| 1 | let __tauri_apps_api_core = require("@tauri-apps/api/core"); |
| 2 | |
| 3 | //#region node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@2.79.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js |
| 4 | function __classPrivateFieldGet(receiver, state, kind, f) { |
| 5 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); |
| 6 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); |
| 7 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); |
| 8 | } |
| 9 | function __classPrivateFieldSet(receiver, state, value, kind, f) { |
| 10 | if (kind === "m") throw new TypeError("Private method is not writable"); |
| 11 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); |
| 12 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); |
| 13 | return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; |
| 14 | } |
| 15 | |
| 16 | //#endregion |
| 17 | //#region guest-js/ads/common.ts |
| 18 | var _MobileAd_created, _MobileAd_init; |
| 19 | async function isPrivacyOptionsRequired() { |
| 20 | return (await (0, __tauri_apps_api_core.invoke)("plugin:admob|isPrivacyOptionsRequired")).isPrivacyOptionsRequired; |
| 21 | } |
| 22 | async function showPrivacyOptionsForm() { |
| 23 | await (0, __tauri_apps_api_core.invoke)("plugin:admob|showPrivacyOptionsForm"); |
| 24 | } |
| 25 | var MobileAd = class MobileAd { |
| 26 | constructor(opts) { |
| 27 | _MobileAd_created.set(this, false); |
| 28 | _MobileAd_init.set(this, null); |
| 29 | this.opts = opts; |
| 30 | this.id = MobileAd.nextId(); |
| 31 | MobileAd.allAdds[this.id] = this; |
| 32 | } |
| 33 | static nextId() { |
| 34 | return MobileAd.idCounter++; |
| 35 | } |
| 36 | get adUnitId() { |
| 37 | return this.opts.adUnitId; |
| 38 | } |
| 39 | async isLoaded() { |
| 40 | await this.init(); |
| 41 | return await (0, __tauri_apps_api_core.invoke)("plugin:admob|adIsLoaded", { id: this.id }); |
| 42 | } |
| 43 | async load() { |
| 44 | await this.init(); |
| 45 | await (0, __tauri_apps_api_core.invoke)("plugin:admob|adLoad", { |
| 46 | ...this.opts, |
| 47 | id: this.id |
| 48 | }); |
| 49 | } |
| 50 | async show() { |
| 51 | await this.init(); |
| 52 | await (0, __tauri_apps_api_core.invoke)("plugin:admob|adShow", { id: this.id }); |
| 53 | } |
| 54 | async hide() { |
| 55 | await this.init(); |
| 56 | await (0, __tauri_apps_api_core.invoke)("plugin:admob|adHide", { id: this.id }); |
| 57 | } |
| 58 | async init() { |
| 59 | if (__classPrivateFieldGet(this, _MobileAd_created, "f")) return; |
| 60 | if (__classPrivateFieldGet(this, _MobileAd_init, "f") === null) { |
| 61 | const cls = this.constructor.cls ?? this.constructor.name; |
| 62 | await (0, __tauri_apps_api_core.invoke)("plugin:admob|adCreate", { |
| 63 | ...this.opts, |
| 64 | id: this.id, |
| 65 | cls |
| 66 | }); |
| 67 | } |
| 68 | await __classPrivateFieldGet(this, _MobileAd_init, "f"); |
| 69 | __classPrivateFieldSet(this, _MobileAd_created, true, "f"); |
| 70 | } |
| 71 | }; |
| 72 | _MobileAd_created = /* @__PURE__ */ new WeakMap(), _MobileAd_init = /* @__PURE__ */ new WeakMap(); |
| 73 | MobileAd.allAdds = {}; |
| 74 | MobileAd.idCounter = 0; |
| 75 | |
| 76 | //#endregion |
| 77 | //#region guest-js/ads/banner.ts |
| 78 | var _BannerAd_loaded; |
| 79 | var BannerAd = class extends MobileAd { |
| 80 | constructor(opts) { |
| 81 | super({ |
| 82 | position: "bottom", |
| 83 | ...opts |
| 84 | }); |
| 85 | _BannerAd_loaded.set(this, false); |
| 86 | } |
| 87 | isLoaded() { |
| 88 | return super.isLoaded(); |
| 89 | } |
| 90 | async load() { |
| 91 | await super.load(); |
| 92 | __classPrivateFieldSet(this, _BannerAd_loaded, true, "f"); |
| 93 | } |
| 94 | async show() { |
| 95 | if (!__classPrivateFieldGet(this, _BannerAd_loaded, "f")) await this.load(); |
| 96 | await super.show(); |
| 97 | } |
| 98 | hide() { |
| 99 | return super.hide(); |
| 100 | } |
| 101 | }; |
| 102 | _BannerAd_loaded = /* @__PURE__ */ new WeakMap(); |
| 103 | BannerAd.cls = "BannerAd"; |
| 104 | |
| 105 | //#endregion |
| 106 | //#region guest-js/ads/interstitial.ts |
| 107 | var InterstitialAd = class extends MobileAd { |
| 108 | isLoaded() { |
| 109 | return super.isLoaded(); |
| 110 | } |
| 111 | async load() { |
| 112 | return super.load(); |
| 113 | } |
| 114 | async show() { |
| 115 | return super.show(); |
| 116 | } |
| 117 | }; |
| 118 | InterstitialAd.cls = "InterstitialAd"; |
| 119 | |
| 120 | //#endregion |
| 121 | //#region guest-js/ads/rewarded.ts |
| 122 | var RewardedAd = class extends MobileAd { |
| 123 | isLoaded() { |
| 124 | return super.isLoaded(); |
| 125 | } |
| 126 | async load() { |
| 127 | return super.load(); |
| 128 | } |
| 129 | async show() { |
| 130 | return super.show(); |
| 131 | } |
| 132 | async onRewarded(handler) { |
| 133 | return await (0, __tauri_apps_api_core.addPluginListener)("admob", "rewarded_reward", handler); |
| 134 | } |
| 135 | }; |
| 136 | RewardedAd.cls = "RewardedAd"; |
| 137 | async function onRewarded(handler) { |
| 138 | return await (0, __tauri_apps_api_core.addPluginListener)("admob", "rewarded/reward", handler); |
| 139 | } |
| 140 | var RewardedInterstitialAd = class extends MobileAd { |
| 141 | isLoaded() { |
| 142 | return super.isLoaded(); |
| 143 | } |
| 144 | async load() { |
| 145 | return super.load(); |
| 146 | } |
| 147 | async show() { |
| 148 | return super.show(); |
| 149 | } |
| 150 | }; |
| 151 | RewardedInterstitialAd.cls = "RewardedInterstitialAd"; |
| 152 | |
| 153 | //#endregion |
| 154 | exports.BannerAd = BannerAd; |
| 155 | exports.InterstitialAd = InterstitialAd; |
| 156 | exports.MobileAd = MobileAd; |
| 157 | exports.RewardedAd = RewardedAd; |
| 158 | exports.RewardedInterstitialAd = RewardedInterstitialAd; |
| 159 | exports.isPrivacyOptionsRequired = isPrivacyOptionsRequired; |
| 160 | exports.onRewarded = onRewarded; |
| 161 | exports.showPrivacyOptionsForm = showPrivacyOptionsForm; |