@jolibox/implement 1.1.30 → 1.1.31

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.
@@ -1,4 +1,4 @@
1
- var RA=Object.create;var no=Object.defineProperty,OA=Object.defineProperties,NA=Object.getOwnPropertyDescriptor,DA=Object.getOwnPropertyDescriptors,qA=Object.getOwnPropertyNames,ro=Object.getOwnPropertySymbols,LA=Object.getPrototypeOf,Hs=Object.prototype.hasOwnProperty,Ef=Object.prototype.propertyIsEnumerable;var If=(e,t,r)=>t in e?no(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))Hs.call(t,r)&&If(e,r,t[r]);if(ro)for(var r of ro(t))Ef.call(t,r)&&If(e,r,t[r]);return e},L=(e,t)=>OA(e,DA(t));var gt=(e,t)=>{var r={};for(var n in e)Hs.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ro)for(var n of ro(e))t.indexOf(n)<0&&Ef.call(e,n)&&(r[n]=e[n]);return r};var T=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xf=(e,t)=>{for(var r in t)no(e,r,{get:t[r],enumerable:!0})},FA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qA(t))!Hs.call(e,i)&&i!==r&&no(e,i,{get:()=>t[i],enumerable:!(n=NA(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?RA(LA(e)):{},FA(t||!e||!e.__esModule?no(r,"default",{value:e,enumerable:!0}):r,e));var I=(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 $A(e){return!!(e!=null&&e.__nativeBuffers__)}function Qs(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!$A(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=HA(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function VA(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:zA(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function YA(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Ff(e){return typeof e=="string"}function Lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Af(e){return typeof e=="number"&&!isNaN(e)}function XA(e){return typeof e=="undefined"}function ZA(e){return XA(e)||e===null}function Mf(e){return typeof e=="function"}function ek(e){return Lr(e)&&Mf(e.then)}function jf(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function kn(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function sk(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 fk(){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 gk(e){return new Promise(t=>Uf(e)(t))}function Uf(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function yk(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Cn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function bk(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)wk(e[n],t[n])}function wk(e,t){if(Ff(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Mf(t)){try{if(e instanceof t)return}catch(r){}if(!ZA(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 Bf(e,t){if(Zs.config[e]){co.warn(`[can i use] ${e} already registered`);return}Zs.config[e]=Dt({},t)}function Pf(e,t){return`[${e}]:${t}`}function kk(e,t){Cf||(Gs=new oo({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ws=new oo({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ks=new oo({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Gs.flush(),Ws.flush(),Ks.flush()}),Cf=!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:m,invokeCallback:v}=f,y=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Gs.report({status:y,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&m&&v&&(Ws.report({status:y,method:s,isForeground:d,duration:Number((m-c).toFixed(3))}),Ks.report({status:y,method:s,isForeground:d,duration:Number((Date.now()-v).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function Rk(e,t){let r=0,n=!0,i=Ck.resolveMap,o=kk(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Ys.forEach(l=>so(this,[l],function*({method:c,args:d,resolve:u}){let p=yield s(c,d);u(p)})),Ys.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Qs(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new QA;if(i.set(r,m.resolve),!n&&xk.includes(l))return new Promise(k=>{Ys.push({method:l,args:c,resolve:k})});let v=BA(Dt({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),y=!Tk&&Ek.includes(l),g=VA(c,y),_=y?g:JSON.stringify(g),w;if(l.endsWith("Sync")||Sk.includes(l)?w=(d=e.call)==null?void 0:d.call(e,l,g,r):typeof _=="string"?w=e.invoke(l,_,r):w=(u=e.call)==null?void 0:u.call(e,l,_,r),w){try{typeof w=="string"&&(w=JSON.parse(w)),w=Qs(w)}catch(k){co.error(k)}return i.delete(r),w.errorCode&&(w.errorCode=Pf(l,w.errorCode)),o(Dt(Dt({},v),w)),w}return l.endsWith("Sync")&&i.delete(r),m.promise.then(k=>(k.errorCode&&(k.errorCode=Pf(l,k.errorCode)),o(Dt(Dt({},v),k)),k))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return ek(d)?d.then(u=>Rf(l,u)):Rf(l,d)},invokeHandler:a}}function Rf(e,t){if(!Lr(t)){co.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=JA(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new ik(n,i,o,a);return s}function Ok(e){if(globalThis[io])return globalThis[io];let t=new rl,r=new rl,n=new oo({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[io]={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=Qs(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===$f){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(Pn.length),u,a)}catch(p){}});return}if(i.startsWith(Pn)){r.emit(i.slice(Pn.length),l,a);return}t.emit(i,l,a)}},globalThis[io]}function Nk(e){let t=new Map,r;return(n,i,o,a)=>{if(a){let l=o?[o]:"*";e.publish(`${Pn}${n}`,i,l);return}r||(r=Promise.resolve().then(()=>{t.forEach((l,c)=>{try{let d=c?[c]:"*";e.publish($f,l,d)}catch(d){}}),r=void 0,t.clear()}));let s=t.get(o);s||(s=[],t.set(o,s)),s.push([`${Pn}${n}`,i])}}function Dk(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=Ok(e),{invokeNative:a,invokeHandler:s,applyNative:l}=Rk(e,r),c=Nk(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,publish:c,subscribe:i,unsubscribe:o}}function Hf(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var MA,jA,UA,ao,Nf,Df,Sf,Dt,BA,JA,so,HA,zA,qf,GA,WA,Lf,KA,QA,tk,rk,lo,nk,ik,ok,zs,co,kf,ak,Xs,lk,Zs,ck,uk,dk,pk,zJ,el,te,hk,mk,Tn,Cn,rl,nl,vk,Vs,_k,VJ,il,Tf,GJ,Jf,Ik,Pn,Ek,xk,Sk,$f,Ak,oo,Cf,Gs,Ws,Ks,Ys,Tk,ol,Pk,Ck,io,al,nt,zf,Vf,qk,Gf,Of,he,F,He,WJ,Lk,Wf,KJ,YJ,Ae=T(()=>{"use strict";MA=Object.defineProperty,jA=Object.defineProperties,UA=Object.getOwnPropertyDescriptors,ao=Object.getOwnPropertySymbols,Nf=Object.prototype.hasOwnProperty,Df=Object.prototype.propertyIsEnumerable,Sf=(e,t,r)=>t in e?MA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dt=(e,t)=>{for(var r in t||(t={}))Nf.call(t,r)&&Sf(e,r,t[r]);if(ao)for(var r of ao(t))Df.call(t,r)&&Sf(e,r,t[r]);return e},BA=(e,t)=>jA(e,UA(t)),JA=(e,t)=>{var r={};for(var n in e)Nf.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ao)for(var n of ao(e))t.indexOf(n)<0&&Df.call(e,n)&&(r[n]=e[n]);return r},so=(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())});HA=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};zA=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)};qf=Object.defineProperty,GA=Object.getOwnPropertyDescriptor,WA=(e,t)=>{for(var r in t)qf(e,r,{get:t[r],enumerable:!0})},Lf=(e,t,r,n)=>{for(var i=n>1?void 0:n?GA(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&&qf(t,r,i),i},KA=(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}QA=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))}})}};tk=(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))(tk||{}),rk=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}},lo=class extends rk{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},nk=class extends lo{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},ik=class extends lo{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},ok=class extends lo{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},zs=class extends lo{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};co={log:kn("log"),warn:kn("warn"),info:kn("info"),error:kn("error"),debug:kn("debug")};Object.assign(globalThis,{logger:co});kf=Symbol.for("Jolibox.canIUseMap"),ak={};globalThis[kf]||(globalThis[kf]=ak);Xs=Symbol.for("Jolibox.canIUseMap.native"),lk={};globalThis[Xs]||(globalThis[Xs]=lk);Zs={get config(){return globalThis[Xs]}},ck=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(ck||{}),uk=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(uk||{}),dk=(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))(dk||{});fk();pk=()=>!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),zJ={isiOS: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:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},el=class tl{constructor(t){this.element=t,this.next=tl.Undefined,this.prev=tl.Undefined}};el.Undefined=new el(void 0);te=el,hk=class{constructor(){this._first=te.Undefined,this._last=te.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===te.Undefined}clear(){let e=this._first;for(;e!==te.Undefined;){let t=e.next;e.prev=te.Undefined,e.next=te.Undefined,e=t}this._first=te.Undefined,this._last=te.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new te(e);if(this._first===te.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!==te.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==te.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==te.Undefined&&e.next!==te.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===te.Undefined&&e.next===te.Undefined?(this._first=te.Undefined,this._last=te.Undefined):e.next===te.Undefined?(this._last=this._last.prev,this._last.next=te.Undefined):e.prev===te.Undefined&&(this._first=this._first.next,this._first.prev=te.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==te.Undefined;)yield e.element,e=e.next}},mk=0,Tn=class{constructor(e){this.value=e,this.id=mk++}},Cn=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 Tn&&(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 Tn(t);return this._listeners?this._listeners instanceof Tn?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 Tn)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 m=this._listeners.indexOf(c);m>=0&&(this._listeners.splice(m,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 Tn?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},rl=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 Cn,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 hk,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)}},nl={};WA(nl,{None:()=>vk,filter:()=>yk,once:()=>Uf,toPromise:()=>gk});vk=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Vs=Symbol.for("Jolibox.hostEmitter"),_k=()=>{let e=new rl;return globalThis[Vs]||(globalThis[Vs]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Vs]},VJ=_k();il=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Cn,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 bk(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}};il=Lf([jf],il);Tf=class{constructor(){this._onWillExecuteCommand=new Cn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Cn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new il,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=YA(3e4)),this._starActivation}executeCommand(e,...t){return KA(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),nl.toPromise(nl.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}}};Tf=Lf([jf],Tf);GJ=Symbol.for("Jolibox.commands");Bf("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Bf("requestProductDetailsAsync",{version:102e4});Jf=e=>{function t(n){let[i,...o]=n.split(":");if(!i)return!1;let a=Zs.config[i];if(!a)return!1;let s=a.version;if(typeof s!="number")return!1;let l=e();return typeof l!="number"||l<s?!1:o.length===0?!0:r(a,o,l)||r(a.properties,o,l)}function r(n,i,o){if(!n)return!1;let a=sk(n,i);if(!a)return!1;if(Lr(a)){let s=a.version;return Af(s)?typeof o=="number"&&o>=s:!0}return Af(a)?typeof o=="number"&&o>=a:a===!0}return{canIUseNative:t}};Ik=()=>pk(),Pn="custom_event_",Ek=[],xk=[],Sk=["env","createRequestTask","login"],$f="__batch_event__",Ak=e=>e==="pv"?e:"default",oo=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=Ak(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&&Lr(a))throw new zs(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(Lr(a))l.push(...Object.keys(a));else if(Ff(a)){if(i.length>0)throw new zs(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new zs(`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=Lr(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={}}},Cf=!1;Ys=[],Tk=!1,ol=Symbol.for("Jolibox.invokeResolverInstance"),Pk=new Map;globalThis[ol]||(globalThis[ol]=Pk);Ck={get resolveMap(){return globalThis[ol]}};io=Symbol.for("Jolibox.subscribeInstance");nt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){nt.trigger=e},onDoExit(e){nt.exit=e},onDoBackPress(e){nt.backPress=e}},zf=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new nk("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{nt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>so(void 0,null,function*(){let o=yield nt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});al={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=Hf(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:zf,doExit:r};globalThis.joliboxJSCore=Dt({},n)}if(window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{nt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>so(void 0,null,function*(){let a=yield nt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});al={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=Hf(a,"joliboxJSCore");t.publish({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 so(this,null,function*(){let a=yield nt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:zf,doExit:n};globalThis.joliboxJSCore=Dt({},i)}Vf=al;if(!Vf&&Ik())throw new ok("No joliboxJScore is found, native bridge not found.");qk=Dt({},Vf),Gf=Dk(qk),{invokeHandler:Of}=Gf,{applyNative:he,invokeNative:F,onNative:He,offNative:WJ,subscribeHandler:Lk,publish:Wf,subscribe:KJ,unsubscribe:YJ}=Gf;globalThis.joliboxJSBridge={callHandler:Of,invokeHandler:Of,subscribeHandler:Lk}});function $k(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Dn(e){return typeof e=="string"}function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function ep(e){return typeof e=="object"&&Array.isArray(e)}function tp(e){return typeof e=="number"&&!isNaN(e)}function qn(e){return e===!0||e===!1}function rp(e){return typeof e=="undefined"}function hl(e){return rp(e)||e===null}function Hk(e){return typeof e=="function"}function np(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function ip(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:Qf(l)&&Qf(s)?i[a]=n(Uk({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function Qf(e){return e&&typeof e=="object"&&e.constructor===Object}function op(e,t){if(Array.isArray(e))return e.concat(t)}function Ln(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 Vk(e,t){return(...r)=>t(e,...r)}function po(e){return t=>Vk(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Fr(`${i}`))}})}function Rn(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function bl(){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 r1(e){return new Promise(t=>hp(e)(t))}function hp(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function n1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Nn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function o1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)a1(e[n],t[n])}function a1(e,t){if(Dn(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Hk(t)){try{if(e instanceof t)return}catch(r){}if(!hl(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 s1(){return typeof globalThis!="undefined"?globalThis[mp]:void 0}function l1(e){typeof globalThis!="undefined"&&(globalThis[mp]=e)}function me(){let e=s1();if(e)return e;let t=new uo,r=new fl,n={registerCommand(i,o,a){t.registerCommand({id:i,handler:o,metadata:a})},executeCommand(i,...o){return r.executeCommand(i,...o)},excuteCommandSync(i,...o){return r.executeCommandThowErr(i,...o)}};return l1(n),n}var pl,Fk,Kf,Mk,jk,Yf,Uk,Bk,Zf,Jk,yt,zk,ml,fo,vl,ap,Fr,sp,lp,cp,up,Fn,gl,_t,ll,Gk,yl,Xf,Wk,Kk,_l,Yk,ho,Mn,Qk,Xk,dp,fp,pp,cl,re,Zk,e1,On,Nn,bt,dl,t1,sl,i1,we,uo,fl,mp,D=T(()=>{"use strict";pl=Object.defineProperty,Fk=Object.getOwnPropertyDescriptor,Kf=Object.getOwnPropertySymbols,Mk=Object.prototype.hasOwnProperty,jk=Object.prototype.propertyIsEnumerable,Yf=(e,t,r)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Uk=(e,t)=>{for(var r in t||(t={}))Mk.call(t,r)&&Yf(e,r,t[r]);if(Kf)for(var r of Kf(t))jk.call(t,r)&&Yf(e,r,t[r]);return e},Bk=(e,t)=>{for(var r in t)pl(e,r,{get:t[r],enumerable:!0})},Zf=(e,t,r,n)=>{for(var i=n>1?void 0:n?Fk(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&&pl(t,r,i),i},Jk=(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}yt=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))}})}};zk=(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))(zk||{}),ml=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}},fo=class extends ml{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},vl=class extends ml{constructor(){super(...arguments),this.kind="USER_ERROR"}},ap=class extends vl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fr=class extends vl{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))}},sp=class extends vl{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))}},lp=class extends fo{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},cp=class extends fo{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))}},up=class extends fo{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Fn=class extends ml{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}}},gl=class extends fo{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};_t={log:Rn("log"),warn:Rn("warn"),info:Rn("info"),error:Rn("error"),debug:Rn("debug")};Object.assign(globalThis,{logger:_t});ll=Symbol.for("Jolibox.canIUseMap"),Gk={};globalThis[ll]||(globalThis[ll]=Gk);yl={get config(){return globalThis[ll]}},Xf=Symbol.for("Jolibox.canIUseMap.native"),Wk={};globalThis[Xf]||(globalThis[Xf]=Wk);Kk=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Kk||{}),_l=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(_l||{}),Yk=(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))(Yk||{}),ho=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});bl();Mn={isiOS: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:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Qk="device_id",Xk="advertising_id",dp=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,ho()),window.__joliboxLocalStorage__.getItem(e)),fp=()=>new URLSearchParams(window.location.search).get("deviceId")||dp(Qk),pp=()=>new URLSearchParams(window.location.search).get("advertisingId")||dp(Xk),cl=class ul{constructor(t){this.element=t,this.next=ul.Undefined,this.prev=ul.Undefined}};cl.Undefined=new cl(void 0);re=cl,Zk=class{constructor(){this._first=re.Undefined,this._last=re.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===re.Undefined}clear(){let e=this._first;for(;e!==re.Undefined;){let t=e.next;e.prev=re.Undefined,e.next=re.Undefined,e=t}this._first=re.Undefined,this._last=re.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new re(e);if(this._first===re.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!==re.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==re.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==re.Undefined&&e.next!==re.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===re.Undefined&&e.next===re.Undefined?(this._first=re.Undefined,this._last=re.Undefined):e.next===re.Undefined?(this._last=this._last.prev,this._last.next=re.Undefined):e.prev===re.Undefined&&(this._first=this._first.next,this._first.prev=re.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==re.Undefined;)yield e.element,e=e.next}},e1=0,On=class{constructor(e){this.value=e,this.id=e1++}},Nn=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 On&&(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 On(t);return this._listeners?this._listeners instanceof On?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 On)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 m=this._listeners.indexOf(c);m>=0&&(this._listeners.splice(m,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 On?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},bt=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 Nn,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 Zk,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)}},dl={};Bk(dl,{None:()=>t1,filter:()=>n1,once:()=>hp,toPromise:()=>r1});t1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});sl=Symbol.for("Jolibox.hostEmitter"),i1=()=>{let e=new bt;return globalThis[sl]||(globalThis[sl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[sl]},we=i1();uo=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Nn,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 o1(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}};uo=Zf([np],uo);fl=class{constructor(){this._onWillExecuteCommand=new Nn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Nn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new uo,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=$k(3e4)),this._starActivation}executeCommand(e,...t){return Jk(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),dl.toPromise(dl.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}}};fl=Zf([np],fl);mp=Symbol.for("Jolibox.commands")});function ke(e,t={}){wl.emit("ERROR_REPORT",{error:e,options:t})}var wl,yr,st=T(()=>{"use strict";D();D();wl=new bt,yr=new bt;ke.debounce=Ln(ke,50,{leading:!0})});var Il,c1,vp,gp,yp=T(()=>{"use strict";D();st();Il=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{}}},c1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},vp=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:Il(o),payloadJson:Il(a),signature:Il(s)}}else throw"joli_source is missing"}catch(r){return ke(new lp(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},gp=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=c1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var u1,El,_p=T(()=>{"use strict";D();u1="1.1.30",El=()=>u1});function f1(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var d1,bp,xl,wp,le,p1,x,Q=T(()=>{"use strict";D();yp();_p();D();d1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:fp(),adId:pp(),pixelRatio:window.devicePixelRatio||1,platform:Mn.isAndroid?"android":Mn.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:El()},schema:window.location.href,platform:Mn.isAndroid?"android":Mn.isiOS?"ios":"h5"},xl=(bp=globalThis.joliboxJSCore)==null?void 0:bp.env,le=Object.assign({},(wp=xl==null?void 0:xl())!=null?wp:d1);p1=()=>{var f,m,v,y,g,_,w,k,R,C,E;let{payloadJson:e,headerJson:t,signature:r}=le.schema.length?vp(le.schema):{},n=`${le.deviceInfo.did}-${new Date().getTime()}`,o=new URL(le.schema.length?le.schema:window.location.href).searchParams,a=(v=(m=(f=o.get("mpId"))!=null?f:o.get("appId"))!=null?m:o.get("gameId"))!=null?v:"",s=(_=(g=(y=le.clientSessionId)!=null?y:e==null?void 0:e.sessionId)!=null?g:o.get("sessionId"))!=null?_:n,l=!!((k=(w=e==null?void 0:e.testAdsMode)!=null?w:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),c=(E=(C=(R=e==null?void 0:e.joliboxEnv)!=null?R:e==null?void 0:e.__joliboxEnv)!=null?C:o.get("joliboxEnv"))!=null?E:"production",d=c==="staging",u=t==null?void 0:t.channel,p=e==null?void 0:e.__shouldInterupt;return{get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var A;return(A=o.get("joliSource"))!=null?A:null},get mpId(){var A;return(A=a!=null?a:e==null?void 0:e.id)!=null?A:""},get mpVersion(){var A;return(A=t==null?void 0:t.ver)!=null?A:El()},get mpType(){var A,H;return(H=(A=t==null?void 0:t.__mpType)!=null?A:e==null?void 0:e.__mpType)!=null?H:"game"},get platform(){var A;return((A=le.platform)!=null?A:le.deviceInfo.platform).toLowerCase()},get deviceInfo(){return le.deviceInfo},get sdkInfo(){return le.sdkInfo},get hostInfo(){return le.hostInfo},get hostUserInfo(){return le.hostUserInfo},get sessionId(){var A,H;return(H=(A=le.clientSessionId)!=null?A:s)!=null?H:n},get channel(){return u},get webviewId(){var A;return(A=le.webviewId)!=null?A:-1},get shouldInterupt(){return p},get from(){return e==null?void 0:e.__from},get baseApiHost(){return d?"https://stg-api.jolibox.com":"https://api.jolibox.com"},get adId(){var A;return(A=le.deviceInfo.adId)!=null?A:le.deviceInfo.did},get language(){return le.deviceInfo.lang},get sdkEnvironment(){return f1("dlightek","jolibox")?"dlightek":"jolibox"},get viewport(){var Be,mt,vt;let A=(Be=le.deviceInfo.pixelRatio)!=null?Be:1,H=(mt=le.deviceInfo.statusBarHeight)!=null?mt:e==null?void 0:e.__androidStatusBarHeight,Ue=(vt=le.deviceInfo.navigationBarHeight)!=null?vt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:H!==void 0?H/A:20,navigationBarHeight:Ue!==void 0?Ue/A:10}},onEnvConfigChanged:A=>{ip(le,A,op)},encodeJoliSourceQuery:A=>{var H,Ue;return t&&r?gp(P(P({},e),A),(H=o.get("joliSource"))!=null?H:""):(Ue=o.get("joliSource"))!=null?Ue:""},setDoExitDirectly:()=>{p=!1}}},x=p1()});var Sl,Ep,h1,m1,Ip,v1,xp=T(()=>{"use strict";D();st();Q();D();Sl=!1,Ep=(e,t)=>e==null?!1:t in e,h1=e=>Ep(e,"kind"),m1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Ip=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=x.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=x.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:m1(e.name)},i=L(P({},n),{env:t.environment,isFromUser:r});r?yr.emit("GLOBAL_USER_ERROR",e,i):yr.emit("GLOBAL_ERROR",e,i)},v1=e=>Ep(e,"kind")&&e.kind==="USER_ERROR";wl.on("ERROR_REPORT",({error:e,options:t})=>{if(Sl)return;Sl=!0;let r=h1(e)&&e.raw?e.raw:e;try{let n=v1(e);Ip(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new gl(`${i}, origin error: ${r.message}`);_t.error(o),Ip(new gl(o.message),{environment:t.environment},!1)}finally{Sl=!1}})});var er,Al,Mr=T(()=>{"use strict";st();D();st();er=(e,t)=>{var r,n;return new Fn((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Al=e=>new ap(e)});var Sp=T(()=>{"use strict";xp();Mr();D();Ae();yr.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})});yr.on("GLOBAL_USER_ERROR",(e,t)=>{_t.log("UserError",e,t)})});var kl=T(()=>{"use strict"});function Ap(e,t){let r=(n,i,o)=>{let a=L(P({tag:n},t),{extra:P({},i)});n=="globalJsError"?ke(new up(JSON.stringify(a))):e("systemLog",a,o)};return r.debounce=Ln(r,500,{leading:!0}),r}function kp(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=Ln(t,500,{leading:!0}),t}var Tp=T(()=>{"use strict";D();D();st()});function Pp(e,t){let r=Ap(e,t),n=kp(r);return{track:r,trackPerformance:n}}var Cp=T(()=>{"use strict";Tp()});var Rp=T(()=>{"use strict";Q();D();D()});var Op=T(()=>{"use strict";Cp();kl();Rp()});var mo,Np=T(()=>{"use strict";mo=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration: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.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{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(),m=f-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,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 vo(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:"https://api.jolibox.com",o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return He("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:v,state:y}=f,g=gt(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(g):p.reject(g),n.delete(v)}else if(u.state==="fail"){let m=u,{requestTaskId:v,state:y}=m,g=gt(m,["requestTaskId","state"]);p.reject(g),n.delete(v)}else _t.warn("onRequestTaskStateChange unknown event",u)}),we.on("onLoginComplete",({isLogin:u,token:p})=>{u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>I(this,[f,...m],function*(u,p={}){let v=Date.now(),y=g1(u,L(P({},p),{baseUrl:i})),{method:g="GET",responseType:_="text",dataType:w="json",timeout:k,enableCache:R=!1,appendHostCookie:C=!0}=p,E=Object.assign({"content-type":"application/json"},a,p.header),A={url:y,method:g,header:E,enableCache:R,responseType:_,appendHostCookie:C};if(g=="POST"||g=="PUT"){let vt=_1(p.data,E["content-type"]);A.data=vt}k&&Object.assign(A,{timeout:k});let{data:{requestTaskId:H}}=F(e,A);if(typeof H!="string")throw er({code:-1,msg:"requestTaskId is not a string"});let{resolve:Ue,reject:Be,promise:mt}=new yt;n.set(H,{resolve:Ue,reject:Be});try{let vt=yield mt,{data:vr}=vt;return w==="json"&&typeof vr=="string"&&(vr=y1(vr)),{url:y,timeout:k,method:g,response:L(P({},vt),{data:vr})}}catch(vt){let vr=vt;if(gr(vr)){let{errMsg:$s,prefetchDetail:JJ,isPrefetch:$J,errNo:CA}=vr;Dn($s)&&ke(er({code:-1,msg:$s},{errNo:CA,errMsg:$s}))}throw vt}})}function y1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function _1(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 g1,Tl=T(()=>{"use strict";D();Ae();st();Mr();g1=(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 Pl,Dp,ne,wt=T(()=>{"use strict";Tl();Q();Pl={};(Dp=x.hostUserInfo)!=null&&Dp.token&&(Pl["x-joli-token"]=x.hostUserInfo.token);x.joliSource&&(Pl["x-joli-source"]=x.joliSource);ne=vo("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:x.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Pl})});var go,qp=T(()=>{"use strict";Q();Np();wt();Ae();go=class extends mo{constructor(t,r,n){super(r,n),this.gameId=x.mpId,this.sessionId=x.sessionId,this.track=t,this.taskUrl=x.testMode?"https://stg-api.jolibox.com/api/base/app-event":"https://api.jolibox.com/api/base/app-event"}reporter(t){return I(this,null,function*(){let{event:r,params:n}=t,i={eventType:r,gameInfo:P({gameId:this.gameId,sessionId:this.sessionId},n)};yield x.platform==="android"?ne("/api/base/app-event",{method:"POST",data:i}):he("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(i)})})}reportToNative(t){return I(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)}}});var Up={};xf(Up,{nativeTaskEmitter:()=>jn,taskTracker:()=>qt,track:()=>lt,trackPerformance:()=>Mp});var b1,Lp,Fp,lt,Mp,jp,jn,qt,_r=T(()=>{"use strict";Sp();D();kl();Op();Q();qp();Ae();b1=(e,t,r)=>{var a,s,l,c,d;let n=t,i=gr(n.extra)?n.extra:Dn(n.extra)?JSON.parse(n.extra):{},o=L(P({},i),{mp_id:(a=n.mp_id)!=null?a:"",mp_version:(s=n.mp_version)!=null?s:"",session_id:x.sessionId,user_id:(c=(l=x.hostUserInfo)==null?void 0:l.uid)!=null?c:""});F("trackAsync",{event:(d=t.tag)!=null?d:e,data:o,webviewId:r})},{track:lt,trackPerformance:Mp}=Pp(b1,{type:_l.AppSDK,platform:"native",jssdk_version:(Fp=(Lp=x.sdkInfo)==null?void 0:Lp.jssdkVersion)!=null?Fp:"1.0.0",mp_id:x.mpId,mp_version:x.mpVersion}),jp=me();jp.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Mp(e,t,r)});jp.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{lt(e,t)});jn=new bt,qt=new go(lt,jn)});function Bp(){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=`
1
+ var RA=Object.create;var no=Object.defineProperty,OA=Object.defineProperties,NA=Object.getOwnPropertyDescriptor,DA=Object.getOwnPropertyDescriptors,qA=Object.getOwnPropertyNames,ro=Object.getOwnPropertySymbols,LA=Object.getPrototypeOf,Hs=Object.prototype.hasOwnProperty,Ef=Object.prototype.propertyIsEnumerable;var If=(e,t,r)=>t in e?no(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))Hs.call(t,r)&&If(e,r,t[r]);if(ro)for(var r of ro(t))Ef.call(t,r)&&If(e,r,t[r]);return e},L=(e,t)=>OA(e,DA(t));var gt=(e,t)=>{var r={};for(var n in e)Hs.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ro)for(var n of ro(e))t.indexOf(n)<0&&Ef.call(e,n)&&(r[n]=e[n]);return r};var T=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xf=(e,t)=>{for(var r in t)no(e,r,{get:t[r],enumerable:!0})},FA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qA(t))!Hs.call(e,i)&&i!==r&&no(e,i,{get:()=>t[i],enumerable:!(n=NA(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?RA(LA(e)):{},FA(t||!e||!e.__esModule?no(r,"default",{value:e,enumerable:!0}):r,e));var I=(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 $A(e){return!!(e!=null&&e.__nativeBuffers__)}function Qs(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!$A(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=HA(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function VA(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:zA(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function YA(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Ff(e){return typeof e=="string"}function Lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Af(e){return typeof e=="number"&&!isNaN(e)}function XA(e){return typeof e=="undefined"}function ZA(e){return XA(e)||e===null}function Mf(e){return typeof e=="function"}function ek(e){return Lr(e)&&Mf(e.then)}function jf(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function kn(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function sk(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 fk(){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 gk(e){return new Promise(t=>Uf(e)(t))}function Uf(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function yk(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Cn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function bk(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)wk(e[n],t[n])}function wk(e,t){if(Ff(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Mf(t)){try{if(e instanceof t)return}catch(r){}if(!ZA(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 Bf(e,t){if(Zs.config[e]){co.warn(`[can i use] ${e} already registered`);return}Zs.config[e]=Dt({},t)}function Pf(e,t){return`[${e}]:${t}`}function kk(e,t){Cf||(Gs=new oo({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ws=new oo({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ks=new oo({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Gs.flush(),Ws.flush(),Ks.flush()}),Cf=!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:m,invokeCallback:v}=f,y=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Gs.report({status:y,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&m&&v&&(Ws.report({status:y,method:s,isForeground:d,duration:Number((m-c).toFixed(3))}),Ks.report({status:y,method:s,isForeground:d,duration:Number((Date.now()-v).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function Rk(e,t){let r=0,n=!0,i=Ck.resolveMap,o=kk(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Ys.forEach(l=>so(this,[l],function*({method:c,args:d,resolve:u}){let p=yield s(c,d);u(p)})),Ys.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Qs(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new QA;if(i.set(r,m.resolve),!n&&xk.includes(l))return new Promise(k=>{Ys.push({method:l,args:c,resolve:k})});let v=BA(Dt({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),y=!Tk&&Ek.includes(l),g=VA(c,y),_=y?g:JSON.stringify(g),w;if(l.endsWith("Sync")||Sk.includes(l)?w=(d=e.call)==null?void 0:d.call(e,l,g,r):typeof _=="string"?w=e.invoke(l,_,r):w=(u=e.call)==null?void 0:u.call(e,l,_,r),w){try{typeof w=="string"&&(w=JSON.parse(w)),w=Qs(w)}catch(k){co.error(k)}return i.delete(r),w.errorCode&&(w.errorCode=Pf(l,w.errorCode)),o(Dt(Dt({},v),w)),w}return l.endsWith("Sync")&&i.delete(r),m.promise.then(k=>(k.errorCode&&(k.errorCode=Pf(l,k.errorCode)),o(Dt(Dt({},v),k)),k))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return ek(d)?d.then(u=>Rf(l,u)):Rf(l,d)},invokeHandler:a}}function Rf(e,t){if(!Lr(t)){co.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=JA(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new ik(n,i,o,a);return s}function Ok(e){if(globalThis[io])return globalThis[io];let t=new rl,r=new rl,n=new oo({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[io]={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=Qs(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===$f){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(Pn.length),u,a)}catch(p){}});return}if(i.startsWith(Pn)){r.emit(i.slice(Pn.length),l,a);return}t.emit(i,l,a)}},globalThis[io]}function Nk(e){let t=new Map,r;return(n,i,o,a)=>{if(a){let l=o?[o]:"*";e.publish(`${Pn}${n}`,i,l);return}r||(r=Promise.resolve().then(()=>{t.forEach((l,c)=>{try{let d=c?[c]:"*";e.publish($f,l,d)}catch(d){}}),r=void 0,t.clear()}));let s=t.get(o);s||(s=[],t.set(o,s)),s.push([`${Pn}${n}`,i])}}function Dk(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=Ok(e),{invokeNative:a,invokeHandler:s,applyNative:l}=Rk(e,r),c=Nk(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,publish:c,subscribe:i,unsubscribe:o}}function Hf(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var MA,jA,UA,ao,Nf,Df,Sf,Dt,BA,JA,so,HA,zA,qf,GA,WA,Lf,KA,QA,tk,rk,lo,nk,ik,ok,zs,co,kf,ak,Xs,lk,Zs,ck,uk,dk,pk,zJ,el,te,hk,mk,Tn,Cn,rl,nl,vk,Vs,_k,VJ,il,Tf,GJ,Jf,Ik,Pn,Ek,xk,Sk,$f,Ak,oo,Cf,Gs,Ws,Ks,Ys,Tk,ol,Pk,Ck,io,al,nt,zf,Vf,qk,Gf,Of,he,F,He,WJ,Lk,Wf,KJ,YJ,Ae=T(()=>{"use strict";MA=Object.defineProperty,jA=Object.defineProperties,UA=Object.getOwnPropertyDescriptors,ao=Object.getOwnPropertySymbols,Nf=Object.prototype.hasOwnProperty,Df=Object.prototype.propertyIsEnumerable,Sf=(e,t,r)=>t in e?MA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dt=(e,t)=>{for(var r in t||(t={}))Nf.call(t,r)&&Sf(e,r,t[r]);if(ao)for(var r of ao(t))Df.call(t,r)&&Sf(e,r,t[r]);return e},BA=(e,t)=>jA(e,UA(t)),JA=(e,t)=>{var r={};for(var n in e)Nf.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ao)for(var n of ao(e))t.indexOf(n)<0&&Df.call(e,n)&&(r[n]=e[n]);return r},so=(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())});HA=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};zA=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)};qf=Object.defineProperty,GA=Object.getOwnPropertyDescriptor,WA=(e,t)=>{for(var r in t)qf(e,r,{get:t[r],enumerable:!0})},Lf=(e,t,r,n)=>{for(var i=n>1?void 0:n?GA(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&&qf(t,r,i),i},KA=(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}QA=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))}})}};tk=(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))(tk||{}),rk=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}},lo=class extends rk{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},nk=class extends lo{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},ik=class extends lo{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},ok=class extends lo{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},zs=class extends lo{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};co={log:kn("log"),warn:kn("warn"),info:kn("info"),error:kn("error"),debug:kn("debug")};Object.assign(globalThis,{logger:co});kf=Symbol.for("Jolibox.canIUseMap"),ak={};globalThis[kf]||(globalThis[kf]=ak);Xs=Symbol.for("Jolibox.canIUseMap.native"),lk={};globalThis[Xs]||(globalThis[Xs]=lk);Zs={get config(){return globalThis[Xs]}},ck=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(ck||{}),uk=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(uk||{}),dk=(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))(dk||{});fk();pk=()=>!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),zJ={isiOS: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:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},el=class tl{constructor(t){this.element=t,this.next=tl.Undefined,this.prev=tl.Undefined}};el.Undefined=new el(void 0);te=el,hk=class{constructor(){this._first=te.Undefined,this._last=te.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===te.Undefined}clear(){let e=this._first;for(;e!==te.Undefined;){let t=e.next;e.prev=te.Undefined,e.next=te.Undefined,e=t}this._first=te.Undefined,this._last=te.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new te(e);if(this._first===te.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!==te.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==te.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==te.Undefined&&e.next!==te.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===te.Undefined&&e.next===te.Undefined?(this._first=te.Undefined,this._last=te.Undefined):e.next===te.Undefined?(this._last=this._last.prev,this._last.next=te.Undefined):e.prev===te.Undefined&&(this._first=this._first.next,this._first.prev=te.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==te.Undefined;)yield e.element,e=e.next}},mk=0,Tn=class{constructor(e){this.value=e,this.id=mk++}},Cn=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 Tn&&(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 Tn(t);return this._listeners?this._listeners instanceof Tn?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 Tn)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 m=this._listeners.indexOf(c);m>=0&&(this._listeners.splice(m,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 Tn?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},rl=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 Cn,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 hk,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)}},nl={};WA(nl,{None:()=>vk,filter:()=>yk,once:()=>Uf,toPromise:()=>gk});vk=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Vs=Symbol.for("Jolibox.hostEmitter"),_k=()=>{let e=new rl;return globalThis[Vs]||(globalThis[Vs]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Vs]},VJ=_k();il=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Cn,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 bk(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}};il=Lf([jf],il);Tf=class{constructor(){this._onWillExecuteCommand=new Cn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Cn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new il,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=YA(3e4)),this._starActivation}executeCommand(e,...t){return KA(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),nl.toPromise(nl.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}}};Tf=Lf([jf],Tf);GJ=Symbol.for("Jolibox.commands");Bf("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Bf("requestProductDetailsAsync",{version:102e4});Jf=e=>{function t(n){let[i,...o]=n.split(":");if(!i)return!1;let a=Zs.config[i];if(!a)return!1;let s=a.version;if(typeof s!="number")return!1;let l=e();return typeof l!="number"||l<s?!1:o.length===0?!0:r(a,o,l)||r(a.properties,o,l)}function r(n,i,o){if(!n)return!1;let a=sk(n,i);if(!a)return!1;if(Lr(a)){let s=a.version;return Af(s)?typeof o=="number"&&o>=s:!0}return Af(a)?typeof o=="number"&&o>=a:a===!0}return{canIUseNative:t}};Ik=()=>pk(),Pn="custom_event_",Ek=[],xk=[],Sk=["env","createRequestTask","login"],$f="__batch_event__",Ak=e=>e==="pv"?e:"default",oo=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=Ak(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&&Lr(a))throw new zs(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(Lr(a))l.push(...Object.keys(a));else if(Ff(a)){if(i.length>0)throw new zs(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new zs(`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=Lr(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={}}},Cf=!1;Ys=[],Tk=!1,ol=Symbol.for("Jolibox.invokeResolverInstance"),Pk=new Map;globalThis[ol]||(globalThis[ol]=Pk);Ck={get resolveMap(){return globalThis[ol]}};io=Symbol.for("Jolibox.subscribeInstance");nt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){nt.trigger=e},onDoExit(e){nt.exit=e},onDoBackPress(e){nt.backPress=e}},zf=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new nk("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{nt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>so(void 0,null,function*(){let o=yield nt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});al={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=Hf(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:zf,doExit:r};globalThis.joliboxJSCore=Dt({},n)}if(window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{nt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>so(void 0,null,function*(){let a=yield nt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});al={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=Hf(a,"joliboxJSCore");t.publish({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 so(this,null,function*(){let a=yield nt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:zf,doExit:n};globalThis.joliboxJSCore=Dt({},i)}Vf=al;if(!Vf&&Ik())throw new ok("No joliboxJScore is found, native bridge not found.");qk=Dt({},Vf),Gf=Dk(qk),{invokeHandler:Of}=Gf,{applyNative:he,invokeNative:F,onNative:He,offNative:WJ,subscribeHandler:Lk,publish:Wf,subscribe:KJ,unsubscribe:YJ}=Gf;globalThis.joliboxJSBridge={callHandler:Of,invokeHandler:Of,subscribeHandler:Lk}});function $k(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Dn(e){return typeof e=="string"}function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function ep(e){return typeof e=="object"&&Array.isArray(e)}function tp(e){return typeof e=="number"&&!isNaN(e)}function qn(e){return e===!0||e===!1}function rp(e){return typeof e=="undefined"}function hl(e){return rp(e)||e===null}function Hk(e){return typeof e=="function"}function np(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function ip(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:Qf(l)&&Qf(s)?i[a]=n(Uk({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function Qf(e){return e&&typeof e=="object"&&e.constructor===Object}function op(e,t){if(Array.isArray(e))return e.concat(t)}function Ln(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 Vk(e,t){return(...r)=>t(e,...r)}function po(e){return t=>Vk(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Fr(`${i}`))}})}function Rn(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function bl(){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 r1(e){return new Promise(t=>hp(e)(t))}function hp(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function n1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Nn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function o1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)a1(e[n],t[n])}function a1(e,t){if(Dn(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Hk(t)){try{if(e instanceof t)return}catch(r){}if(!hl(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 s1(){return typeof globalThis!="undefined"?globalThis[mp]:void 0}function l1(e){typeof globalThis!="undefined"&&(globalThis[mp]=e)}function me(){let e=s1();if(e)return e;let t=new uo,r=new fl,n={registerCommand(i,o,a){t.registerCommand({id:i,handler:o,metadata:a})},executeCommand(i,...o){return r.executeCommand(i,...o)},excuteCommandSync(i,...o){return r.executeCommandThowErr(i,...o)}};return l1(n),n}var pl,Fk,Kf,Mk,jk,Yf,Uk,Bk,Zf,Jk,yt,zk,ml,fo,vl,ap,Fr,sp,lp,cp,up,Fn,gl,_t,ll,Gk,yl,Xf,Wk,Kk,_l,Yk,ho,Mn,Qk,Xk,dp,fp,pp,cl,re,Zk,e1,On,Nn,bt,dl,t1,sl,i1,we,uo,fl,mp,D=T(()=>{"use strict";pl=Object.defineProperty,Fk=Object.getOwnPropertyDescriptor,Kf=Object.getOwnPropertySymbols,Mk=Object.prototype.hasOwnProperty,jk=Object.prototype.propertyIsEnumerable,Yf=(e,t,r)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Uk=(e,t)=>{for(var r in t||(t={}))Mk.call(t,r)&&Yf(e,r,t[r]);if(Kf)for(var r of Kf(t))jk.call(t,r)&&Yf(e,r,t[r]);return e},Bk=(e,t)=>{for(var r in t)pl(e,r,{get:t[r],enumerable:!0})},Zf=(e,t,r,n)=>{for(var i=n>1?void 0:n?Fk(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&&pl(t,r,i),i},Jk=(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}yt=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))}})}};zk=(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))(zk||{}),ml=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}},fo=class extends ml{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},vl=class extends ml{constructor(){super(...arguments),this.kind="USER_ERROR"}},ap=class extends vl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fr=class extends vl{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))}},sp=class extends vl{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))}},lp=class extends fo{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},cp=class extends fo{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))}},up=class extends fo{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Fn=class extends ml{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}}},gl=class extends fo{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};_t={log:Rn("log"),warn:Rn("warn"),info:Rn("info"),error:Rn("error"),debug:Rn("debug")};Object.assign(globalThis,{logger:_t});ll=Symbol.for("Jolibox.canIUseMap"),Gk={};globalThis[ll]||(globalThis[ll]=Gk);yl={get config(){return globalThis[ll]}},Xf=Symbol.for("Jolibox.canIUseMap.native"),Wk={};globalThis[Xf]||(globalThis[Xf]=Wk);Kk=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Kk||{}),_l=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(_l||{}),Yk=(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))(Yk||{}),ho=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});bl();Mn={isiOS: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:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Qk="device_id",Xk="advertising_id",dp=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,ho()),window.__joliboxLocalStorage__.getItem(e)),fp=()=>new URLSearchParams(window.location.search).get("deviceId")||dp(Qk),pp=()=>new URLSearchParams(window.location.search).get("advertisingId")||dp(Xk),cl=class ul{constructor(t){this.element=t,this.next=ul.Undefined,this.prev=ul.Undefined}};cl.Undefined=new cl(void 0);re=cl,Zk=class{constructor(){this._first=re.Undefined,this._last=re.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===re.Undefined}clear(){let e=this._first;for(;e!==re.Undefined;){let t=e.next;e.prev=re.Undefined,e.next=re.Undefined,e=t}this._first=re.Undefined,this._last=re.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new re(e);if(this._first===re.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!==re.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==re.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==re.Undefined&&e.next!==re.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===re.Undefined&&e.next===re.Undefined?(this._first=re.Undefined,this._last=re.Undefined):e.next===re.Undefined?(this._last=this._last.prev,this._last.next=re.Undefined):e.prev===re.Undefined&&(this._first=this._first.next,this._first.prev=re.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==re.Undefined;)yield e.element,e=e.next}},e1=0,On=class{constructor(e){this.value=e,this.id=e1++}},Nn=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 On&&(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 On(t);return this._listeners?this._listeners instanceof On?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 On)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 m=this._listeners.indexOf(c);m>=0&&(this._listeners.splice(m,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 On?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},bt=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 Nn,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 Zk,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)}},dl={};Bk(dl,{None:()=>t1,filter:()=>n1,once:()=>hp,toPromise:()=>r1});t1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});sl=Symbol.for("Jolibox.hostEmitter"),i1=()=>{let e=new bt;return globalThis[sl]||(globalThis[sl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[sl]},we=i1();uo=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Nn,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 o1(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}};uo=Zf([np],uo);fl=class{constructor(){this._onWillExecuteCommand=new Nn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Nn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new uo,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=$k(3e4)),this._starActivation}executeCommand(e,...t){return Jk(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),dl.toPromise(dl.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}}};fl=Zf([np],fl);mp=Symbol.for("Jolibox.commands")});function ke(e,t={}){wl.emit("ERROR_REPORT",{error:e,options:t})}var wl,yr,st=T(()=>{"use strict";D();D();wl=new bt,yr=new bt;ke.debounce=Ln(ke,50,{leading:!0})});var Il,c1,vp,gp,yp=T(()=>{"use strict";D();st();Il=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{}}},c1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},vp=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:Il(o),payloadJson:Il(a),signature:Il(s)}}else throw"joli_source is missing"}catch(r){return ke(new lp(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},gp=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=c1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var u1,El,_p=T(()=>{"use strict";D();u1="1.1.31",El=()=>u1});function f1(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var d1,bp,xl,wp,le,p1,x,Q=T(()=>{"use strict";D();yp();_p();D();d1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:fp(),adId:pp(),pixelRatio:window.devicePixelRatio||1,platform:Mn.isAndroid?"android":Mn.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:El()},schema:window.location.href,platform:Mn.isAndroid?"android":Mn.isiOS?"ios":"h5"},xl=(bp=globalThis.joliboxJSCore)==null?void 0:bp.env,le=Object.assign({},(wp=xl==null?void 0:xl())!=null?wp:d1);p1=()=>{var f,m,v,y,g,_,w,k,R,C,E;let{payloadJson:e,headerJson:t,signature:r}=le.schema.length?vp(le.schema):{},n=`${le.deviceInfo.did}-${new Date().getTime()}`,o=new URL(le.schema.length?le.schema:window.location.href).searchParams,a=(v=(m=(f=o.get("mpId"))!=null?f:o.get("appId"))!=null?m:o.get("gameId"))!=null?v:"",s=(_=(g=(y=le.clientSessionId)!=null?y:e==null?void 0:e.sessionId)!=null?g:o.get("sessionId"))!=null?_:n,l=!!((k=(w=e==null?void 0:e.testAdsMode)!=null?w:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),c=(E=(C=(R=e==null?void 0:e.joliboxEnv)!=null?R:e==null?void 0:e.__joliboxEnv)!=null?C:o.get("joliboxEnv"))!=null?E:"production",d=c==="staging",u=t==null?void 0:t.channel,p=e==null?void 0:e.__shouldInterupt;return{get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var A;return(A=o.get("joliSource"))!=null?A:null},get mpId(){var A;return(A=a!=null?a:e==null?void 0:e.id)!=null?A:""},get mpVersion(){var A;return(A=t==null?void 0:t.ver)!=null?A:El()},get mpType(){var A,H;return(H=(A=t==null?void 0:t.__mpType)!=null?A:e==null?void 0:e.__mpType)!=null?H:"game"},get platform(){var A;return((A=le.platform)!=null?A:le.deviceInfo.platform).toLowerCase()},get deviceInfo(){return le.deviceInfo},get sdkInfo(){return le.sdkInfo},get hostInfo(){return le.hostInfo},get hostUserInfo(){return le.hostUserInfo},get sessionId(){var A,H;return(H=(A=le.clientSessionId)!=null?A:s)!=null?H:n},get channel(){return u},get webviewId(){var A;return(A=le.webviewId)!=null?A:-1},get shouldInterupt(){return p},get from(){return e==null?void 0:e.__from},get baseApiHost(){return d?"https://stg-api.jolibox.com":"https://api.jolibox.com"},get adId(){var A;return(A=le.deviceInfo.adId)!=null?A:le.deviceInfo.did},get language(){return le.deviceInfo.lang},get sdkEnvironment(){return f1("dlightek","jolibox")?"dlightek":"jolibox"},get viewport(){var Be,mt,vt;let A=(Be=le.deviceInfo.pixelRatio)!=null?Be:1,H=(mt=le.deviceInfo.statusBarHeight)!=null?mt:e==null?void 0:e.__androidStatusBarHeight,Ue=(vt=le.deviceInfo.navigationBarHeight)!=null?vt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:H!==void 0?H/A:20,navigationBarHeight:Ue!==void 0?Ue/A:10}},onEnvConfigChanged:A=>{ip(le,A,op)},encodeJoliSourceQuery:A=>{var H,Ue;return t&&r?gp(P(P({},e),A),(H=o.get("joliSource"))!=null?H:""):(Ue=o.get("joliSource"))!=null?Ue:""},setDoExitDirectly:()=>{p=!1}}},x=p1()});var Sl,Ep,h1,m1,Ip,v1,xp=T(()=>{"use strict";D();st();Q();D();Sl=!1,Ep=(e,t)=>e==null?!1:t in e,h1=e=>Ep(e,"kind"),m1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Ip=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=x.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=x.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:m1(e.name)},i=L(P({},n),{env:t.environment,isFromUser:r});r?yr.emit("GLOBAL_USER_ERROR",e,i):yr.emit("GLOBAL_ERROR",e,i)},v1=e=>Ep(e,"kind")&&e.kind==="USER_ERROR";wl.on("ERROR_REPORT",({error:e,options:t})=>{if(Sl)return;Sl=!0;let r=h1(e)&&e.raw?e.raw:e;try{let n=v1(e);Ip(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new gl(`${i}, origin error: ${r.message}`);_t.error(o),Ip(new gl(o.message),{environment:t.environment},!1)}finally{Sl=!1}})});var er,Al,Mr=T(()=>{"use strict";st();D();st();er=(e,t)=>{var r,n;return new Fn((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Al=e=>new ap(e)});var Sp=T(()=>{"use strict";xp();Mr();D();Ae();yr.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})});yr.on("GLOBAL_USER_ERROR",(e,t)=>{_t.log("UserError",e,t)})});var kl=T(()=>{"use strict"});function Ap(e,t){let r=(n,i,o)=>{let a=L(P({tag:n},t),{extra:P({},i)});n=="globalJsError"?ke(new up(JSON.stringify(a))):e("systemLog",a,o)};return r.debounce=Ln(r,500,{leading:!0}),r}function kp(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=Ln(t,500,{leading:!0}),t}var Tp=T(()=>{"use strict";D();D();st()});function Pp(e,t){let r=Ap(e,t),n=kp(r);return{track:r,trackPerformance:n}}var Cp=T(()=>{"use strict";Tp()});var Rp=T(()=>{"use strict";Q();D();D()});var Op=T(()=>{"use strict";Cp();kl();Rp()});var mo,Np=T(()=>{"use strict";mo=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration: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.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{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(),m=f-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,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 vo(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:"https://api.jolibox.com",o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return He("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:v,state:y}=f,g=gt(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(g):p.reject(g),n.delete(v)}else if(u.state==="fail"){let m=u,{requestTaskId:v,state:y}=m,g=gt(m,["requestTaskId","state"]);p.reject(g),n.delete(v)}else _t.warn("onRequestTaskStateChange unknown event",u)}),we.on("onLoginComplete",({isLogin:u,token:p})=>{u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>I(this,[f,...m],function*(u,p={}){let v=Date.now(),y=g1(u,L(P({},p),{baseUrl:i})),{method:g="GET",responseType:_="text",dataType:w="json",timeout:k,enableCache:R=!1,appendHostCookie:C=!0}=p,E=Object.assign({"content-type":"application/json"},a,p.header),A={url:y,method:g,header:E,enableCache:R,responseType:_,appendHostCookie:C};if(g=="POST"||g=="PUT"){let vt=_1(p.data,E["content-type"]);A.data=vt}k&&Object.assign(A,{timeout:k});let{data:{requestTaskId:H}}=F(e,A);if(typeof H!="string")throw er({code:-1,msg:"requestTaskId is not a string"});let{resolve:Ue,reject:Be,promise:mt}=new yt;n.set(H,{resolve:Ue,reject:Be});try{let vt=yield mt,{data:vr}=vt;return w==="json"&&typeof vr=="string"&&(vr=y1(vr)),{url:y,timeout:k,method:g,response:L(P({},vt),{data:vr})}}catch(vt){let vr=vt;if(gr(vr)){let{errMsg:$s,prefetchDetail:JJ,isPrefetch:$J,errNo:CA}=vr;Dn($s)&&ke(er({code:-1,msg:$s},{errNo:CA,errMsg:$s}))}throw vt}})}function y1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function _1(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 g1,Tl=T(()=>{"use strict";D();Ae();st();Mr();g1=(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 Pl,Dp,ne,wt=T(()=>{"use strict";Tl();Q();Pl={};(Dp=x.hostUserInfo)!=null&&Dp.token&&(Pl["x-joli-token"]=x.hostUserInfo.token);x.joliSource&&(Pl["x-joli-source"]=x.joliSource);ne=vo("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:x.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Pl})});var go,qp=T(()=>{"use strict";Q();Np();wt();Ae();go=class extends mo{constructor(t,r,n){super(r,n),this.gameId=x.mpId,this.sessionId=x.sessionId,this.track=t,this.taskUrl=x.testMode?"https://stg-api.jolibox.com/api/base/app-event":"https://api.jolibox.com/api/base/app-event"}reporter(t){return I(this,null,function*(){let{event:r,params:n}=t,i={eventType:r,gameInfo:P({gameId:this.gameId,sessionId:this.sessionId},n)};yield x.platform==="android"?ne("/api/base/app-event",{method:"POST",data:i}):he("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(i)})})}reportToNative(t){return I(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)}}});var Up={};xf(Up,{nativeTaskEmitter:()=>jn,taskTracker:()=>qt,track:()=>lt,trackPerformance:()=>Mp});var b1,Lp,Fp,lt,Mp,jp,jn,qt,_r=T(()=>{"use strict";Sp();D();kl();Op();Q();qp();Ae();b1=(e,t,r)=>{var a,s,l,c,d;let n=t,i=gr(n.extra)?n.extra:Dn(n.extra)?JSON.parse(n.extra):{},o=L(P({},i),{mp_id:(a=n.mp_id)!=null?a:"",mp_version:(s=n.mp_version)!=null?s:"",session_id:x.sessionId,user_id:(c=(l=x.hostUserInfo)==null?void 0:l.uid)!=null?c:""});F("trackAsync",{event:(d=t.tag)!=null?d:e,data:o,webviewId:r})},{track:lt,trackPerformance:Mp}=Pp(b1,{type:_l.AppSDK,platform:"native",jssdk_version:(Fp=(Lp=x.sdkInfo)==null?void 0:Lp.jssdkVersion)!=null?Fp:"1.0.0",mp_id:x.mpId,mp_version:x.mpVersion}),jp=me();jp.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Mp(e,t,r)});jp.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{lt(e,t)});jn=new bt,qt=new go(lt,jn)});function Bp(){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=`
2
2
  html[data-jolibox-root] {
3
3
  height: 100%;
4
4
  margin: 0;
@@ -483,7 +483,7 @@ If multiple caches share the same key they might "fight" for each other's style
483
483
  }
484
484
  `,SB=()=>b("div",{style:wE.container,children:[b("style",{children:xB}),b("div",{style:wE.spinner})]});QG=wd()});function hx(){return I(this,null,function*(){if(Id)return Id;let t=`${x.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com"}/api/user-retention/exit-recommendations?objectId=${x.mpId}&from=GAME_DETAIL`,{response:{data:r}}=yield ne(t);return Id=r,r})}function mx(){return I(this,null,function*(){let e=new yt;if(x.mpType!=="game")return e.resolve(!1),e.promise;if(Ed)return e.resolve(!0),e.promise;let t=yield hx();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:i}=t.data;Ed=!0;let o=tx({games:r.games,title:n,buttons:i,onClose:a=>{var s;switch(Ed=!1,a.type){case"quit":e.resolve(!1);break;case"dismiss":e.resolve(!0),o.destroy();break;case"navigate":if((s=a.data)!=null&&s.game){let l=a.data.game;AB(l),setTimeout(()=>{e.resolve(!1)},0)}else e.resolve(!0);o.destroy();break;default:e.resolve(!0);break}}});return e.promise})}var Id,AB,Ed,vx=T(()=>{"use strict";Q();Ae();D();Nr();wt();Id=null;hx();AB=e=>{var a;let{data:t}=F("envSync"),r=new URL(t.schema),n=new URLSearchParams(r.search);n.set("gameId",e.gameId),n.set("joliSource",x.encodeJoliSourceQuery({__mpType:"game",__orientation:(a=e.orientation)!=null?a:"VERTICAL"}));let o=`${`https://${e.gameId}.content.jolibox.com/`}index.html?${n.toString()}`;F("openSchemaSync",{schema:o})},Ed=!1});function TB(e){let t=P(P({},kB),e),{url:r,height:n,showCloseButton:i,enableDragClose:o,useAnimation:a,onClose:s,onLoad:l}=t,c=0,d=0,u=!1,p=()=>a?{overlayTransition:"opacity 0.3s ease",containerTransition:"transform 0.3s ease",iframeTransition:"opacity 0.3s ease"}:{overlayTransition:"none",containerTransition:"none",iframeTransition:"none"},f=()=>a?300:0;function m(){let{overlayTransition:_,containerTransition:w,iframeTransition:k}=p();ee=document.createElement("div"),ee.id="jolibox-modal-overlay",ee.style.cssText=`position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); z-index:1000; display:flex; justify-content:center; align-items:flex-end; transition:${_}; opacity:0; visibility:hidden;`,z=document.createElement("div"),z.id="jolibox-modal-container",z.style.cssText=`width:100%; height:${n}; background:white; border-radius:12px 12px 0 0; overflow:hidden; box-shadow:0 -2px 10px rgba(0,0,0,0.2); transform:translateY(100%); transition:${w};`;let R=document.createElement("div");R.id="jolibox-modal-loading",R.style.cssText="position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); width:40px; height:40px; border:4px solid #f3f3f3; border-top:4px solid #3498db; border-radius:50%; animation:spin 1s linear infinite;";let C=document.createElement("style");C.textContent="@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }",document.head.appendChild(C);let E=document.createElement("div");if(E.style.cssText="width:100%; height:100%; display:flex; flex-direction:column; padding-bottom:env(safe-area-inset-bottom, 0); position:relative;",at=document.createElement("iframe"),at.style.cssText=`width:100%; flex:1; border:none; opacity:0; transition:${k};`,at.src=r,at.onload=()=>{R.parentNode&&R.parentNode.removeChild(R),at.style.opacity="1",v(),l==null||l(),we.emit("onModalIframeLoaded",{url:r})},E.appendChild(at),E.appendChild(R),z.appendChild(E),i){let A=document.createElement("div");A.style.cssText="position:absolute; top:10px; right:10px; width:30px; height:30px; background:rgba(0,0,0,0.1); border-radius:15px; display:flex; justify-content:center; align-items:center; cursor:pointer; z-index:10;",A.innerHTML="\u2715",A.onclick=g,z.appendChild(A)}ee.appendChild(z),document.body.appendChild(ee),ee.addEventListener("click",function(A){A.target===ee&&g()}),o&&y()}function v(){!ee||!z||u||(ee.style.visibility="visible",a?requestAnimationFrame(()=>{ee&&(ee.style.opacity="1"),z&&(z.style.transform="translateY(0)"),u=!0}):(ee&&(ee.style.opacity="1"),z&&(z.style.transform="translateY(0)"),u=!0),F("updateContainerConfigSync",{displayCapsuleButton:!1,webviewId:x.webviewId}))}function y(){if(!z)return;let _=R=>{c=R.touches[0].clientY},w=R=>{if(!u)return;d=R.touches[0].clientY;let C=d-c;C>0&&(z&&(z.style.transition="none",z.style.transform=`translateY(${C}px)`),R.preventDefault())},k=()=>{!u||!z||(z.style.transition=a?"transform 0.3s ease":"none",d-c>80?g():z.style.transform="translateY(0)")};z.addEventListener("touchstart",_),z.addEventListener("touchmove",w),z.addEventListener("touchend",k)}function g(){!ee||!z||!u||(a?(z.style.transform="translateY(100%)",ee.style.opacity="0"):ee.style.visibility="hidden",u=!1,F("updateContainerConfigSync",{displayCapsuleButton:!0,webviewId:x.webviewId}),setTimeout(()=>{ee&&(ee.remove(),ee=null,z=null,at=null,s==null||s(),we.emit("onModalIframeClosed",{url:r}))},f()))}return m(),{close:g}}function gx(){return window.joliboxUI=L(P({},window.joliboxUI),{createIframeModal:TB}),()=>{window.joliboxUI=void 0,ee&&ee.parentNode&&ee.parentNode.removeChild(ee),z&&z.parentNode&&z.parentNode.removeChild(z),at&&at.parentNode&&at.parentNode.removeChild(at),ee=null,z=null,at=null}}var kB,ee,z,at,yx=T(()=>{"use strict";Ae();Q();D();kB={height:"50%",showCloseButton:!0,enableDragClose:!0,useAnimation:!0},ee=null,z=null,at=null});var bx={};xf(bx,{config:()=>jB});function CB(){yo.on("isAdShowing",e=>{$a=e,qn($a)&&F("updateContainerConfigSync",{displayCapsuleButton:!$a,webviewId:x.webviewId})})}function RB(){we.on("onInterceptSystemExit",({intercept:e})=>{_x=e})}function OB(){we.on("onInterceptBackPress",({intercept:e})=>{PB=e}),He("onBeforeBackPress",({uuid:e})=>{var t,r;we.emit("onBackPress",{}),(r=(t=globalThis.joliboxJSCore)==null?void 0:t.doBackPress)==null||r.call(t,e)})}function NB(){we.on("onDocumentReady",()=>{var e;(e=globalThis.joliboxJSCore)==null||e.onDocumentReady(window.location.href),lt("onDocumentReady",{start_timestamp:za,timestamp:Date.now()})})}function DB(){He("onI18nChanged",({language:e})=>{we.emit("onI18nChanged",{i18n:e})})}function qB(e){x.mpType==="game"&&qt.start(e)}function LB(){He("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&x.onEnvConfigChanged({hostUserInfo:e}),we.emit("LifecycleEvent.onReady",P({},x.hostUserInfo?x.hostUserInfo:{isLogin:!1})),lt("joliboxServiceReady",{start_timestamp:za,timestamp:Date.now()}),qB(t),KE(()=>x.language)}),He("onBeforeExit",({uuid:e})=>{var t;(t=globalThis.joliboxJSCore)==null||t.doExit(e)})}function FB(){let e=()=>{lt("onBeforeExit",{timestamp:Date.now()}),Ba==null||Ba(),Ja==null||Ja(),qt.close(Date.now()-za)},t=()=>$a||_x;nt.onDoExit(()=>I(this,null,function*(){return t()?!0:qn(x.shouldInterupt)?(x.shouldInterupt||e(),x.shouldInterupt):Ha!=null&&Ha.canShowRecommended&&(yield mx())?!0:(e(),!1)})),nt.onDoBackPress(()=>I(this,null,function*(){return!!t()}))}function MB(){return I(this,null,function*(){let e=`${x.baseApiHost}/api/fe-configs/js-sdk/basic-meta`,{response:{data:t}}=yield ne(e);t&&(Ha=t)})}function jB(){za=Date.now(),LB(),CB(),RB(),OB(),FB(),NB(),DB(),MB(),Ja=gx(),Ba=Bp()}var Ba,Ja,za,$a,Ha,_x,PB,wx=T(()=>{"use strict";Ae();Q();D();_r();Jp();Cl();vx();wt();Nr();yx();$a=!1,Ha=null,_x=!1,PB=!1;nt.onReady(()=>{})});function Ix(e){let t=yl.config[e];return t||(t={},yl.config[e]=t),(r,n)=>{if(t[r]){_t.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var Ex=T(()=>{"use strict";D()});function xd(e){xx=e}function Va(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Va(t)):Object.keys(e).reduce((t,r)=>(t[r]=Va(e[r]),t),{})}function Vt(e){return typeof e=="number"}function Sd(e){let t=Ad(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Ad(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var xx,_e,Ga,Wa,Ka,Ya,pn,Qa,Xa,Za,es,ts,rs,ns,is,os,as,ss,ls,kd=T(()=>{"use strict";xx=!1;_e=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(xx)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 ${Sd(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Va(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Va(this._default)}optional(){return this._optional=!0,this}};Ga=class extends _e{validate(t){return this._optional&&t===void 0?!0:Vt(t)?Vt(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):Vt(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):Vt(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}},Wa=class extends _e{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ka=class extends _e{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(Vt(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(Vt(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}},Ya=class extends _e{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},pn=class extends _e{validate(t){return!0}},Qa=class extends _e{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Xa=class extends _e{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Za=class extends _e{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},es=class extends _e{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 ${Sd(t)}`)}return!0}},ts=class extends _e{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(Vt(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(Vt(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(Vt(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}},rs=class extends _e{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ad(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}},ns=class extends _e{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ad(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}},is=class extends _e{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Sd(this.value),actual:r}):!0}},os=class extends _e{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(`
485
485
  or `);this.errors.push(o)}return n}},as=class extends _e{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}},ss=class extends _e{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},ls=class extends _e{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 Td(e,t,r="param"){if(e.errors=[],e.path=r,xd(!0),!e.validate(t)){let n=e.errors.join(`
486
- `);throw e.errors.length=0,xd(!1),new TypeError(n)}}var S,Pd=T(()=>{"use strict";kd();kd();S={object(e){return new ns(e)},array(e){return new ts(e)},tuple(...e){return new as(...e)},literal(e){return new is(e)},or(...e){return new os(...e)},symbol(){return new Ya},record(e){return new rs(e)},function(){return new Za},boolean(){return new Wa},string(){return new Ka},number(){return new Ga},undefined(){return new Qa},null(){return new Xa},unknown(){return new pn},any(){return new pn},as(){return new pn},arraybuffer(){return new ss},enum(...e){return new es(...e)},typedarray(e){return new ls(e)}}});var cs,Sx,Ax=T(()=>{"use strict";D();st();Pd();Mr();cs=1,Sx=e=>{function t(n,i){return(...o)=>{var u,p,f,m;let a=Date.now(),s={method:n,trace_id:cs};cs+=1;let l="SUCCESS",c=`${n}:ok`,d=0;try{if(i.paramsSchema)try{Td(i.paramsSchema,o,"params")}catch(_){throw Al(`${n}:fail ${_.message}`)}let v=i.implement(...o),y=v,g=`${n}:ok`;if(v&&"code"in v){let{code:_,data:w,message:k}=v;l=_,y=w,g=k}return{code:l,message:g,data:y}}catch(v){let y=v;d=(p=(u=y.code)!=null?u:y.errNo)!=null?p:2e3,l="FAILURE";let g=(m=(f=y.message)!=null?f:y.errMsg)!=null?m:`${v}`;return c=`${n}:${l} ${g.replace(/^\S+:(fail|cancel)\s?/,"")}`,ke(new Fn(c,d)),{code:l,message:c}}finally{let v=Date.now()-a;e("apiInvoked",L(P({},s),{duration:v,status:l}))}}}function r(n,i){return(...o)=>I(this,null,function*(){var p,f,m,v;let a=ep(o)?o:[o],s=Date.now(),l={method:n,trace_id:cs};cs+=1;let c=`${n}:ok`,d="SUCCESS",u={code:d,message:c};try{if(i.paramsSchema)try{Td(i.paramsSchema,a,"params")}catch(_){throw Al(_.message)}let g=yield i.implement(...a);if(g&&"code"in g){let{code:_,data:w,message:k}=g;d=_,c=k,g=w}return Object.assign(u,{code:d,message:c,data:g}),u}catch(y){let g=y,_=(f=(p=g.code)!=null?p:g.errNo)!=null?f:2e3;d="FAILURE";let w=(v=(m=g.message)!=null?m:g.errMsg)!=null?v:`${y}`,k=`${n}:${d} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:d,message:k}),ke(new Fn(k,_)),u}finally{let y=Date.now()-s;e("apiInvoked",L(P({},l),{duration:y,status:d}))}})}return{createAPI:r,createSyncAPI:t}}});var Re,K,q,kx,pt=T(()=>{"use strict";Ex();_r();Ax();Pd();Ae();Q();({createAPI:Re,createSyncAPI:K}=Sx(lt)),q=Ix("native"),{canIUseNative:kx}=Jf(()=>x.sdkInfo.nativeSDKVersionCode)});var Tx,BB,JB,$B,HB,Px=T(()=>{"use strict";D();pt();Ae();Tx=me(),BB="env",JB="getSystemInfoSync",$B=K(JB,{implement:()=>{var r;let e=F("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform.toLowerCase(),version:t.sdkInfo.jssdkVersion,pixelRatio:t.deviceInfo.pixelRatio,language:t.deviceInfo.lang,brand:t.deviceInfo.brand,appName:(r=t.hostInfo)==null?void 0:r.appName,SDKVersion:t.sdkInfo.jssdkVersion}}}),HB=K(BB,{implement:()=>{var t;let e=F("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Tx.registerCommand("API.getSystemInfoSync",$B);Tx.registerCommand("API.env",HB);q("env",{version:"1.0.0"});q("getSystemInfoSync",{version:"1.0.0"})});var Cx=h(Cd=>{"use strict";D();pt();st();Ae();_r();Q();var zB="exitGame",VB="onReady",GB="onJoliboxShow",WB="onJoliboxHide",us=me(),ds=po(ke),KB=Re(zB,{paramsSchema:S.tuple(S.function(),S.boolean().optional().default(!1)),implement:(e,t=!1)=>I(Cd,null,function*(){ds(e).call(Cd),qn(x.shouldInterupt)&&!x.shouldInterupt&&x.from&&Wf("onRetentionResult",{shouldStay:t},x.from,!0),t||x.setDoExitDirectly(),yield he("exitAppAsync")})}),YB=K(GB,{paramsSchema:S.tuple(S.function()),implement(e){let t=ds(e);He("onJoliboxEnterForeground",()=>{t.call(this),jn.emit("visible",!0)})}}),QB=K(WB,{paramsSchema:S.tuple(S.function()),implement(e){let t=ds(e);He("onJoliboxEnterBackground",()=>{t.call(this),jn.emit("visible",!1)})}}),XB=K(VB,{paramsSchema:S.tuple(S.function()),implement(e){let t=ds(e);we.on("LifecycleEvent.onReady",r=>{t(r)})}});us.registerCommand("LifecycleSDK.exit",KB);us.registerCommand("LifecycleSDK.onReady",XB);us.registerCommand("LifecycleSDK.onJoliboxShow",YB);us.registerCommand("LifecycleSDK.onJoliboxHide",QB);q("lifeCycle.exit",{version:"1.0.0"});q("lifeCycle.onReady",{version:"1.0.0"});q("lifeCycle.onJoliboxShow",{version:"1.0.0"});q("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Rx(e){let t={};if(!gr(e))return t;for(let[r,n]of Object.entries(e)){let i=r.toLocaleLowerCase();n?typeof n=="object"?t[i]=Object.prototype.toString.call(n):t[i]=String(n):t[i]=""}return t}function Ox(e="GET"){if(e==="")return"POST";let t=e.toUpperCase();return["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"].includes(t)?t:"GET"}function Nx(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Dx(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!gr(r))return e;let[n,i=""]=e.split("?"),o=new URLSearchParams(i);for(let[s,l]of Object.entries(r))l!=null&&o.append(s,String(l));let a=o.toString();return a?`${n}?${a}`:n}var qx=T(()=>{"use strict";D()});var ZB,e5,Rd,Od,Lx,t5,r5,n5,Fx=T(()=>{"use strict";Mr();Tl();pt();qx();D();st();Q();ZB=15,e5=vo("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:x.baseApiHost}),Rd=0,Od=[],Lx=po(ke),t5=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},r5=e=>{let t=new yt,r=()=>{};return K("request",{paramsSchema:S.tuple(S.object({url:S.string(),method:S.string(),headers:S.object().optional(),data:S.object().optional(),query:S.object().optional(),dataType:S.string().default("json"),responseType:S.string().default("text"),enableCache:S.boolean().default(!1),appendHostCookie:S.boolean().default(!0),timeout:S.number().default(3e4),success:S.function(),fail:S.function()})),implement(i){let o=()=>I(this,null,function*(){var s,l,c;let a=Lx(i.fail);try{if(Rd+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:m}=i,v=Rx((s=i.headers)!=null?s:{}),y=Ox(i.method),g=Nx(i.timeout),_=Dx(i.url,y,d),w=Lx(i.success),k=Object.assign({},i,{method:y,header:m?void 0:v,data:y==="GET"||y==="HEAD"?void 0:d,enableCache:f,query:(l=i.query)!=null?l:{},dataType:u,responseType:p,appendHostCookie:m});g&&(k.timeout=g);let R=e5(_,k);{let{response:C}=yield R,{code:E,data:A,message:H}=C;if(A&&typeof A=="object"&&"status"in A&&A.status!==200)throw er({code:A.status||-1,msg:`request:fail status ${A.status}`});t.resolve({code:E!=null?E:"SUCCESS",data:A,message:H!=null?H:"request:ok"}),w({code:"SUCCESS",message:"request:ok",data:A})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{Rd-=1,(c=Od.shift())==null||c()}});return Rd>=ZB?(r=()=>{t5(Od,a=>a===o)},Od.push(o)):o(),t.promise}})(e),{abort(){t.reject(er({code:-1,msg:"request:fail abort"})),r()}}},n5=me();n5.registerCommand("HttpSDK.request",r5);q("request",{version:"1.0.0"})});function Mx(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return t==="array"&&(t="object"),l5.includes(t)?t:""}function jx(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 Ux(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 fs,i5,o5,a5,s5,x8,S8,l5,Ui,Nd,Dd=T(()=>{"use strict";pt();Ae();D();wt();Q();fs=me(),i5=Re("getLocalStorage",{paramsSchema:S.tuple(S.string()),implement(e){return I(this,null,function*(){let{response:t}=yield ne(`/api/games/user-storage/${x.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=jx(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}}})}});fs.registerCommand("StorageSDK.getItem",i5);q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});o5=Re("setStorage",{paramsSchema:S.tuple(S.string(),S.or(S.string(),S.boolean(),S.number())),implement(e,t){return I(this,null,function*(){let r=x.mpId,n=typeof t=="string"?t:String(t),{response:i}=yield ne(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:o,message:a}}=i,s=Mx(t),l=Ux(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`}})}});fs.registerCommand("StorageSDK.setItem",o5);q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});a5=Re("removeStorage",{paramsSchema:S.tuple(S.string()),implement(e){return I(this,null,function*(){let t=x.mpId,{response:r}=yield ne(`/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"}})}});fs.registerCommand("StorageSDK.removeItem",a5);q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});s5=Re("clearStorage",{implement(){return I(this,null,function*(){let e=x.mpId,{response:t}=yield ne(`/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`}})}});fs.registerCommand("StorageSDK.clear",s5);q("storage.clear",{version:"1.0.0"});x8=Re("getStorageInfo",{implement(){return I(this,null,function*(){let{data:e}=yield he("getStorageInfoAsync");return e})}});q("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});S8=K("getStorageInfoSync",{implement(){return F("getStorageInfoSync")}}),l5=["string","number","boolean","object",""];Ui=Re("getGlobalStorage",{paramsSchema:S.tuple(S.string()),implement(e){return I(this,null,function*(){try{let{data:{data:t,dataType:r}}=yield he("getGlobalStorageAsync",{key:e});return{code:"SUCCESS",message:"success",data:jx(t,r)}}catch(t){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get global storage failed",data:null}}})}}),Nd=Re("setGlobalStorage",{paramsSchema:S.tuple(S.string(),S.or(S.string(),S.boolean(),S.number(),S.array())),implement(e,t){return I(this,null,function*(){try{let r=Mx(t),n=Ux(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 c5,u5,d5,qd,Bx=T(()=>{"use strict";D();Ae();pt();c5=K("showKeyboard",{paramsSchema:S.tuple(S.object({defaultValue:S.string().optional().default(""),multiple:S.boolean().optional().default(!1),maxLength:S.unknown().optional().default(1e5)})),implement(e){var n;let t=Math.floor((n=Number(e.maxLength))!=null?n:1e5),{defaultValue:r}=e;r&&t&&(r=r.slice(0,t)),F("showKeyboardSync",L(P({},e),{defaultValue:r,maxLength:t}))}});q("keyboard.showKeyboard",{version:"1.0.0",properties:{params:{defaultValue:"1.0.0",multiple:"1.0.0",confirmHold:"1.0.0",confirmType:"1.0.0",maxLength:"1.0.0"}},success:{errMsg:"1.0.0"}});u5=K("updateKeyboard",{paramsSchema:S.tuple(S.object({value:S.string()})),implement(e){F("updateKeyboardSync",e)}});q("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});d5=K("hideKeyboard",{implement(){F("hideKeyboardSync")}});q("keyboard.hideKeyboard",{version:"1.0.0"});qd=me();qd.registerCommand("KeyboardSDK.showKeyboard",c5);qd.registerCommand("KeyboardSDK.updateKeyboard",u5);qd.registerCommand("KeyboardSDK.hideKeyboard",d5)});var Jx=h(ps=>{"use strict";D();pt();_r();var Ld=me(),f5=Re("levelFinished",{paramsSchema:S.tuple(S.object({levelId:S.or(S.string(),S.number()),duration:S.number().optional(),rating:S.number().optional(),score:S.number().optional()})),implement:e=>I(ps,null,function*(){let{levelId:t,duration:r,rating:n,score:i}=e,o=[];o.push(qt.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i})),o.push(qt.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),p5=Re("gamePlayEnded",{paramsSchema:S.tuple(S.object({duration:S.number().optional(),rating:S.number().optional(),score:S.number()})),implement:e=>I(ps,null,function*(){let{duration:t,rating:r,score:n}=e;return qt.tracker("GamePlayEnded",{duration:t,rating:r,score:n})})}),h5=Re("levelUpgrade",{paramsSchema:S.tuple(S.object({levelId:S.or(S.string(),S.number()),name:S.string().optional()})),implement:r=>I(ps,[r],function*({levelId:e,name:t}){let n=[];n.push(qt.tracker("LevelUpgrade",{name:t,levelId:e})),yield Promise.all(n)})});Ld.registerCommand("TaskTrackerSDK.levelFinished",f5);Ld.registerCommand("TaskTrackerSDK.gamePlayEnded",p5);Ld.registerCommand("TaskTrackerSDK.levelUpgrade",h5);q("TaskTrackerSDK.onLevelFinished",{version:"1.1.25",properties:{params:{levelId:"1.1.25",duration:"1.1.25",rating:"1.1.25",score:"1.1.25"}}});q("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25"}}});q("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var Fd,m5,$x,Md=T(()=>{"use strict";Q();Ae();pt();D();Mr();q("login",{version:"1.0.0",properties:{force:"1.0.0"},success:{errMsg:"1.0.0",code:"1.0.0",token:"1.0.0",isLogin:"1.0.0"}});q("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});Fd=Re("login",{implement(){return I(this,null,function*(){var a;let{data:{isLogin:e}}=yield he("checkLoginAsync");if(e)return{isLogin:!0,token:(a=x.hostUserInfo)==null?void 0:a.token};let t=F("loginSync"),{data:{uuid:r}}=t;if(!r)throw er({code:-1,msg:"login failed"});He("onLoginStateChange",({isLogin:s,token:l,uuid:c})=>{c==r&&i({isLogin:s,token:l})});let{promise:n,resolve:i}=new yt,o=yield n;return x.onEnvConfigChanged({hostUserInfo:o}),we.emit("onLoginComplete",o),o})}}),m5=Re("checkSession",{implement(){return I(this,null,function*(){let{data:{isLogin:e}}=yield he("checkLoginAsync");return{isLogin:e}})}}),$x=me();$x.registerCommand("API.login",Fd);$x.registerCommand("API.checkSession",m5)});var mn,hs,ht,ms,vn,vs,hn,v5,G,gn,Dr=T(()=>{"use strict";D();mn="UNLOCK_OPTIONS_CHANGED",hs="INVOKE_PAYMENT",ht="ON_PAYMENT_RESULT",ms="ON_USE_MODAL_EVENT",vn="ON_USE_MODAL_RESULT",vs="ON_USE_MODAL_FREQUENCY",hn=new bt,v5=()=>({on:hn.on.bind(hn),off:hn.off.bind(hn),emit:hn.emit.bind(hn)}),G=v5(),gn={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}}});function Gt(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r)}}var Bi=T(()=>{"use strict"});var jd,Hx=T(()=>{"use strict";jd=e=>{let t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),n=r+24*60*60*1e3;return e.filter(i=>i>=r&&i<n)}});var gs,zx,Vx,Gx,Wx,Kx=T(()=>{"use strict";Dd();Hx();gs=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t},zx=e=>I(void 0,null,function*(){let{dailyMaxPopUps:t,minInterval:r}=e,n=yield Ui("joli_coin_use_modal_frequency");if(console.log("checkUseModalFrequency",n.data),!n.data)return!0;let i=gs(n.data),o=jd(i);return!(o.length>=t||Date.now()-o[o.length-1]<r)}),Vx=()=>I(void 0,null,function*(){var n;let e=Date.now(),t=yield Ui("joli_coin_use_modal_frequency"),r=gs((n=t.data)!=null?n:"[]");r.push(e),r.sort((i,o)=>o-i).splice(8),yield Nd("joli_coin_use_modal_frequency",JSON.stringify(r))}),Gx=e=>I(void 0,null,function*(){let{dailyMaxPopUps:t,minInterval:r}=e,n=yield Ui("joli_coin_payment_frequency");if(console.log("checkPaymentFrequency",n.data),!n.data)return!0;let i=gs(n.data),o=jd(i);return!(o.length>=t||Date.now()-o[o.length-1]<r)}),Wx=()=>I(void 0,null,function*(){var n;let e=Date.now(),t=yield Ui("joli_coin_payment_frequency"),r=gs((n=t.data)!=null?n:"[]");r.push(e),r.sort((i,o)=>o-i).splice(8),yield Nd("joli_coin_payment_frequency",JSON.stringify(r))})});function Yx(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return I(this,null,function*(){let i=e.get(r);if(!i)return{code:"FAILED",message:`[joliboxSDK]: ${r} payment not supported in this platform`};try{return yield i(...n)}catch(o){return ke(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var Qx=T(()=>{"use strict";st()});var ys=T(()=>{"use strict"});var g5,yn,fr,y5,qr,Ud=T(()=>{"use strict";ys();D();Q();wt();g5=()=>{let[e,t]=[sp,cp].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:yn,createPaymentInternalError:fr}=g5(),y5=x.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",qr=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>I(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw yn(n,1001);return yield this.pay()});this.cancelOrder=t=>I(this,null,function*(){var n,i;let{response:r}=yield ne(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw yn((i=(n=r.message)!=null?n:r.errMsg)!=null?i:"",1003)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",x.deviceInfo.platform),t.set("joliSource",x.encodeJoliSourceQuery(P({},this.generatePaymentContext()))),`${y5}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var Bd,Zx,eS=T(()=>{"use strict";wt();Ud();ys();Bd=class extends qr{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>I(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return I(this,null,function*(){var n,i,o,a;try{let{response:s}=yield ne("/api/orders/checkout/joli-coin",{method:"POST",data:{productId:r.productId}});if(s.code!=="SUCCESS")throw yn((i=(n=s.errMsg)!=null?n:s.message)!=null?i:"",1002);return{code:"SUCCESS",message:(o=s.message)!=null?o:"placeorder jolicoin success",data:s.data}}catch(s){throw console.info("[JoliboxSDK] placeorder failed",s),fr((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},Zx=()=>{let e=new Map;return t=>I(void 0,null,function*(){let r=e.get(t);return r||(r=new Bd(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var tS,rS=T(()=>{"use strict";tS={SUCCESS:"unlockSuccess",FAIL_NOT_LOGIN:"unlockFailedNotLogin",FAIL_PAYING:"unlockFailedPaying",FAIL_PRODUCT_EMPTY:"unlockFailedProductIdNotFound",FAIL_GET_PRODUCT_INFO:"unlockFailedProductInvalid",FAIL_LAUNCH_BILLING:"unlockFailedLaunch",FAIL_TRANSACTION:"unlockFailedTransaction",FAIL_VERIFY:"unlockFaileVerify",TRANSACTION_PENDING:"transactionPending",FAILED:"unlockFailed"}});var Jd,nS,$d,Hd,_5,iS,oS=T(()=>{"use strict";wt();Ud();ys();Ae();D();Q();Nr();rS();Jd=new Map;He("onPaymentStateChange",e=>{var a;console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=Jd.get(t);if(o){if(r==="SUCCESS")ji("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&tp(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw fr(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let s=(a=tS[r])!=null?a:"unlockFailed";ji(`{slot-error} {slot-i18n-jolicoin.${s}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}Jd.delete(t)}});nS=e=>I(void 0,null,function*(){var n,i;let t=new yt,r;try{let o=yield he("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---payInApp---",o),!r)throw fr("orderUUID is null",1002);Jd.set(r,t)}catch(o){throw fr((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),$d=class extends qr{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>I(this,null,function*(){return yield nS({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return I(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},Hd=class extends qr{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>I(this,null,function*(){return yield nS({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return I(this,null,function*(){var a;console.log("----start place order for ios----");let{response:n}=yield ne("/api/orders/iap-init",{method:"GET",appendHostCookie:!0}),{data:i,code:o}=n!=null?n:{};if(console.log("----iap init----",i,o),i.code!=="SUCCESS")throw fr("iap-init failed",1002);return this.appAccountToken=(a=i==null?void 0:i.data)==null?void 0:a.iapToken,{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},_5={android:$d,ios:Hd},iS=()=>{let e=new Map;return t=>I(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=_5[x.platform];if(!s)throw fr("platform not supported",1002);i=new s(r,n),e.set(r,i)}let{code:o,message:a}=yield i.startPayment({productId:r,appStoreProductId:n});if(o!=="SUCCESS")throw yn(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var _s,aS=T(()=>{"use strict";Qx();eS();oS();_s=Yx();_s.registerPaymentHandler("JOLI_COIN",Zx());_s.registerPaymentHandler("JOLI_COIN_IAP",iS())});var cS=h(Wt=>{"use strict";Dr();Nr();wt();Q();Md();Bi();Kx();aS();Nr();pt();Ae();D();var Vd=Gt(G,vs);Vd.getData();var pr=wd(),zd=Promise.resolve(),lS=e=>I(Wt,null,function*(){zd=zd.then(()=>I(Wt,null,function*(){yield ne("/api/joli-coin/user-config",{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield zd});G.on(ms,(e,t)=>I(Wt,null,function*(){if(e==="ADS-JOLI_COIN"){yield pr.show({duration:3e3});let n=yield Vd.getData(),i=yield zx(n.joliCoinUseAndCharge.useJolicoin);if(console.log("use modal show by frequency",i),pr.hide(),!i){G.emit(vn,{useModalResult:"CONFIRM"});return}}let r=ix({data:{enableAutoDeduct:t.enableAutoDeduct,userJolicoin:t.userJoliCoin,joliCoinQuantity:t.joliCoinQuantity},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{G.emit(vn,{useModalResult:"CONFIRM"}),r.hide()}},cancel:{text:t.cancelButtonText,onPress:({type:n})=>{G.emit(vn,{useModalResult:(n!=null?n:"")==="CANCEL"?"CANCEL":"FAILED"}),r.hide()}},onEnableDeductChanged:n=>I(Wt,null,function*(){yield lS(n)})}});yield Vx()}));G.on(hs,(e,t)=>I(Wt,null,function*(){var r,n;try{if(!kx("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{G.emit(ht,{paymentResult:"FAILED"})},0);return}if(e==="ADS-JOLI_COIN"){yield pr.show({duration:3e3});let a=yield Vd.getData(),s=yield Gx(a.joliCoinUseAndCharge.charge);if(console.log("use payment show by frequency",s),pr.hide(),!s){G.emit(ht,{paymentResult:"SUCCESS"});return}console.log("show by frequency")}yield pr.show({duration:3e3});let i=yield sS();if(pr.hide(),!i){G.emit(ht,{paymentResult:"FAILED"});return}let o=ox({data:{userJolicoin:t.userJoliCoin,joliCoinQuantity:t.joliCoinQuantity,paymentChoices:(n=(r=i.paymentChoices)==null?void 0:r.map(a=>{var s;return L(P({},a),{totalAmountStr:(s=a.totalAmountStr)!=null?s:""})}))!=null?n:[],enableAutoDeduct:i.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:a=>I(Wt,null,function*(){var c,d,u,p;if(!((c=x.hostUserInfo)!=null&&c.isLogin)){let{data:f}=yield Fd();if(!(f!=null&&f.isLogin)){console.log("login failed");return}let m=yield sS();if(((d=m==null?void 0:m.balance)!=null?d:0)>=t.joliCoinQuantity){G.emit(ht,{paymentResult:"SUCCESS"}),o.hide();return}}console.log("invokeNativePayment",a);let s=(p=(u=i==null?void 0:i.paymentChoices)==null?void 0:u.find(f=>f.productId===a))==null?void 0:p.appStoreProductId;if(!s){G.emit(ht,{paymentResult:"FAILED"}),o.hide();return}yield pr.show({duration:3e3});let{code:l}=yield _s.invokePayment("JOLI_COIN_IAP",{productId:a,appStoreProductId:s});if(pr.hide(),l!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}G.emit(ht,{paymentResult:"SUCCESS"}),o.hide()})},cancel:{text:t.cancelButtonText,onPress:({type:a})=>{G.emit(ht,{paymentResult:(a!=null?a:"")==="CANCEL"?"CANCEL":"FAILED"}),o.hide()}},onEnableDeductChanged:a=>I(Wt,null,function*(){yield lS(a)})}});yield Wx()}catch(i){console.info("payment failed",i),G.emit(ht,{paymentResult:"FAILED"})}}));var b5=(e,t)=>{Object.keys(t).forEach(r=>{let n=e.paymentChoices.find(i=>i.appStoreProductId===r);n&&(n.totalAmountStr=t[r].price)}),e.paymentChoices=e.paymentChoices.filter(r=>!hl(r.totalAmountStr)),console.info("----mergeResponseData-----",e.paymentChoices)},sS=()=>I(Wt,null,function*(){var r,n,i,o,a,s,l,c;let{response:e}=yield ne("/api/joli-coin/balance-detail",{method:"GET",appendHostCookie:!0,responseType:"json"});console.info("getBalenceDetails",e);let{data:t}=yield he("requestProductDetailsAsync",{appStoreProductIds:(o=(i=(n=(r=e.data)==null?void 0:r.data)==null?void 0:n.paymentChoices)==null?void 0:i.filter(d=>typeof d.appStoreProductId=="string").map(d=>d.appStoreProductId))!=null?o:[]});return(a=e.data)!=null&&a.data&&t&&b5((s=e.data)==null?void 0:s.data,t),console.info("productDetails",(l=e.data)==null?void 0:l.data),(c=e.data)==null?void 0:c.data})});function et(e,t,r){return(t=x5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x5(e){var t=S5(e,"string");return typeof t=="symbol"?t:t+""}function S5(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bs(e,t,r){return(t=A5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A5(e){var t=k5(e,"string");return typeof t=="symbol"?t:t+""}function k5(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function L5(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function F5(e){return typeof e=="string"}function M5(e){return typeof e=="undefined"}function j5(e){return M5(e)||e===null}function U5(e){return typeof e=="function"}function LS(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function Ji(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function Es(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function G5(e){let t=e.location?Es(e.location,mS):null,r=e.target?Es(e.target,mS):null;return Es(N5(O5({},e),{location:t,target:r}),z5)}function W5(e){let t=e.events.map(n=>G5(n)),r=Es(e.device,V5);return[e.protocolVersion,t,r,e.project]}function K5(){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 e3(e){return new Promise(t=>US(e)(t))}function US(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function t3(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Gi(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}function n3(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)i3(e[n],t[n])}function i3(e,t){if(F5(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(U5(t)){try{if(e instanceof t)return}catch(r){}if(!j5(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 Wd(e,t,r){return(t=o3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o3(e){var t=a3(e,"string");return typeof t=="symbol"?t:t+""}function a3(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ws(e,t,r){return(t=s3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s3(e){var t=l3(e,"string");return typeof t=="symbol"?t:t+""}function l3(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kt(e,t,r){return(t=c3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c3(e){var t=u3(e,"string");return typeof t=="symbol"?t:t+""}function u3(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function d3(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function f3(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}function y3(e,t){return Oe(e,0)^45?(((t<<2^Oe(e,0))<<2^Oe(e,1))<<2^Oe(e,2))<<2^Oe(e,3):0}function $S(e){return e.trim()}function _3(e,t){return(e=t.exec(e))?e[0]:e}function J(e,t,r){return e.replace(t,r)}function cf(e,t){return e.indexOf(t)}function Oe(e,t){return e.charCodeAt(t)|0}function Wi(e,t,r){return e.slice(t,r)}function Ot(e){return e.length}function bf(e){return e.length}function Is(e,t){return t.push(e),e}function b3(e,t){return e.map(t).join("")}function Ls(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:qs,column:In,length:a,return:""}}function Hi(e,t){return g3(Ls("",null,null,"",null,null,0),e,{length:-e.length},t)}function w3(){return be}function I3(){return be=We>0?Oe(En,--We):0,In--,be===10&&(In=1,qs--),be}function rt(){return be=We<HS?Oe(En,We++):0,In++,be===10&&(In=1,qs++),be}function Nt(){return Oe(En,We)}function xs(){return We}function Yi(e,t){return Wi(En,e,t)}function Ki(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function zS(e){return qs=In=1,HS=Ot(En=e),We=0,[]}function VS(e){return En="",e}function Ss(e){return $S(Yi(We-1,uf(e===91?e+2:e===40?e+1:e)))}function E3(e){for(;(be=Nt())&&be<33;)rt();return Ki(e)>2||Ki(be)>3?"":" "}function x3(e,t){for(;--t&&rt()&&!(be<48||be>102||be>57&&be<65||be>70&&be<97););return Yi(e,xs()+(t<6&&Nt()==32&&rt()==32))}function uf(e){for(;rt();)switch(be){case e:return We;case 34:case 39:e!==34&&e!==39&&uf(be);break;case 40:e===41&&uf(e);break;case 92:rt();break}return We}function S3(e,t){for(;rt()&&e+be!==57&&!(e+be===84&&Nt()===47););return"/*"+Yi(t,We-1)+"*"+Ds(e===47?e:rt())}function A3(e){for(;!Ki(Nt());)rt();return Yi(e,We)}function k3(e){return VS(As("",null,null,null,[""],e=zS(e),0,[0],e))}function As(e,t,r,n,i,o,a,s,l){for(var c=0,d=0,u=a,p=0,f=0,m=0,v=1,y=1,g=1,_=0,w="",k=i,R=o,C=n,E=w;y;)switch(m=_,_=rt()){case 40:if(m!=108&&Oe(E,u-1)==58){cf(E+=J(Ss(_),"&","&\f"),"&\f")!=-1&&(g=-1);break}case 34:case 39:case 91:E+=Ss(_);break;case 9:case 10:case 13:case 32:E+=E3(m);break;case 92:E+=x3(xs()-1,7);continue;case 47:switch(Nt()){case 42:case 47:Is(T3(S3(rt(),xs()),t,r),l);break;default:E+="/"}break;case 123*v:s[c++]=Ot(E)*g;case 125*v:case 59:case 0:switch(_){case 0:case 125:y=0;case 59+d:g==-1&&(E=J(E,/\f/g,"")),f>0&&Ot(E)-u&&Is(f>32?yS(E+";",n,r,u-1):yS(J(E," ","")+";",n,r,u-2),l);break;case 59:E+=";";default:if(Is(C=gS(E,t,r,c,d,i,s,w,k=[],R=[],u),o),_===123)if(d===0)As(E,t,C,C,k,o,u,s,R);else switch(p===99&&Oe(E,3)===110?100:p){case 100:case 108:case 109:case 115:As(e,C,C,n&&Is(gS(e,C,C,0,0,i,s,w,i,k=[],u),R),i,R,u,s,n?k:R);break;default:As(E,C,C,C,[""],R,0,s,R)}}c=d=f=0,v=g=1,w=E="",u=a;break;case 58:u=1+Ot(E),f=m;default:if(v<1){if(_==123)--v;else if(_==125&&v++==0&&I3()==125)continue}switch(E+=Ds(_),_*v){case 38:g=d>0?1:(E+="\f",-1);break;case 44:s[c++]=(Ot(E)-1)*g,g=1;break;case 64:Nt()===45&&(E+=Ss(rt())),p=Nt(),d=u=Ot(w=E+=A3(xs())),_++;break;case 45:m===45&&Ot(E)==2&&(v=0)}}return o}function gS(e,t,r,n,i,o,a,s,l,c,d){for(var u=i-1,p=i===0?o:[""],f=bf(p),m=0,v=0,y=0;m<n;++m)for(var g=0,_=Wi(e,u+1,u=v3(v=a[m])),w=e;g<f;++g)(w=$S(v>0?p[g]+" "+_:J(_,/&\f/g,p[g])))&&(l[y++]=w);return Ls(e,t,r,i===0?yf:s,l,c,d)}function T3(e,t,r){return Ls(e,t,r,BS,Ds(w3()),Wi(e,2,-2),0)}function yS(e,t,r,n){return Ls(e,t,r,_f,Wi(e,0,n),Wi(e,n+1,-1),n)}function wn(e,t){for(var r="",n=bf(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function P3(e,t,r,n){switch(e.type){case m3:if(e.children.length)break;case h3:case _f:return e.return=e.return||e.value;case BS:return"";case JS:return e.return=e.value+"{"+wn(e.children,n)+"}";case yf:e.value=e.props.join(",")}return Ot(r=wn(e.children,n))?e.return=e.value+"{"+r+"}":""}function C3(e){var t=bf(e);return function(r,n,i,o){for(var a="",s=0;s<t;s++)a+=e[s](r,n,i,o)||"";return a}}function R3(e){return function(t){t.root||(t=t.return)&&e(t)}}function O3(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function GS(e,t){switch(y3(e,t)){case 5103:return B+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return B+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return B+e+Ps+e+Me+e+e;case 6828:case 4268:return B+e+Me+e+e;case 6165:return B+e+Me+"flex-"+e+e;case 5187:return B+e+J(e,/(\w+).+(:[^]+)/,B+"box-$1$2"+Me+"flex-$1$2")+e;case 5443:return B+e+Me+"flex-item-"+J(e,/flex-|-self/,"")+e;case 4675:return B+e+Me+"flex-line-pack"+J(e,/align-content|flex-|-self/,"")+e;case 5548:return B+e+Me+J(e,"shrink","negative")+e;case 5292:return B+e+Me+J(e,"basis","preferred-size")+e;case 6060:return B+"box-"+J(e,"-grow","")+B+e+Me+J(e,"grow","positive")+e;case 4554:return B+J(e,/([^-])(transform)/g,"$1"+B+"$2")+e;case 6187:return J(J(J(e,/(zoom-|grab)/,B+"$1"),/(image-set)/,B+"$1"),e,"")+e;case 5495:case 3959:return J(e,/(image-set\([^]*)/,B+"$1$`$1");case 4968:return J(J(e,/(.+:)(flex-)?(.*)/,B+"box-pack:$3"+Me+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+B+e+e;case 4095:case 3583:case 4068:case 2532:return J(e,/(.+)-inline(.+)/,B+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ot(e)-1-t>6)switch(Oe(e,t+1)){case 109:if(Oe(e,t+4)!==45)break;case 102:return J(e,/(.+:)(.+)-([^]+)/,"$1"+B+"$2-$3$1"+Ps+(Oe(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~cf(e,"stretch")?GS(J(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Oe(e,t+1)!==115)break;case 6444:switch(Oe(e,Ot(e)-3-(~cf(e,"!important")&&10))){case 107:return J(e,":",":"+B)+e;case 101:return J(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+B+(Oe(e,14)===45?"inline-":"")+"box$3$1"+B+"$2$3$1"+Me+"$2box$3")+e}break;case 5936:switch(Oe(e,t+11)){case 114:return B+e+Me+J(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return B+e+Me+J(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return B+e+Me+J(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return B+e+Me+e+e}return e}function B3(e){for(var t=0,r,n=0,i=e.length;i>=4;++n,i-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function Cs(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return hr={name:i.name,styles:i.styles,next:hr},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)hr={name:a.name,styles:a.styles,next:hr},a=a.next;var s=o.styles+";";return s}return z3(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function z3(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Cs(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":bS(s)&&(n+=Kd(o)+":"+wS(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)bS(a[l])&&(n+=Kd(o)+":"+wS(o,a[l])+";");else{var c=Cs(e,t,a);switch(o){case"animation":case"animationName":{n+=Kd(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}function Yd(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,i="";hr=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=Cs(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=Cs(r,t,e[s]),n){var l=o;i+=l[s]}IS.lastIndex=0;for(var c="",d;(d=IS.exec(i))!==null;)c+="-"+d[1];var u=B3(i)+c;return{name:u,styles:i,next:hr}}function KS(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function ES(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function xS(e,t,r){var n=[],i=KS(e,n,r);return n.length<2?r:i+t(n)}function Q3(e,t){Se.__h&&Se.__h(tt,e,AS||t),AS=0;var r=tt.__H||(tt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function QS(e,t){var r=Q3(df++,7);return eJ(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function X3(){for(var e;e=YS.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ks),e.__H.__h.forEach(ff),e.__H.__h=[]}catch(t){e.__H.__h=[],Se.__e(t,e.__v)}}function Z3(e){var t,r=function(){clearTimeout(n),NS&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);NS&&(t=requestAnimationFrame(r))}function ks(e){var t=tt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),tt=t}function ff(e){var t=tt;e.__c=e.__(),tt=t}function eJ(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Fs(){if(mr>1)mr--;else{for(var e,t=!1;zi!==void 0;){var r=zi;for(zi=void 0,pf++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ZS(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(pf=0,mr--,t)throw e}}function Ge(e){if(mr>0)return e();mr++;try{return e()}finally{Fs()}}function XS(e){if(W!==void 0){var t=e.n;if(t===void 0||t.t!==W)return t={i:0,S:e,p:W.s,n:void 0,t:W,e:void 0,x:void 0,r:t},W.s!==void 0&&(W.s.n=t),W.s=t,e.n=t,32&W.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=W.s,t.n=void 0,W.s.n=t,W.s=t),t}}function Ne(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function Y(e){return new Ne(e)}function ZS(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function eA(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function tA(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function Sn(e){Ne.call(this,void 0),this.x=e,this.s=void 0,this.g=Rs-1,this.f=4}function Vi(e){return new Sn(e)}function rA(e){var t=e.u;if(e.u=void 0,typeof t=="function"){mr++;var r=W;W=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,wf(e),n}finally{W=r,Fs()}}}function wf(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,rA(e)}function rJ(e){if(W!==this)throw new Error("Out-of-order effect");tA(this),W=e,this.f&=-2,8&this.f&&wf(this),Fs()}function Qi(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Xi(e){var t=new Qi(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function An(e,t){O[e]=t.bind(null,O[e]||function(){})}function Os(e){Xd&&Xd(),Xd=e&&e.S()}function oA(e){var t=this,r=e.data,n=aA(r);n.value=r;var i=QS(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=Vi(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=Vi(function(){return!Array.isArray(c.value)&&!Dl(c.value)}),u=Xi(function(){if(this.N=sA,d.value){var f=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),p=t.__$u.d;return t.__$u.d=function(){u(),p.call(this)},[d,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}function nJ(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=Y(r);return{o:function(a,s){o.value=a,n=s},d:Xi(function(){this.N=sA;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function aA(e){return QS(function(){return Y(e)},[])}function oJ(){Ge(function(){for(var e;e=iA.shift();)nA.call(e)})}function sA(){iA.push(this)===1&&(O.requestAnimationFrame||iJ)(oJ)}function aJ(e,t){let r=si(e);Yr(()=>{r.current=e},[e]),ai(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function pe(e,t,r,n,i,o){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--sJ,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return O.vnode&&O.vnode(c),c}function Yt(e,t,r){return(t=_J(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _J(e){var t=bJ(e,"string");return typeof t=="symbol"?t:t+""}function bJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qt(e,t,r){return(t=xJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xJ(e){var t=SJ(e,"string");return typeof t=="symbol"?t:t+""}function SJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rt(e,t,r){return(t=AJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AJ(e){var t=kJ(e,"string");return typeof t=="symbol"?t:t+""}function kJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uS,w5,I5,E5,Zd,ef,DS,T5,P5,dS,C5,R5,fS,O5,N5,D5,qS,q5,B5,J5,pS,$5,hS,H5,FS,MS,jS,mS,z5,V5,tf,ie,Y5,Q5,$i,Gi,X5,nf,Z5,Gd,r3,of,vS,af,sf,lf,p3,Me,Ps,B,BS,yf,_f,h3,JS,m3,v3,Ds,g3,qs,In,HS,We,be,En,N3,D3,q3,_S,L3,F3,M3,j3,U3,J3,$3,H3,WS,bS,Kd,wS,IS,hr,V3,G3,W3,K3,Y3,xn,df,tt,Qd,SS,AS,YS,Se,kS,TS,PS,CS,RS,OS,NS,tJ,W,zi,mr,pf,Rs,nA,Xd,iA,iJ,je,sJ,lJ,Xt,hf,mf,Ts,cJ,uJ,dJ,fJ,pJ,hJ,mJ,vJ,gJ,yJ,vf,bn,_n,wJ,IJ,EJ,gf,Ns,e7,lA=T(()=>{"use strict";Ur();Fo();uS=Object.getOwnPropertySymbols,w5=Object.prototype.hasOwnProperty,I5=Object.prototype.propertyIsEnumerable,E5=(e,t)=>{var r={};for(var n in e)w5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&uS)for(var n of uS(e))t.indexOf(n)<0&&I5.call(e,n)&&(r[n]=e[n]);return r};Zd=class{constructor(t){et(this,"context",void 0),et(this,"continueCallback",void 0),et(this,"adIsShowingCallback",void 0),et(this,"isBeforeAdCalled",!1),et(this,"isBeforeRewardCalled",!1),et(this,"isAdDismissedCalled",!1),et(this,"isAdViewedCalled",!1),et(this,"isAfterAdCalled",!1),et(this,"currentProvider",void 0),et(this,"currentClientParams",void 0),et(this,"adsHasResponse",!1),et(this,"videoChecker",window.document.createElement("video")),et(this,"wrapShowAdFn",r=>()=>{var n;this.adsHasResponse=!0;let i=!1;this.videoChecker.play().catch(()=>{i=!1}),i=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:i},this.paramsToTrack)),(n=this.adIsShowingCallback)==null||n.call(this,!0),r()}),this.context=t}get paramsToTrack(){var t,r,n,i,o,a;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null,type:(n=this.currentClientParams)==null?void 0:n.type,name:((i=this.currentClientParams)==null?void 0:i.type)==="preroll"?null:(a=(o=this.currentClientParams)==null?void 0:o.name)!=null?a:""}}wrapBeforeAd(t){return()=>{var r,n;this.adsHasResponse=!0,this.context.track("CallBeforeAd",this.paramsToTrack),this.isBeforeAdCalled||(this.isBeforeAdCalled=!0,t==null||t(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0)))}}wrapBeforeReward(t){return r=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(r)():(this.isBeforeRewardCalled=!0,t==null||t(this.wrapShowAdFn(r)))}}wrapAdDismissed(t){return()=>{this.adsHasResponse=!0,this.isAdDismissedCalled||(this.isAdDismissedCalled=!0,t==null||t())}}wrapAdViewed(t){return()=>{this.adsHasResponse=!0,this.isAdViewedCalled||(this.isAdViewedCalled=!0,t==null||t())}}wrapAfterAd(t){return()=>{this.adsHasResponse=!0,this.context.track("CallAfterAd",this.paramsToTrack),this.isAfterAdCalled||(this.isAfterAdCalled=!0,t==null||t())}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(o=r.breakName)!=null?o:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{t==null||t(r),(a=this.adIsShowingCallback)==null||a.call(this,!1),(s=this.continueCallback)==null||s.call(this,[!1,r]);break}default:{(l=this.continueCallback)==null||l.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return I(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,d,u;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),(d=this.continueCallback)==null||d.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(c=r.name)!=null?c:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(u=this.adIsShowingCallback)==null||u.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),t.adBreak(a,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};ef=class{constructor(t){bs(this,"context",void 0),bs(this,"adBreakIsShowing",!1),bs(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),bs(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=t,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}},DS=Object.defineProperty,T5=Object.defineProperties,P5=Object.getOwnPropertyDescriptors,dS=Object.getOwnPropertySymbols,C5=Object.prototype.hasOwnProperty,R5=Object.prototype.propertyIsEnumerable,fS=(e,t,r)=>t in e?DS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,O5=(e,t)=>{for(var r in t||(t={}))C5.call(t,r)&&fS(e,r,t[r]);if(dS)for(var r of dS(t))R5.call(t,r)&&fS(e,r,t[r]);return e},N5=(e,t)=>T5(e,P5(t)),D5=(e,t)=>{for(var r in t)DS(e,r,{get:t[r],enumerable:!0})},qS=(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},q5=(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}B5=(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))(B5||{});J5={log:Ji("log"),warn:Ji("warn"),info:Ji("info"),error:Ji("error"),debug:Ji("debug")};Object.assign(globalThis,{logger:J5});pS=Symbol.for("Jolibox.canIUseMap"),$5={};globalThis[pS]||(globalThis[pS]=$5);hS=Symbol.for("Jolibox.canIUseMap.native"),H5={};globalThis[hS]||(globalThis[hS]=H5);FS=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(FS||{}),MS=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(MS||{}),jS=(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))(jS||{}),mS=["name","params"],z5=["name","type","location","target","extra","timestamp","userId"],V5=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];K5();navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),navigator.userAgent.includes("Android"),navigator.userAgent.includes("Mac"),navigator.userAgent.includes("FB_IAB"),!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");tf=class rf{constructor(t){this.element=t,this.next=rf.Undefined,this.prev=rf.Undefined}};tf.Undefined=new tf(void 0);ie=tf,Y5=class{constructor(){this._first=ie.Undefined,this._last=ie.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ie.Undefined}clear(){let e=this._first;for(;e!==ie.Undefined;){let t=e.next;e.prev=ie.Undefined,e.next=ie.Undefined,e=t}this._first=ie.Undefined,this._last=ie.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ie(e);if(this._first===ie.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!==ie.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ie.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ie.Undefined&&e.next!==ie.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ie.Undefined&&e.next===ie.Undefined?(this._first=ie.Undefined,this._last=ie.Undefined):e.next===ie.Undefined?(this._last=this._last.prev,this._last.next=ie.Undefined):e.prev===ie.Undefined&&(this._first=this._first.next,this._first.prev=ie.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ie.Undefined;)yield e.element,e=e.next}},Q5=0,$i=class{constructor(e){this.value=e,this.id=Q5++}},Gi=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 $i&&(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 $i(e);return this._listeners?this._listeners instanceof $i?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 $i)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 $i?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},X5=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 Gi,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 Y5,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)}},nf={};D5(nf,{None:()=>Z5,filter:()=>t3,once:()=>US,toPromise:()=>e3});Z5=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Gd=Symbol.for("Jolibox.hostEmitter"),r3=()=>{let e=new X5;return globalThis[Gd]||(globalThis[Gd]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Gd]};r3();of=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Gi,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 n3(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}};of=qS([LS],of);vS=class{constructor(){this._onWillExecuteCommand=new Gi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Gi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new of,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=L5(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 q5(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),nf.toPromise(nf.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{}}};vS=qS([LS],vS);af=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";Wd(this,"context",void 0),Wd(this,"placement","GAME"),Wd(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:jS.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:FS.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:MS.WebSDK};return W5(i)}};sf=class{constructor(t){ws(this,"configs",null),ws(this,"firstRun",!0),ws(this,"context",void 0),ws(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return I(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(t){}})}shouldBypassCallingInterstitial(){var t,r;let n;if(!this.configs)this.init(),n=!this.firstRun;else{let i=(t=this.contextInfo.channel)!=null?t:"",o=this.configs[i],a=(r=o==null?void 0:o.interstitialRate)!=null?r:1;n=Math.random()<a}return this.firstRun=!1,n}};lf=class{constructor(t,r){Kt(this,"name","ADSENSE"),Kt(this,"context",void 0),Kt(this,"contextInfo",void 0),Kt(this,"configured",!1),Kt(this,"initParams",void 0),Kt(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Kt(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=E5(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Kt(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Kt(this,"adUnit",n=>I(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:d,fullWidthResponsive:u,style:p}=n,f;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?f=document.querySelector(l):f=l,!f)throw new Error("targeting element not found");let m=c;if(m||(m=this.initParams.unitId),!m)throw new Error("slot is required");let v=typeof d=="object"&&Array.isArray(d)?d.join(", "):d,y=document.createElement("ins");if(y.className="adsbygoogle",y.id="jolibox-ads",y.style.display="block",y.setAttribute("data-ad-client",this.initParams.clientId),y.setAttribute("data-ad-slot",m),v&&y.setAttribute("data-ad-format",v),u&&y.setAttribute("data-full-width-responsive",u),p&&y.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let g=document.createElement("div");g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.width="100%",g.style.height="100%",g.style.display="flex",g.style.justifyContent="center",g.style.alignItems="center",g.style.backgroundColor="rgba(0, 0, 0, 0.5)",g.style.color="white",g.innerHTML="Test Ad",y.style.position="relative",f.appendChild(y),y.appendChild(g)}else f.appendChild(y),new MutationObserver(g=>{g.forEach(_=>{if(_.type==="attributes"&&_.attributeName==="data-ad-status"){let w=y.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:w!=null?w:"null"})}})}).observe(y,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,window.adsbygoogle=window.adsbygoogle||[]}init(){return I(this,null,function*(){var t;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let r="google-adsense",n=(t=this.contextInfo.testAdsMode)!=null?t:!1;if(!document.getElementById(r)&&this.initParams.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&i.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&this.initParams.admobRewardedSlot&&(i.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),i.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&i.setAttribute("data-admob-ads-only","on")),document.head.appendChild(i),this.context.track("LoadAdsenseCompleted",null)}})}};p3=function(){function e(r){var n=this;this._insertTag=function(i){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,o),n.tags.push(i)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(f3(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=d3(n);try{i.insertRule(r,i.cssRules.length)}catch(o){}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e}(),Me="-ms-",Ps="-moz-",B="-webkit-",BS="comm",yf="rule",_f="decl",h3="@import",JS="@keyframes",m3="@layer",v3=Math.abs,Ds=String.fromCharCode,g3=Object.assign;qs=1,In=1,HS=0,We=0,be=0,En="";N3=function(e,t,r){for(var n=0,i=0;n=i,i=Nt(),n===38&&i===12&&(t[r]=1),!Ki(i);)rt();return Yi(e,We)},D3=function(e,t){var r=-1,n=44;do switch(Ki(n)){case 0:n===38&&Nt()===12&&(t[r]=1),e[r]+=N3(We-1,t,r);break;case 2:e[r]+=Ss(n);break;case 4:if(n===44){e[++r]=Nt()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Ds(n)}while(n=rt());return e},q3=function(e,t){return VS(D3(zS(e),t))},_S=new WeakMap,L3=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!_S.get(r))&&!n){_S.set(e,!0);for(var i=[],o=q3(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},F3=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};M3=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case _f:e.return=GS(e.value,e.length);break;case JS:return wn([Hi(e,{value:J(e.value,"@","@"+B)})],n);case yf:if(e.length)return b3(e.props,function(i){switch(_3(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return wn([Hi(e,{props:[J(i,/:(read-\w+)/,":"+Ps+"$1")]})],n);case"::placeholder":return wn([Hi(e,{props:[J(i,/:(plac\w+)/,":"+B+"input-$1")]}),Hi(e,{props:[J(i,/:(plac\w+)/,":"+Ps+"$1")]}),Hi(e,{props:[J(i,/:(plac\w+)/,Me+"input-$1")]})],n)}return""})}},j3=[M3],U3=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var v=m.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var n=e.stylisPlugins||j3,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(m){for(var v=m.getAttribute("data-emotion").split(" "),y=1;y<v.length;y++)i[v[y]]=!0;a.push(m)});var s,l=[L3,F3];{var c,d=[P3,R3(function(m){c.insert(m)})],u=C3(l.concat(n,d)),p=function(m){return wn(k3(m),u)};s=function(m,v,y,g){c=y,p(m?m+"{"+v.styles+"}":v.styles),g&&(f.inserted[v.name]=!0)}}var f={key:t,sheet:new p3({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:s};return f.sheet.hydrate(a),f};J3={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},$3=/[A-Z]|^ms/g,H3=/_EMO_([^_]+?)_([^]*?)_EMO_/g,WS=function(e){return e.charCodeAt(1)===45},bS=function(e){return e!=null&&typeof e!="boolean"},Kd=O3(function(e){return WS(e)?e:e.replace($3,"-$&").toLowerCase()}),wS=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(H3,function(r,n,i){return hr={name:n,styles:i,next:hr},n})}return J3[e]!==1&&!WS(e)&&typeof t=="number"&&t!==0?t+"px":t};IS=/label:\s*([^\s;{]+)\s*(;|$)/g;V3=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},G3=function(e,t,r){V3(e,t);var n=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var i=t;do e.insert(t===i?"."+n:"",i,e.sheet,!0),i=i.next;while(i!==void 0)}};W3=function(e){var t=U3(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=Yd(s,t.registered,void 0);return G3(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=Yd(s,t.registered),d="animation-"+c.name;return ES(t,{name:c.name,styles:"@keyframes "+d+"{"+c.styles+"}"}),d},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=Yd(s,t.registered);ES(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return xS(t.registered,r,K3(s))};return{css:r,cx:o,injectGlobal:i,keyframes:n,hydrate:function(a){a.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:KS.bind(null,t.registered),merge:xS.bind(null,t.registered,r)}},K3=function e(t){for(var r="",n=0;n<t.length;n++){var i=t[n];if(i!=null){var o=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))o=e(i);else{o="";for(var a in i)i[a]&&a&&(o&&(o+=" "),o+=a)}break}default:o=i}o&&(r&&(r+=" "),r+=o)}}return r},Y3=W3({key:"css"}),xn=Y3.css,AS=0,YS=[],Se=O,kS=Se.__b,TS=Se.__r,PS=Se.diffed,CS=Se.__c,RS=Se.unmount,OS=Se.__;Se.__b=function(e){tt=null,kS&&kS(e)},Se.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),OS&&OS(e,t)},Se.__r=function(e){TS&&TS(e),df=0;var t=(tt=e.__c).__H;t&&(Qd===tt?(t.__h=[],tt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(ks),t.__h.forEach(ff),t.__h=[],df=0)),Qd=tt},Se.diffed=function(e){PS&&PS(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(YS.push(t)!==1&&SS===Se.requestAnimationFrame||((SS=Se.requestAnimationFrame)||Z3)(X3)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Qd=tt=null},Se.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ks),r.__h=r.__h.filter(function(n){return!n.__||ff(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Se.__e(n,r.__v)}}),CS&&CS(e,t)},Se.unmount=function(e){RS&&RS(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ks(n)}catch(i){t=i}}),r.__H=void 0,t&&Se.__e(t,r.__v))};NS=typeof requestAnimationFrame=="function";tJ=Symbol.for("preact-signals");W=void 0,zi=void 0,mr=0,pf=0,Rs=0;Ne.prototype.brand=tJ;Ne.prototype.h=function(){return!0};Ne.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};Ne.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Ne.prototype.subscribe=function(e){var t=this;return Xi(function(){var r=t.value,n=W;W=void 0;try{e(r)}finally{W=n}})};Ne.prototype.valueOf=function(){return this.value};Ne.prototype.toString=function(){return this.value+""};Ne.prototype.toJSON=function(){return this.value};Ne.prototype.peek=function(){var e=W;W=void 0;try{return this.value}finally{W=e}};Object.defineProperty(Ne.prototype,"value",{get:function(){var e=XS(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(pf>100)throw new Error("Cycle detected");this.v=e,this.i++,Rs++,mr++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Fs()}}}});(Sn.prototype=new Ne).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Rs))return!0;if(this.g=Rs,this.f|=1,this.i>0&&!ZS(this))return this.f&=-2,!0;var e=W;try{eA(this),W=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return W=e,tA(this),this.f&=-2,!0};Sn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ne.prototype.S.call(this,e)};Sn.prototype.U=function(e){if(this.t!==void 0&&(Ne.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Sn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Sn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=XS(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});Qi.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};Qi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rA(this),eA(this),mr++;var e=W;return W=this,rJ.bind(this,e)};Qi.prototype.N=function(){2&this.f||(this.f|=2,this.o=zi,zi=this)};Qi.prototype.d=function(){this.f|=8,1&this.f||wf(this)};iA=[];Xi(function(){nA=this.N})();oA.displayName="_st";Object.defineProperties(Ne.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:oA},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});An("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Ne&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});An("__r",function(e,t){Os();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return Xi(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Os(r),e(t)});An("__e",function(e,t,r,n){Os(),e(t,r,n)});An("diffed",function(e,t){Os();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],d=n[l];c===void 0?(c=nJ(r,l,d,i),o[l]=c):c.o(d,i)}}}e(t)});An("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)});An("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Ke.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(n||o||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var a in e)if(a!=="__source"&&e[a]!==this.props[a])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};iJ=function(e){queueMicrotask(function(){queueMicrotask(e)})};je=xn`
486
+ `);throw e.errors.length=0,xd(!1),new TypeError(n)}}var S,Pd=T(()=>{"use strict";kd();kd();S={object(e){return new ns(e)},array(e){return new ts(e)},tuple(...e){return new as(...e)},literal(e){return new is(e)},or(...e){return new os(...e)},symbol(){return new Ya},record(e){return new rs(e)},function(){return new Za},boolean(){return new Wa},string(){return new Ka},number(){return new Ga},undefined(){return new Qa},null(){return new Xa},unknown(){return new pn},any(){return new pn},as(){return new pn},arraybuffer(){return new ss},enum(...e){return new es(...e)},typedarray(e){return new ls(e)}}});var cs,Sx,Ax=T(()=>{"use strict";D();st();Pd();Mr();cs=1,Sx=e=>{function t(n,i){return(...o)=>{var u,p,f,m;let a=Date.now(),s={method:n,trace_id:cs};cs+=1;let l="SUCCESS",c=`${n}:ok`,d=0;try{if(i.paramsSchema)try{Td(i.paramsSchema,o,"params")}catch(_){throw Al(`${n}:fail ${_.message}`)}let v=i.implement(...o),y=v,g=`${n}:ok`;if(v&&"code"in v){let{code:_,data:w,message:k}=v;l=_,y=w,g=k}return{code:l,message:g,data:y}}catch(v){let y=v;d=(p=(u=y.code)!=null?u:y.errNo)!=null?p:2e3,l="FAILURE";let g=(m=(f=y.message)!=null?f:y.errMsg)!=null?m:`${v}`;return c=`${n}:${l} ${g.replace(/^\S+:(fail|cancel)\s?/,"")}`,ke(new Fn(c,d)),{code:l,message:c}}finally{let v=Date.now()-a;e("apiInvoked",L(P({},s),{duration:v,status:l}))}}}function r(n,i){return(...o)=>I(this,null,function*(){var p,f,m,v;let a=ep(o)?o:[o],s=Date.now(),l={method:n,trace_id:cs};cs+=1;let c=`${n}:ok`,d="SUCCESS",u={code:d,message:c};try{if(i.paramsSchema)try{Td(i.paramsSchema,a,"params")}catch(_){throw Al(_.message)}let g=yield i.implement(...a);if(g&&"code"in g){let{code:_,data:w,message:k}=g;d=_,c=k,g=w}return Object.assign(u,{code:d,message:c,data:g}),u}catch(y){let g=y,_=(f=(p=g.code)!=null?p:g.errNo)!=null?f:2e3;d="FAILURE";let w=(v=(m=g.message)!=null?m:g.errMsg)!=null?v:`${y}`,k=`${n}:${d} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:d,message:k}),ke(new Fn(k,_)),u}finally{let y=Date.now()-s;e("apiInvoked",L(P({},l),{duration:y,status:d}))}})}return{createAPI:r,createSyncAPI:t}}});var Re,K,q,kx,pt=T(()=>{"use strict";Ex();_r();Ax();Pd();Ae();Q();({createAPI:Re,createSyncAPI:K}=Sx(lt)),q=Ix("native"),{canIUseNative:kx}=Jf(()=>x.sdkInfo.nativeSDKVersionCode)});var Tx,BB,JB,$B,HB,Px=T(()=>{"use strict";D();pt();Ae();Tx=me(),BB="env",JB="getSystemInfoSync",$B=K(JB,{implement:()=>{var r;let e=F("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform.toLowerCase(),version:t.sdkInfo.jssdkVersion,pixelRatio:t.deviceInfo.pixelRatio,language:t.deviceInfo.lang,brand:t.deviceInfo.brand,appName:(r=t.hostInfo)==null?void 0:r.appName,SDKVersion:t.sdkInfo.jssdkVersion}}}),HB=K(BB,{implement:()=>{var t;let e=F("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Tx.registerCommand("API.getSystemInfoSync",$B);Tx.registerCommand("API.env",HB);q("env",{version:"1.0.0"});q("getSystemInfoSync",{version:"1.0.0"})});var Cx=h(Cd=>{"use strict";D();pt();st();Ae();_r();Q();var zB="exitGame",VB="onReady",GB="onJoliboxShow",WB="onJoliboxHide",us=me(),ds=po(ke),KB=Re(zB,{paramsSchema:S.tuple(S.function(),S.boolean().optional().default(!1)),implement:(e,t=!1)=>I(Cd,null,function*(){ds(e).call(Cd),qn(x.shouldInterupt)&&!x.shouldInterupt&&x.from&&Wf("onRetentionResult",{shouldStay:t},x.from,!0),t||x.setDoExitDirectly(),yield he("exitAppAsync")})}),YB=K(GB,{paramsSchema:S.tuple(S.function()),implement(e){let t=ds(e);He("onJoliboxEnterForeground",()=>{t.call(this),jn.emit("visible",!0)})}}),QB=K(WB,{paramsSchema:S.tuple(S.function()),implement(e){let t=ds(e);He("onJoliboxEnterBackground",()=>{t.call(this),jn.emit("visible",!1)})}}),XB=K(VB,{paramsSchema:S.tuple(S.function()),implement(e){let t=ds(e);we.on("LifecycleEvent.onReady",r=>{t(r)})}});us.registerCommand("LifecycleSDK.exit",KB);us.registerCommand("LifecycleSDK.onReady",XB);us.registerCommand("LifecycleSDK.onJoliboxShow",YB);us.registerCommand("LifecycleSDK.onJoliboxHide",QB);q("lifeCycle.exit",{version:"1.0.0"});q("lifeCycle.onReady",{version:"1.0.0"});q("lifeCycle.onJoliboxShow",{version:"1.0.0"});q("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Rx(e){let t={};if(!gr(e))return t;for(let[r,n]of Object.entries(e)){let i=r.toLocaleLowerCase();n?typeof n=="object"?t[i]=Object.prototype.toString.call(n):t[i]=String(n):t[i]=""}return t}function Ox(e="GET"){if(e==="")return"POST";let t=e.toUpperCase();return["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"].includes(t)?t:"GET"}function Nx(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Dx(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!gr(r))return e;let[n,i=""]=e.split("?"),o=new URLSearchParams(i);for(let[s,l]of Object.entries(r))l!=null&&o.append(s,String(l));let a=o.toString();return a?`${n}?${a}`:n}var qx=T(()=>{"use strict";D()});var ZB,e5,Rd,Od,Lx,t5,r5,n5,Fx=T(()=>{"use strict";Mr();Tl();pt();qx();D();st();Q();ZB=15,e5=vo("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:x.baseApiHost}),Rd=0,Od=[],Lx=po(ke),t5=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},r5=e=>{let t=new yt,r=()=>{};return K("request",{paramsSchema:S.tuple(S.object({url:S.string(),method:S.string(),headers:S.object().optional(),data:S.object().optional(),query:S.object().optional(),dataType:S.string().default("json"),responseType:S.string().default("text"),enableCache:S.boolean().default(!1),appendHostCookie:S.boolean().default(!0),timeout:S.number().default(3e4),success:S.function(),fail:S.function()})),implement(i){let o=()=>I(this,null,function*(){var s,l,c;let a=Lx(i.fail);try{if(Rd+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:m}=i,v=Rx((s=i.headers)!=null?s:{}),y=Ox(i.method),g=Nx(i.timeout),_=Dx(i.url,y,d),w=Lx(i.success),k=Object.assign({},i,{method:y,header:m?void 0:v,data:y==="GET"||y==="HEAD"?void 0:d,enableCache:f,query:(l=i.query)!=null?l:{},dataType:u,responseType:p,appendHostCookie:m});g&&(k.timeout=g);let R=e5(_,k);{let{response:C}=yield R,{code:E,data:A,message:H}=C;if(A&&typeof A=="object"&&"status"in A&&A.status!==200)throw er({code:A.status||-1,msg:`request:fail status ${A.status}`});t.resolve({code:E!=null?E:"SUCCESS",data:A,message:H!=null?H:"request:ok"}),w({code:"SUCCESS",message:"request:ok",data:A})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{Rd-=1,(c=Od.shift())==null||c()}});return Rd>=ZB?(r=()=>{t5(Od,a=>a===o)},Od.push(o)):o(),t.promise}})(e),{abort(){t.reject(er({code:-1,msg:"request:fail abort"})),r()}}},n5=me();n5.registerCommand("HttpSDK.request",r5);q("request",{version:"1.0.0"})});function Mx(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return t==="array"&&(t="object"),l5.includes(t)?t:""}function jx(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 Ux(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 fs,i5,o5,a5,s5,x8,S8,l5,Ui,Nd,Dd=T(()=>{"use strict";pt();Ae();D();wt();Q();fs=me(),i5=Re("getLocalStorage",{paramsSchema:S.tuple(S.string()),implement(e){return I(this,null,function*(){let{response:t}=yield ne(`/api/games/user-storage/${x.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=jx(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}}})}});fs.registerCommand("StorageSDK.getItem",i5);q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});o5=Re("setStorage",{paramsSchema:S.tuple(S.string(),S.or(S.string(),S.boolean(),S.number())),implement(e,t){return I(this,null,function*(){let r=x.mpId,n=typeof t=="string"?t:String(t),{response:i}=yield ne(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:o,message:a}}=i,s=Mx(t),l=Ux(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`}})}});fs.registerCommand("StorageSDK.setItem",o5);q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});a5=Re("removeStorage",{paramsSchema:S.tuple(S.string()),implement(e){return I(this,null,function*(){let t=x.mpId,{response:r}=yield ne(`/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"}})}});fs.registerCommand("StorageSDK.removeItem",a5);q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});s5=Re("clearStorage",{implement(){return I(this,null,function*(){let e=x.mpId,{response:t}=yield ne(`/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`}})}});fs.registerCommand("StorageSDK.clear",s5);q("storage.clear",{version:"1.0.0"});x8=Re("getStorageInfo",{implement(){return I(this,null,function*(){let{data:e}=yield he("getStorageInfoAsync");return e})}});q("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});S8=K("getStorageInfoSync",{implement(){return F("getStorageInfoSync")}}),l5=["string","number","boolean","object",""];Ui=Re("getGlobalStorage",{paramsSchema:S.tuple(S.string()),implement(e){return I(this,null,function*(){try{let{data:{data:t,dataType:r}}=yield he("getGlobalStorageAsync",{key:e});return{code:"SUCCESS",message:"success",data:jx(t,r)}}catch(t){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get global storage failed",data:null}}})}}),Nd=Re("setGlobalStorage",{paramsSchema:S.tuple(S.string(),S.or(S.string(),S.boolean(),S.number(),S.array())),implement(e,t){return I(this,null,function*(){try{let r=Mx(t),n=Ux(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 c5,u5,d5,qd,Bx=T(()=>{"use strict";D();Ae();pt();c5=K("showKeyboard",{paramsSchema:S.tuple(S.object({defaultValue:S.string().optional().default(""),multiple:S.boolean().optional().default(!1),maxLength:S.unknown().optional().default(1e5)})),implement(e){var n;let t=Math.floor((n=Number(e.maxLength))!=null?n:1e5),{defaultValue:r}=e;r&&t&&(r=r.slice(0,t)),F("showKeyboardSync",L(P({},e),{defaultValue:r,maxLength:t}))}});q("keyboard.showKeyboard",{version:"1.0.0",properties:{params:{defaultValue:"1.0.0",multiple:"1.0.0",confirmHold:"1.0.0",confirmType:"1.0.0",maxLength:"1.0.0"}},success:{errMsg:"1.0.0"}});u5=K("updateKeyboard",{paramsSchema:S.tuple(S.object({value:S.string()})),implement(e){F("updateKeyboardSync",e)}});q("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});d5=K("hideKeyboard",{implement(){F("hideKeyboardSync")}});q("keyboard.hideKeyboard",{version:"1.0.0"});qd=me();qd.registerCommand("KeyboardSDK.showKeyboard",c5);qd.registerCommand("KeyboardSDK.updateKeyboard",u5);qd.registerCommand("KeyboardSDK.hideKeyboard",d5)});var Jx=h(ps=>{"use strict";D();pt();_r();var Ld=me(),f5=Re("levelFinished",{paramsSchema:S.tuple(S.object({levelId:S.or(S.string(),S.number()),duration:S.number().optional(),rating:S.number().optional(),score:S.number().optional()})),implement:e=>I(ps,null,function*(){let{levelId:t,duration:r,rating:n,score:i}=e,o=[];o.push(qt.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i})),o.push(qt.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),p5=Re("gamePlayEnded",{paramsSchema:S.tuple(S.object({duration:S.number().optional(),rating:S.number().optional(),score:S.number()})),implement:e=>I(ps,null,function*(){let{duration:t,rating:r,score:n}=e;return qt.tracker("GamePlayEnded",{duration:t,rating:r,score:n})})}),h5=Re("levelUpgrade",{paramsSchema:S.tuple(S.object({levelId:S.or(S.string(),S.number()),name:S.string().optional()})),implement:r=>I(ps,[r],function*({levelId:e,name:t}){let n=[];n.push(qt.tracker("LevelUpgrade",{name:t,levelId:e})),yield Promise.all(n)})});Ld.registerCommand("TaskTrackerSDK.levelFinished",f5);Ld.registerCommand("TaskTrackerSDK.gamePlayEnded",p5);Ld.registerCommand("TaskTrackerSDK.levelUpgrade",h5);q("TaskTrackerSDK.onLevelFinished",{version:"1.1.25",properties:{params:{levelId:"1.1.25",duration:"1.1.25",rating:"1.1.25",score:"1.1.25"}}});q("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25"}}});q("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var Fd,m5,$x,Md=T(()=>{"use strict";Q();Ae();pt();D();Mr();q("login",{version:"1.0.0",properties:{force:"1.0.0"},success:{errMsg:"1.0.0",code:"1.0.0",token:"1.0.0",isLogin:"1.0.0"}});q("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});Fd=Re("login",{implement(){return I(this,null,function*(){var a;let{data:{isLogin:e}}=yield he("checkLoginAsync");if(e)return{isLogin:!0,token:(a=x.hostUserInfo)==null?void 0:a.token};let t=F("loginSync"),{data:{uuid:r}}=t;if(!r)throw er({code:-1,msg:"login failed"});He("onLoginStateChange",({isLogin:s,token:l,uuid:c})=>{c==r&&i({isLogin:s,token:l})});let{promise:n,resolve:i}=new yt,o=yield n;return x.onEnvConfigChanged({hostUserInfo:o}),we.emit("onLoginComplete",o),o})}}),m5=Re("checkSession",{implement(){return I(this,null,function*(){let{data:{isLogin:e}}=yield he("checkLoginAsync");return{isLogin:e}})}}),$x=me();$x.registerCommand("API.login",Fd);$x.registerCommand("API.checkSession",m5)});var mn,hs,ht,ms,vn,vs,hn,v5,G,gn,Dr=T(()=>{"use strict";D();mn="UNLOCK_OPTIONS_CHANGED",hs="INVOKE_PAYMENT",ht="ON_PAYMENT_RESULT",ms="ON_USE_MODAL_EVENT",vn="ON_USE_MODAL_RESULT",vs="ON_USE_MODAL_FREQUENCY",hn=new bt,v5=()=>({on:hn.on.bind(hn),off:hn.off.bind(hn),emit:hn.emit.bind(hn)}),G=v5(),gn={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}}});function Gt(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r)}}var Bi=T(()=>{"use strict"});var jd,Hx=T(()=>{"use strict";jd=e=>{let t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),n=r+24*60*60*1e3;return e.filter(i=>i>=r&&i<n)}});var gs,zx,Vx,Gx,Wx,Kx=T(()=>{"use strict";Dd();Hx();gs=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t},zx=e=>I(void 0,null,function*(){let{dailyMaxPopUps:t,minInterval:r}=e,n=yield Ui("joli_coin_use_modal_frequency");if(console.log("checkUseModalFrequency",n.data),!n.data)return!0;let i=gs(n.data),o=jd(i);return!(o.length>=t||Date.now()-o[o.length-1]<r)}),Vx=()=>I(void 0,null,function*(){var n;let e=Date.now(),t=yield Ui("joli_coin_use_modal_frequency"),r=gs((n=t.data)!=null?n:"[]");r.push(e),r.sort((i,o)=>o-i).splice(8),yield Nd("joli_coin_use_modal_frequency",JSON.stringify(r))}),Gx=e=>I(void 0,null,function*(){let{dailyMaxPopUps:t,minInterval:r}=e,n=yield Ui("joli_coin_payment_frequency");if(console.log("checkPaymentFrequency",n.data),!n.data)return!0;let i=gs(n.data),o=jd(i);return!(o.length>=t||Date.now()-o[o.length-1]<r)}),Wx=()=>I(void 0,null,function*(){var n;let e=Date.now(),t=yield Ui("joli_coin_payment_frequency"),r=gs((n=t.data)!=null?n:"[]");r.push(e),r.sort((i,o)=>o-i).splice(8),yield Nd("joli_coin_payment_frequency",JSON.stringify(r))})});function Yx(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return I(this,null,function*(){let i=e.get(r);if(!i)return{code:"FAILED",message:`[joliboxSDK]: ${r} payment not supported in this platform`};try{return yield i(...n)}catch(o){return ke(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var Qx=T(()=>{"use strict";st()});var ys=T(()=>{"use strict"});var g5,yn,fr,y5,qr,Ud=T(()=>{"use strict";ys();D();Q();wt();g5=()=>{let[e,t]=[sp,cp].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:yn,createPaymentInternalError:fr}=g5(),y5=x.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",qr=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>I(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw yn(n,1001);return yield this.pay()});this.cancelOrder=t=>I(this,null,function*(){var n,i;let{response:r}=yield ne(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw yn((i=(n=r.message)!=null?n:r.errMsg)!=null?i:"",1003)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",x.deviceInfo.platform),t.set("joliSource",x.encodeJoliSourceQuery(P({},this.generatePaymentContext()))),`${y5}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var Bd,Zx,eS=T(()=>{"use strict";wt();Ud();ys();Bd=class extends qr{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>I(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return I(this,null,function*(){var n,i,o,a;try{let{response:s}=yield ne("/api/orders/checkout/joli-coin",{method:"POST",data:{productId:r.productId}});if(s.code!=="SUCCESS")throw yn((i=(n=s.errMsg)!=null?n:s.message)!=null?i:"",1002);return{code:"SUCCESS",message:(o=s.message)!=null?o:"placeorder jolicoin success",data:s.data}}catch(s){throw console.info("[JoliboxSDK] placeorder failed",s),fr((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},Zx=()=>{let e=new Map;return t=>I(void 0,null,function*(){let r=e.get(t);return r||(r=new Bd(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var tS,rS=T(()=>{"use strict";tS={SUCCESS:"unlockSuccess",FAIL_NOT_LOGIN:"unlockFailedNotLogin",FAIL_PAYING:"unlockFailedPaying",FAIL_PRODUCT_EMPTY:"unlockFailedProductIdNotFound",FAIL_GET_PRODUCT_INFO:"unlockFailedProductInvalid",FAIL_LAUNCH_BILLING:"unlockFailedLaunch",FAIL_TRANSACTION:"unlockFailedTransaction",FAIL_VERIFY:"unlockFaileVerify",TRANSACTION_PENDING:"transactionPending",FAILED:"unlockFailed"}});var Jd,nS,$d,Hd,_5,iS,oS=T(()=>{"use strict";wt();Ud();ys();Ae();D();Q();Nr();rS();Jd=new Map;He("onPaymentStateChange",e=>{var a;console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=Jd.get(t);if(o){if(r==="SUCCESS")ji("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&tp(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw fr(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let s=(a=tS[r])!=null?a:"unlockFailed";ji(`{slot-error} {slot-i18n-jolicoin.${s}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}Jd.delete(t)}});nS=e=>I(void 0,null,function*(){var n,i;let t=new yt,r;try{let o=yield he("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---payInApp---",o),!r)throw fr("orderUUID is null",1002);Jd.set(r,t)}catch(o){throw fr((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),$d=class extends qr{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>I(this,null,function*(){return yield nS({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return I(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},Hd=class extends qr{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>I(this,null,function*(){return yield nS({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return I(this,null,function*(){var a;console.log("----start place order for ios----");let{response:n}=yield ne("/api/orders/iap-init",{method:"GET",appendHostCookie:!0}),{data:i,code:o}=n!=null?n:{};if(console.log("----iap init----",i,o),i.code!=="SUCCESS")throw fr("iap-init failed",1002);return this.appAccountToken=(a=i==null?void 0:i.data)==null?void 0:a.iapToken,{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},_5={android:$d,ios:Hd},iS=()=>{let e=new Map;return t=>I(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=_5[x.platform];if(!s)throw fr("platform not supported",1002);i=new s(r,n),e.set(r,i)}let{code:o,message:a}=yield i.startPayment({productId:r,appStoreProductId:n});if(o!=="SUCCESS")throw yn(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var _s,aS=T(()=>{"use strict";Qx();eS();oS();_s=Yx();_s.registerPaymentHandler("JOLI_COIN",Zx());_s.registerPaymentHandler("JOLI_COIN_IAP",iS())});var cS=h(Wt=>{"use strict";Dr();Nr();wt();Q();Md();Bi();Kx();aS();Nr();pt();Ae();D();var Vd=Gt(G,vs);Vd.getData();var pr=wd(),zd=Promise.resolve(),lS=e=>I(Wt,null,function*(){zd=zd.then(()=>I(Wt,null,function*(){yield ne("/api/joli-coin/user-config",{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield zd});G.on(ms,(e,t)=>I(Wt,null,function*(){if(e==="ADS-JOLI_COIN"){yield pr.show({duration:3e3});let n=yield Vd.getData(),i=yield zx(n.joliCoinUseAndCharge.useJolicoin);if(console.log("use modal show by frequency",i),pr.hide(),!i){G.emit(vn,{useModalResult:"CONFIRM"});return}}let r=ix({data:{enableAutoDeduct:t.enableAutoDeduct,userJolicoin:t.userJoliCoin,joliCoinQuantity:t.joliCoinQuantity},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{G.emit(vn,{useModalResult:"CONFIRM"}),r.destroy()}},cancel:{text:t.cancelButtonText,onPress:({type:n})=>{G.emit(vn,{useModalResult:(n!=null?n:"")==="CANCEL"?"CANCEL":"FAILED"}),r.destroy()}},onEnableDeductChanged:n=>I(Wt,null,function*(){yield lS(n)})}});yield Vx()}));G.on(hs,(e,t)=>I(Wt,null,function*(){var r,n;try{if(!kx("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{G.emit(ht,{paymentResult:"FAILED"})},0);return}if(e==="ADS-JOLI_COIN"){yield pr.show({duration:3e3});let a=yield Vd.getData(),s=yield Gx(a.joliCoinUseAndCharge.charge);if(console.log("use payment show by frequency",s),pr.hide(),!s){G.emit(ht,{paymentResult:"SUCCESS"});return}console.log("show by frequency")}yield pr.show({duration:3e3});let i=yield sS();if(pr.hide(),!i){G.emit(ht,{paymentResult:"FAILED"});return}let o=ox({data:{userJolicoin:t.userJoliCoin,joliCoinQuantity:t.joliCoinQuantity,paymentChoices:(n=(r=i.paymentChoices)==null?void 0:r.map(a=>{var s;return L(P({},a),{totalAmountStr:(s=a.totalAmountStr)!=null?s:""})}))!=null?n:[],enableAutoDeduct:i.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:a=>I(Wt,null,function*(){var c,d,u,p;if(!((c=x.hostUserInfo)!=null&&c.isLogin)){let{data:f}=yield Fd();if(!(f!=null&&f.isLogin)){console.log("login failed");return}let m=yield sS();if(((d=m==null?void 0:m.balance)!=null?d:0)>=t.joliCoinQuantity){G.emit(ht,{paymentResult:"SUCCESS"}),o.destroy();return}}console.log("invokeNativePayment",a);let s=(p=(u=i==null?void 0:i.paymentChoices)==null?void 0:u.find(f=>f.productId===a))==null?void 0:p.appStoreProductId;if(!s){G.emit(ht,{paymentResult:"FAILED"}),o.destroy();return}yield pr.show({duration:3e3});let{code:l}=yield _s.invokePayment("JOLI_COIN_IAP",{productId:a,appStoreProductId:s});if(pr.hide(),l!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}G.emit(ht,{paymentResult:"SUCCESS"}),o.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:a})=>{G.emit(ht,{paymentResult:(a!=null?a:"")==="CANCEL"?"CANCEL":"FAILED"}),o.destroy()}},onEnableDeductChanged:a=>I(Wt,null,function*(){yield lS(a)})}});yield Wx()}catch(i){console.info("payment failed",i),G.emit(ht,{paymentResult:"FAILED"})}}));var b5=(e,t)=>{Object.keys(t).forEach(r=>{let n=e.paymentChoices.find(i=>i.appStoreProductId===r);n&&(n.totalAmountStr=t[r].price)}),e.paymentChoices=e.paymentChoices.filter(r=>!hl(r.totalAmountStr)),console.info("----mergeResponseData-----",e.paymentChoices)},sS=()=>I(Wt,null,function*(){var r,n,i,o,a,s,l,c;let{response:e}=yield ne("/api/joli-coin/balance-detail",{method:"GET",appendHostCookie:!0,responseType:"json"});console.info("getBalenceDetails",e);let{data:t}=yield he("requestProductDetailsAsync",{appStoreProductIds:(o=(i=(n=(r=e.data)==null?void 0:r.data)==null?void 0:n.paymentChoices)==null?void 0:i.filter(d=>typeof d.appStoreProductId=="string").map(d=>d.appStoreProductId))!=null?o:[]});return(a=e.data)!=null&&a.data&&t&&b5((s=e.data)==null?void 0:s.data,t),console.info("productDetails",(l=e.data)==null?void 0:l.data),(c=e.data)==null?void 0:c.data})});function et(e,t,r){return(t=x5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x5(e){var t=S5(e,"string");return typeof t=="symbol"?t:t+""}function S5(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bs(e,t,r){return(t=A5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A5(e){var t=k5(e,"string");return typeof t=="symbol"?t:t+""}function k5(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function L5(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function F5(e){return typeof e=="string"}function M5(e){return typeof e=="undefined"}function j5(e){return M5(e)||e===null}function U5(e){return typeof e=="function"}function LS(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function Ji(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function Es(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function G5(e){let t=e.location?Es(e.location,mS):null,r=e.target?Es(e.target,mS):null;return Es(N5(O5({},e),{location:t,target:r}),z5)}function W5(e){let t=e.events.map(n=>G5(n)),r=Es(e.device,V5);return[e.protocolVersion,t,r,e.project]}function K5(){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 e3(e){return new Promise(t=>US(e)(t))}function US(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function t3(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Gi(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}function n3(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)i3(e[n],t[n])}function i3(e,t){if(F5(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(U5(t)){try{if(e instanceof t)return}catch(r){}if(!j5(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 Wd(e,t,r){return(t=o3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o3(e){var t=a3(e,"string");return typeof t=="symbol"?t:t+""}function a3(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ws(e,t,r){return(t=s3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s3(e){var t=l3(e,"string");return typeof t=="symbol"?t:t+""}function l3(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kt(e,t,r){return(t=c3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c3(e){var t=u3(e,"string");return typeof t=="symbol"?t:t+""}function u3(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function d3(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function f3(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}function y3(e,t){return Oe(e,0)^45?(((t<<2^Oe(e,0))<<2^Oe(e,1))<<2^Oe(e,2))<<2^Oe(e,3):0}function $S(e){return e.trim()}function _3(e,t){return(e=t.exec(e))?e[0]:e}function J(e,t,r){return e.replace(t,r)}function cf(e,t){return e.indexOf(t)}function Oe(e,t){return e.charCodeAt(t)|0}function Wi(e,t,r){return e.slice(t,r)}function Ot(e){return e.length}function bf(e){return e.length}function Is(e,t){return t.push(e),e}function b3(e,t){return e.map(t).join("")}function Ls(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:qs,column:In,length:a,return:""}}function Hi(e,t){return g3(Ls("",null,null,"",null,null,0),e,{length:-e.length},t)}function w3(){return be}function I3(){return be=We>0?Oe(En,--We):0,In--,be===10&&(In=1,qs--),be}function rt(){return be=We<HS?Oe(En,We++):0,In++,be===10&&(In=1,qs++),be}function Nt(){return Oe(En,We)}function xs(){return We}function Yi(e,t){return Wi(En,e,t)}function Ki(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function zS(e){return qs=In=1,HS=Ot(En=e),We=0,[]}function VS(e){return En="",e}function Ss(e){return $S(Yi(We-1,uf(e===91?e+2:e===40?e+1:e)))}function E3(e){for(;(be=Nt())&&be<33;)rt();return Ki(e)>2||Ki(be)>3?"":" "}function x3(e,t){for(;--t&&rt()&&!(be<48||be>102||be>57&&be<65||be>70&&be<97););return Yi(e,xs()+(t<6&&Nt()==32&&rt()==32))}function uf(e){for(;rt();)switch(be){case e:return We;case 34:case 39:e!==34&&e!==39&&uf(be);break;case 40:e===41&&uf(e);break;case 92:rt();break}return We}function S3(e,t){for(;rt()&&e+be!==57&&!(e+be===84&&Nt()===47););return"/*"+Yi(t,We-1)+"*"+Ds(e===47?e:rt())}function A3(e){for(;!Ki(Nt());)rt();return Yi(e,We)}function k3(e){return VS(As("",null,null,null,[""],e=zS(e),0,[0],e))}function As(e,t,r,n,i,o,a,s,l){for(var c=0,d=0,u=a,p=0,f=0,m=0,v=1,y=1,g=1,_=0,w="",k=i,R=o,C=n,E=w;y;)switch(m=_,_=rt()){case 40:if(m!=108&&Oe(E,u-1)==58){cf(E+=J(Ss(_),"&","&\f"),"&\f")!=-1&&(g=-1);break}case 34:case 39:case 91:E+=Ss(_);break;case 9:case 10:case 13:case 32:E+=E3(m);break;case 92:E+=x3(xs()-1,7);continue;case 47:switch(Nt()){case 42:case 47:Is(T3(S3(rt(),xs()),t,r),l);break;default:E+="/"}break;case 123*v:s[c++]=Ot(E)*g;case 125*v:case 59:case 0:switch(_){case 0:case 125:y=0;case 59+d:g==-1&&(E=J(E,/\f/g,"")),f>0&&Ot(E)-u&&Is(f>32?yS(E+";",n,r,u-1):yS(J(E," ","")+";",n,r,u-2),l);break;case 59:E+=";";default:if(Is(C=gS(E,t,r,c,d,i,s,w,k=[],R=[],u),o),_===123)if(d===0)As(E,t,C,C,k,o,u,s,R);else switch(p===99&&Oe(E,3)===110?100:p){case 100:case 108:case 109:case 115:As(e,C,C,n&&Is(gS(e,C,C,0,0,i,s,w,i,k=[],u),R),i,R,u,s,n?k:R);break;default:As(E,C,C,C,[""],R,0,s,R)}}c=d=f=0,v=g=1,w=E="",u=a;break;case 58:u=1+Ot(E),f=m;default:if(v<1){if(_==123)--v;else if(_==125&&v++==0&&I3()==125)continue}switch(E+=Ds(_),_*v){case 38:g=d>0?1:(E+="\f",-1);break;case 44:s[c++]=(Ot(E)-1)*g,g=1;break;case 64:Nt()===45&&(E+=Ss(rt())),p=Nt(),d=u=Ot(w=E+=A3(xs())),_++;break;case 45:m===45&&Ot(E)==2&&(v=0)}}return o}function gS(e,t,r,n,i,o,a,s,l,c,d){for(var u=i-1,p=i===0?o:[""],f=bf(p),m=0,v=0,y=0;m<n;++m)for(var g=0,_=Wi(e,u+1,u=v3(v=a[m])),w=e;g<f;++g)(w=$S(v>0?p[g]+" "+_:J(_,/&\f/g,p[g])))&&(l[y++]=w);return Ls(e,t,r,i===0?yf:s,l,c,d)}function T3(e,t,r){return Ls(e,t,r,BS,Ds(w3()),Wi(e,2,-2),0)}function yS(e,t,r,n){return Ls(e,t,r,_f,Wi(e,0,n),Wi(e,n+1,-1),n)}function wn(e,t){for(var r="",n=bf(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function P3(e,t,r,n){switch(e.type){case m3:if(e.children.length)break;case h3:case _f:return e.return=e.return||e.value;case BS:return"";case JS:return e.return=e.value+"{"+wn(e.children,n)+"}";case yf:e.value=e.props.join(",")}return Ot(r=wn(e.children,n))?e.return=e.value+"{"+r+"}":""}function C3(e){var t=bf(e);return function(r,n,i,o){for(var a="",s=0;s<t;s++)a+=e[s](r,n,i,o)||"";return a}}function R3(e){return function(t){t.root||(t=t.return)&&e(t)}}function O3(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function GS(e,t){switch(y3(e,t)){case 5103:return B+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return B+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return B+e+Ps+e+Me+e+e;case 6828:case 4268:return B+e+Me+e+e;case 6165:return B+e+Me+"flex-"+e+e;case 5187:return B+e+J(e,/(\w+).+(:[^]+)/,B+"box-$1$2"+Me+"flex-$1$2")+e;case 5443:return B+e+Me+"flex-item-"+J(e,/flex-|-self/,"")+e;case 4675:return B+e+Me+"flex-line-pack"+J(e,/align-content|flex-|-self/,"")+e;case 5548:return B+e+Me+J(e,"shrink","negative")+e;case 5292:return B+e+Me+J(e,"basis","preferred-size")+e;case 6060:return B+"box-"+J(e,"-grow","")+B+e+Me+J(e,"grow","positive")+e;case 4554:return B+J(e,/([^-])(transform)/g,"$1"+B+"$2")+e;case 6187:return J(J(J(e,/(zoom-|grab)/,B+"$1"),/(image-set)/,B+"$1"),e,"")+e;case 5495:case 3959:return J(e,/(image-set\([^]*)/,B+"$1$`$1");case 4968:return J(J(e,/(.+:)(flex-)?(.*)/,B+"box-pack:$3"+Me+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+B+e+e;case 4095:case 3583:case 4068:case 2532:return J(e,/(.+)-inline(.+)/,B+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ot(e)-1-t>6)switch(Oe(e,t+1)){case 109:if(Oe(e,t+4)!==45)break;case 102:return J(e,/(.+:)(.+)-([^]+)/,"$1"+B+"$2-$3$1"+Ps+(Oe(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~cf(e,"stretch")?GS(J(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Oe(e,t+1)!==115)break;case 6444:switch(Oe(e,Ot(e)-3-(~cf(e,"!important")&&10))){case 107:return J(e,":",":"+B)+e;case 101:return J(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+B+(Oe(e,14)===45?"inline-":"")+"box$3$1"+B+"$2$3$1"+Me+"$2box$3")+e}break;case 5936:switch(Oe(e,t+11)){case 114:return B+e+Me+J(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return B+e+Me+J(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return B+e+Me+J(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return B+e+Me+e+e}return e}function B3(e){for(var t=0,r,n=0,i=e.length;i>=4;++n,i-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function Cs(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return hr={name:i.name,styles:i.styles,next:hr},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)hr={name:a.name,styles:a.styles,next:hr},a=a.next;var s=o.styles+";";return s}return z3(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function z3(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Cs(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":bS(s)&&(n+=Kd(o)+":"+wS(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)bS(a[l])&&(n+=Kd(o)+":"+wS(o,a[l])+";");else{var c=Cs(e,t,a);switch(o){case"animation":case"animationName":{n+=Kd(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}function Yd(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,i="";hr=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=Cs(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=Cs(r,t,e[s]),n){var l=o;i+=l[s]}IS.lastIndex=0;for(var c="",d;(d=IS.exec(i))!==null;)c+="-"+d[1];var u=B3(i)+c;return{name:u,styles:i,next:hr}}function KS(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function ES(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function xS(e,t,r){var n=[],i=KS(e,n,r);return n.length<2?r:i+t(n)}function Q3(e,t){Se.__h&&Se.__h(tt,e,AS||t),AS=0;var r=tt.__H||(tt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function QS(e,t){var r=Q3(df++,7);return eJ(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function X3(){for(var e;e=YS.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ks),e.__H.__h.forEach(ff),e.__H.__h=[]}catch(t){e.__H.__h=[],Se.__e(t,e.__v)}}function Z3(e){var t,r=function(){clearTimeout(n),NS&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);NS&&(t=requestAnimationFrame(r))}function ks(e){var t=tt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),tt=t}function ff(e){var t=tt;e.__c=e.__(),tt=t}function eJ(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Fs(){if(mr>1)mr--;else{for(var e,t=!1;zi!==void 0;){var r=zi;for(zi=void 0,pf++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ZS(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(pf=0,mr--,t)throw e}}function Ge(e){if(mr>0)return e();mr++;try{return e()}finally{Fs()}}function XS(e){if(W!==void 0){var t=e.n;if(t===void 0||t.t!==W)return t={i:0,S:e,p:W.s,n:void 0,t:W,e:void 0,x:void 0,r:t},W.s!==void 0&&(W.s.n=t),W.s=t,e.n=t,32&W.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=W.s,t.n=void 0,W.s.n=t,W.s=t),t}}function Ne(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function Y(e){return new Ne(e)}function ZS(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function eA(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function tA(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function Sn(e){Ne.call(this,void 0),this.x=e,this.s=void 0,this.g=Rs-1,this.f=4}function Vi(e){return new Sn(e)}function rA(e){var t=e.u;if(e.u=void 0,typeof t=="function"){mr++;var r=W;W=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,wf(e),n}finally{W=r,Fs()}}}function wf(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,rA(e)}function rJ(e){if(W!==this)throw new Error("Out-of-order effect");tA(this),W=e,this.f&=-2,8&this.f&&wf(this),Fs()}function Qi(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Xi(e){var t=new Qi(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function An(e,t){O[e]=t.bind(null,O[e]||function(){})}function Os(e){Xd&&Xd(),Xd=e&&e.S()}function oA(e){var t=this,r=e.data,n=aA(r);n.value=r;var i=QS(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=Vi(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=Vi(function(){return!Array.isArray(c.value)&&!Dl(c.value)}),u=Xi(function(){if(this.N=sA,d.value){var f=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),p=t.__$u.d;return t.__$u.d=function(){u(),p.call(this)},[d,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}function nJ(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=Y(r);return{o:function(a,s){o.value=a,n=s},d:Xi(function(){this.N=sA;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function aA(e){return QS(function(){return Y(e)},[])}function oJ(){Ge(function(){for(var e;e=iA.shift();)nA.call(e)})}function sA(){iA.push(this)===1&&(O.requestAnimationFrame||iJ)(oJ)}function aJ(e,t){let r=si(e);Yr(()=>{r.current=e},[e]),ai(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function pe(e,t,r,n,i,o){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--sJ,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return O.vnode&&O.vnode(c),c}function Yt(e,t,r){return(t=_J(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _J(e){var t=bJ(e,"string");return typeof t=="symbol"?t:t+""}function bJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qt(e,t,r){return(t=xJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xJ(e){var t=SJ(e,"string");return typeof t=="symbol"?t:t+""}function SJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rt(e,t,r){return(t=AJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AJ(e){var t=kJ(e,"string");return typeof t=="symbol"?t:t+""}function kJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uS,w5,I5,E5,Zd,ef,DS,T5,P5,dS,C5,R5,fS,O5,N5,D5,qS,q5,B5,J5,pS,$5,hS,H5,FS,MS,jS,mS,z5,V5,tf,ie,Y5,Q5,$i,Gi,X5,nf,Z5,Gd,r3,of,vS,af,sf,lf,p3,Me,Ps,B,BS,yf,_f,h3,JS,m3,v3,Ds,g3,qs,In,HS,We,be,En,N3,D3,q3,_S,L3,F3,M3,j3,U3,J3,$3,H3,WS,bS,Kd,wS,IS,hr,V3,G3,W3,K3,Y3,xn,df,tt,Qd,SS,AS,YS,Se,kS,TS,PS,CS,RS,OS,NS,tJ,W,zi,mr,pf,Rs,nA,Xd,iA,iJ,je,sJ,lJ,Xt,hf,mf,Ts,cJ,uJ,dJ,fJ,pJ,hJ,mJ,vJ,gJ,yJ,vf,bn,_n,wJ,IJ,EJ,gf,Ns,e7,lA=T(()=>{"use strict";Ur();Fo();uS=Object.getOwnPropertySymbols,w5=Object.prototype.hasOwnProperty,I5=Object.prototype.propertyIsEnumerable,E5=(e,t)=>{var r={};for(var n in e)w5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&uS)for(var n of uS(e))t.indexOf(n)<0&&I5.call(e,n)&&(r[n]=e[n]);return r};Zd=class{constructor(t){et(this,"context",void 0),et(this,"continueCallback",void 0),et(this,"adIsShowingCallback",void 0),et(this,"isBeforeAdCalled",!1),et(this,"isBeforeRewardCalled",!1),et(this,"isAdDismissedCalled",!1),et(this,"isAdViewedCalled",!1),et(this,"isAfterAdCalled",!1),et(this,"currentProvider",void 0),et(this,"currentClientParams",void 0),et(this,"adsHasResponse",!1),et(this,"videoChecker",window.document.createElement("video")),et(this,"wrapShowAdFn",r=>()=>{var n;this.adsHasResponse=!0;let i=!1;this.videoChecker.play().catch(()=>{i=!1}),i=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:i},this.paramsToTrack)),(n=this.adIsShowingCallback)==null||n.call(this,!0),r()}),this.context=t}get paramsToTrack(){var t,r,n,i,o,a;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null,type:(n=this.currentClientParams)==null?void 0:n.type,name:((i=this.currentClientParams)==null?void 0:i.type)==="preroll"?null:(a=(o=this.currentClientParams)==null?void 0:o.name)!=null?a:""}}wrapBeforeAd(t){return()=>{var r,n;this.adsHasResponse=!0,this.context.track("CallBeforeAd",this.paramsToTrack),this.isBeforeAdCalled||(this.isBeforeAdCalled=!0,t==null||t(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0)))}}wrapBeforeReward(t){return r=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(r)():(this.isBeforeRewardCalled=!0,t==null||t(this.wrapShowAdFn(r)))}}wrapAdDismissed(t){return()=>{this.adsHasResponse=!0,this.isAdDismissedCalled||(this.isAdDismissedCalled=!0,t==null||t())}}wrapAdViewed(t){return()=>{this.adsHasResponse=!0,this.isAdViewedCalled||(this.isAdViewedCalled=!0,t==null||t())}}wrapAfterAd(t){return()=>{this.adsHasResponse=!0,this.context.track("CallAfterAd",this.paramsToTrack),this.isAfterAdCalled||(this.isAfterAdCalled=!0,t==null||t())}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(o=r.breakName)!=null?o:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{t==null||t(r),(a=this.adIsShowingCallback)==null||a.call(this,!1),(s=this.continueCallback)==null||s.call(this,[!1,r]);break}default:{(l=this.continueCallback)==null||l.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return I(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,d,u;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),(d=this.continueCallback)==null||d.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(c=r.name)!=null?c:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(u=this.adIsShowingCallback)==null||u.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),t.adBreak(a,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};ef=class{constructor(t){bs(this,"context",void 0),bs(this,"adBreakIsShowing",!1),bs(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),bs(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=t,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}},DS=Object.defineProperty,T5=Object.defineProperties,P5=Object.getOwnPropertyDescriptors,dS=Object.getOwnPropertySymbols,C5=Object.prototype.hasOwnProperty,R5=Object.prototype.propertyIsEnumerable,fS=(e,t,r)=>t in e?DS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,O5=(e,t)=>{for(var r in t||(t={}))C5.call(t,r)&&fS(e,r,t[r]);if(dS)for(var r of dS(t))R5.call(t,r)&&fS(e,r,t[r]);return e},N5=(e,t)=>T5(e,P5(t)),D5=(e,t)=>{for(var r in t)DS(e,r,{get:t[r],enumerable:!0})},qS=(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},q5=(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}B5=(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))(B5||{});J5={log:Ji("log"),warn:Ji("warn"),info:Ji("info"),error:Ji("error"),debug:Ji("debug")};Object.assign(globalThis,{logger:J5});pS=Symbol.for("Jolibox.canIUseMap"),$5={};globalThis[pS]||(globalThis[pS]=$5);hS=Symbol.for("Jolibox.canIUseMap.native"),H5={};globalThis[hS]||(globalThis[hS]=H5);FS=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(FS||{}),MS=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(MS||{}),jS=(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))(jS||{}),mS=["name","params"],z5=["name","type","location","target","extra","timestamp","userId"],V5=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];K5();navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),navigator.userAgent.includes("Android"),navigator.userAgent.includes("Mac"),navigator.userAgent.includes("FB_IAB"),!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");tf=class rf{constructor(t){this.element=t,this.next=rf.Undefined,this.prev=rf.Undefined}};tf.Undefined=new tf(void 0);ie=tf,Y5=class{constructor(){this._first=ie.Undefined,this._last=ie.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ie.Undefined}clear(){let e=this._first;for(;e!==ie.Undefined;){let t=e.next;e.prev=ie.Undefined,e.next=ie.Undefined,e=t}this._first=ie.Undefined,this._last=ie.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ie(e);if(this._first===ie.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!==ie.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ie.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ie.Undefined&&e.next!==ie.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ie.Undefined&&e.next===ie.Undefined?(this._first=ie.Undefined,this._last=ie.Undefined):e.next===ie.Undefined?(this._last=this._last.prev,this._last.next=ie.Undefined):e.prev===ie.Undefined&&(this._first=this._first.next,this._first.prev=ie.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ie.Undefined;)yield e.element,e=e.next}},Q5=0,$i=class{constructor(e){this.value=e,this.id=Q5++}},Gi=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 $i&&(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 $i(e);return this._listeners?this._listeners instanceof $i?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 $i)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 $i?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},X5=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 Gi,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 Y5,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)}},nf={};D5(nf,{None:()=>Z5,filter:()=>t3,once:()=>US,toPromise:()=>e3});Z5=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Gd=Symbol.for("Jolibox.hostEmitter"),r3=()=>{let e=new X5;return globalThis[Gd]||(globalThis[Gd]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Gd]};r3();of=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Gi,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 n3(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}};of=qS([LS],of);vS=class{constructor(){this._onWillExecuteCommand=new Gi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Gi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new of,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=L5(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 q5(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),nf.toPromise(nf.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{}}};vS=qS([LS],vS);af=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";Wd(this,"context",void 0),Wd(this,"placement","GAME"),Wd(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:jS.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:FS.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:MS.WebSDK};return W5(i)}};sf=class{constructor(t){ws(this,"configs",null),ws(this,"firstRun",!0),ws(this,"context",void 0),ws(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return I(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(t){}})}shouldBypassCallingInterstitial(){var t,r;let n;if(!this.configs)this.init(),n=!this.firstRun;else{let i=(t=this.contextInfo.channel)!=null?t:"",o=this.configs[i],a=(r=o==null?void 0:o.interstitialRate)!=null?r:1;n=Math.random()<a}return this.firstRun=!1,n}};lf=class{constructor(t,r){Kt(this,"name","ADSENSE"),Kt(this,"context",void 0),Kt(this,"contextInfo",void 0),Kt(this,"configured",!1),Kt(this,"initParams",void 0),Kt(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Kt(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=E5(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Kt(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Kt(this,"adUnit",n=>I(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:d,fullWidthResponsive:u,style:p}=n,f;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?f=document.querySelector(l):f=l,!f)throw new Error("targeting element not found");let m=c;if(m||(m=this.initParams.unitId),!m)throw new Error("slot is required");let v=typeof d=="object"&&Array.isArray(d)?d.join(", "):d,y=document.createElement("ins");if(y.className="adsbygoogle",y.id="jolibox-ads",y.style.display="block",y.setAttribute("data-ad-client",this.initParams.clientId),y.setAttribute("data-ad-slot",m),v&&y.setAttribute("data-ad-format",v),u&&y.setAttribute("data-full-width-responsive",u),p&&y.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let g=document.createElement("div");g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.width="100%",g.style.height="100%",g.style.display="flex",g.style.justifyContent="center",g.style.alignItems="center",g.style.backgroundColor="rgba(0, 0, 0, 0.5)",g.style.color="white",g.innerHTML="Test Ad",y.style.position="relative",f.appendChild(y),y.appendChild(g)}else f.appendChild(y),new MutationObserver(g=>{g.forEach(_=>{if(_.type==="attributes"&&_.attributeName==="data-ad-status"){let w=y.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:w!=null?w:"null"})}})}).observe(y,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,window.adsbygoogle=window.adsbygoogle||[]}init(){return I(this,null,function*(){var t;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let r="google-adsense",n=(t=this.contextInfo.testAdsMode)!=null?t:!1;if(!document.getElementById(r)&&this.initParams.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&i.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&this.initParams.admobRewardedSlot&&(i.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),i.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&i.setAttribute("data-admob-ads-only","on")),document.head.appendChild(i),this.context.track("LoadAdsenseCompleted",null)}})}};p3=function(){function e(r){var n=this;this._insertTag=function(i){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,o),n.tags.push(i)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(f3(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=d3(n);try{i.insertRule(r,i.cssRules.length)}catch(o){}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e}(),Me="-ms-",Ps="-moz-",B="-webkit-",BS="comm",yf="rule",_f="decl",h3="@import",JS="@keyframes",m3="@layer",v3=Math.abs,Ds=String.fromCharCode,g3=Object.assign;qs=1,In=1,HS=0,We=0,be=0,En="";N3=function(e,t,r){for(var n=0,i=0;n=i,i=Nt(),n===38&&i===12&&(t[r]=1),!Ki(i);)rt();return Yi(e,We)},D3=function(e,t){var r=-1,n=44;do switch(Ki(n)){case 0:n===38&&Nt()===12&&(t[r]=1),e[r]+=N3(We-1,t,r);break;case 2:e[r]+=Ss(n);break;case 4:if(n===44){e[++r]=Nt()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Ds(n)}while(n=rt());return e},q3=function(e,t){return VS(D3(zS(e),t))},_S=new WeakMap,L3=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!_S.get(r))&&!n){_S.set(e,!0);for(var i=[],o=q3(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},F3=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};M3=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case _f:e.return=GS(e.value,e.length);break;case JS:return wn([Hi(e,{value:J(e.value,"@","@"+B)})],n);case yf:if(e.length)return b3(e.props,function(i){switch(_3(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return wn([Hi(e,{props:[J(i,/:(read-\w+)/,":"+Ps+"$1")]})],n);case"::placeholder":return wn([Hi(e,{props:[J(i,/:(plac\w+)/,":"+B+"input-$1")]}),Hi(e,{props:[J(i,/:(plac\w+)/,":"+Ps+"$1")]}),Hi(e,{props:[J(i,/:(plac\w+)/,Me+"input-$1")]})],n)}return""})}},j3=[M3],U3=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var v=m.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var n=e.stylisPlugins||j3,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(m){for(var v=m.getAttribute("data-emotion").split(" "),y=1;y<v.length;y++)i[v[y]]=!0;a.push(m)});var s,l=[L3,F3];{var c,d=[P3,R3(function(m){c.insert(m)})],u=C3(l.concat(n,d)),p=function(m){return wn(k3(m),u)};s=function(m,v,y,g){c=y,p(m?m+"{"+v.styles+"}":v.styles),g&&(f.inserted[v.name]=!0)}}var f={key:t,sheet:new p3({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:s};return f.sheet.hydrate(a),f};J3={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},$3=/[A-Z]|^ms/g,H3=/_EMO_([^_]+?)_([^]*?)_EMO_/g,WS=function(e){return e.charCodeAt(1)===45},bS=function(e){return e!=null&&typeof e!="boolean"},Kd=O3(function(e){return WS(e)?e:e.replace($3,"-$&").toLowerCase()}),wS=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(H3,function(r,n,i){return hr={name:n,styles:i,next:hr},n})}return J3[e]!==1&&!WS(e)&&typeof t=="number"&&t!==0?t+"px":t};IS=/label:\s*([^\s;{]+)\s*(;|$)/g;V3=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},G3=function(e,t,r){V3(e,t);var n=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var i=t;do e.insert(t===i?"."+n:"",i,e.sheet,!0),i=i.next;while(i!==void 0)}};W3=function(e){var t=U3(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=Yd(s,t.registered,void 0);return G3(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=Yd(s,t.registered),d="animation-"+c.name;return ES(t,{name:c.name,styles:"@keyframes "+d+"{"+c.styles+"}"}),d},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=Yd(s,t.registered);ES(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return xS(t.registered,r,K3(s))};return{css:r,cx:o,injectGlobal:i,keyframes:n,hydrate:function(a){a.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:KS.bind(null,t.registered),merge:xS.bind(null,t.registered,r)}},K3=function e(t){for(var r="",n=0;n<t.length;n++){var i=t[n];if(i!=null){var o=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))o=e(i);else{o="";for(var a in i)i[a]&&a&&(o&&(o+=" "),o+=a)}break}default:o=i}o&&(r&&(r+=" "),r+=o)}}return r},Y3=W3({key:"css"}),xn=Y3.css,AS=0,YS=[],Se=O,kS=Se.__b,TS=Se.__r,PS=Se.diffed,CS=Se.__c,RS=Se.unmount,OS=Se.__;Se.__b=function(e){tt=null,kS&&kS(e)},Se.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),OS&&OS(e,t)},Se.__r=function(e){TS&&TS(e),df=0;var t=(tt=e.__c).__H;t&&(Qd===tt?(t.__h=[],tt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(ks),t.__h.forEach(ff),t.__h=[],df=0)),Qd=tt},Se.diffed=function(e){PS&&PS(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(YS.push(t)!==1&&SS===Se.requestAnimationFrame||((SS=Se.requestAnimationFrame)||Z3)(X3)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Qd=tt=null},Se.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ks),r.__h=r.__h.filter(function(n){return!n.__||ff(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Se.__e(n,r.__v)}}),CS&&CS(e,t)},Se.unmount=function(e){RS&&RS(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ks(n)}catch(i){t=i}}),r.__H=void 0,t&&Se.__e(t,r.__v))};NS=typeof requestAnimationFrame=="function";tJ=Symbol.for("preact-signals");W=void 0,zi=void 0,mr=0,pf=0,Rs=0;Ne.prototype.brand=tJ;Ne.prototype.h=function(){return!0};Ne.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};Ne.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Ne.prototype.subscribe=function(e){var t=this;return Xi(function(){var r=t.value,n=W;W=void 0;try{e(r)}finally{W=n}})};Ne.prototype.valueOf=function(){return this.value};Ne.prototype.toString=function(){return this.value+""};Ne.prototype.toJSON=function(){return this.value};Ne.prototype.peek=function(){var e=W;W=void 0;try{return this.value}finally{W=e}};Object.defineProperty(Ne.prototype,"value",{get:function(){var e=XS(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(pf>100)throw new Error("Cycle detected");this.v=e,this.i++,Rs++,mr++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Fs()}}}});(Sn.prototype=new Ne).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Rs))return!0;if(this.g=Rs,this.f|=1,this.i>0&&!ZS(this))return this.f&=-2,!0;var e=W;try{eA(this),W=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return W=e,tA(this),this.f&=-2,!0};Sn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ne.prototype.S.call(this,e)};Sn.prototype.U=function(e){if(this.t!==void 0&&(Ne.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Sn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Sn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=XS(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});Qi.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};Qi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rA(this),eA(this),mr++;var e=W;return W=this,rJ.bind(this,e)};Qi.prototype.N=function(){2&this.f||(this.f|=2,this.o=zi,zi=this)};Qi.prototype.d=function(){this.f|=8,1&this.f||wf(this)};iA=[];Xi(function(){nA=this.N})();oA.displayName="_st";Object.defineProperties(Ne.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:oA},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});An("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Ne&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});An("__r",function(e,t){Os();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return Xi(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Os(r),e(t)});An("__e",function(e,t,r,n){Os(),e(t,r,n)});An("diffed",function(e,t){Os();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],d=n[l];c===void 0?(c=nJ(r,l,d,i),o[l]=c):c.o(d,i)}}}e(t)});An("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)});An("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Ke.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(n||o||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var a in e)if(a!=="__source"&&e[a]!==this.props[a])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};iJ=function(e){queueMicrotask(function(){queueMicrotask(e)})};je=xn`
487
487
  inset: 0;
488
488
  clear: none;
489
489
  float: none;