@jolibox/implement 1.3.5-beta.10 → 1.3.5-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
|
|
5
5
|
"packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
|
|
6
6
|
"packages/implement/esbuild.config.js": "876db4e384d8543b66a0b61d8f7b277a36dfb4e0",
|
|
7
|
-
"packages/implement/package.json": "
|
|
7
|
+
"packages/implement/package.json": "714c5c35ee77bd6b383d29bf4d1cac1d3fb7e6c1",
|
|
8
8
|
"packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
|
|
9
9
|
"packages/implement/src/common/ads/anti-cheating.test.ts": "e2ff3dc6760cfd28d0f8c15703d7fb20d43df583",
|
|
10
10
|
"packages/implement/src/common/ads/anti-cheating.ts": "a3ffb6a78e289e1c0ce45c7f7c0cee000e75e541",
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Hf=Object.create;var Wi=Object.defineProperty,qf=Object.defineProperties,Vf=Object.getOwnPropertyDescriptor,$f=Object.getOwnPropertyDescriptors,Kf=Object.getOwnPropertyNames,nn=Object.getOwnPropertySymbols,Ks=Object.getPrototypeOf,zi=Object.prototype.hasOwnProperty,Ws=Object.prototype.propertyIsEnumerable,Wf=Reflect.get;var $s=(e,t,r)=>t in e?Wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,z=(e,t)=>{for(var r in t||(t={}))zi.call(t,r)&&$s(e,r,t[r]);if(nn)for(var r of nn(t))Ws.call(t,r)&&$s(e,r,t[r]);return e},Re=(e,t)=>qf(e,$f(t));var gr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var zs=(e,t)=>{var r={};for(var n in e)zi.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nn)for(var n of nn(e))t.indexOf(n)<0&&Ws.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kf(t))!zi.call(e,i)&&i!==r&&Wi(e,i,{get:()=>t[i],enumerable:!(n=Vf(t,i))||n.enumerable});return e};var Xi=(e,t,r)=>(r=e!=null?Hf(Ks(e)):{},zf(t||!e||!e.__esModule?Wi(r,"default",{value:e,enumerable:!0}):r,e));var Ys=(e,t,r)=>Wf(Ks(e),r,t);var A=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function nh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function oa(e){return typeof e=="string"}function nl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function il(e){return typeof e=="object"&&Array.isArray(e)}function ih(e){return typeof e=="undefined"}function ah(e){return ih(e)||e===null}function oh(e){return typeof e=="function"}function al(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function ol(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,a){for(let o in a)if(Object.prototype.hasOwnProperty.call(a,o)){let s=i[o],l=a[o],c=r(s,l,o,i,a);c!==void 0?i[o]=c:Zs(l)&&Zs(s)?i[o]=n(aa({},s),l):Array.isArray(l)&&Array.isArray(s)?i[o]=[...s,...l]:i[o]=l}return i}return n(e,t)}function Zs(e){return e&&typeof e=="object"&&e.constructor===Object}function sl(e,t){if(Array.isArray(e))return e.concat(t)}function wr(e,t,r={}){let n=null,i,a,o,{leading:s=!1,trailing:l=!0}=r,c=()=>(o=e.apply(a,i),i=void 0,a=void 0,o),p=function(...u){i=u,a=this;let m=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!m&&c()},t),m)return c()};return p.cancel=()=>{n&&clearTimeout(n),n=null,i=a=void 0},p.flush=()=>{if(n)return clearTimeout(n),n=null,c()},p}function ch(e,t){return(...r)=>t(e,...r)}function ul(e){return t=>ch(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new lh(`${i}`))}})}function _r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function an(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,a)=>(i[a]=String(n[a]),i),{})}return e[r]})}function ph(e){let t=e.location?an(e.location,tl):null,r=e.target?an(e.target,tl):null;return an(th(aa({},e),{location:t,target:r}),hh)}function ua(e){let t=e.events.map(n=>ph(n)),r=an(e.device,mh);return[e.protocolVersion,t,r,e.project]}function vh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function ma(e,t,r){let n=window.location.hostname,i=n.split("."),a=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${a}.jolibox.com`;if(i.length>=2){let o=i.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com"||o==="mporia.com"||o==="pingplus.ai")return`${a}.${o}`}return`${a}.jolibox.com`}function ml(e){return ma("app","stg-app",e)}function Kt(e){return`https://${ma("api","stg-api",e)}`}function Ih(e){return ma("collect","stg-collect",e)}function pl(e){return`https://${Ih(e)}`}function Rh(e){return new Promise(t=>vl(e)(t))}function vl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Oh(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new br(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function Th(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xh(e[n],t[n])}function xh(e,t){if(oa(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(oh(t)){try{if(e instanceof t)return}catch(r){}if(!ah(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function Ph(){return typeof globalThis!="undefined"?globalThis[gl]:void 0}function Nh(e){typeof globalThis!="undefined"&&(globalThis[gl]=e)}function we(e=!1){let t=Ph();if(!e&&t)return t;let r=new on,n=new na,i={registerCommand(a,o,s){r.registerCommand({id:a,handler:o,metadata:s})},executeCommand(a,...o){return n.executeCommand(a,...o)},excuteCommandSync(a,...o){return n.executeCommandThowErr(a,...o)}};return Nh(i),i}var ia,Yf,Xf,Qf,Xs,Zf,eh,Qs,aa,th,rh,rl,Ot,sh,sa,la,ll,cl,lh,dl,sn,ln,ca,Be,Zi,dh,da,el,uh,kt,$t,fh,tl,hh,mh,$e,Vt,gh,Oe,_h,yh,bh,fl,fa,ha,wh,Eh,hl,Tt,ea,ae,Ah,Sh,yr,br,ze,ra,Ch,Qi,kh,bt,on,na,gl,q=re(()=>{"use strict";ia=Object.defineProperty,Yf=Object.defineProperties,Xf=Object.getOwnPropertyDescriptor,Qf=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable,Qs=(e,t,r)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aa=(e,t)=>{for(var r in t||(t={}))Zf.call(t,r)&&Qs(e,r,t[r]);if(Xs)for(var r of Xs(t))eh.call(t,r)&&Qs(e,r,t[r]);return e},th=(e,t)=>Yf(e,Qf(t)),rh=(e,t)=>{for(var r in t)ia(e,r,{get:t[r],enumerable:!0})},rl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Xf(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ia(t,r,i),i},Ot=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}sh=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(sh||{}),sa=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},la=class extends sa{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},ll=class extends sa{constructor(){super(...arguments),this.kind="USER_ERROR"}},cl=class extends ll{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},lh=class extends ll{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},dl=class extends la{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},sn=class extends la{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},ln=class extends sa{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},ca=class extends la{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Be={log:_r("log"),warn:_r("warn"),info:_r("info"),error:_r("error"),debug:_r("debug")};Object.assign(globalThis,{logger:Be});Zi=Symbol.for("Jolibox.canIUseMap"),dh={};globalThis[Zi]||(globalThis[Zi]=dh);da={get config(){return globalThis[Zi]}},el=Symbol.for("Jolibox.canIUseMap.native"),uh={};globalThis[el]||(globalThis[el]=uh);kt=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(kt||{}),$t=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))($t||{}),fh=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(fh||{}),tl=["name","params"],hh=["name","type","location","target","extra","timestamp","userId"],mh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];$e=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});vh();Vt=typeof window=="undefined",gh=()=>!Vt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Oe={isiOS:!Vt&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:!Vt&&navigator.userAgent.includes("Android"),isMac:!Vt&&navigator.userAgent.includes("Mac"),isFacebook:!Vt&&navigator.userAgent.includes("FB_IAB"),isPC:!Vt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},_h=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",yh="device_id",bh="advertising_id",fl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,$e()),window.__joliboxLocalStorage__.getItem(e)),fa=()=>new URLSearchParams(window.location.search).get("deviceId")||fl(yh),ha=()=>new URLSearchParams(window.location.search).get("advertisingId")||fl(bh),wh=e=>e.charAt(0).toUpperCase()+e.slice(1),Eh=()=>{var e;let t=new URLSearchParams(window.location.search);return wh((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},hl=e=>{if(gh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=_h(),n=navigator.language,i=fa(),a=ha();return`${t} (${Eh()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${a} version/${e||""}`};Tt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=aa({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),a=this.createTimeoutPromise(),o=Promise.race([i,a]).catch(s=>Ot(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,o),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield o}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Ot(this,null,function*(){var r,n,i,a;let o=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(o);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),m=this.requestAdapter.extractRealTimeData(u),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(o,h,s),u):this.requestAdapter.mergeData(l,m)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),p=(a=(i=this.requestAdapter).extractCacheableData)==null?void 0:a.call(i,c);return p&&this.setCachedDataWithSequence(o,p,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let a=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:a,expiresAt:a+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Ot(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),a=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${a})`);let o=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,o);return s&&(this.setCachedDataWithSequence(i,s,a),console.log(`[RequestCacheService] Force updated cache for ${e}`)),o})}warmupCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},ea=class ta{constructor(t){this.element=t,this.next=ta.Undefined,this.prev=ta.Undefined}};ea.Undefined=new ea(void 0);ae=ea,Ah=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},Sh=0,yr=class{constructor(e){this.value=e,this.id=Sh++}},br=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof yr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,a,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new yr(t);return this._listeners?this._listeners instanceof yr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(o=(a=this.options)==null?void 0:a.onDidFirstListener)==null||o.call(a,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var p,u,m,h;if(!this._disposed){if(this._listeners instanceof yr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||u.call(p));else if(this._listeners){let w=this._listeners.indexOf(c);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((h=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||h.call(m)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof yr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ze=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new br,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new Ah,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},ra={};rh(ra,{None:()=>Ch,filter:()=>Oh,once:()=>vl,toPromise:()=>Rh});Ch=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Qi=Symbol.for("Jolibox.hostEmitter"),kh=()=>{let e=new ze;return globalThis[Qi]||(globalThis[Qi]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Qi]},bt=kh();on=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new br,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return Th(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};on=rl([al],on);na=class{constructor(){this._onWillExecuteCommand=new br,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new br,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new on,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nh(3e4)),this._starActivation}executeCommand(e,...t){return Ot(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ra.toPromise(ra.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};na=rl([al],na);gl=Symbol.for("Jolibox.commands")});function Me(e,t={}){pa.emit("ERROR_REPORT",{error:e,options:t})}var pa,xt,rt=re(()=>{"use strict";q();q();pa=new ze,xt=new ze;Me.debounce=wr(Me,50,{leading:!0})});var va,Dh,_l,yl,bl=re(()=>{"use strict";q();rt();va=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},Dh=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},_l=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[a,o,s]=i;return{headerJson:va(a),payloadJson:va(o),signature:va(s)}}else throw"joli_source is missing"}catch(r){return Me(new dl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},yl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Dh(e),a=r[2];return`${n}.${i}.${a}`}return t}});var Lh,cn,wl,ga=re(()=>{"use strict";q();Lh="1.3.5-beta.10",cn=()=>Lh,wl=()=>{let e=cn();return`${hl(e)}`}});function ya(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var Uh,El,_a,Il,oe,Bh,L,he=re(()=>{"use strict";q();bl();ga();q();Uh={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:fa(),adId:ha(),pixelRatio:window.devicePixelRatio||1,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:cn()},schema:window.location.href,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5"},_a=(El=globalThis.joliboxJSCore)==null?void 0:El.env,oe=Object.assign({},(Il=_a==null?void 0:_a())!=null?Il:Uh);Bh=()=>{var E,I,b,R,k,D,J,S,N,F,H;let{payloadJson:e,headerJson:t,signature:r}=oe.schema.length?_l(oe.schema):{},n=`${oe.deviceInfo.did}-${new Date().getTime()}`,a=new URL(oe.schema.length?oe.schema:window.location.href).searchParams,o=(b=(I=(E=a.get("mpId"))!=null?E:a.get("appId"))!=null?I:a.get("gameId"))!=null?b:"",s=(D=(k=(R=oe.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?k:a.get("sessionId"))!=null?D:n,l=!!((S=(J=e==null?void 0:e.testAdsMode)!=null?J:e==null?void 0:e.__testAdsMode)!=null?S:a.get("testAdsMode")==="true"),c=(H=(F=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?F:a.get("joliboxEnv"))!=null?H:"production",p=c==="staging",u=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,w=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return p},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=h.get("joliSource"))!=null?U:a.get("joliSource"))!=null?G:null},get mpId(){var U;return(U=o!=null?o:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:cn()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=oe.platform)!=null?U:oe.deviceInfo.platform).toLowerCase()},get deviceInfo(){return oe.deviceInfo},get sdkInfo(){return oe.sdkInfo},get hostInfo(){return oe.hostInfo},get hostUserInfo(){return oe.hostUserInfo},get sessionId(){var U,G;return(G=(U=oe.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return u},get webviewId(){var U;return(U=oe.webviewId)!=null?U:-1},get shouldInterupt(){return w},get from(){return e==null?void 0:e.__from},get baseApiHost(){return ml(p)},get adId(){var U;return(U=oe.deviceInfo.adId)!=null?U:oe.deviceInfo.did},get language(){return oe.deviceInfo.lang},get sdkEnvironment(){return ya("dlightek","jolibox")?"dlightek":a.get("huaweiQuick")==="true"?"huaweiQuick":ya("gamedistribution","jolibox")?"gamedistribution":ya("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var $,Y,Ue;let U=($=oe.deviceInfo.pixelRatio)!=null?$:1,G=(Y=oe.deviceInfo.statusBarHeight)!=null?Y:e==null?void 0:e.__androidStatusBarHeight,B=(Ue=oe.deviceInfo.navigationBarHeight)!=null?Ue:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:B!==void 0?B/U:10}},get abTests(){var U,G;return(G=(U=oe.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=oe.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{ol(oe,U,sl)},encodeJoliSourceQuery:U=>{var G,B;return t&&r?yl(z(z({},e),U),(G=a.get("joliSource"))!=null?G:""):(B=a.get("joliSource"))!=null?B:""},setDoExitDirectly:()=>{w=!1}}},L=Bh()});var ba,Sl,Mh,Gh,Al,Jh,Cl=re(()=>{"use strict";q();rt();he();q();ba=!1,Sl=(e,t)=>e==null?!1:t in e,Mh=e=>Sl(e,"kind"),Gh=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Al=(e,t={},r)=>{var a,o,s;let n={user_id:(o=(a=L.hostUserInfo)==null?void 0:a.uid)!=null?o:"",device_id:(s=L.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:Gh(e.name)},i=Re(z({},n),{env:t.environment,isFromUser:r});r?xt.emit("GLOBAL_USER_ERROR",e,i):xt.emit("GLOBAL_ERROR",e,i)},Jh=e=>Sl(e,"kind")&&e.kind==="USER_ERROR";pa.on("ERROR_REPORT",({error:e,options:t})=>{if(ba)return;ba=!0;let r=Mh(e)&&e.raw?e.raw:e;try{let n=Jh(e);Al(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),a=new ca(`${i}, origin error: ${r.message}`);Be.error(a),Al(new ca(a.message),{environment:t.environment},!1)}finally{ba=!1}})});var wa,Ea=re(()=>{"use strict";rt();q();rt();wa=e=>new cl(e)});function Rl(e,t){let r=(n,i,a)=>{let c=i!=null?i:{},{eventType:o}=c,s=zs(c,["eventType"]),l=Re(z({tag:n,eventType:a!=null?a:o!=null?o:kt.Other},t),{extra:z({},s)});n=="globalJsError"?Me(new sn(JSON.stringify(l))):e("systemLog",l,L.webviewId)};return r.debounce=wr(r,500,{leading:!0}),r}function Ol(e){let t=(r,n,i)=>{var s;let a=(s=i&&JSON.stringify(i))!=null?s:0,o={speed_value_type:r,total_duration:n};a&&Object.assign(o,{extra:a}),e("joliboxSpeedAnalysis",o)};return t.debounce=wr(t,500,{leading:!0}),t}var kl=re(()=>{"use strict";q();q();rt();he()});function Tl(e,t){let r=Rl(e,t),n=Ol(r);return{track:r,trackPerformance:n}}var xl=re(()=>{"use strict";kl()});var Ia=re(()=>{"use strict"});var dn,Pl=re(()=>{"use strict";he();q();q();dn=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return A(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,a,o,s;let{nativeSDKVersion:t,jssdkVersion:r}=L.sdkInfo;return{platform:1e3,os:L.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(a=(i=L.hostInfo)==null?void 0:i.aid)!=null?a:"1",model:(o=L.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=L.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:L.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return A(this,null,function*(){if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),a=t.target||null,o=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let s=this.deviceInfo,c={protocolVersion:"1.0.0",events:[Re(z({},t),{location:i,target:a,extra:o,timestamp:Date.now(),userId:null})],device:s,project:r};try{n?yield this.doReport(ua(c),n):yield this.doReport(ua(c))}catch(p){Be.log("[Jolibox SDK] report API error",p)}})}}});var Aa=re(()=>{"use strict";xl();Ia();Pl()});var Sa,Nl,nt,un,Ke,Wt=re(()=>{"use strict";ga();he();q();Sa=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Nl=AbortSignal.timeout)!=null||(AbortSignal.timeout=Sa);nt=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new un(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},un=class{constructor(t){this.xua=wl();this.getJoliSource=()=>L.joliSource;var n;let r=Kt(L.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return A(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:a}=r!=null?r:{},o=n?new URLSearchParams(n):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,p=this.getJoliSource();a=Object.assign({},a!=null?a:{},c?{"x-user-agent":c}:{},p?{"x-joli-source":p}:{});let u=yield fetch(l,{method:"GET",headers:a,credentials:"include",signal:Sa(i!=null?i:3e4)});return nt.getInstance().recordNetworkRequest(!0),yield u.json()}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{},{"x-os-type":Oe.isAndroid?"ANDROID":Oe.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let m=yield fetch(c,{method:"POST",headers:o,body:JSON.stringify(n),signal:Sa(a!=null?a:3e4),credentials:"include"});nt.getInstance().recordNetworkRequest(!0);let h=m.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return m.blob()}catch(w){return yield m.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return m.formData()}catch(w){return yield m.text()}if(h!=null&&h.includes("application/json"))try{return yield m.json()}catch(w){return yield m.text()}return m}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{});let m=yield fetch(c,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!m.ok)throw nt.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${m.status}`);return nt.getInstance().recordNetworkRequest(!0),yield m.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=un;Ke=nt.getInstance()});var Ca,fn,Ra=re(()=>{"use strict";he();Aa();Wt();q();Ca=class extends dn{constructor(){super(...arguments);this.httpClient=Ke.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return pl((r=L.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},fn=new Ca(Kt(L.testMode))});var Fh,Dl=re(()=>{"use strict";Cl();q();Ea();q();Ra();he();Fh=(e,t)=>{var i,a,o;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:kt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(a=L.hostUserInfo)==null?void 0:a.uid)!=null?o:null};fn.trackEvent(n,$t.WebSDK)};xt.on("GLOBAL_ERROR",(e,t)=>{Fh(t.tag,e)});xt.on("GLOBAL_USER_ERROR",(e,t)=>{Be.log("UserError",e,t)})});var hn,Ll=re(()=>{"use strict";hn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(t)});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,a=!1,o=0,s=()=>{if(!a)return;let h=Date.now(),w=h-r;w>=this.interval&&(this.visible&&(o+=Math.min(w,this.interval+1e3),t(o)),r=h),n=requestAnimationFrame(s)},l=()=>{p(),r=Date.now(),i=window.setInterval(()=>{if(!a)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},p=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{a&&(console.log("visible",h),h?c():l())});let m=this.visible;return{start(){a||(a=!0,m?c():l())},stop(){a=!1,p(),u()}}}}});var Ul,Bl=re(()=>{"use strict";Ul=`-----BEGIN PUBLIC KEY-----
|
|
1
|
+
var Hf=Object.create;var Wi=Object.defineProperty,qf=Object.defineProperties,Vf=Object.getOwnPropertyDescriptor,$f=Object.getOwnPropertyDescriptors,Kf=Object.getOwnPropertyNames,nn=Object.getOwnPropertySymbols,Ks=Object.getPrototypeOf,zi=Object.prototype.hasOwnProperty,Ws=Object.prototype.propertyIsEnumerable,Wf=Reflect.get;var $s=(e,t,r)=>t in e?Wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,z=(e,t)=>{for(var r in t||(t={}))zi.call(t,r)&&$s(e,r,t[r]);if(nn)for(var r of nn(t))Ws.call(t,r)&&$s(e,r,t[r]);return e},Re=(e,t)=>qf(e,$f(t));var gr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var zs=(e,t)=>{var r={};for(var n in e)zi.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nn)for(var n of nn(e))t.indexOf(n)<0&&Ws.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kf(t))!zi.call(e,i)&&i!==r&&Wi(e,i,{get:()=>t[i],enumerable:!(n=Vf(t,i))||n.enumerable});return e};var Xi=(e,t,r)=>(r=e!=null?Hf(Ks(e)):{},zf(t||!e||!e.__esModule?Wi(r,"default",{value:e,enumerable:!0}):r,e));var Ys=(e,t,r)=>Wf(Ks(e),r,t);var A=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function nh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function oa(e){return typeof e=="string"}function nl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function il(e){return typeof e=="object"&&Array.isArray(e)}function ih(e){return typeof e=="undefined"}function ah(e){return ih(e)||e===null}function oh(e){return typeof e=="function"}function al(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function ol(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,a){for(let o in a)if(Object.prototype.hasOwnProperty.call(a,o)){let s=i[o],l=a[o],c=r(s,l,o,i,a);c!==void 0?i[o]=c:Zs(l)&&Zs(s)?i[o]=n(aa({},s),l):Array.isArray(l)&&Array.isArray(s)?i[o]=[...s,...l]:i[o]=l}return i}return n(e,t)}function Zs(e){return e&&typeof e=="object"&&e.constructor===Object}function sl(e,t){if(Array.isArray(e))return e.concat(t)}function wr(e,t,r={}){let n=null,i,a,o,{leading:s=!1,trailing:l=!0}=r,c=()=>(o=e.apply(a,i),i=void 0,a=void 0,o),p=function(...u){i=u,a=this;let m=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!m&&c()},t),m)return c()};return p.cancel=()=>{n&&clearTimeout(n),n=null,i=a=void 0},p.flush=()=>{if(n)return clearTimeout(n),n=null,c()},p}function ch(e,t){return(...r)=>t(e,...r)}function ul(e){return t=>ch(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new lh(`${i}`))}})}function _r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function an(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,a)=>(i[a]=String(n[a]),i),{})}return e[r]})}function ph(e){let t=e.location?an(e.location,tl):null,r=e.target?an(e.target,tl):null;return an(th(aa({},e),{location:t,target:r}),hh)}function ua(e){let t=e.events.map(n=>ph(n)),r=an(e.device,mh);return[e.protocolVersion,t,r,e.project]}function vh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function ma(e,t,r){let n=window.location.hostname,i=n.split("."),a=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${a}.jolibox.com`;if(i.length>=2){let o=i.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com"||o==="mporia.com"||o==="pingplus.ai")return`${a}.${o}`}return`${a}.jolibox.com`}function ml(e){return ma("app","stg-app",e)}function Kt(e){return`https://${ma("api","stg-api",e)}`}function Ih(e){return ma("collect","stg-collect",e)}function pl(e){return`https://${Ih(e)}`}function Rh(e){return new Promise(t=>vl(e)(t))}function vl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Oh(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new br(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function Th(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xh(e[n],t[n])}function xh(e,t){if(oa(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(oh(t)){try{if(e instanceof t)return}catch(r){}if(!ah(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function Ph(){return typeof globalThis!="undefined"?globalThis[gl]:void 0}function Nh(e){typeof globalThis!="undefined"&&(globalThis[gl]=e)}function we(e=!1){let t=Ph();if(!e&&t)return t;let r=new on,n=new na,i={registerCommand(a,o,s){r.registerCommand({id:a,handler:o,metadata:s})},executeCommand(a,...o){return n.executeCommand(a,...o)},excuteCommandSync(a,...o){return n.executeCommandThowErr(a,...o)}};return Nh(i),i}var ia,Yf,Xf,Qf,Xs,Zf,eh,Qs,aa,th,rh,rl,Ot,sh,sa,la,ll,cl,lh,dl,sn,ln,ca,Be,Zi,dh,da,el,uh,kt,$t,fh,tl,hh,mh,$e,Vt,gh,Oe,_h,yh,bh,fl,fa,ha,wh,Eh,hl,Tt,ea,ae,Ah,Sh,yr,br,ze,ra,Ch,Qi,kh,bt,on,na,gl,q=re(()=>{"use strict";ia=Object.defineProperty,Yf=Object.defineProperties,Xf=Object.getOwnPropertyDescriptor,Qf=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable,Qs=(e,t,r)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aa=(e,t)=>{for(var r in t||(t={}))Zf.call(t,r)&&Qs(e,r,t[r]);if(Xs)for(var r of Xs(t))eh.call(t,r)&&Qs(e,r,t[r]);return e},th=(e,t)=>Yf(e,Qf(t)),rh=(e,t)=>{for(var r in t)ia(e,r,{get:t[r],enumerable:!0})},rl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Xf(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ia(t,r,i),i},Ot=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}sh=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(sh||{}),sa=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},la=class extends sa{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},ll=class extends sa{constructor(){super(...arguments),this.kind="USER_ERROR"}},cl=class extends ll{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},lh=class extends ll{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},dl=class extends la{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},sn=class extends la{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},ln=class extends sa{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},ca=class extends la{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Be={log:_r("log"),warn:_r("warn"),info:_r("info"),error:_r("error"),debug:_r("debug")};Object.assign(globalThis,{logger:Be});Zi=Symbol.for("Jolibox.canIUseMap"),dh={};globalThis[Zi]||(globalThis[Zi]=dh);da={get config(){return globalThis[Zi]}},el=Symbol.for("Jolibox.canIUseMap.native"),uh={};globalThis[el]||(globalThis[el]=uh);kt=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(kt||{}),$t=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))($t||{}),fh=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(fh||{}),tl=["name","params"],hh=["name","type","location","target","extra","timestamp","userId"],mh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];$e=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});vh();Vt=typeof window=="undefined",gh=()=>!Vt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Oe={isiOS:!Vt&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:!Vt&&navigator.userAgent.includes("Android"),isMac:!Vt&&navigator.userAgent.includes("Mac"),isFacebook:!Vt&&navigator.userAgent.includes("FB_IAB"),isPC:!Vt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},_h=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",yh="device_id",bh="advertising_id",fl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,$e()),window.__joliboxLocalStorage__.getItem(e)),fa=()=>new URLSearchParams(window.location.search).get("deviceId")||fl(yh),ha=()=>new URLSearchParams(window.location.search).get("advertisingId")||fl(bh),wh=e=>e.charAt(0).toUpperCase()+e.slice(1),Eh=()=>{var e;let t=new URLSearchParams(window.location.search);return wh((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},hl=e=>{if(gh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=_h(),n=navigator.language,i=fa(),a=ha();return`${t} (${Eh()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${a} version/${e||""}`};Tt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=aa({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),a=this.createTimeoutPromise(),o=Promise.race([i,a]).catch(s=>Ot(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,o),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield o}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Ot(this,null,function*(){var r,n,i,a;let o=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(o);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),m=this.requestAdapter.extractRealTimeData(u),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(o,h,s),u):this.requestAdapter.mergeData(l,m)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),p=(a=(i=this.requestAdapter).extractCacheableData)==null?void 0:a.call(i,c);return p&&this.setCachedDataWithSequence(o,p,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let a=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:a,expiresAt:a+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Ot(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),a=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${a})`);let o=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,o);return s&&(this.setCachedDataWithSequence(i,s,a),console.log(`[RequestCacheService] Force updated cache for ${e}`)),o})}warmupCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},ea=class ta{constructor(t){this.element=t,this.next=ta.Undefined,this.prev=ta.Undefined}};ea.Undefined=new ea(void 0);ae=ea,Ah=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},Sh=0,yr=class{constructor(e){this.value=e,this.id=Sh++}},br=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof yr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,a,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new yr(t);return this._listeners?this._listeners instanceof yr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(o=(a=this.options)==null?void 0:a.onDidFirstListener)==null||o.call(a,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var p,u,m,h;if(!this._disposed){if(this._listeners instanceof yr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||u.call(p));else if(this._listeners){let w=this._listeners.indexOf(c);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((h=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||h.call(m)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof yr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ze=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new br,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new Ah,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},ra={};rh(ra,{None:()=>Ch,filter:()=>Oh,once:()=>vl,toPromise:()=>Rh});Ch=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Qi=Symbol.for("Jolibox.hostEmitter"),kh=()=>{let e=new ze;return globalThis[Qi]||(globalThis[Qi]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Qi]},bt=kh();on=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new br,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return Th(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};on=rl([al],on);na=class{constructor(){this._onWillExecuteCommand=new br,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new br,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new on,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nh(3e4)),this._starActivation}executeCommand(e,...t){return Ot(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ra.toPromise(ra.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};na=rl([al],na);gl=Symbol.for("Jolibox.commands")});function Me(e,t={}){pa.emit("ERROR_REPORT",{error:e,options:t})}var pa,xt,rt=re(()=>{"use strict";q();q();pa=new ze,xt=new ze;Me.debounce=wr(Me,50,{leading:!0})});var va,Dh,_l,yl,bl=re(()=>{"use strict";q();rt();va=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},Dh=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},_l=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[a,o,s]=i;return{headerJson:va(a),payloadJson:va(o),signature:va(s)}}else throw"joli_source is missing"}catch(r){return Me(new dl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},yl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Dh(e),a=r[2];return`${n}.${i}.${a}`}return t}});var Lh,cn,wl,ga=re(()=>{"use strict";q();Lh="1.3.5-beta.11",cn=()=>Lh,wl=()=>{let e=cn();return`${hl(e)}`}});function ya(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var Uh,El,_a,Il,oe,Bh,L,he=re(()=>{"use strict";q();bl();ga();q();Uh={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:fa(),adId:ha(),pixelRatio:window.devicePixelRatio||1,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:cn()},schema:window.location.href,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5"},_a=(El=globalThis.joliboxJSCore)==null?void 0:El.env,oe=Object.assign({},(Il=_a==null?void 0:_a())!=null?Il:Uh);Bh=()=>{var E,I,b,R,k,D,J,S,N,F,H;let{payloadJson:e,headerJson:t,signature:r}=oe.schema.length?_l(oe.schema):{},n=`${oe.deviceInfo.did}-${new Date().getTime()}`,a=new URL(oe.schema.length?oe.schema:window.location.href).searchParams,o=(b=(I=(E=a.get("mpId"))!=null?E:a.get("appId"))!=null?I:a.get("gameId"))!=null?b:"",s=(D=(k=(R=oe.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?k:a.get("sessionId"))!=null?D:n,l=!!((S=(J=e==null?void 0:e.testAdsMode)!=null?J:e==null?void 0:e.__testAdsMode)!=null?S:a.get("testAdsMode")==="true"),c=(H=(F=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?F:a.get("joliboxEnv"))!=null?H:"production",p=c==="staging",u=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,w=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return p},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=h.get("joliSource"))!=null?U:a.get("joliSource"))!=null?G:null},get mpId(){var U;return(U=o!=null?o:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:cn()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=oe.platform)!=null?U:oe.deviceInfo.platform).toLowerCase()},get deviceInfo(){return oe.deviceInfo},get sdkInfo(){return oe.sdkInfo},get hostInfo(){return oe.hostInfo},get hostUserInfo(){return oe.hostUserInfo},get sessionId(){var U,G;return(G=(U=oe.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return u},get webviewId(){var U;return(U=oe.webviewId)!=null?U:-1},get shouldInterupt(){return w},get from(){return e==null?void 0:e.__from},get baseApiHost(){return ml(p)},get adId(){var U;return(U=oe.deviceInfo.adId)!=null?U:oe.deviceInfo.did},get language(){return oe.deviceInfo.lang},get sdkEnvironment(){return ya("dlightek","jolibox")?"dlightek":a.get("huaweiQuick")==="true"?"huaweiQuick":ya("gamedistribution","jolibox")?"gamedistribution":ya("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var $,Y,Ue;let U=($=oe.deviceInfo.pixelRatio)!=null?$:1,G=(Y=oe.deviceInfo.statusBarHeight)!=null?Y:e==null?void 0:e.__androidStatusBarHeight,B=(Ue=oe.deviceInfo.navigationBarHeight)!=null?Ue:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:B!==void 0?B/U:10}},get abTests(){var U,G;return(G=(U=oe.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=oe.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{ol(oe,U,sl)},encodeJoliSourceQuery:U=>{var G,B;return t&&r?yl(z(z({},e),U),(G=a.get("joliSource"))!=null?G:""):(B=a.get("joliSource"))!=null?B:""},setDoExitDirectly:()=>{w=!1}}},L=Bh()});var ba,Sl,Mh,Gh,Al,Jh,Cl=re(()=>{"use strict";q();rt();he();q();ba=!1,Sl=(e,t)=>e==null?!1:t in e,Mh=e=>Sl(e,"kind"),Gh=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Al=(e,t={},r)=>{var a,o,s;let n={user_id:(o=(a=L.hostUserInfo)==null?void 0:a.uid)!=null?o:"",device_id:(s=L.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:Gh(e.name)},i=Re(z({},n),{env:t.environment,isFromUser:r});r?xt.emit("GLOBAL_USER_ERROR",e,i):xt.emit("GLOBAL_ERROR",e,i)},Jh=e=>Sl(e,"kind")&&e.kind==="USER_ERROR";pa.on("ERROR_REPORT",({error:e,options:t})=>{if(ba)return;ba=!0;let r=Mh(e)&&e.raw?e.raw:e;try{let n=Jh(e);Al(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),a=new ca(`${i}, origin error: ${r.message}`);Be.error(a),Al(new ca(a.message),{environment:t.environment},!1)}finally{ba=!1}})});var wa,Ea=re(()=>{"use strict";rt();q();rt();wa=e=>new cl(e)});function Rl(e,t){let r=(n,i,a)=>{let c=i!=null?i:{},{eventType:o}=c,s=zs(c,["eventType"]),l=Re(z({tag:n,eventType:a!=null?a:o!=null?o:kt.Other},t),{extra:z({},s)});n=="globalJsError"?Me(new sn(JSON.stringify(l))):e("systemLog",l,L.webviewId)};return r.debounce=wr(r,500,{leading:!0}),r}function Ol(e){let t=(r,n,i)=>{var s;let a=(s=i&&JSON.stringify(i))!=null?s:0,o={speed_value_type:r,total_duration:n};a&&Object.assign(o,{extra:a}),e("joliboxSpeedAnalysis",o)};return t.debounce=wr(t,500,{leading:!0}),t}var kl=re(()=>{"use strict";q();q();rt();he()});function Tl(e,t){let r=Rl(e,t),n=Ol(r);return{track:r,trackPerformance:n}}var xl=re(()=>{"use strict";kl()});var Ia=re(()=>{"use strict"});var dn,Pl=re(()=>{"use strict";he();q();q();dn=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return A(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,a,o,s;let{nativeSDKVersion:t,jssdkVersion:r}=L.sdkInfo;return{platform:1e3,os:L.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(a=(i=L.hostInfo)==null?void 0:i.aid)!=null?a:"1",model:(o=L.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=L.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:L.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return A(this,null,function*(){if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),a=t.target||null,o=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let s=this.deviceInfo,c={protocolVersion:"1.0.0",events:[Re(z({},t),{location:i,target:a,extra:o,timestamp:Date.now(),userId:null})],device:s,project:r};try{n?yield this.doReport(ua(c),n):yield this.doReport(ua(c))}catch(p){Be.log("[Jolibox SDK] report API error",p)}})}}});var Aa=re(()=>{"use strict";xl();Ia();Pl()});var Sa,Nl,nt,un,Ke,Wt=re(()=>{"use strict";ga();he();q();Sa=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Nl=AbortSignal.timeout)!=null||(AbortSignal.timeout=Sa);nt=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new un(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},un=class{constructor(t){this.xua=wl();this.getJoliSource=()=>L.joliSource;var n;let r=Kt(L.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return A(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:a}=r!=null?r:{},o=n?new URLSearchParams(n):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,p=this.getJoliSource();a=Object.assign({},a!=null?a:{},c?{"x-user-agent":c}:{},p?{"x-joli-source":p}:{});let u=yield fetch(l,{method:"GET",headers:a,credentials:"include",signal:Sa(i!=null?i:3e4)});return nt.getInstance().recordNetworkRequest(!0),yield u.json()}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{},{"x-os-type":Oe.isAndroid?"ANDROID":Oe.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let m=yield fetch(c,{method:"POST",headers:o,body:JSON.stringify(n),signal:Sa(a!=null?a:3e4),credentials:"include"});nt.getInstance().recordNetworkRequest(!0);let h=m.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return m.blob()}catch(w){return yield m.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return m.formData()}catch(w){return yield m.text()}if(h!=null&&h.includes("application/json"))try{return yield m.json()}catch(w){return yield m.text()}return m}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{});let m=yield fetch(c,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!m.ok)throw nt.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${m.status}`);return nt.getInstance().recordNetworkRequest(!0),yield m.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=un;Ke=nt.getInstance()});var Ca,fn,Ra=re(()=>{"use strict";he();Aa();Wt();q();Ca=class extends dn{constructor(){super(...arguments);this.httpClient=Ke.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return pl((r=L.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},fn=new Ca(Kt(L.testMode))});var Fh,Dl=re(()=>{"use strict";Cl();q();Ea();q();Ra();he();Fh=(e,t)=>{var i,a,o;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:kt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(a=L.hostUserInfo)==null?void 0:a.uid)!=null?o:null};fn.trackEvent(n,$t.WebSDK)};xt.on("GLOBAL_ERROR",(e,t)=>{Fh(t.tag,e)});xt.on("GLOBAL_USER_ERROR",(e,t)=>{Be.log("UserError",e,t)})});var hn,Ll=re(()=>{"use strict";hn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(t)});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,a=!1,o=0,s=()=>{if(!a)return;let h=Date.now(),w=h-r;w>=this.interval&&(this.visible&&(o+=Math.min(w,this.interval+1e3),t(o)),r=h),n=requestAnimationFrame(s)},l=()=>{p(),r=Date.now(),i=window.setInterval(()=>{if(!a)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},p=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{a&&(console.log("visible",h),h?c():l())});let m=this.visible;return{start(){a||(a=!0,m?c():l())},stop(){a=!1,p(),u()}}}}});var Ul,Bl=re(()=>{"use strict";Ul=`-----BEGIN PUBLIC KEY-----
|
|
2
2
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs29BUZPZdQwNDEYtXufp
|
|
3
3
|
IGF40RBoddFzoD2ixl6PjyKWFXF8kxGS++HNtLspxhLvWoE12IZvrP7+whSpgHcy
|
|
4
4
|
4ryuW86mOdHnP9iyeK69GosHz3lVhQjF9UdhJDXB7P/zdj3VlVzZIj0yL+YvZjO0
|
|
@@ -255,7 +255,7 @@ or `);this.errors.push(a)}return n}},kn=class extends me{constructor(...t){super
|
|
|
255
255
|
width: 100%;
|
|
256
256
|
height: 100%;
|
|
257
257
|
}
|
|
258
|
-
`,rg=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adLinkClicked:s,visible:l,src:c}=t,[p,u]=dt(!1),m=w=>{var E,I,b,R;u(!1),l.value=!1,w==="dismiss"?(E=n.value)==null||E.call(n):w==="viewed"&&((I=i.value)==null||I.call(i)),(b=r.value)==null||b.call(r),(R=a.value)==null||R.call(a)},h=()=>{var w;(w=o.value)==null||w.call(o)};return rr("appsrockets_ad_dismissed",()=>m("dismiss")),rr("appsrockets_ad_rewarded",()=>m("viewed")),rr("appsrockets_ad_completed",()=>m("viewed")),rr("appsrockets_ad_skipped",()=>m("viewed")),rr("appsrockets_ad_clicked",w=>{var E;return(E=s.value)==null?void 0:E.call(s,w)}),rr("appsrockets_ad_loaded",()=>u(!0)),l.value?X("div",{className:tg,style:{display:p?"flex":"none"},children:l.value&&X("iframe",{src:c.value,onLoad:h,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};function ht(e,t,r){return(t=ng(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ng(e){var t=ig(e,"string");return typeof t=="symbol"?t:t+""}function ig(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xo=class{constructor(t,r){ht(this,"name","APPSROCKETS"),ht(this,"initialized",!1),ht(this,"initCompleter",null),ht(this,"context",void 0),ht(this,"adsOverlay",null),ht(this,"adsIsShowing",!1),ht(this,"lastUnDisplayedAdBreak",null),ht(this,"state",eg()),ht(this,"processUrl",(n,i)=>{var a;let o=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",o.joliSource),l.get("osType")||l.set("osType",o.osType),l.get("runtimeType")||l.set("runtimeType",o.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",o.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((a=this.context.getWindowInfo().statusBarHeight)!=null?a:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return A(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),oi(X(rg,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){var n,i,a,o,s,l,c,p;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let u=h=>{var w,E;(E=(w=this.context).handleLinkClicked)==null||E.call(w,h)},m=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=t.beforeAd)==null||o.call(t);let h=()=>{var I;this.adsIsShowing=!1,(I=t.afterAd)==null||I.call(t)},w=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},E=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};ye(()=>{this.adsIsShowing=!0,this.state.afterAd.value=h,this.state.adBreakDone.value=w,this.state.src.value=this.processUrl(r.params.url,m),this.state.adLinkClicked.value=u,this.state.adError.value=E,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(c=t.beforeAd)==null||c.call(t);let h=()=>{var D;this.adsIsShowing=!1,(D=t.afterAd)==null||D.call(t)},w={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var D;this.adsIsShowing=!1,w.breakStatus="dismissed",(D=t.adDismissed)==null||D.call(t)},I=()=>{var D;this.adsIsShowing=!1,w.breakStatus="viewed",(D=t.adViewed)==null||D.call(t)},b=()=>{var D;this.adsIsShowing=!1,(D=t.adBreakDone)==null||D.call(t,w)},R=()=>{this.adsIsShowing=!1,w.breakStatus="noAdPreloaded"};ye(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=E,this.state.adViewed.value=I,this.state.adBreakDone.value=b,this.state.adLinkClicked.value=u,this.state.adError.value=R});let k=()=>{var D;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(D=t.adBreakDone)==null||D.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,ye(()=>{this.state.src.value=this.processUrl(r.params.url,m),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(p=t.beforeReward)==null||p.call(t,k);break}}}},lu=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Ae(e,t,r){return(t=ag(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ag(e){var t=og(e,"string");return typeof t=="symbol"?t:t+""}function og(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Qo=class{constructor(t,r,n){Ae(this,"adUnit",void 0),Ae(this,"project",void 0),Ae(this,"keyValue",void 0),Ae(this,"adsContext",null),Ae(this,"rewardedSlot",null),Ae(this,"rewardedPayload",null),Ae(this,"readyEvent",null),Ae(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ae(this,"init",()=>{var i;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(a=>{var o;(o=this.rewardedSlot)==null||o.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(i=this.rewardedSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Ae(this,"destroy",i=>{var a,o;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(o=(a=this.adsContext)==null?void 0:a.adBreakDone)==null||o.call(a,i),i!=="ignored"&&(this.adsContext=null)}),Ae(this,"reinit",i=>{this.destroy(i),this.init()}),Ae(this,"handleSlotReady",i=>{i.slot===this.rewardedSlot&&(this.readyEvent=i)}),Ae(this,"handleSlotClosed",i=>{var a,o;if(this.adsContext&&i.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(a=this.adsContext).afterAd)==null||o.call(a),this.withCommand(()=>{this.reinit(s)})}}),Ae(this,"handleSlotGranted",i=>{this.adsContext&&i.slot===this.rewardedSlot&&(this.rewardedPayload=i.payload)}),Ae(this,"handleSlotRenderEnded",i=>{i.slot===this.rewardedSlot&&i.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Ae(this,"requestAds",i=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=i,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var a,o,s;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let a=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",a),this.readyEvent=o,this.adsContext.beforeReward(()=>{var s,l,c;(l=(s=this.adsContext)==null?void 0:s.beforeAd)==null||l.call(s),(c=this.readyEvent)==null||c.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",a),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",a))},500)}})}),this.adUnit=t,this.project=r,this.keyValue=n,lu(),this.withCommand(()=>{this.init()})}};function De(e,t,r){return(t=sg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sg(e){var t=lg(e,"string");return typeof t=="symbol"?t:t+""}function lg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zo=class{constructor(t,r,n){var i=this;De(this,"adUnit",void 0),De(this,"project",void 0),De(this,"keyValue",void 0),De(this,"adsContext",null),De(this,"gamingInterstitialSlot",null),De(this,"readyEvent",null),De(this,"isRetrying",!1),De(this,"withCommand",function(){googletag.cmd.push(...arguments)}),De(this,"init",()=>{var a;this.gamingInterstitialSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL),this.gamingInterstitialSlot&&(this.gamingInterstitialSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("gameManualInterstitialSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("gameManualInterstitialSlotClosed",this.handleSlotClosed),this.keyValue&&(Object.keys(this.keyValue).forEach(o=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(a=this.gamingInterstitialSlot)==null||a.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),De(this,"destroy",function(a){var o,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(o=i.adsContext)==null?void 0:o.onEnd)==null||s.call(o,a),a!=="ignored"&&(i.adsContext=null)),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",i.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",i.handleSlotClosed),i.gamingInterstitialSlot&&(googletag.destroySlots([i.gamingInterstitialSlot]),i.gamingInterstitialSlot=null,i.readyEvent=null)}),De(this,"reinit",function(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(a,o),i.init()}),De(this,"handleSlotReady",a=>{this.gamingInterstitialSlot===a.slot&&(this.readyEvent=a)}),De(this,"handleSlotClosed",a=>{var o,s;this.adsContext&&this.gamingInterstitialSlot===a.slot&&((s=(o=this.adsContext).afterAd)==null||s.call(o),this.withCommand(()=>{this.reinit("viewed")}))}),De(this,"requestAds",a=>{this.withCommand(()=>{var o,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=a,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((o=a.beforeAd)==null||o.call(a),this.readyEvent.makeGameManualInterstitialVisible()):((l=(s=this.adsContext).onEnd)==null||l.call(s,"frequencyCapped"),this.adsContext=null,this.isRetrying||(this.isRetrying=!0,window.setTimeout(()=>{this.readyEvent||this.withCommand(()=>{this.reinit("frequencyCapped",!1)}),this.isRetrying=!1},31e3)))})}),lu(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Jt(e,t,r){return(t=cg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cg(e){var t=dg(e,"string");return typeof t=="symbol"?t:t+""}function dg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var es=class{constructor(t,r){Jt(this,"name","GOOGLE_GPT"),Jt(this,"context",void 0),Jt(this,"contextInfo",void 0),Jt(this,"initParams",void 0),Jt(this,"rewardAdManager",void 0),Jt(this,"interstitialManager",void 0),Jt(this,"insertScript",()=>{let n="jolibox-google-gpt",i=document.getElementById(n);i||(i=window.document.createElement("script"),i.id=n,i.async=!0,i.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",i.crossOrigin="anonymous",document.head.appendChild(i))}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,this.insertScript()}init(){return A(this,null,function*(){let t=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,r=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,n=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;t&&(this.rewardAdManager=new Qo(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Zo(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,a;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o})}});break}default:{if(!this.interstitialManager){(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:o})}});break}}}};function So(e,t,r){return(t=ug(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ug(e){var t=fg(e,"string");return typeof t=="symbol"?t:t+""}function fg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ts=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";So(this,"context",void 0),So(this,"placement","GAME"),So(this,"contextInfo",void 0),this.context=t,this.placement=r,this.contextInfo=this.context.getContextInfo()}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:r}}getDevice(){var t,r,n,i;return{platform:(t=this.contextInfo.platform)!=null?t:Gd.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(r=this.contextInfo.hostAppId)!=null?r:"1",model:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",brand:(i=this.contextInfo.deviceBrand)!=null?i:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,r){var n;let i={protocolVersion:"1.0.0",events:[{name:t,type:Bd.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Md.WebSDK};return fp(i)}};function Te(e,t,r){return(t=hg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hg(e){var t=mg(e,"string");return typeof t=="symbol"?t:t+""}function mg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ii=class{constructor(t){Te(this,"context",void 0),Te(this,"adsTrackSerializer",void 0),Te(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new ts(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:a}=this.context.getWindowInfo();return{report:JSON.stringify(this.adsTrackSerializer.serialize(t,{sessionId:this.contextInfo.sessionId,objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId,testAdsMode:this.contextInfo.testAdsMode})),osType:this.contextInfo.osType,runtimeType:this.contextInfo.runtimeType,sessionId:this.contextInfo.sessionId,deviceId:this.contextInfo.deviceId,adId:this.contextInfo.adId,deviceModel:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",deviceBrand:(n=this.contextInfo.deviceBrand)!=null?n:"UnknownBrand",dimension:{width:i,height:a}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},rs=class{constructor(t,r){var n=this;Te(this,"context",void 0),Te(this,"contextInfo",void 0),Te(this,"requestContext",void 0),Te(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Te(this,"pendingAFVAdsInfo",Promise.resolve(null)),Te(this,"doFetchAdsInfo",i=>A(this,null,function*(){let a=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",o=[];switch(i){case"afv":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{o=["INTERSTITIAL"];break}}let s=i==="afv"?void 0:"cached",{data:l,code:c}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(a),bizParams:this.requestContext.getRequestBizParams(),adsTypes:o,testAdsMode:this.contextInfo.testAdsMode,name:s}});return c==="SUCCESS"||c==="BYPASS_ADS"?{code:c,data:l}:null})),Te(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Te(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),Te(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Te(this,"cacheNextAFGAdsInfo",i=>A(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),Te(this,"getAFGAdsInfo",i=>A(this,null,function*(){let a=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),a})),Te(this,"getAFVAdsInfo",function(){return A(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let i=yield n.pendingAFVAdsInfo;return n.cacheAFVInfo(),i}else return n.cacheAFVInfo(),yield n.pendingAFVAdsInfo})}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.requestContext=new Ii(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}},pg=Object.defineProperty,vg=Object.defineProperties,gg=Object.getOwnPropertyDescriptors,Ai=Object.getOwnPropertySymbols,cu=Object.prototype.hasOwnProperty,du=Object.prototype.propertyIsEnumerable,Id=(e,t,r)=>t in e?pg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gt=(e,t)=>{for(var r in t||(t={}))cu.call(t,r)&&Id(e,r,t[r]);if(Ai)for(var r of Ai(t))du.call(t,r)&&Id(e,r,t[r]);return e},_g=(e,t)=>vg(e,gg(t)),yg=(e,t)=>{var r={};for(var n in e)cu.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ai)for(var n of Ai(e))t.indexOf(n)<0&&du.call(e,n)&&(r[n]=e[n]);return r},Si=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function bg(e){return!!(e!=null&&e.__nativeBuffers__)}var wg=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=t.charCodeAt(i);return n.buffer};function ns(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!bg(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let i;n.value?i=n.value:n.base64&&(i=wg(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var Eg=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return btoa(t)};function Ig(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=e,n=[];for(let[i,a]of Object.entries(r))if(a!==void 0&&a instanceof ArrayBuffer&&a.byteLength!==void 0){let o=t?{value:a,key:i}:{base64:Eg(a),key:i};n.push(o),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var Ag=Object.defineProperty,Sg=(e,t)=>{for(var r in t)Ag(e,r,{get:t[r],enumerable:!0})},uu=(e,t,r,n)=>{for(var i=t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Cg=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}function Rg(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var Og=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};function fu(e){return typeof e=="string"}function sr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Ad(e){return typeof e=="number"&&!isNaN(e)}function kg(e){return typeof e=="undefined"}function Tg(e){return kg(e)||e===null}function hu(e){return typeof e=="function"}function xg(e){return sr(e)&&hu(e.then)}function mu(e){let t=e,r=null,n=function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}var Pg=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(Pg||{}),Ng=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},xi=class extends Ng{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Dg=class extends xi{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Lg=class extends xi{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Ug=class extends xi{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Co=class extends xi{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function Ur(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var Pi={log:Ur("log"),warn:Ur("warn"),info:Ur("info"),error:Ur("error"),debug:Ur("debug")};Object.assign(globalThis,{logger:Pi});var Sd=Symbol.for("Jolibox.canIUseMap"),Bg={};globalThis[Sd]||(globalThis[Sd]=Bg);function Mg(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}var is=Symbol.for("Jolibox.canIUseMap.native"),Gg={};globalThis[is]||(globalThis[is]=Gg);var as={get config(){return globalThis[is]}},Jg=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Jg||{}),Fg=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Fg||{}),jg=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(jg||{});function Hg(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}Hg();var ir=typeof window=="undefined",qg=()=>!ir&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!ir&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!ir&&navigator.userAgent.includes("Android"),!ir&&navigator.userAgent.includes("Mac"),!ir&&navigator.userAgent.includes("FB_IAB"),!ir&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var os=class ss{constructor(t){this.element=t,this.next=ss.Undefined,this.prev=ss.Undefined}};os.Undefined=new os(void 0);var le=os,Vg=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},$g=0,Br=class{constructor(e){this.value=e,this.id=$g++}},Vr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Br&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,a,o,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new Br(e);return this._listeners?this._listeners instanceof Br?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(s=(o=this.options)==null?void 0:o.onDidAddListener)==null||s.call(o,this),this._size++,()=>{var c,p,u,m;if(!this._disposed){if(this._listeners instanceof Br)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(p=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||p.call(c));else if(this._listeners){let h=this._listeners.indexOf(l);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((m=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||m.call(u)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Br?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ls=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var n;let i=(n=this.listeners.get(e))!=null?n:new Vr,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];r||(r=new Vg,this.cachedEventQueue.set(e,r)),r.push({args:i}),t&&t.fire({event:e,args:i})}once(e,t){var r=this;let n=function(){t(...arguments),r.off(e,n)};this.on(e,n,!1)}},cs={};Sg(cs,{None:()=>Kg,filter:()=>zg,once:()=>pu,toPromise:()=>Wg});var Kg=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Wg(e){return new Promise(t=>pu(e)(t))}function pu(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function zg(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Vr(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}var Ro=Symbol.for("Jolibox.hostEmitter"),Yg=()=>{let e=new ls;return globalThis[Ro]||(globalThis[Ro]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Ro]};Yg();function Xg(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Qg(e[n],t[n])}function Qg(e,t){if(fu(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(hu(t)){try{if(e instanceof t)return}catch(r){}if(!Tg(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}var ds=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Vr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Xg(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};ds=uu([mu],ds);var Cd=class{constructor(){this._onWillExecuteCommand=new Vr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Vr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ds,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Rg(3e4)),this._starActivation}executeCommand(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Cg(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),cs.toPromise(cs.filter(this.registry.onDidRegisterCommand,i=>i===e))])]),this._tryExecuteCommand(e,r))})}executeCommandThowErr(e){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let t=this.registry.getCommand(e);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._onWillExecuteCommand.fire({commandId:e,args:n});let a=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),a}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e(...r)}finally{}}};Cd=uu([mu],Cd);Ve("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ve("requestProductDetailsAsync",{version:102e4});Ve("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ve("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ve("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ve("userTrackAsync",{version:1e6});Ve("openMiniapp",{version:1050100});Ve("requestCoinDetailsSync",{version:1070100});Ve("requestCoinDetailsAsync",{version:1070100});Ve("sendServerEventAsync",{version:1070100});Ve("loadAdsAsync",{version:1070200});Ve("showAdAsync",{version:1070200});function Ve(e,t){if(as.config[e]){Pi.warn(`[can i use] ${e} already registered`);return}as.config[e]=gt({},t)}var Zg=(e,t)=>{function r(i){var a;let[o,...s]=i.split(":");if(!o)return!1;let l=as.config[o];if(!l)return!1;let c=(a=t==null?void 0:t())!=null?a:"",p=l.version;if(l.platforms&&c in l.platforms){let m=l.platforms[c];if(m===!1)return!1;typeof m=="number"&&(p=m)}if(typeof p!="number")return!1;let u=e();return typeof u!="number"||u<p?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,a,o){if(!i)return!1;let s=Mg(i,a);if(!s)return!1;if(sr(s)){let l=s.version;return Ad(l)?typeof o=="number"&&o>=l:!0}return Ad(s)?typeof o=="number"&&o>=s:s===!0}return{canIUseNative:r}};function Rd(e,t){return`[${e}]:${t}`}var e_=()=>qg(),Fr="custom_event_",t_=[],r_=[],n_=["env","createRequestTask","login"],vu="__batch_event__",i_="__native_batch_event__",a_=e=>e==="pv"?e:"default",gi=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:a,type:o}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=a,this.type=a_(o)}report(e){this.type==="pv"?this.addPVPoint(e):this.addPoint(e),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(e){if(Object.keys(this.cache).length){if(e){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(e){let t=(r,n,i,a)=>{let o=n.shift();if(o){let s=a[o];r[s]||(r[s]={}),t(r[s],n,i,a)}else r[i]||(r[i]=[]),r[i].push(a[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,a,o)=>{let s=i.shift();if(!s&&sr(o))throw new Co(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(sr(o))l.push(...Object.keys(o));else if(fu(o)){if(i.length>0)throw new Co(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(o)}else throw new Co(`expected metric value to be a string, but got a(n) ${typeof o}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let p=sr(o)?o[c]:o;t(n[c],[...i],a,p)})}else n[a]?n[a]++:n[a]=1},r={point:e,metricName:this.metricName,tagNameOrder:this.tagNameOrder};t(this.cache,[...this.tagNameOrder],this.metricName,e)}processPoints(e){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:e}}clearPoints(){this.cache={}}},Od=!1,Oo,ko,To;function o_(e,t){Od||(Oo=new gi({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),ko=new gi({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),To=new gi({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Oo.flush(),ko.flush(),To.flush()}),Od=!0);function r(i){var a,o;let{method:s,args:l,startTime:c,isForeground:p,errMsg:u=`${s}:fail no errMsg`,errNo:m=0,__timing:h={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:w,invokeCallback:E}=h,I=(o=(a=u.match(/\S:(\S+)\s?/))==null?void 0:a[1])!=null?o:"fail";Oo.report({status:I,method:n(s,l),errNo:`${m}`,errMsg:u,isForeground:p,duration:Date.now()-c}),c&&w&&E&&(ko.report({status:I,method:s,isForeground:p,duration:Number((w-c).toFixed(3))}),To.report({status:I,method:s,isForeground:p,duration:Number((Date.now()-E).toFixed(3))}))}function n(i,a){return(i==="callHostMethod"||i==="callHostMethodSync")&&a!=null&&a.method?`${i}-${a.method}`:i}return r}var xo=[],us=Symbol.for("Jolibox.invokeResolverInstance"),s_=new Map;globalThis[us]||(globalThis[us]=s_);var l_={get resolveMap(){return globalThis[us]}};function c_(e,t){let r=0,n=!0,i=l_.resolveMap,a=o_(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,xo.forEach(l=>Si(this,[l],function(c){let{method:p,args:u,resolve:m}=c;return function*(){let h=yield s(p,u);m(h)}()})),xo.length=0});let o=(l,c)=>{let p=i.get(Number(l));if(!p)return;let u=ns(c);p(u),i.delete(Number(l))},s=(l,c)=>{var p,u;let m=Date.now(),h=`${n}`;r+=1;let w=new Og;if(i.set(r,w.resolve),!n&&r_.includes(l))return new Promise(D=>{xo.push({method:l,args:c,resolve:D})});let E=_g(gt({},{method:l,startTime:m,args:c,isForeground:h}),{invokeType:"js-bridge"}),I=t_.includes(l),b=Ig(c,I),R=I?b:JSON.stringify(b),k;if(l.endsWith("Sync")||n_.includes(l)?k=(p=e.call)==null?void 0:p.call(e,l,b,r):typeof R=="string"?k=e.invoke(l,R,r):k=(u=e.call)==null?void 0:u.call(e,l,R,r),k){try{typeof k=="string"&&(k=JSON.parse(k)),k=ns(k)}catch(D){Pi.error(D)}return i.delete(r),k.errorCode&&(k.errorCode=Rd(l,k.errorCode)),a(gt(gt({},E),k)),k}return l.endsWith("Sync")&&i.delete(r),w.promise.then(D=>(D.errorCode&&(D.errorCode=Rd(l,D.errorCode)),a(gt(gt({},E),D)),D))};return{invokeNative:s,applyNative:(l,c)=>{let p=s(l,c);return xg(p)?p.then(u=>kd(l,u)):kd(l,p)},invokeHandler:o}}function kd(e,t){if(!sr(t)){Pi.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:a,errorCode:o}=r,s=yg(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new Lg(n,i,a,o);return s}var di=Symbol.for("Jolibox.subscribeInstance");function d_(e){if(globalThis[di])return globalThis[di];let t=new ls,r=new ls,n=new gi({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[di]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,a,o){let s=ns(a),l;if(s.__extra){l=s.params;let{type:c,startTime:p}=s.__extra;n.report({type:c,event:i,duration:Date.now()-p})}else l=s;if(i===vu){l.forEach(c=>{let[p,u]=c;try{r.emit(p.slice(Fr.length),u,o)}catch(m){}});return}if(i.startsWith(Fr)){r.emit(i.slice(Fr.length),l,o);return}t.emit(i,l,o)}},globalThis[di]}function u_(e){let t=new Map,r=new Map,n,i;return{publish:(a,o,s,l)=>{if(l){let p=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Fr}${a}`,o,p);return}n||(n=Promise.resolve().then(()=>{t.forEach((p,u)=>{try{let m=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(vu,p,m)}catch(m){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Fr}${a}`,o])},emitNative:(a,o,s,l)=>{if(l){let p=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(a,o,p),console.log("emitNative",a,o,p);return}i||(i=Promise.resolve().then(()=>{r.forEach((p,u)=>{try{let m=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(i_,p,m)}catch(m){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([a,o])}}}function f_(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:a}=d_(e),{invokeNative:o,invokeHandler:s,applyNative:l}=c_(e,r),{publish:c,emitNative:p}=u_(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:o,onNative:r,offNative:n,emitNative:p,publish:c,subscribe:i,unsubscribe:a}}function gu(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ys,St={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){St.trigger=e},onDoExit(e){St.exit=e},onDoBackPress(e){St.backPress=e}},_u=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Dg("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";St.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Si(void 0,null,function*(){let a=yield St.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:a})});ys={onDocumentReady:t,doExit:r,invoke(i,a,o){e.invoke.postMessage({event:i,paramsString:a,callbackId:o})},publish(i,a,o){let s=gu(a,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:o}))},call(i,a,o){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(a),callbackId:o}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:_u,doExit:r};globalThis.joliboxJSCore=gt({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";St.trigger(),e.onDocumentReady(JSON.stringify({path:i}))},r=i=>Si(void 0,null,function*(){let a=yield St.exit();e.doExit(JSON.stringify({uuid:i,shouldInterrupt:a}))});ys={onDocumentReady:t,invoke(i,a,o){e.invoke(JSON.stringify({event:i,paramsString:a,callbackId:o}))},doExit:r,publish(i,a,o){let s=gu(a,"joliboxJSCore");e.publish(JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:o}))},call(i,a,o){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(a),callbackId:o}));if(s)return JSON.parse(s)},doBackPress(i){return Si(this,null,function*(){let a=yield St.backPress();e.doBackPress(JSON.stringify({uuid:i,shouldInterrupt:a}))})}};let n={onDocumentReady:t,env:_u,doExit:r};globalThis.joliboxJSCore=gt({},n)}var yu=ys;if(!yu&&e_())throw new Ug("No joliboxJScore is found, native bridge not found.");var h_=gt({},yu),bu=f_(h_),{invokeHandler:Td}=bu,{invokeNative:Po,onNative:m_,offNative:p_,subscribeHandler:v_}=bu;globalThis.joliboxJSBridge={callHandler:Td,invokeHandler:Td,subscribeHandler:v_};function g_(e,t,r){return(t=__(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function __(e){var t=y_(e,"string");return typeof t=="symbol"?t:t+""}function y_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var b_=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e)try{e(...r)}catch(i){console.error("[JoliboxSDK] Callback error:",i)}},Ci=class{constructor(t){this.context=t,g_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=Zg(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return A(this,null,function*(){try{let{errNo:r,errMsg:n}=yield Po("loadAdsAsync",{params:{providers:t.providers}});return r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){return No()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return A(this,null,function*(){try{let r=yield Po("showAdAsync",{params:{providers:t.providers}});if(r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(t.callbacks){let i=t.timeout!==void 0?t.timeout:-1,a=null,o=()=>{p_("onAdsStateChange",s),a&&(clearTimeout(a),a=null)},s=l=>{var c;if(l.UUID!==n)return;let p=(c=t.callbacks)==null?void 0:c[l.event];p&&b_(p,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&o()};m_("onAdsStateChange",s),i>0&&(a=setTimeout(()=>{o(),console.warn(`[JoliboxSDK] Event listener for ad ${n} auto-cleaned after ${i}ms timeout`)},i))}return{code:"SUCCESS",message:"Ad shown successfully"}}catch(r){return{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(t){try{let{errNo:r,data:n}=Po("isAdsReadySync",{params:{providers:t.providers}});return r!==0||!n?(console.warn("[Jolibox SDK]isAdsReadySync returned an error or no data"),!1):!0}catch(r){return console.warn("[Jolibox SDK]isAdsReadySync invocation failed:",r),!1}}};function mt(e,t,r){return(t=w_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w_(e){var t=E_(e,"string");return typeof t=="symbol"?t:t+""}function E_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){mt(this,"providers",void 0),mt(this,"helper",void 0),mt(this,"adsContext",null),mt(this,"_isAdsReady",!1),mt(this,"init",()=>A(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),mt(this,"destroy",n=>{var i,a;this._isAdsReady=!1,(a=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||a.call(i,n),n!=="ignored"&&(this.adsContext=null)}),mt(this,"reinit",n=>A(this,null,function*(){this.destroy(n),yield this.init()})),mt(this,"requestAds",(n,i)=>A(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=n,i&&i.length>0&&(this.providers=i);try{this.isAdsReady?this.showAd():yield this.reinit("frequencyCapped")}catch(a){this.destroy("notReady")}})),mt(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>A(this,null,function*(){var a,o;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a);let s=c=>{var p,u,m;i||(i=!0,c==="dismissed"&&((p=this.adsContext)==null||p.adDismissed()),(m=(u=this.adsContext)==null?void 0:u.afterAd)==null||m.call(u),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var c;n=!0,(c=this.adsContext)==null||c.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new Ci(t),this.init()}};function pt(e,t,r){return(t=I_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I_(e){var t=A_(e,"string");return typeof t=="symbol"?t:t+""}function A_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;pt(this,"providers",void 0),pt(this,"helper",void 0),pt(this,"adsContext",null),pt(this,"_isAdsReady",!1),pt(this,"init",()=>A(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),pt(this,"destroy",function(i){var a,o;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n._isAdsReady=!1,s&&((o=(a=n.adsContext)==null?void 0:a.onEnd)==null||o.call(a,i),i!=="ignored"&&(n.adsContext=null))}),pt(this,"reinit",function(a){return A(this,arguments,function*(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,o),yield n.init()})}),pt(this,"requestAds",(i,a)=>A(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=i,a&&a.length>0&&(this.providers=a);try{this.isAdsReady?yield this.showAd():yield this.reinit("frequencyCapped")}catch(o){this.destroy("notReady")}})),pt(this,"showAd",()=>A(this,null,function*(){var i,a;if(!this.adsContext){this.destroy("error");return}let o=!1;(a=(i=this.adsContext).beforeAd)==null||a.call(i);let s=c=>{var p,u;o||(o=!0,(u=(p=this.adsContext)==null?void 0:p.afterAd)==null||u.call(p),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new Ci(t),this.init()}};function Mr(e,t,r){return(t=S_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S_(e){var t=C_(e,"string");return typeof t=="symbol"?t:t+""}function C_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ms=class{constructor(t,r){Mr(this,"name","INTERNAL_NATIVE"),Mr(this,"context",void 0),Mr(this,"rewardAdManager",void 0),Mr(this,"interstitialManager",void 0),Mr(this,"initProviders",void 0),this.context=t,this.initProviders=r.providers;let n=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL"],r.providers),i=this.getConfigsByTypes(["INTERSTITIAL"],r.providers);n.length>0&&(this.rewardAdManager=new fs(this.context,n)),i.length>0&&(this.interstitialManager=new hs(this.context,i))}getConfigsByTypes(t,r,n){let i=[];return(n?n.map(a=>r.find(o=>o.provider===a.provider)).filter(a=>!!a):r).forEach(a=>{t.forEach(o=>{let s="";o==="REWARD"&&(s=a.params.adUnitId.reward),o==="REWARD_INTERSTITIAL"&&(s=a.params.adUnitId.rewardInterstitial),o==="INTERSTITIAL"&&(s=a.params.adUnitId.interstitial),s&&i.push({provider:a.provider,params:{placementId:s,adsType:o,extra:a.params.extra}})})}),i}init(){return A(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,a;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}let o=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL"],this.initProviders,r.params);this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:s=>{var l;(l=t.adBreakDone)==null||l.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:s})}},o);break}default:{let o=t;if(!this.interstitialManager){(a=t.adBreakDone)==null||a.call(t,{breakName:o.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);this.interstitialManager.requestAds({beforeAd:o.beforeAd,afterAd:o.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:o.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}};function We(e,t,r){return(t=R_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R_(e){var t=O_(e,"string");return typeof t=="symbol"?t:t+""}function O_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $r=class{constructor(t){if(We(this,"context",void 0),We(this,"contextInfo",void 0),We(this,"providers",{}),We(this,"channelPolicy",void 0),We(this,"adsActionDetection",void 0),We(this,"requestContext",void 0),We(this,"adsRequest",void 0),We(this,"initialized",!1),We(this,"adsIsShowing",!1),We(this,"lastAdBreak",void 0),We(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Jo(this.context),this.adsActionDetection=new Go(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new rs(t),this.requestContext=new Ii(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return A(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:r}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((r==null?void 0:r.length)>0){let n=r.filter(s=>s.isNative),i=r.filter(s=>!s.isNative),a={provider:"INTERNAL_NATIVE",params:{providers:n}},o=i.concat([a]);for(let s of o)switch(s.provider){case"GOOGLE_GPT":{let l=new es(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new Fo(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new zo(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new Xo(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Yo(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new ms(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;break}}}this.adsRequest.cacheInterstitialInfo("start"),this.adsRequest.cacheRewardInfo(),this.initialized=!0})}adConfig(t){this.providers.ADSENSE?this.providers.ADSENSE.adConfig(t):window.adsbygoogle.push(t)}adBreak(t){return A(this,null,function*(){var r,n,i,a,o,s,l,c,p,u,m,h,w,E,I,b;let R=Date.now();if(R-this.initializedTimeStamp<3e3){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}if(this.lastAdBreak&&R-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads] You can't call adBreak too frequently"),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.lastAdBreak=R,this.adsIsShowing){console.warn("[Jolibox SDK Ads] You can't call adBreak while ad is showing"),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.initialized||(yield this.init()),t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let k=yield this.adsRequest.getAFGAdsInfo(t.type),D=k==null?void 0:k.data,J=k==null?void 0:k.code;if(J==="BYPASS_ADS"){switch(t.type){case"preroll":{(s=t.adBreakDone)==null||s.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{t.beforeReward(()=>{var S,N,F,H;(S=t.beforeAd)==null||S.call(t),(N=t.adViewed)==null||N.call(t),(F=t.afterAd)==null||F.call(t),(H=t.adBreakDone)==null||H.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=t.beforeAd)==null||l.call(t),(c=t.afterAd)==null||c.call(t),(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!D||J!=="SUCCESS"){(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(D.length===0){(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let S=!0,N=null,F=new Mo(this.context);this.adsActionDetection.adBreakIsShowing=!0;let H=D.filter(B=>B.isNative).sort((B,$)=>B.seq-$.seq),U=D.filter(B=>!B.isNative).sort((B,$)=>B.seq-$.seq),G=[{seq:(w=(h=H[0])==null?void 0:h.seq)!=null?w:0,provider:"INTERNAL_NATIVE",params:H}].concat(U);for(G=G.sort((B,$)=>B.seq-$.seq).map((B,$)=>qm(Nd({},B),{seq:$}));G.length>0;){let B=G.shift(),$=this.providers[B.provider];if($){let[Y,Ue]=yield F.callAdBreakAndContinue($,t,B,Rt=>{var jt;this.adsIsShowing=Rt,(jt=this.context.eventEmitter)==null||jt.emit("isAdShowing",Rt)});S=Y,N=Ue}else S=!0,N={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!S)break}S&&N&&((E=t.adBreakDone)==null||E.call(t,N))}}catch(k){(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(b=this.context.eventEmitter)==null||b.emit("isAdShowing",!1),this.adsActionDetection.adBreakIsShowing=!1}})}adUnit(t){console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.")}};var fS=Ce`
|
|
258
|
+
`,rg=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:a,adLoaded:o,adLinkClicked:s,visible:l,src:c}=t,[p,u]=dt(!1),m=w=>{var E,I,b,R;u(!1),l.value=!1,w==="dismiss"?(E=n.value)==null||E.call(n):w==="viewed"&&((I=i.value)==null||I.call(i)),(b=r.value)==null||b.call(r),(R=a.value)==null||R.call(a)},h=()=>{var w;(w=o.value)==null||w.call(o)};return rr("appsrockets_ad_dismissed",()=>m("dismiss")),rr("appsrockets_ad_rewarded",()=>m("viewed")),rr("appsrockets_ad_completed",()=>m("viewed")),rr("appsrockets_ad_skipped",()=>m("viewed")),rr("appsrockets_ad_clicked",w=>{var E;return(E=s.value)==null?void 0:E.call(s,w)}),rr("appsrockets_ad_loaded",()=>u(!0)),l.value?X("div",{className:tg,style:{display:p?"flex":"none"},children:l.value&&X("iframe",{src:c.value,onLoad:h,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};function ht(e,t,r){return(t=ng(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ng(e){var t=ig(e,"string");return typeof t=="symbol"?t:t+""}function ig(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xo=class{constructor(t,r){ht(this,"name","APPSROCKETS"),ht(this,"initialized",!1),ht(this,"initCompleter",null),ht(this,"context",void 0),ht(this,"adsOverlay",null),ht(this,"adsIsShowing",!1),ht(this,"lastUnDisplayedAdBreak",null),ht(this,"state",eg()),ht(this,"processUrl",(n,i)=>{var a;let o=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",o.joliSource),l.get("osType")||l.set("osType",o.osType),l.get("runtimeType")||l.set("runtimeType",o.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",o.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((a=this.context.getWindowInfo().statusBarHeight)!=null?a:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return A(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),oi(X(rg,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){var n,i,a,o,s,l,c,p;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let u=h=>{var w,E;(E=(w=this.context).handleLinkClicked)==null||E.call(w,h)},m=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=t.beforeAd)==null||o.call(t);let h=()=>{var I;this.adsIsShowing=!1,(I=t.afterAd)==null||I.call(t)},w=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},E=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};ye(()=>{this.adsIsShowing=!0,this.state.afterAd.value=h,this.state.adBreakDone.value=w,this.state.src.value=this.processUrl(r.params.url,m),this.state.adLinkClicked.value=u,this.state.adError.value=E,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(c=t.beforeAd)==null||c.call(t);let h=()=>{var D;this.adsIsShowing=!1,(D=t.afterAd)==null||D.call(t)},w={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var D;this.adsIsShowing=!1,w.breakStatus="dismissed",(D=t.adDismissed)==null||D.call(t)},I=()=>{var D;this.adsIsShowing=!1,w.breakStatus="viewed",(D=t.adViewed)==null||D.call(t)},b=()=>{var D;this.adsIsShowing=!1,(D=t.adBreakDone)==null||D.call(t,w)},R=()=>{this.adsIsShowing=!1,w.breakStatus="noAdPreloaded"};ye(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=E,this.state.adViewed.value=I,this.state.adBreakDone.value=b,this.state.adLinkClicked.value=u,this.state.adError.value=R});let k=()=>{var D;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(D=t.adBreakDone)==null||D.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,ye(()=>{this.state.src.value=this.processUrl(r.params.url,m),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(p=t.beforeReward)==null||p.call(t,k);break}}}},lu=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Ae(e,t,r){return(t=ag(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ag(e){var t=og(e,"string");return typeof t=="symbol"?t:t+""}function og(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Qo=class{constructor(t,r,n){Ae(this,"adUnit",void 0),Ae(this,"project",void 0),Ae(this,"keyValue",void 0),Ae(this,"adsContext",null),Ae(this,"rewardedSlot",null),Ae(this,"rewardedPayload",null),Ae(this,"readyEvent",null),Ae(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ae(this,"init",()=>{var i;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(a=>{var o;(o=this.rewardedSlot)==null||o.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(i=this.rewardedSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Ae(this,"destroy",i=>{var a,o;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(o=(a=this.adsContext)==null?void 0:a.adBreakDone)==null||o.call(a,i),i!=="ignored"&&(this.adsContext=null)}),Ae(this,"reinit",i=>{this.destroy(i),this.init()}),Ae(this,"handleSlotReady",i=>{i.slot===this.rewardedSlot&&(this.readyEvent=i)}),Ae(this,"handleSlotClosed",i=>{var a,o;if(this.adsContext&&i.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(a=this.adsContext).afterAd)==null||o.call(a),this.withCommand(()=>{this.reinit(s)})}}),Ae(this,"handleSlotGranted",i=>{this.adsContext&&i.slot===this.rewardedSlot&&(this.rewardedPayload=i.payload)}),Ae(this,"handleSlotRenderEnded",i=>{i.slot===this.rewardedSlot&&i.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Ae(this,"requestAds",i=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=i,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var a,o,s;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let a=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",a),this.readyEvent=o,this.adsContext.beforeReward(()=>{var s,l,c;(l=(s=this.adsContext)==null?void 0:s.beforeAd)==null||l.call(s),(c=this.readyEvent)==null||c.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",a),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",a))},500)}})}),this.adUnit=t,this.project=r,this.keyValue=n,lu(),this.withCommand(()=>{this.init()})}};function De(e,t,r){return(t=sg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sg(e){var t=lg(e,"string");return typeof t=="symbol"?t:t+""}function lg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zo=class{constructor(t,r,n){var i=this;De(this,"adUnit",void 0),De(this,"project",void 0),De(this,"keyValue",void 0),De(this,"adsContext",null),De(this,"gamingInterstitialSlot",null),De(this,"readyEvent",null),De(this,"isRetrying",!1),De(this,"withCommand",function(){googletag.cmd.push(...arguments)}),De(this,"init",()=>{var a;this.gamingInterstitialSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL),this.gamingInterstitialSlot&&(this.gamingInterstitialSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("gameManualInterstitialSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("gameManualInterstitialSlotClosed",this.handleSlotClosed),this.keyValue&&(Object.keys(this.keyValue).forEach(o=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(a=this.gamingInterstitialSlot)==null||a.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),De(this,"destroy",function(a){var o,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(o=i.adsContext)==null?void 0:o.onEnd)==null||s.call(o,a),a!=="ignored"&&(i.adsContext=null)),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",i.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",i.handleSlotClosed),i.gamingInterstitialSlot&&(googletag.destroySlots([i.gamingInterstitialSlot]),i.gamingInterstitialSlot=null,i.readyEvent=null)}),De(this,"reinit",function(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(a,o),i.init()}),De(this,"handleSlotReady",a=>{this.gamingInterstitialSlot===a.slot&&(this.readyEvent=a)}),De(this,"handleSlotClosed",a=>{var o,s;this.adsContext&&this.gamingInterstitialSlot===a.slot&&((s=(o=this.adsContext).afterAd)==null||s.call(o),this.withCommand(()=>{this.reinit("viewed")}))}),De(this,"requestAds",a=>{this.withCommand(()=>{var o,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=a,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((o=a.beforeAd)==null||o.call(a),this.readyEvent.makeGameManualInterstitialVisible()):((l=(s=this.adsContext).onEnd)==null||l.call(s,"frequencyCapped"),this.adsContext=null,this.isRetrying||(this.isRetrying=!0,window.setTimeout(()=>{this.readyEvent||this.withCommand(()=>{this.reinit("frequencyCapped",!1)}),this.isRetrying=!1},31e3)))})}),lu(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Jt(e,t,r){return(t=cg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cg(e){var t=dg(e,"string");return typeof t=="symbol"?t:t+""}function dg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var es=class{constructor(t,r){Jt(this,"name","GOOGLE_GPT"),Jt(this,"context",void 0),Jt(this,"contextInfo",void 0),Jt(this,"initParams",void 0),Jt(this,"rewardAdManager",void 0),Jt(this,"interstitialManager",void 0),Jt(this,"insertScript",()=>{let n="jolibox-google-gpt",i=document.getElementById(n);i||(i=window.document.createElement("script"),i.id=n,i.async=!0,i.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",i.crossOrigin="anonymous",document.head.appendChild(i))}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,this.insertScript()}init(){return A(this,null,function*(){let t=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,r=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,n=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;t&&(this.rewardAdManager=new Qo(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Zo(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,a;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o})}});break}default:{if(!this.interstitialManager){(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:o})}});break}}}};function So(e,t,r){return(t=ug(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ug(e){var t=fg(e,"string");return typeof t=="symbol"?t:t+""}function fg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ts=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";So(this,"context",void 0),So(this,"placement","GAME"),So(this,"contextInfo",void 0),this.context=t,this.placement=r,this.contextInfo=this.context.getContextInfo()}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:r}}getDevice(){var t,r,n,i;return{platform:(t=this.contextInfo.platform)!=null?t:Gd.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(r=this.contextInfo.hostAppId)!=null?r:"1",model:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",brand:(i=this.contextInfo.deviceBrand)!=null?i:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,r){var n;let i={protocolVersion:"1.0.0",events:[{name:t,type:Bd.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Md.WebSDK};return fp(i)}};function Te(e,t,r){return(t=hg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hg(e){var t=mg(e,"string");return typeof t=="symbol"?t:t+""}function mg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ii=class{constructor(t){Te(this,"context",void 0),Te(this,"adsTrackSerializer",void 0),Te(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new ts(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:a}=this.context.getWindowInfo();return{report:JSON.stringify(this.adsTrackSerializer.serialize(t,{sessionId:this.contextInfo.sessionId,objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId,testAdsMode:this.contextInfo.testAdsMode})),osType:this.contextInfo.osType,runtimeType:this.contextInfo.runtimeType,sessionId:this.contextInfo.sessionId,deviceId:this.contextInfo.deviceId,adId:this.contextInfo.adId,deviceModel:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",deviceBrand:(n=this.contextInfo.deviceBrand)!=null?n:"UnknownBrand",dimension:{width:i,height:a}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},rs=class{constructor(t,r){var n=this;Te(this,"context",void 0),Te(this,"contextInfo",void 0),Te(this,"requestContext",void 0),Te(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Te(this,"pendingAFVAdsInfo",Promise.resolve(null)),Te(this,"doFetchAdsInfo",i=>A(this,null,function*(){let a=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",o=[];switch(i){case"afv":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{o=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{o=["INTERSTITIAL"];break}}let s=i==="afv"?void 0:"cached",{data:l,code:c}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(a),bizParams:this.requestContext.getRequestBizParams(),adsTypes:o,testAdsMode:this.contextInfo.testAdsMode,name:s}});return c==="SUCCESS"||c==="BYPASS_ADS"?{code:c,data:l}:null})),Te(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Te(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),Te(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Te(this,"cacheNextAFGAdsInfo",i=>A(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),Te(this,"getAFGAdsInfo",i=>A(this,null,function*(){let a=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),a})),Te(this,"getAFVAdsInfo",function(){return A(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let i=yield n.pendingAFVAdsInfo;return n.cacheAFVInfo(),i}else return n.cacheAFVInfo(),yield n.pendingAFVAdsInfo})}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.requestContext=new Ii(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}},pg=Object.defineProperty,vg=Object.defineProperties,gg=Object.getOwnPropertyDescriptors,Ai=Object.getOwnPropertySymbols,cu=Object.prototype.hasOwnProperty,du=Object.prototype.propertyIsEnumerable,Id=(e,t,r)=>t in e?pg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gt=(e,t)=>{for(var r in t||(t={}))cu.call(t,r)&&Id(e,r,t[r]);if(Ai)for(var r of Ai(t))du.call(t,r)&&Id(e,r,t[r]);return e},_g=(e,t)=>vg(e,gg(t)),yg=(e,t)=>{var r={};for(var n in e)cu.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ai)for(var n of Ai(e))t.indexOf(n)<0&&du.call(e,n)&&(r[n]=e[n]);return r},Si=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function bg(e){return!!(e!=null&&e.__nativeBuffers__)}var wg=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=t.charCodeAt(i);return n.buffer};function ns(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!bg(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let i;n.value?i=n.value:n.base64&&(i=wg(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var Eg=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return btoa(t)};function Ig(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=e,n=[];for(let[i,a]of Object.entries(r))if(a!==void 0&&a instanceof ArrayBuffer&&a.byteLength!==void 0){let o=t?{value:a,key:i}:{base64:Eg(a),key:i};n.push(o),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var Ag=Object.defineProperty,Sg=(e,t)=>{for(var r in t)Ag(e,r,{get:t[r],enumerable:!0})},uu=(e,t,r,n)=>{for(var i=t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Cg=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}function Rg(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var Og=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};function fu(e){return typeof e=="string"}function sr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Ad(e){return typeof e=="number"&&!isNaN(e)}function kg(e){return typeof e=="undefined"}function Tg(e){return kg(e)||e===null}function hu(e){return typeof e=="function"}function xg(e){return sr(e)&&hu(e.then)}function mu(e){let t=e,r=null,n=function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}var Pg=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(Pg||{}),Ng=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},xi=class extends Ng{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Dg=class extends xi{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Lg=class extends xi{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Ug=class extends xi{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Co=class extends xi{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function Ur(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var Pi={log:Ur("log"),warn:Ur("warn"),info:Ur("info"),error:Ur("error"),debug:Ur("debug")};Object.assign(globalThis,{logger:Pi});var Sd=Symbol.for("Jolibox.canIUseMap"),Bg={};globalThis[Sd]||(globalThis[Sd]=Bg);function Mg(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}var is=Symbol.for("Jolibox.canIUseMap.native"),Gg={};globalThis[is]||(globalThis[is]=Gg);var as={get config(){return globalThis[is]}},Jg=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Jg||{}),Fg=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Fg||{}),jg=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(jg||{});function Hg(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}Hg();var ir=typeof window=="undefined",qg=()=>!ir&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!ir&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!ir&&navigator.userAgent.includes("Android"),!ir&&navigator.userAgent.includes("Mac"),!ir&&navigator.userAgent.includes("FB_IAB"),!ir&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var os=class ss{constructor(t){this.element=t,this.next=ss.Undefined,this.prev=ss.Undefined}};os.Undefined=new os(void 0);var le=os,Vg=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},$g=0,Br=class{constructor(e){this.value=e,this.id=$g++}},Vr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Br&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,a,o,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new Br(e);return this._listeners?this._listeners instanceof Br?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(s=(o=this.options)==null?void 0:o.onDidAddListener)==null||s.call(o,this),this._size++,()=>{var c,p,u,m;if(!this._disposed){if(this._listeners instanceof Br)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(p=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||p.call(c));else if(this._listeners){let h=this._listeners.indexOf(l);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((m=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||m.call(u)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Br?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ls=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var n;let i=(n=this.listeners.get(e))!=null?n:new Vr,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];r||(r=new Vg,this.cachedEventQueue.set(e,r)),r.push({args:i}),t&&t.fire({event:e,args:i})}once(e,t){var r=this;let n=function(){t(...arguments),r.off(e,n)};this.on(e,n,!1)}},cs={};Sg(cs,{None:()=>Kg,filter:()=>zg,once:()=>pu,toPromise:()=>Wg});var Kg=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Wg(e){return new Promise(t=>pu(e)(t))}function pu(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function zg(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Vr(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}var Ro=Symbol.for("Jolibox.hostEmitter"),Yg=()=>{let e=new ls;return globalThis[Ro]||(globalThis[Ro]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Ro]};Yg();function Xg(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Qg(e[n],t[n])}function Qg(e,t){if(fu(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(hu(t)){try{if(e instanceof t)return}catch(r){}if(!Tg(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}var ds=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Vr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Xg(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};ds=uu([mu],ds);var Cd=class{constructor(){this._onWillExecuteCommand=new Vr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Vr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ds,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Rg(3e4)),this._starActivation}executeCommand(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Cg(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),cs.toPromise(cs.filter(this.registry.onDidRegisterCommand,i=>i===e))])]),this._tryExecuteCommand(e,r))})}executeCommandThowErr(e){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let t=this.registry.getCommand(e);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._onWillExecuteCommand.fire({commandId:e,args:n});let a=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),a}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e(...r)}finally{}}};Cd=uu([mu],Cd);Ve("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ve("requestProductDetailsAsync",{version:102e4});Ve("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ve("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ve("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ve("userTrackAsync",{version:1e6});Ve("openMiniapp",{version:1050100});Ve("requestCoinDetailsSync",{version:1070100});Ve("requestCoinDetailsAsync",{version:1070100});Ve("sendServerEventAsync",{version:1070100});Ve("loadAdsAsync",{version:1070200});Ve("showAdAsync",{version:1070200});function Ve(e,t){if(as.config[e]){Pi.warn(`[can i use] ${e} already registered`);return}as.config[e]=gt({},t)}var Zg=(e,t)=>{function r(i){var a;let[o,...s]=i.split(":");if(!o)return!1;let l=as.config[o];if(!l)return!1;let c=(a=t==null?void 0:t())!=null?a:"",p=l.version;if(l.platforms&&c in l.platforms){let m=l.platforms[c];if(m===!1)return!1;typeof m=="number"&&(p=m)}if(typeof p!="number")return!1;let u=e();return typeof u!="number"||u<p?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,a,o){if(!i)return!1;let s=Mg(i,a);if(!s)return!1;if(sr(s)){let l=s.version;return Ad(l)?typeof o=="number"&&o>=l:!0}return Ad(s)?typeof o=="number"&&o>=s:s===!0}return{canIUseNative:r}};function Rd(e,t){return`[${e}]:${t}`}var e_=()=>qg(),Fr="custom_event_",t_=[],r_=[],n_=["env","createRequestTask","login"],vu="__batch_event__",i_="__native_batch_event__",a_=e=>e==="pv"?e:"default",gi=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:a,type:o}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=a,this.type=a_(o)}report(e){this.type==="pv"?this.addPVPoint(e):this.addPoint(e),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(e){if(Object.keys(this.cache).length){if(e){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(e){let t=(r,n,i,a)=>{let o=n.shift();if(o){let s=a[o];r[s]||(r[s]={}),t(r[s],n,i,a)}else r[i]||(r[i]=[]),r[i].push(a[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,a,o)=>{let s=i.shift();if(!s&&sr(o))throw new Co(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(sr(o))l.push(...Object.keys(o));else if(fu(o)){if(i.length>0)throw new Co(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(o)}else throw new Co(`expected metric value to be a string, but got a(n) ${typeof o}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let p=sr(o)?o[c]:o;t(n[c],[...i],a,p)})}else n[a]?n[a]++:n[a]=1},r={point:e,metricName:this.metricName,tagNameOrder:this.tagNameOrder};t(this.cache,[...this.tagNameOrder],this.metricName,e)}processPoints(e){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:e}}clearPoints(){this.cache={}}},Od=!1,Oo,ko,To;function o_(e,t){Od||(Oo=new gi({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),ko=new gi({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),To=new gi({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Oo.flush(),ko.flush(),To.flush()}),Od=!0);function r(i){var a,o;let{method:s,args:l,startTime:c,isForeground:p,errMsg:u=`${s}:fail no errMsg`,errNo:m=0,__timing:h={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:w,invokeCallback:E}=h,I=(o=(a=u.match(/\S:(\S+)\s?/))==null?void 0:a[1])!=null?o:"fail";Oo.report({status:I,method:n(s,l),errNo:`${m}`,errMsg:u,isForeground:p,duration:Date.now()-c}),c&&w&&E&&(ko.report({status:I,method:s,isForeground:p,duration:Number((w-c).toFixed(3))}),To.report({status:I,method:s,isForeground:p,duration:Number((Date.now()-E).toFixed(3))}))}function n(i,a){return(i==="callHostMethod"||i==="callHostMethodSync")&&a!=null&&a.method?`${i}-${a.method}`:i}return r}var xo=[],us=Symbol.for("Jolibox.invokeResolverInstance"),s_=new Map;globalThis[us]||(globalThis[us]=s_);var l_={get resolveMap(){return globalThis[us]}};function c_(e,t){let r=0,n=!0,i=l_.resolveMap,a=o_(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,xo.forEach(l=>Si(this,[l],function(c){let{method:p,args:u,resolve:m}=c;return function*(){let h=yield s(p,u);m(h)}()})),xo.length=0});let o=(l,c)=>{let p=i.get(Number(l));if(!p)return;let u=ns(c);p(u),i.delete(Number(l))},s=(l,c)=>{var p,u;let m=Date.now(),h=`${n}`;r+=1;let w=new Og;if(i.set(r,w.resolve),!n&&r_.includes(l))return new Promise(D=>{xo.push({method:l,args:c,resolve:D})});let E=_g(gt({},{method:l,startTime:m,args:c,isForeground:h}),{invokeType:"js-bridge"}),I=t_.includes(l),b=Ig(c,I),R=I?b:JSON.stringify(b),k;if(l.endsWith("Sync")||n_.includes(l)?k=(p=e.call)==null?void 0:p.call(e,l,b,r):typeof R=="string"?k=e.invoke(l,R,r):k=(u=e.call)==null?void 0:u.call(e,l,R,r),k){try{typeof k=="string"&&(k=JSON.parse(k)),k=ns(k)}catch(D){Pi.error(D)}return i.delete(r),k.errorCode&&(k.errorCode=Rd(l,k.errorCode)),a(gt(gt({},E),k)),k}return l.endsWith("Sync")&&i.delete(r),w.promise.then(D=>(D.errorCode&&(D.errorCode=Rd(l,D.errorCode)),a(gt(gt({},E),D)),D))};return{invokeNative:s,applyNative:(l,c)=>{let p=s(l,c);return xg(p)?p.then(u=>kd(l,u)):kd(l,p)},invokeHandler:o}}function kd(e,t){if(!sr(t)){Pi.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:a,errorCode:o}=r,s=yg(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new Lg(n,i,a,o);return s}var di=Symbol.for("Jolibox.subscribeInstance");function d_(e){if(globalThis[di])return globalThis[di];let t=new ls,r=new ls,n=new gi({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[di]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,a,o){let s=ns(a),l;if(s.__extra){l=s.params;let{type:c,startTime:p}=s.__extra;n.report({type:c,event:i,duration:Date.now()-p})}else l=s;if(i===vu){l.forEach(c=>{let[p,u]=c;try{r.emit(p.slice(Fr.length),u,o)}catch(m){}});return}if(i.startsWith(Fr)){r.emit(i.slice(Fr.length),l,o);return}t.emit(i,l,o)}},globalThis[di]}function u_(e){let t=new Map,r=new Map,n,i;return{publish:(a,o,s,l)=>{if(l){let p=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Fr}${a}`,o,p);return}n||(n=Promise.resolve().then(()=>{t.forEach((p,u)=>{try{let m=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(vu,p,m)}catch(m){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Fr}${a}`,o])},emitNative:(a,o,s,l)=>{if(l){let p=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(a,o,p),console.log("emitNative",a,o,p);return}i||(i=Promise.resolve().then(()=>{r.forEach((p,u)=>{try{let m=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(i_,p,m)}catch(m){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([a,o])}}}function f_(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:a}=d_(e),{invokeNative:o,invokeHandler:s,applyNative:l}=c_(e,r),{publish:c,emitNative:p}=u_(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:o,onNative:r,offNative:n,emitNative:p,publish:c,subscribe:i,unsubscribe:a}}function gu(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ys,St={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){St.trigger=e},onDoExit(e){St.exit=e},onDoBackPress(e){St.backPress=e}},_u=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Dg("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";St.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Si(void 0,null,function*(){let a=yield St.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:a})});ys={onDocumentReady:t,doExit:r,invoke(i,a,o){e.invoke.postMessage({event:i,paramsString:a,callbackId:o})},publish(i,a,o){let s=gu(a,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:o}))},call(i,a,o){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(a),callbackId:o}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:_u,doExit:r};globalThis.joliboxJSCore=gt({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";St.trigger(),e.onDocumentReady(JSON.stringify({path:i}))},r=i=>Si(void 0,null,function*(){let a=yield St.exit();e.doExit(JSON.stringify({uuid:i,shouldInterrupt:a}))});ys={onDocumentReady:t,invoke(i,a,o){e.invoke(JSON.stringify({event:i,paramsString:a,callbackId:o}))},doExit:r,publish(i,a,o){let s=gu(a,"joliboxJSCore");e.publish(JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:o}))},call(i,a,o){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(a),callbackId:o}));if(s)return JSON.parse(s)},doBackPress(i){return Si(this,null,function*(){let a=yield St.backPress();e.doBackPress(JSON.stringify({uuid:i,shouldInterrupt:a}))})}};let n={onDocumentReady:t,env:_u,doExit:r};globalThis.joliboxJSCore=gt({},n)}var yu=ys;if(!yu&&e_())throw new Ug("No joliboxJScore is found, native bridge not found.");var h_=gt({},yu),bu=f_(h_),{invokeHandler:Td}=bu,{invokeNative:Po,onNative:m_,offNative:p_,subscribeHandler:v_}=bu;globalThis.joliboxJSBridge={callHandler:Td,invokeHandler:Td,subscribeHandler:v_};function g_(e,t,r){return(t=__(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function __(e){var t=y_(e,"string");return typeof t=="symbol"?t:t+""}function y_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var b_=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e)try{e(...r)}catch(i){console.error("[JoliboxSDK] Callback error:",i)}},Ci=class{constructor(t){this.context=t,g_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=Zg(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return A(this,null,function*(){try{let{errNo:r,errMsg:n}=yield Po("loadAdsAsync",{params:{providers:t.providers}});return r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){return No()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return A(this,null,function*(){try{let r=yield Po("showAdAsync",{params:{providers:t.providers}});if(r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(t.callbacks){let i=t.timeout!==void 0?t.timeout:-1,a=null,o=()=>{p_("onAdsStateChange",s),a&&(clearTimeout(a),a=null)},s=l=>{var c;if(l.UUID!==n)return;let p=(c=t.callbacks)==null?void 0:c[l.event];p&&b_(p,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&o()};m_("onAdsStateChange",s),i>0&&(a=setTimeout(()=>{o(),console.warn(`[JoliboxSDK] Event listener for ad ${n} auto-cleaned after ${i}ms timeout`)},i))}return{code:"SUCCESS",message:"Ad shown successfully"}}catch(r){return{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(t){try{let{errNo:r,data:n}=Po("isAdsReadySync",{params:{providers:t.providers}});return r!==0||!n?(console.warn("[Jolibox SDK]isAdsReadySync returned an error or no data"),!1):!0}catch(r){return console.warn("[Jolibox SDK]isAdsReadySync invocation failed:",r),!1}}};function mt(e,t,r){return(t=w_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w_(e){var t=E_(e,"string");return typeof t=="symbol"?t:t+""}function E_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){mt(this,"providers",void 0),mt(this,"helper",void 0),mt(this,"adsContext",null),mt(this,"_isAdsReady",!1),mt(this,"init",()=>A(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),mt(this,"destroy",n=>{var i,a;this._isAdsReady=!1,(a=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||a.call(i,n),n!=="ignored"&&(this.adsContext=null)}),mt(this,"reinit",n=>A(this,null,function*(){this.destroy(n),yield this.init()})),mt(this,"requestAds",(n,i)=>A(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=n,i&&i.length>0&&(this.providers=i);try{this.isAdsReady?this.showAd():yield this.reinit("frequencyCapped")}catch(a){this.destroy("notReady")}})),mt(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>A(this,null,function*(){var a,o;(o=(a=this.adsContext)==null?void 0:a.beforeAd)==null||o.call(a);let s=c=>{var p,u,m;i||(i=!0,c==="dismissed"&&((p=this.adsContext)==null||p.adDismissed()),(m=(u=this.adsContext)==null?void 0:u.afterAd)==null||m.call(u),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var c;n=!0,(c=this.adsContext)==null||c.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new Ci(t),this.init()}};function pt(e,t,r){return(t=I_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I_(e){var t=A_(e,"string");return typeof t=="symbol"?t:t+""}function A_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;pt(this,"providers",void 0),pt(this,"helper",void 0),pt(this,"adsContext",null),pt(this,"_isAdsReady",!1),pt(this,"init",()=>A(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),pt(this,"destroy",function(i){var a,o;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n._isAdsReady=!1,s&&((o=(a=n.adsContext)==null?void 0:a.onEnd)==null||o.call(a,i),i!=="ignored"&&(n.adsContext=null))}),pt(this,"reinit",function(a){return A(this,arguments,function*(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,o),yield n.init()})}),pt(this,"requestAds",(i,a)=>A(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=i,a&&a.length>0&&(this.providers=a);try{this.isAdsReady?yield this.showAd():yield this.reinit("frequencyCapped")}catch(o){this.destroy("notReady")}})),pt(this,"showAd",()=>A(this,null,function*(){var i,a;if(!this.adsContext){this.destroy("error");return}let o=!1;(a=(i=this.adsContext).beforeAd)==null||a.call(i);let s=c=>{var p,u;o||(o=!0,(u=(p=this.adsContext)==null?void 0:p.afterAd)==null||u.call(p),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new Ci(t),this.init()}};function Mr(e,t,r){return(t=S_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S_(e){var t=C_(e,"string");return typeof t=="symbol"?t:t+""}function C_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ms=class{constructor(t,r){Mr(this,"name","INTERNAL_NATIVE"),Mr(this,"context",void 0),Mr(this,"rewardAdManager",void 0),Mr(this,"interstitialManager",void 0),Mr(this,"initProviders",void 0),this.context=t,this.initProviders=r.providers;let n=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],r.providers),i=this.getConfigsByTypes(["INTERSTITIAL"],r.providers);n.length>0&&(this.rewardAdManager=new fs(this.context,n)),i.length>0&&(this.interstitialManager=new hs(this.context,i))}getConfigsByTypes(t,r,n){let i=[];return(n?n.map(a=>r.find(o=>o.provider===a.provider)).filter(a=>!!a):r).forEach(a=>{t.forEach(o=>{let s="";o==="REWARD"&&(s=a.params.adUnitId.reward),o==="REWARD_INTERSTITIAL"&&(s=a.params.adUnitId.rewardInterstitial),o==="INTERSTITIAL"&&(s=a.params.adUnitId.interstitial),o==="NATIVE"&&(s=a.params.adUnitId.nativeAds),s&&i.push({provider:a.provider,params:{placementId:s,adsType:o,extra:a.params.extra}})})}),i}init(){return A(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,a;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}let o=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],this.initProviders,r.params);this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:s=>{var l;(l=t.adBreakDone)==null||l.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:s})}},o);break}default:{let o=t;if(!this.interstitialManager){(a=t.adBreakDone)==null||a.call(t,{breakName:o.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);this.interstitialManager.requestAds({beforeAd:o.beforeAd,afterAd:o.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:o.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}};function We(e,t,r){return(t=R_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R_(e){var t=O_(e,"string");return typeof t=="symbol"?t:t+""}function O_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $r=class{constructor(t){if(We(this,"context",void 0),We(this,"contextInfo",void 0),We(this,"providers",{}),We(this,"channelPolicy",void 0),We(this,"adsActionDetection",void 0),We(this,"requestContext",void 0),We(this,"adsRequest",void 0),We(this,"initialized",!1),We(this,"adsIsShowing",!1),We(this,"lastAdBreak",void 0),We(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Jo(this.context),this.adsActionDetection=new Go(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new rs(t),this.requestContext=new Ii(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return A(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:r}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((r==null?void 0:r.length)>0){let n=r.filter(s=>s.isNative),i=r.filter(s=>!s.isNative),a={provider:"INTERNAL_NATIVE",params:{providers:n}},o=i.concat([a]);for(let s of o)switch(s.provider){case"GOOGLE_GPT":{let l=new es(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new Fo(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new zo(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new Xo(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Yo(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new ms(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;break}}}this.adsRequest.cacheInterstitialInfo("start"),this.adsRequest.cacheRewardInfo(),this.initialized=!0})}adConfig(t){this.providers.ADSENSE?this.providers.ADSENSE.adConfig(t):window.adsbygoogle.push(t)}adBreak(t){return A(this,null,function*(){var r,n,i,a,o,s,l,c,p,u,m,h,w,E,I,b;let R=Date.now();if(R-this.initializedTimeStamp<3e3){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}if(this.lastAdBreak&&R-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads] You can't call adBreak too frequently"),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.lastAdBreak=R,this.adsIsShowing){console.warn("[Jolibox SDK Ads] You can't call adBreak while ad is showing"),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.initialized||(yield this.init()),t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let k=yield this.adsRequest.getAFGAdsInfo(t.type),D=k==null?void 0:k.data,J=k==null?void 0:k.code;if(J==="BYPASS_ADS"){switch(t.type){case"preroll":{(s=t.adBreakDone)==null||s.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{t.beforeReward(()=>{var S,N,F,H;(S=t.beforeAd)==null||S.call(t),(N=t.adViewed)==null||N.call(t),(F=t.afterAd)==null||F.call(t),(H=t.adBreakDone)==null||H.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=t.beforeAd)==null||l.call(t),(c=t.afterAd)==null||c.call(t),(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!D||J!=="SUCCESS"){(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(D.length===0){(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let S=!0,N=null,F=new Mo(this.context);this.adsActionDetection.adBreakIsShowing=!0;let H=D.filter(B=>B.isNative).sort((B,$)=>B.seq-$.seq),U=D.filter(B=>!B.isNative).sort((B,$)=>B.seq-$.seq),G=[{seq:(w=(h=H[0])==null?void 0:h.seq)!=null?w:0,provider:"INTERNAL_NATIVE",params:H}].concat(U);for(G=G.sort((B,$)=>B.seq-$.seq).map((B,$)=>qm(Nd({},B),{seq:$}));G.length>0;){let B=G.shift(),$=this.providers[B.provider];if($){let[Y,Ue]=yield F.callAdBreakAndContinue($,t,B,Rt=>{var jt;this.adsIsShowing=Rt,(jt=this.context.eventEmitter)==null||jt.emit("isAdShowing",Rt)});S=Y,N=Ue}else S=!0,N={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!S)break}S&&N&&((E=t.adBreakDone)==null||E.call(t,N))}}catch(k){(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(b=this.context.eventEmitter)==null||b.emit("isAdShowing",!1),this.adsActionDetection.adBreakIsShowing=!1}})}adUnit(t){console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.")}};var fS=Ce`
|
|
259
259
|
${ge}
|
|
260
260
|
position: fixed;
|
|
261
261
|
left: 0;
|