@jolibox/implement 1.3.5-beta.9 → 1.3.5
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.
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var MR=Object.create;var ka=Object.defineProperty,FR=Object.defineProperties,jR=Object.getOwnPropertyDescriptor,BR=Object.getOwnPropertyDescriptors,GR=Object.getOwnPropertyNames,Ca=Object.getOwnPropertySymbols,JR=Object.getPrototypeOf,Jc=Object.prototype.hasOwnProperty,Gm=Object.prototype.propertyIsEnumerable;var Bm=(e,t,r)=>t in e?ka(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))Jc.call(t,r)&&Bm(e,r,t[r]);if(Ca)for(var r of Ca(t))Gm.call(t,r)&&Bm(e,r,t[r]);return e},B=(e,t)=>FR(e,BR(t));var Xe=(e,t)=>{var r={};for(var n in e)Jc.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ca)for(var n of Ca(e))t.indexOf(n)<0&&Gm.call(e,n)&&(r[n]=e[n]);return r};var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jm=(e,t)=>{for(var r in t)ka(e,r,{get:t[r],enumerable:!0})},HR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GR(t))!Jc.call(e,i)&&i!==r&&ka(e,i,{get:()=>t[i],enumerable:!(n=jR(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?MR(JR(e)):{},HR(t||!e||!e.__esModule?ka(r,"default",{value:e,enumerable:!0}):r,e));var v=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function YR(e){return!!(e!=null&&e.__nativeBuffers__)}function Yc(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!YR(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=QR(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function ZR(e={},t=!1){let r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:XR(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function nO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function rg(e){return typeof e=="string"}function jn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function $m(e){return typeof e=="number"&&!isNaN(e)}function oO(e){return typeof e=="undefined"}function aO(e){return oO(e)||e===null}function ng(e){return typeof e=="function"}function sO(e){return jn(e)&&ng(e.then)}function ig(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Ji(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function hO(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}function bO(){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 EO(e){return new Promise(t=>og(e)(t))}function og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function AO(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Vi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function kO(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xO(e[n],t[n])}function xO(e,t){if(rg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ng(t)){try{if(e instanceof t)return}catch(r){}if(!aO(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 Rt(e,t){if(Xc.config[e]){Na.warn(`[can i use] ${e} already registered`);return}Xc.config[e]=pr({},t)}function zm(e,t){return`[${e}]:${t}`}function LO(e,t){Km||(Vc=new Ta({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Wc=new Ta({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),zc=new Ta({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Vc.flush(),Wc.flush(),zc.flush()}),Km=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:h,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Vc.report({status:b,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&h&&g&&(Wc.report({status:b,method:s,isForeground:d,duration:Number((h-c).toFixed(3))}),zc.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function FO(e,t){let r=0,n=!0,i=MO.resolveMap,o=LO(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Kc.forEach(l=>Ra(this,[l],function*({method:c,args:d,resolve:u}){let p=yield s(c,d);u(p)})),Kc.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Yc(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let h=new iO;if(i.set(r,h.resolve),!n&&RO.includes(l))return new Promise(E=>{Kc.push({method:l,args:c,resolve:E})});let g=zR(pr({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),b=!qO&&PO.includes(l),y=ZR(c,b),_=b?y:JSON.stringify(y),I;if(l.endsWith("Sync")||OO.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,y,r):typeof _=="string"?I=e.invoke(l,_,r):I=(u=e.call)==null?void 0:u.call(e,l,_,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=Yc(I)}catch(E){Na.error(E)}return i.delete(r),I.errorCode&&(I.errorCode=zm(l,I.errorCode)),o(pr(pr({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),h.promise.then(E=>(E.errorCode&&(E.errorCode=zm(l,E.errorCode)),o(pr(pr({},g),E)),E))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return sO(d)?d.then(u=>Ym(l,u)):Ym(l,d)},invokeHandler:a}}function Ym(e,t){if(!jn(t)){Na.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=KR(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new dO(n,i,o,a);return s}function jO(e){if(globalThis[xa])return globalThis[xa];let t=new tu,r=new tu,n=new Ta({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[xa]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=Yc(o),l;if(s.__extra){l=s.params;let{type:c,startTime:d}=s.__extra;n.report({type:c,event:i,duration:Date.now()-d})}else l=s;if(i===sg){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice($i.length),u,a)}catch(p){}});return}if(i.startsWith($i)){r.emit(i.slice($i.length),l,a);return}t.emit(i,l,a)}},globalThis[xa]}function BO(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${$i}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(sg,d,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${$i}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(NO,d,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function GO(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=jO(e),{invokeNative:a,invokeHandler:s,applyNative:l}=FO(e,r),{publish:c,emitNative:d}=BO(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function lg(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var $R,VR,WR,Pa,Xm,Zm,Hm,pr,zR,KR,Ra,QR,XR,eg,eO,tO,tg,rO,iO,lO,cO,Oa,uO,dO,pO,Hc,Na,Vm,fO,Qc,mO,Xc,gO,vO,yO,Fn,_O,s6,Zc,fe,wO,SO,Hi,Vi,tu,ru,IO,$c,CO,l6,nu,Wm,c6,ag,TO,$i,PO,RO,OO,sg,NO,DO,Ta,Km,Vc,Wc,zc,Kc,qO,iu,UO,MO,xa,ou,Pt,cg,ug,JO,dg,Qm,he,F,De,u6,HO,pg,au,d6,p6,ue=x(()=>{"use strict";$R=Object.defineProperty,VR=Object.defineProperties,WR=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,Xm=Object.prototype.hasOwnProperty,Zm=Object.prototype.propertyIsEnumerable,Hm=(e,t,r)=>t in e?$R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pr=(e,t)=>{for(var r in t||(t={}))Xm.call(t,r)&&Hm(e,r,t[r]);if(Pa)for(var r of Pa(t))Zm.call(t,r)&&Hm(e,r,t[r]);return e},zR=(e,t)=>VR(e,WR(t)),KR=(e,t)=>{var r={};for(var n in e)Xm.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pa)for(var n of Pa(e))t.indexOf(n)<0&&Zm.call(e,n)&&(r[n]=e[n]);return r},Ra=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});QR=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};XR=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)};eg=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,tO=(e,t)=>{for(var r in t)eg(e,r,{get:t[r],enumerable:!0})},tg=(e,t,r,n)=>{for(var i=n>1?void 0:n?eO(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&eg(t,r,i),i},rO=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);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}iO=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))}})}};lO=(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))(lO||{}),cO=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}},Oa=class extends cO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},uO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},dO=class extends Oa{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},pO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Hc=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Na={log:Ji("log"),warn:Ji("warn"),info:Ji("info"),error:Ji("error"),debug:Ji("debug")};Object.assign(globalThis,{logger:Na});Vm=Symbol.for("Jolibox.canIUseMap"),fO={};globalThis[Vm]||(globalThis[Vm]=fO);Qc=Symbol.for("Jolibox.canIUseMap.native"),mO={};globalThis[Qc]||(globalThis[Qc]=mO);Xc={get config(){return globalThis[Qc]}},gO=(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))(gO||{}),vO=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(vO||{}),yO=(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))(yO||{});bO();Fn=typeof window=="undefined",_O=()=>!Fn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),s6={isiOS:!Fn&&(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:!Fn&&navigator.userAgent.includes("Android"),isMac:!Fn&&navigator.userAgent.includes("Mac"),isFacebook:!Fn&&navigator.userAgent.includes("FB_IAB"),isPC:!Fn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Zc=class eu{constructor(t){this.element=t,this.next=eu.Undefined,this.prev=eu.Undefined}};Zc.Undefined=new Zc(void 0);fe=Zc,wO=class{constructor(){this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===fe.Undefined}clear(){let e=this._first;for(;e!==fe.Undefined;){let t=e.next;e.prev=fe.Undefined,e.next=fe.Undefined,e=t}this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new fe(e);if(this._first===fe.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!==fe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==fe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==fe.Undefined&&e.next!==fe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===fe.Undefined&&e.next===fe.Undefined?(this._first=fe.Undefined,this._last=fe.Undefined):e.next===fe.Undefined?(this._last=this._last.prev,this._last.next=fe.Undefined):e.prev===fe.Undefined&&(this._first=this._first.next,this._first.prev=fe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==fe.Undefined;)yield e.element,e=e.next}},SO=0,Hi=class{constructor(e){this.value=e,this.id=SO++}},Vi=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 Hi&&(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,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Hi(t);return this._listeners?this._listeners instanceof Hi?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,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Hi)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),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 Hi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},tu=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 Vi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),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 wO,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)}},ru={};tO(ru,{None:()=>IO,filter:()=>AO,once:()=>og,toPromise:()=>EO});IO=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});$c=Symbol.for("Jolibox.hostEmitter"),CO=()=>{let e=new tu;return globalThis[$c]||(globalThis[$c]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[$c]},l6=CO();nu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Vi,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 kO(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}};nu=tg([ig],nu);Wm=class{constructor(){this._onWillExecuteCommand=new Vi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Vi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new nu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nO(3e4)),this._starActivation}executeCommand(e,...t){return rO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ru.toPromise(ru.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}}};Wm=tg([ig],Wm);c6=Symbol.for("Jolibox.commands");Rt("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Rt("requestProductDetailsAsync",{version:102e4});Rt("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Rt("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Rt("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Rt("userTrackAsync",{version:1e6});Rt("openMiniapp",{version:1050100});Rt("requestCoinDetailsSync",{version:1070100});Rt("requestCoinDetailsAsync",{version:1070100});Rt("sendServerEventAsync",{version:1070100});Rt("loadAdsAsync",{version:1070200});Rt("showAdAsync",{version:1070200});ag=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Xc.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",d=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=hO(i,o);if(!s)return!1;if(jn(s)){let l=s.version;return $m(l)?typeof a=="number"&&a>=l:!0}return $m(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};TO=()=>_O(),$i="custom_event_",PO=[],RO=[],OO=["env","createRequestTask","login"],sg="__batch_event__",NO="__native_batch_event__",DO=e=>e==="pv"?e:"default",Ta=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=DO(a)}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,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&jn(a))throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(jn(a))l.push(...Object.keys(a));else if(rg(a)){if(i.length>0)throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Hc(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=jn(a)?a[c]:a;t(n[c],[...i],o,d)})}else n[o]?n[o]++:n[o]=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={}}},Km=!1;Kc=[],qO=!1,iu=Symbol.for("Jolibox.invokeResolverInstance"),UO=new Map;globalThis[iu]||(globalThis[iu]=UO);MO={get resolveMap(){return globalThis[iu]}};xa=Symbol.for("Jolibox.subscribeInstance");Pt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Pt.trigger=e},onDoExit(e){Pt.exit=e},onDoBackPress(e){Pt.backPress=e}},cg=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new uO("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=(i="")=>{Pt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ra(void 0,null,function*(){let o=yield Pt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});ou={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=lg(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:cg,doExit:r};globalThis.joliboxJSCore=pr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Pt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ra(void 0,null,function*(){let a=yield Pt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});ou={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=lg(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Ra(this,null,function*(){let a=yield Pt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:cg,doExit:n};globalThis.joliboxJSCore=pr({},i)}ug=ou;if(!ug&&TO())throw new pO("No joliboxJScore is found, native bridge not found.");JO=pr({},ug),dg=GO(JO),{invokeHandler:Qm}=dg,{applyNative:he,invokeNative:F,onNative:De,offNative:u6,subscribeHandler:HO,publish:pg,emitNative:au,subscribe:d6,unsubscribe:p6}=dg;globalThis.joliboxJSBridge={callHandler:Qm,invokeHandler:Qm,subscribeHandler:HO}});function KO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function La(e){return new Promise(t=>setTimeout(t,e))}function Qi(e){return typeof e=="string"}function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function bg(e){return typeof e=="object"&&Array.isArray(e)}function qa(e){return typeof e=="number"&&!isNaN(e)}function Fr(e){return e===!0||e===!1}function _g(e){return typeof e=="undefined"}function Xi(e){return _g(e)||e===null}function YO(e){return typeof e=="function"}function wg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Sg(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:mg(l)&&mg(s)?i[a]=n(vg({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function mg(e){return e&&typeof e=="object"&&e.constructor===Object}function Ig(e,t){if(Array.isArray(e))return e.concat(t)}function Zi(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),d=function(...u){i=u,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,c()},d}function XO(e,t){return(...r)=>t(e,...r)}function Bn(e){return t=>XO(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Wt(`${i}`))}})}function Wi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function xg(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let l=parseInt(i[s],10)||0,c=parseInt(o[s],10)||0;if(l>c){n=1;break}else if(l<c){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function bu(){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 i1(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function _u(e){return i1("app","stg-app",e)}function Jn(e){return`https://${_u(e)}`}function l1(e){return new Promise(t=>Og(e)(t))}function Og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function c1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Yi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function d1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)p1(e[n],t[n])}function p1(e,t){if(Qi(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(YO(t)){try{if(e instanceof t)return}catch(r){}if(!Xi(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 f1(){return typeof globalThis!="undefined"?globalThis[Ng]:void 0}function h1(e){typeof globalThis!="undefined"&&(globalThis[Ng]=e)}function W(e=!1){let t=f1();if(!e&&t)return t;let r=new Da,n=new pu,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return h1(i),i}var fu,$O,fg,VO,WO,hg,vg,zO,yg,ln,ut,QO,hu,eo,mu,Eg,Wt,Ua,Ag,Ma,Cg,kg,to,gu,zt,lu,ZO,vu,gg,e1,V,yu,t1,Gn,zi,ro,r1,n1,Tg,Pg,Rg,Ft,cu,me,o1,a1,Ki,Yi,Kt,du,s1,su,u1,_e,Da,pu,Ng,O=x(()=>{"use strict";fu=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,fg=Object.getOwnPropertySymbols,VO=Object.prototype.hasOwnProperty,WO=Object.prototype.propertyIsEnumerable,hg=(e,t,r)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vg=(e,t)=>{for(var r in t||(t={}))VO.call(t,r)&&hg(e,r,t[r]);if(fg)for(var r of fg(t))WO.call(t,r)&&hg(e,r,t[r]);return e},zO=(e,t)=>{for(var r in t)fu(e,r,{get:t[r],enumerable:!0})},yg=(e,t,r,n)=>{for(var i=n>1?void 0:n?$O(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&fu(t,r,i),i},ln=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);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}ut=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))}})}};QO=(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))(QO||{}),hu=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}},eo=class extends hu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},mu=class extends hu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Eg=class extends mu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Wt=class extends mu{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))}},Ua=class extends mu{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_PAYMENT_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Ag=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Ma=class extends eo{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="INTERNAL_PAYMENT_ERROR",this.priority="P0",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Cg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},kg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},to=class extends hu{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}}},gu=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};zt={log:Wi("log"),warn:Wi("warn"),info:Wi("info"),error:Wi("error"),debug:Wi("debug")};Object.assign(globalThis,{logger:zt});lu=Symbol.for("Jolibox.canIUseMap"),ZO={};globalThis[lu]||(globalThis[lu]=ZO);vu={get config(){return globalThis[lu]}},gg=Symbol.for("Jolibox.canIUseMap.native"),e1={};globalThis[gg]||(globalThis[gg]=e1);V=(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))(V||{}),yu=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(yu||{}),t1=(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))(t1||{}),Gn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});bu();zi=typeof window=="undefined",ro={isiOS:!zi&&(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:!zi&&navigator.userAgent.includes("Android"),isMac:!zi&&navigator.userAgent.includes("Mac"),isFacebook:!zi&&navigator.userAgent.includes("FB_IAB"),isPC:!zi&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},r1="device_id",n1="advertising_id",Tg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Gn()),window.__joliboxLocalStorage__.getItem(e)),Pg=()=>new URLSearchParams(window.location.search).get("deviceId")||Tg(r1),Rg=()=>new URLSearchParams(window.location.search).get("advertisingId")||Tg(n1);Ft=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=vg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return ln(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),o=this.createTimeoutPromise(),a=Promise.race([i,o]).catch(s=>ln(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,a),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 a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return ln(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);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),p=this.requestAdapter.extractRealTimeData(u),f=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return f&&!this.config.consistencyChecker(l,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(l,p)}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),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return d&&this.setCachedDataWithSequence(a,d,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 o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+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 ln(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return ln(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),o=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${o})`);let a=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,a);return s&&(this.setCachedDataWithSequence(i,s,o),console.log(`[RequestCacheService] Force updated cache for ${e}`)),a})}warmupCache(e,t){return ln(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)}},cu=class uu{constructor(t){this.element=t,this.next=uu.Undefined,this.prev=uu.Undefined}};cu.Undefined=new cu(void 0);me=cu,o1=class{constructor(){this._first=me.Undefined,this._last=me.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===me.Undefined}clear(){let e=this._first;for(;e!==me.Undefined;){let t=e.next;e.prev=me.Undefined,e.next=me.Undefined,e=t}this._first=me.Undefined,this._last=me.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new me(e);if(this._first===me.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!==me.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==me.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==me.Undefined&&e.next!==me.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===me.Undefined&&e.next===me.Undefined?(this._first=me.Undefined,this._last=me.Undefined):e.next===me.Undefined?(this._last=this._last.prev,this._last.next=me.Undefined):e.prev===me.Undefined&&(this._first=this._first.next,this._first.prev=me.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==me.Undefined;)yield e.element,e=e.next}},a1=0,Ki=class{constructor(e){this.value=e,this.id=a1++}},Yi=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 Ki&&(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,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Ki(t);return this._listeners?this._listeners instanceof Ki?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,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Ki)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),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 Ki?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Kt=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 Yi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),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 o1,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)}},du={};zO(du,{None:()=>s1,filter:()=>c1,once:()=>Og,toPromise:()=>l1});s1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});su=Symbol.for("Jolibox.hostEmitter"),u1=()=>{let e=new Kt;return globalThis[su]||(globalThis[su]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[su]},_e=u1();Da=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Yi,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 d1(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}};Da=yg([wg],Da);pu=class{constructor(){this._onWillExecuteCommand=new Yi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Yi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Da,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=KO(3e4)),this._starActivation}executeCommand(e,...t){return ln(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),du.toPromise(du.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}}};pu=yg([wg],pu);Ng=Symbol.for("Jolibox.commands")});function Ee(e,t={}){wu.emit("ERROR_REPORT",{error:e,options:t})}var wu,un,yt=x(()=>{"use strict";O();O();wu=new Kt,un=new Kt;Ee.debounce=Zi(Ee,50,{leading:!0})});var Su,m1,Dg,Lg,qg=x(()=>{"use strict";O();yt();Su=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{}}},m1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Dg=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[o,a,s]=i;return{headerJson:Su(o),payloadJson:Su(a),signature:Su(s)}}else throw"joli_source is missing"}catch(r){return Ee(new Ag(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Lg=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=m1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var g1,Iu,Ug=x(()=>{"use strict";O();g1="1.3.5-beta.9",Iu=()=>g1});function Au(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var v1,Mg,Eu,Fg,ge,y1,S,H=x(()=>{"use strict";O();qg();Ug();O();v1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Pg(),adId:Rg(),pixelRatio:window.devicePixelRatio||1,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Iu()},schema:window.location.href,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5"},Eu=(Mg=globalThis.joliboxJSCore)==null?void 0:Mg.env,ge=Object.assign({},(Fg=Eu==null?void 0:Eu())!=null?Fg:v1);y1=()=>{var g,b,y,_,I,E,T,k,C,G,ce;let{payloadJson:e,headerJson:t,signature:r}=ge.schema.length?Dg(ge.schema):{},n=`${ge.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ge.schema.length?ge.schema:window.location.href).searchParams,a=(y=(b=(g=o.get("mpId"))!=null?g:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(E=(I=(_=ge.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?I:o.get("sessionId"))!=null?E:n,l=!!((k=(T=e==null?void 0:e.testAdsMode)!=null?T:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),c=(ce=(G=(C=e==null?void 0:e.joliboxEnv)!=null?C:e==null?void 0:e.__joliboxEnv)!=null?G:o.get("joliboxEnv"))!=null?ce:"production",d=c==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,h=e==null?void 0:e.__shouldInterupt;return{get startTime(){var N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var N,R;return(R=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?R:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:Iu()},get mpType(){var N,R;return(R=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?R:"game"},get platform(){var N;return((N=ge.platform)!=null?N:ge.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ge.deviceInfo},get sdkInfo(){return ge.sdkInfo},get hostInfo(){return ge.hostInfo},get hostUserInfo(){return ge.hostUserInfo},get sessionId(){var N,R;return(R=(N=ge.clientSessionId)!=null?N:s)!=null?R:n},get channel(){return u},get webviewId(){var N;return(N=ge.webviewId)!=null?N:-1},get shouldInterupt(){return h},get from(){return e==null?void 0:e.__from},get baseApiHost(){return _u(d)},get adId(){var N;return(N=ge.deviceInfo.adId)!=null?N:ge.deviceInfo.did},get language(){return ge.deviceInfo.lang},get sdkEnvironment(){return Au("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Au("gamedistribution","jolibox")?"gamedistribution":Au("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,re,Mt;let N=(J=ge.deviceInfo.pixelRatio)!=null?J:1,R=(re=ge.deviceInfo.statusBarHeight)!=null?re:e==null?void 0:e.__androidStatusBarHeight,D=(Mt=ge.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:R!==void 0?R/N:20,navigationBarHeight:D!==void 0?D/N:10}},get abTests(){var N,R;return(R=(N=ge.abValues)==null?void 0:N.split(","))!=null?R:[]},get mpInfo(){var N;return(N=ge.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{Sg(ge,N,Ig)},encodeJoliSourceQuery:N=>{var R,D;return t&&r?Lg(P(P({},e),N),(R=o.get("joliSource"))!=null?R:""):(D=o.get("joliSource"))!=null?D:""},setDoExitDirectly:()=>{h=!1}}},S=y1()});var Cu,Bg,b1,_1,jg,w1,Gg=x(()=>{"use strict";O();yt();H();O();Cu=!1,Bg=(e,t)=>e==null?!1:t in e,b1=e=>Bg(e,"kind"),_1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},jg=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=S.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?un.emit("GLOBAL_USER_ERROR",e,i):un.emit("GLOBAL_ERROR",e,i)},w1=e=>Bg(e,"kind")&&e.kind==="USER_ERROR";wu.on("ERROR_REPORT",({error:e,options:t})=>{if(Cu)return;Cu=!0;let r=b1(e)&&e.raw?e.raw:e;try{let n=w1(e);jg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new gu(`${i}, origin error: ${r.message}`);zt.error(o),jg(new gu(o.message),{environment:t.environment},!1)}finally{Cu=!1}})});var Je,ku,jr=x(()=>{"use strict";yt();O();yt();Je=(e,t)=>{var r,n;return new to((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},ku=e=>new Eg(e)});var Jg=x(()=>{"use strict";Gg();jr();O();ue();un.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};F("trackAsync",{event:"reportJsError",data:r})});un.on("GLOBAL_USER_ERROR",(e,t)=>{zt.log("UserError",e,t)})});var xu=x(()=>{"use strict"});function Hg(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=Xe(c,["eventType"]),l=B(P({tag:n,eventType:o!=null?o:a!=null?a:V.Other},t),{extra:P({},s)});n=="globalJsError"?Ee(new kg(JSON.stringify(l))):e("systemLog",l,S.webviewId)};return r.debounce=Zi(r,500,{leading:!0}),r}function $g(e){let t=(r,n,i)=>{var s;let o=(s=i&&JSON.stringify(i))!=null?s:0,a={speed_value_type:r,total_duration:n};o&&Object.assign(a,{extra:o}),e("joliboxSpeedAnalysis",a)};return t.debounce=Zi(t,500,{leading:!0}),t}var Vg=x(()=>{"use strict";O();O();yt();H()});function Wg(e,t){let r=Hg(e,t),n=$g(r);return{track:r,trackPerformance:n}}var zg=x(()=>{"use strict";Vg()});var Kg=x(()=>{"use strict";H();O();O()});var Yg=x(()=>{"use strict";zg();xu();Kg()});var Fa,Qg=x(()=>{"use strict";Fa=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,o=!1,a=0,s=()=>{if(!o)return;let f=Date.now(),h=f-r;h>=this.interval&&(this.visible&&(a+=Math.min(h,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},l=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",f=>{o&&(console.log("visible",f),f?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,d(),u()}}}}});function ja(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:Jn(S.testMode),o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return De("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:g,state:b}=f,y=Xe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(g)}else if(u.state==="fail"){let h=u,{requestTaskId:g,state:b}=h,y=Xe(h,["requestTaskId","state"]);p.reject(y),n.delete(g)}else zt.warn("onRequestTaskStateChange unknown event",u)}),_e.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...h)=>v(this,[f,...h],function*(u,p={}){let g=Date.now(),b=S1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:I="json",timeout:E,enableCache:T=!1,appendHostCookie:k=!0}=p,C=Object.assign({"content-type":"application/json"},a,p.header),G={url:b,method:y,header:C,enableCache:T,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=E1(p.data,C["content-type"]);G.data=J}E&&Object.assign(G,{timeout:E});let{data:{requestTaskId:ce}}=F(e,G);if(typeof ce!="string")throw Je({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:R,promise:D}=new ut;n.set(ce,{resolve:N,reject:R});try{let J=yield D,{data:re}=J;return I==="json"&&typeof re=="string"&&(re=I1(re)),{url:b,timeout:E,method:y,response:B(P({},J),{data:re})}}catch(J){let re=J;if(cn(re)){let{errMsg:Mt,prefetchDetail:Bc,isPrefetch:Gc,errNo:UR}=re;Qi(Mt)&&Ee(Je({code:-1,msg:Mt},{errNo:UR,errMsg:Mt}))}throw J}})}function I1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function E1(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var S1,Tu=x(()=>{"use strict";O();ue();yt();jr();H();S1=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,i=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${i?`?${i}`:""}`:`${e}${i?`?${i}`:""}`}});var Pu,Xg,z,dt=x(()=>{"use strict";Tu();H();O();Pu={};(Xg=S.hostUserInfo)!=null&&Xg.token&&(Pu["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Pu["x-joli-source"]=S.joliSource);z=ja("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Jn(S.testMode),defaultHeaders:Pu})});function Zg(e){let t=vu.config[e];return t||(t={},vu.config[e]=t),(r,n)=>{if(t[r]){zt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var ev=x(()=>{"use strict";O()});function Ru(e){tv=e}function Ba(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Ba(t)):Object.keys(e).reduce((t,r)=>(t[r]=Ba(e[r]),t),{})}function fr(e){return typeof e=="number"}function Ou(e){let t=Nu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Nu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var tv,ke,Ga,Ja,Ha,$a,Hn,Va,Wa,za,Ka,Ya,Qa,Xa,Za,es,ts,rs,ns,Du=x(()=>{"use strict";tv=!1;ke=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(tv)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${Ou(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Ba(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Ba(this._default)}optional(){return this._optional=!0,this}};Ga=class extends ke{validate(t){return this._optional&&t===void 0?!0:fr(t)?fr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):fr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):fr(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},Ja=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ha=class extends ke{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(fr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(fr(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},$a=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Hn=class extends ke{validate(t){return!0}},Va=class extends ke{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Wa=class extends ke{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},za=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Ka=class extends ke{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Ou(t)}`)}return!0}},Ya=class extends ke{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(fr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(fr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(fr(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((o,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,o===void 0&&n.hasDefault){r[a]=n.defaultValue;return}n.validate(o)||(n.hasFallback?r[a]=n.fallbackValue:i=!1)}),this._uniqueItems){let o=new Map;for(let a in r)o.has(r[a])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${o.get(r[a])}] and ${this.path}[${a}] are identical)`):o.set(r[a],a)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},Qa=class extends ke{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,o=this._value;o.errors=this.errors;let a=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?o.path=`${this.path}.${s}`:o.path=`${this.path}["${s}"]`,!(l===void 0&&o._optional)){if(l===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(l)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Xa=class extends ke{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let o in this._object){let a=n[o],s=this._object[o];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(o)?s.path=`${this.path}.${o}`:s.path=`${this.path}["${o}"]`,!(s._optional&&a===void 0)){if(a===void 0&&s.hasDefault){n[o]=s.defaultValue;continue}s.validate(a)||(s.hasFallback?n[o]=s.fallbackValue:i=!1)}}return i}},Za=class extends ke{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Ou(this.value),actual:r}):!0}},es=class extends ke{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let o=0;o<i;o++){let a=this._items[o];if(a.errors=[],a.path=this.path,!a.validate(t))r.push(a.errors.join("; "));else if(!n){n=!0;break}}if(!n){let o=r.join(`
|
|
1
|
+
var MR=Object.create;var ka=Object.defineProperty,FR=Object.defineProperties,jR=Object.getOwnPropertyDescriptor,BR=Object.getOwnPropertyDescriptors,GR=Object.getOwnPropertyNames,Ca=Object.getOwnPropertySymbols,JR=Object.getPrototypeOf,Jc=Object.prototype.hasOwnProperty,Gm=Object.prototype.propertyIsEnumerable;var Bm=(e,t,r)=>t in e?ka(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))Jc.call(t,r)&&Bm(e,r,t[r]);if(Ca)for(var r of Ca(t))Gm.call(t,r)&&Bm(e,r,t[r]);return e},B=(e,t)=>FR(e,BR(t));var Xe=(e,t)=>{var r={};for(var n in e)Jc.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ca)for(var n of Ca(e))t.indexOf(n)<0&&Gm.call(e,n)&&(r[n]=e[n]);return r};var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jm=(e,t)=>{for(var r in t)ka(e,r,{get:t[r],enumerable:!0})},HR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GR(t))!Jc.call(e,i)&&i!==r&&ka(e,i,{get:()=>t[i],enumerable:!(n=jR(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?MR(JR(e)):{},HR(t||!e||!e.__esModule?ka(r,"default",{value:e,enumerable:!0}):r,e));var v=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function YR(e){return!!(e!=null&&e.__nativeBuffers__)}function Yc(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!YR(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=QR(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function ZR(e={},t=!1){let r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:XR(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function nO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function rg(e){return typeof e=="string"}function jn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function $m(e){return typeof e=="number"&&!isNaN(e)}function oO(e){return typeof e=="undefined"}function aO(e){return oO(e)||e===null}function ng(e){return typeof e=="function"}function sO(e){return jn(e)&&ng(e.then)}function ig(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Ji(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function hO(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}function bO(){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 EO(e){return new Promise(t=>og(e)(t))}function og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function AO(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Vi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function kO(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xO(e[n],t[n])}function xO(e,t){if(rg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ng(t)){try{if(e instanceof t)return}catch(r){}if(!aO(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 Rt(e,t){if(Xc.config[e]){Na.warn(`[can i use] ${e} already registered`);return}Xc.config[e]=pr({},t)}function zm(e,t){return`[${e}]:${t}`}function LO(e,t){Km||(Vc=new Ta({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Wc=new Ta({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),zc=new Ta({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Vc.flush(),Wc.flush(),zc.flush()}),Km=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:h,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Vc.report({status:b,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&h&&g&&(Wc.report({status:b,method:s,isForeground:d,duration:Number((h-c).toFixed(3))}),zc.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function FO(e,t){let r=0,n=!0,i=MO.resolveMap,o=LO(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Kc.forEach(l=>Ra(this,[l],function*({method:c,args:d,resolve:u}){let p=yield s(c,d);u(p)})),Kc.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Yc(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let h=new iO;if(i.set(r,h.resolve),!n&&RO.includes(l))return new Promise(E=>{Kc.push({method:l,args:c,resolve:E})});let g=zR(pr({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),b=!qO&&PO.includes(l),y=ZR(c,b),_=b?y:JSON.stringify(y),I;if(l.endsWith("Sync")||OO.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,y,r):typeof _=="string"?I=e.invoke(l,_,r):I=(u=e.call)==null?void 0:u.call(e,l,_,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=Yc(I)}catch(E){Na.error(E)}return i.delete(r),I.errorCode&&(I.errorCode=zm(l,I.errorCode)),o(pr(pr({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),h.promise.then(E=>(E.errorCode&&(E.errorCode=zm(l,E.errorCode)),o(pr(pr({},g),E)),E))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return sO(d)?d.then(u=>Ym(l,u)):Ym(l,d)},invokeHandler:a}}function Ym(e,t){if(!jn(t)){Na.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=KR(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new dO(n,i,o,a);return s}function jO(e){if(globalThis[xa])return globalThis[xa];let t=new tu,r=new tu,n=new Ta({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[xa]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=Yc(o),l;if(s.__extra){l=s.params;let{type:c,startTime:d}=s.__extra;n.report({type:c,event:i,duration:Date.now()-d})}else l=s;if(i===sg){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice($i.length),u,a)}catch(p){}});return}if(i.startsWith($i)){r.emit(i.slice($i.length),l,a);return}t.emit(i,l,a)}},globalThis[xa]}function BO(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${$i}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(sg,d,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${$i}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(NO,d,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function GO(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=jO(e),{invokeNative:a,invokeHandler:s,applyNative:l}=FO(e,r),{publish:c,emitNative:d}=BO(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function lg(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var $R,VR,WR,Pa,Xm,Zm,Hm,pr,zR,KR,Ra,QR,XR,eg,eO,tO,tg,rO,iO,lO,cO,Oa,uO,dO,pO,Hc,Na,Vm,fO,Qc,mO,Xc,gO,vO,yO,Fn,_O,s6,Zc,fe,wO,SO,Hi,Vi,tu,ru,IO,$c,CO,l6,nu,Wm,c6,ag,TO,$i,PO,RO,OO,sg,NO,DO,Ta,Km,Vc,Wc,zc,Kc,qO,iu,UO,MO,xa,ou,Pt,cg,ug,JO,dg,Qm,he,F,De,u6,HO,pg,au,d6,p6,ue=x(()=>{"use strict";$R=Object.defineProperty,VR=Object.defineProperties,WR=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,Xm=Object.prototype.hasOwnProperty,Zm=Object.prototype.propertyIsEnumerable,Hm=(e,t,r)=>t in e?$R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pr=(e,t)=>{for(var r in t||(t={}))Xm.call(t,r)&&Hm(e,r,t[r]);if(Pa)for(var r of Pa(t))Zm.call(t,r)&&Hm(e,r,t[r]);return e},zR=(e,t)=>VR(e,WR(t)),KR=(e,t)=>{var r={};for(var n in e)Xm.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pa)for(var n of Pa(e))t.indexOf(n)<0&&Zm.call(e,n)&&(r[n]=e[n]);return r},Ra=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});QR=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};XR=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)};eg=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,tO=(e,t)=>{for(var r in t)eg(e,r,{get:t[r],enumerable:!0})},tg=(e,t,r,n)=>{for(var i=n>1?void 0:n?eO(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&eg(t,r,i),i},rO=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);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}iO=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))}})}};lO=(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))(lO||{}),cO=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}},Oa=class extends cO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},uO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},dO=class extends Oa{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},pO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Hc=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Na={log:Ji("log"),warn:Ji("warn"),info:Ji("info"),error:Ji("error"),debug:Ji("debug")};Object.assign(globalThis,{logger:Na});Vm=Symbol.for("Jolibox.canIUseMap"),fO={};globalThis[Vm]||(globalThis[Vm]=fO);Qc=Symbol.for("Jolibox.canIUseMap.native"),mO={};globalThis[Qc]||(globalThis[Qc]=mO);Xc={get config(){return globalThis[Qc]}},gO=(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))(gO||{}),vO=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(vO||{}),yO=(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))(yO||{});bO();Fn=typeof window=="undefined",_O=()=>!Fn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),s6={isiOS:!Fn&&(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:!Fn&&navigator.userAgent.includes("Android"),isMac:!Fn&&navigator.userAgent.includes("Mac"),isFacebook:!Fn&&navigator.userAgent.includes("FB_IAB"),isPC:!Fn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Zc=class eu{constructor(t){this.element=t,this.next=eu.Undefined,this.prev=eu.Undefined}};Zc.Undefined=new Zc(void 0);fe=Zc,wO=class{constructor(){this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===fe.Undefined}clear(){let e=this._first;for(;e!==fe.Undefined;){let t=e.next;e.prev=fe.Undefined,e.next=fe.Undefined,e=t}this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new fe(e);if(this._first===fe.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!==fe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==fe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==fe.Undefined&&e.next!==fe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===fe.Undefined&&e.next===fe.Undefined?(this._first=fe.Undefined,this._last=fe.Undefined):e.next===fe.Undefined?(this._last=this._last.prev,this._last.next=fe.Undefined):e.prev===fe.Undefined&&(this._first=this._first.next,this._first.prev=fe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==fe.Undefined;)yield e.element,e=e.next}},SO=0,Hi=class{constructor(e){this.value=e,this.id=SO++}},Vi=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 Hi&&(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,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Hi(t);return this._listeners?this._listeners instanceof Hi?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,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Hi)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),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 Hi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},tu=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 Vi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),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 wO,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)}},ru={};tO(ru,{None:()=>IO,filter:()=>AO,once:()=>og,toPromise:()=>EO});IO=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});$c=Symbol.for("Jolibox.hostEmitter"),CO=()=>{let e=new tu;return globalThis[$c]||(globalThis[$c]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[$c]},l6=CO();nu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Vi,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 kO(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}};nu=tg([ig],nu);Wm=class{constructor(){this._onWillExecuteCommand=new Vi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Vi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new nu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nO(3e4)),this._starActivation}executeCommand(e,...t){return rO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ru.toPromise(ru.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}}};Wm=tg([ig],Wm);c6=Symbol.for("Jolibox.commands");Rt("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Rt("requestProductDetailsAsync",{version:102e4});Rt("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Rt("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Rt("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Rt("userTrackAsync",{version:1e6});Rt("openMiniapp",{version:1050100});Rt("requestCoinDetailsSync",{version:1070100});Rt("requestCoinDetailsAsync",{version:1070100});Rt("sendServerEventAsync",{version:1070100});Rt("loadAdsAsync",{version:1070200});Rt("showAdAsync",{version:1070200});ag=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Xc.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",d=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=hO(i,o);if(!s)return!1;if(jn(s)){let l=s.version;return $m(l)?typeof a=="number"&&a>=l:!0}return $m(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};TO=()=>_O(),$i="custom_event_",PO=[],RO=[],OO=["env","createRequestTask","login"],sg="__batch_event__",NO="__native_batch_event__",DO=e=>e==="pv"?e:"default",Ta=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=DO(a)}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,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&jn(a))throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(jn(a))l.push(...Object.keys(a));else if(rg(a)){if(i.length>0)throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Hc(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=jn(a)?a[c]:a;t(n[c],[...i],o,d)})}else n[o]?n[o]++:n[o]=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={}}},Km=!1;Kc=[],qO=!1,iu=Symbol.for("Jolibox.invokeResolverInstance"),UO=new Map;globalThis[iu]||(globalThis[iu]=UO);MO={get resolveMap(){return globalThis[iu]}};xa=Symbol.for("Jolibox.subscribeInstance");Pt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Pt.trigger=e},onDoExit(e){Pt.exit=e},onDoBackPress(e){Pt.backPress=e}},cg=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new uO("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=(i="")=>{Pt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ra(void 0,null,function*(){let o=yield Pt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});ou={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=lg(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:cg,doExit:r};globalThis.joliboxJSCore=pr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Pt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ra(void 0,null,function*(){let a=yield Pt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});ou={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=lg(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Ra(this,null,function*(){let a=yield Pt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:cg,doExit:n};globalThis.joliboxJSCore=pr({},i)}ug=ou;if(!ug&&TO())throw new pO("No joliboxJScore is found, native bridge not found.");JO=pr({},ug),dg=GO(JO),{invokeHandler:Qm}=dg,{applyNative:he,invokeNative:F,onNative:De,offNative:u6,subscribeHandler:HO,publish:pg,emitNative:au,subscribe:d6,unsubscribe:p6}=dg;globalThis.joliboxJSBridge={callHandler:Qm,invokeHandler:Qm,subscribeHandler:HO}});function KO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function La(e){return new Promise(t=>setTimeout(t,e))}function Qi(e){return typeof e=="string"}function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function bg(e){return typeof e=="object"&&Array.isArray(e)}function qa(e){return typeof e=="number"&&!isNaN(e)}function Fr(e){return e===!0||e===!1}function _g(e){return typeof e=="undefined"}function Xi(e){return _g(e)||e===null}function YO(e){return typeof e=="function"}function wg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Sg(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:mg(l)&&mg(s)?i[a]=n(vg({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function mg(e){return e&&typeof e=="object"&&e.constructor===Object}function Ig(e,t){if(Array.isArray(e))return e.concat(t)}function Zi(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),d=function(...u){i=u,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,c()},d}function XO(e,t){return(...r)=>t(e,...r)}function Bn(e){return t=>XO(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Wt(`${i}`))}})}function Wi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function xg(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let l=parseInt(i[s],10)||0,c=parseInt(o[s],10)||0;if(l>c){n=1;break}else if(l<c){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function bu(){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 i1(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function _u(e){return i1("app","stg-app",e)}function Jn(e){return`https://${_u(e)}`}function l1(e){return new Promise(t=>Og(e)(t))}function Og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function c1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Yi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function d1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)p1(e[n],t[n])}function p1(e,t){if(Qi(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(YO(t)){try{if(e instanceof t)return}catch(r){}if(!Xi(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 f1(){return typeof globalThis!="undefined"?globalThis[Ng]:void 0}function h1(e){typeof globalThis!="undefined"&&(globalThis[Ng]=e)}function W(e=!1){let t=f1();if(!e&&t)return t;let r=new Da,n=new pu,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return h1(i),i}var fu,$O,fg,VO,WO,hg,vg,zO,yg,ln,ut,QO,hu,eo,mu,Eg,Wt,Ua,Ag,Ma,Cg,kg,to,gu,zt,lu,ZO,vu,gg,e1,V,yu,t1,Gn,zi,ro,r1,n1,Tg,Pg,Rg,Ft,cu,me,o1,a1,Ki,Yi,Kt,du,s1,su,u1,_e,Da,pu,Ng,O=x(()=>{"use strict";fu=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,fg=Object.getOwnPropertySymbols,VO=Object.prototype.hasOwnProperty,WO=Object.prototype.propertyIsEnumerable,hg=(e,t,r)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vg=(e,t)=>{for(var r in t||(t={}))VO.call(t,r)&&hg(e,r,t[r]);if(fg)for(var r of fg(t))WO.call(t,r)&&hg(e,r,t[r]);return e},zO=(e,t)=>{for(var r in t)fu(e,r,{get:t[r],enumerable:!0})},yg=(e,t,r,n)=>{for(var i=n>1?void 0:n?$O(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&fu(t,r,i),i},ln=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);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}ut=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))}})}};QO=(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))(QO||{}),hu=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}},eo=class extends hu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},mu=class extends hu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Eg=class extends mu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Wt=class extends mu{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))}},Ua=class extends mu{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_PAYMENT_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Ag=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Ma=class extends eo{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="INTERNAL_PAYMENT_ERROR",this.priority="P0",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Cg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},kg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},to=class extends hu{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}}},gu=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};zt={log:Wi("log"),warn:Wi("warn"),info:Wi("info"),error:Wi("error"),debug:Wi("debug")};Object.assign(globalThis,{logger:zt});lu=Symbol.for("Jolibox.canIUseMap"),ZO={};globalThis[lu]||(globalThis[lu]=ZO);vu={get config(){return globalThis[lu]}},gg=Symbol.for("Jolibox.canIUseMap.native"),e1={};globalThis[gg]||(globalThis[gg]=e1);V=(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))(V||{}),yu=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(yu||{}),t1=(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))(t1||{}),Gn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});bu();zi=typeof window=="undefined",ro={isiOS:!zi&&(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:!zi&&navigator.userAgent.includes("Android"),isMac:!zi&&navigator.userAgent.includes("Mac"),isFacebook:!zi&&navigator.userAgent.includes("FB_IAB"),isPC:!zi&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},r1="device_id",n1="advertising_id",Tg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Gn()),window.__joliboxLocalStorage__.getItem(e)),Pg=()=>new URLSearchParams(window.location.search).get("deviceId")||Tg(r1),Rg=()=>new URLSearchParams(window.location.search).get("advertisingId")||Tg(n1);Ft=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=vg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return ln(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),o=this.createTimeoutPromise(),a=Promise.race([i,o]).catch(s=>ln(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,a),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 a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return ln(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);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),p=this.requestAdapter.extractRealTimeData(u),f=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return f&&!this.config.consistencyChecker(l,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(l,p)}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),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return d&&this.setCachedDataWithSequence(a,d,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 o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+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 ln(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return ln(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),o=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${o})`);let a=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,a);return s&&(this.setCachedDataWithSequence(i,s,o),console.log(`[RequestCacheService] Force updated cache for ${e}`)),a})}warmupCache(e,t){return ln(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)}},cu=class uu{constructor(t){this.element=t,this.next=uu.Undefined,this.prev=uu.Undefined}};cu.Undefined=new cu(void 0);me=cu,o1=class{constructor(){this._first=me.Undefined,this._last=me.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===me.Undefined}clear(){let e=this._first;for(;e!==me.Undefined;){let t=e.next;e.prev=me.Undefined,e.next=me.Undefined,e=t}this._first=me.Undefined,this._last=me.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new me(e);if(this._first===me.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!==me.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==me.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==me.Undefined&&e.next!==me.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===me.Undefined&&e.next===me.Undefined?(this._first=me.Undefined,this._last=me.Undefined):e.next===me.Undefined?(this._last=this._last.prev,this._last.next=me.Undefined):e.prev===me.Undefined&&(this._first=this._first.next,this._first.prev=me.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==me.Undefined;)yield e.element,e=e.next}},a1=0,Ki=class{constructor(e){this.value=e,this.id=a1++}},Yi=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 Ki&&(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,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Ki(t);return this._listeners?this._listeners instanceof Ki?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,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Ki)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),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 Ki?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Kt=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 Yi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),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 o1,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)}},du={};zO(du,{None:()=>s1,filter:()=>c1,once:()=>Og,toPromise:()=>l1});s1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});su=Symbol.for("Jolibox.hostEmitter"),u1=()=>{let e=new Kt;return globalThis[su]||(globalThis[su]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[su]},_e=u1();Da=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Yi,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 d1(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}};Da=yg([wg],Da);pu=class{constructor(){this._onWillExecuteCommand=new Yi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Yi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Da,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=KO(3e4)),this._starActivation}executeCommand(e,...t){return ln(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),du.toPromise(du.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}}};pu=yg([wg],pu);Ng=Symbol.for("Jolibox.commands")});function Ee(e,t={}){wu.emit("ERROR_REPORT",{error:e,options:t})}var wu,un,yt=x(()=>{"use strict";O();O();wu=new Kt,un=new Kt;Ee.debounce=Zi(Ee,50,{leading:!0})});var Su,m1,Dg,Lg,qg=x(()=>{"use strict";O();yt();Su=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{}}},m1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Dg=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[o,a,s]=i;return{headerJson:Su(o),payloadJson:Su(a),signature:Su(s)}}else throw"joli_source is missing"}catch(r){return Ee(new Ag(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Lg=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=m1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var g1,Iu,Ug=x(()=>{"use strict";O();g1="1.3.5",Iu=()=>g1});function Au(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var v1,Mg,Eu,Fg,ge,y1,S,H=x(()=>{"use strict";O();qg();Ug();O();v1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Pg(),adId:Rg(),pixelRatio:window.devicePixelRatio||1,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Iu()},schema:window.location.href,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5"},Eu=(Mg=globalThis.joliboxJSCore)==null?void 0:Mg.env,ge=Object.assign({},(Fg=Eu==null?void 0:Eu())!=null?Fg:v1);y1=()=>{var g,b,y,_,I,E,T,k,C,G,ce;let{payloadJson:e,headerJson:t,signature:r}=ge.schema.length?Dg(ge.schema):{},n=`${ge.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ge.schema.length?ge.schema:window.location.href).searchParams,a=(y=(b=(g=o.get("mpId"))!=null?g:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(E=(I=(_=ge.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?I:o.get("sessionId"))!=null?E:n,l=!!((k=(T=e==null?void 0:e.testAdsMode)!=null?T:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),c=(ce=(G=(C=e==null?void 0:e.joliboxEnv)!=null?C:e==null?void 0:e.__joliboxEnv)!=null?G:o.get("joliboxEnv"))!=null?ce:"production",d=c==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,h=e==null?void 0:e.__shouldInterupt;return{get startTime(){var N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var N,R;return(R=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?R:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:Iu()},get mpType(){var N,R;return(R=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?R:"game"},get platform(){var N;return((N=ge.platform)!=null?N:ge.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ge.deviceInfo},get sdkInfo(){return ge.sdkInfo},get hostInfo(){return ge.hostInfo},get hostUserInfo(){return ge.hostUserInfo},get sessionId(){var N,R;return(R=(N=ge.clientSessionId)!=null?N:s)!=null?R:n},get channel(){return u},get webviewId(){var N;return(N=ge.webviewId)!=null?N:-1},get shouldInterupt(){return h},get from(){return e==null?void 0:e.__from},get baseApiHost(){return _u(d)},get adId(){var N;return(N=ge.deviceInfo.adId)!=null?N:ge.deviceInfo.did},get language(){return ge.deviceInfo.lang},get sdkEnvironment(){return Au("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Au("gamedistribution","jolibox")?"gamedistribution":Au("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,re,Mt;let N=(J=ge.deviceInfo.pixelRatio)!=null?J:1,R=(re=ge.deviceInfo.statusBarHeight)!=null?re:e==null?void 0:e.__androidStatusBarHeight,D=(Mt=ge.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:R!==void 0?R/N:20,navigationBarHeight:D!==void 0?D/N:10}},get abTests(){var N,R;return(R=(N=ge.abValues)==null?void 0:N.split(","))!=null?R:[]},get mpInfo(){var N;return(N=ge.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{Sg(ge,N,Ig)},encodeJoliSourceQuery:N=>{var R,D;return t&&r?Lg(P(P({},e),N),(R=o.get("joliSource"))!=null?R:""):(D=o.get("joliSource"))!=null?D:""},setDoExitDirectly:()=>{h=!1}}},S=y1()});var Cu,Bg,b1,_1,jg,w1,Gg=x(()=>{"use strict";O();yt();H();O();Cu=!1,Bg=(e,t)=>e==null?!1:t in e,b1=e=>Bg(e,"kind"),_1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},jg=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=S.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?un.emit("GLOBAL_USER_ERROR",e,i):un.emit("GLOBAL_ERROR",e,i)},w1=e=>Bg(e,"kind")&&e.kind==="USER_ERROR";wu.on("ERROR_REPORT",({error:e,options:t})=>{if(Cu)return;Cu=!0;let r=b1(e)&&e.raw?e.raw:e;try{let n=w1(e);jg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new gu(`${i}, origin error: ${r.message}`);zt.error(o),jg(new gu(o.message),{environment:t.environment},!1)}finally{Cu=!1}})});var Je,ku,jr=x(()=>{"use strict";yt();O();yt();Je=(e,t)=>{var r,n;return new to((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},ku=e=>new Eg(e)});var Jg=x(()=>{"use strict";Gg();jr();O();ue();un.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};F("trackAsync",{event:"reportJsError",data:r})});un.on("GLOBAL_USER_ERROR",(e,t)=>{zt.log("UserError",e,t)})});var xu=x(()=>{"use strict"});function Hg(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=Xe(c,["eventType"]),l=B(P({tag:n,eventType:o!=null?o:a!=null?a:V.Other},t),{extra:P({},s)});n=="globalJsError"?Ee(new kg(JSON.stringify(l))):e("systemLog",l,S.webviewId)};return r.debounce=Zi(r,500,{leading:!0}),r}function $g(e){let t=(r,n,i)=>{var s;let o=(s=i&&JSON.stringify(i))!=null?s:0,a={speed_value_type:r,total_duration:n};o&&Object.assign(a,{extra:o}),e("joliboxSpeedAnalysis",a)};return t.debounce=Zi(t,500,{leading:!0}),t}var Vg=x(()=>{"use strict";O();O();yt();H()});function Wg(e,t){let r=Hg(e,t),n=$g(r);return{track:r,trackPerformance:n}}var zg=x(()=>{"use strict";Vg()});var Kg=x(()=>{"use strict";H();O();O()});var Yg=x(()=>{"use strict";zg();xu();Kg()});var Fa,Qg=x(()=>{"use strict";Fa=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,o=!1,a=0,s=()=>{if(!o)return;let f=Date.now(),h=f-r;h>=this.interval&&(this.visible&&(a+=Math.min(h,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},l=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",f=>{o&&(console.log("visible",f),f?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,d(),u()}}}}});function ja(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:Jn(S.testMode),o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return De("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:g,state:b}=f,y=Xe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(g)}else if(u.state==="fail"){let h=u,{requestTaskId:g,state:b}=h,y=Xe(h,["requestTaskId","state"]);p.reject(y),n.delete(g)}else zt.warn("onRequestTaskStateChange unknown event",u)}),_e.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...h)=>v(this,[f,...h],function*(u,p={}){let g=Date.now(),b=S1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:I="json",timeout:E,enableCache:T=!1,appendHostCookie:k=!0}=p,C=Object.assign({"content-type":"application/json"},a,p.header),G={url:b,method:y,header:C,enableCache:T,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=E1(p.data,C["content-type"]);G.data=J}E&&Object.assign(G,{timeout:E});let{data:{requestTaskId:ce}}=F(e,G);if(typeof ce!="string")throw Je({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:R,promise:D}=new ut;n.set(ce,{resolve:N,reject:R});try{let J=yield D,{data:re}=J;return I==="json"&&typeof re=="string"&&(re=I1(re)),{url:b,timeout:E,method:y,response:B(P({},J),{data:re})}}catch(J){let re=J;if(cn(re)){let{errMsg:Mt,prefetchDetail:Bc,isPrefetch:Gc,errNo:UR}=re;Qi(Mt)&&Ee(Je({code:-1,msg:Mt},{errNo:UR,errMsg:Mt}))}throw J}})}function I1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function E1(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var S1,Tu=x(()=>{"use strict";O();ue();yt();jr();H();S1=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,i=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${i?`?${i}`:""}`:`${e}${i?`?${i}`:""}`}});var Pu,Xg,z,dt=x(()=>{"use strict";Tu();H();O();Pu={};(Xg=S.hostUserInfo)!=null&&Xg.token&&(Pu["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Pu["x-joli-source"]=S.joliSource);z=ja("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Jn(S.testMode),defaultHeaders:Pu})});function Zg(e){let t=vu.config[e];return t||(t={},vu.config[e]=t),(r,n)=>{if(t[r]){zt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var ev=x(()=>{"use strict";O()});function Ru(e){tv=e}function Ba(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Ba(t)):Object.keys(e).reduce((t,r)=>(t[r]=Ba(e[r]),t),{})}function fr(e){return typeof e=="number"}function Ou(e){let t=Nu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Nu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var tv,ke,Ga,Ja,Ha,$a,Hn,Va,Wa,za,Ka,Ya,Qa,Xa,Za,es,ts,rs,ns,Du=x(()=>{"use strict";tv=!1;ke=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(tv)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${Ou(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Ba(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Ba(this._default)}optional(){return this._optional=!0,this}};Ga=class extends ke{validate(t){return this._optional&&t===void 0?!0:fr(t)?fr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):fr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):fr(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},Ja=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ha=class extends ke{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(fr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(fr(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},$a=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Hn=class extends ke{validate(t){return!0}},Va=class extends ke{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Wa=class extends ke{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},za=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Ka=class extends ke{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Ou(t)}`)}return!0}},Ya=class extends ke{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(fr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(fr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(fr(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((o,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,o===void 0&&n.hasDefault){r[a]=n.defaultValue;return}n.validate(o)||(n.hasFallback?r[a]=n.fallbackValue:i=!1)}),this._uniqueItems){let o=new Map;for(let a in r)o.has(r[a])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${o.get(r[a])}] and ${this.path}[${a}] are identical)`):o.set(r[a],a)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},Qa=class extends ke{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,o=this._value;o.errors=this.errors;let a=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?o.path=`${this.path}.${s}`:o.path=`${this.path}["${s}"]`,!(l===void 0&&o._optional)){if(l===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(l)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Xa=class extends ke{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let o in this._object){let a=n[o],s=this._object[o];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(o)?s.path=`${this.path}.${o}`:s.path=`${this.path}["${o}"]`,!(s._optional&&a===void 0)){if(a===void 0&&s.hasDefault){n[o]=s.defaultValue;continue}s.validate(a)||(s.hasFallback?n[o]=s.fallbackValue:i=!1)}}return i}},Za=class extends ke{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Ou(this.value),actual:r}):!0}},es=class extends ke{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let o=0;o<i;o++){let a=this._items[o];if(a.errors=[],a.path=this.path,!a.validate(t))r.push(a.errors.join("; "));else if(!n){n=!0;break}}if(!n){let o=r.join(`
|
|
2
2
|
or `);this.errors.push(o)}return n}},ts=class extends ke{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let i=t[n];if(i._optional||i.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,t[i]===void 0&&n.hasDefault){t[i]=n.defaultValue;return}n.validate(t[i])||(n.hasFallback?t[i]=n._fallback:r=!1)}),r}},rs=class extends ke{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},ns=class extends ke{constructor(t){super(),this._ctor=t}validate(t){return t===void 0&&this._optional||t instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:t})}}});function Lu(e,t,r="param"){if(e.errors=[],e.path=r,Ru(!0),!e.validate(t)){let n=e.errors.join(`
|
|
3
3
|
`);throw e.errors.length=0,Ru(!1),new TypeError(n)}}var A,qu=x(()=>{"use strict";Du();Du();A={object(e){return new Xa(e)},array(e){return new Ya(e)},tuple(...e){return new ts(...e)},literal(e){return new Za(e)},or(...e){return new es(...e)},symbol(){return new $a},record(e){return new Qa(e)},function(){return new za},boolean(){return new Ja},string(){return new Ha},number(){return new Ga},undefined(){return new Va},null(){return new Wa},unknown(){return new Hn},any(){return new Hn},as(){return new Hn},arraybuffer(){return new rs},enum(...e){return new Ka(...e)},typedarray(e){return new ns(e)}}});var is,rv,nv=x(()=>{"use strict";O();yt();qu();jr();is=1,rv=e=>{function t(n,i){return(...o)=>{var u,p,f,h;let a=Date.now(),s={method:n,trace_id:is};is+=1;let l="SUCCESS",c=`${n}:ok`,d=0;try{if(i.paramsSchema)try{Lu(i.paramsSchema,o,"params")}catch(_){throw ku(`${n}:fail ${_.message}`)}let g=i.implement(...o),b=g,y=`${n}:ok`;if(g&&"code"in g){let{code:_,data:I,message:E}=g;l=_,b=I,y=E}return{code:l,message:y,data:b}}catch(g){let b=g;d=(p=(u=b.code)!=null?u:b.errNo)!=null?p:2e3,l="FAILURE";let y=(h=(f=b.message)!=null?f:b.errMsg)!=null?h:`${g}`;return c=`${n}:${l} ${y.replace(/^\S+:(fail|cancel)\s?/,"")}`,Ee(new to(c,d)),{code:l,message:c}}finally{let g=Date.now()-a}}}function r(n,i){return(...o)=>v(this,null,function*(){var p,f,h,g;let a=bg(o)?o:[o],s=Date.now(),l={method:n,trace_id:is};is+=1;let c=`${n}:ok`,d="SUCCESS",u={code:d,message:c};try{if(i.paramsSchema)try{Lu(i.paramsSchema,a,"params")}catch(_){throw ku(_.message)}let y=yield i.implement(...a);if(y&&"code"in y){let{code:_,data:I,message:E}=y;d=_,c=E,y=I}return Object.assign(u,{code:d,message:c,data:y}),u}catch(b){let y=b,_=(f=(p=y.code)!=null?p:y.errNo)!=null?f:2e3;d="FAILURE";let I=(g=(h=y.message)!=null?h:y.errMsg)!=null?g:`${b}`,E=`${n}:${d} ${I.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:d,message:E}),Ee(new to(E,_)),u}finally{let b=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var je,Uu=x(()=>{"use strict";H();ue();({canIUseNative:je}=ag(()=>S.sdkInfo.nativeSDKVersionCode,()=>S.platform))});function Mu(e){if(typeof e!="number"||e<=0)return"0.0.0";let t=e.toString(),r=0,n=0,i=0;return t.length>=1&&(r=parseInt(t.substring(0,1),10)),t.length>=3&&(n=parseInt(t.substring(1,3),10)),t.length>=5&&(i=parseInt(t.substring(3,5),10)),`${r}.${n}.${i}`}var iv=x(()=>{"use strict"});var ie,Y,L,He=x(()=>{"use strict";ev();bt();nv();qu();Uu();iv();({createAPI:ie,createSyncAPI:Y}=rv(j)),L=Zg("native")});function ov(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return t==="array"&&(t="object"),P1.includes(t)?t:""}function av(e,t){try{switch(t){case"string":return e;case"object":return JSON.parse(e);case"number":return parseFloat(e);case"boolean":return e==="true";default:return""}}catch(r){return""}}function sv(e,t){try{switch(t){case"string":case"number":case"boolean":return`${e}`;case"object":return JSON.stringify(e);default:return""}}catch(r){return""}}var os,C1,k1,x1,T1,j8,B8,P1,Br,_t,no=x(()=>{"use strict";He();ue();O();dt();H();os=W(),C1=ie("getLocalStorage",{paramsSchema:A.tuple(A.string()),implement(e){return v(this,null,function*(){let{response:t}=yield z(`/api/games/user-storage/${S.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:i}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:i==null?void 0:i.value};try{let{data:{data:o,dataType:a}}=yield he("getLocalStorageAsync",{key:e}),s=av(o,a);return{code:r,message:`${n}. fallback to native`,data:s}}catch(o){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});os.registerCommand("StorageSDK.getItem",C1);L("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});k1=ie("setStorage",{paramsSchema:A.tuple(A.string(),A.or(A.string(),A.boolean(),A.number())),implement(e,t){return v(this,null,function*(){let r=S.mpId,n=typeof t=="string"?t:String(t),{response:i}=yield z(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:o,message:a}}=i,s=ov(t),l=sv(t,s);return yield he("setLocalStorageAsync",{key:e,data:l,dataType:s}),o=="SUCCESS"?{code:o,message:a}:{code:o,message:`${a}. fallback to native`}})}});os.registerCommand("StorageSDK.setItem",k1);L("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});x1=ie("removeStorage",{paramsSchema:A.tuple(A.string()),implement(e){return v(this,null,function*(){let t=S.mpId,{response:r}=yield z(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:i}}=r;return yield he("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:i}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});os.registerCommand("StorageSDK.removeItem",x1);L("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});T1=ie("clearStorage",{implement(){return v(this,null,function*(){let e=S.mpId,{response:t}=yield z(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});he("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});os.registerCommand("StorageSDK.clear",T1);L("storage.clear",{version:"1.0.0"});j8=ie("getStorageInfo",{implement(){return v(this,null,function*(){let{data:e}=yield he("getStorageInfoAsync");return e})}});L("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});B8=Y("getStorageInfoSync",{implement(){return F("getStorageInfoSync")}}),P1=["string","number","boolean","object",""];Br=ie("getGlobalStorage",{paramsSchema:A.tuple(A.string()),implement(e){return v(this,null,function*(){try{let{data:{data:t,dataType:r}}=yield he("getGlobalStorageAsync",{key:e});return{code:"SUCCESS",message:"success",data:av(t,r)}}catch(t){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get global storage failed",data:null}}})}}),_t=ie("setGlobalStorage",{paramsSchema:A.tuple(A.string(),A.or(A.string(),A.boolean(),A.number(),A.array())),implement(e,t){return v(this,null,function*(){try{let r=ov(t),n=sv(t,r);return yield he("setGlobalStorageAsync",{key:e,data:n,dataType:r}),{code:"SUCCESS",message:"success"}}catch(r){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] set global storage failed"}}})}})});var lv,as,cv=x(()=>{"use strict";H();Qg();O();dt();ue();no();Uu();lv="REPORT_FIRST_OPEN_GAME",as=class extends Fa{constructor(t,r,n){super(r,n),this.gameId=S.mpId,this.sessionId=S.sessionId,this.track=t,this.taskUrl=Jn(S.testMode)+"/api/base/app-event"}reporter(t){return v(this,null,function*(){let{event:r,params:n,extraParams:i}=t,o={eventType:r,gameInfo:P({gameId:this.gameId,sessionId:this.sessionId},n)};i&&Object.assign(o,i),yield this.createTask(o)})}reportToNative(t){return v(this,null,function*(){let{event:r,params:n}=t;yield he("userTrackAsync",{event:r,params:P({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}start(t){super.start(t),this.tryReportOpenGamePlus()}tryReportOpenGamePlus(){Br(lv).then(t=>{Fr(t.data)&&t.data&&this.tracker("OpenGame_2Plus"),_t(lv,!0)})}createTask(t){return je("sendServerEventAsync")?he("sendServerEventAsync",{payload:t}):S.platform==="android"?z("/api/base/app-event",{method:"POST",data:t}):he("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(t)})}}});var hv={};Jm(hv,{nativeTaskEmitter:()=>io,taskTracker:()=>wt,track:()=>j,trackPerformance:()=>pv});var R1,uv,dv,j,pv,fv,io,wt,bt=x(()=>{"use strict";Jg();O();xu();Yg();H();cv();ue();R1=(e,t,r)=>{var c,d,u,p,f,h,g;let n=t,i=cn(n.extra)?n.extra:Qi(n.extra)?JSON.parse(n.extra):{},{mpName:o,mpVersion:a}=(c=S.mpInfo)!=null?c:{},s=P(P(B(P({},i),{mp_id:(d=n.mp_id)!=null?d:"",mp_version:(u=n.mp_version)!=null?u:"",session_id:S.sessionId,user_id:(f=(p=S.hostUserInfo)==null?void 0:p.uid)!=null?f:""}),o?{mp_name:o}:{}),a?{mp_info_version:a}:{}),l=(h=n.eventType)!=null?h:V.Other;F("trackAsync",{event:(g=t.tag)!=null?g:e,data:s,webviewId:r,eventType:l})},{track:j,trackPerformance:pv}=Wg(R1,{type:yu.AppSDK,platform:"native",jssdk_version:(dv=(uv=S.sdkInfo)==null?void 0:uv.jssdkVersion)!=null?dv:"1.0.0",mp_id:S.mpId,mp_version:S.mpVersion}),fv=W();fv.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{pv(e,t,r)});fv.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{j(e,t)});io=new Kt,wt=new as(j,io)});function mv(){let e=null,t=null,r=window.fetch,n=()=>{t=document.createElement("meta"),t.setAttribute("name","viewport"),t.setAttribute("content","viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"),t.setAttribute("data-jolibox-sdk","viewport-meta"),e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let s=`
|
|
4
4
|
html[data-jolibox-root] {
|
|
@@ -866,7 +866,7 @@ If multiple caches share the same key they might "fight" for each other's style
|
|
|
866
866
|
width: 100%;
|
|
867
867
|
height: 100%;
|
|
868
868
|
}
|
|
869
|
-
`,z9=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:l,src:c}=t,[d,u]=yr(!1),p=h=>{var g,b,y,_;u(!1),l.value=!1,h==="dismiss"?(g=n.value)==null||g.call(n):h==="viewed"&&((b=i.value)==null||b.call(i)),(y=r.value)==null||y.call(r),(_=o.value)==null||_.call(o)},f=()=>{var h;(h=a.value)==null||h.call(a)};return ki("appsrockets_ad_dismissed",()=>p("dismiss")),ki("appsrockets_ad_rewarded",()=>p("viewed")),ki("appsrockets_ad_completed",()=>p("viewed")),ki("appsrockets_ad_skipped",()=>p("viewed")),ki("appsrockets_ad_clicked",h=>{var g;return(g=s.value)==null?void 0:g.call(s,h)}),ki("appsrockets_ad_loaded",()=>u(!0)),l.value?K("div",{className:W9,style:{display:d?"flex":"none"},children:l.value&&K("iframe",{src:c.value,onLoad:f,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};Hh=class{constructor(t,r){Rr(this,"name","APPSROCKETS"),Rr(this,"initialized",!1),Rr(this,"initCompleter",null),Rr(this,"context",void 0),Rr(this,"adsOverlay",null),Rr(this,"adsIsShowing",!1),Rr(this,"lastUnDisplayedAdBreak",null),Rr(this,"state",V9()),Rr(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",a.joliSource),l.get("osType")||l.set("osType",a.osType),l.get("runtimeType")||l.set("runtimeType",a.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",a.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return v(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),As(K(z9,{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,o,a,s,l,c,d;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=f=>{var h,g;(g=(h=this.context).handleLinkClicked)==null||g.call(h,f)},p=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let f=()=>{var b;this.adsIsShowing=!1,(b=t.afterAd)==null||b.call(t)},h=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},g=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};Ye(()=>{this.adsIsShowing=!0,this.state.afterAd.value=f,this.state.adBreakDone.value=h,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=u,this.state.adError.value=g,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 f=()=>{var E;this.adsIsShowing=!1,(E=t.afterAd)==null||E.call(t)},h={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},g=()=>{var E;this.adsIsShowing=!1,h.breakStatus="dismissed",(E=t.adDismissed)==null||E.call(t)},b=()=>{var E;this.adsIsShowing=!1,h.breakStatus="viewed",(E=t.adViewed)==null||E.call(t)},y=()=>{var E;this.adsIsShowing=!1,(E=t.adBreakDone)==null||E.call(t,h)},_=()=>{this.adsIsShowing=!1,h.breakStatus="noAdPreloaded"};Ye(()=>{this.state.afterAd.value=f,this.state.adDismissed.value=g,this.state.adViewed.value=b,this.state.adBreakDone.value=y,this.state.adLinkClicked.value=u,this.state.adError.value=_});let I=()=>{var E;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(E=t.adBreakDone)==null||E.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,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(d=t.beforeReward)==null||d.call(t,I);break}}}},LP=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};$h=class{constructor(t,r,n){nt(this,"adUnit",void 0),nt(this,"project",void 0),nt(this,"keyValue",void 0),nt(this,"adsContext",null),nt(this,"rewardedSlot",null),nt(this,"rewardedPayload",null),nt(this,"readyEvent",null),nt(this,"withCommand",function(){googletag.cmd.push(...arguments)}),nt(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(o=>{var a;(a=this.rewardedSlot)==null||a.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(i=this.rewardedSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),nt(this,"destroy",i=>{var o,a;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),(a=(o=this.adsContext)==null?void 0:o.adBreakDone)==null||a.call(o,i),i!=="ignored"&&(this.adsContext=null)}),nt(this,"reinit",i=>{this.destroy(i),this.init()}),nt(this,"handleSlotReady",i=>{i.slot===this.rewardedSlot&&(this.readyEvent=i)}),nt(this,"handleSlotClosed",i=>{var o,a;if(this.adsContext&&i.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(a=(o=this.adsContext).afterAd)==null||a.call(o),this.withCommand(()=>{this.reinit(s)})}}),nt(this,"handleSlotGranted",i=>{this.adsContext&&i.slot===this.rewardedSlot&&(this.rewardedPayload=i.payload)}),nt(this,"handleSlotRenderEnded",i=>{i.slot===this.rewardedSlot&&i.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),nt(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 o,a,s;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let o=a=>{a.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",o),this.readyEvent=a,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",o),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",o))},500)}})}),this.adUnit=t,this.project=r,this.keyValue=n,LP(),this.withCommand(()=>{this.init()})}};Vh=class{constructor(t,r,n){var i=this;mt(this,"adUnit",void 0),mt(this,"project",void 0),mt(this,"keyValue",void 0),mt(this,"adsContext",null),mt(this,"gamingInterstitialSlot",null),mt(this,"readyEvent",null),mt(this,"isRetrying",!1),mt(this,"withCommand",function(){googletag.cmd.push(...arguments)}),mt(this,"init",()=>{var o;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(a=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(o=this.gamingInterstitialSlot)==null||o.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),mt(this,"destroy",function(o){var a,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(a=i.adsContext)==null?void 0:a.onEnd)==null||s.call(a,o),o!=="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)}),mt(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(o,a),i.init()}),mt(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),mt(this,"handleSlotClosed",o=>{var a,s;this.adsContext&&this.gamingInterstitialSlot===o.slot&&((s=(a=this.adsContext).afterAd)==null||s.call(a),this.withCommand(()=>{this.reinit("viewed")}))}),mt(this,"requestAds",o=>{this.withCommand(()=>{var a,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=o,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((a=o.beforeAd)==null||a.call(o),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)))})}),LP(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};Wh=class{constructor(t,r){Dn(this,"name","GOOGLE_GPT"),Dn(this,"context",void 0),Dn(this,"contextInfo",void 0),Dn(this,"initParams",void 0),Dn(this,"rewardAdManager",void 0),Dn(this,"interstitialManager",void 0),Dn(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 v(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 $h(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Vh(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,o;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:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a})}});break}default:{if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:a})}});break}}}};zh=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";yh(this,"context",void 0),yh(this,"placement","GAME"),yh(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:pP.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:uP.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:dP.WebSDK};return iV(i)}};Ec=class{constructor(t){ct(this,"context",void 0),ct(this,"adsTrackSerializer",void 0),ct(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new zh(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:o}=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:o}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},Kh=class{constructor(t,r){var n=this;ct(this,"context",void 0),ct(this,"contextInfo",void 0),ct(this,"requestContext",void 0),ct(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),ct(this,"pendingAFVAdsInfo",Promise.resolve(null)),ct(this,"doFetchAdsInfo",i=>v(this,null,function*(){let o=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",a=[];switch(i){case"afv":{a=["REWARD_INTERSTITIAL","REWARD"];break}case"reward":{a=["REWARD_INTERSTITIAL","REWARD"];break}default:{a=["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(o),bizParams:this.requestContext.getRequestBizParams(),adsTypes:a,testAdsMode:this.contextInfo.testAdsMode,name:s}});return c==="SUCCESS"||c==="BYPASS_ADS"?{code:c,data:l}:null})),ct(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),ct(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),ct(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),ct(this,"cacheNextAFGAdsInfo",i=>v(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),ct(this,"getAFGAdsInfo",i=>v(this,null,function*(){let o=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),o})),ct(this,"getAFVAdsInfo",function(){return v(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 Ec(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}},sW=Object.defineProperty,lW=Object.defineProperties,cW=Object.getOwnPropertyDescriptors,Ac=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable,YT=(e,t,r)=>t in e?sW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Lr=(e,t)=>{for(var r in t||(t={}))qP.call(t,r)&&YT(e,r,t[r]);if(Ac)for(var r of Ac(t))UP.call(t,r)&&YT(e,r,t[r]);return e},uW=(e,t)=>lW(e,cW(t)),dW=(e,t)=>{var r={};for(var n in e)qP.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ac)for(var n of Ac(e))t.indexOf(n)<0&&UP.call(e,n)&&(r[n]=e[n]);return r},Cc=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});fW=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};hW=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)};gW=Object.defineProperty,vW=(e,t)=>{for(var r in t)gW(e,r,{get:t[r],enumerable:!0})},MP=(e,t,r,n)=>{for(var i=t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},yW=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);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}_W=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))}})}};EW=(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))(EW||{}),AW=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}},Oc=class extends AW{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},CW=class extends Oc{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},kW=class extends Oc{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},xW=class extends Oc{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},bh=class extends Oc{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Nc={log:la("log"),warn:la("warn"),info:la("info"),error:la("error"),debug:la("debug")};Object.assign(globalThis,{logger:Nc});XT=Symbol.for("Jolibox.canIUseMap"),TW={};globalThis[XT]||(globalThis[XT]=TW);Qh=Symbol.for("Jolibox.canIUseMap.native"),RW={};globalThis[Qh]||(globalThis[Qh]=RW);Xh={get config(){return globalThis[Qh]}},OW=(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))(OW||{}),NW=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(NW||{}),DW=(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))(DW||{});LW();Ti=typeof window=="undefined",qW=()=>!Ti&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!Ti&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!Ti&&navigator.userAgent.includes("Android"),!Ti&&navigator.userAgent.includes("Mac"),!Ti&&navigator.userAgent.includes("FB_IAB"),!Ti&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");Zh=class em{constructor(t){this.element=t,this.next=em.Undefined,this.prev=em.Undefined}};Zh.Undefined=new Zh(void 0);be=Zh,UW=class{constructor(){this._first=be.Undefined,this._last=be.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===be.Undefined}clear(){let e=this._first;for(;e!==be.Undefined;){let t=e.next;e.prev=be.Undefined,e.next=be.Undefined,e=t}this._first=be.Undefined,this._last=be.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new be(e);if(this._first===be.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!==be.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==be.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==be.Undefined&&e.next!==be.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===be.Undefined&&e.next===be.Undefined?(this._first=be.Undefined,this._last=be.Undefined):e.next===be.Undefined?(this._last=this._last.prev,this._last.next=be.Undefined):e.prev===be.Undefined&&(this._first=this._first.next,this._first.prev=be.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==be.Undefined;)yield e.element,e=e.next}},MW=0,ca=class{constructor(e){this.value=e,this.id=MW++}},va=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 ca&&(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,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new ca(e);return this._listeners?this._listeners instanceof ca?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,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,d,u,p;if(!this._disposed){if(this._listeners instanceof ca)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(d=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||d.call(c));else if(this._listeners){let f=this._listeners.indexOf(l);f>=0&&(this._listeners.splice(f,1),this._size--,this._size===0&&((p=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||p.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 ca?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},tm=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 va,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),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),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new UW,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)}},rm={};vW(rm,{None:()=>FW,filter:()=>BW,once:()=>GP,toPromise:()=>jW});FW=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});_h=Symbol.for("Jolibox.hostEmitter"),GW=()=>{let e=new tm;return globalThis[_h]||(globalThis[_h]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[_h]};GW();nm=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new va,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,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return JW(o,r),n(...o)}}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}};nm=MP([BP],nm);ZT=class{constructor(){this._onWillExecuteCommand=new va,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new va,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new nm,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=bW(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 yW(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),rm.toPromise(rm.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 o=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),o}_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{}}};ZT=MP([BP],ZT);Lt("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Lt("requestProductDetailsAsync",{version:102e4});Lt("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Lt("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Lt("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Lt("userTrackAsync",{version:1e6});Lt("openMiniapp",{version:1050100});Lt("requestCoinDetailsSync",{version:1070100});Lt("requestCoinDetailsAsync",{version:1070100});Lt("sendServerEventAsync",{version:1070100});Lt("loadAdsAsync",{version:1070200});Lt("showAdAsync",{version:1070200});$W=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Xh.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",d=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=PW(i,o);if(!s)return!1;if(Oi(s)){let l=s.version;return QT(l)?typeof a=="number"&&a>=l:!0}return QT(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};VW=()=>qW(),fa="custom_event_",WW=[],zW=[],KW=["env","createRequestTask","login"],JP="__batch_event__",YW="__native_batch_event__",QW=e=>e==="pv"?e:"default",yc=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=QW(a)}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,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&Oi(a))throw new bh(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(Oi(a))l.push(...Object.keys(a));else if(FP(a)){if(i.length>0)throw new bh(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new bh(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=Oi(a)?a[c]:a;t(n[c],[...i],o,d)})}else n[o]?n[o]++:n[o]=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={}}},tP=!1;Eh=[],im=Symbol.for("Jolibox.invokeResolverInstance"),ZW=new Map;globalThis[im]||(globalThis[im]=ZW);ez={get resolveMap(){return globalThis[im]}};dc=Symbol.for("Jolibox.subscribeInstance");an={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){an.trigger=e},onDoExit(e){an.exit=e},onDoBackPress(e){an.backPress=e}},$P=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new CW("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]:"";an.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Cc(void 0,null,function*(){let o=yield an.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});pm={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=HP(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:$P,doExit:r};globalThis.joliboxJSCore=Lr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";an.trigger(),e.onDocumentReady(JSON.stringify({path:i}))},r=i=>Cc(void 0,null,function*(){let o=yield an.exit();e.doExit(JSON.stringify({uuid:i,shouldInterrupt:o}))});pm={onDocumentReady:t,invoke(i,o,a){e.invoke(JSON.stringify({event:i,paramsString:o,callbackId:a}))},doExit:r,publish(i,o,a){let s=HP(o,"joliboxJSCore");e.publish(JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)},doBackPress(i){return Cc(this,null,function*(){let o=yield an.backPress();e.doBackPress(JSON.stringify({uuid:i,shouldInterrupt:o}))})}};let n={onDocumentReady:t,env:$P,doExit:r};globalThis.joliboxJSCore=Lr({},n)}VP=pm;if(!VP&&VW())throw new xW("No joliboxJScore is found, native bridge not found.");oz=Lr({},VP),WP=iz(oz),{invokeHandler:nP}=WP,{invokeNative:Ah,onNative:az,offNative:sz,subscribeHandler:lz}=WP;globalThis.joliboxJSBridge={callHandler:nP,invokeHandler:nP,subscribeHandler:lz};pz=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)}},kc=class{constructor(t){this.context=t,cz(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=$W(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return v(this,null,function*(){try{let{errNo:r,errMsg:n}=yield Ah("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 Ch()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return v(this,null,function*(){try{let r=yield Ah("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,o=null,a=()=>{sz("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=l=>{var c;if(l.UUID!==n)return;let d=(c=t.callbacks)==null?void 0:c[l.event];d&&pz(d,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&a()};az("onAdsStateChange",s),i>0&&(o=setTimeout(()=>{a(),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}=Ah("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}}};om=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){Or(this,"providers",void 0),Or(this,"helper",void 0),Or(this,"adsContext",null),Or(this,"_isAdsReady",!1),Or(this,"init",()=>v(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),Or(this,"destroy",n=>{var i,o;this._isAdsReady=!1,(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,n),n!=="ignored"&&(this.adsContext=null)}),Or(this,"reinit",n=>v(this,null,function*(){this.destroy(n),yield this.init()})),Or(this,"requestAds",(n,i)=>v(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(o){this.destroy("notReady")}})),Or(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>v(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=c=>{var d,u,p;i||(i=!0,c==="dismissed"&&((d=this.adsContext)==null||d.adDismissed()),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.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 kc(t),this.init()}};am=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;Nr(this,"providers",void 0),Nr(this,"helper",void 0),Nr(this,"adsContext",null),Nr(this,"_isAdsReady",!1),Nr(this,"init",()=>v(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),Nr(this,"destroy",function(i){var o,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n._isAdsReady=!1,s&&((a=(o=n.adsContext)==null?void 0:o.onEnd)==null||a.call(o,i),i!=="ignored"&&(n.adsContext=null))}),Nr(this,"reinit",function(o){return v(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,a),yield n.init()})}),Nr(this,"requestAds",(i,o)=>v(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=i,o&&o.length>0&&(this.providers=o);try{this.isAdsReady?yield this.showAd():yield this.reinit("frequencyCapped")}catch(a){this.destroy("notReady")}})),Nr(this,"showAd",()=>v(this,null,function*(){var i,o;if(!this.adsContext){this.destroy("error");return}let a=!1;(o=(i=this.adsContext).beforeAd)==null||o.call(i);let s=c=>{var d,u;a||(a=!0,(u=(d=this.adsContext)==null?void 0:d.afterAd)==null||u.call(d),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 kc(t),this.init()}};sm=class{constructor(t,r){ua(this,"name","INTERNAL_NATIVE"),ua(this,"context",void 0),ua(this,"rewardAdManager",void 0),ua(this,"interstitialManager",void 0),ua(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 om(this.context,n)),i.length>0&&(this.interstitialManager=new am(this.context,i))}getConfigsByTypes(t,r,n){let i=[];return(n?n.map(o=>r.find(a=>a.provider===o.provider)).filter(o=>!!o):r).forEach(o=>{t.forEach(a=>{let s="";a==="REWARD"&&(s=o.params.adUnitId.reward),a==="REWARD_INTERSTITIAL"&&(s=o.params.adUnitId.rewardInterstitial),a==="INTERSTITIAL"&&(s=o.params.adUnitId.interstitial),s&&i.push({provider:o.provider,params:{placementId:s,adsType:a,extra:o.params.extra}})})}),i}init(){return v(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,o;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 a=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})}},a);break}default:{let a=t;if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);this.interstitialManager.requestAds({beforeAd:a.beforeAd,afterAd:a.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}};Di=class{constructor(t){if(Vt(this,"context",void 0),Vt(this,"contextInfo",void 0),Vt(this,"providers",{}),Vt(this,"channelPolicy",void 0),Vt(this,"adsActionDetection",void 0),Vt(this,"requestContext",void 0),Vt(this,"adsRequest",void 0),Vt(this,"initialized",!1),Vt(this,"adsIsShowing",!1),Vt(this,"lastAdBreak",void 0),Vt(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Nh(this.context),this.adsActionDetection=new Oh(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new Kh(t),this.requestContext=new Ec(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return v(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),o={provider:"INTERNAL_NATIVE",params:{providers:n}},a=i.concat([o]);for(let s of a)switch(s.provider){case"GOOGLE_GPT":{let l=new Wh(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new Dh(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new Gh(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new Hh(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Jh(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new sm(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 v(this,null,function*(){var r,n,i,o,a,s,l,c,d,u,p,f,h,g,b,y;let _=Date.now();if(_-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&&_-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=_,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()){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let I=yield this.adsRequest.getAFGAdsInfo(t.type),E=I==null?void 0:I.data,T=I==null?void 0:I.code;if(T==="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 k,C,G,ce;(k=t.beforeAd)==null||k.call(t),(C=t.adViewed)==null||C.call(t),(G=t.afterAd)==null||G.call(t),(ce=t.adBreakDone)==null||ce.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),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!E||T!=="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(E.length===0){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let k=!0,C=null,G=new Rh(this.context);this.adsActionDetection.adBreakIsShowing=!0;let ce=E.filter(D=>D.isNative).sort((D,J)=>D.seq-J.seq),N=E.filter(D=>!D.isNative).sort((D,J)=>D.seq-J.seq),R=[{seq:(h=(f=ce[0])==null?void 0:f.seq)!=null?h:0,provider:"INTERNAL_NATIVE",params:ce}].concat(N);for(R=R.sort((D,J)=>D.seq-J.seq).map((D,J)=>q$(aP({},D),{seq:J}));R.length>0;){let D=R.shift(),J=this.providers[D.provider];if(J){let[re,Mt]=yield G.callAdBreakAndContinue(J,t,D,Bc=>{var Gc;this.adsIsShowing=Bc,(Gc=this.context.eventEmitter)==null||Gc.emit("isAdShowing",Bc)});k=re,C=Mt}else k=!0,C={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!k)break}k&&C&&((g=t.adBreakDone)==null||g.call(t,C))}}catch(I){(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(y=this.context.eventEmitter)==null||y.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.")}},hoe=ot`
|
|
869
|
+
`,z9=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:l,src:c}=t,[d,u]=yr(!1),p=h=>{var g,b,y,_;u(!1),l.value=!1,h==="dismiss"?(g=n.value)==null||g.call(n):h==="viewed"&&((b=i.value)==null||b.call(i)),(y=r.value)==null||y.call(r),(_=o.value)==null||_.call(o)},f=()=>{var h;(h=a.value)==null||h.call(a)};return ki("appsrockets_ad_dismissed",()=>p("dismiss")),ki("appsrockets_ad_rewarded",()=>p("viewed")),ki("appsrockets_ad_completed",()=>p("viewed")),ki("appsrockets_ad_skipped",()=>p("viewed")),ki("appsrockets_ad_clicked",h=>{var g;return(g=s.value)==null?void 0:g.call(s,h)}),ki("appsrockets_ad_loaded",()=>u(!0)),l.value?K("div",{className:W9,style:{display:d?"flex":"none"},children:l.value&&K("iframe",{src:c.value,onLoad:f,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};Hh=class{constructor(t,r){Rr(this,"name","APPSROCKETS"),Rr(this,"initialized",!1),Rr(this,"initCompleter",null),Rr(this,"context",void 0),Rr(this,"adsOverlay",null),Rr(this,"adsIsShowing",!1),Rr(this,"lastUnDisplayedAdBreak",null),Rr(this,"state",V9()),Rr(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",a.joliSource),l.get("osType")||l.set("osType",a.osType),l.get("runtimeType")||l.set("runtimeType",a.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",a.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return v(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),As(K(z9,{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,o,a,s,l,c,d;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=f=>{var h,g;(g=(h=this.context).handleLinkClicked)==null||g.call(h,f)},p=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let f=()=>{var b;this.adsIsShowing=!1,(b=t.afterAd)==null||b.call(t)},h=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},g=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};Ye(()=>{this.adsIsShowing=!0,this.state.afterAd.value=f,this.state.adBreakDone.value=h,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=u,this.state.adError.value=g,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 f=()=>{var E;this.adsIsShowing=!1,(E=t.afterAd)==null||E.call(t)},h={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},g=()=>{var E;this.adsIsShowing=!1,h.breakStatus="dismissed",(E=t.adDismissed)==null||E.call(t)},b=()=>{var E;this.adsIsShowing=!1,h.breakStatus="viewed",(E=t.adViewed)==null||E.call(t)},y=()=>{var E;this.adsIsShowing=!1,(E=t.adBreakDone)==null||E.call(t,h)},_=()=>{this.adsIsShowing=!1,h.breakStatus="noAdPreloaded"};Ye(()=>{this.state.afterAd.value=f,this.state.adDismissed.value=g,this.state.adViewed.value=b,this.state.adBreakDone.value=y,this.state.adLinkClicked.value=u,this.state.adError.value=_});let I=()=>{var E;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(E=t.adBreakDone)==null||E.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,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(d=t.beforeReward)==null||d.call(t,I);break}}}},LP=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};$h=class{constructor(t,r,n){nt(this,"adUnit",void 0),nt(this,"project",void 0),nt(this,"keyValue",void 0),nt(this,"adsContext",null),nt(this,"rewardedSlot",null),nt(this,"rewardedPayload",null),nt(this,"readyEvent",null),nt(this,"withCommand",function(){googletag.cmd.push(...arguments)}),nt(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(o=>{var a;(a=this.rewardedSlot)==null||a.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(i=this.rewardedSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),nt(this,"destroy",i=>{var o,a;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),(a=(o=this.adsContext)==null?void 0:o.adBreakDone)==null||a.call(o,i),i!=="ignored"&&(this.adsContext=null)}),nt(this,"reinit",i=>{this.destroy(i),this.init()}),nt(this,"handleSlotReady",i=>{i.slot===this.rewardedSlot&&(this.readyEvent=i)}),nt(this,"handleSlotClosed",i=>{var o,a;if(this.adsContext&&i.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(a=(o=this.adsContext).afterAd)==null||a.call(o),this.withCommand(()=>{this.reinit(s)})}}),nt(this,"handleSlotGranted",i=>{this.adsContext&&i.slot===this.rewardedSlot&&(this.rewardedPayload=i.payload)}),nt(this,"handleSlotRenderEnded",i=>{i.slot===this.rewardedSlot&&i.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),nt(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 o,a,s;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let o=a=>{a.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",o),this.readyEvent=a,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",o),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",o))},500)}})}),this.adUnit=t,this.project=r,this.keyValue=n,LP(),this.withCommand(()=>{this.init()})}};Vh=class{constructor(t,r,n){var i=this;mt(this,"adUnit",void 0),mt(this,"project",void 0),mt(this,"keyValue",void 0),mt(this,"adsContext",null),mt(this,"gamingInterstitialSlot",null),mt(this,"readyEvent",null),mt(this,"isRetrying",!1),mt(this,"withCommand",function(){googletag.cmd.push(...arguments)}),mt(this,"init",()=>{var o;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(a=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(o=this.gamingInterstitialSlot)==null||o.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),mt(this,"destroy",function(o){var a,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(a=i.adsContext)==null?void 0:a.onEnd)==null||s.call(a,o),o!=="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)}),mt(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(o,a),i.init()}),mt(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),mt(this,"handleSlotClosed",o=>{var a,s;this.adsContext&&this.gamingInterstitialSlot===o.slot&&((s=(a=this.adsContext).afterAd)==null||s.call(a),this.withCommand(()=>{this.reinit("viewed")}))}),mt(this,"requestAds",o=>{this.withCommand(()=>{var a,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=o,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((a=o.beforeAd)==null||a.call(o),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)))})}),LP(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};Wh=class{constructor(t,r){Dn(this,"name","GOOGLE_GPT"),Dn(this,"context",void 0),Dn(this,"contextInfo",void 0),Dn(this,"initParams",void 0),Dn(this,"rewardAdManager",void 0),Dn(this,"interstitialManager",void 0),Dn(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 v(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 $h(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Vh(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,o;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:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a})}});break}default:{if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:a})}});break}}}};zh=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";yh(this,"context",void 0),yh(this,"placement","GAME"),yh(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:pP.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:uP.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:dP.WebSDK};return iV(i)}};Ec=class{constructor(t){ct(this,"context",void 0),ct(this,"adsTrackSerializer",void 0),ct(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new zh(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:o}=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:o}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},Kh=class{constructor(t,r){var n=this;ct(this,"context",void 0),ct(this,"contextInfo",void 0),ct(this,"requestContext",void 0),ct(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),ct(this,"pendingAFVAdsInfo",Promise.resolve(null)),ct(this,"doFetchAdsInfo",i=>v(this,null,function*(){let o=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",a=[];switch(i){case"afv":{a=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{a=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{a=["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(o),bizParams:this.requestContext.getRequestBizParams(),adsTypes:a,testAdsMode:this.contextInfo.testAdsMode,name:s}});return c==="SUCCESS"||c==="BYPASS_ADS"?{code:c,data:l}:null})),ct(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),ct(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),ct(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),ct(this,"cacheNextAFGAdsInfo",i=>v(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),ct(this,"getAFGAdsInfo",i=>v(this,null,function*(){let o=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),o})),ct(this,"getAFVAdsInfo",function(){return v(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 Ec(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}},sW=Object.defineProperty,lW=Object.defineProperties,cW=Object.getOwnPropertyDescriptors,Ac=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable,YT=(e,t,r)=>t in e?sW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Lr=(e,t)=>{for(var r in t||(t={}))qP.call(t,r)&&YT(e,r,t[r]);if(Ac)for(var r of Ac(t))UP.call(t,r)&&YT(e,r,t[r]);return e},uW=(e,t)=>lW(e,cW(t)),dW=(e,t)=>{var r={};for(var n in e)qP.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ac)for(var n of Ac(e))t.indexOf(n)<0&&UP.call(e,n)&&(r[n]=e[n]);return r},Cc=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});fW=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};hW=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)};gW=Object.defineProperty,vW=(e,t)=>{for(var r in t)gW(e,r,{get:t[r],enumerable:!0})},MP=(e,t,r,n)=>{for(var i=t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},yW=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);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}_W=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))}})}};EW=(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))(EW||{}),AW=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}},Oc=class extends AW{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},CW=class extends Oc{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},kW=class extends Oc{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},xW=class extends Oc{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},bh=class extends Oc{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Nc={log:la("log"),warn:la("warn"),info:la("info"),error:la("error"),debug:la("debug")};Object.assign(globalThis,{logger:Nc});XT=Symbol.for("Jolibox.canIUseMap"),TW={};globalThis[XT]||(globalThis[XT]=TW);Qh=Symbol.for("Jolibox.canIUseMap.native"),RW={};globalThis[Qh]||(globalThis[Qh]=RW);Xh={get config(){return globalThis[Qh]}},OW=(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))(OW||{}),NW=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(NW||{}),DW=(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))(DW||{});LW();Ti=typeof window=="undefined",qW=()=>!Ti&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!Ti&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!Ti&&navigator.userAgent.includes("Android"),!Ti&&navigator.userAgent.includes("Mac"),!Ti&&navigator.userAgent.includes("FB_IAB"),!Ti&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");Zh=class em{constructor(t){this.element=t,this.next=em.Undefined,this.prev=em.Undefined}};Zh.Undefined=new Zh(void 0);be=Zh,UW=class{constructor(){this._first=be.Undefined,this._last=be.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===be.Undefined}clear(){let e=this._first;for(;e!==be.Undefined;){let t=e.next;e.prev=be.Undefined,e.next=be.Undefined,e=t}this._first=be.Undefined,this._last=be.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new be(e);if(this._first===be.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!==be.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==be.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==be.Undefined&&e.next!==be.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===be.Undefined&&e.next===be.Undefined?(this._first=be.Undefined,this._last=be.Undefined):e.next===be.Undefined?(this._last=this._last.prev,this._last.next=be.Undefined):e.prev===be.Undefined&&(this._first=this._first.next,this._first.prev=be.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==be.Undefined;)yield e.element,e=e.next}},MW=0,ca=class{constructor(e){this.value=e,this.id=MW++}},va=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 ca&&(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,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new ca(e);return this._listeners?this._listeners instanceof ca?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,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,d,u,p;if(!this._disposed){if(this._listeners instanceof ca)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(d=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||d.call(c));else if(this._listeners){let f=this._listeners.indexOf(l);f>=0&&(this._listeners.splice(f,1),this._size--,this._size===0&&((p=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||p.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 ca?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},tm=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 va,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),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),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new UW,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)}},rm={};vW(rm,{None:()=>FW,filter:()=>BW,once:()=>GP,toPromise:()=>jW});FW=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});_h=Symbol.for("Jolibox.hostEmitter"),GW=()=>{let e=new tm;return globalThis[_h]||(globalThis[_h]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[_h]};GW();nm=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new va,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,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return JW(o,r),n(...o)}}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}};nm=MP([BP],nm);ZT=class{constructor(){this._onWillExecuteCommand=new va,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new va,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new nm,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=bW(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 yW(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),rm.toPromise(rm.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 o=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),o}_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{}}};ZT=MP([BP],ZT);Lt("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Lt("requestProductDetailsAsync",{version:102e4});Lt("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Lt("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Lt("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Lt("userTrackAsync",{version:1e6});Lt("openMiniapp",{version:1050100});Lt("requestCoinDetailsSync",{version:1070100});Lt("requestCoinDetailsAsync",{version:1070100});Lt("sendServerEventAsync",{version:1070100});Lt("loadAdsAsync",{version:1070200});Lt("showAdAsync",{version:1070200});$W=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Xh.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",d=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=PW(i,o);if(!s)return!1;if(Oi(s)){let l=s.version;return QT(l)?typeof a=="number"&&a>=l:!0}return QT(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};VW=()=>qW(),fa="custom_event_",WW=[],zW=[],KW=["env","createRequestTask","login"],JP="__batch_event__",YW="__native_batch_event__",QW=e=>e==="pv"?e:"default",yc=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=QW(a)}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,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&Oi(a))throw new bh(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(Oi(a))l.push(...Object.keys(a));else if(FP(a)){if(i.length>0)throw new bh(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new bh(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=Oi(a)?a[c]:a;t(n[c],[...i],o,d)})}else n[o]?n[o]++:n[o]=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={}}},tP=!1;Eh=[],im=Symbol.for("Jolibox.invokeResolverInstance"),ZW=new Map;globalThis[im]||(globalThis[im]=ZW);ez={get resolveMap(){return globalThis[im]}};dc=Symbol.for("Jolibox.subscribeInstance");an={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){an.trigger=e},onDoExit(e){an.exit=e},onDoBackPress(e){an.backPress=e}},$P=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new CW("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]:"";an.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Cc(void 0,null,function*(){let o=yield an.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});pm={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=HP(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:$P,doExit:r};globalThis.joliboxJSCore=Lr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";an.trigger(),e.onDocumentReady(JSON.stringify({path:i}))},r=i=>Cc(void 0,null,function*(){let o=yield an.exit();e.doExit(JSON.stringify({uuid:i,shouldInterrupt:o}))});pm={onDocumentReady:t,invoke(i,o,a){e.invoke(JSON.stringify({event:i,paramsString:o,callbackId:a}))},doExit:r,publish(i,o,a){let s=HP(o,"joliboxJSCore");e.publish(JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)},doBackPress(i){return Cc(this,null,function*(){let o=yield an.backPress();e.doBackPress(JSON.stringify({uuid:i,shouldInterrupt:o}))})}};let n={onDocumentReady:t,env:$P,doExit:r};globalThis.joliboxJSCore=Lr({},n)}VP=pm;if(!VP&&VW())throw new xW("No joliboxJScore is found, native bridge not found.");oz=Lr({},VP),WP=iz(oz),{invokeHandler:nP}=WP,{invokeNative:Ah,onNative:az,offNative:sz,subscribeHandler:lz}=WP;globalThis.joliboxJSBridge={callHandler:nP,invokeHandler:nP,subscribeHandler:lz};pz=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)}},kc=class{constructor(t){this.context=t,cz(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=$W(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return v(this,null,function*(){try{let{errNo:r,errMsg:n}=yield Ah("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 Ch()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return v(this,null,function*(){try{let r=yield Ah("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,o=null,a=()=>{sz("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=l=>{var c;if(l.UUID!==n)return;let d=(c=t.callbacks)==null?void 0:c[l.event];d&&pz(d,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&a()};az("onAdsStateChange",s),i>0&&(o=setTimeout(()=>{a(),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}=Ah("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}}};om=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){Or(this,"providers",void 0),Or(this,"helper",void 0),Or(this,"adsContext",null),Or(this,"_isAdsReady",!1),Or(this,"init",()=>v(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),Or(this,"destroy",n=>{var i,o;this._isAdsReady=!1,(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,n),n!=="ignored"&&(this.adsContext=null)}),Or(this,"reinit",n=>v(this,null,function*(){this.destroy(n),yield this.init()})),Or(this,"requestAds",(n,i)=>v(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(o){this.destroy("notReady")}})),Or(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>v(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=c=>{var d,u,p;i||(i=!0,c==="dismissed"&&((d=this.adsContext)==null||d.adDismissed()),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.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 kc(t),this.init()}};am=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;Nr(this,"providers",void 0),Nr(this,"helper",void 0),Nr(this,"adsContext",null),Nr(this,"_isAdsReady",!1),Nr(this,"init",()=>v(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),Nr(this,"destroy",function(i){var o,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n._isAdsReady=!1,s&&((a=(o=n.adsContext)==null?void 0:o.onEnd)==null||a.call(o,i),i!=="ignored"&&(n.adsContext=null))}),Nr(this,"reinit",function(o){return v(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,a),yield n.init()})}),Nr(this,"requestAds",(i,o)=>v(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=i,o&&o.length>0&&(this.providers=o);try{this.isAdsReady?yield this.showAd():yield this.reinit("frequencyCapped")}catch(a){this.destroy("notReady")}})),Nr(this,"showAd",()=>v(this,null,function*(){var i,o;if(!this.adsContext){this.destroy("error");return}let a=!1;(o=(i=this.adsContext).beforeAd)==null||o.call(i);let s=c=>{var d,u;a||(a=!0,(u=(d=this.adsContext)==null?void 0:d.afterAd)==null||u.call(d),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 kc(t),this.init()}};sm=class{constructor(t,r){ua(this,"name","INTERNAL_NATIVE"),ua(this,"context",void 0),ua(this,"rewardAdManager",void 0),ua(this,"interstitialManager",void 0),ua(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 om(this.context,n)),i.length>0&&(this.interstitialManager=new am(this.context,i))}getConfigsByTypes(t,r,n){let i=[];return(n?n.map(o=>r.find(a=>a.provider===o.provider)).filter(o=>!!o):r).forEach(o=>{t.forEach(a=>{let s="";a==="REWARD"&&(s=o.params.adUnitId.reward),a==="REWARD_INTERSTITIAL"&&(s=o.params.adUnitId.rewardInterstitial),a==="INTERSTITIAL"&&(s=o.params.adUnitId.interstitial),a==="NATIVE"&&(s=o.params.adUnitId.nativeAds),s&&i.push({provider:o.provider,params:{placementId:s,adsType:a,extra:o.params.extra}})})}),i}init(){return v(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,o;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 a=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})}},a);break}default:{let a=t;if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);this.interstitialManager.requestAds({beforeAd:a.beforeAd,afterAd:a.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}};Di=class{constructor(t){if(Vt(this,"context",void 0),Vt(this,"contextInfo",void 0),Vt(this,"providers",{}),Vt(this,"channelPolicy",void 0),Vt(this,"adsActionDetection",void 0),Vt(this,"requestContext",void 0),Vt(this,"adsRequest",void 0),Vt(this,"initialized",!1),Vt(this,"adsIsShowing",!1),Vt(this,"lastAdBreak",void 0),Vt(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Nh(this.context),this.adsActionDetection=new Oh(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new Kh(t),this.requestContext=new Ec(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return v(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),o={provider:"INTERNAL_NATIVE",params:{providers:n}},a=i.concat([o]);for(let s of a)switch(s.provider){case"GOOGLE_GPT":{let l=new Wh(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new Dh(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new Gh(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new Hh(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Jh(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new sm(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 v(this,null,function*(){var r,n,i,o,a,s,l,c,d,u,p,f,h,g,b,y;let _=Date.now();if(_-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&&_-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=_,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()){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let I=yield this.adsRequest.getAFGAdsInfo(t.type),E=I==null?void 0:I.data,T=I==null?void 0:I.code;if(T==="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 k,C,G,ce;(k=t.beforeAd)==null||k.call(t),(C=t.adViewed)==null||C.call(t),(G=t.afterAd)==null||G.call(t),(ce=t.adBreakDone)==null||ce.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),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!E||T!=="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(E.length===0){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let k=!0,C=null,G=new Rh(this.context);this.adsActionDetection.adBreakIsShowing=!0;let ce=E.filter(D=>D.isNative).sort((D,J)=>D.seq-J.seq),N=E.filter(D=>!D.isNative).sort((D,J)=>D.seq-J.seq),R=[{seq:(h=(f=ce[0])==null?void 0:f.seq)!=null?h:0,provider:"INTERNAL_NATIVE",params:ce}].concat(N);for(R=R.sort((D,J)=>D.seq-J.seq).map((D,J)=>q$(aP({},D),{seq:J}));R.length>0;){let D=R.shift(),J=this.providers[D.provider];if(J){let[re,Mt]=yield G.callAdBreakAndContinue(J,t,D,Bc=>{var Gc;this.adsIsShowing=Bc,(Gc=this.context.eventEmitter)==null||Gc.emit("isAdShowing",Bc)});k=re,C=Mt}else k=!0,C={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!k)break}k&&C&&((g=t.adBreakDone)==null||g.call(t,C))}}catch(I){(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(y=this.context.eventEmitter)==null||y.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.")}},hoe=ot`
|
|
870
870
|
${Fe}
|
|
871
871
|
position: fixed;
|
|
872
872
|
left: 0;
|