@jolibox/implement 1.1.55 → 1.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var r1=Object.create;var xo=Object.defineProperty,n1=Object.defineProperties,i1=Object.getOwnPropertyDescriptor,o1=Object.getOwnPropertyDescriptors,a1=Object.getOwnPropertyNames,Eo=Object.getOwnPropertySymbols,s1=Object.getPrototypeOf,yl=Object.prototype.hasOwnProperty,gp=Object.prototype.propertyIsEnumerable;var vp=(e,t,r)=>t in e?xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))yl.call(t,r)&&vp(e,r,t[r]);if(Eo)for(var r of Eo(t))gp.call(t,r)&&vp(e,r,t[r]);return e},B=(e,t)=>n1(e,o1(t));var je=(e,t)=>{var r={};for(var n in e)yl.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Eo)for(var n of Eo(e))t.indexOf(n)<0&&gp.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yp=(e,t)=>{for(var r in t)xo(e,r,{get:t[r],enumerable:!0})},l1=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a1(t))!yl.call(e,i)&&i!==r&&xo(e,i,{get:()=>t[i],enumerable:!(n=i1(t,i))||n.enumerable});return e};var ie=(e,t,r)=>(r=e!=null?r1(s1(e)):{},l1(t||!e||!e.__esModule?xo(r,"default",{value:e,enumerable:!0}):r,e));var w=(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 h1(e){return!!(e!=null&&e.__nativeBuffers__)}function xl(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!h1(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=m1(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function g1(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:v1(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function w1(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Op(e){return typeof e=="string"}function Wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function bp(e){return typeof e=="number"&&!isNaN(e)}function S1(e){return typeof e=="undefined"}function E1(e){return S1(e)||e===null}function Rp(e){return typeof e=="function"}function x1(e){return Wr(e)&&Rp(e.then)}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 $n(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function R1(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 F1(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function J1(e){return new Promise(t=>Dp(e)(t))}function Dp(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function H1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new zn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function V1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)G1(e[n],t[n])}function G1(e,t){if(Op(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Rp(t)){try{if(e instanceof t)return}catch(r){}if(!E1(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 Dl(e,t){if(Al.config[e]){Oo.warn(`[can i use] ${e} already registered`);return}Al.config[e]=$t({},t)}function Sp(e,t){return`[${e}]:${t}`}function Z1(e,t){Ep||(wl=new Ao({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Il=new Ao({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Sl=new Ao({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{wl.flush(),Il.flush(),Sl.flush()}),Ep=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:f=0,__timing:p={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:m,invokeCallback:g}=p,_=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";wl.report({status:_,method:n(s,l),errNo:`${f}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&m&&g&&(Il.report({status:_,method:s,isForeground:d,duration:Number((m-c).toFixed(3))}),Sl.report({status:_,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function nT(e,t){let r=0,n=!0,i=rT.resolveMap,o=Z1(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,El.forEach(l=>Co(this,[l],function*({method:c,args:d,resolve:u}){let f=yield s(c,d);u(f)})),El.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=xl(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let f=Date.now(),p=`${n}`;r+=1;let m=new I1;if(i.set(r,m.resolve),!n&&K1.includes(l))return new Promise(A=>{El.push({method:l,args:c,resolve:A})});let g=f1($t({},{method:l,startTime:f,args:c,isForeground:p}),{invokeType:"js-bridge"}),_=!eT&&W1.includes(l),v=g1(c,_),b=_?v:JSON.stringify(v),I;if(l.endsWith("Sync")||Q1.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,v,r):typeof b=="string"?I=e.invoke(l,b,r):I=(u=e.call)==null?void 0:u.call(e,l,b,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=xl(I)}catch(A){Oo.error(A)}return i.delete(r),I.errorCode&&(I.errorCode=Sp(l,I.errorCode)),o($t($t({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),m.promise.then(A=>(A.errorCode&&(A.errorCode=Sp(l,A.errorCode)),o($t($t({},g),A)),A))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return x1(d)?d.then(u=>xp(l,u)):xp(l,d)},invokeHandler:a}}function xp(e,t){if(!Wr(t)){Oo.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=p1(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new C1(n,i,o,a);return s}function iT(e){if(globalThis[ko])return globalThis[ko];let t=new Pl,r=new Pl,n=new Ao({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[ko]={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=xl(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===qp){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(Gn.length),u,a)}catch(f){}});return}if(i.startsWith(Gn)){r.emit(i.slice(Gn.length),l,a);return}t.emit(i,l,a)}},globalThis[ko]}function oT(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Gn}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let f=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(qp,d,f)}catch(f){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Gn}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let f=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(Y1,d,f)}catch(f){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function aT(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=iT(e),{invokeNative:a,invokeHandler:s,applyNative:l}=nT(e,r),{publish:c,emitNative:d}=oT(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function Fp(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var c1,u1,d1,To,Ap,Tp,_p,$t,f1,p1,Co,m1,v1,Cp,y1,_1,Pp,b1,I1,k1,A1,Po,T1,C1,P1,_l,Oo,wp,O1,kl,N1,Al,D1,L1,q1,zr,M1,c$,Tl,se,U1,j1,Vn,zn,Pl,Ol,B1,bl,$1,u$,Rl,Ip,d$,Lp,z1,Gn,W1,K1,Q1,qp,Y1,X1,Ao,Ep,wl,Il,Sl,El,eT,Nl,tT,rT,ko,Ll,ht,Mp,Up,sT,jp,kp,ye,j,Ze,f$,lT,Bp,ql,p$,h$,_e=k(()=>{"use strict";c1=Object.defineProperty,u1=Object.defineProperties,d1=Object.getOwnPropertyDescriptors,To=Object.getOwnPropertySymbols,Ap=Object.prototype.hasOwnProperty,Tp=Object.prototype.propertyIsEnumerable,_p=(e,t,r)=>t in e?c1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$t=(e,t)=>{for(var r in t||(t={}))Ap.call(t,r)&&_p(e,r,t[r]);if(To)for(var r of To(t))Tp.call(t,r)&&_p(e,r,t[r]);return e},f1=(e,t)=>u1(e,d1(t)),p1=(e,t)=>{var r={};for(var n in e)Ap.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&To)for(var n of To(e))t.indexOf(n)<0&&Tp.call(e,n)&&(r[n]=e[n]);return r},Co=(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())});m1=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};v1=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)};Cp=Object.defineProperty,y1=Object.getOwnPropertyDescriptor,_1=(e,t)=>{for(var r in t)Cp(e,r,{get:t[r],enumerable:!0})},Pp=(e,t,r,n)=>{for(var i=n>1?void 0:n?y1(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&&Cp(t,r,i),i},b1=(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}I1=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))}})}};k1=(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))(k1||{}),A1=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}},Po=class extends A1{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},T1=class extends Po{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},C1=class extends Po{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},P1=class extends Po{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},_l=class extends Po{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Oo={log:$n("log"),warn:$n("warn"),info:$n("info"),error:$n("error"),debug:$n("debug")};Object.assign(globalThis,{logger:Oo});wp=Symbol.for("Jolibox.canIUseMap"),O1={};globalThis[wp]||(globalThis[wp]=O1);kl=Symbol.for("Jolibox.canIUseMap.native"),N1={};globalThis[kl]||(globalThis[kl]=N1);Al={get config(){return globalThis[kl]}},D1=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(D1||{}),L1=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(L1||{}),q1=(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))(q1||{});F1();zr=typeof window=="undefined",M1=()=>!zr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),c$={isiOS:!zr&&(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:!zr&&navigator.userAgent.includes("Android"),isMac:!zr&&navigator.userAgent.includes("Mac"),isFacebook:!zr&&navigator.userAgent.includes("FB_IAB"),isPC:!zr&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Tl=class Cl{constructor(t){this.element=t,this.next=Cl.Undefined,this.prev=Cl.Undefined}};Tl.Undefined=new Tl(void 0);se=Tl,U1=class{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let e=this._first;for(;e!==se.Undefined;){let t=e.next;e.prev=se.Undefined,e.next=se.Undefined,e=t}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new se(e);if(this._first===se.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!==se.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==se.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==se.Undefined&&e.next!==se.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===se.Undefined&&e.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):e.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):e.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==se.Undefined;)yield e.element,e=e.next}},j1=0,Vn=class{constructor(e){this.value=e,this.id=j1++}},zn=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 Vn&&(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 Vn(t);return this._listeners?this._listeners instanceof Vn?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,f,p;if(!this._disposed){if(this._listeners instanceof Vn)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&&((p=(f=this.options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f)))}}}}),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 Vn?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Pl=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 zn,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 U1,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)}},Ol={};_1(Ol,{None:()=>B1,filter:()=>H1,once:()=>Dp,toPromise:()=>J1});B1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});bl=Symbol.for("Jolibox.hostEmitter"),$1=()=>{let e=new Pl;return globalThis[bl]||(globalThis[bl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[bl]},u$=$1();Rl=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new zn,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 V1(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}};Rl=Pp([Np],Rl);Ip=class{constructor(){this._onWillExecuteCommand=new zn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new zn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Rl,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=w1(3e4)),this._starActivation}executeCommand(e,...t){return b1(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Ol.toPromise(Ol.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}}};Ip=Pp([Np],Ip);d$=Symbol.for("Jolibox.commands");Dl("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Dl("requestProductDetailsAsync",{version:102e4});Dl("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Lp=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Al.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"";if(l.platforms&&!l.platforms.includes(c))return!1;let d=l.version;if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=R1(i,o);if(!s)return!1;if(Wr(s)){let l=s.version;return bp(l)?typeof a=="number"&&a>=l:!0}return bp(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};z1=()=>M1(),Gn="custom_event_",W1=[],K1=[],Q1=["env","createRequestTask","login"],qp="__batch_event__",Y1="__native_batch_event__",X1=e=>e==="pv"?e:"default",Ao=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=X1(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&&Wr(a))throw new _l(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(Wr(a))l.push(...Object.keys(a));else if(Op(a)){if(i.length>0)throw new _l(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new _l(`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=Wr(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={}}},Ep=!1;El=[],eT=!1,Nl=Symbol.for("Jolibox.invokeResolverInstance"),tT=new Map;globalThis[Nl]||(globalThis[Nl]=tT);rT={get resolveMap(){return globalThis[Nl]}};ko=Symbol.for("Jolibox.subscribeInstance");ht={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){ht.trigger=e},onDoExit(e){ht.exit=e},onDoBackPress(e){ht.backPress=e}},Mp=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new T1("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{ht.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Co(void 0,null,function*(){let o=yield ht.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});Ll={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=Fp(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:Mp,doExit:r};globalThis.joliboxJSCore=$t({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{ht.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Co(void 0,null,function*(){let a=yield ht.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});Ll={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=Fp(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Co(this,null,function*(){let a=yield ht.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:Mp,doExit:n};globalThis.joliboxJSCore=$t({},i)}Up=Ll;if(!Up&&z1())throw new P1("No joliboxJScore is found, native bridge not found.");sT=$t({},Up),jp=aT(sT),{invokeHandler:kp}=jp,{applyNative:ye,invokeNative:j,onNative:Ze,offNative:f$,subscribeHandler:lT,publish:Bp,emitNative:ql,subscribe:p$,unsubscribe:h$}=jp;globalThis.joliboxJSBridge={callHandler:kp,invokeHandler:kp,subscribeHandler:lT}});function mT(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function zp(e){return new Promise(t=>setTimeout(t,e))}function Xn(e){return typeof e=="string"}function Tr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Wp(e){return typeof e=="object"&&Array.isArray(e)}function Kp(e){return typeof e=="number"&&!isNaN(e)}function Kr(e){return e===!0||e===!1}function Qp(e){return typeof e=="undefined"}function $l(e){return Qp(e)||e===null}function vT(e){return typeof e=="function"}function Yp(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Xp(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:$p(l)&&$p(s)?i[a]=n(fT({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function $p(e){return e&&typeof e=="object"&&e.constructor===Object}function Zp(e,t){if(Array.isArray(e))return e.concat(t)}function Zn(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 f=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!f&&c()},t),f)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 yT(e,t){return(...r)=>t(e,...r)}function No(e){return t=>yT(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new lr(`${i}`))}})}function Wn(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function ah(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let l=parseInt(i[s],10)||0,c=parseInt(o[s],10)||0;if(l>c){n=1;break}else if(l<c){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function Ql(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function ET(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com")return`${o}.${a}`}return`${o}.jolibox.com`}function Yl(e){return ET("api","stg-api",e)}function Cr(e){return`https://${Yl(e)}`}function TT(e){return new Promise(t=>uh(e)(t))}function uh(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function CT(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Yn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function OT(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)RT(e[n],t[n])}function RT(e,t){if(Xn(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(vT(t)){try{if(e instanceof t)return}catch(r){}if(!$l(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 NT(){return typeof globalThis!="undefined"?globalThis[dh]:void 0}function DT(e){typeof globalThis!="undefined"&&(globalThis[dh]=e)}function X(e=!1){let t=NT();if(!e&&t)return t;let r=new Ro,n=new Jl,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return DT(i),i}var Hl,cT,Jp,uT,dT,Hp,fT,pT,Gp,hT,Ct,gT,Vl,ei,Gl,eh,lr,th,rh,nh,ih,oh,ti,zl,Pt,Ml,_T,Wl,Vp,bT,J,Kl,wT,Do,Kn,ri,IT,ST,sh,lh,ch,Ul,le,xT,kT,Qn,Yn,Ot,Bl,AT,Fl,PT,ne,Ro,Jl,dh,N=k(()=>{"use strict";Hl=Object.defineProperty,cT=Object.getOwnPropertyDescriptor,Jp=Object.getOwnPropertySymbols,uT=Object.prototype.hasOwnProperty,dT=Object.prototype.propertyIsEnumerable,Hp=(e,t,r)=>t in e?Hl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fT=(e,t)=>{for(var r in t||(t={}))uT.call(t,r)&&Hp(e,r,t[r]);if(Jp)for(var r of Jp(t))dT.call(t,r)&&Hp(e,r,t[r]);return e},pT=(e,t)=>{for(var r in t)Hl(e,r,{get:t[r],enumerable:!0})},Gp=(e,t,r,n)=>{for(var i=n>1?void 0:n?cT(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&&Hl(t,r,i),i},hT=(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}Ct=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))}})}};gT=(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))(gT||{}),Vl=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}},ei=class extends Vl{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Gl=class extends Vl{constructor(){super(...arguments),this.kind="USER_ERROR"}},eh=class extends Gl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},lr=class extends Gl{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))}},th=class extends Gl{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))}},rh=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},nh=class extends ei{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))}},ih=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},oh=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},ti=class extends Vl{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}}},zl=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Pt={log:Wn("log"),warn:Wn("warn"),info:Wn("info"),error:Wn("error"),debug:Wn("debug")};Object.assign(globalThis,{logger:Pt});Ml=Symbol.for("Jolibox.canIUseMap"),_T={};globalThis[Ml]||(globalThis[Ml]=_T);Wl={get config(){return globalThis[Ml]}},Vp=Symbol.for("Jolibox.canIUseMap.native"),bT={};globalThis[Vp]||(globalThis[Vp]=bT);J=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(J||{}),Kl=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Kl||{}),wT=(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))(wT||{}),Do=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Ql();Kn=typeof window=="undefined",ri={isiOS:!Kn&&(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:!Kn&&navigator.userAgent.includes("Android"),isMac:!Kn&&navigator.userAgent.includes("Mac"),isFacebook:!Kn&&navigator.userAgent.includes("FB_IAB"),isPC:!Kn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},IT="device_id",ST="advertising_id",sh=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Do()),window.__joliboxLocalStorage__.getItem(e)),lh=()=>new URLSearchParams(window.location.search).get("deviceId")||sh(IT),ch=()=>new URLSearchParams(window.location.search).get("advertisingId")||sh(ST);Ul=class jl{constructor(t){this.element=t,this.next=jl.Undefined,this.prev=jl.Undefined}};Ul.Undefined=new Ul(void 0);le=Ul,xT=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},kT=0,Qn=class{constructor(e){this.value=e,this.id=kT++}},Yn=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 Qn&&(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 Qn(t);return this._listeners?this._listeners instanceof Qn?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,f,p;if(!this._disposed){if(this._listeners instanceof Qn)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&&((p=(f=this.options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f)))}}}}),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 Qn?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Ot=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 Yn,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 xT,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)}},Bl={};pT(Bl,{None:()=>AT,filter:()=>CT,once:()=>uh,toPromise:()=>TT});AT=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Fl=Symbol.for("Jolibox.hostEmitter"),PT=()=>{let e=new Ot;return globalThis[Fl]||(globalThis[Fl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Fl]},ne=PT();Ro=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Yn,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 OT(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}};Ro=Gp([Yp],Ro);Jl=class{constructor(){this._onWillExecuteCommand=new Yn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Yn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ro,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=mT(3e4)),this._starActivation}executeCommand(e,...t){return hT(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Bl.toPromise(Bl.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}}};Jl=Gp([Yp],Jl);dh=Symbol.for("Jolibox.commands")});function ke(e,t={}){Xl.emit("ERROR_REPORT",{error:e,options:t})}var Xl,Pr,mt=k(()=>{"use strict";N();N();Xl=new Ot,Pr=new Ot;ke.debounce=Zn(ke,50,{leading:!0})});var Zl,LT,fh,ph,hh=k(()=>{"use strict";N();mt();Zl=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{}}},LT=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},fh=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:Zl(o),payloadJson:Zl(a),signature:Zl(s)}}else throw"joli_source is missing"}catch(r){return ke(new rh(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},ph=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=LT(e),o=r[2];return`${n}.${i}.${o}`}return t}});var qT,ec,mh=k(()=>{"use strict";N();qT="1.1.55",ec=()=>qT});function rc(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var FT,vh,tc,gh,de,MT,S,H=k(()=>{"use strict";N();hh();mh();N();FT={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lh(),adId:ch(),pixelRatio:window.devicePixelRatio||1,platform:ri.isAndroid?"android":ri.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ec()},schema:window.location.href,platform:ri.isAndroid?"android":ri.isiOS?"ios":"h5"},tc=(vh=globalThis.joliboxJSCore)==null?void 0:vh.env,de=Object.assign({},(gh=tc==null?void 0:tc())!=null?gh:FT);MT=()=>{var p,m,g,_,v,b,I,A,P,O,x;let{payloadJson:e,headerJson:t,signature:r}=de.schema.length?fh(de.schema):{},n=`${de.deviceInfo.did}-${new Date().getTime()}`,o=new URL(de.schema.length?de.schema:window.location.href).searchParams,a=(g=(m=(p=o.get("mpId"))!=null?p:o.get("appId"))!=null?m:o.get("gameId"))!=null?g:"",s=(b=(v=(_=de.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?v:o.get("sessionId"))!=null?b:n,l=!!((A=(I=e==null?void 0:e.testAdsMode)!=null?I:e==null?void 0:e.__testAdsMode)!=null?A:o.get("testAdsMode")==="true"),c=(x=(O=(P=e==null?void 0:e.joliboxEnv)!=null?P:e==null?void 0:e.__joliboxEnv)!=null?O:o.get("joliboxEnv"))!=null?x:"production",d=c==="staging",u=t==null?void 0:t.channel,f=e==null?void 0:e.__shouldInterupt;return{get startTime(){var C;return(C=performance.timeOrigin)!=null?C:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var C;return(C=o.get("joliSource"))!=null?C:null},get mpId(){var C;return(C=a!=null?a:e==null?void 0:e.id)!=null?C:""},get mpVersion(){var C;return(C=t==null?void 0:t.ver)!=null?C:ec()},get mpType(){var C,U;return(U=(C=t==null?void 0:t.__mpType)!=null?C:e==null?void 0:e.__mpType)!=null?U:"game"},get platform(){var C;return((C=de.platform)!=null?C:de.deviceInfo.platform).toLowerCase()},get deviceInfo(){return de.deviceInfo},get sdkInfo(){return de.sdkInfo},get hostInfo(){return de.hostInfo},get hostUserInfo(){return de.hostUserInfo},get sessionId(){var C,U;return(U=(C=de.clientSessionId)!=null?C:s)!=null?U:n},get channel(){return u},get webviewId(){var C;return(C=de.webviewId)!=null?C:-1},get shouldInterupt(){return f},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Yl(d)},get adId(){var C;return(C=de.deviceInfo.adId)!=null?C:de.deviceInfo.did},get language(){return de.deviceInfo.lang},get sdkEnvironment(){return rc("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":rc("gamedistribution","jolibox")?"gamedistribution":rc("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var q,Re,Ne;let C=(q=de.deviceInfo.pixelRatio)!=null?q:1,U=(Re=de.deviceInfo.statusBarHeight)!=null?Re:e==null?void 0:e.__androidStatusBarHeight,We=(Ne=de.deviceInfo.navigationBarHeight)!=null?Ne:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:U!==void 0?U/C:20,navigationBarHeight:We!==void 0?We/C:10}},get abTests(){var C,U;return(U=(C=de.abValues)==null?void 0:C.split(","))!=null?U:[]},onEnvConfigChanged:C=>{Xp(de,C,Zp)},encodeJoliSourceQuery:C=>{var U,We;return t&&r?ph(T(T({},e),C),(U=o.get("joliSource"))!=null?U:""):(We=o.get("joliSource"))!=null?We:""},setDoExitDirectly:()=>{f=!1}}},S=MT()});var nc,_h,UT,jT,yh,BT,bh=k(()=>{"use strict";N();mt();H();N();nc=!1,_h=(e,t)=>e==null?!1:t in e,UT=e=>_h(e,"kind"),jT=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},yh=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=S.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:jT(e.name)},i=B(T({},n),{env:t.environment,isFromUser:r});r?Pr.emit("GLOBAL_USER_ERROR",e,i):Pr.emit("GLOBAL_ERROR",e,i)},BT=e=>_h(e,"kind")&&e.kind==="USER_ERROR";Xl.on("ERROR_REPORT",({error:e,options:t})=>{if(nc)return;nc=!0;let r=UT(e)&&e.raw?e.raw:e;try{let n=BT(e);yh(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new zl(`${i}, origin error: ${r.message}`);Pt.error(o),yh(new zl(o.message),{environment:t.environment},!1)}finally{nc=!1}})});var cr,ic,Qr=k(()=>{"use strict";mt();N();mt();cr=(e,t)=>{var r,n;return new ti((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},ic=e=>new eh(e)});var wh=k(()=>{"use strict";bh();Qr();N();_e();Pr.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};j("trackAsync",{event:"reportJsError",data:r})});Pr.on("GLOBAL_USER_ERROR",(e,t)=>{Pt.log("UserError",e,t)})});var oc=k(()=>{"use strict"});function Ih(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=je(c,["eventType"]),l=B(T({tag:n,eventType:o!=null?o:a!=null?a:J.Other},t),{extra:T({},s)});n=="globalJsError"?ke(new oh(JSON.stringify(l))):e("systemLog",l,S.webviewId)};return r.debounce=Zn(r,500,{leading:!0}),r}function Sh(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=Zn(t,500,{leading:!0}),t}var Eh=k(()=>{"use strict";N();N();mt();H()});function xh(e,t){let r=Ih(e,t),n=Sh(r);return{track:r,trackPerformance:n}}var kh=k(()=>{"use strict";Eh()});var Ah=k(()=>{"use strict";H();N();N()});var Th=k(()=>{"use strict";kh();oc();Ah()});var Lo,Ch=k(()=>{"use strict";Lo=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 p=Date.now(),m=p-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,this.interval+1e3),t(a)),r=p),n=requestAnimationFrame(s)},l=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let p=Date.now();p-r>=this.interval&&(r=p)},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",p=>{o&&(console.log("visible",p),p?c():l())});let f=this.visible;return{start(){o||(o=!0,f?c():l())},stop(){o=!1,d(),u()}}}}});function qo(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:Cr(S.testMode),o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return Ze("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let f=n.get(u.requestTaskId);if(f)if(u.state==="success"){let p=u,{requestTaskId:g,state:_}=p,v=je(p,["requestTaskId","state"]);u.statusCode===200?f.resolve(v):f.reject(v),n.delete(g)}else if(u.state==="fail"){let m=u,{requestTaskId:g,state:_}=m,v=je(m,["requestTaskId","state"]);f.reject(v),n.delete(g)}else Pt.warn("onRequestTaskStateChange unknown event",u)}),ne.on("onLoginComplete",({isLogin:u,token:f})=>{o!=="public"&&u&&f&&(a["X-JOLI-TOKEN"]=f)}),(p,...m)=>w(this,[p,...m],function*(u,f={}){let g=Date.now(),_=JT(u,B(T({},f),{baseUrl:i})),{method:v="GET",responseType:b="text",dataType:I="json",timeout:A,enableCache:P=!1,appendHostCookie:O=!0}=f,x=Object.assign({"content-type":"application/json"},a,f.header),C={url:_,method:v,header:x,enableCache:P,responseType:b,appendHostCookie:O};if(v=="POST"||v=="PUT"){let Ne=$T(f.data,x["content-type"]);C.data=Ne}A&&Object.assign(C,{timeout:A});let{data:{requestTaskId:U}}=j(e,C);if(typeof U!="string")throw cr({code:-1,msg:"requestTaskId is not a string"});let{resolve:We,reject:q,promise:Re}=new Ct;n.set(U,{resolve:We,reject:q});try{let Ne=yield Re,{data:Ar}=Ne;return I==="json"&&typeof Ar=="string"&&(Ar=HT(Ar)),{url:_,timeout:A,method:v,response:B(T({},Ne),{data:Ar})}}catch(Ne){let Ar=Ne;if(Tr(Ar)){let{errMsg:gl,prefetchDetail:a$,isPrefetch:s$,errNo:t1}=Ar;Xn(gl)&&ke(cr({code:-1,msg:gl},{errNo:t1,errMsg:gl}))}throw Ne}})}function HT(e){try{return JSON.parse(e.trim())}catch(t){return e}}function $T(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 JT,ac=k(()=>{"use strict";N();_e();mt();Qr();H();JT=(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 sc,Ph,te,vt=k(()=>{"use strict";ac();H();N();sc={};(Ph=S.hostUserInfo)!=null&&Ph.token&&(sc["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(sc["x-joli-source"]=S.joliSource);te=qo("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Cr(S.testMode),defaultHeaders:sc})});var Fo,Oh=k(()=>{"use strict";H();Ch();N();vt();_e();Fo=class extends Lo{constructor(t,r,n){super(r,n),this.gameId=S.mpId,this.sessionId=S.sessionId,this.track=t,this.taskUrl=Cr(S.testMode)+"/api/base/app-event"}reporter(t){return w(this,null,function*(){let{event:r,params:n,extraParams:i}=t,o={eventType:r,gameInfo:T({gameId:this.gameId,sessionId:this.sessionId},n)};i&&Object.assign(o,i),yield S.platform==="android"?te("/api/base/app-event",{method:"POST",data:o}):ye("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(o)})})}reportToNative(t){return w(this,null,function*(){let{event:r,params:n}=t;yield ye("userTrackAsync",{event:r,params:T({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var qh={};yp(qh,{nativeTaskEmitter:()=>ni,taskTracker:()=>It,track:()=>M,trackPerformance:()=>Dh});var VT,Rh,Nh,M,Dh,Lh,ni,It,gt=k(()=>{"use strict";wh();N();oc();Th();H();Oh();_e();VT=(e,t,r)=>{var s,l,c,d,u,f;let n=t,i=Tr(n.extra)?n.extra:Xn(n.extra)?JSON.parse(n.extra):{},o=B(T({},i),{mp_id:(s=n.mp_id)!=null?s:"",mp_version:(l=n.mp_version)!=null?l:"",session_id:S.sessionId,user_id:(d=(c=S.hostUserInfo)==null?void 0:c.uid)!=null?d:""}),a=(u=n.eventType)!=null?u:J.Other;j("trackAsync",{event:(f=t.tag)!=null?f:e,data:o,webviewId:r,eventType:a})},{track:M,trackPerformance:Dh}=xh(VT,{type:Kl.AppSDK,platform:"native",jssdk_version:(Nh=(Rh=S.sdkInfo)==null?void 0:Rh.jssdkVersion)!=null?Nh:"1.0.0",mp_id:S.mpId,mp_version:S.mpVersion}),Lh=X();Lh.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Dh(e,t,r)});Lh.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{M(e,t)});ni=new Ot,It=new Fo(M,ni)});function Fh(){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 r1=Object.create;var xo=Object.defineProperty,n1=Object.defineProperties,i1=Object.getOwnPropertyDescriptor,o1=Object.getOwnPropertyDescriptors,a1=Object.getOwnPropertyNames,Eo=Object.getOwnPropertySymbols,s1=Object.getPrototypeOf,yl=Object.prototype.hasOwnProperty,gp=Object.prototype.propertyIsEnumerable;var vp=(e,t,r)=>t in e?xo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))yl.call(t,r)&&vp(e,r,t[r]);if(Eo)for(var r of Eo(t))gp.call(t,r)&&vp(e,r,t[r]);return e},B=(e,t)=>n1(e,o1(t));var je=(e,t)=>{var r={};for(var n in e)yl.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Eo)for(var n of Eo(e))t.indexOf(n)<0&&gp.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yp=(e,t)=>{for(var r in t)xo(e,r,{get:t[r],enumerable:!0})},l1=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a1(t))!yl.call(e,i)&&i!==r&&xo(e,i,{get:()=>t[i],enumerable:!(n=i1(t,i))||n.enumerable});return e};var ie=(e,t,r)=>(r=e!=null?r1(s1(e)):{},l1(t||!e||!e.__esModule?xo(r,"default",{value:e,enumerable:!0}):r,e));var w=(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 h1(e){return!!(e!=null&&e.__nativeBuffers__)}function xl(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!h1(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=m1(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function g1(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:v1(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function w1(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Op(e){return typeof e=="string"}function Wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function bp(e){return typeof e=="number"&&!isNaN(e)}function S1(e){return typeof e=="undefined"}function E1(e){return S1(e)||e===null}function Rp(e){return typeof e=="function"}function x1(e){return Wr(e)&&Rp(e.then)}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 $n(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function R1(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 F1(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function J1(e){return new Promise(t=>Dp(e)(t))}function Dp(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function H1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new zn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function V1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)G1(e[n],t[n])}function G1(e,t){if(Op(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Rp(t)){try{if(e instanceof t)return}catch(r){}if(!E1(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 Dl(e,t){if(Al.config[e]){Oo.warn(`[can i use] ${e} already registered`);return}Al.config[e]=$t({},t)}function Sp(e,t){return`[${e}]:${t}`}function Z1(e,t){Ep||(wl=new Ao({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Il=new Ao({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Sl=new Ao({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{wl.flush(),Il.flush(),Sl.flush()}),Ep=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:f=0,__timing:p={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:m,invokeCallback:g}=p,_=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";wl.report({status:_,method:n(s,l),errNo:`${f}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&m&&g&&(Il.report({status:_,method:s,isForeground:d,duration:Number((m-c).toFixed(3))}),Sl.report({status:_,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function nT(e,t){let r=0,n=!0,i=rT.resolveMap,o=Z1(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,El.forEach(l=>Co(this,[l],function*({method:c,args:d,resolve:u}){let f=yield s(c,d);u(f)})),El.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=xl(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let f=Date.now(),p=`${n}`;r+=1;let m=new I1;if(i.set(r,m.resolve),!n&&K1.includes(l))return new Promise(A=>{El.push({method:l,args:c,resolve:A})});let g=f1($t({},{method:l,startTime:f,args:c,isForeground:p}),{invokeType:"js-bridge"}),_=!eT&&W1.includes(l),v=g1(c,_),b=_?v:JSON.stringify(v),I;if(l.endsWith("Sync")||Q1.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,v,r):typeof b=="string"?I=e.invoke(l,b,r):I=(u=e.call)==null?void 0:u.call(e,l,b,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=xl(I)}catch(A){Oo.error(A)}return i.delete(r),I.errorCode&&(I.errorCode=Sp(l,I.errorCode)),o($t($t({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),m.promise.then(A=>(A.errorCode&&(A.errorCode=Sp(l,A.errorCode)),o($t($t({},g),A)),A))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return x1(d)?d.then(u=>xp(l,u)):xp(l,d)},invokeHandler:a}}function xp(e,t){if(!Wr(t)){Oo.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=p1(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new C1(n,i,o,a);return s}function iT(e){if(globalThis[ko])return globalThis[ko];let t=new Pl,r=new Pl,n=new Ao({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[ko]={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=xl(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===qp){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(Gn.length),u,a)}catch(f){}});return}if(i.startsWith(Gn)){r.emit(i.slice(Gn.length),l,a);return}t.emit(i,l,a)}},globalThis[ko]}function oT(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Gn}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let f=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(qp,d,f)}catch(f){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Gn}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let f=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(Y1,d,f)}catch(f){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function aT(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=iT(e),{invokeNative:a,invokeHandler:s,applyNative:l}=nT(e,r),{publish:c,emitNative:d}=oT(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function Fp(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var c1,u1,d1,To,Ap,Tp,_p,$t,f1,p1,Co,m1,v1,Cp,y1,_1,Pp,b1,I1,k1,A1,Po,T1,C1,P1,_l,Oo,wp,O1,kl,N1,Al,D1,L1,q1,zr,M1,c$,Tl,se,U1,j1,Vn,zn,Pl,Ol,B1,bl,$1,u$,Rl,Ip,d$,Lp,z1,Gn,W1,K1,Q1,qp,Y1,X1,Ao,Ep,wl,Il,Sl,El,eT,Nl,tT,rT,ko,Ll,ht,Mp,Up,sT,jp,kp,ye,j,Ze,f$,lT,Bp,ql,p$,h$,_e=k(()=>{"use strict";c1=Object.defineProperty,u1=Object.defineProperties,d1=Object.getOwnPropertyDescriptors,To=Object.getOwnPropertySymbols,Ap=Object.prototype.hasOwnProperty,Tp=Object.prototype.propertyIsEnumerable,_p=(e,t,r)=>t in e?c1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$t=(e,t)=>{for(var r in t||(t={}))Ap.call(t,r)&&_p(e,r,t[r]);if(To)for(var r of To(t))Tp.call(t,r)&&_p(e,r,t[r]);return e},f1=(e,t)=>u1(e,d1(t)),p1=(e,t)=>{var r={};for(var n in e)Ap.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&To)for(var n of To(e))t.indexOf(n)<0&&Tp.call(e,n)&&(r[n]=e[n]);return r},Co=(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())});m1=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};v1=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)};Cp=Object.defineProperty,y1=Object.getOwnPropertyDescriptor,_1=(e,t)=>{for(var r in t)Cp(e,r,{get:t[r],enumerable:!0})},Pp=(e,t,r,n)=>{for(var i=n>1?void 0:n?y1(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&&Cp(t,r,i),i},b1=(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}I1=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))}})}};k1=(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))(k1||{}),A1=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}},Po=class extends A1{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},T1=class extends Po{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},C1=class extends Po{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},P1=class extends Po{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},_l=class extends Po{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Oo={log:$n("log"),warn:$n("warn"),info:$n("info"),error:$n("error"),debug:$n("debug")};Object.assign(globalThis,{logger:Oo});wp=Symbol.for("Jolibox.canIUseMap"),O1={};globalThis[wp]||(globalThis[wp]=O1);kl=Symbol.for("Jolibox.canIUseMap.native"),N1={};globalThis[kl]||(globalThis[kl]=N1);Al={get config(){return globalThis[kl]}},D1=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(D1||{}),L1=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(L1||{}),q1=(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))(q1||{});F1();zr=typeof window=="undefined",M1=()=>!zr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),c$={isiOS:!zr&&(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:!zr&&navigator.userAgent.includes("Android"),isMac:!zr&&navigator.userAgent.includes("Mac"),isFacebook:!zr&&navigator.userAgent.includes("FB_IAB"),isPC:!zr&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Tl=class Cl{constructor(t){this.element=t,this.next=Cl.Undefined,this.prev=Cl.Undefined}};Tl.Undefined=new Tl(void 0);se=Tl,U1=class{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let e=this._first;for(;e!==se.Undefined;){let t=e.next;e.prev=se.Undefined,e.next=se.Undefined,e=t}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new se(e);if(this._first===se.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!==se.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==se.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==se.Undefined&&e.next!==se.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===se.Undefined&&e.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):e.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):e.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==se.Undefined;)yield e.element,e=e.next}},j1=0,Vn=class{constructor(e){this.value=e,this.id=j1++}},zn=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 Vn&&(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 Vn(t);return this._listeners?this._listeners instanceof Vn?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,f,p;if(!this._disposed){if(this._listeners instanceof Vn)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&&((p=(f=this.options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f)))}}}}),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 Vn?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Pl=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 zn,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 U1,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)}},Ol={};_1(Ol,{None:()=>B1,filter:()=>H1,once:()=>Dp,toPromise:()=>J1});B1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});bl=Symbol.for("Jolibox.hostEmitter"),$1=()=>{let e=new Pl;return globalThis[bl]||(globalThis[bl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[bl]},u$=$1();Rl=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new zn,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 V1(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}};Rl=Pp([Np],Rl);Ip=class{constructor(){this._onWillExecuteCommand=new zn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new zn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Rl,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=w1(3e4)),this._starActivation}executeCommand(e,...t){return b1(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Ol.toPromise(Ol.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}}};Ip=Pp([Np],Ip);d$=Symbol.for("Jolibox.commands");Dl("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Dl("requestProductDetailsAsync",{version:102e4});Dl("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Lp=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Al.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"";if(l.platforms&&!l.platforms.includes(c))return!1;let d=l.version;if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=R1(i,o);if(!s)return!1;if(Wr(s)){let l=s.version;return bp(l)?typeof a=="number"&&a>=l:!0}return bp(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};z1=()=>M1(),Gn="custom_event_",W1=[],K1=[],Q1=["env","createRequestTask","login"],qp="__batch_event__",Y1="__native_batch_event__",X1=e=>e==="pv"?e:"default",Ao=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=X1(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&&Wr(a))throw new _l(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(Wr(a))l.push(...Object.keys(a));else if(Op(a)){if(i.length>0)throw new _l(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new _l(`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=Wr(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={}}},Ep=!1;El=[],eT=!1,Nl=Symbol.for("Jolibox.invokeResolverInstance"),tT=new Map;globalThis[Nl]||(globalThis[Nl]=tT);rT={get resolveMap(){return globalThis[Nl]}};ko=Symbol.for("Jolibox.subscribeInstance");ht={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){ht.trigger=e},onDoExit(e){ht.exit=e},onDoBackPress(e){ht.backPress=e}},Mp=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new T1("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{ht.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Co(void 0,null,function*(){let o=yield ht.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});Ll={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=Fp(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:Mp,doExit:r};globalThis.joliboxJSCore=$t({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{ht.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Co(void 0,null,function*(){let a=yield ht.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});Ll={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=Fp(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Co(this,null,function*(){let a=yield ht.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:Mp,doExit:n};globalThis.joliboxJSCore=$t({},i)}Up=Ll;if(!Up&&z1())throw new P1("No joliboxJScore is found, native bridge not found.");sT=$t({},Up),jp=aT(sT),{invokeHandler:kp}=jp,{applyNative:ye,invokeNative:j,onNative:Ze,offNative:f$,subscribeHandler:lT,publish:Bp,emitNative:ql,subscribe:p$,unsubscribe:h$}=jp;globalThis.joliboxJSBridge={callHandler:kp,invokeHandler:kp,subscribeHandler:lT}});function mT(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function zp(e){return new Promise(t=>setTimeout(t,e))}function Xn(e){return typeof e=="string"}function Tr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Wp(e){return typeof e=="object"&&Array.isArray(e)}function Kp(e){return typeof e=="number"&&!isNaN(e)}function Kr(e){return e===!0||e===!1}function Qp(e){return typeof e=="undefined"}function $l(e){return Qp(e)||e===null}function vT(e){return typeof e=="function"}function Yp(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Xp(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:$p(l)&&$p(s)?i[a]=n(fT({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function $p(e){return e&&typeof e=="object"&&e.constructor===Object}function Zp(e,t){if(Array.isArray(e))return e.concat(t)}function Zn(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 f=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!f&&c()},t),f)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 yT(e,t){return(...r)=>t(e,...r)}function No(e){return t=>yT(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new lr(`${i}`))}})}function Wn(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function ah(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let l=parseInt(i[s],10)||0,c=parseInt(o[s],10)||0;if(l>c){n=1;break}else if(l<c){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function Ql(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function ET(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com")return`${o}.${a}`}return`${o}.jolibox.com`}function Yl(e){return ET("api","stg-api",e)}function Cr(e){return`https://${Yl(e)}`}function TT(e){return new Promise(t=>uh(e)(t))}function uh(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function CT(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Yn(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function OT(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)RT(e[n],t[n])}function RT(e,t){if(Xn(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(vT(t)){try{if(e instanceof t)return}catch(r){}if(!$l(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 NT(){return typeof globalThis!="undefined"?globalThis[dh]:void 0}function DT(e){typeof globalThis!="undefined"&&(globalThis[dh]=e)}function X(e=!1){let t=NT();if(!e&&t)return t;let r=new Ro,n=new Jl,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return DT(i),i}var Hl,cT,Jp,uT,dT,Hp,fT,pT,Gp,hT,Ct,gT,Vl,ei,Gl,eh,lr,th,rh,nh,ih,oh,ti,zl,Pt,Ml,_T,Wl,Vp,bT,J,Kl,wT,Do,Kn,ri,IT,ST,sh,lh,ch,Ul,le,xT,kT,Qn,Yn,Ot,Bl,AT,Fl,PT,ne,Ro,Jl,dh,N=k(()=>{"use strict";Hl=Object.defineProperty,cT=Object.getOwnPropertyDescriptor,Jp=Object.getOwnPropertySymbols,uT=Object.prototype.hasOwnProperty,dT=Object.prototype.propertyIsEnumerable,Hp=(e,t,r)=>t in e?Hl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fT=(e,t)=>{for(var r in t||(t={}))uT.call(t,r)&&Hp(e,r,t[r]);if(Jp)for(var r of Jp(t))dT.call(t,r)&&Hp(e,r,t[r]);return e},pT=(e,t)=>{for(var r in t)Hl(e,r,{get:t[r],enumerable:!0})},Gp=(e,t,r,n)=>{for(var i=n>1?void 0:n?cT(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&&Hl(t,r,i),i},hT=(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}Ct=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))}})}};gT=(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))(gT||{}),Vl=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}},ei=class extends Vl{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Gl=class extends Vl{constructor(){super(...arguments),this.kind="USER_ERROR"}},eh=class extends Gl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},lr=class extends Gl{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))}},th=class extends Gl{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))}},rh=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},nh=class extends ei{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))}},ih=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},oh=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},ti=class extends Vl{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}}},zl=class extends ei{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Pt={log:Wn("log"),warn:Wn("warn"),info:Wn("info"),error:Wn("error"),debug:Wn("debug")};Object.assign(globalThis,{logger:Pt});Ml=Symbol.for("Jolibox.canIUseMap"),_T={};globalThis[Ml]||(globalThis[Ml]=_T);Wl={get config(){return globalThis[Ml]}},Vp=Symbol.for("Jolibox.canIUseMap.native"),bT={};globalThis[Vp]||(globalThis[Vp]=bT);J=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(J||{}),Kl=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Kl||{}),wT=(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))(wT||{}),Do=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Ql();Kn=typeof window=="undefined",ri={isiOS:!Kn&&(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:!Kn&&navigator.userAgent.includes("Android"),isMac:!Kn&&navigator.userAgent.includes("Mac"),isFacebook:!Kn&&navigator.userAgent.includes("FB_IAB"),isPC:!Kn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},IT="device_id",ST="advertising_id",sh=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Do()),window.__joliboxLocalStorage__.getItem(e)),lh=()=>new URLSearchParams(window.location.search).get("deviceId")||sh(IT),ch=()=>new URLSearchParams(window.location.search).get("advertisingId")||sh(ST);Ul=class jl{constructor(t){this.element=t,this.next=jl.Undefined,this.prev=jl.Undefined}};Ul.Undefined=new Ul(void 0);le=Ul,xT=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},kT=0,Qn=class{constructor(e){this.value=e,this.id=kT++}},Yn=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 Qn&&(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 Qn(t);return this._listeners?this._listeners instanceof Qn?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,f,p;if(!this._disposed){if(this._listeners instanceof Qn)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&&((p=(f=this.options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f)))}}}}),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 Qn?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Ot=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 Yn,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 xT,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)}},Bl={};pT(Bl,{None:()=>AT,filter:()=>CT,once:()=>uh,toPromise:()=>TT});AT=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Fl=Symbol.for("Jolibox.hostEmitter"),PT=()=>{let e=new Ot;return globalThis[Fl]||(globalThis[Fl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Fl]},ne=PT();Ro=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Yn,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 OT(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}};Ro=Gp([Yp],Ro);Jl=class{constructor(){this._onWillExecuteCommand=new Yn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Yn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ro,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=mT(3e4)),this._starActivation}executeCommand(e,...t){return hT(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Bl.toPromise(Bl.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}}};Jl=Gp([Yp],Jl);dh=Symbol.for("Jolibox.commands")});function ke(e,t={}){Xl.emit("ERROR_REPORT",{error:e,options:t})}var Xl,Pr,mt=k(()=>{"use strict";N();N();Xl=new Ot,Pr=new Ot;ke.debounce=Zn(ke,50,{leading:!0})});var Zl,LT,fh,ph,hh=k(()=>{"use strict";N();mt();Zl=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{}}},LT=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},fh=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:Zl(o),payloadJson:Zl(a),signature:Zl(s)}}else throw"joli_source is missing"}catch(r){return ke(new rh(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},ph=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=LT(e),o=r[2];return`${n}.${i}.${o}`}return t}});var qT,ec,mh=k(()=>{"use strict";N();qT="1.1.56",ec=()=>qT});function rc(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var FT,vh,tc,gh,de,MT,S,H=k(()=>{"use strict";N();hh();mh();N();FT={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lh(),adId:ch(),pixelRatio:window.devicePixelRatio||1,platform:ri.isAndroid?"android":ri.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ec()},schema:window.location.href,platform:ri.isAndroid?"android":ri.isiOS?"ios":"h5"},tc=(vh=globalThis.joliboxJSCore)==null?void 0:vh.env,de=Object.assign({},(gh=tc==null?void 0:tc())!=null?gh:FT);MT=()=>{var p,m,g,_,v,b,I,A,P,O,x;let{payloadJson:e,headerJson:t,signature:r}=de.schema.length?fh(de.schema):{},n=`${de.deviceInfo.did}-${new Date().getTime()}`,o=new URL(de.schema.length?de.schema:window.location.href).searchParams,a=(g=(m=(p=o.get("mpId"))!=null?p:o.get("appId"))!=null?m:o.get("gameId"))!=null?g:"",s=(b=(v=(_=de.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?v:o.get("sessionId"))!=null?b:n,l=!!((A=(I=e==null?void 0:e.testAdsMode)!=null?I:e==null?void 0:e.__testAdsMode)!=null?A:o.get("testAdsMode")==="true"),c=(x=(O=(P=e==null?void 0:e.joliboxEnv)!=null?P:e==null?void 0:e.__joliboxEnv)!=null?O:o.get("joliboxEnv"))!=null?x:"production",d=c==="staging",u=t==null?void 0:t.channel,f=e==null?void 0:e.__shouldInterupt;return{get startTime(){var C;return(C=performance.timeOrigin)!=null?C:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var C;return(C=o.get("joliSource"))!=null?C:null},get mpId(){var C;return(C=a!=null?a:e==null?void 0:e.id)!=null?C:""},get mpVersion(){var C;return(C=t==null?void 0:t.ver)!=null?C:ec()},get mpType(){var C,U;return(U=(C=t==null?void 0:t.__mpType)!=null?C:e==null?void 0:e.__mpType)!=null?U:"game"},get platform(){var C;return((C=de.platform)!=null?C:de.deviceInfo.platform).toLowerCase()},get deviceInfo(){return de.deviceInfo},get sdkInfo(){return de.sdkInfo},get hostInfo(){return de.hostInfo},get hostUserInfo(){return de.hostUserInfo},get sessionId(){var C,U;return(U=(C=de.clientSessionId)!=null?C:s)!=null?U:n},get channel(){return u},get webviewId(){var C;return(C=de.webviewId)!=null?C:-1},get shouldInterupt(){return f},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Yl(d)},get adId(){var C;return(C=de.deviceInfo.adId)!=null?C:de.deviceInfo.did},get language(){return de.deviceInfo.lang},get sdkEnvironment(){return rc("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":rc("gamedistribution","jolibox")?"gamedistribution":rc("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var q,Re,Ne;let C=(q=de.deviceInfo.pixelRatio)!=null?q:1,U=(Re=de.deviceInfo.statusBarHeight)!=null?Re:e==null?void 0:e.__androidStatusBarHeight,We=(Ne=de.deviceInfo.navigationBarHeight)!=null?Ne:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:U!==void 0?U/C:20,navigationBarHeight:We!==void 0?We/C:10}},get abTests(){var C,U;return(U=(C=de.abValues)==null?void 0:C.split(","))!=null?U:[]},onEnvConfigChanged:C=>{Xp(de,C,Zp)},encodeJoliSourceQuery:C=>{var U,We;return t&&r?ph(T(T({},e),C),(U=o.get("joliSource"))!=null?U:""):(We=o.get("joliSource"))!=null?We:""},setDoExitDirectly:()=>{f=!1}}},S=MT()});var nc,_h,UT,jT,yh,BT,bh=k(()=>{"use strict";N();mt();H();N();nc=!1,_h=(e,t)=>e==null?!1:t in e,UT=e=>_h(e,"kind"),jT=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},yh=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=S.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:jT(e.name)},i=B(T({},n),{env:t.environment,isFromUser:r});r?Pr.emit("GLOBAL_USER_ERROR",e,i):Pr.emit("GLOBAL_ERROR",e,i)},BT=e=>_h(e,"kind")&&e.kind==="USER_ERROR";Xl.on("ERROR_REPORT",({error:e,options:t})=>{if(nc)return;nc=!0;let r=UT(e)&&e.raw?e.raw:e;try{let n=BT(e);yh(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new zl(`${i}, origin error: ${r.message}`);Pt.error(o),yh(new zl(o.message),{environment:t.environment},!1)}finally{nc=!1}})});var cr,ic,Qr=k(()=>{"use strict";mt();N();mt();cr=(e,t)=>{var r,n;return new ti((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},ic=e=>new eh(e)});var wh=k(()=>{"use strict";bh();Qr();N();_e();Pr.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};j("trackAsync",{event:"reportJsError",data:r})});Pr.on("GLOBAL_USER_ERROR",(e,t)=>{Pt.log("UserError",e,t)})});var oc=k(()=>{"use strict"});function Ih(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=je(c,["eventType"]),l=B(T({tag:n,eventType:o!=null?o:a!=null?a:J.Other},t),{extra:T({},s)});n=="globalJsError"?ke(new oh(JSON.stringify(l))):e("systemLog",l,S.webviewId)};return r.debounce=Zn(r,500,{leading:!0}),r}function Sh(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=Zn(t,500,{leading:!0}),t}var Eh=k(()=>{"use strict";N();N();mt();H()});function xh(e,t){let r=Ih(e,t),n=Sh(r);return{track:r,trackPerformance:n}}var kh=k(()=>{"use strict";Eh()});var Ah=k(()=>{"use strict";H();N();N()});var Th=k(()=>{"use strict";kh();oc();Ah()});var Lo,Ch=k(()=>{"use strict";Lo=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 p=Date.now(),m=p-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,this.interval+1e3),t(a)),r=p),n=requestAnimationFrame(s)},l=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let p=Date.now();p-r>=this.interval&&(r=p)},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",p=>{o&&(console.log("visible",p),p?c():l())});let f=this.visible;return{start(){o||(o=!0,f?c():l())},stop(){o=!1,d(),u()}}}}});function qo(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:Cr(S.testMode),o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return Ze("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let f=n.get(u.requestTaskId);if(f)if(u.state==="success"){let p=u,{requestTaskId:g,state:_}=p,v=je(p,["requestTaskId","state"]);u.statusCode===200?f.resolve(v):f.reject(v),n.delete(g)}else if(u.state==="fail"){let m=u,{requestTaskId:g,state:_}=m,v=je(m,["requestTaskId","state"]);f.reject(v),n.delete(g)}else Pt.warn("onRequestTaskStateChange unknown event",u)}),ne.on("onLoginComplete",({isLogin:u,token:f})=>{o!=="public"&&u&&f&&(a["X-JOLI-TOKEN"]=f)}),(p,...m)=>w(this,[p,...m],function*(u,f={}){let g=Date.now(),_=JT(u,B(T({},f),{baseUrl:i})),{method:v="GET",responseType:b="text",dataType:I="json",timeout:A,enableCache:P=!1,appendHostCookie:O=!0}=f,x=Object.assign({"content-type":"application/json"},a,f.header),C={url:_,method:v,header:x,enableCache:P,responseType:b,appendHostCookie:O};if(v=="POST"||v=="PUT"){let Ne=$T(f.data,x["content-type"]);C.data=Ne}A&&Object.assign(C,{timeout:A});let{data:{requestTaskId:U}}=j(e,C);if(typeof U!="string")throw cr({code:-1,msg:"requestTaskId is not a string"});let{resolve:We,reject:q,promise:Re}=new Ct;n.set(U,{resolve:We,reject:q});try{let Ne=yield Re,{data:Ar}=Ne;return I==="json"&&typeof Ar=="string"&&(Ar=HT(Ar)),{url:_,timeout:A,method:v,response:B(T({},Ne),{data:Ar})}}catch(Ne){let Ar=Ne;if(Tr(Ar)){let{errMsg:gl,prefetchDetail:a$,isPrefetch:s$,errNo:t1}=Ar;Xn(gl)&&ke(cr({code:-1,msg:gl},{errNo:t1,errMsg:gl}))}throw Ne}})}function HT(e){try{return JSON.parse(e.trim())}catch(t){return e}}function $T(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 JT,ac=k(()=>{"use strict";N();_e();mt();Qr();H();JT=(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 sc,Ph,te,vt=k(()=>{"use strict";ac();H();N();sc={};(Ph=S.hostUserInfo)!=null&&Ph.token&&(sc["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(sc["x-joli-source"]=S.joliSource);te=qo("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Cr(S.testMode),defaultHeaders:sc})});var Fo,Oh=k(()=>{"use strict";H();Ch();N();vt();_e();Fo=class extends Lo{constructor(t,r,n){super(r,n),this.gameId=S.mpId,this.sessionId=S.sessionId,this.track=t,this.taskUrl=Cr(S.testMode)+"/api/base/app-event"}reporter(t){return w(this,null,function*(){let{event:r,params:n,extraParams:i}=t,o={eventType:r,gameInfo:T({gameId:this.gameId,sessionId:this.sessionId},n)};i&&Object.assign(o,i),yield S.platform==="android"?te("/api/base/app-event",{method:"POST",data:o}):ye("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(o)})})}reportToNative(t){return w(this,null,function*(){let{event:r,params:n}=t;yield ye("userTrackAsync",{event:r,params:T({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var qh={};yp(qh,{nativeTaskEmitter:()=>ni,taskTracker:()=>It,track:()=>M,trackPerformance:()=>Dh});var VT,Rh,Nh,M,Dh,Lh,ni,It,gt=k(()=>{"use strict";wh();N();oc();Th();H();Oh();_e();VT=(e,t,r)=>{var s,l,c,d,u,f;let n=t,i=Tr(n.extra)?n.extra:Xn(n.extra)?JSON.parse(n.extra):{},o=B(T({},i),{mp_id:(s=n.mp_id)!=null?s:"",mp_version:(l=n.mp_version)!=null?l:"",session_id:S.sessionId,user_id:(d=(c=S.hostUserInfo)==null?void 0:c.uid)!=null?d:""}),a=(u=n.eventType)!=null?u:J.Other;j("trackAsync",{event:(f=t.tag)!=null?f:e,data:o,webviewId:r,eventType:a})},{track:M,trackPerformance:Dh}=xh(VT,{type:Kl.AppSDK,platform:"native",jssdk_version:(Nh=(Rh=S.sdkInfo)==null?void 0:Rh.jssdkVersion)!=null?Nh:"1.0.0",mp_id:S.mpId,mp_version:S.mpVersion}),Lh=X();Lh.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Dh(e,t,r)});Lh.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{M(e,t)});ni=new Ot,It=new Fo(M,ni)});function Fh(){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;
|
package/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.1.
|
|
3
|
+
> @jolibox/implement@1.1.56 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.
|
|
7
|
+
> @jolibox/implement@1.1.56 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.56",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.1.
|
|
10
|
-
"@jolibox/types": "1.1.
|
|
11
|
-
"@jolibox/native-bridge": "1.1.
|
|
12
|
-
"@jolibox/ads": "1.1.
|
|
9
|
+
"@jolibox/common": "1.1.56",
|
|
10
|
+
"@jolibox/types": "1.1.56",
|
|
11
|
+
"@jolibox/native-bridge": "1.1.56",
|
|
12
|
+
"@jolibox/ads": "1.1.56",
|
|
13
13
|
"localforage": "1.10.0",
|
|
14
14
|
"@jolibox/ui": "1.0.0",
|
|
15
15
|
"web-vitals": "4.2.4"
|