@jolibox/implement 1.1.13-beta.4 → 1.1.13-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
|
|
5
5
|
"packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
|
|
6
6
|
"packages/implement/esbuild.config.js": "86f1fd21722a2cb05216751578dcca66326e664a",
|
|
7
|
-
"packages/implement/package.json": "
|
|
7
|
+
"packages/implement/package.json": "f4e3d13fb674bf547f1d1072e01f89172d5e7765",
|
|
8
8
|
"packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
|
|
9
9
|
"packages/implement/src/common/ads/anti-cheating.test.ts": "e2ff3dc6760cfd28d0f8c15703d7fb20d43df583",
|
|
10
10
|
"packages/implement/src/common/ads/anti-cheating.ts": "166d11798eb7f2263ea1d0abd6e5f58c28a3aca6",
|
|
11
11
|
"packages/implement/src/common/ads/channel-policy.ts": "c6d036be5cedf0c5d545fac271c6c8447ca55d8a",
|
|
12
|
-
"packages/implement/src/common/ads/index.ts": "
|
|
12
|
+
"packages/implement/src/common/ads/index.ts": "e5d6d4b5754b6735f54b6cad377320ac980efb29",
|
|
13
13
|
"packages/implement/src/common/api-factory/index.ts": "a2b60f027384e37492ddde550dd46f3fb3e14cfe",
|
|
14
14
|
"packages/implement/src/common/api-factory/validator/__tests__/validate/any.test.ts": "6e225e09fce401b374221ad2e4fe33bc91df4152",
|
|
15
15
|
"packages/implement/src/common/api-factory/validator/__tests__/validate/array.test.ts": "8a9cc32be03e952f1176a970fea033d597c176cb",
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var Ii=Object.create;var qt=Object.defineProperty,Ti=Object.defineProperties,Si=Object.getOwnPropertyDescriptor,Ri=Object.getOwnPropertyDescriptors,Ai=Object.getOwnPropertyNames,ze=Object.getOwnPropertySymbols,ki=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable;var an=(e,t,r)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t)=>{for(var r in t||(t={}))zt.call(t,r)&&an(e,r,t[r]);if(ze)for(var r of ze(t))sn.call(t,r)&&an(e,r,t[r]);return e},Y=(e,t)=>Ti(e,Ri(t));var Ue=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var cn=(e,t)=>{var r={};for(var n in e)zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ze)for(var n of ze(e))t.indexOf(n)<0&&sn.call(e,n)&&(r[n]=e[n]);return r};var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var un=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var xi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ai(t))!zt.call(e,a)&&a!==r&&qt(e,a,{get:()=>t[a],enumerable:!(n=Si(t,a))||n.enumerable});return e};var ln=(e,t,r)=>(r=e!=null?Ii(ki(e)):{},xi(t||!e||!e.__esModule?qt(r,"default",{value:e,enumerable:!0}):r,e));var F=(e,t,r)=>new Promise((n,a)=>{var u=p=>{try{m(r.next(p))}catch(E){a(E)}},f=p=>{try{m(r.throw(p))}catch(E){a(E)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(u,f);m((r=r.apply(e,t)).next())});function Bi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function or(e){return typeof e=="string"}function gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function vn(e){return typeof e=="object"&&Array.isArray(e)}function Mi(e){return typeof e=="undefined"}function ji(e){return Mi(e)||e===null}function $i(e){return typeof e=="function"}function yn(e){let t=e,r=null,n=function(...a){return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}function bn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(a,u){for(let f in u)if(Object.prototype.hasOwnProperty.call(u,f)){let m=a[f],p=u[f],E=r(m,p,f,a,u);E!==void 0?a[f]=E:mn(p)&&mn(m)?a[f]=n(nr({},m),p):Array.isArray(p)&&Array.isArray(m)?a[f]=[...m,...p]:a[f]=p}return a}return n(e,t)}function mn(e){return e&&typeof e=="object"&&e.constructor===Object}function _n(e,t){if(Array.isArray(e))return e.concat(t)}function je(e,t,r={}){let n=null,a,u,f,{leading:m=!1,trailing:p=!0}=r,E=()=>(f=e.apply(u,a),a=void 0,u=void 0,f),y=function(...S){a=S,u=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p&&!g&&E()},t),g)return E()};return y.cancel=()=>{n&&clearTimeout(n),n=null,a=u=void 0},y.flush=()=>{if(n)return clearTimeout(n),n=null,E()},y}function Ki(e,t){return(...r)=>t(e,...r)}function Sn(e){return t=>Ki(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(a){e(new Hi(`${a}`))}})}function Be(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Xe(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((a,u)=>(a[u]=String(n[u]),a),{})}return e[r]})}function zi(e){let t=e.location?Xe(e.location,pn):null,r=e.target?Xe(e.target,pn):null;return Xe(Ni(nr({},e),{location:t,target:r}),Wi)}function ur(e){let t=e.events.map(n=>zi(n)),r=Xe(e.device,qi);return[e.protocolVersion,t,r,e.project]}function aa(e){return new Promise(t=>xn(e)(t))}function xn(e){return(t,r=null)=>{let n=!1;return e(a=>{if(!n)return n=!0,t.call(r,a)},null)}}function sa(e,t){return(r=>{let n,a={onWillAddFirstListener(){n=r(u.fire,u)}},u=new Me(a);return u.event})((r,n=null)=>e(a=>t(a)&&r.call(n,a),null))}function ua(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)la(e[n],t[n])}function la(e,t){if(or(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if($i(t)){try{if(e instanceof t)return}catch(r){}if(!ji(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 ae(){if(globalThis[Qt])return globalThis[Qt];let e=new Ze,t=new tr,r={registerCommand(n,a,u){e.registerCommand({id:n,handler:a,metadata:u})},executeCommand(n,...a){return t.executeCommand(n,...a)},excuteCommandSync(n,...a){return t.executeCommandThowErr(n,...a)}};return globalThis[Qt]=r,r}var rr,Ci,Pi,Di,dn,Oi,Li,fn,nr,Ni,Fi,hn,Ui,Vi,ir,ar,En,wn,Hi,In,Tn,et,sr,ce,Rn,Gi,cr,$e,Ae,Ji,pn,Wi,qi,Yi,Ye,Qi,Xi,Zi,An,lr,ea,ta,ra,kn,Xt,J,na,oa,Qe,Me,be,er,ia,Yt,ca,Ve,Ze,tr,Qt,K=G(()=>{"use strict";rr=Object.defineProperty,Ci=Object.defineProperties,Pi=Object.getOwnPropertyDescriptor,Di=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,Oi=Object.prototype.hasOwnProperty,Li=Object.prototype.propertyIsEnumerable,fn=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nr=(e,t)=>{for(var r in t||(t={}))Oi.call(t,r)&&fn(e,r,t[r]);if(dn)for(var r of dn(t))Li.call(t,r)&&fn(e,r,t[r]);return e},Ni=(e,t)=>Ci(e,Di(t)),Fi=(e,t)=>{for(var r in t)rr(e,r,{get:t[r],enumerable:!0})},hn=(e,t,r,n)=>{for(var a=n>1?void 0:n?Pi(t,r):t,u=e.length-1,f;u>=0;u--)(f=e[u])&&(a=(n?f(t,r,a):f(a))||a);return n&&a&&rr(t,r,a),a},Ui=(e,t,r)=>new Promise((n,a)=>{var u=p=>{try{m(r.next(p))}catch(E){a(E)}},f=p=>{try{m(r.throw(p))}catch(E){a(E)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(u,f);m((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 a=this._eventListeners[r].indexOf(n);a!==-1&&this._eventListeners[r].splice(a,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}Vi=(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))(Vi||{}),ir=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}},ar=class extends ir{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},En=class extends ir{constructor(){super(...arguments),this.kind="USER_ERROR"}},wn=class extends En{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Hi=class extends En{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))}},In=class extends ar{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Tn=class extends ar{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},et=class extends ir{constructor(e,t,r,n,a){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),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},sr=class extends ar{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:Be("log"),warn:Be("warn"),info:Be("info"),error:Be("error"),debug:Be("debug")};Object.assign(globalThis,{logger:ce});Rn=Symbol.for("Jolibox.canIUseMap"),Gi={};globalThis[Rn]=Gi;cr={get config(){return globalThis[Rn]}},$e=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))($e||{}),Ae=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ae||{}),Ji=(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))(Ji||{}),pn=["name","params"],Wi=["name","type","location","target","extra","timestamp","userId"],qi=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Yi=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Ye={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Qi=()=>Ye.isiOS?"iOS":Ye.isAndroid?"Android":Ye.isMac?"Mac":Ye.isFacebook?"Facebook":"PC",Xi="device_id",Zi="advertising_id",An=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Yi()),window.__joliboxLocalStorage__.getItem(e)),lr=()=>An(Xi),ea=()=>An(Zi),ta=e=>e.charAt(0).toUpperCase()+e.slice(1),ra=()=>{var e;let t=new URLSearchParams(window.location.search);return ta((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},kn=e=>{let t="JoliboxWebSDK",r=Qi(),n=navigator.language,a=lr(),u=ea();return`${t} (${ra()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${a} adid/${u} version/${e||""}`},Xt=class Zt{constructor(t){this.element=t,this.next=Zt.Undefined,this.prev=Zt.Undefined}};Xt.Undefined=new Xt(void 0);J=Xt,na=class{constructor(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===J.Undefined}clear(){let e=this._first;for(;e!==J.Undefined;){let t=e.next;e.prev=J.Undefined,e.next=J.Undefined,e=t}this._first=J.Undefined,this._last=J.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new J(e);if(this._first===J.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==J.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==J.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==J.Undefined&&e.next!==J.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===J.Undefined&&e.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):e.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):e.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==J.Undefined;)yield e.element,e=e.next}},oa=0,Qe=class{constructor(e){this.value=e,this.id=oa++}},Me=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 Qe&&(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,a,u,f,m,p;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let E=new Qe(t);this._listeners?this._listeners instanceof Qe?this._listeners=[this._listeners,E]:this._listeners.push(E):((a=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||a.call(n,this),this._listeners=E,(f=(u=this.options)==null?void 0:u.onDidFirstListener)==null||f.call(u,this)),(p=(m=this.options)==null?void 0:m.onDidAddListener)==null||p.call(m,this),this._size++}),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(a){n(a)}}fire(e){this._listeners&&(this._listeners instanceof Qe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},be=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new Me,a=f=>t(...f.args);this.listerHandlerMap.set(t,a),n.event(a),this.listeners.set(e,n);let u=this.cachedEventQueue.get(e);if(u)for(;u.size>0;)n.fire(nr({event:e},u.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new na,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},er={};Fi(er,{None:()=>ia,filter:()=>sa,once:()=>xn,toPromise:()=>aa});ia=()=>{console.log("[Jolibox SDK] None Event")};Yt=Symbol.for("Jolibox.hostEmitter"),ca=()=>{let e=new be;return globalThis[Yt]||(globalThis[Yt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Yt]},Ve=ca();Ze=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Me,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 a of e.metadata.args)r.push(a.constraint);let n=e.handler;e.handler=function(...a){return ua(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};Ze=hn([yn],Ze);tr=class{constructor(){this._onWillExecuteCommand=new Me,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Me,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ze,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Bi(3e4)),this._starActivation}executeCommand(e,...t){return Ui(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),er.toPromise(er.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}}};tr=hn([yn],tr);Qt=Symbol.for("Jolibox.commands")});function ue(e,t={}){dr.emit("ERROR_REPORT",{error:e,options:t})}var dr,Ee,_e=G(()=>{"use strict";K();K();dr=new be,Ee=new be;ue.debounce=je(ue,50,{leading:!0})});var fr,da,Cn,Pn,Dn=G(()=>{"use strict";K();_e();fr=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(a){return{}}},da=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Cn=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[u,f,m]=a;return{headerJson:fr(u),payloadJson:fr(f),signature:fr(m)}}else throw"joli_source is missing"}catch(r){return ue(new In(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Pn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],a=da(e),u=r[2];return`${n}.${a}.${u}`}return t}});var fa,tt,On,mr=G(()=>{"use strict";K();fa="1.1.13-beta.4",tt=()=>fa,On=()=>{let e=tt();return`${kn(e)}`}});var ma,Ln,pr,Nn,Z,pa,A,re=G(()=>{"use strict";K();Dn();mr();K();ma={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:tt()},schema:window.location.href,platform:"h5"},pr=(Ln=globalThis.joliboxJSCore)==null?void 0:Ln.env,Z=Object.assign({},(Nn=pr==null?void 0:pr())!=null?Nn:ma),pa=()=>{var g,I,P,D,x,C,V,U,ee;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?Cn(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,u=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,f=(P=(I=(g=u.get("mpId"))!=null?g:u.get("appId"))!=null?I:u.get("gameId"))!=null?P:"",m=(C=(x=(D=Z.clientSessionId)!=null?D:e==null?void 0:e.sessionId)!=null?x:u.get("sessionId"))!=null?C:n,p=!!((V=e==null?void 0:e.testAdsMode)!=null?V:u.get("testAdsMode")==="true"),E=(ee=(U=e==null?void 0:e.joliboxEnv)!=null?U:u.get("joliboxEnv"))!=null?ee:"production",y=E==="staging",S=t==null?void 0:t.channel;return{get testMode(){return y},get testAdsMode(){return p},get joliboxEnv(){return E},get joliSource(){var B;return(B=u.get("joliSource"))!=null?B:null},get mpId(){var B;return(B=f!=null?f:e==null?void 0:e.id)!=null?B:""},get mpVersion(){var B;return(B=t==null?void 0:t.ver)!=null?B:tt()},get mpType(){var B,T;return(T=(B=t==null?void 0:t.__mpType)!=null?B:e==null?void 0:e.__mpType)!=null?T:"game"},get platform(){var B;return(B=Z.platform)!=null?B:Z.deviceInfo.platform},get deviceInfo(){return Z.deviceInfo},get sdkInfo(){return Z.sdkInfo},get hostInfo(){return Z.hostInfo},get hostUserInfo(){return Z.hostUserInfo},get sessionId(){var B,T;return(T=(B=Z.clientSessionId)!=null?B:m)!=null?T:n},get channel(){return S},get webviewId(){var B;return(B=Z.webviewId)!=null?B:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},get baseApiHost(){return y?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:B=>{bn(Z,B,_n)},encodeJoliSourceQuery:B=>{var T,N;return t&&r?Pn($($({},e),B),(T=u.get("joliSource"))!=null?T:""):(N=u.get("joliSource"))!=null?N:""}}},A=pa()});var hr,Un,ha,ga,Fn,va,Bn=G(()=>{"use strict";K();_e();re();K();hr=!1,Un=(e,t)=>e==null?!1:t in e,ha=e=>Un(e,"kind"),ga=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Fn=(e,t={},r)=>{var u,f,m;let n={user_id:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:ga(e.name)},a=Y($({},n),{env:t.environment,isFromUser:r});r?Ee.emit("GLOBAL_USER_ERROR",e,a):Ee.emit("GLOBAL_ERROR",e,a)},va=e=>Un(e,"kind")&&e.kind==="USER_ERROR";dr.on("ERROR_REPORT",({error:e,options:t})=>{if(hr)return;hr=!0;let r=ha(e)&&e.raw?e.raw:e;try{let n=va(e);Fn(e,t,n)}catch(n){let a=n instanceof Error?n.message:String(n),u=new sr(`${a}, origin error: ${r.message}`);ce.error(u),Fn(new sr(u.message),{environment:t.environment},!1)}finally{hr=!1}})});var gr,vr=G(()=>{"use strict";_e();K();_e();gr=e=>new wn(e)});function Mn(e,t){let r=(n,a,u)=>{let f=Y($({tag:n},t),{extra:$({},a)});n=="globalJsError"?ue(new Tn(JSON.stringify(f))):e("systemLog",f,u)};return r.debounce=je(r,500,{leading:!0}),r}function jn(e){let t=(r,n,a)=>{var m;let u=(m=a&&JSON.stringify(a))!=null?m:0,f={speed_value_type:r,total_duration:n};u&&Object.assign(f,{extra:u}),e("joliboxSpeedAnalysis",f)};return t.debounce=je(t,500,{leading:!0}),t}var $n=G(()=>{"use strict";K();K();_e()});function Vn(e,t){let r=Mn(e,t),n=jn(r);return{track:r,trackPerformance:n}}var Hn=G(()=>{"use strict";$n()});var yr=G(()=>{"use strict"});var rt,Kn=G(()=>{"use strict";re();K();K();rt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return F(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,a]of Object.entries(r))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,a,u,f,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(u=(a=A.hostInfo)==null?void 0:a.aid)!=null?u:"1",model:(f=A.deviceInfo.model)!=null?f:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,a)=>{r[a]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return F(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),u=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,E={protocolVersion:"1.0.0",events:[Y($({},t),{location:a,target:u,extra:f,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(ur(E),n):yield this.doReport(ur(E))}catch(y){ce.log("[Jolibox SDK] report API error",y)}})}}});var br=G(()=>{"use strict";Hn();yr();Kn()});var _r,Gn,pe,nt,he,He=G(()=>{"use strict";mr();re();_r=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Gn=AbortSignal.timeout)!=null||(AbortSignal.timeout=_r);pe=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new nt(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}getNetworkStatus(){return this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}},nt=class{constructor(t){this.xua=On();this.getJoliSource=()=>A.joliSource;var n;let r=A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com";this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return F(this,null,function*(){try{let{query:n,timeout:a}=r!=null?r:{},{headers:u}=r!=null?r:{},f=n?new URLSearchParams(n):null,m=f==null?void 0:f.toString(),p=`${this.baseUrl}${t}${m?`?${m}`:""}`,E=this.xua,y=this.getJoliSource();u=Object.assign({},u!=null?u:{},E?{"x-user-agent":E}:{},y?{"x-joli-source":y}:{});let S=yield fetch(p,{method:"GET",headers:u,credentials:"include",signal:_r(a!=null?a:3e4)});return pe.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return F(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),E=`${this.baseUrl}${t}${p?`?${p}`:""}`,y=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},y?{"x-user-agent":y}:{},S?{"x-joli-source":S}:{});let g=yield fetch(E,{method:"POST",headers:f,body:JSON.stringify(n),signal:_r(u!=null?u:3e4),credentials:"include"});pe.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return F(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),E=`${this.baseUrl}${t}${p?`?${p}`:""}`,y=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},y?{"x-user-agent":y}:{},S?{"x-joli-source":S}:{});let g=yield fetch(E,{method:"PUT",headers:f,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!g.ok)throw pe.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return pe.getInstance().recordNetworkRequest(!0),yield g.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=nt;he=pe.getInstance()});var Er,ot,wr=G(()=>{"use strict";re();br();He();Er=class extends rt{constructor(){super(...arguments);this.hostToApiMap={default:{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.jolibox.com":{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.pico-game.com":{test:"https://stg-collect.pico-game.com",prod:"https://collect.pico-game.com"}};this.httpClient=he.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n,a;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(a=A.testMode)!=null&&a?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},ot=new Er});var ya,Jn=G(()=>{"use strict";Bn();K();vr();K();wr();re();ya=(e,t)=>{var a,u,f;let r={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},n={name:e,type:$e.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:null};ot.trackEvent(n,Ae.WebSDK)};Ee.on("GLOBAL_ERROR",(e,t)=>{ya(t.tag,e)});Ee.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var it,Wn=G(()=>{"use strict";it=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,a,u=!1,f=0,m=()=>{if(!u)return;let I=Date.now(),P=I-r;P>=this.interval&&(this.visible&&(f+=P,t(f)),r=I),n=requestAnimationFrame(m)},p=()=>{y(),r=Date.now(),a=window.setInterval(()=>{if(!u)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},E=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},y=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",I=>{u&&(console.log("visible",I),I?E():p())});let g=this.visible;return{start(){u||(u=!0,g?E():p())},stop(){u=!1,y(),S()}}}}});var at,qn=G(()=>{"use strict";re();Wn();He();at=class extends it{constructor(r,n,a){super(n,a);this.httpClient=he.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return F(this,null,function*(){let{event:n,params:a}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:$({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,n=null){this.track(r,n)}}});var zn,ba,de,_a,Ir,le,we=G(()=>{"use strict";Jn();K();K();br();wr();qn();re();yr();zn=ae(),ba={type:Ae.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:de,trackPerformance:_a}=Vn((...e)=>{var f,m,p,E;let[,t]=e,r=t,n=gn(r.extra)?r.extra:or(r.extra)?JSON.parse(r.extra):{},a=Y($({},n),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(m=r.mp_version)!=null?m:""}),u={name:t.tag,type:$e.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(E=(p=A.hostUserInfo)==null?void 0:p.uid)!=null?E:null};ot.trackEvent(u,Ae.WebSDK)},ba);zn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{_a(e,t,r)});zn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{de(e,t)});Ir=new be,le=new at(de,Ir)});function Yn(e){let t=cr.config[e];return t||(t={},cr.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=$({},n)}}var Qn=G(()=>{"use strict";K()});function Tr(e){Xn=e}function st(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>st(t)):Object.keys(e).reduce((t,r)=>(t[r]=st(e[r]),t),{})}function ge(e){return typeof e=="number"}function Sr(e){let t=Rr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Rr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Xn,z,ct,ut,lt,dt,ke,ft,mt,pt,ht,gt,vt,yt,bt,_t,Et,wt,It,Ar=G(()=>{"use strict";Xn=!1;z=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Xn)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${Sr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return st(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:st(this._default)}optional(){return this._optional=!0,this}};ct=class extends z{validate(t){return this._optional&&t===void 0?!0:ge(t)?ge(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ge(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ge(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},ut=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},lt=class extends z{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ge(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ge(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},dt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends z{validate(t){return!0}},ft=class extends z{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},mt=class extends z{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},pt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},ht=class extends z{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Sr(t)}`)}return!0}},gt=class extends z{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ge(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ge(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ge(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let a=!0;if(r.forEach((u,f)=>{if(n.path=`${this.path}[${f}]`,n.errors=this.errors,u===void 0&&n.hasDefault){r[f]=n.defaultValue;return}n.validate(u)||(n.hasFallback?r[f]=n.fallbackValue:a=!1)}),this._uniqueItems){let u=new Map;for(let f in r)u.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${u.get(r[f])}] and ${this.path}[${f}] are identical)`):u.set(r[f],f)}return a}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},vt=class extends z{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Rr(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,u=this._value;u.errors=this.errors;let f=!0;for(let m in a){let p=a[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?u.path=`${this.path}.${m}`:u.path=`${this.path}["${m}"]`,!(p===void 0&&u._optional)){if(p===void 0&&u.hasDefault){a[m]=u.defaultValue;continue}u.validate(p)||(u.hasFallback?a[m]=u.fallbackValue:f=!1)}}return f}},yt=class extends z{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Rr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,a=!0;for(let u in this._object){let f=n[u],m=this._object[u];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(u)?m.path=`${this.path}.${u}`:m.path=`${this.path}["${u}"]`,!(m._optional&&f===void 0)){if(f===void 0&&m.hasDefault){n[u]=m.defaultValue;continue}m.validate(f)||(m.hasFallback?n[u]=m.fallbackValue:a=!1)}}return a}},bt=class extends z{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Sr(this.value),actual:r}):!0}},_t=class extends z{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,a=this._items.length;for(let u=0;u<a;u++){let f=this._items[u];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!n){n=!0;break}}if(!n){let u=r.join(`
|
|
1
|
+
var Ii=Object.create;var qt=Object.defineProperty,Ti=Object.defineProperties,Si=Object.getOwnPropertyDescriptor,Ri=Object.getOwnPropertyDescriptors,Ai=Object.getOwnPropertyNames,ze=Object.getOwnPropertySymbols,ki=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable;var an=(e,t,r)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t)=>{for(var r in t||(t={}))zt.call(t,r)&&an(e,r,t[r]);if(ze)for(var r of ze(t))sn.call(t,r)&&an(e,r,t[r]);return e},Y=(e,t)=>Ti(e,Ri(t));var Ue=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var cn=(e,t)=>{var r={};for(var n in e)zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ze)for(var n of ze(e))t.indexOf(n)<0&&sn.call(e,n)&&(r[n]=e[n]);return r};var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var un=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var xi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ai(t))!zt.call(e,a)&&a!==r&&qt(e,a,{get:()=>t[a],enumerable:!(n=Si(t,a))||n.enumerable});return e};var ln=(e,t,r)=>(r=e!=null?Ii(ki(e)):{},xi(t||!e||!e.__esModule?qt(r,"default",{value:e,enumerable:!0}):r,e));var F=(e,t,r)=>new Promise((n,a)=>{var u=p=>{try{m(r.next(p))}catch(E){a(E)}},f=p=>{try{m(r.throw(p))}catch(E){a(E)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(u,f);m((r=r.apply(e,t)).next())});function Bi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function or(e){return typeof e=="string"}function gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function vn(e){return typeof e=="object"&&Array.isArray(e)}function Mi(e){return typeof e=="undefined"}function ji(e){return Mi(e)||e===null}function $i(e){return typeof e=="function"}function yn(e){let t=e,r=null,n=function(...a){return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}function bn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(a,u){for(let f in u)if(Object.prototype.hasOwnProperty.call(u,f)){let m=a[f],p=u[f],E=r(m,p,f,a,u);E!==void 0?a[f]=E:mn(p)&&mn(m)?a[f]=n(nr({},m),p):Array.isArray(p)&&Array.isArray(m)?a[f]=[...m,...p]:a[f]=p}return a}return n(e,t)}function mn(e){return e&&typeof e=="object"&&e.constructor===Object}function _n(e,t){if(Array.isArray(e))return e.concat(t)}function je(e,t,r={}){let n=null,a,u,f,{leading:m=!1,trailing:p=!0}=r,E=()=>(f=e.apply(u,a),a=void 0,u=void 0,f),y=function(...S){a=S,u=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p&&!g&&E()},t),g)return E()};return y.cancel=()=>{n&&clearTimeout(n),n=null,a=u=void 0},y.flush=()=>{if(n)return clearTimeout(n),n=null,E()},y}function Ki(e,t){return(...r)=>t(e,...r)}function Sn(e){return t=>Ki(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(a){e(new Hi(`${a}`))}})}function Be(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Xe(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((a,u)=>(a[u]=String(n[u]),a),{})}return e[r]})}function zi(e){let t=e.location?Xe(e.location,pn):null,r=e.target?Xe(e.target,pn):null;return Xe(Ni(nr({},e),{location:t,target:r}),Wi)}function ur(e){let t=e.events.map(n=>zi(n)),r=Xe(e.device,qi);return[e.protocolVersion,t,r,e.project]}function aa(e){return new Promise(t=>xn(e)(t))}function xn(e){return(t,r=null)=>{let n=!1;return e(a=>{if(!n)return n=!0,t.call(r,a)},null)}}function sa(e,t){return(r=>{let n,a={onWillAddFirstListener(){n=r(u.fire,u)}},u=new Me(a);return u.event})((r,n=null)=>e(a=>t(a)&&r.call(n,a),null))}function ua(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)la(e[n],t[n])}function la(e,t){if(or(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if($i(t)){try{if(e instanceof t)return}catch(r){}if(!ji(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 ae(){if(globalThis[Qt])return globalThis[Qt];let e=new Ze,t=new tr,r={registerCommand(n,a,u){e.registerCommand({id:n,handler:a,metadata:u})},executeCommand(n,...a){return t.executeCommand(n,...a)},excuteCommandSync(n,...a){return t.executeCommandThowErr(n,...a)}};return globalThis[Qt]=r,r}var rr,Ci,Pi,Di,dn,Oi,Li,fn,nr,Ni,Fi,hn,Ui,Vi,ir,ar,En,wn,Hi,In,Tn,et,sr,ce,Rn,Gi,cr,$e,Ae,Ji,pn,Wi,qi,Yi,Ye,Qi,Xi,Zi,An,lr,ea,ta,ra,kn,Xt,J,na,oa,Qe,Me,be,er,ia,Yt,ca,Ve,Ze,tr,Qt,K=G(()=>{"use strict";rr=Object.defineProperty,Ci=Object.defineProperties,Pi=Object.getOwnPropertyDescriptor,Di=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,Oi=Object.prototype.hasOwnProperty,Li=Object.prototype.propertyIsEnumerable,fn=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nr=(e,t)=>{for(var r in t||(t={}))Oi.call(t,r)&&fn(e,r,t[r]);if(dn)for(var r of dn(t))Li.call(t,r)&&fn(e,r,t[r]);return e},Ni=(e,t)=>Ci(e,Di(t)),Fi=(e,t)=>{for(var r in t)rr(e,r,{get:t[r],enumerable:!0})},hn=(e,t,r,n)=>{for(var a=n>1?void 0:n?Pi(t,r):t,u=e.length-1,f;u>=0;u--)(f=e[u])&&(a=(n?f(t,r,a):f(a))||a);return n&&a&&rr(t,r,a),a},Ui=(e,t,r)=>new Promise((n,a)=>{var u=p=>{try{m(r.next(p))}catch(E){a(E)}},f=p=>{try{m(r.throw(p))}catch(E){a(E)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(u,f);m((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 a=this._eventListeners[r].indexOf(n);a!==-1&&this._eventListeners[r].splice(a,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}Vi=(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))(Vi||{}),ir=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}},ar=class extends ir{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},En=class extends ir{constructor(){super(...arguments),this.kind="USER_ERROR"}},wn=class extends En{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Hi=class extends En{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))}},In=class extends ar{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Tn=class extends ar{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},et=class extends ir{constructor(e,t,r,n,a){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),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},sr=class extends ar{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:Be("log"),warn:Be("warn"),info:Be("info"),error:Be("error"),debug:Be("debug")};Object.assign(globalThis,{logger:ce});Rn=Symbol.for("Jolibox.canIUseMap"),Gi={};globalThis[Rn]=Gi;cr={get config(){return globalThis[Rn]}},$e=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))($e||{}),Ae=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ae||{}),Ji=(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))(Ji||{}),pn=["name","params"],Wi=["name","type","location","target","extra","timestamp","userId"],qi=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Yi=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Ye={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Qi=()=>Ye.isiOS?"iOS":Ye.isAndroid?"Android":Ye.isMac?"Mac":Ye.isFacebook?"Facebook":"PC",Xi="device_id",Zi="advertising_id",An=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Yi()),window.__joliboxLocalStorage__.getItem(e)),lr=()=>An(Xi),ea=()=>An(Zi),ta=e=>e.charAt(0).toUpperCase()+e.slice(1),ra=()=>{var e;let t=new URLSearchParams(window.location.search);return ta((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},kn=e=>{let t="JoliboxWebSDK",r=Qi(),n=navigator.language,a=lr(),u=ea();return`${t} (${ra()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${a} adid/${u} version/${e||""}`},Xt=class Zt{constructor(t){this.element=t,this.next=Zt.Undefined,this.prev=Zt.Undefined}};Xt.Undefined=new Xt(void 0);J=Xt,na=class{constructor(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===J.Undefined}clear(){let e=this._first;for(;e!==J.Undefined;){let t=e.next;e.prev=J.Undefined,e.next=J.Undefined,e=t}this._first=J.Undefined,this._last=J.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new J(e);if(this._first===J.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==J.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==J.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==J.Undefined&&e.next!==J.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===J.Undefined&&e.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):e.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):e.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==J.Undefined;)yield e.element,e=e.next}},oa=0,Qe=class{constructor(e){this.value=e,this.id=oa++}},Me=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 Qe&&(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,a,u,f,m,p;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let E=new Qe(t);this._listeners?this._listeners instanceof Qe?this._listeners=[this._listeners,E]:this._listeners.push(E):((a=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||a.call(n,this),this._listeners=E,(f=(u=this.options)==null?void 0:u.onDidFirstListener)==null||f.call(u,this)),(p=(m=this.options)==null?void 0:m.onDidAddListener)==null||p.call(m,this),this._size++}),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(a){n(a)}}fire(e){this._listeners&&(this._listeners instanceof Qe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},be=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new Me,a=f=>t(...f.args);this.listerHandlerMap.set(t,a),n.event(a),this.listeners.set(e,n);let u=this.cachedEventQueue.get(e);if(u)for(;u.size>0;)n.fire(nr({event:e},u.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new na,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},er={};Fi(er,{None:()=>ia,filter:()=>sa,once:()=>xn,toPromise:()=>aa});ia=()=>{console.log("[Jolibox SDK] None Event")};Yt=Symbol.for("Jolibox.hostEmitter"),ca=()=>{let e=new be;return globalThis[Yt]||(globalThis[Yt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Yt]},Ve=ca();Ze=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Me,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 a of e.metadata.args)r.push(a.constraint);let n=e.handler;e.handler=function(...a){return ua(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};Ze=hn([yn],Ze);tr=class{constructor(){this._onWillExecuteCommand=new Me,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Me,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ze,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Bi(3e4)),this._starActivation}executeCommand(e,...t){return Ui(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),er.toPromise(er.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}}};tr=hn([yn],tr);Qt=Symbol.for("Jolibox.commands")});function ue(e,t={}){dr.emit("ERROR_REPORT",{error:e,options:t})}var dr,Ee,_e=G(()=>{"use strict";K();K();dr=new be,Ee=new be;ue.debounce=je(ue,50,{leading:!0})});var fr,da,Cn,Pn,Dn=G(()=>{"use strict";K();_e();fr=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(a){return{}}},da=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Cn=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[u,f,m]=a;return{headerJson:fr(u),payloadJson:fr(f),signature:fr(m)}}else throw"joli_source is missing"}catch(r){return ue(new In(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Pn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],a=da(e),u=r[2];return`${n}.${a}.${u}`}return t}});var fa,tt,On,mr=G(()=>{"use strict";K();fa="1.1.13-beta.6",tt=()=>fa,On=()=>{let e=tt();return`${kn(e)}`}});var ma,Ln,pr,Nn,Z,pa,A,re=G(()=>{"use strict";K();Dn();mr();K();ma={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:tt()},schema:window.location.href,platform:"h5"},pr=(Ln=globalThis.joliboxJSCore)==null?void 0:Ln.env,Z=Object.assign({},(Nn=pr==null?void 0:pr())!=null?Nn:ma),pa=()=>{var g,I,P,D,x,C,V,U,ee;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?Cn(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,u=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,f=(P=(I=(g=u.get("mpId"))!=null?g:u.get("appId"))!=null?I:u.get("gameId"))!=null?P:"",m=(C=(x=(D=Z.clientSessionId)!=null?D:e==null?void 0:e.sessionId)!=null?x:u.get("sessionId"))!=null?C:n,p=!!((V=e==null?void 0:e.testAdsMode)!=null?V:u.get("testAdsMode")==="true"),E=(ee=(U=e==null?void 0:e.joliboxEnv)!=null?U:u.get("joliboxEnv"))!=null?ee:"production",y=E==="staging",S=t==null?void 0:t.channel;return{get testMode(){return y},get testAdsMode(){return p},get joliboxEnv(){return E},get joliSource(){var B;return(B=u.get("joliSource"))!=null?B:null},get mpId(){var B;return(B=f!=null?f:e==null?void 0:e.id)!=null?B:""},get mpVersion(){var B;return(B=t==null?void 0:t.ver)!=null?B:tt()},get mpType(){var B,T;return(T=(B=t==null?void 0:t.__mpType)!=null?B:e==null?void 0:e.__mpType)!=null?T:"game"},get platform(){var B;return(B=Z.platform)!=null?B:Z.deviceInfo.platform},get deviceInfo(){return Z.deviceInfo},get sdkInfo(){return Z.sdkInfo},get hostInfo(){return Z.hostInfo},get hostUserInfo(){return Z.hostUserInfo},get sessionId(){var B,T;return(T=(B=Z.clientSessionId)!=null?B:m)!=null?T:n},get channel(){return S},get webviewId(){var B;return(B=Z.webviewId)!=null?B:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},get baseApiHost(){return y?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:B=>{bn(Z,B,_n)},encodeJoliSourceQuery:B=>{var T,N;return t&&r?Pn($($({},e),B),(T=u.get("joliSource"))!=null?T:""):(N=u.get("joliSource"))!=null?N:""}}},A=pa()});var hr,Un,ha,ga,Fn,va,Bn=G(()=>{"use strict";K();_e();re();K();hr=!1,Un=(e,t)=>e==null?!1:t in e,ha=e=>Un(e,"kind"),ga=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Fn=(e,t={},r)=>{var u,f,m;let n={user_id:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:ga(e.name)},a=Y($({},n),{env:t.environment,isFromUser:r});r?Ee.emit("GLOBAL_USER_ERROR",e,a):Ee.emit("GLOBAL_ERROR",e,a)},va=e=>Un(e,"kind")&&e.kind==="USER_ERROR";dr.on("ERROR_REPORT",({error:e,options:t})=>{if(hr)return;hr=!0;let r=ha(e)&&e.raw?e.raw:e;try{let n=va(e);Fn(e,t,n)}catch(n){let a=n instanceof Error?n.message:String(n),u=new sr(`${a}, origin error: ${r.message}`);ce.error(u),Fn(new sr(u.message),{environment:t.environment},!1)}finally{hr=!1}})});var gr,vr=G(()=>{"use strict";_e();K();_e();gr=e=>new wn(e)});function Mn(e,t){let r=(n,a,u)=>{let f=Y($({tag:n},t),{extra:$({},a)});n=="globalJsError"?ue(new Tn(JSON.stringify(f))):e("systemLog",f,u)};return r.debounce=je(r,500,{leading:!0}),r}function jn(e){let t=(r,n,a)=>{var m;let u=(m=a&&JSON.stringify(a))!=null?m:0,f={speed_value_type:r,total_duration:n};u&&Object.assign(f,{extra:u}),e("joliboxSpeedAnalysis",f)};return t.debounce=je(t,500,{leading:!0}),t}var $n=G(()=>{"use strict";K();K();_e()});function Vn(e,t){let r=Mn(e,t),n=jn(r);return{track:r,trackPerformance:n}}var Hn=G(()=>{"use strict";$n()});var yr=G(()=>{"use strict"});var rt,Kn=G(()=>{"use strict";re();K();K();rt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return F(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,a]of Object.entries(r))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,a,u,f,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(u=(a=A.hostInfo)==null?void 0:a.aid)!=null?u:"1",model:(f=A.deviceInfo.model)!=null?f:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,a)=>{r[a]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return F(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),u=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,E={protocolVersion:"1.0.0",events:[Y($({},t),{location:a,target:u,extra:f,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(ur(E),n):yield this.doReport(ur(E))}catch(y){ce.log("[Jolibox SDK] report API error",y)}})}}});var br=G(()=>{"use strict";Hn();yr();Kn()});var _r,Gn,pe,nt,he,He=G(()=>{"use strict";mr();re();_r=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Gn=AbortSignal.timeout)!=null||(AbortSignal.timeout=_r);pe=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new nt(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}getNetworkStatus(){return this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}},nt=class{constructor(t){this.xua=On();this.getJoliSource=()=>A.joliSource;var n;let r=A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com";this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return F(this,null,function*(){try{let{query:n,timeout:a}=r!=null?r:{},{headers:u}=r!=null?r:{},f=n?new URLSearchParams(n):null,m=f==null?void 0:f.toString(),p=`${this.baseUrl}${t}${m?`?${m}`:""}`,E=this.xua,y=this.getJoliSource();u=Object.assign({},u!=null?u:{},E?{"x-user-agent":E}:{},y?{"x-joli-source":y}:{});let S=yield fetch(p,{method:"GET",headers:u,credentials:"include",signal:_r(a!=null?a:3e4)});return pe.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return F(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),E=`${this.baseUrl}${t}${p?`?${p}`:""}`,y=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},y?{"x-user-agent":y}:{},S?{"x-joli-source":S}:{});let g=yield fetch(E,{method:"POST",headers:f,body:JSON.stringify(n),signal:_r(u!=null?u:3e4),credentials:"include"});pe.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return F(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),E=`${this.baseUrl}${t}${p?`?${p}`:""}`,y=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},y?{"x-user-agent":y}:{},S?{"x-joli-source":S}:{});let g=yield fetch(E,{method:"PUT",headers:f,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!g.ok)throw pe.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return pe.getInstance().recordNetworkRequest(!0),yield g.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=nt;he=pe.getInstance()});var Er,ot,wr=G(()=>{"use strict";re();br();He();Er=class extends rt{constructor(){super(...arguments);this.hostToApiMap={default:{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.jolibox.com":{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.pico-game.com":{test:"https://stg-collect.pico-game.com",prod:"https://collect.pico-game.com"}};this.httpClient=he.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n,a;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(a=A.testMode)!=null&&a?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},ot=new Er});var ya,Jn=G(()=>{"use strict";Bn();K();vr();K();wr();re();ya=(e,t)=>{var a,u,f;let r={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},n={name:e,type:$e.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:null};ot.trackEvent(n,Ae.WebSDK)};Ee.on("GLOBAL_ERROR",(e,t)=>{ya(t.tag,e)});Ee.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var it,Wn=G(()=>{"use strict";it=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,a,u=!1,f=0,m=()=>{if(!u)return;let I=Date.now(),P=I-r;P>=this.interval&&(this.visible&&(f+=P,t(f)),r=I),n=requestAnimationFrame(m)},p=()=>{y(),r=Date.now(),a=window.setInterval(()=>{if(!u)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},E=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},y=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",I=>{u&&(console.log("visible",I),I?E():p())});let g=this.visible;return{start(){u||(u=!0,g?E():p())},stop(){u=!1,y(),S()}}}}});var at,qn=G(()=>{"use strict";re();Wn();He();at=class extends it{constructor(r,n,a){super(n,a);this.httpClient=he.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return F(this,null,function*(){let{event:n,params:a}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:$({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,n=null){this.track(r,n)}}});var zn,ba,de,_a,Ir,le,we=G(()=>{"use strict";Jn();K();K();br();wr();qn();re();yr();zn=ae(),ba={type:Ae.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:de,trackPerformance:_a}=Vn((...e)=>{var f,m,p,E;let[,t]=e,r=t,n=gn(r.extra)?r.extra:or(r.extra)?JSON.parse(r.extra):{},a=Y($({},n),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(m=r.mp_version)!=null?m:""}),u={name:t.tag,type:$e.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(E=(p=A.hostUserInfo)==null?void 0:p.uid)!=null?E:null};ot.trackEvent(u,Ae.WebSDK)},ba);zn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{_a(e,t,r)});zn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{de(e,t)});Ir=new be,le=new at(de,Ir)});function Yn(e){let t=cr.config[e];return t||(t={},cr.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=$({},n)}}var Qn=G(()=>{"use strict";K()});function Tr(e){Xn=e}function st(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>st(t)):Object.keys(e).reduce((t,r)=>(t[r]=st(e[r]),t),{})}function ge(e){return typeof e=="number"}function Sr(e){let t=Rr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Rr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Xn,z,ct,ut,lt,dt,ke,ft,mt,pt,ht,gt,vt,yt,bt,_t,Et,wt,It,Ar=G(()=>{"use strict";Xn=!1;z=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Xn)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${Sr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return st(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:st(this._default)}optional(){return this._optional=!0,this}};ct=class extends z{validate(t){return this._optional&&t===void 0?!0:ge(t)?ge(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ge(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ge(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},ut=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},lt=class extends z{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ge(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ge(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},dt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends z{validate(t){return!0}},ft=class extends z{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},mt=class extends z{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},pt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},ht=class extends z{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Sr(t)}`)}return!0}},gt=class extends z{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ge(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ge(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ge(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let a=!0;if(r.forEach((u,f)=>{if(n.path=`${this.path}[${f}]`,n.errors=this.errors,u===void 0&&n.hasDefault){r[f]=n.defaultValue;return}n.validate(u)||(n.hasFallback?r[f]=n.fallbackValue:a=!1)}),this._uniqueItems){let u=new Map;for(let f in r)u.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${u.get(r[f])}] and ${this.path}[${f}] are identical)`):u.set(r[f],f)}return a}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},vt=class extends z{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Rr(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,u=this._value;u.errors=this.errors;let f=!0;for(let m in a){let p=a[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?u.path=`${this.path}.${m}`:u.path=`${this.path}["${m}"]`,!(p===void 0&&u._optional)){if(p===void 0&&u.hasDefault){a[m]=u.defaultValue;continue}u.validate(p)||(u.hasFallback?a[m]=u.fallbackValue:f=!1)}}return f}},yt=class extends z{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Rr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,a=!0;for(let u in this._object){let f=n[u],m=this._object[u];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(u)?m.path=`${this.path}.${u}`:m.path=`${this.path}["${u}"]`,!(m._optional&&f===void 0)){if(f===void 0&&m.hasDefault){n[u]=m.defaultValue;continue}m.validate(f)||(m.hasFallback?n[u]=m.fallbackValue:a=!1)}}return a}},bt=class extends z{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Sr(this.value),actual:r}):!0}},_t=class extends z{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,a=this._items.length;for(let u=0;u<a;u++){let f=this._items[u];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!n){n=!0;break}}if(!n){let u=r.join(`
|
|
2
2
|
or `);this.errors.push(u)}return n}},Et=class extends z{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let a=t[n];if(a._optional||a.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,t[a]===void 0&&n.hasDefault){t[a]=n.defaultValue;return}n.validate(t[a])||(n.hasFallback?t[a]=n._fallback:r=!1)}),r}},wt=class extends z{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},It=class extends z{constructor(t){super(),this._ctor=t}validate(t){return t===void 0&&this._optional||t instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:t})}}});function kr(e,t,r="param"){if(e.errors=[],e.path=r,Tr(!0),!e.validate(t)){let n=e.errors.join(`
|
|
3
|
-
`);throw e.errors.length=0,Tr(!1),new TypeError(n)}}var k,xr=G(()=>{"use strict";Ar();Ar();k={object(e){return new yt(e)},array(e){return new gt(e)},tuple(...e){return new Et(...e)},literal(e){return new bt(e)},or(...e){return new _t(...e)},symbol(){return new dt},record(e){return new vt(e)},function(){return new pt},boolean(){return new ut},string(){return new lt},number(){return new ct},undefined(){return new ft},null(){return new mt},unknown(){return new ke},any(){return new ke},as(){return new ke},arraybuffer(){return new wt},enum(...e){return new ht(...e)},typedarray(e){return new It(e)}}});var Tt,Zn,eo=G(()=>{"use strict";K();_e();xr();vr();Tt=1,Zn=e=>{function t(n,a){return(...u)=>{var S,g,I,P;let f=Date.now(),m={method:n,trace_id:Tt};Tt+=1;let p="SUCCESS",E=`${n}:ok`,y=0;try{if(a.paramsSchema)try{kr(a.paramsSchema,u,"params")}catch(V){throw gr(`${n}:fail ${V.message}`)}let D=a.implement(...u),x=D,C=`${n}:ok`;if(D&&"code"in D){let{code:V,data:U,message:ee}=D;p=V,x=U,C=ee}return{code:p,message:C,data:x}}catch(D){let x=D;y=(g=(S=x.code)!=null?S:x.errNo)!=null?g:2e3,p="FAILURE";let C=(P=(I=x.message)!=null?I:x.errMsg)!=null?P:`${D}`;return E=`${n}:${p} ${C.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new et(E,y)),{code:p,message:E}}finally{let D=Date.now()-f;e("apiInvoked",Y($({},m),{duration:D,status:p}))}}}function r(n,a){return(...u)=>F(this,null,function*(){var g,I,P,D;let f=vn(u)?u:[u],m=Date.now(),p={method:n,trace_id:Tt};Tt+=1;let E=`${n}:ok`,y="SUCCESS",S={code:y,message:E};try{if(a.paramsSchema)try{kr(a.paramsSchema,f,"params")}catch(V){throw gr(V.message)}let C=yield a.implement(...f);if(C&&"code"in C){let{code:V,data:U,message:ee}=C;y=V,E=ee,C=U}return Object.assign(S,{code:y,message:E,data:C}),S}catch(x){let C=x,V=(I=(g=C.code)!=null?g:C.errNo)!=null?I:2e3;y="FAILURE";let U=(D=(P=C.message)!=null?P:C.errMsg)!=null?D:`${x}`,ee=`${n}:${y} ${U.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:y,message:ee}),ue(new et(ee,V)),S}finally{let x=Date.now()-m;e("apiInvoked",Y($({},p),{duration:x,status:y}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Ie,Q,Ke=G(()=>{"use strict";Qn();we();eo();xr();({createAPI:se,createSyncAPI:Ie}=Zn(de)),Q=Yn("h5")});var oo=un((no,Or)=>{(function(e){if(typeof no=="object"&&typeof Or!="undefined")Or.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(a,u,f){function m(y,S){if(!u[y]){if(!a[y]){var g=typeof Ue=="function"&&Ue;if(!S&&g)return g(y,!0);if(p)return p(y,!0);var I=new Error("Cannot find module '"+y+"'");throw I.code="MODULE_NOT_FOUND",I}var P=u[y]={exports:{}};a[y][0].call(P.exports,function(D){var x=a[y][1][D];return m(x||D)},P,P.exports,n,a,u,f)}return u[y].exports}for(var p=typeof Ue=="function"&&Ue,E=0;E<f.length;E++)m(f[E]);return m}({1:[function(n,a,u){(function(f){"use strict";var m=f.MutationObserver||f.WebKitMutationObserver,p;if(m){var E=0,y=new m(D),S=f.document.createTextNode("");y.observe(S,{characterData:!0}),p=function(){S.data=E=++E%2}}else if(!f.setImmediate&&typeof f.MessageChannel!="undefined"){var g=new f.MessageChannel;g.port1.onmessage=D,p=function(){g.port2.postMessage(0)}}else"document"in f&&"onreadystatechange"in f.document.createElement("script")?p=function(){var C=f.document.createElement("script");C.onreadystatechange=function(){D(),C.onreadystatechange=null,C.parentNode.removeChild(C),C=null},f.document.documentElement.appendChild(C)}:p=function(){setTimeout(D,0)};var I,P=[];function D(){I=!0;for(var C,V,U=P.length;U;){for(V=P,P=[],C=-1;++C<U;)V[C]();U=P.length}I=!1}a.exports=x;function x(C){P.push(C)===1&&!I&&p()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,a,u){"use strict";var f=n(1);function m(){}var p={},E=["REJECTED"],y=["FULFILLED"],S=["PENDING"];a.exports=g;function g(T){if(typeof T!="function")throw new TypeError("resolver must be a function");this.state=S,this.queue=[],this.outcome=void 0,T!==m&&x(this,T)}g.prototype.catch=function(T){return this.then(null,T)},g.prototype.then=function(T,N){if(typeof T!="function"&&this.state===y||typeof N!="function"&&this.state===E)return this;var L=new this.constructor(m);if(this.state!==S){var H=this.state===y?T:N;P(L,H,this.outcome)}else this.queue.push(new I(L,T,N));return L};function I(T,N,L){this.promise=T,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(T){p.resolve(this.promise,T)},I.prototype.otherCallFulfilled=function(T){P(this.promise,this.onFulfilled,T)},I.prototype.callRejected=function(T){p.reject(this.promise,T)},I.prototype.otherCallRejected=function(T){P(this.promise,this.onRejected,T)};function P(T,N,L){f(function(){var H;try{H=N(L)}catch(X){return p.reject(T,X)}H===T?p.reject(T,new TypeError("Cannot resolve promise with itself")):p.resolve(T,H)})}p.resolve=function(T,N){var L=C(D,N);if(L.status==="error")return p.reject(T,L.value);var H=L.value;if(H)x(T,H);else{T.state=y,T.outcome=N;for(var X=-1,te=T.queue.length;++X<te;)T.queue[X].callFulfilled(N)}return T},p.reject=function(T,N){T.state=E,T.outcome=N;for(var L=-1,H=T.queue.length;++L<H;)T.queue[L].callRejected(N);return T};function D(T){var N=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof N=="function")return function(){N.apply(T,arguments)}}function x(T,N){var L=!1;function H(oe){L||(L=!0,p.reject(T,oe))}function X(oe){L||(L=!0,p.resolve(T,oe))}function te(){N(X,H)}var ne=C(te);ne.status==="error"&&H(ne.value)}function C(T,N){var L={};try{L.value=T(N),L.status="success"}catch(H){L.status="error",L.value=H}return L}g.resolve=V;function V(T){return T instanceof this?T:p.resolve(new this(m),T)}g.reject=U;function U(T){var N=new this(m);return p.reject(N,T)}g.all=ee;function ee(T){var N=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,H=!1;if(!L)return this.resolve([]);for(var X=new Array(L),te=0,ne=-1,oe=new this(m);++ne<L;)fe(T[ne],ne);return oe;function fe(Le,Je){N.resolve(Le).then(Bt,function(Se){H||(H=!0,p.reject(oe,Se))});function Bt(Se){X[Je]=Se,++te===L&&!H&&(H=!0,p.resolve(oe,X))}}}g.race=B;function B(T){var N=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,H=!1;if(!L)return this.resolve([]);for(var X=-1,te=new this(m);++X<L;)ne(T[X]);return te;function ne(oe){N.resolve(oe).then(function(fe){H||(H=!0,p.resolve(te,fe))},function(fe){H||(H=!0,p.reject(te,fe))})}}},{1:1}],3:[function(n,a,u){(function(f){"use strict";typeof f.Promise!="function"&&(f.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,a,u){"use strict";var f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function m(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}function p(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(o){return}}var E=p();function y(){try{if(!E||!E.open)return!1;var o=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),s=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||s)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function S(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<o.length;d+=1)l.append(o[d]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function I(o,s){s&&o.then(function(i){s(null,i)},function(i){s(i)})}function P(o,s,i){typeof s=="function"&&o.then(s),typeof i=="function"&&o.catch(i)}function D(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function x(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var C="local-forage-detect-blob-support",V=void 0,U={},ee=Object.prototype.toString,B="readonly",T="readwrite";function N(o){for(var s=o.length,i=new ArrayBuffer(s),l=new Uint8Array(i),d=0;d<s;d++)l[d]=o.charCodeAt(d);return i}function L(o){return new g(function(s){var i=o.transaction(C,T),l=S([""]);i.objectStore(C).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),s(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);s(c||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function H(o){return typeof V=="boolean"?g.resolve(V):L(o).then(function(s){return V=s,V})}function X(o){var s=U[o.name],i={};i.promise=new g(function(l,d){i.resolve=l,i.reject=d}),s.deferredOperations.push(i),s.dbReady?s.dbReady=s.dbReady.then(function(){return i.promise}):s.dbReady=i.promise}function te(o){var s=U[o.name],i=s.deferredOperations.pop();if(i)return i.resolve(),i.promise}function ne(o,s){var i=U[o.name],l=i.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(o,s){return new g(function(i,l){if(U[o.name]=U[o.name]||Mr(),o.db)if(s)X(o),o.db.close();else return i(o.db);var d=[o.name];s&&d.push(o.version);var c=E.open.apply(E,d);s&&(c.onupgradeneeded=function(h){var v=c.result;try{v.createObjectStore(o.storeName),h.oldVersion<=1&&v.createObjectStore(C)}catch(b){if(b.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw b}}),c.onerror=function(h){h.preventDefault(),l(c.error)},c.onsuccess=function(){var h=c.result;h.onversionchange=function(v){v.target.close()},i(h),te(o)}})}function fe(o){return oe(o,!1)}function Le(o){return oe(o,!0)}function Je(o,s){if(!o.db)return!0;var i=!o.db.objectStoreNames.contains(o.storeName),l=o.version<o.db.version,d=o.version>o.db.version;if(l&&(o.version!==s&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),d||i){if(i){var c=o.db.version+1;c>o.version&&(o.version=c)}return!0}return!1}function Bt(o){return new g(function(s,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var c=btoa(d.target.result||"");s({__local_forage_encoded_blob:!0,data:c,type:o.type})},l.readAsBinaryString(o)})}function Se(o){var s=N(atob(o.data));return S([s],{type:o.type})}function Br(o){return o&&o.__local_forage_encoded_blob}function To(o){var s=this,i=s._initReady().then(function(){var l=U[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return P(i,o,o),i}function So(o){X(o);for(var s=U[o.name],i=s.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return o.db=null,fe(o).then(function(c){return o.db=c,Je(o)?Le(o):c}).then(function(c){o.db=s.db=c;for(var h=0;h<i.length;h++)i[h]._dbInfo.db=c}).catch(function(c){throw ne(o,c),c})}function me(o,s,i,l){l===void 0&&(l=1);try{var d=o.db.transaction(o.storeName,s);i(null,d)}catch(c){if(l>0&&(!o.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||c.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Le(o)}).then(function(){return So(o).then(function(){me(o,s,i,l-1)})}).catch(i);i(c)}}function Mr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ro(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=o[l];var d=U[i.name];d||(d=Mr(),U[i.name]=d),d.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=To);var c=[];function h(){return g.resolve()}for(var v=0;v<d.forages.length;v++){var b=d.forages[v];b!==s&&c.push(b._initReady().catch(h))}var _=d.forages.slice(0);return g.all(c).then(function(){return i.db=d.db,fe(i)}).then(function(w){return i.db=w,Je(i,s._defaultConfig.version)?Le(i):w}).then(function(w){i.db=d.db=w,s._dbInfo=i;for(var R=0;R<_.length;R++){var O=_[R];O!==s&&(O._dbInfo.db=i.db,O._dbInfo.version=i.version)}})}function Ao(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.get(o);_.onsuccess=function(){var w=_.result;w===void 0&&(w=null),Br(w)&&(w=Se(w)),d(w)},_.onerror=function(){c(_.error)}}catch(w){c(w)}})}).catch(c)});return I(l,s),l}function ko(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.openCursor(),w=1;_.onsuccess=function(){var R=_.result;if(R){var O=R.value;Br(O)&&(O=Se(O));var M=o(O,R.key,w++);M!==void 0?d(M):R.continue()}else d()},_.onerror=function(){c(_.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function xo(o,s,i){var l=this;o=D(o);var d=new g(function(c,h){var v;l.ready().then(function(){return v=l._dbInfo,ee.call(s)==="[object Blob]"?H(v.db).then(function(b){return b?s:Bt(s)}):s}).then(function(b){me(l._dbInfo,T,function(_,w){if(_)return h(_);try{var R=w.objectStore(l._dbInfo.storeName);b===null&&(b=void 0);var O=R.put(b,o);w.oncomplete=function(){b===void 0&&(b=null),c(b)},w.onabort=w.onerror=function(){var M=O.error?O.error:O.transaction.error;h(M)}}catch(M){h(M)}})}).catch(h)});return I(d,i),d}function Co(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,T,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.delete(o);v.oncomplete=function(){d()},v.onerror=function(){c(_.error)},v.onabort=function(){var w=_.error?_.error:_.transaction.error;c(w)}}catch(w){c(w)}})}).catch(c)});return I(l,s),l}function Po(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,T,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),b=v.clear();h.oncomplete=function(){l()},h.onabort=h.onerror=function(){var _=b.error?b.error:b.transaction.error;d(_)}}catch(_){d(_)}})}).catch(d)});return I(i,o),i}function Do(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,B,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),b=v.count();b.onsuccess=function(){l(b.result)},b.onerror=function(){d(b.error)}}catch(_){d(_)}})}).catch(d)});return I(i,o),i}function Oo(o,s){var i=this,l=new g(function(d,c){if(o<0){d(null);return}i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=!1,w=b.openKeyCursor();w.onsuccess=function(){var R=w.result;if(!R){d(null);return}o===0||_?d(R.key):(_=!0,R.advance(o))},w.onerror=function(){c(w.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function Lo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,B,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),b=v.openKeyCursor(),_=[];b.onsuccess=function(){var w=b.result;if(!w){l(_);return}_.push(w.key),w.continue()},b.onerror=function(){d(b.error)}}catch(w){d(w)}})}).catch(d)});return I(i,o),i}function No(o,s){s=x.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;if(!o.name)d=g.reject("Invalid arguments");else{var c=o.name===i.name&&l._dbInfo.db,h=c?g.resolve(l._dbInfo.db):fe(o).then(function(v){var b=U[o.name],_=b.forages;b.db=v;for(var w=0;w<_.length;w++)_[w]._dbInfo.db=v;return v});o.storeName?d=h.then(function(v){if(v.objectStoreNames.contains(o.storeName)){var b=v.version+1;X(o);var _=U[o.name],w=_.forages;v.close();for(var R=0;R<w.length;R++){var O=w[R];O._dbInfo.db=null,O._dbInfo.version=b}var M=new g(function(j,q){var W=E.open(o.name,b);W.onerror=function(ie){var Fe=W.result;Fe.close(),q(ie)},W.onupgradeneeded=function(){var ie=W.result;ie.deleteObjectStore(o.storeName)},W.onsuccess=function(){var ie=W.result;ie.close(),j(ie)}});return M.then(function(j){_.db=j;for(var q=0;q<w.length;q++){var W=w[q];W._dbInfo.db=j,te(W._dbInfo)}}).catch(function(j){throw(ne(o,j)||g.resolve()).catch(function(){}),j})}}):d=h.then(function(v){X(o);var b=U[o.name],_=b.forages;v.close();for(var w=0;w<_.length;w++){var R=_[w];R._dbInfo.db=null}var O=new g(function(M,j){var q=E.deleteDatabase(o.name);q.onerror=function(){var W=q.result;W&&W.close(),j(q.error)},q.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},q.onsuccess=function(){var W=q.result;W&&W.close(),M(W)}});return O.then(function(M){b.db=M;for(var j=0;j<_.length;j++){var q=_[j];te(q._dbInfo)}}).catch(function(M){throw(ne(o,M)||g.resolve()).catch(function(){}),M})})}return I(d,s),d}var Fo={_driver:"asyncStorage",_initStorage:Ro,_support:y(),iterate:ko,getItem:Ao,setItem:xo,removeItem:Co,clear:Po,length:Do,key:Oo,keys:Lo,dropInstance:No};function Uo(){return typeof openDatabase=="function"}var ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bo="~~local_forage_type~",jr=/^~~local_forage_type~([^~]+)~/,We="__lfsc__:",Mt=We.length,jt="arbf",$t="blob",$r="si08",Vr="ui08",Hr="uic8",Kr="si16",Gr="si32",Jr="ur16",Wr="ui32",qr="fl32",zr="fl64",Yr=Mt+jt.length,Qr=Object.prototype.toString;function Xr(o){var s=o.length*.75,i=o.length,l,d=0,c,h,v,b;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var _=new ArrayBuffer(s),w=new Uint8Array(_);for(l=0;l<i;l+=4)c=ve.indexOf(o[l]),h=ve.indexOf(o[l+1]),v=ve.indexOf(o[l+2]),b=ve.indexOf(o[l+3]),w[d++]=c<<2|h>>4,w[d++]=(h&15)<<4|v>>2,w[d++]=(v&3)<<6|b&63;return _}function Vt(o){var s=new Uint8Array(o),i="",l;for(l=0;l<s.length;l+=3)i+=ve[s[l]>>2],i+=ve[(s[l]&3)<<4|s[l+1]>>4],i+=ve[(s[l+1]&15)<<2|s[l+2]>>6],i+=ve[s[l+2]&63];return s.length%3===2?i=i.substring(0,i.length-1)+"=":s.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function Mo(o,s){var i="";if(o&&(i=Qr.call(o)),o&&(i==="[object ArrayBuffer]"||o.buffer&&Qr.call(o.buffer)==="[object ArrayBuffer]")){var l,d=We;o instanceof ArrayBuffer?(l=o,d+=jt):(l=o.buffer,i==="[object Int8Array]"?d+=$r:i==="[object Uint8Array]"?d+=Vr:i==="[object Uint8ClampedArray]"?d+=Hr:i==="[object Int16Array]"?d+=Kr:i==="[object Uint16Array]"?d+=Jr:i==="[object Int32Array]"?d+=Gr:i==="[object Uint32Array]"?d+=Wr:i==="[object Float32Array]"?d+=qr:i==="[object Float64Array]"?d+=zr:s(new Error("Failed to get type for BinaryArray"))),s(d+Vt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var h=Bo+o.type+"~"+Vt(this.result);s(We+$t+h)},c.readAsArrayBuffer(o)}else try{s(JSON.stringify(o))}catch(h){console.error("Couldn't convert value into a JSON string: ",o),s(null,h)}}function jo(o){if(o.substring(0,Mt)!==We)return JSON.parse(o);var s=o.substring(Yr),i=o.substring(Mt,Yr),l;if(i===$t&&jr.test(s)){var d=s.match(jr);l=d[1],s=s.substring(d[0].length)}var c=Xr(s);switch(i){case jt:return c;case $t:return S([c],{type:l});case $r:return new Int8Array(c);case Vr:return new Uint8Array(c);case Hr:return new Uint8ClampedArray(c);case Kr:return new Int16Array(c);case Jr:return new Uint16Array(c);case Gr:return new Int32Array(c);case Wr:return new Uint32Array(c);case qr:return new Float32Array(c);case zr:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var Ht={serialize:Mo,deserialize:jo,stringToBuffer:Xr,bufferToString:Vt};function Zr(o,s,i,l){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function $o(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=typeof o[l]!="string"?o[l].toString():o[l];var d=new g(function(c,h){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(v){return h(v)}i.db.transaction(function(v){Zr(v,i,function(){s._dbInfo=i,c()},function(b,_){h(_)})},h)});return i.serializer=Ht,d}function ye(o,s,i,l,d,c){o.executeSql(i,l,d,function(h,v){v.code===v.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(b,_){_.rows.length?c(b,v):Zr(b,s,function(){b.executeSql(i,l,d,c)},c)},c):c(h,v)},c)}function Vo(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[o],function(b,_){var w=_.rows.length?_.rows.item(0).value:null;w&&(w=h.serializer.deserialize(w)),d(w)},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function Ho(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT * FROM "+h.storeName,[],function(b,_){for(var w=_.rows,R=w.length,O=0;O<R;O++){var M=w.item(O),j=M.value;if(j&&(j=h.serializer.deserialize(j)),j=o(j,M.key,O+1),j!==void 0){d(j);return}}d()},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function en(o,s,i,l){var d=this;o=D(o);var c=new g(function(h,v){d.ready().then(function(){s===void 0&&(s=null);var b=s,_=d._dbInfo;_.serializer.serialize(s,function(w,R){R?v(R):_.db.transaction(function(O){ye(O,_,"INSERT OR REPLACE INTO "+_.storeName+" (key, value) VALUES (?, ?)",[o,w],function(){h(b)},function(M,j){v(j)})},function(O){if(O.code===O.QUOTA_ERR){if(l>0){h(en.apply(d,[o,b,i,l-1]));return}v(O)}})})}).catch(v)});return I(c,i),c}function Ko(o,s,i){return en.apply(this,[o,s,i,1])}function Go(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[o],function(){d()},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function Jo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){ye(h,c,"DELETE FROM "+c.storeName,[],function(){l()},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function Wo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){ye(h,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(v,b){var _=b.rows.item(0).c;l(_)},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function qo(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[o+1],function(b,_){var w=_.rows.length?_.rows.item(0).key:null;d(w)},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function zo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){ye(h,c,"SELECT key FROM "+c.storeName,[],function(v,b){for(var _=[],w=0;w<b.rows.length;w++)_.push(b.rows.item(w).key);l(_)},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function Yo(o){return new g(function(s,i){o.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var h=[],v=0;v<c.rows.length;v++)h.push(c.rows.item(v).name);s({db:o,storeNames:h})},function(d,c){i(c)})},function(l){i(l)})})}function Qo(o,s){s=x.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;return o.name?d=new g(function(c){var h;o.name===i.name?h=l._dbInfo.db:h=openDatabase(o.name,"","",0),o.storeName?c({db:h,storeNames:[o.storeName]}):c(Yo(h))}).then(function(c){return new g(function(h,v){c.db.transaction(function(b){function _(M){return new g(function(j,q){b.executeSql("DROP TABLE IF EXISTS "+M,[],function(){j()},function(W,ie){q(ie)})})}for(var w=[],R=0,O=c.storeNames.length;R<O;R++)w.push(_(c.storeNames[R]));g.all(w).then(function(){h()}).catch(function(M){v(M)})},function(b){v(b)})})}):d=g.reject("Invalid arguments"),I(d,s),d}var Xo={_driver:"webSQLStorage",_initStorage:$o,_support:Uo(),iterate:Ho,getItem:Vo,setItem:Ko,removeItem:Go,clear:Jo,length:Wo,key:qo,keys:zo,dropInstance:Qo};function Zo(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function tn(o,s){var i=o.name+"/";return o.storeName!==s.storeName&&(i+=o.storeName+"/"),i}function ei(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function ti(){return!ei()||localStorage.length>0}function ri(o){var s=this,i={};if(o)for(var l in o)i[l]=o[l];return i.keyPrefix=tn(o,s._defaultConfig),ti()?(s._dbInfo=i,i.serializer=Ht,g.resolve()):g.reject()}function ni(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var c=localStorage.key(d);c.indexOf(l)===0&&localStorage.removeItem(c)}});return I(i,o),i}function oi(o,s){var i=this;o=D(o);var l=i.ready().then(function(){var d=i._dbInfo,c=localStorage.getItem(d.keyPrefix+o);return c&&(c=d.serializer.deserialize(c)),c});return I(l,s),l}function ii(o,s){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,h=c.length,v=localStorage.length,b=1,_=0;_<v;_++){var w=localStorage.key(_);if(w.indexOf(c)===0){var R=localStorage.getItem(w);if(R&&(R=d.serializer.deserialize(R)),R=o(R,w.substring(h),b++),R!==void 0)return R}}});return I(l,s),l}function ai(o,s){var i=this,l=i.ready().then(function(){var d=i._dbInfo,c;try{c=localStorage.key(o)}catch(h){c=null}return c&&(c=c.substring(d.keyPrefix.length)),c});return I(l,s),l}function si(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo,d=localStorage.length,c=[],h=0;h<d;h++){var v=localStorage.key(h);v.indexOf(l.keyPrefix)===0&&c.push(v.substring(l.keyPrefix.length))}return c});return I(i,o),i}function ci(o){var s=this,i=s.keys().then(function(l){return l.length});return I(i,o),i}function ui(o,s){var i=this;o=D(o);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+o)});return I(l,s),l}function li(o,s,i){var l=this;o=D(o);var d=l.ready().then(function(){s===void 0&&(s=null);var c=s;return new g(function(h,v){var b=l._dbInfo;b.serializer.serialize(s,function(_,w){if(w)v(w);else try{localStorage.setItem(b.keyPrefix+o,_),h(c)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&v(R),v(R)}})})});return I(d,i),d}function di(o,s){if(s=x.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var i=this.config();o.name=o.name||i.name,o.storeName=o.storeName||i.storeName}var l=this,d;return o.name?d=new g(function(c){o.storeName?c(tn(o,l._defaultConfig)):c(o.name+"/")}).then(function(c){for(var h=localStorage.length-1;h>=0;h--){var v=localStorage.key(h);v.indexOf(c)===0&&localStorage.removeItem(v)}}):d=g.reject("Invalid arguments"),I(d,s),d}var fi={_driver:"localStorageWrapper",_initStorage:ri,_support:Zo(),iterate:ii,getItem:oi,setItem:li,removeItem:ui,clear:ni,length:ci,key:ai,keys:si,dropInstance:di},mi=function(s,i){return s===i||typeof s=="number"&&typeof i=="number"&&isNaN(s)&&isNaN(i)},pi=function(s,i){for(var l=s.length,d=0;d<l;){if(mi(s[d],i))return!0;d++}return!1},rn=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Ne={},nn={},Re={INDEXEDDB:Fo,WEBSQL:Xo,LOCALSTORAGE:fi},hi=[Re.INDEXEDDB._driver,Re.WEBSQL._driver,Re.LOCALSTORAGE._driver],qe=["dropInstance"],Kt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(qe),gi={description:"",driver:hi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function vi(o,s){o[s]=function(){var i=arguments;return o.ready().then(function(){return o[s].apply(o,i)})}}function Gt(){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var i in s)s.hasOwnProperty(i)&&(rn(s[i])?arguments[0][i]=s[i].slice():arguments[0][i]=s[i])}return arguments[0]}var yi=function(){function o(s){m(this,o);for(var i in Re)if(Re.hasOwnProperty(i)){var l=Re[i],d=l._driver;this[i]=d,Ne[d]||this.defineDriver(l)}this._defaultConfig=Gt({},gi),this._config=Gt({},this._defaultConfig,s),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return o.prototype.config=function(i){if((typeof i=="undefined"?"undefined":f(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},o.prototype.defineDriver=function(i,l,d){var c=new g(function(h,v){try{var b=i._driver,_=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){v(_);return}for(var w=Kt.concat("_initStorage"),R=0,O=w.length;R<O;R++){var M=w[R],j=!pi(qe,M);if((j||i[M])&&typeof i[M]!="function"){v(_);return}}var q=function(){for(var Fe=function(Ei){return function(){var wi=new Error("Method "+Ei+" is not implemented by the current driver"),on=g.reject(wi);return I(on,arguments[arguments.length-1]),on}},Jt=0,_i=qe.length;Jt<_i;Jt++){var Wt=qe[Jt];i[Wt]||(i[Wt]=Fe(Wt))}};q();var W=function(Fe){Ne[b]&&console.info("Redefining LocalForage driver: "+b),Ne[b]=i,nn[b]=Fe,h()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(W,v):W(!!i._support):W(!0)}catch(ie){v(ie)}});return P(c,l,d),c},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(i,l,d){var c=Ne[i]?g.resolve(Ne[i]):g.reject(new Error("Driver not found."));return P(c,l,d),c},o.prototype.getSerializer=function(i){var l=g.resolve(Ht);return P(l,i),l},o.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return P(d,i,i),d},o.prototype.setDriver=function(i,l,d){var c=this;rn(i)||(i=[i]);var h=this._getSupportedDrivers(i);function v(){c._config.driver=c.driver()}function b(R){return c._extend(R),v(),c._ready=c._initStorage(c._config),c._ready}function _(R){return function(){var O=0;function M(){for(;O<R.length;){var j=R[O];return O++,c._dbInfo=null,c._ready=null,c.getDriver(j).then(b).catch(M)}v();var q=new Error("No available storage method found.");return c._driverSet=g.reject(q),c._driverSet}return M()}}var w=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=w.then(function(){var R=h[0];return c._dbInfo=null,c._ready=null,c.getDriver(R).then(function(O){c._driver=O._driver,v(),c._wrapLibraryMethodsWithReady(),c._initDriver=_(h)})}).catch(function(){v();var R=new Error("No available storage method found.");return c._driverSet=g.reject(R),c._driverSet}),P(this._driverSet,l,d),this._driverSet},o.prototype.supports=function(i){return!!nn[i]},o.prototype._extend=function(i){Gt(this,i)},o.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,c=i.length;d<c;d++){var h=i[d];this.supports(h)&&l.push(h)}return l},o.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=Kt.length;i<l;i++)vi(this,Kt[i])},o.prototype.createInstance=function(i){return new o(i)},o}(),bi=new yi;a.exports=bi},{3:3}]},{},[4])(4)})});var ao=un(Te=>{"use strict";K();Ke();we();var xe=ae(),Ba=se("levelFinished",{paramsSchema:k.tuple(k.string(),k.object({result:k.boolean(),duration:k.number()})),implement:(e,t)=>F(Te,null,function*(){let{result:r,duration:n}=t;ce.info("onLevelFinished",r,n),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:n})])})}),Ma=se("taskFinished",{paramsSchema:k.tuple(k.string(),k.object({duration:k.number()})),implement:(e,t)=>F(Te,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),ja=se("levelUpgrade",{paramsSchema:k.tuple(k.string(),k.string()),implement:(e,t)=>F(Te,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),$a=se("onHistoryUserLevel",{paramsSchema:k.tuple(k.number()),implement:e=>F(Te,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Va=se("onHistoryUserScore",{paramsSchema:k.tuple(k.number()),implement:e=>F(Te,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Ha=se("taskEvent",{paramsSchema:k.tuple(k.string(),k.object({tools:k.array(k.object({id:k.string(),name:k.string(),count:k.number(),description:k.string().optional(),price:k.object({amount:k.number(),unit:k.string()}).optional()})).optional(),awards:k.array(k.object({id:k.string(),name:k.string()})).optional()})),implement:(e,t)=>F(Te,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",$({taskId:e},t))]))})});xe.registerCommand("TaskTrackerSDK.levelFinished",Ba);xe.registerCommand("TaskTrackerSDK.taskFinished",Ma);xe.registerCommand("TaskTrackerSDK.levelUpgrade",ja);xe.registerCommand("TaskTrackerSDK.historyUserLevel",$a);xe.registerCommand("TaskTrackerSDK.historyUserScore",Va);xe.registerCommand("TaskTrackerSDK.taskEvent",Ha);Q("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Q("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Q("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Q("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});we();re();Ke();K();var to=ae(),wa="env",Ia="getSystemInfoSync",Ta=()=>{var a,u,f,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform,brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(a=A.hostInfo)==null?void 0:a.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(u=A.hostInfo)==null?void 0:u.version;t&&(e=Y($({},e),{version:t}));let r=(f=A.hostInfo)==null?void 0:f.appName;r&&(e=Y($({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=Y($({},e),{SDKVersion:n})),e},Sa=Ie(Ia,{implement:Ta}),Ra=Ie(wa,{implement:()=>Y($({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});to.registerCommand("API.env",Ra);to.registerCommand("API.getSystemInfoSync",Sa);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});K();Ke();_e();we();var Aa="onJoliboxShow",ka="onJoliboxHide",xa="onReady",Pr=ae(),Dr=Sn(ue),Cr=!0,Ge=!0,St=0,Rt=Ir;function Ca(){let e=Date.now();if(e-St<100)return;St=e;let t=document.visibilityState==="visible";t!==Cr&&(Cr=t,Rt.emit("visible",Cr))}function ro(e){let t=Date.now();t-St<100||(St=t,e==="focus"&&!Ge?Ge=!0:e==="blur"&&Ge&&(Ge=!1),Rt.emit("visible",Ge))}document.addEventListener("visibilitychange",Ca);window.addEventListener("focus",()=>ro("focus"));window.addEventListener("blur",()=>ro("blur"));var Pa=Ie(Aa,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Rt.on("visible",r=>{r&&t()})}}),Da=Ie(ka,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Rt.on("visible",r=>{!r&&t()})}}),Oa=Ie(xa,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Ve.on("LifecycleEvent.onReady",r=>{t(r)})}});Pr.registerCommand("LifecycleSDK.onReady",Oa);Pr.registerCommand("LifecycleSDK.onJoliboxShow",Pa);Pr.registerCommand("LifecycleSDK.onJoliboxHide",Da);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ke();K();He();re();var io=ln(oo());var At=ae(),Lr=class{constructor(){this.httpClient=he.create({baseUrl:A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"});this.getGameId=()=>A.mpId;this.getItem=t=>F(this,null,function*(){let{code:r,data:n,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),u=n==null?void 0:n.value,f=a;return r!=="SUCCESS"&&(u=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",u),f+="fallback to localstorage"),{code:r,message:f,data:u&&u!=="undefined"?u:null}});this.setItem=(t,r)=>F(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:a,message:u}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:a,message:u}});this.removeItem=t=>F(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>F(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=io.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},kt=new Lr,La=se("getLocalStorage",{paramsSchema:k.tuple(k.string()),implement(e){return F(this,null,function*(){return yield kt.getItem(e)})}});At.registerCommand("StorageSDK.getItem",La);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Na=se("setStorage",{paramsSchema:k.tuple(k.string(),k.or(k.string(),k.boolean(),k.number())),implement(e,t){return F(this,null,function*(){return yield kt.setItem(e,t)})}});At.registerCommand("StorageSDK.setItem",Na);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Fa=se("removeStorage",{paramsSchema:k.tuple(k.string()),implement(e){return F(this,null,function*(){return yield kt.removeItem(e)})}});At.registerCommand("StorageSDK.removeItem",Fa);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Ua=se("clearStorage",{implement(){return F(this,null,function*(){return yield kt.clear()})}});At.registerCommand("StorageSDK.clear",Ua);Q("storage.clear",{version:"1.0.0"});var tl=ln(ao());var xt=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};var Ct=class{constructor(t,r,n,a){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let a=this.checkShouldBanHighFreq(t);if(a)return a;let u=this.checkShouldBanForTime(t);return u?{reason:u}:{reason:"ALLOWED"}};var g,I,P,D,x,C,V;let u=(g=a==null?void 0:a.maxAllowedAdsForTime)!=null?g:8,f=(I=a==null?void 0:a.banForTimeThreshold)!=null?I:6e4,m=(P=a==null?void 0:a.bannedReleaseTime)!=null?P:6e4,p=(D=a==null?void 0:a.maxAllowedAdsForSession)!=null?D:200,E=(x=a==null?void 0:a.banForSessionThreshold)!=null?x:6e5,y=(C=a==null?void 0:a.initialThreshold)!=null?C:2e3,S=(V=a==null?void 0:a.highFreqThreshold)!=null?V:2e3;this.checkShouldBanInitial=Ja(y),this.checkShouldBanHighFreq=Wa(S),this.checkShouldBanForTime=Ga(u,f,m),this.checkShouldBanForSession=Ka(p,E)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Ka=(e,t)=>{let r=!1,n=[];return u=>{if(r)return"BANNED_FOR_SESSION";let f=Date.now();if(n=n.concat({timestamp:f,type:u}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&f-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Ga=(e,t,r)=>{let n=null,a=y=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{p.value=!1,n=null},y)},u="jolibox-sdk-ads-callbreak-timestamps",f="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var y;try{let S=JSON.parse((y=window.__joliboxLocalStorage__.getItem(u))!=null?y:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(y){try{window.__joliboxLocalStorage__.setItem(u,JSON.stringify(y))}catch(S){}this._records=y}},p={_record:!1,init(){var y;try{let S=JSON.parse((y=window.__joliboxLocalStorage__.getItem(f))!=null?y:"false");typeof S=="boolean"&&(this._record=S)}catch(S){this._record=!1}if(this._record){let S=m.values[m.values.length-1],g=S?Date.now()-S.timestamp:r;g<=r&&g>0?a(g):this._record=!1}},get value(){return this._record},set value(y){try{window.__joliboxLocalStorage__.setItem(f,JSON.stringify(y))}catch(S){}this._record=y}};return m.init(),p.init(),y=>{if(p.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:y}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&S-m.values[0].timestamp<=t))return p.value=!0,a(r),"BANNED_FOR_TIME"}},Ja=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Wa=(e=2e3)=>{let t=0,r=null;return a=>{if(a==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}};re();re();var Pt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return F(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let a=(r=A.channel)!=null?r:"",u=this.configs[a],f=(n=u==null?void 0:u.interstitialRate)!=null?n:1;t=Math.random()<f}return this.firstRun=!1,t}};K();var Ce=new be,Dt=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>A.mpId;this.getTestAdsMode=()=>A.testAdsMode;this.asyncLoad=()=>F(this,null,function*(){var f,m,p,E,y;let t="ca-pub-7171363994453626",r,n,a=window.encodeURIComponent(window.btoa((f=this.getGameId())!=null?f:"")),u=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:a,testAdsMode:`${u}`}});t=(p=S.data)==null?void 0:p.clientId,r=(E=S.data)==null?void 0:E.channelId,n=(y=S.data)==null?void 0:y.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>F(this,null,function*(){var a;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(a=this.getTestAdsMode())!=null?a:!1;if(!document.getElementById(r)&&this.clientId){let u=document.createElement("script");u.id=r,u.async=!0,u.crossOrigin="anonymous",u.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&u.setAttribute("data-adbreak-test","on"),this.channelId&&u.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(u),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{let r=!1,n=t.adBreakDone,a=f=>{var m;r=!0,this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:f.breakType,breakName:(m=f.breakName)!=null?m:"",breakFormat:f.breakFormat,breakStatus:f.breakStatus}),n&&n(f)};if(t.adBreakDone=a,t.type==="reward"){let f=t.beforeReward,m=E=>()=>{this.track("CallShowAdFn",null),E()},p=E=>{r=!0,f&&f(m(E))};t.beforeReward=p,window.setTimeout(()=>{var E,y;r||(this.track("CallAdBreakTimeout",{type:t.type}),(y=t.adBreakDone)==null||y.call(t,{breakType:t.type,breakName:(E=t.name)!=null?E:"",breakFormat:"reward",breakStatus:"timeout"}))},1e4)}if((f=>f.type==="preroll")(t)){Ce.emit("isAdShowing",!0);let f=t.adBreakDone,m=p=>{Ce.emit("isAdShowing",!1),f&&f(p)};return Y($({},t),{adBreakDone:m})}else{let f=t.beforeAd,m=t.afterAd,p=()=>{var y;r=!0,Ce.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(y=t.name)!=null?y:""}),f&&f()},E=()=>{var y;r=!0,Ce.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(y=t.name)!=null?y:""}),m&&m()};return Y($({},t),{beforeAd:p,afterAd:E})}};this.adConfig=t=>{let a=t,{onReady:r}=a,n=cn(a,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var m,p,E,y,S,g;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(E=t.adBreakDone)==null||E.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(S=t.adBreakDone)==null||S.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((y=n==null?void 0:n.count)!=null?y:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let a=t.type,u;switch(a){case"preroll":u={type:a};break;case"start":case"pause":case"next":case"browse":case"reward":u={type:a,name:(g=t.name)!=null?g:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",u);let f=this.wrapAdBreakParams(t);this.push(f),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>F(this,null,function*(){var g,I,P,D;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(P=t.fullWidthResponsive)!=null?P:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:a,fullWidthResponsive:u,style:f}=t,m;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?m=document.querySelector(r):m=r,!m)throw new Error("targeting element not found");let p=n;if(p||(p=this.unitId),!p)throw new Error("slot is required");let E=typeof a=="object"&&Array.isArray(a)?a.join(", "):a,y=document.createElement("ins");if(y.className="adsbygoogle",y.id="jolibox-ads",y.style.display="block",y.setAttribute("data-ad-client",this.clientId),y.setAttribute("data-ad-slot",p),E&&y.setAttribute("data-ad-format",E),u&&y.setAttribute("data-full-width-responsive",u),f&&y.setAttribute("style",f),(D=this.getTestAdsMode())!=null?D:!1){let x=document.createElement("div");x.style.position="absolute",x.style.top="0",x.style.left="0",x.style.width="100%",x.style.height="100%",x.style.display="flex",x.style.justifyContent="center",x.style.alignItems="center",x.style.backgroundColor="rgba(0, 0, 0, 0.5)",x.style.color="white",x.innerHTML="Test Ad",y.style.position="relative",m.appendChild(y),y.appendChild(x)}else m.appendChild(y),new MutationObserver(C=>{C.forEach(V=>{if(V.type==="attributes"&&V.attributeName==="data-ad-status"){let U=y.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:U!=null?U:"null"})}})}).observe(y,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Ct(t,r,n),this.adsActionDetection=new xt(this.track),this.channelPolicy=new Pt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}};we();K();He();var so=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};var Ot=ae(),qa=he.create(),Lt=new Dt(de,qa,()=>he.getNetworkStatus());Ce.on("isAdShowing",e=>{so("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Ot.registerCommand("AdsSDK.init",e=>{Lt.init(e)});Ot.registerCommand("AdsSDK.adConfig",e=>{Lt.adConfig(e)});Ot.registerCommand("AdsSDK.adBreak",e=>{Lt.adBreak(e)});Ot.registerCommand("AdsSDK.adUnit",e=>{Lt.adUnit(e)});K();we();var po=-1,Ft=function(e){addEventListener("pageshow",function(t){t.persisted&&(po=t.timeStamp,e(t))},!0)},Fr=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Ut=function(){var e=Fr();return e&&e.activationStart||0},De=function(e,t){var r=Fr(),n="navigate";return po>=0?n="back-forward-cache":r&&(document.prerendering||Ut()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},ho=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(a){}},Oe=function(e,t,r,n){var a,u;return function(f){t.value>=0&&(f||n)&&((u=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=u,t.rating=function(m,p){return m>p[1]?"poor":m>p[0]?"needs-improvement":"good"}(t.value,r),e(t))}},go=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},vo=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},yo=function(e){var t=!1;return function(){t||(e(),t=!0)}},Pe=-1,co=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Nt=function(e){document.visibilityState==="hidden"&&Pe>-1&&(Pe=e.type==="visibilitychange"?e.timeStamp:0,za())},uo=function(){addEventListener("visibilitychange",Nt,!0),addEventListener("prerenderingchange",Nt,!0)},za=function(){removeEventListener("visibilitychange",Nt,!0),removeEventListener("prerenderingchange",Nt,!0)},bo=function(){return Pe<0&&(Pe=co(),uo(),Ft(function(){setTimeout(function(){Pe=co(),uo()},0)})),{get firstHiddenTime(){return Pe}}},Ur=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},lo=[1800,3e3],_o=function(e,t){t=t||{},Ur(function(){var r,n=bo(),a=De("FCP"),u=ho("paint",function(f){f.forEach(function(m){m.name==="first-contentful-paint"&&(u.disconnect(),m.startTime<n.firstHiddenTime&&(a.value=Math.max(m.startTime-Ut(),0),a.entries.push(m),r(!0)))})});u&&(r=Oe(e,a,lo,t.reportAllChanges),Ft(function(f){a=De("FCP"),r=Oe(e,a,lo,t.reportAllChanges),go(function(){a.value=performance.now()-f.timeStamp,r(!0)})}))})};var Ya=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=yo(e),document.visibilityState==="hidden"?e():(r=t(e),vo(e)),r};var fo=[2500,4e3],Nr={},Eo=function(e,t){t=t||{},Ur(function(){var r,n=bo(),a=De("LCP"),u=function(p){t.reportAllChanges||(p=p.slice(-1)),p.forEach(function(E){E.startTime<n.firstHiddenTime&&(a.value=Math.max(E.startTime-Ut(),0),a.entries=[E],r())})},f=ho("largest-contentful-paint",u);if(f){r=Oe(e,a,fo,t.reportAllChanges);var m=yo(function(){Nr[a.id]||(u(f.takeRecords()),f.disconnect(),Nr[a.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return Ya(m)},{once:!0,capture:!0})}),vo(m),Ft(function(p){a=De("LCP"),r=Oe(e,a,fo,t.reportAllChanges),go(function(){a.value=performance.now()-p.timeStamp,Nr[a.id]=!0,r(!0)})})}})},mo=[800,1800],Qa=function e(t){document.prerendering?Ur(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},wo=function(e,t){t=t||{};var r=De("TTFB"),n=Oe(e,r,mo,t.reportAllChanges);Qa(function(){var a=Fr();a&&(r.value=Math.max(a.responseStart-Ut(),0),r.entries=[a],n(!0),Ft(function(){r=De("TTFB",0),(n=Oe(e,r,mo,t.reportAllChanges))(!0)}))})};re();function Xa(){_o(e=>{de("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Eo(e=>{de("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),wo(e=>{de("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Za(){Ve.on("onDocumentReady",e=>{Ve.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function Io(){Za(),Xa()}Io();
|
|
3
|
+
`);throw e.errors.length=0,Tr(!1),new TypeError(n)}}var k,xr=G(()=>{"use strict";Ar();Ar();k={object(e){return new yt(e)},array(e){return new gt(e)},tuple(...e){return new Et(...e)},literal(e){return new bt(e)},or(...e){return new _t(...e)},symbol(){return new dt},record(e){return new vt(e)},function(){return new pt},boolean(){return new ut},string(){return new lt},number(){return new ct},undefined(){return new ft},null(){return new mt},unknown(){return new ke},any(){return new ke},as(){return new ke},arraybuffer(){return new wt},enum(...e){return new ht(...e)},typedarray(e){return new It(e)}}});var Tt,Zn,eo=G(()=>{"use strict";K();_e();xr();vr();Tt=1,Zn=e=>{function t(n,a){return(...u)=>{var S,g,I,P;let f=Date.now(),m={method:n,trace_id:Tt};Tt+=1;let p="SUCCESS",E=`${n}:ok`,y=0;try{if(a.paramsSchema)try{kr(a.paramsSchema,u,"params")}catch(V){throw gr(`${n}:fail ${V.message}`)}let D=a.implement(...u),x=D,C=`${n}:ok`;if(D&&"code"in D){let{code:V,data:U,message:ee}=D;p=V,x=U,C=ee}return{code:p,message:C,data:x}}catch(D){let x=D;y=(g=(S=x.code)!=null?S:x.errNo)!=null?g:2e3,p="FAILURE";let C=(P=(I=x.message)!=null?I:x.errMsg)!=null?P:`${D}`;return E=`${n}:${p} ${C.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new et(E,y)),{code:p,message:E}}finally{let D=Date.now()-f;e("apiInvoked",Y($({},m),{duration:D,status:p}))}}}function r(n,a){return(...u)=>F(this,null,function*(){var g,I,P,D;let f=vn(u)?u:[u],m=Date.now(),p={method:n,trace_id:Tt};Tt+=1;let E=`${n}:ok`,y="SUCCESS",S={code:y,message:E};try{if(a.paramsSchema)try{kr(a.paramsSchema,f,"params")}catch(V){throw gr(V.message)}let C=yield a.implement(...f);if(C&&"code"in C){let{code:V,data:U,message:ee}=C;y=V,E=ee,C=U}return Object.assign(S,{code:y,message:E,data:C}),S}catch(x){let C=x,V=(I=(g=C.code)!=null?g:C.errNo)!=null?I:2e3;y="FAILURE";let U=(D=(P=C.message)!=null?P:C.errMsg)!=null?D:`${x}`,ee=`${n}:${y} ${U.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:y,message:ee}),ue(new et(ee,V)),S}finally{let x=Date.now()-m;e("apiInvoked",Y($({},p),{duration:x,status:y}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Ie,Q,Ke=G(()=>{"use strict";Qn();we();eo();xr();({createAPI:se,createSyncAPI:Ie}=Zn(de)),Q=Yn("h5")});var oo=un((no,Or)=>{(function(e){if(typeof no=="object"&&typeof Or!="undefined")Or.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(a,u,f){function m(y,S){if(!u[y]){if(!a[y]){var g=typeof Ue=="function"&&Ue;if(!S&&g)return g(y,!0);if(p)return p(y,!0);var I=new Error("Cannot find module '"+y+"'");throw I.code="MODULE_NOT_FOUND",I}var P=u[y]={exports:{}};a[y][0].call(P.exports,function(D){var x=a[y][1][D];return m(x||D)},P,P.exports,n,a,u,f)}return u[y].exports}for(var p=typeof Ue=="function"&&Ue,E=0;E<f.length;E++)m(f[E]);return m}({1:[function(n,a,u){(function(f){"use strict";var m=f.MutationObserver||f.WebKitMutationObserver,p;if(m){var E=0,y=new m(D),S=f.document.createTextNode("");y.observe(S,{characterData:!0}),p=function(){S.data=E=++E%2}}else if(!f.setImmediate&&typeof f.MessageChannel!="undefined"){var g=new f.MessageChannel;g.port1.onmessage=D,p=function(){g.port2.postMessage(0)}}else"document"in f&&"onreadystatechange"in f.document.createElement("script")?p=function(){var C=f.document.createElement("script");C.onreadystatechange=function(){D(),C.onreadystatechange=null,C.parentNode.removeChild(C),C=null},f.document.documentElement.appendChild(C)}:p=function(){setTimeout(D,0)};var I,P=[];function D(){I=!0;for(var C,V,U=P.length;U;){for(V=P,P=[],C=-1;++C<U;)V[C]();U=P.length}I=!1}a.exports=x;function x(C){P.push(C)===1&&!I&&p()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,a,u){"use strict";var f=n(1);function m(){}var p={},E=["REJECTED"],y=["FULFILLED"],S=["PENDING"];a.exports=g;function g(T){if(typeof T!="function")throw new TypeError("resolver must be a function");this.state=S,this.queue=[],this.outcome=void 0,T!==m&&x(this,T)}g.prototype.catch=function(T){return this.then(null,T)},g.prototype.then=function(T,N){if(typeof T!="function"&&this.state===y||typeof N!="function"&&this.state===E)return this;var L=new this.constructor(m);if(this.state!==S){var H=this.state===y?T:N;P(L,H,this.outcome)}else this.queue.push(new I(L,T,N));return L};function I(T,N,L){this.promise=T,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(T){p.resolve(this.promise,T)},I.prototype.otherCallFulfilled=function(T){P(this.promise,this.onFulfilled,T)},I.prototype.callRejected=function(T){p.reject(this.promise,T)},I.prototype.otherCallRejected=function(T){P(this.promise,this.onRejected,T)};function P(T,N,L){f(function(){var H;try{H=N(L)}catch(X){return p.reject(T,X)}H===T?p.reject(T,new TypeError("Cannot resolve promise with itself")):p.resolve(T,H)})}p.resolve=function(T,N){var L=C(D,N);if(L.status==="error")return p.reject(T,L.value);var H=L.value;if(H)x(T,H);else{T.state=y,T.outcome=N;for(var X=-1,te=T.queue.length;++X<te;)T.queue[X].callFulfilled(N)}return T},p.reject=function(T,N){T.state=E,T.outcome=N;for(var L=-1,H=T.queue.length;++L<H;)T.queue[L].callRejected(N);return T};function D(T){var N=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof N=="function")return function(){N.apply(T,arguments)}}function x(T,N){var L=!1;function H(oe){L||(L=!0,p.reject(T,oe))}function X(oe){L||(L=!0,p.resolve(T,oe))}function te(){N(X,H)}var ne=C(te);ne.status==="error"&&H(ne.value)}function C(T,N){var L={};try{L.value=T(N),L.status="success"}catch(H){L.status="error",L.value=H}return L}g.resolve=V;function V(T){return T instanceof this?T:p.resolve(new this(m),T)}g.reject=U;function U(T){var N=new this(m);return p.reject(N,T)}g.all=ee;function ee(T){var N=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,H=!1;if(!L)return this.resolve([]);for(var X=new Array(L),te=0,ne=-1,oe=new this(m);++ne<L;)fe(T[ne],ne);return oe;function fe(Le,Je){N.resolve(Le).then(Bt,function(Se){H||(H=!0,p.reject(oe,Se))});function Bt(Se){X[Je]=Se,++te===L&&!H&&(H=!0,p.resolve(oe,X))}}}g.race=B;function B(T){var N=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,H=!1;if(!L)return this.resolve([]);for(var X=-1,te=new this(m);++X<L;)ne(T[X]);return te;function ne(oe){N.resolve(oe).then(function(fe){H||(H=!0,p.resolve(te,fe))},function(fe){H||(H=!0,p.reject(te,fe))})}}},{1:1}],3:[function(n,a,u){(function(f){"use strict";typeof f.Promise!="function"&&(f.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,a,u){"use strict";var f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function m(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}function p(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(o){return}}var E=p();function y(){try{if(!E||!E.open)return!1;var o=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),s=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||s)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function S(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<o.length;d+=1)l.append(o[d]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function I(o,s){s&&o.then(function(i){s(null,i)},function(i){s(i)})}function P(o,s,i){typeof s=="function"&&o.then(s),typeof i=="function"&&o.catch(i)}function D(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function x(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var C="local-forage-detect-blob-support",V=void 0,U={},ee=Object.prototype.toString,B="readonly",T="readwrite";function N(o){for(var s=o.length,i=new ArrayBuffer(s),l=new Uint8Array(i),d=0;d<s;d++)l[d]=o.charCodeAt(d);return i}function L(o){return new g(function(s){var i=o.transaction(C,T),l=S([""]);i.objectStore(C).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),s(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);s(c||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function H(o){return typeof V=="boolean"?g.resolve(V):L(o).then(function(s){return V=s,V})}function X(o){var s=U[o.name],i={};i.promise=new g(function(l,d){i.resolve=l,i.reject=d}),s.deferredOperations.push(i),s.dbReady?s.dbReady=s.dbReady.then(function(){return i.promise}):s.dbReady=i.promise}function te(o){var s=U[o.name],i=s.deferredOperations.pop();if(i)return i.resolve(),i.promise}function ne(o,s){var i=U[o.name],l=i.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(o,s){return new g(function(i,l){if(U[o.name]=U[o.name]||Mr(),o.db)if(s)X(o),o.db.close();else return i(o.db);var d=[o.name];s&&d.push(o.version);var c=E.open.apply(E,d);s&&(c.onupgradeneeded=function(h){var v=c.result;try{v.createObjectStore(o.storeName),h.oldVersion<=1&&v.createObjectStore(C)}catch(b){if(b.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw b}}),c.onerror=function(h){h.preventDefault(),l(c.error)},c.onsuccess=function(){var h=c.result;h.onversionchange=function(v){v.target.close()},i(h),te(o)}})}function fe(o){return oe(o,!1)}function Le(o){return oe(o,!0)}function Je(o,s){if(!o.db)return!0;var i=!o.db.objectStoreNames.contains(o.storeName),l=o.version<o.db.version,d=o.version>o.db.version;if(l&&(o.version!==s&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),d||i){if(i){var c=o.db.version+1;c>o.version&&(o.version=c)}return!0}return!1}function Bt(o){return new g(function(s,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var c=btoa(d.target.result||"");s({__local_forage_encoded_blob:!0,data:c,type:o.type})},l.readAsBinaryString(o)})}function Se(o){var s=N(atob(o.data));return S([s],{type:o.type})}function Br(o){return o&&o.__local_forage_encoded_blob}function To(o){var s=this,i=s._initReady().then(function(){var l=U[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return P(i,o,o),i}function So(o){X(o);for(var s=U[o.name],i=s.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return o.db=null,fe(o).then(function(c){return o.db=c,Je(o)?Le(o):c}).then(function(c){o.db=s.db=c;for(var h=0;h<i.length;h++)i[h]._dbInfo.db=c}).catch(function(c){throw ne(o,c),c})}function me(o,s,i,l){l===void 0&&(l=1);try{var d=o.db.transaction(o.storeName,s);i(null,d)}catch(c){if(l>0&&(!o.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||c.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Le(o)}).then(function(){return So(o).then(function(){me(o,s,i,l-1)})}).catch(i);i(c)}}function Mr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ro(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=o[l];var d=U[i.name];d||(d=Mr(),U[i.name]=d),d.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=To);var c=[];function h(){return g.resolve()}for(var v=0;v<d.forages.length;v++){var b=d.forages[v];b!==s&&c.push(b._initReady().catch(h))}var _=d.forages.slice(0);return g.all(c).then(function(){return i.db=d.db,fe(i)}).then(function(w){return i.db=w,Je(i,s._defaultConfig.version)?Le(i):w}).then(function(w){i.db=d.db=w,s._dbInfo=i;for(var R=0;R<_.length;R++){var O=_[R];O!==s&&(O._dbInfo.db=i.db,O._dbInfo.version=i.version)}})}function Ao(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.get(o);_.onsuccess=function(){var w=_.result;w===void 0&&(w=null),Br(w)&&(w=Se(w)),d(w)},_.onerror=function(){c(_.error)}}catch(w){c(w)}})}).catch(c)});return I(l,s),l}function ko(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.openCursor(),w=1;_.onsuccess=function(){var R=_.result;if(R){var O=R.value;Br(O)&&(O=Se(O));var M=o(O,R.key,w++);M!==void 0?d(M):R.continue()}else d()},_.onerror=function(){c(_.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function xo(o,s,i){var l=this;o=D(o);var d=new g(function(c,h){var v;l.ready().then(function(){return v=l._dbInfo,ee.call(s)==="[object Blob]"?H(v.db).then(function(b){return b?s:Bt(s)}):s}).then(function(b){me(l._dbInfo,T,function(_,w){if(_)return h(_);try{var R=w.objectStore(l._dbInfo.storeName);b===null&&(b=void 0);var O=R.put(b,o);w.oncomplete=function(){b===void 0&&(b=null),c(b)},w.onabort=w.onerror=function(){var M=O.error?O.error:O.transaction.error;h(M)}}catch(M){h(M)}})}).catch(h)});return I(d,i),d}function Co(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,T,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.delete(o);v.oncomplete=function(){d()},v.onerror=function(){c(_.error)},v.onabort=function(){var w=_.error?_.error:_.transaction.error;c(w)}}catch(w){c(w)}})}).catch(c)});return I(l,s),l}function Po(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,T,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),b=v.clear();h.oncomplete=function(){l()},h.onabort=h.onerror=function(){var _=b.error?b.error:b.transaction.error;d(_)}}catch(_){d(_)}})}).catch(d)});return I(i,o),i}function Do(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,B,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),b=v.count();b.onsuccess=function(){l(b.result)},b.onerror=function(){d(b.error)}}catch(_){d(_)}})}).catch(d)});return I(i,o),i}function Oo(o,s){var i=this,l=new g(function(d,c){if(o<0){d(null);return}i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return c(h);try{var b=v.objectStore(i._dbInfo.storeName),_=!1,w=b.openKeyCursor();w.onsuccess=function(){var R=w.result;if(!R){d(null);return}o===0||_?d(R.key):(_=!0,R.advance(o))},w.onerror=function(){c(w.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function Lo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,B,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),b=v.openKeyCursor(),_=[];b.onsuccess=function(){var w=b.result;if(!w){l(_);return}_.push(w.key),w.continue()},b.onerror=function(){d(b.error)}}catch(w){d(w)}})}).catch(d)});return I(i,o),i}function No(o,s){s=x.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;if(!o.name)d=g.reject("Invalid arguments");else{var c=o.name===i.name&&l._dbInfo.db,h=c?g.resolve(l._dbInfo.db):fe(o).then(function(v){var b=U[o.name],_=b.forages;b.db=v;for(var w=0;w<_.length;w++)_[w]._dbInfo.db=v;return v});o.storeName?d=h.then(function(v){if(v.objectStoreNames.contains(o.storeName)){var b=v.version+1;X(o);var _=U[o.name],w=_.forages;v.close();for(var R=0;R<w.length;R++){var O=w[R];O._dbInfo.db=null,O._dbInfo.version=b}var M=new g(function(j,q){var W=E.open(o.name,b);W.onerror=function(ie){var Fe=W.result;Fe.close(),q(ie)},W.onupgradeneeded=function(){var ie=W.result;ie.deleteObjectStore(o.storeName)},W.onsuccess=function(){var ie=W.result;ie.close(),j(ie)}});return M.then(function(j){_.db=j;for(var q=0;q<w.length;q++){var W=w[q];W._dbInfo.db=j,te(W._dbInfo)}}).catch(function(j){throw(ne(o,j)||g.resolve()).catch(function(){}),j})}}):d=h.then(function(v){X(o);var b=U[o.name],_=b.forages;v.close();for(var w=0;w<_.length;w++){var R=_[w];R._dbInfo.db=null}var O=new g(function(M,j){var q=E.deleteDatabase(o.name);q.onerror=function(){var W=q.result;W&&W.close(),j(q.error)},q.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},q.onsuccess=function(){var W=q.result;W&&W.close(),M(W)}});return O.then(function(M){b.db=M;for(var j=0;j<_.length;j++){var q=_[j];te(q._dbInfo)}}).catch(function(M){throw(ne(o,M)||g.resolve()).catch(function(){}),M})})}return I(d,s),d}var Fo={_driver:"asyncStorage",_initStorage:Ro,_support:y(),iterate:ko,getItem:Ao,setItem:xo,removeItem:Co,clear:Po,length:Do,key:Oo,keys:Lo,dropInstance:No};function Uo(){return typeof openDatabase=="function"}var ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bo="~~local_forage_type~",jr=/^~~local_forage_type~([^~]+)~/,We="__lfsc__:",Mt=We.length,jt="arbf",$t="blob",$r="si08",Vr="ui08",Hr="uic8",Kr="si16",Gr="si32",Jr="ur16",Wr="ui32",qr="fl32",zr="fl64",Yr=Mt+jt.length,Qr=Object.prototype.toString;function Xr(o){var s=o.length*.75,i=o.length,l,d=0,c,h,v,b;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var _=new ArrayBuffer(s),w=new Uint8Array(_);for(l=0;l<i;l+=4)c=ve.indexOf(o[l]),h=ve.indexOf(o[l+1]),v=ve.indexOf(o[l+2]),b=ve.indexOf(o[l+3]),w[d++]=c<<2|h>>4,w[d++]=(h&15)<<4|v>>2,w[d++]=(v&3)<<6|b&63;return _}function Vt(o){var s=new Uint8Array(o),i="",l;for(l=0;l<s.length;l+=3)i+=ve[s[l]>>2],i+=ve[(s[l]&3)<<4|s[l+1]>>4],i+=ve[(s[l+1]&15)<<2|s[l+2]>>6],i+=ve[s[l+2]&63];return s.length%3===2?i=i.substring(0,i.length-1)+"=":s.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function Mo(o,s){var i="";if(o&&(i=Qr.call(o)),o&&(i==="[object ArrayBuffer]"||o.buffer&&Qr.call(o.buffer)==="[object ArrayBuffer]")){var l,d=We;o instanceof ArrayBuffer?(l=o,d+=jt):(l=o.buffer,i==="[object Int8Array]"?d+=$r:i==="[object Uint8Array]"?d+=Vr:i==="[object Uint8ClampedArray]"?d+=Hr:i==="[object Int16Array]"?d+=Kr:i==="[object Uint16Array]"?d+=Jr:i==="[object Int32Array]"?d+=Gr:i==="[object Uint32Array]"?d+=Wr:i==="[object Float32Array]"?d+=qr:i==="[object Float64Array]"?d+=zr:s(new Error("Failed to get type for BinaryArray"))),s(d+Vt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var h=Bo+o.type+"~"+Vt(this.result);s(We+$t+h)},c.readAsArrayBuffer(o)}else try{s(JSON.stringify(o))}catch(h){console.error("Couldn't convert value into a JSON string: ",o),s(null,h)}}function jo(o){if(o.substring(0,Mt)!==We)return JSON.parse(o);var s=o.substring(Yr),i=o.substring(Mt,Yr),l;if(i===$t&&jr.test(s)){var d=s.match(jr);l=d[1],s=s.substring(d[0].length)}var c=Xr(s);switch(i){case jt:return c;case $t:return S([c],{type:l});case $r:return new Int8Array(c);case Vr:return new Uint8Array(c);case Hr:return new Uint8ClampedArray(c);case Kr:return new Int16Array(c);case Jr:return new Uint16Array(c);case Gr:return new Int32Array(c);case Wr:return new Uint32Array(c);case qr:return new Float32Array(c);case zr:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var Ht={serialize:Mo,deserialize:jo,stringToBuffer:Xr,bufferToString:Vt};function Zr(o,s,i,l){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function $o(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=typeof o[l]!="string"?o[l].toString():o[l];var d=new g(function(c,h){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(v){return h(v)}i.db.transaction(function(v){Zr(v,i,function(){s._dbInfo=i,c()},function(b,_){h(_)})},h)});return i.serializer=Ht,d}function ye(o,s,i,l,d,c){o.executeSql(i,l,d,function(h,v){v.code===v.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(b,_){_.rows.length?c(b,v):Zr(b,s,function(){b.executeSql(i,l,d,c)},c)},c):c(h,v)},c)}function Vo(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[o],function(b,_){var w=_.rows.length?_.rows.item(0).value:null;w&&(w=h.serializer.deserialize(w)),d(w)},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function Ho(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT * FROM "+h.storeName,[],function(b,_){for(var w=_.rows,R=w.length,O=0;O<R;O++){var M=w.item(O),j=M.value;if(j&&(j=h.serializer.deserialize(j)),j=o(j,M.key,O+1),j!==void 0){d(j);return}}d()},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function en(o,s,i,l){var d=this;o=D(o);var c=new g(function(h,v){d.ready().then(function(){s===void 0&&(s=null);var b=s,_=d._dbInfo;_.serializer.serialize(s,function(w,R){R?v(R):_.db.transaction(function(O){ye(O,_,"INSERT OR REPLACE INTO "+_.storeName+" (key, value) VALUES (?, ?)",[o,w],function(){h(b)},function(M,j){v(j)})},function(O){if(O.code===O.QUOTA_ERR){if(l>0){h(en.apply(d,[o,b,i,l-1]));return}v(O)}})})}).catch(v)});return I(c,i),c}function Ko(o,s,i){return en.apply(this,[o,s,i,1])}function Go(o,s){var i=this;o=D(o);var l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[o],function(){d()},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function Jo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){ye(h,c,"DELETE FROM "+c.storeName,[],function(){l()},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function Wo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){ye(h,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(v,b){var _=b.rows.item(0).c;l(_)},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function qo(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[o+1],function(b,_){var w=_.rows.length?_.rows.item(0).key:null;d(w)},function(b,_){c(_)})})}).catch(c)});return I(l,s),l}function zo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){ye(h,c,"SELECT key FROM "+c.storeName,[],function(v,b){for(var _=[],w=0;w<b.rows.length;w++)_.push(b.rows.item(w).key);l(_)},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function Yo(o){return new g(function(s,i){o.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var h=[],v=0;v<c.rows.length;v++)h.push(c.rows.item(v).name);s({db:o,storeNames:h})},function(d,c){i(c)})},function(l){i(l)})})}function Qo(o,s){s=x.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;return o.name?d=new g(function(c){var h;o.name===i.name?h=l._dbInfo.db:h=openDatabase(o.name,"","",0),o.storeName?c({db:h,storeNames:[o.storeName]}):c(Yo(h))}).then(function(c){return new g(function(h,v){c.db.transaction(function(b){function _(M){return new g(function(j,q){b.executeSql("DROP TABLE IF EXISTS "+M,[],function(){j()},function(W,ie){q(ie)})})}for(var w=[],R=0,O=c.storeNames.length;R<O;R++)w.push(_(c.storeNames[R]));g.all(w).then(function(){h()}).catch(function(M){v(M)})},function(b){v(b)})})}):d=g.reject("Invalid arguments"),I(d,s),d}var Xo={_driver:"webSQLStorage",_initStorage:$o,_support:Uo(),iterate:Ho,getItem:Vo,setItem:Ko,removeItem:Go,clear:Jo,length:Wo,key:qo,keys:zo,dropInstance:Qo};function Zo(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function tn(o,s){var i=o.name+"/";return o.storeName!==s.storeName&&(i+=o.storeName+"/"),i}function ei(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function ti(){return!ei()||localStorage.length>0}function ri(o){var s=this,i={};if(o)for(var l in o)i[l]=o[l];return i.keyPrefix=tn(o,s._defaultConfig),ti()?(s._dbInfo=i,i.serializer=Ht,g.resolve()):g.reject()}function ni(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var c=localStorage.key(d);c.indexOf(l)===0&&localStorage.removeItem(c)}});return I(i,o),i}function oi(o,s){var i=this;o=D(o);var l=i.ready().then(function(){var d=i._dbInfo,c=localStorage.getItem(d.keyPrefix+o);return c&&(c=d.serializer.deserialize(c)),c});return I(l,s),l}function ii(o,s){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,h=c.length,v=localStorage.length,b=1,_=0;_<v;_++){var w=localStorage.key(_);if(w.indexOf(c)===0){var R=localStorage.getItem(w);if(R&&(R=d.serializer.deserialize(R)),R=o(R,w.substring(h),b++),R!==void 0)return R}}});return I(l,s),l}function ai(o,s){var i=this,l=i.ready().then(function(){var d=i._dbInfo,c;try{c=localStorage.key(o)}catch(h){c=null}return c&&(c=c.substring(d.keyPrefix.length)),c});return I(l,s),l}function si(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo,d=localStorage.length,c=[],h=0;h<d;h++){var v=localStorage.key(h);v.indexOf(l.keyPrefix)===0&&c.push(v.substring(l.keyPrefix.length))}return c});return I(i,o),i}function ci(o){var s=this,i=s.keys().then(function(l){return l.length});return I(i,o),i}function ui(o,s){var i=this;o=D(o);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+o)});return I(l,s),l}function li(o,s,i){var l=this;o=D(o);var d=l.ready().then(function(){s===void 0&&(s=null);var c=s;return new g(function(h,v){var b=l._dbInfo;b.serializer.serialize(s,function(_,w){if(w)v(w);else try{localStorage.setItem(b.keyPrefix+o,_),h(c)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&v(R),v(R)}})})});return I(d,i),d}function di(o,s){if(s=x.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var i=this.config();o.name=o.name||i.name,o.storeName=o.storeName||i.storeName}var l=this,d;return o.name?d=new g(function(c){o.storeName?c(tn(o,l._defaultConfig)):c(o.name+"/")}).then(function(c){for(var h=localStorage.length-1;h>=0;h--){var v=localStorage.key(h);v.indexOf(c)===0&&localStorage.removeItem(v)}}):d=g.reject("Invalid arguments"),I(d,s),d}var fi={_driver:"localStorageWrapper",_initStorage:ri,_support:Zo(),iterate:ii,getItem:oi,setItem:li,removeItem:ui,clear:ni,length:ci,key:ai,keys:si,dropInstance:di},mi=function(s,i){return s===i||typeof s=="number"&&typeof i=="number"&&isNaN(s)&&isNaN(i)},pi=function(s,i){for(var l=s.length,d=0;d<l;){if(mi(s[d],i))return!0;d++}return!1},rn=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Ne={},nn={},Re={INDEXEDDB:Fo,WEBSQL:Xo,LOCALSTORAGE:fi},hi=[Re.INDEXEDDB._driver,Re.WEBSQL._driver,Re.LOCALSTORAGE._driver],qe=["dropInstance"],Kt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(qe),gi={description:"",driver:hi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function vi(o,s){o[s]=function(){var i=arguments;return o.ready().then(function(){return o[s].apply(o,i)})}}function Gt(){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var i in s)s.hasOwnProperty(i)&&(rn(s[i])?arguments[0][i]=s[i].slice():arguments[0][i]=s[i])}return arguments[0]}var yi=function(){function o(s){m(this,o);for(var i in Re)if(Re.hasOwnProperty(i)){var l=Re[i],d=l._driver;this[i]=d,Ne[d]||this.defineDriver(l)}this._defaultConfig=Gt({},gi),this._config=Gt({},this._defaultConfig,s),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return o.prototype.config=function(i){if((typeof i=="undefined"?"undefined":f(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},o.prototype.defineDriver=function(i,l,d){var c=new g(function(h,v){try{var b=i._driver,_=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){v(_);return}for(var w=Kt.concat("_initStorage"),R=0,O=w.length;R<O;R++){var M=w[R],j=!pi(qe,M);if((j||i[M])&&typeof i[M]!="function"){v(_);return}}var q=function(){for(var Fe=function(Ei){return function(){var wi=new Error("Method "+Ei+" is not implemented by the current driver"),on=g.reject(wi);return I(on,arguments[arguments.length-1]),on}},Jt=0,_i=qe.length;Jt<_i;Jt++){var Wt=qe[Jt];i[Wt]||(i[Wt]=Fe(Wt))}};q();var W=function(Fe){Ne[b]&&console.info("Redefining LocalForage driver: "+b),Ne[b]=i,nn[b]=Fe,h()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(W,v):W(!!i._support):W(!0)}catch(ie){v(ie)}});return P(c,l,d),c},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(i,l,d){var c=Ne[i]?g.resolve(Ne[i]):g.reject(new Error("Driver not found."));return P(c,l,d),c},o.prototype.getSerializer=function(i){var l=g.resolve(Ht);return P(l,i),l},o.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return P(d,i,i),d},o.prototype.setDriver=function(i,l,d){var c=this;rn(i)||(i=[i]);var h=this._getSupportedDrivers(i);function v(){c._config.driver=c.driver()}function b(R){return c._extend(R),v(),c._ready=c._initStorage(c._config),c._ready}function _(R){return function(){var O=0;function M(){for(;O<R.length;){var j=R[O];return O++,c._dbInfo=null,c._ready=null,c.getDriver(j).then(b).catch(M)}v();var q=new Error("No available storage method found.");return c._driverSet=g.reject(q),c._driverSet}return M()}}var w=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=w.then(function(){var R=h[0];return c._dbInfo=null,c._ready=null,c.getDriver(R).then(function(O){c._driver=O._driver,v(),c._wrapLibraryMethodsWithReady(),c._initDriver=_(h)})}).catch(function(){v();var R=new Error("No available storage method found.");return c._driverSet=g.reject(R),c._driverSet}),P(this._driverSet,l,d),this._driverSet},o.prototype.supports=function(i){return!!nn[i]},o.prototype._extend=function(i){Gt(this,i)},o.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,c=i.length;d<c;d++){var h=i[d];this.supports(h)&&l.push(h)}return l},o.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=Kt.length;i<l;i++)vi(this,Kt[i])},o.prototype.createInstance=function(i){return new o(i)},o}(),bi=new yi;a.exports=bi},{3:3}]},{},[4])(4)})});var ao=un(Te=>{"use strict";K();Ke();we();var xe=ae(),Ba=se("levelFinished",{paramsSchema:k.tuple(k.string(),k.object({result:k.boolean(),duration:k.number()})),implement:(e,t)=>F(Te,null,function*(){let{result:r,duration:n}=t;ce.info("onLevelFinished",r,n),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:n})])})}),Ma=se("taskFinished",{paramsSchema:k.tuple(k.string(),k.object({duration:k.number()})),implement:(e,t)=>F(Te,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),ja=se("levelUpgrade",{paramsSchema:k.tuple(k.string(),k.string()),implement:(e,t)=>F(Te,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),$a=se("onHistoryUserLevel",{paramsSchema:k.tuple(k.number()),implement:e=>F(Te,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Va=se("onHistoryUserScore",{paramsSchema:k.tuple(k.number()),implement:e=>F(Te,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Ha=se("taskEvent",{paramsSchema:k.tuple(k.string(),k.object({tools:k.array(k.object({id:k.string(),name:k.string(),count:k.number(),description:k.string().optional(),price:k.object({amount:k.number(),unit:k.string()}).optional()})).optional(),awards:k.array(k.object({id:k.string(),name:k.string()})).optional()})),implement:(e,t)=>F(Te,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",$({taskId:e},t))]))})});xe.registerCommand("TaskTrackerSDK.levelFinished",Ba);xe.registerCommand("TaskTrackerSDK.taskFinished",Ma);xe.registerCommand("TaskTrackerSDK.levelUpgrade",ja);xe.registerCommand("TaskTrackerSDK.historyUserLevel",$a);xe.registerCommand("TaskTrackerSDK.historyUserScore",Va);xe.registerCommand("TaskTrackerSDK.taskEvent",Ha);Q("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Q("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Q("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Q("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});we();re();Ke();K();var to=ae(),wa="env",Ia="getSystemInfoSync",Ta=()=>{var a,u,f,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform,brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(a=A.hostInfo)==null?void 0:a.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(u=A.hostInfo)==null?void 0:u.version;t&&(e=Y($({},e),{version:t}));let r=(f=A.hostInfo)==null?void 0:f.appName;r&&(e=Y($({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=Y($({},e),{SDKVersion:n})),e},Sa=Ie(Ia,{implement:Ta}),Ra=Ie(wa,{implement:()=>Y($({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});to.registerCommand("API.env",Ra);to.registerCommand("API.getSystemInfoSync",Sa);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});K();Ke();_e();we();var Aa="onJoliboxShow",ka="onJoliboxHide",xa="onReady",Pr=ae(),Dr=Sn(ue),Cr=!0,Ge=!0,St=0,Rt=Ir;function Ca(){let e=Date.now();if(e-St<100)return;St=e;let t=document.visibilityState==="visible";t!==Cr&&(Cr=t,Rt.emit("visible",Cr))}function ro(e){let t=Date.now();t-St<100||(St=t,e==="focus"&&!Ge?Ge=!0:e==="blur"&&Ge&&(Ge=!1),Rt.emit("visible",Ge))}document.addEventListener("visibilitychange",Ca);window.addEventListener("focus",()=>ro("focus"));window.addEventListener("blur",()=>ro("blur"));var Pa=Ie(Aa,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Rt.on("visible",r=>{r&&t()})}}),Da=Ie(ka,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Rt.on("visible",r=>{!r&&t()})}}),Oa=Ie(xa,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Ve.on("LifecycleEvent.onReady",r=>{t(r)})}});Pr.registerCommand("LifecycleSDK.onReady",Oa);Pr.registerCommand("LifecycleSDK.onJoliboxShow",Pa);Pr.registerCommand("LifecycleSDK.onJoliboxHide",Da);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ke();K();He();re();var io=ln(oo());var At=ae(),Lr=class{constructor(){this.httpClient=he.create({baseUrl:A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"});this.getGameId=()=>A.mpId;this.getItem=t=>F(this,null,function*(){let{code:r,data:n,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),u=n==null?void 0:n.value,f=a;return r!=="SUCCESS"&&(u=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",u),f+="fallback to localstorage"),{code:r,message:f,data:u&&u!=="undefined"?u:null}});this.setItem=(t,r)=>F(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:a,message:u}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:a,message:u}});this.removeItem=t=>F(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>F(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=io.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},kt=new Lr,La=se("getLocalStorage",{paramsSchema:k.tuple(k.string()),implement(e){return F(this,null,function*(){return yield kt.getItem(e)})}});At.registerCommand("StorageSDK.getItem",La);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Na=se("setStorage",{paramsSchema:k.tuple(k.string(),k.or(k.string(),k.boolean(),k.number())),implement(e,t){return F(this,null,function*(){return yield kt.setItem(e,t)})}});At.registerCommand("StorageSDK.setItem",Na);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Fa=se("removeStorage",{paramsSchema:k.tuple(k.string()),implement(e){return F(this,null,function*(){return yield kt.removeItem(e)})}});At.registerCommand("StorageSDK.removeItem",Fa);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Ua=se("clearStorage",{implement(){return F(this,null,function*(){return yield kt.clear()})}});At.registerCommand("StorageSDK.clear",Ua);Q("storage.clear",{version:"1.0.0"});var tl=ln(ao());var xt=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};var Ct=class{constructor(t,r,n,a){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let a=this.checkShouldBanHighFreq(t);if(a)return a;let u=this.checkShouldBanForTime(t);return u?{reason:u}:{reason:"ALLOWED"}};var g,I,P,D,x,C,V;let u=(g=a==null?void 0:a.maxAllowedAdsForTime)!=null?g:8,f=(I=a==null?void 0:a.banForTimeThreshold)!=null?I:6e4,m=(P=a==null?void 0:a.bannedReleaseTime)!=null?P:6e4,p=(D=a==null?void 0:a.maxAllowedAdsForSession)!=null?D:200,E=(x=a==null?void 0:a.banForSessionThreshold)!=null?x:6e5,y=(C=a==null?void 0:a.initialThreshold)!=null?C:2e3,S=(V=a==null?void 0:a.highFreqThreshold)!=null?V:2e3;this.checkShouldBanInitial=Ja(y),this.checkShouldBanHighFreq=Wa(S),this.checkShouldBanForTime=Ga(u,f,m),this.checkShouldBanForSession=Ka(p,E)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Ka=(e,t)=>{let r=!1,n=[];return u=>{if(r)return"BANNED_FOR_SESSION";let f=Date.now();if(n=n.concat({timestamp:f,type:u}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&f-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Ga=(e,t,r)=>{let n=null,a=y=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{p.value=!1,n=null},y)},u="jolibox-sdk-ads-callbreak-timestamps",f="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var y;try{let S=JSON.parse((y=window.__joliboxLocalStorage__.getItem(u))!=null?y:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(y){try{window.__joliboxLocalStorage__.setItem(u,JSON.stringify(y))}catch(S){}this._records=y}},p={_record:!1,init(){var y;try{let S=JSON.parse((y=window.__joliboxLocalStorage__.getItem(f))!=null?y:"false");typeof S=="boolean"&&(this._record=S)}catch(S){this._record=!1}if(this._record){let S=m.values[m.values.length-1],g=S?Date.now()-S.timestamp:r;g<=r&&g>0?a(g):this._record=!1}},get value(){return this._record},set value(y){try{window.__joliboxLocalStorage__.setItem(f,JSON.stringify(y))}catch(S){}this._record=y}};return m.init(),p.init(),y=>{if(p.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:y}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&S-m.values[0].timestamp<=t))return p.value=!0,a(r),"BANNED_FOR_TIME"}},Ja=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Wa=(e=2e3)=>{let t=0,r=null;return a=>{if(a==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}};re();re();var Pt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return F(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let a=(r=A.channel)!=null?r:"",u=this.configs[a],f=(n=u==null?void 0:u.interstitialRate)!=null?n:1;t=Math.random()<f}return this.firstRun=!1,t}};K();var Ce=new be,Dt=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>A.mpId;this.getTestAdsMode=()=>A.testAdsMode;this.asyncLoad=()=>F(this,null,function*(){var f,m,p,E,y;let t="ca-pub-7171363994453626",r,n,a=window.encodeURIComponent(window.btoa((f=this.getGameId())!=null?f:"")),u=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:a,testAdsMode:`${u}`}});t=(p=S.data)==null?void 0:p.clientId,r=(E=S.data)==null?void 0:E.channelId,n=(y=S.data)==null?void 0:y.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>F(this,null,function*(){var a;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(a=this.getTestAdsMode())!=null?a:!1;if(!document.getElementById(r)&&this.clientId){let u=document.createElement("script");u.id=r,u.async=!0,u.crossOrigin="anonymous",u.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&u.setAttribute("data-adbreak-test","on"),this.channelId&&u.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(u),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{let r=!1,n=t.adBreakDone,a=f=>{var m;r=!0,this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:f.breakType,breakName:(m=f.breakName)!=null?m:"",breakFormat:f.breakFormat,breakStatus:f.breakStatus}),n&&n(f)};if(t.adBreakDone=a,t.type==="reward"){let f=t.beforeReward,m=E=>()=>{this.track("CallShowAdFn",null),E()},p=E=>{r=!0,f&&f(m(E))};t.beforeReward=p,window.setTimeout(()=>{var E,y;r||(this.track("CallAdBreakTimeout",{type:t.type}),(y=t.adBreakDone)==null||y.call(t,{breakType:t.type,breakName:(E=t.name)!=null?E:"",breakFormat:"reward",breakStatus:"timeout"}))},5e3)}if((f=>f.type==="preroll")(t)){Ce.emit("isAdShowing",!0);let f=t.adBreakDone,m=p=>{Ce.emit("isAdShowing",!1),f&&f(p)};return Y($({},t),{adBreakDone:m})}else{let f=t.beforeAd,m=t.afterAd,p=()=>{var y;r=!0,Ce.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(y=t.name)!=null?y:""}),f&&f()},E=()=>{var y;r=!0,Ce.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(y=t.name)!=null?y:""}),m&&m()};return Y($({},t),{beforeAd:p,afterAd:E})}};this.adConfig=t=>{let a=t,{onReady:r}=a,n=cn(a,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var m,p,E,y,S,g;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(E=t.adBreakDone)==null||E.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(S=t.adBreakDone)==null||S.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((y=n==null?void 0:n.count)!=null?y:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let a=t.type,u;switch(a){case"preroll":u={type:a};break;case"start":case"pause":case"next":case"browse":case"reward":u={type:a,name:(g=t.name)!=null?g:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",u);let f=this.wrapAdBreakParams(t);this.push(f),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>F(this,null,function*(){var g,I,P,D;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(P=t.fullWidthResponsive)!=null?P:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:a,fullWidthResponsive:u,style:f}=t,m;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?m=document.querySelector(r):m=r,!m)throw new Error("targeting element not found");let p=n;if(p||(p=this.unitId),!p)throw new Error("slot is required");let E=typeof a=="object"&&Array.isArray(a)?a.join(", "):a,y=document.createElement("ins");if(y.className="adsbygoogle",y.id="jolibox-ads",y.style.display="block",y.setAttribute("data-ad-client",this.clientId),y.setAttribute("data-ad-slot",p),E&&y.setAttribute("data-ad-format",E),u&&y.setAttribute("data-full-width-responsive",u),f&&y.setAttribute("style",f),(D=this.getTestAdsMode())!=null?D:!1){let x=document.createElement("div");x.style.position="absolute",x.style.top="0",x.style.left="0",x.style.width="100%",x.style.height="100%",x.style.display="flex",x.style.justifyContent="center",x.style.alignItems="center",x.style.backgroundColor="rgba(0, 0, 0, 0.5)",x.style.color="white",x.innerHTML="Test Ad",y.style.position="relative",m.appendChild(y),y.appendChild(x)}else m.appendChild(y),new MutationObserver(C=>{C.forEach(V=>{if(V.type==="attributes"&&V.attributeName==="data-ad-status"){let U=y.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:U!=null?U:"null"})}})}).observe(y,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Ct(t,r,n),this.adsActionDetection=new xt(this.track),this.channelPolicy=new Pt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}};we();K();He();var so=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};var Ot=ae(),qa=he.create(),Lt=new Dt(de,qa,()=>he.getNetworkStatus());Ce.on("isAdShowing",e=>{so("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Ot.registerCommand("AdsSDK.init",e=>{Lt.init(e)});Ot.registerCommand("AdsSDK.adConfig",e=>{Lt.adConfig(e)});Ot.registerCommand("AdsSDK.adBreak",e=>{Lt.adBreak(e)});Ot.registerCommand("AdsSDK.adUnit",e=>{Lt.adUnit(e)});K();we();var po=-1,Ft=function(e){addEventListener("pageshow",function(t){t.persisted&&(po=t.timeStamp,e(t))},!0)},Fr=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Ut=function(){var e=Fr();return e&&e.activationStart||0},De=function(e,t){var r=Fr(),n="navigate";return po>=0?n="back-forward-cache":r&&(document.prerendering||Ut()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},ho=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(a){}},Oe=function(e,t,r,n){var a,u;return function(f){t.value>=0&&(f||n)&&((u=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=u,t.rating=function(m,p){return m>p[1]?"poor":m>p[0]?"needs-improvement":"good"}(t.value,r),e(t))}},go=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},vo=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},yo=function(e){var t=!1;return function(){t||(e(),t=!0)}},Pe=-1,co=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Nt=function(e){document.visibilityState==="hidden"&&Pe>-1&&(Pe=e.type==="visibilitychange"?e.timeStamp:0,za())},uo=function(){addEventListener("visibilitychange",Nt,!0),addEventListener("prerenderingchange",Nt,!0)},za=function(){removeEventListener("visibilitychange",Nt,!0),removeEventListener("prerenderingchange",Nt,!0)},bo=function(){return Pe<0&&(Pe=co(),uo(),Ft(function(){setTimeout(function(){Pe=co(),uo()},0)})),{get firstHiddenTime(){return Pe}}},Ur=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},lo=[1800,3e3],_o=function(e,t){t=t||{},Ur(function(){var r,n=bo(),a=De("FCP"),u=ho("paint",function(f){f.forEach(function(m){m.name==="first-contentful-paint"&&(u.disconnect(),m.startTime<n.firstHiddenTime&&(a.value=Math.max(m.startTime-Ut(),0),a.entries.push(m),r(!0)))})});u&&(r=Oe(e,a,lo,t.reportAllChanges),Ft(function(f){a=De("FCP"),r=Oe(e,a,lo,t.reportAllChanges),go(function(){a.value=performance.now()-f.timeStamp,r(!0)})}))})};var Ya=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=yo(e),document.visibilityState==="hidden"?e():(r=t(e),vo(e)),r};var fo=[2500,4e3],Nr={},Eo=function(e,t){t=t||{},Ur(function(){var r,n=bo(),a=De("LCP"),u=function(p){t.reportAllChanges||(p=p.slice(-1)),p.forEach(function(E){E.startTime<n.firstHiddenTime&&(a.value=Math.max(E.startTime-Ut(),0),a.entries=[E],r())})},f=ho("largest-contentful-paint",u);if(f){r=Oe(e,a,fo,t.reportAllChanges);var m=yo(function(){Nr[a.id]||(u(f.takeRecords()),f.disconnect(),Nr[a.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return Ya(m)},{once:!0,capture:!0})}),vo(m),Ft(function(p){a=De("LCP"),r=Oe(e,a,fo,t.reportAllChanges),go(function(){a.value=performance.now()-p.timeStamp,Nr[a.id]=!0,r(!0)})})}})},mo=[800,1800],Qa=function e(t){document.prerendering?Ur(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},wo=function(e,t){t=t||{};var r=De("TTFB"),n=Oe(e,r,mo,t.reportAllChanges);Qa(function(){var a=Fr();a&&(r.value=Math.max(a.responseStart-Ut(),0),r.entries=[a],n(!0),Ft(function(){r=De("TTFB",0),(n=Oe(e,r,mo,t.reportAllChanges))(!0)}))})};re();function Xa(){_o(e=>{de("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Eo(e=>{de("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),wo(e=>{de("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Za(){Ve.on("onDocumentReady",e=>{Ve.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function Io(){Za(),Xa()}Io();
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
localforage/dist/localforage.js:
|
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ts=Object.create;var Ye=Object.defineProperty,rs=Object.defineProperties,ns=Object.getOwnPropertyDescriptor,os=Object.getOwnPropertyDescriptors,is=Object.getOwnPropertyNames,Qe=Object.getOwnPropertySymbols,ss=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty,dn=Object.prototype.propertyIsEnumerable;var un=(e,t,r)=>t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w=(e,t)=>{for(var r in t||(t={}))zt.call(t,r)&&un(e,r,t[r]);if(Qe)for(var r of Qe(t))dn.call(t,r)&&un(e,r,t[r]);return e},N=(e,t)=>rs(e,os(t));var Z=(e,t)=>{var r={};for(var n in e)zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Qe)for(var n of Qe(e))t.indexOf(n)<0&&dn.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var pn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mn=(e,t)=>{for(var r in t)Ye(e,r,{get:t[r],enumerable:!0})},as=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of is(t))!zt.call(e,o)&&o!==r&&Ye(e,o,{get:()=>t[o],enumerable:!(n=ns(t,o))||n.enumerable});return e};var fn=(e,t,r)=>(r=e!=null?ts(ss(e)):{},as(t||!e||!e.__esModule?Ye(r,"default",{value:e,enumerable:!0}):r,e));var E=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())});function ms(e){return!!(e!=null&&e.__nativeBuffers__)}function rr(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!ms(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 o;n.value?o=n.value:n.base64&&(o=fs(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function _s(e={},t=!1){let r=e,n=[];for(let[o,i]of Object.entries(r))if(i!==void 0&&i instanceof ArrayBuffer&&i.byteLength!==void 0){let s=t?{value:i,key:o}:{base64:hs(i),key:o};n.push(s),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}function ks(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function xn(e){return typeof e=="string"}function Oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Ts(e){return typeof e=="undefined"}function xs(e){return Ts(e)||e===null}function In(e){return typeof e=="function"}function Is(e){return Oe(e)&&In(e.then)}function Rn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function Ne(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function $s(e){return new Promise(t=>An(e)(t))}function An(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function Hs(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(i.fire,i)}},i=new Le(o);return i.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function Vs(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Js(e[n],t[n])}function Js(e,t){if(xn(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(In(t)){try{if(e instanceof t)return}catch(r){}if(!xs(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 yn(e,t){return`[${e}]:${t}`}function Qs(e,t){bn||(Xt=new Ze({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),Zt=new Ze({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),er=new Ze({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{Xt.flush(),Zt.flush(),er.flush()}),bn=!0);function r(o){var i,s;let{method:a,args:l,startTime:c,isForeground:d,errMsg:u=`${a}:fail no errMsg`,errNo:p=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:g,invokeCallback:b}=m,h=(s=(i=u.match(/\S:(\S+)\s?/))==null?void 0:i[1])!=null?s:"fail";Xt.report({status:h,method:n(a,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&g&&b&&(Zt.report({status:h,method:a,isForeground:d,duration:Number((g-c).toFixed(3))}),er.report({status:h,method:a,isForeground:d,duration:Number((Date.now()-b).toFixed(3))}))}function n(o,i){return(o==="callHostMethod"||o==="callHostMethodSync")&&i!=null&&i.method?`${o}-${i.method}`:o}return r}function Xs(e,t){let r=0,n=!0,o=new Map,i=Qs(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,tr.forEach(l=>lr(this,[l],function*({method:c,args:d,resolve:u}){let p=yield a(c,d);u(p)})),tr.length=0});let s=(l,c)=>{let d=o.get(Number(l));if(!d)return;let u=rr(c);d(u),o.delete(Number(l))},a=(l,c)=>{var d,u;let p=Date.now(),m=`${n}`;r+=1;let g=new Ss;if(o.set(r,g.resolve),!n&&qs.includes(l))return new Promise(R=>{tr.push({method:l,args:c,resolve:R})});let b=ds(me({},{method:l,startTime:p,args:c,isForeground:m}),{invokeType:"js-bridge"}),h=!Ys&&Gs.includes(l),_=_s(c,h),v=h?_:JSON.stringify(_),S;if(l.endsWith("Sync")||Ws.includes(l)?S=(d=e.call)==null?void 0:d.call(e,l,_,r):typeof v=="string"?S=e.invoke(l,v,r):S=(u=e.call)==null?void 0:u.call(e,l,v,r),S){try{typeof S=="string"&&(S=JSON.parse(S)),S=rr(S)}catch(R){ur.error(R)}return o.delete(r),S.errorCode&&(S.errorCode=yn(l,S.errorCode)),i(me(me({},b),S)),S}return l.endsWith("Sync")&&o.delete(r),g.promise.then(R=>(R.errorCode&&(R.errorCode=yn(l,R.errorCode)),i(me(me({},b),R)),R))};return{invokeNative:a,applyNative:(l,c)=>{let d=a(l,c);return Is(d)?d.then(u=>wn(l,u)):wn(l,d)},invokeHandler:s}}function wn(e,t){if(!Oe(t)){ur.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:o,errorType:i,errorCode:s}=r,a=ps(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new Ps(n,o,i,s);return a}function Zs(e){let t=new ir,r=new ir,n=new Ze({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(o,i,s){let a=rr(i),l;if(a.__extra){l=a.params;let{type:c,startTime:d}=a.__extra;n.report({type:c,event:o,duration:Date.now()-d})}else l=a;if(o===Cn){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(De.length),u,s)}catch(p){}});return}if(o.startsWith(De)){r.emit(o.slice(De.length),l,s);return}t.emit(o,l,s)}}}function ea(e){let t=new Map,r;return(n,o,i,s)=>{if(s){let l=i?[i]:"*";e.publish(`${De}${n}`,o,l);return}r||(r=Promise.resolve().then(()=>{t.forEach((l,c)=>{try{let d=c?[c]:"*";e.publish(Cn,l,d)}catch(d){}}),r=void 0,t.clear()}));let a=t.get(i);a||(a=[],t.set(i,a)),a.push([`${De}${n}`,o])}}function ta(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:i}=Zs(e),{invokeNative:s,invokeHandler:a,applyNative:l}=Xs(e,r),c=ea(e);return{invokeHandler:a,subscribeHandler:t,applyNative:l,invokeNative:s,onNative:r,offNative:n,publish:c,subscribe:o,unsubscribe:i}}function Pn(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ls,cs,us,et,kn,Sn,hn,me,ds,ps,lr,fs,hs,cr,gs,_n,vs,ys,gn,bs,ws,Tn,Es,Ss,Rs,As,tt,Cs,Ps,Ns,Qt,ur,Os,Ds,Ls,Us,Fs,Dc,nr,L,js,Ms,Xe,Le,ir,sr,Bs,Yt,Ks,Lc,ar,vn,Uc,De,Gs,qs,Ws,Cn,zs,Ze,bn,Xt,Zt,er,tr,Ys,dr,le,Nn,On,ra,Dn,En,Q,O,re,Fc,na,Ln,jc,Mc,G=k(()=>{"use strict";ls=Object.defineProperty,cs=Object.defineProperties,us=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertySymbols,kn=Object.prototype.hasOwnProperty,Sn=Object.prototype.propertyIsEnumerable,hn=(e,t,r)=>t in e?ls(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,me=(e,t)=>{for(var r in t||(t={}))kn.call(t,r)&&hn(e,r,t[r]);if(et)for(var r of et(t))Sn.call(t,r)&&hn(e,r,t[r]);return e},ds=(e,t)=>cs(e,us(t)),ps=(e,t)=>{var r={};for(var n in e)kn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&et)for(var n of et(e))t.indexOf(n)<0&&Sn.call(e,n)&&(r[n]=e[n]);return r},lr=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())});fs=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer};hs=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)};cr=Object.defineProperty,gs=Object.getOwnPropertyDescriptor,_n=Object.getOwnPropertySymbols,vs=Object.prototype.hasOwnProperty,ys=Object.prototype.propertyIsEnumerable,gn=(e,t,r)=>t in e?cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bs=(e,t)=>{for(var r in t||(t={}))vs.call(t,r)&&gn(e,r,t[r]);if(_n)for(var r of _n(t))ys.call(t,r)&&gn(e,r,t[r]);return e},ws=(e,t)=>{for(var r in t)cr(e,r,{get:t[r],enumerable:!0})},Tn=(e,t,r,n)=>{for(var o=n>1?void 0:n?gs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&cr(t,r,o),o},Es=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((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 o=this._eventListeners[r].indexOf(n);o!==-1&&this._eventListeners[r].splice(o,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}Ss=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))}})}};Rs=(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))(Rs||{}),As=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}},tt=class extends As{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Cs=class extends tt{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Ps=class extends tt{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Ns=class extends tt{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Qt=class extends tt{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};ur={log:Ne("log"),warn:Ne("warn"),info:Ne("info"),error:Ne("error"),debug:Ne("debug")};Object.assign(globalThis,{logger:ur});Os=Symbol.for("Jolibox.canIUseMap"),Ds={};globalThis[Os]=Ds;Ls=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Ls||{}),Us=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Us||{}),Fs=(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))(Fs||{}),Dc={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},nr=class or{constructor(t){this.element=t,this.next=or.Undefined,this.prev=or.Undefined}};nr.Undefined=new nr(void 0);L=nr,js=class{constructor(){this._first=L.Undefined,this._last=L.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===L.Undefined}clear(){let e=this._first;for(;e!==L.Undefined;){let t=e.next;e.prev=L.Undefined,e.next=L.Undefined,e=t}this._first=L.Undefined,this._last=L.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new L(e);if(this._first===L.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==L.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==L.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==L.Undefined&&e.next!==L.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===L.Undefined&&e.next===L.Undefined?(this._first=L.Undefined,this._last=L.Undefined):e.next===L.Undefined?(this._last=this._last.prev,this._last.next=L.Undefined):e.prev===L.Undefined&&(this._first=this._first.next,this._first.prev=L.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==L.Undefined;)yield e.element,e=e.next}},Ms=0,Xe=class{constructor(e){this.value=e,this.id=Ms++}},Le=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 Xe&&(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,o,i,s,a,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Xe(t);this._listeners?this._listeners instanceof Xe?this._listeners=[this._listeners,c]:this._listeners.push(c):((o=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||o.call(n,this),this._listeners=c,(s=(i=this.options)==null?void 0:i.onDidFirstListener)==null||s.call(i,this)),(l=(a=this.options)==null?void 0:a.onDidAddListener)==null||l.call(a,this),this._size++}),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(o){n(o)}}fire(e){this._listeners&&(this._listeners instanceof Xe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ir=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new Le,o=s=>t(...s.args);this.listerHandlerMap.set(t,o),n.event(o),this.listeners.set(e,n);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)n.fire(bs({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new js,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},sr={};ws(sr,{None:()=>Bs,filter:()=>Hs,once:()=>An,toPromise:()=>$s});Bs=()=>{console.log("[Jolibox SDK] None Event")};Yt=Symbol.for("Jolibox.hostEmitter"),Ks=()=>{let e=new ir;return globalThis[Yt]||(globalThis[Yt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Yt]},Lc=Ks();ar=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Le,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 o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return Vs(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};ar=Tn([Rn],ar);vn=class{constructor(){this._onWillExecuteCommand=new Le,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Le,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ar,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=ks(3e4)),this._starActivation}executeCommand(e,...t){return Es(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),sr.toPromise(sr.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}}};vn=Tn([Rn],vn);Uc=Symbol.for("Jolibox.commands");De="custom_event_",Gs=[],qs=[],Ws=["env","createRequestTask","login"],Cn="__batch_event__",zs=e=>e==="pv"?e:"default",Ze=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:o,metricName:i,type:s}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=o,this.metricName=i,this.type=zs(s)}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,o,i)=>{let s=n.shift();if(s){let a=i[s];r[a]||(r[a]={}),t(r[a],n,o,i)}else r[o]||(r[o]=[]),r[o].push(i[o])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,o,i,s)=>{let a=o.shift();if(!a&&Oe(s))throw new Qt(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(a){let l=[];if(Oe(s))l.push(...Object.keys(s));else if(xn(s)){if(o.length>0)throw new Qt(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(s)}else throw new Qt(`expected metric value to be a string, but got a(n) ${typeof s}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=Oe(s)?s[c]:s;t(n[c],[...o],i,d)})}else n[i]?n[i]++:n[i]=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={}}},bn=!1;tr=[],Ys=!1;le={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){le.trigger=e},onDoExit(e){le.exit=e}},Nn=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Cs("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(o="")=>{le.trigger(),e.onDocumentReady.postMessage({path:o})},r=o=>lr(void 0,null,function*(){let i=yield le.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:i})});dr={onDocumentReady:t,doExit:r,invoke(o,i,s){e.invoke.postMessage({event:o,paramsString:i,callbackId:s})},publish(o,i,s){let a=Pn(i,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:s}))},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Nn,doExit:r};globalThis.joliboxJSCore=me({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{le.trigger(),e.onDocumentReady(JSON.stringify({path:o}))},r=o=>lr(void 0,null,function*(){let i=yield le.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:i}))});dr={onDocumentReady:t,invoke(o,i,s){e.invoke(JSON.stringify({event:o,paramsString:i,callbackId:s}))},doExit:r,publish(o,i,s){let a=Pn(i,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:s})},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Nn,doExit:r};globalThis.joliboxJSCore=me({},n)}On=dr;if(!On)throw new Ns("No joliboxJScore is found, native bridge not found.");ra=me({},On),Dn=ta(ra),{invokeHandler:En}=Dn,{applyNative:Q,invokeNative:O,onNative:re,offNative:Fc,subscribeHandler:na,publish:Ln,subscribe:jc,unsubscribe:Mc}=Dn;globalThis.joliboxJSBridge={callHandler:En,invokeHandler:En,subscribeHandler:na}});function ca(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function je(e){return typeof e=="string"}function ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function $n(e){return typeof e=="object"&&Array.isArray(e)}function Me(e){return e===!0||e===!1}function ua(e){return typeof e=="undefined"}function da(e){return ua(e)||e===null}function pa(e){return typeof e=="function"}function Hn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function Kn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,i){for(let s in i)if(Object.prototype.hasOwnProperty.call(i,s)){let a=o[s],l=i[s],c=r(a,l,s,o,i);c!==void 0?o[s]=c:jn(l)&&jn(a)?o[s]=n(Mn({},a),l):Array.isArray(l)&&Array.isArray(a)?o[s]=[...a,...l]:o[s]=l}return o}return n(e,t)}function jn(e){return e&&typeof e=="object"&&e.constructor===Object}function Vn(e,t){if(Array.isArray(e))return e.concat(t)}function Be(e,t,r={}){let n=null,o,i,s,{leading:a=!1,trailing:l=!0}=r,c=()=>(s=e.apply(i,o),o=void 0,i=void 0,s),d=function(...u){o=u,i=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return d.cancel=()=>{n&&clearTimeout(n),n=null,o=i=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,c()},d}function fa(e,t){return(...r)=>t(e,...r)}function it(e){return t=>fa(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new $e(`${o}`))}})}function Ue(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Ra(e){return new Promise(t=>Xn(e)(t))}function Xn(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function Aa(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(i.fire,i)}},i=new Fe(o);return i.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function Pa(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Na(e[n],t[n])}function Na(e,t){if(je(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(pa(t)){try{if(e instanceof t)return}catch(r){}if(!da(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 j(){if(globalThis[mr])return globalThis[mr];let e=new ot,t=new gr,r={registerCommand(n,o,i){e.registerCommand({id:n,handler:o,metadata:i})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[mr]=r,r}var vr,oa,Un,ia,sa,Fn,Mn,aa,Bn,la,fe,ma,yr,br,Jn,Gn,$e,qn,Wn,He,wr,ne,zn,ha,Er,_a,kr,ga,va,rt,ya,ba,wa,Qn,Sr,Ea,ka,Sa,Yn,fr,U,Ta,xa,nt,Fe,he,_r,Ia,pr,Ca,ce,ot,gr,mr,P=k(()=>{"use strict";vr=Object.defineProperty,oa=Object.getOwnPropertyDescriptor,Un=Object.getOwnPropertySymbols,ia=Object.prototype.hasOwnProperty,sa=Object.prototype.propertyIsEnumerable,Fn=(e,t,r)=>t in e?vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mn=(e,t)=>{for(var r in t||(t={}))ia.call(t,r)&&Fn(e,r,t[r]);if(Un)for(var r of Un(t))sa.call(t,r)&&Fn(e,r,t[r]);return e},aa=(e,t)=>{for(var r in t)vr(e,r,{get:t[r],enumerable:!0})},Bn=(e,t,r,n)=>{for(var o=n>1?void 0:n?oa(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&vr(t,r,o),o},la=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((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 o=this._eventListeners[r].indexOf(n);o!==-1&&this._eventListeners[r].splice(o,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}fe=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))}})}};ma=(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))(ma||{}),yr=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}},br=class extends yr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Jn=class extends yr{constructor(){super(...arguments),this.kind="USER_ERROR"}},Gn=class extends Jn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},$e=class extends Jn{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))}},qn=class extends br{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Wn=class extends br{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},He=class extends yr{constructor(e,t,r,n,o){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),o&&(this.priority=o)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},wr=class extends br{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ne={log:Ue("log"),warn:Ue("warn"),info:Ue("info"),error:Ue("error"),debug:Ue("debug")};Object.assign(globalThis,{logger:ne});zn=Symbol.for("Jolibox.canIUseMap"),ha={};globalThis[zn]=ha;Er={get config(){return globalThis[zn]}},_a=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(_a||{}),kr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(kr||{}),ga=(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))(ga||{}),va=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),rt={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},ya=()=>rt.isiOS?"iOS":rt.isAndroid?"Android":rt.isMac?"Mac":rt.isFacebook?"Facebook":"PC",ba="device_id",wa="advertising_id",Qn=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,va()),window.__joliboxLocalStorage__.getItem(e)),Sr=()=>Qn(ba),Ea=()=>Qn(wa),ka=e=>e.charAt(0).toUpperCase()+e.slice(1),Sa=()=>{var e;let t=new URLSearchParams(window.location.search);return ka((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Yn=e=>{let t="JoliboxWebSDK",r=ya(),n=navigator.language,o=Sr(),i=Ea();return`${t} (${Sa()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${i} version/${e||""}`},fr=class hr{constructor(t){this.element=t,this.next=hr.Undefined,this.prev=hr.Undefined}};fr.Undefined=new fr(void 0);U=fr,Ta=class{constructor(){this._first=U.Undefined,this._last=U.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===U.Undefined}clear(){let e=this._first;for(;e!==U.Undefined;){let t=e.next;e.prev=U.Undefined,e.next=U.Undefined,e=t}this._first=U.Undefined,this._last=U.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new U(e);if(this._first===U.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==U.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==U.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==U.Undefined&&e.next!==U.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===U.Undefined&&e.next===U.Undefined?(this._first=U.Undefined,this._last=U.Undefined):e.next===U.Undefined?(this._last=this._last.prev,this._last.next=U.Undefined):e.prev===U.Undefined&&(this._first=this._first.next,this._first.prev=U.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==U.Undefined;)yield e.element,e=e.next}},xa=0,nt=class{constructor(e){this.value=e,this.id=xa++}},Fe=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 nt&&(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,o,i,s,a,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new nt(t);this._listeners?this._listeners instanceof nt?this._listeners=[this._listeners,c]:this._listeners.push(c):((o=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||o.call(n,this),this._listeners=c,(s=(i=this.options)==null?void 0:i.onDidFirstListener)==null||s.call(i,this)),(l=(a=this.options)==null?void 0:a.onDidAddListener)==null||l.call(a,this),this._size++}),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(o){n(o)}}fire(e){this._listeners&&(this._listeners instanceof nt?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},he=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new Fe,o=s=>t(...s.args);this.listerHandlerMap.set(t,o),n.event(o),this.listeners.set(e,n);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)n.fire(Mn({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Ta,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},_r={};aa(_r,{None:()=>Ia,filter:()=>Aa,once:()=>Xn,toPromise:()=>Ra});Ia=()=>{console.log("[Jolibox SDK] None Event")};pr=Symbol.for("Jolibox.hostEmitter"),Ca=()=>{let e=new he;return globalThis[pr]||(globalThis[pr]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[pr]},ce=Ca();ot=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Fe,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 o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return Pa(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};ot=Bn([Hn],ot);gr=class{constructor(){this._onWillExecuteCommand=new Fe,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Fe,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ot,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=ca(3e4)),this._starActivation}executeCommand(e,...t){return la(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),_r.toPromise(_r.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}}};gr=Bn([Hn],gr);mr=Symbol.for("Jolibox.commands")});function K(e,t={}){Tr.emit("ERROR_REPORT",{error:e,options:t})}var Tr,be,oe=k(()=>{"use strict";P();P();Tr=new he,be=new he;K.debounce=Be(K,50,{leading:!0})});var xr,Oa,Zn,eo,to=k(()=>{"use strict";P();oe();xr=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(o){return{}}},Oa=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Zn=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[i,s,a]=o;return{headerJson:xr(i),payloadJson:xr(s),signature:xr(a)}}else throw"joli_source is missing"}catch(r){return K(new qn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},eo=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],o=Oa(e),i=r[2];return`${n}.${o}.${i}`}return t}});var Da,st,ro,Ir=k(()=>{"use strict";P();Da="1.1.13-beta.4",st=()=>Da,ro=()=>{let e=st();return`${Yn(e)}`}});var La,no,Rr,oo,V,Ua,y,J=k(()=>{"use strict";P();to();Ir();P();La={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Sr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:st()},schema:window.location.href,platform:"h5"},Rr=(no=globalThis.joliboxJSCore)==null?void 0:no.env,V=Object.assign({},(oo=Rr==null?void 0:Rr())!=null?oo:La),Ua=()=>{var p,m,g,b,h,_,v,S,R;let{payloadJson:e,headerJson:t,signature:r}=V.schema.length?Zn(V.schema):{},n=`${V.deviceInfo.did}-${new Date().getTime()}`,i=new URL(V.schema.length?V.schema:window.location.href).searchParams,s=(g=(m=(p=i.get("mpId"))!=null?p:i.get("appId"))!=null?m:i.get("gameId"))!=null?g:"",a=(_=(h=(b=V.clientSessionId)!=null?b:e==null?void 0:e.sessionId)!=null?h:i.get("sessionId"))!=null?_:n,l=!!((v=e==null?void 0:e.testAdsMode)!=null?v:i.get("testAdsMode")==="true"),c=(R=(S=e==null?void 0:e.joliboxEnv)!=null?S:i.get("joliboxEnv"))!=null?R:"production",d=c==="staging",u=t==null?void 0:t.channel;return{get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var A;return(A=i.get("joliSource"))!=null?A:null},get mpId(){var A;return(A=s!=null?s:e==null?void 0:e.id)!=null?A:""},get mpVersion(){var A;return(A=t==null?void 0:t.ver)!=null?A:st()},get mpType(){var A,C;return(C=(A=t==null?void 0:t.__mpType)!=null?A:e==null?void 0:e.__mpType)!=null?C:"game"},get platform(){var A;return(A=V.platform)!=null?A:V.deviceInfo.platform},get deviceInfo(){return V.deviceInfo},get sdkInfo(){return V.sdkInfo},get hostInfo(){return V.hostInfo},get hostUserInfo(){return V.hostUserInfo},get sessionId(){var A,C;return(C=(A=V.clientSessionId)!=null?A:a)!=null?C:n},get channel(){return u},get webviewId(){var A;return(A=V.webviewId)!=null?A:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},get baseApiHost(){return d?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:A=>{Kn(V,A,Vn)},encodeJoliSourceQuery:A=>{var C,H;return t&&r?eo(w(w({},e),A),(C=i.get("joliSource"))!=null?C:""):(H=i.get("joliSource"))!=null?H:""}}},y=Ua()});var Ar,so,Fa,ja,io,Ma,ao=k(()=>{"use strict";P();oe();J();P();Ar=!1,so=(e,t)=>e==null?!1:t in e,Fa=e=>so(e,"kind"),ja=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},io=(e,t={},r)=>{var i,s,a;let n={user_id:(s=(i=y.hostUserInfo)==null?void 0:i.uid)!=null?s:"",device_id:(a=y.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:ja(e.name)},o=N(w({},n),{env:t.environment,isFromUser:r});r?be.emit("GLOBAL_USER_ERROR",e,o):be.emit("GLOBAL_ERROR",e,o)},Ma=e=>so(e,"kind")&&e.kind==="USER_ERROR";Tr.on("ERROR_REPORT",({error:e,options:t})=>{if(Ar)return;Ar=!0;let r=Fa(e)&&e.raw?e.raw:e;try{let n=Ma(e);io(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),i=new wr(`${o}, origin error: ${r.message}`);ne.error(i),io(new wr(i.message),{environment:t.environment},!1)}finally{Ar=!1}})});var _e,Cr,xe=k(()=>{"use strict";oe();P();oe();_e=(e,t)=>{var r,n;return new He((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Cr=e=>new Gn(e)});var lo=k(()=>{"use strict";ao();xe();P();G();be.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};O("trackAsync",{event:"reportJsError",data:r})});be.on("GLOBAL_USER_ERROR",(e,t)=>{ne.log("UserError",e,t)})});var Pr=k(()=>{"use strict"});function co(e,t){let r=(n,o,i)=>{let s=N(w({tag:n},t),{extra:w({},o)});n=="globalJsError"?K(new Wn(JSON.stringify(s))):e("systemLog",s,i)};return r.debounce=Be(r,500,{leading:!0}),r}function uo(e){let t=(r,n,o)=>{var a;let i=(a=o&&JSON.stringify(o))!=null?a:0,s={speed_value_type:r,total_duration:n};i&&Object.assign(s,{extra:i}),e("joliboxSpeedAnalysis",s)};return t.debounce=Be(t,500,{leading:!0}),t}var po=k(()=>{"use strict";P();P();oe()});function mo(e,t){let r=co(e,t),n=uo(r);return{track:r,trackPerformance:n}}var fo=k(()=>{"use strict";po()});var ho=k(()=>{"use strict";J();P();P()});var _o=k(()=>{"use strict";fo();Pr();ho()});var at,go=k(()=>{"use strict";at=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,o,i=!1,s=0,a=()=>{if(!i)return;let m=Date.now(),g=m-r;g>=this.interval&&(this.visible&&(s+=g,t(s)),r=m),n=requestAnimationFrame(a)},l=()=>{d(),r=Date.now(),o=window.setInterval(()=>{if(!i)return;let m=Date.now();m-r>=this.interval&&(r=m)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(a)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",m=>{i&&(console.log("visible",m),m?c():l())});let p=this.visible;return{start(){i||(i=!0,p?c():l())},stop(){i=!1,d(),u()}}}}});var Nr=k(()=>{"use strict"});function yo(e,t,r){let{response:n,startTime:o,endTime:i,requestFrom:s}=r,{errMsg:a="",profile:l={}}=n,d={duration:i-o,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:l.socketReused?1:0,request_from:s};(s==="public"&&vo<$a||s==="inner")&&(d.joli_request_number=vo++,setTimeout(()=>{Y("joliboxNetRequestResult",d)},500))}var vo,$a,bo=k(()=>{"use strict";Nr();ge();vo=0,$a=10});function lt(e,t,r){var l,c,d;let n=new Map,o=(l=r==null?void 0:r.baseUrl)!=null?l:"https://api.jolibox.com",i=(c=r==null?void 0:r.type)!=null?c:"public",s=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return re("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let m=u,{requestTaskId:b,state:h}=m,_=Z(m,["requestTaskId","state"]);p.resolve(_),n.delete(b)}else if(u.state==="fail"){let g=u,{requestTaskId:b,state:h}=g,_=Z(g,["requestTaskId","state"]);p.reject(_),n.delete(b)}else ne.warn("onRequestTaskStateChange unknown event",u)}),ce.on("onLoginComplete",({isLogin:u,token:p})=>{u&&p&&(s["X-JOLI-TOKEN"]=p)}),(m,...g)=>E(this,[m,...g],function*(u,p={}){let b=Date.now(),h=Ha(u,N(w({},p),{baseUrl:o})),{method:_="GET",responseType:v="text",dataType:S="json",timeout:R,enableCache:A=!1,appendHostCookie:C=!0}=p,H=Object.assign({"content-type":"application/json"},s,p.header),z={url:h,method:_,header:H,enableCache:A,responseType:v,appendHostCookie:C};if(_=="POST"||_=="PUT"){let te=Va(p.data,H["content-type"]);z.data=te}R&&Object.assign(z,{timeout:R});let{data:{requestTaskId:se}}=O(e,z);if(typeof se!="string")throw _e({code:-1,msg:"requestTaskId is not a string"});let Te=(te,ae)=>{yo("request",h,{state:te,startTime:b,endTime:Date.now(),params:z,response:ae,requestId:se,requestFrom:i=="public"?"public":"inner"})},{resolve:X,reject:ve,promise:Yi}=new fe;n.set(se,{resolve:X,reject:ve});try{let te=yield Yi;Te("success",te);let{data:ae}=te;return S==="json"&&typeof ae=="string"&&(ae=Ka(ae)),{url:h,timeout:R,method:_,response:N(w({},te),{data:ae})}}catch(te){let ae=te;if(ye(ae)){let{errMsg:ze,prefetchDetail:Xi,isPrefetch:Zi,errNo:es}=ae;je(ze)&&(Te("fail",{errMsg:ze,isPrefetch:Zi,prefetchDetail:Xi}),K(_e({code:-1,msg:ze},{errNo:es,errMsg:ze})))}throw te}})}function Ka(e){try{return JSON.parse(e.trim())}catch(t){return e}}function Va(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 Ha,Or=k(()=>{"use strict";P();bo();Nr();G();oe();xe();Ha=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,o=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${o?`?${o}`:""}`:`${e}${o?`?${o}`:""}`}});var Dr,wo,q,Ie=k(()=>{"use strict";Ir();Or();J();Dr={"x-user-agent":ro()};(wo=y.hostUserInfo)!=null&&wo.token&&(Dr["x-joli-token"]=y.hostUserInfo.token);y.joliSource&&(Dr["x-joli-source"]=y.joliSource);q=lt("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:y.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Dr})});var ct,Eo=k(()=>{"use strict";J();go();Ie();G();ct=class extends at{constructor(t,r,n){super(r,n),this.gameId=y.mpId,this.sessionId=y.sessionId,this.track=t}reporter(t){return E(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(q("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:w({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return E(this,null,function*(){let{event:r,params:n}=t;yield Q("userTrackAsync",{event:r,params:w({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var Io={};mn(Io,{nativeTaskEmitter:()=>Ke,taskTracker:()=>W,track:()=>Y,trackPerformance:()=>To});var Ja,ko,So,Y,To,xo,Ke,W,ge=k(()=>{"use strict";lo();P();Pr();_o();J();Eo();G();Ja=(e,t,r)=>{var s,a;let n=t,o=ye(n.extra)?n.extra:je(n.extra)?JSON.parse(n.extra):{},i=N(w({},o),{mp_id:(s=n.mp_id)!=null?s:"",mp_version:(a=n.mp_version)!=null?a:""});O("trackAsync",{event:e,data:i,webviewId:r})},{track:Y,trackPerformance:To}=mo(Ja,{type:kr.AppSDK,platform:"native",jssdk_version:(So=(ko=y.sdkInfo)==null?void 0:ko.jssdkVersion)!=null?So:"1.0.0",mp_id:y.mpId,mp_version:y.mpVersion}),xo=j();xo.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{To(e,t,r)});xo.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Y(e,t)});Ke=new he,W=new ct(Y,Ke)});function Ro(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let i=`
|
|
1
|
+
var ts=Object.create;var Ye=Object.defineProperty,rs=Object.defineProperties,ns=Object.getOwnPropertyDescriptor,os=Object.getOwnPropertyDescriptors,is=Object.getOwnPropertyNames,Qe=Object.getOwnPropertySymbols,ss=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty,dn=Object.prototype.propertyIsEnumerable;var un=(e,t,r)=>t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w=(e,t)=>{for(var r in t||(t={}))zt.call(t,r)&&un(e,r,t[r]);if(Qe)for(var r of Qe(t))dn.call(t,r)&&un(e,r,t[r]);return e},N=(e,t)=>rs(e,os(t));var Z=(e,t)=>{var r={};for(var n in e)zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Qe)for(var n of Qe(e))t.indexOf(n)<0&&dn.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var pn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mn=(e,t)=>{for(var r in t)Ye(e,r,{get:t[r],enumerable:!0})},as=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of is(t))!zt.call(e,o)&&o!==r&&Ye(e,o,{get:()=>t[o],enumerable:!(n=ns(t,o))||n.enumerable});return e};var fn=(e,t,r)=>(r=e!=null?ts(ss(e)):{},as(t||!e||!e.__esModule?Ye(r,"default",{value:e,enumerable:!0}):r,e));var E=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())});function ms(e){return!!(e!=null&&e.__nativeBuffers__)}function rr(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!ms(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 o;n.value?o=n.value:n.base64&&(o=fs(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function _s(e={},t=!1){let r=e,n=[];for(let[o,i]of Object.entries(r))if(i!==void 0&&i instanceof ArrayBuffer&&i.byteLength!==void 0){let s=t?{value:i,key:o}:{base64:hs(i),key:o};n.push(s),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}function ks(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function xn(e){return typeof e=="string"}function Oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Ts(e){return typeof e=="undefined"}function xs(e){return Ts(e)||e===null}function In(e){return typeof e=="function"}function Is(e){return Oe(e)&&In(e.then)}function Rn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function Ne(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function $s(e){return new Promise(t=>An(e)(t))}function An(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function Hs(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(i.fire,i)}},i=new Le(o);return i.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function Vs(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Js(e[n],t[n])}function Js(e,t){if(xn(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(In(t)){try{if(e instanceof t)return}catch(r){}if(!xs(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 yn(e,t){return`[${e}]:${t}`}function Qs(e,t){bn||(Xt=new Ze({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),Zt=new Ze({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),er=new Ze({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{Xt.flush(),Zt.flush(),er.flush()}),bn=!0);function r(o){var i,s;let{method:a,args:l,startTime:c,isForeground:d,errMsg:u=`${a}:fail no errMsg`,errNo:p=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:g,invokeCallback:b}=m,h=(s=(i=u.match(/\S:(\S+)\s?/))==null?void 0:i[1])!=null?s:"fail";Xt.report({status:h,method:n(a,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&g&&b&&(Zt.report({status:h,method:a,isForeground:d,duration:Number((g-c).toFixed(3))}),er.report({status:h,method:a,isForeground:d,duration:Number((Date.now()-b).toFixed(3))}))}function n(o,i){return(o==="callHostMethod"||o==="callHostMethodSync")&&i!=null&&i.method?`${o}-${i.method}`:o}return r}function Xs(e,t){let r=0,n=!0,o=new Map,i=Qs(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,tr.forEach(l=>lr(this,[l],function*({method:c,args:d,resolve:u}){let p=yield a(c,d);u(p)})),tr.length=0});let s=(l,c)=>{let d=o.get(Number(l));if(!d)return;let u=rr(c);d(u),o.delete(Number(l))},a=(l,c)=>{var d,u;let p=Date.now(),m=`${n}`;r+=1;let g=new Ss;if(o.set(r,g.resolve),!n&&qs.includes(l))return new Promise(R=>{tr.push({method:l,args:c,resolve:R})});let b=ds(me({},{method:l,startTime:p,args:c,isForeground:m}),{invokeType:"js-bridge"}),h=!Ys&&Gs.includes(l),_=_s(c,h),v=h?_:JSON.stringify(_),S;if(l.endsWith("Sync")||Ws.includes(l)?S=(d=e.call)==null?void 0:d.call(e,l,_,r):typeof v=="string"?S=e.invoke(l,v,r):S=(u=e.call)==null?void 0:u.call(e,l,v,r),S){try{typeof S=="string"&&(S=JSON.parse(S)),S=rr(S)}catch(R){ur.error(R)}return o.delete(r),S.errorCode&&(S.errorCode=yn(l,S.errorCode)),i(me(me({},b),S)),S}return l.endsWith("Sync")&&o.delete(r),g.promise.then(R=>(R.errorCode&&(R.errorCode=yn(l,R.errorCode)),i(me(me({},b),R)),R))};return{invokeNative:a,applyNative:(l,c)=>{let d=a(l,c);return Is(d)?d.then(u=>wn(l,u)):wn(l,d)},invokeHandler:s}}function wn(e,t){if(!Oe(t)){ur.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:o,errorType:i,errorCode:s}=r,a=ps(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new Ps(n,o,i,s);return a}function Zs(e){let t=new ir,r=new ir,n=new Ze({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(o){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:o}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(o,i,s){let a=rr(i),l;if(a.__extra){l=a.params;let{type:c,startTime:d}=a.__extra;n.report({type:c,event:o,duration:Date.now()-d})}else l=a;if(o===Cn){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(De.length),u,s)}catch(p){}});return}if(o.startsWith(De)){r.emit(o.slice(De.length),l,s);return}t.emit(o,l,s)}}}function ea(e){let t=new Map,r;return(n,o,i,s)=>{if(s){let l=i?[i]:"*";e.publish(`${De}${n}`,o,l);return}r||(r=Promise.resolve().then(()=>{t.forEach((l,c)=>{try{let d=c?[c]:"*";e.publish(Cn,l,d)}catch(d){}}),r=void 0,t.clear()}));let a=t.get(i);a||(a=[],t.set(i,a)),a.push([`${De}${n}`,o])}}function ta(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:i}=Zs(e),{invokeNative:s,invokeHandler:a,applyNative:l}=Xs(e,r),c=ea(e);return{invokeHandler:a,subscribeHandler:t,applyNative:l,invokeNative:s,onNative:r,offNative:n,publish:c,subscribe:o,unsubscribe:i}}function Pn(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ls,cs,us,et,kn,Sn,hn,me,ds,ps,lr,fs,hs,cr,gs,_n,vs,ys,gn,bs,ws,Tn,Es,Ss,Rs,As,tt,Cs,Ps,Ns,Qt,ur,Os,Ds,Ls,Us,Fs,Dc,nr,L,js,Ms,Xe,Le,ir,sr,Bs,Yt,Ks,Lc,ar,vn,Uc,De,Gs,qs,Ws,Cn,zs,Ze,bn,Xt,Zt,er,tr,Ys,dr,le,Nn,On,ra,Dn,En,Q,O,re,Fc,na,Ln,jc,Mc,G=k(()=>{"use strict";ls=Object.defineProperty,cs=Object.defineProperties,us=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertySymbols,kn=Object.prototype.hasOwnProperty,Sn=Object.prototype.propertyIsEnumerable,hn=(e,t,r)=>t in e?ls(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,me=(e,t)=>{for(var r in t||(t={}))kn.call(t,r)&&hn(e,r,t[r]);if(et)for(var r of et(t))Sn.call(t,r)&&hn(e,r,t[r]);return e},ds=(e,t)=>cs(e,us(t)),ps=(e,t)=>{var r={};for(var n in e)kn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&et)for(var n of et(e))t.indexOf(n)<0&&Sn.call(e,n)&&(r[n]=e[n]);return r},lr=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())});fs=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer};hs=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)};cr=Object.defineProperty,gs=Object.getOwnPropertyDescriptor,_n=Object.getOwnPropertySymbols,vs=Object.prototype.hasOwnProperty,ys=Object.prototype.propertyIsEnumerable,gn=(e,t,r)=>t in e?cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bs=(e,t)=>{for(var r in t||(t={}))vs.call(t,r)&&gn(e,r,t[r]);if(_n)for(var r of _n(t))ys.call(t,r)&&gn(e,r,t[r]);return e},ws=(e,t)=>{for(var r in t)cr(e,r,{get:t[r],enumerable:!0})},Tn=(e,t,r,n)=>{for(var o=n>1?void 0:n?gs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&cr(t,r,o),o},Es=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((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 o=this._eventListeners[r].indexOf(n);o!==-1&&this._eventListeners[r].splice(o,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}Ss=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))}})}};Rs=(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))(Rs||{}),As=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}},tt=class extends As{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Cs=class extends tt{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Ps=class extends tt{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Ns=class extends tt{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Qt=class extends tt{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};ur={log:Ne("log"),warn:Ne("warn"),info:Ne("info"),error:Ne("error"),debug:Ne("debug")};Object.assign(globalThis,{logger:ur});Os=Symbol.for("Jolibox.canIUseMap"),Ds={};globalThis[Os]=Ds;Ls=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Ls||{}),Us=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Us||{}),Fs=(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))(Fs||{}),Dc={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},nr=class or{constructor(t){this.element=t,this.next=or.Undefined,this.prev=or.Undefined}};nr.Undefined=new nr(void 0);L=nr,js=class{constructor(){this._first=L.Undefined,this._last=L.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===L.Undefined}clear(){let e=this._first;for(;e!==L.Undefined;){let t=e.next;e.prev=L.Undefined,e.next=L.Undefined,e=t}this._first=L.Undefined,this._last=L.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new L(e);if(this._first===L.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==L.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==L.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==L.Undefined&&e.next!==L.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===L.Undefined&&e.next===L.Undefined?(this._first=L.Undefined,this._last=L.Undefined):e.next===L.Undefined?(this._last=this._last.prev,this._last.next=L.Undefined):e.prev===L.Undefined&&(this._first=this._first.next,this._first.prev=L.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==L.Undefined;)yield e.element,e=e.next}},Ms=0,Xe=class{constructor(e){this.value=e,this.id=Ms++}},Le=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 Xe&&(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,o,i,s,a,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Xe(t);this._listeners?this._listeners instanceof Xe?this._listeners=[this._listeners,c]:this._listeners.push(c):((o=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||o.call(n,this),this._listeners=c,(s=(i=this.options)==null?void 0:i.onDidFirstListener)==null||s.call(i,this)),(l=(a=this.options)==null?void 0:a.onDidAddListener)==null||l.call(a,this),this._size++}),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(o){n(o)}}fire(e){this._listeners&&(this._listeners instanceof Xe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ir=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new Le,o=s=>t(...s.args);this.listerHandlerMap.set(t,o),n.event(o),this.listeners.set(e,n);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)n.fire(bs({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new js,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},sr={};ws(sr,{None:()=>Bs,filter:()=>Hs,once:()=>An,toPromise:()=>$s});Bs=()=>{console.log("[Jolibox SDK] None Event")};Yt=Symbol.for("Jolibox.hostEmitter"),Ks=()=>{let e=new ir;return globalThis[Yt]||(globalThis[Yt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Yt]},Lc=Ks();ar=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Le,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 o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return Vs(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};ar=Tn([Rn],ar);vn=class{constructor(){this._onWillExecuteCommand=new Le,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Le,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ar,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=ks(3e4)),this._starActivation}executeCommand(e,...t){return Es(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),sr.toPromise(sr.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}}};vn=Tn([Rn],vn);Uc=Symbol.for("Jolibox.commands");De="custom_event_",Gs=[],qs=[],Ws=["env","createRequestTask","login"],Cn="__batch_event__",zs=e=>e==="pv"?e:"default",Ze=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:o,metricName:i,type:s}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=o,this.metricName=i,this.type=zs(s)}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,o,i)=>{let s=n.shift();if(s){let a=i[s];r[a]||(r[a]={}),t(r[a],n,o,i)}else r[o]||(r[o]=[]),r[o].push(i[o])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,o,i,s)=>{let a=o.shift();if(!a&&Oe(s))throw new Qt(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(a){let l=[];if(Oe(s))l.push(...Object.keys(s));else if(xn(s)){if(o.length>0)throw new Qt(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(s)}else throw new Qt(`expected metric value to be a string, but got a(n) ${typeof s}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=Oe(s)?s[c]:s;t(n[c],[...o],i,d)})}else n[i]?n[i]++:n[i]=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={}}},bn=!1;tr=[],Ys=!1;le={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){le.trigger=e},onDoExit(e){le.exit=e}},Nn=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Cs("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(o="")=>{le.trigger(),e.onDocumentReady.postMessage({path:o})},r=o=>lr(void 0,null,function*(){let i=yield le.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:i})});dr={onDocumentReady:t,doExit:r,invoke(o,i,s){e.invoke.postMessage({event:o,paramsString:i,callbackId:s})},publish(o,i,s){let a=Pn(i,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:s}))},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Nn,doExit:r};globalThis.joliboxJSCore=me({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{le.trigger(),e.onDocumentReady(JSON.stringify({path:o}))},r=o=>lr(void 0,null,function*(){let i=yield le.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:i}))});dr={onDocumentReady:t,invoke(o,i,s){e.invoke(JSON.stringify({event:o,paramsString:i,callbackId:s}))},doExit:r,publish(o,i,s){let a=Pn(i,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:s})},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Nn,doExit:r};globalThis.joliboxJSCore=me({},n)}On=dr;if(!On)throw new Ns("No joliboxJScore is found, native bridge not found.");ra=me({},On),Dn=ta(ra),{invokeHandler:En}=Dn,{applyNative:Q,invokeNative:O,onNative:re,offNative:Fc,subscribeHandler:na,publish:Ln,subscribe:jc,unsubscribe:Mc}=Dn;globalThis.joliboxJSBridge={callHandler:En,invokeHandler:En,subscribeHandler:na}});function ca(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function je(e){return typeof e=="string"}function ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function $n(e){return typeof e=="object"&&Array.isArray(e)}function Me(e){return e===!0||e===!1}function ua(e){return typeof e=="undefined"}function da(e){return ua(e)||e===null}function pa(e){return typeof e=="function"}function Hn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function Kn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,i){for(let s in i)if(Object.prototype.hasOwnProperty.call(i,s)){let a=o[s],l=i[s],c=r(a,l,s,o,i);c!==void 0?o[s]=c:jn(l)&&jn(a)?o[s]=n(Mn({},a),l):Array.isArray(l)&&Array.isArray(a)?o[s]=[...a,...l]:o[s]=l}return o}return n(e,t)}function jn(e){return e&&typeof e=="object"&&e.constructor===Object}function Vn(e,t){if(Array.isArray(e))return e.concat(t)}function Be(e,t,r={}){let n=null,o,i,s,{leading:a=!1,trailing:l=!0}=r,c=()=>(s=e.apply(i,o),o=void 0,i=void 0,s),d=function(...u){o=u,i=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return d.cancel=()=>{n&&clearTimeout(n),n=null,o=i=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,c()},d}function fa(e,t){return(...r)=>t(e,...r)}function it(e){return t=>fa(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new $e(`${o}`))}})}function Ue(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Ra(e){return new Promise(t=>Xn(e)(t))}function Xn(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function Aa(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(i.fire,i)}},i=new Fe(o);return i.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function Pa(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Na(e[n],t[n])}function Na(e,t){if(je(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(pa(t)){try{if(e instanceof t)return}catch(r){}if(!da(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 j(){if(globalThis[mr])return globalThis[mr];let e=new ot,t=new gr,r={registerCommand(n,o,i){e.registerCommand({id:n,handler:o,metadata:i})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[mr]=r,r}var vr,oa,Un,ia,sa,Fn,Mn,aa,Bn,la,fe,ma,yr,br,Jn,Gn,$e,qn,Wn,He,wr,ne,zn,ha,Er,_a,kr,ga,va,rt,ya,ba,wa,Qn,Sr,Ea,ka,Sa,Yn,fr,U,Ta,xa,nt,Fe,he,_r,Ia,pr,Ca,ce,ot,gr,mr,P=k(()=>{"use strict";vr=Object.defineProperty,oa=Object.getOwnPropertyDescriptor,Un=Object.getOwnPropertySymbols,ia=Object.prototype.hasOwnProperty,sa=Object.prototype.propertyIsEnumerable,Fn=(e,t,r)=>t in e?vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mn=(e,t)=>{for(var r in t||(t={}))ia.call(t,r)&&Fn(e,r,t[r]);if(Un)for(var r of Un(t))sa.call(t,r)&&Fn(e,r,t[r]);return e},aa=(e,t)=>{for(var r in t)vr(e,r,{get:t[r],enumerable:!0})},Bn=(e,t,r,n)=>{for(var o=n>1?void 0:n?oa(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&vr(t,r,o),o},la=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((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 o=this._eventListeners[r].indexOf(n);o!==-1&&this._eventListeners[r].splice(o,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}fe=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))}})}};ma=(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))(ma||{}),yr=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}},br=class extends yr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Jn=class extends yr{constructor(){super(...arguments),this.kind="USER_ERROR"}},Gn=class extends Jn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},$e=class extends Jn{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))}},qn=class extends br{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Wn=class extends br{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},He=class extends yr{constructor(e,t,r,n,o){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),o&&(this.priority=o)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},wr=class extends br{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ne={log:Ue("log"),warn:Ue("warn"),info:Ue("info"),error:Ue("error"),debug:Ue("debug")};Object.assign(globalThis,{logger:ne});zn=Symbol.for("Jolibox.canIUseMap"),ha={};globalThis[zn]=ha;Er={get config(){return globalThis[zn]}},_a=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(_a||{}),kr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(kr||{}),ga=(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))(ga||{}),va=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),rt={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},ya=()=>rt.isiOS?"iOS":rt.isAndroid?"Android":rt.isMac?"Mac":rt.isFacebook?"Facebook":"PC",ba="device_id",wa="advertising_id",Qn=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,va()),window.__joliboxLocalStorage__.getItem(e)),Sr=()=>Qn(ba),Ea=()=>Qn(wa),ka=e=>e.charAt(0).toUpperCase()+e.slice(1),Sa=()=>{var e;let t=new URLSearchParams(window.location.search);return ka((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Yn=e=>{let t="JoliboxWebSDK",r=ya(),n=navigator.language,o=Sr(),i=Ea();return`${t} (${Sa()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${i} version/${e||""}`},fr=class hr{constructor(t){this.element=t,this.next=hr.Undefined,this.prev=hr.Undefined}};fr.Undefined=new fr(void 0);U=fr,Ta=class{constructor(){this._first=U.Undefined,this._last=U.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===U.Undefined}clear(){let e=this._first;for(;e!==U.Undefined;){let t=e.next;e.prev=U.Undefined,e.next=U.Undefined,e=t}this._first=U.Undefined,this._last=U.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new U(e);if(this._first===U.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==U.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==U.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==U.Undefined&&e.next!==U.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===U.Undefined&&e.next===U.Undefined?(this._first=U.Undefined,this._last=U.Undefined):e.next===U.Undefined?(this._last=this._last.prev,this._last.next=U.Undefined):e.prev===U.Undefined&&(this._first=this._first.next,this._first.prev=U.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==U.Undefined;)yield e.element,e=e.next}},xa=0,nt=class{constructor(e){this.value=e,this.id=xa++}},Fe=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 nt&&(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,o,i,s,a,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new nt(t);this._listeners?this._listeners instanceof nt?this._listeners=[this._listeners,c]:this._listeners.push(c):((o=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||o.call(n,this),this._listeners=c,(s=(i=this.options)==null?void 0:i.onDidFirstListener)==null||s.call(i,this)),(l=(a=this.options)==null?void 0:a.onDidAddListener)==null||l.call(a,this),this._size++}),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(o){n(o)}}fire(e){this._listeners&&(this._listeners instanceof nt?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},he=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new Fe,o=s=>t(...s.args);this.listerHandlerMap.set(t,o),n.event(o),this.listeners.set(e,n);let i=this.cachedEventQueue.get(e);if(i)for(;i.size>0;)n.fire(Mn({event:e},i.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Ta,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},_r={};aa(_r,{None:()=>Ia,filter:()=>Aa,once:()=>Xn,toPromise:()=>Ra});Ia=()=>{console.log("[Jolibox SDK] None Event")};pr=Symbol.for("Jolibox.hostEmitter"),Ca=()=>{let e=new he;return globalThis[pr]||(globalThis[pr]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[pr]},ce=Ca();ot=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Fe,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 o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return Pa(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};ot=Bn([Hn],ot);gr=class{constructor(){this._onWillExecuteCommand=new Fe,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Fe,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ot,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=ca(3e4)),this._starActivation}executeCommand(e,...t){return la(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),_r.toPromise(_r.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}}};gr=Bn([Hn],gr);mr=Symbol.for("Jolibox.commands")});function K(e,t={}){Tr.emit("ERROR_REPORT",{error:e,options:t})}var Tr,be,oe=k(()=>{"use strict";P();P();Tr=new he,be=new he;K.debounce=Be(K,50,{leading:!0})});var xr,Oa,Zn,eo,to=k(()=>{"use strict";P();oe();xr=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(o){return{}}},Oa=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Zn=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[i,s,a]=o;return{headerJson:xr(i),payloadJson:xr(s),signature:xr(a)}}else throw"joli_source is missing"}catch(r){return K(new qn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},eo=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],o=Oa(e),i=r[2];return`${n}.${o}.${i}`}return t}});var Da,st,ro,Ir=k(()=>{"use strict";P();Da="1.1.13-beta.6",st=()=>Da,ro=()=>{let e=st();return`${Yn(e)}`}});var La,no,Rr,oo,V,Ua,y,J=k(()=>{"use strict";P();to();Ir();P();La={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Sr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:st()},schema:window.location.href,platform:"h5"},Rr=(no=globalThis.joliboxJSCore)==null?void 0:no.env,V=Object.assign({},(oo=Rr==null?void 0:Rr())!=null?oo:La),Ua=()=>{var p,m,g,b,h,_,v,S,R;let{payloadJson:e,headerJson:t,signature:r}=V.schema.length?Zn(V.schema):{},n=`${V.deviceInfo.did}-${new Date().getTime()}`,i=new URL(V.schema.length?V.schema:window.location.href).searchParams,s=(g=(m=(p=i.get("mpId"))!=null?p:i.get("appId"))!=null?m:i.get("gameId"))!=null?g:"",a=(_=(h=(b=V.clientSessionId)!=null?b:e==null?void 0:e.sessionId)!=null?h:i.get("sessionId"))!=null?_:n,l=!!((v=e==null?void 0:e.testAdsMode)!=null?v:i.get("testAdsMode")==="true"),c=(R=(S=e==null?void 0:e.joliboxEnv)!=null?S:i.get("joliboxEnv"))!=null?R:"production",d=c==="staging",u=t==null?void 0:t.channel;return{get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var A;return(A=i.get("joliSource"))!=null?A:null},get mpId(){var A;return(A=s!=null?s:e==null?void 0:e.id)!=null?A:""},get mpVersion(){var A;return(A=t==null?void 0:t.ver)!=null?A:st()},get mpType(){var A,C;return(C=(A=t==null?void 0:t.__mpType)!=null?A:e==null?void 0:e.__mpType)!=null?C:"game"},get platform(){var A;return(A=V.platform)!=null?A:V.deviceInfo.platform},get deviceInfo(){return V.deviceInfo},get sdkInfo(){return V.sdkInfo},get hostInfo(){return V.hostInfo},get hostUserInfo(){return V.hostUserInfo},get sessionId(){var A,C;return(C=(A=V.clientSessionId)!=null?A:a)!=null?C:n},get channel(){return u},get webviewId(){var A;return(A=V.webviewId)!=null?A:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},get baseApiHost(){return d?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:A=>{Kn(V,A,Vn)},encodeJoliSourceQuery:A=>{var C,H;return t&&r?eo(w(w({},e),A),(C=i.get("joliSource"))!=null?C:""):(H=i.get("joliSource"))!=null?H:""}}},y=Ua()});var Ar,so,Fa,ja,io,Ma,ao=k(()=>{"use strict";P();oe();J();P();Ar=!1,so=(e,t)=>e==null?!1:t in e,Fa=e=>so(e,"kind"),ja=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},io=(e,t={},r)=>{var i,s,a;let n={user_id:(s=(i=y.hostUserInfo)==null?void 0:i.uid)!=null?s:"",device_id:(a=y.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:ja(e.name)},o=N(w({},n),{env:t.environment,isFromUser:r});r?be.emit("GLOBAL_USER_ERROR",e,o):be.emit("GLOBAL_ERROR",e,o)},Ma=e=>so(e,"kind")&&e.kind==="USER_ERROR";Tr.on("ERROR_REPORT",({error:e,options:t})=>{if(Ar)return;Ar=!0;let r=Fa(e)&&e.raw?e.raw:e;try{let n=Ma(e);io(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),i=new wr(`${o}, origin error: ${r.message}`);ne.error(i),io(new wr(i.message),{environment:t.environment},!1)}finally{Ar=!1}})});var _e,Cr,xe=k(()=>{"use strict";oe();P();oe();_e=(e,t)=>{var r,n;return new He((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Cr=e=>new Gn(e)});var lo=k(()=>{"use strict";ao();xe();P();G();be.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};O("trackAsync",{event:"reportJsError",data:r})});be.on("GLOBAL_USER_ERROR",(e,t)=>{ne.log("UserError",e,t)})});var Pr=k(()=>{"use strict"});function co(e,t){let r=(n,o,i)=>{let s=N(w({tag:n},t),{extra:w({},o)});n=="globalJsError"?K(new Wn(JSON.stringify(s))):e("systemLog",s,i)};return r.debounce=Be(r,500,{leading:!0}),r}function uo(e){let t=(r,n,o)=>{var a;let i=(a=o&&JSON.stringify(o))!=null?a:0,s={speed_value_type:r,total_duration:n};i&&Object.assign(s,{extra:i}),e("joliboxSpeedAnalysis",s)};return t.debounce=Be(t,500,{leading:!0}),t}var po=k(()=>{"use strict";P();P();oe()});function mo(e,t){let r=co(e,t),n=uo(r);return{track:r,trackPerformance:n}}var fo=k(()=>{"use strict";po()});var ho=k(()=>{"use strict";J();P();P()});var _o=k(()=>{"use strict";fo();Pr();ho()});var at,go=k(()=>{"use strict";at=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,o,i=!1,s=0,a=()=>{if(!i)return;let m=Date.now(),g=m-r;g>=this.interval&&(this.visible&&(s+=g,t(s)),r=m),n=requestAnimationFrame(a)},l=()=>{d(),r=Date.now(),o=window.setInterval(()=>{if(!i)return;let m=Date.now();m-r>=this.interval&&(r=m)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(a)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",m=>{i&&(console.log("visible",m),m?c():l())});let p=this.visible;return{start(){i||(i=!0,p?c():l())},stop(){i=!1,d(),u()}}}}});var Nr=k(()=>{"use strict"});function yo(e,t,r){let{response:n,startTime:o,endTime:i,requestFrom:s}=r,{errMsg:a="",profile:l={}}=n,d={duration:i-o,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:l.socketReused?1:0,request_from:s};(s==="public"&&vo<$a||s==="inner")&&(d.joli_request_number=vo++,setTimeout(()=>{Y("joliboxNetRequestResult",d)},500))}var vo,$a,bo=k(()=>{"use strict";Nr();ge();vo=0,$a=10});function lt(e,t,r){var l,c,d;let n=new Map,o=(l=r==null?void 0:r.baseUrl)!=null?l:"https://api.jolibox.com",i=(c=r==null?void 0:r.type)!=null?c:"public",s=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return re("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let m=u,{requestTaskId:b,state:h}=m,_=Z(m,["requestTaskId","state"]);p.resolve(_),n.delete(b)}else if(u.state==="fail"){let g=u,{requestTaskId:b,state:h}=g,_=Z(g,["requestTaskId","state"]);p.reject(_),n.delete(b)}else ne.warn("onRequestTaskStateChange unknown event",u)}),ce.on("onLoginComplete",({isLogin:u,token:p})=>{u&&p&&(s["X-JOLI-TOKEN"]=p)}),(m,...g)=>E(this,[m,...g],function*(u,p={}){let b=Date.now(),h=Ha(u,N(w({},p),{baseUrl:o})),{method:_="GET",responseType:v="text",dataType:S="json",timeout:R,enableCache:A=!1,appendHostCookie:C=!0}=p,H=Object.assign({"content-type":"application/json"},s,p.header),z={url:h,method:_,header:H,enableCache:A,responseType:v,appendHostCookie:C};if(_=="POST"||_=="PUT"){let te=Va(p.data,H["content-type"]);z.data=te}R&&Object.assign(z,{timeout:R});let{data:{requestTaskId:se}}=O(e,z);if(typeof se!="string")throw _e({code:-1,msg:"requestTaskId is not a string"});let Te=(te,ae)=>{yo("request",h,{state:te,startTime:b,endTime:Date.now(),params:z,response:ae,requestId:se,requestFrom:i=="public"?"public":"inner"})},{resolve:X,reject:ve,promise:Yi}=new fe;n.set(se,{resolve:X,reject:ve});try{let te=yield Yi;Te("success",te);let{data:ae}=te;return S==="json"&&typeof ae=="string"&&(ae=Ka(ae)),{url:h,timeout:R,method:_,response:N(w({},te),{data:ae})}}catch(te){let ae=te;if(ye(ae)){let{errMsg:ze,prefetchDetail:Xi,isPrefetch:Zi,errNo:es}=ae;je(ze)&&(Te("fail",{errMsg:ze,isPrefetch:Zi,prefetchDetail:Xi}),K(_e({code:-1,msg:ze},{errNo:es,errMsg:ze})))}throw te}})}function Ka(e){try{return JSON.parse(e.trim())}catch(t){return e}}function Va(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 Ha,Or=k(()=>{"use strict";P();bo();Nr();G();oe();xe();Ha=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,o=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${o?`?${o}`:""}`:`${e}${o?`?${o}`:""}`}});var Dr,wo,q,Ie=k(()=>{"use strict";Ir();Or();J();Dr={"x-user-agent":ro()};(wo=y.hostUserInfo)!=null&&wo.token&&(Dr["x-joli-token"]=y.hostUserInfo.token);y.joliSource&&(Dr["x-joli-source"]=y.joliSource);q=lt("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:y.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Dr})});var ct,Eo=k(()=>{"use strict";J();go();Ie();G();ct=class extends at{constructor(t,r,n){super(r,n),this.gameId=y.mpId,this.sessionId=y.sessionId,this.track=t}reporter(t){return E(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(q("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:w({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return E(this,null,function*(){let{event:r,params:n}=t;yield Q("userTrackAsync",{event:r,params:w({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var Io={};mn(Io,{nativeTaskEmitter:()=>Ke,taskTracker:()=>W,track:()=>Y,trackPerformance:()=>To});var Ja,ko,So,Y,To,xo,Ke,W,ge=k(()=>{"use strict";lo();P();Pr();_o();J();Eo();G();Ja=(e,t,r)=>{var s,a;let n=t,o=ye(n.extra)?n.extra:je(n.extra)?JSON.parse(n.extra):{},i=N(w({},o),{mp_id:(s=n.mp_id)!=null?s:"",mp_version:(a=n.mp_version)!=null?a:""});O("trackAsync",{event:e,data:i,webviewId:r})},{track:Y,trackPerformance:To}=mo(Ja,{type:kr.AppSDK,platform:"native",jssdk_version:(So=(ko=y.sdkInfo)==null?void 0:ko.jssdkVersion)!=null?So:"1.0.0",mp_id:y.mpId,mp_version:y.mpVersion}),xo=j();xo.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{To(e,t,r)});xo.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Y(e,t)});Ke=new he,W=new ct(Y,Ke)});function Ro(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let i=`
|
|
2
2
|
html[data-jolibox-root] {
|
|
3
3
|
height: 100%;
|
|
4
4
|
margin: 0;
|
|
@@ -16,7 +16,7 @@ var ts=Object.create;var Ye=Object.defineProperty,rs=Object.defineProperties,ns=
|
|
|
16
16
|
min-height: 100dvh;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`;e.textContent=i;let s=document.head||document.getElementsByTagName("head")[0];s.insertBefore(e,s.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function i(a){return E(this,null,function*(){let l=a instanceof URL?a.href:a,c=new Promise((d,u)=>{let p=new XMLHttpRequest;p.open("GET",l),p.responseType="arraybuffer",p.addEventListener("load",()=>d(p.response)),p.addEventListener("error",u),p.send()});try{let d=yield c;return new Response(d,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(d){throw console.error("Failed to load wasm:",d),d}})}let s=window.fetch;window.fetch=(a,l)=>{let c=a instanceof URL?a.href:a.toString();return c.endsWith(".wasm")?i(c):s(a,l)}},o=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),o}var Ao=k(()=>{"use strict"});var ut,Co=k(()=>{"use strict";ut=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}}});var dt,Ga,qa,Wa,za,Po=k(()=>{"use strict";dt=class{constructor(t,r,n,o){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let o=this.checkShouldBanHighFreq(t);if(o)return o;let i=this.checkShouldBanForTime(t);return i?{reason:i}:{reason:"ALLOWED"}};var p,m,g,b,h,_,v;let i=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,s=(m=o==null?void 0:o.banForTimeThreshold)!=null?m:6e4,a=(g=o==null?void 0:o.bannedReleaseTime)!=null?g:6e4,l=(b=o==null?void 0:o.maxAllowedAdsForSession)!=null?b:200,c=(h=o==null?void 0:o.banForSessionThreshold)!=null?h:6e5,d=(_=o==null?void 0:o.initialThreshold)!=null?_:2e3,u=(v=o==null?void 0:o.highFreqThreshold)!=null?v:2e3;this.checkShouldBanInitial=Wa(d),this.checkShouldBanHighFreq=za(u),this.checkShouldBanForTime=qa(i,s,a),this.checkShouldBanForSession=Ga(l,c)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Ga=(e,t)=>{let r=!1,n=[];return i=>{if(r)return"BANNED_FOR_SESSION";let s=Date.now();if(n=n.concat({timestamp:s,type:i}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&s-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},qa=(e,t,r)=>{let n=null,o=d=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{l.value=!1,n=null},d)},i="jolibox-sdk-ads-callbreak-timestamps",s="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var d;try{let u=JSON.parse((d=window.__joliboxLocalStorage__.getItem(i))!=null?d:"[]");Array.isArray(u)?this._records=u:this._records=[]}catch(u){this._records=[]}},get values(){return this._records},set values(d){try{window.__joliboxLocalStorage__.setItem(i,JSON.stringify(d))}catch(u){}this._records=d}},l={_record:!1,init(){var d;try{let u=JSON.parse((d=window.__joliboxLocalStorage__.getItem(s))!=null?d:"false");typeof u=="boolean"&&(this._record=u)}catch(u){this._record=!1}if(this._record){let u=a.values[a.values.length-1],p=u?Date.now()-u.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(d){try{window.__joliboxLocalStorage__.setItem(s,JSON.stringify(d))}catch(u){}this._record=d}};return a.init(),l.init(),d=>{if(l.value)return"WAITING_BANNED_RELEASE";let u=Date.now();if(a.values=a.values.concat({timestamp:u,type:d}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&u-a.values[0].timestamp<=t))return l.value=!0,o(r),"BANNED_FOR_TIME"}},Wa=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},za=(e=2e3)=>{let t=0,r=null;return o=>{if(o==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}}});var pt,No=k(()=>{"use strict";J();pt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return E(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let o=(r=y.channel)!=null?r:"",i=this.configs[o],s=(n=i==null?void 0:i.interstitialRate)!=null?n:1;t=Math.random()<s}return this.firstRun=!1,t}}});var Re,mt,Lr=k(()=>{"use strict";Co();Po();J();No();P();Re=new he,mt=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>y.mpId;this.getTestAdsMode=()=>y.testAdsMode;this.asyncLoad=()=>E(this,null,function*(){var s,a,l,c,d;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((s=this.getGameId())!=null?s:"")),i=(a=this.getTestAdsMode())!=null?a:!1;try{let u=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${i}`}});t=(l=u.data)==null?void 0:l.clientId,r=(c=u.data)==null?void 0:c.channelId,n=(d=u.data)==null?void 0:d.unitId}catch(u){console.error("Failed to fetch client info",u)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>E(this,null,function*(){var o;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(o=this.getTestAdsMode())!=null?o:!1;if(!document.getElementById(r)&&this.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.channelId&&i.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(i),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{let r=!1,n=t.adBreakDone,o=s=>{var a;r=!0,this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:s.breakType,breakName:(a=s.breakName)!=null?a:"",breakFormat:s.breakFormat,breakStatus:s.breakStatus}),n&&n(s)};if(t.adBreakDone=o,t.type==="reward"){let s=t.beforeReward,a=c=>()=>{this.track("CallShowAdFn",null),c()},l=c=>{r=!0,s&&s(a(c))};t.beforeReward=l,window.setTimeout(()=>{var c,d;r||(this.track("CallAdBreakTimeout",{type:t.type}),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:(c=t.name)!=null?c:"",breakFormat:"reward",breakStatus:"timeout"}))},1e4)}if((s=>s.type==="preroll")(t)){Re.emit("isAdShowing",!0);let s=t.adBreakDone,a=l=>{Re.emit("isAdShowing",!1),s&&s(l)};return N(w({},t),{adBreakDone:a})}else{let s=t.beforeAd,a=t.afterAd,l=()=>{var d;r=!0,Re.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(d=t.name)!=null?d:""}),s&&s()},c=()=>{var d;r=!0,Re.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(d=t.name)!=null?d:""}),a&&a()};return N(w({},t),{beforeAd:l,afterAd:c})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=Z(o,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var a,l,c,d,u,p;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(l=t.adBreakDone)==null||l.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(u=t.adBreakDone)==null||u.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((d=n==null?void 0:n.count)!=null?d:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let o=t.type,i;switch(o){case"preroll":i={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":i={type:o,name:(p=t.name)!=null?p:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",i);let s=this.wrapAdBreakParams(t);this.push(s),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>E(this,null,function*(){var p,m,g,b;if(this.track("CallAdUnit",{adFormat:(m=(p=t.adFormat)==null?void 0:p.toString())!=null?m:null,fullWidthResponsive:(g=t.fullWidthResponsive)!=null?g:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:o,fullWidthResponsive:i,style:s}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let l=n;if(l||(l=this.unitId),!l)throw new Error("slot is required");let c=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,d=document.createElement("ins");if(d.className="adsbygoogle",d.id="jolibox-ads",d.style.display="block",d.setAttribute("data-ad-client",this.clientId),d.setAttribute("data-ad-slot",l),c&&d.setAttribute("data-ad-format",c),i&&d.setAttribute("data-full-width-responsive",i),s&&d.setAttribute("style",s),(b=this.getTestAdsMode())!=null?b:!1){let h=document.createElement("div");h.style.position="absolute",h.style.top="0",h.style.left="0",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center",h.style.backgroundColor="rgba(0, 0, 0, 0.5)",h.style.color="white",h.innerHTML="Test Ad",d.style.position="relative",a.appendChild(d),d.appendChild(h)}else a.appendChild(d),new MutationObserver(_=>{_.forEach(v=>{if(v.type==="attributes"&&v.attributeName==="data-ad-status"){let S=d.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:S!=null?S:"null"})}})}).observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new dt(t,r,n),this.adsActionDetection=new ut(this.track),this.channelPolicy=new pt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function ue(e,t){for(var r in t)e[r]=t[r];return e}function qr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ee(e,t,r){var n,o,i,s={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?wt.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return _t(e,s,n,o,null)}function _t(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o!=null?o:++Zo,__i:-1,__u:0};return o==null&&T.vnode!=null&&T.vnode(i),i}function ke(e){return e.children}function de(e,t){this.props=e,this.context=t}function Ae(e,t){if(t==null)return e.__?Ae(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Ae(e):null}function oi(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return oi(e)}}function Do(e){(!e.__d&&(e.__d=!0)&&we.push(e)&&!vt.__r++||Oo!==T.debounceRendering)&&((Oo=T.debounceRendering)||ei)(vt)}function vt(){for(var e,t,r,n,o,i,s,a=1;we.length;)we.length>a&&we.sort(ti),e=we.shift(),a=we.length,e.__d&&(r=void 0,o=(n=(t=e).__v).__e,i=[],s=[],t.__P&&((r=ue({},n)).__v=n.__v+1,T.vnode&&T.vnode(r),Wr(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[o]:null,i,o!=null?o:Ae(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,ai(i,r,s),r.__e!=o&&oi(r)));vt.__r=0}function ii(e,t,r,n,o,i,s,a,l,c,d){var u,p,m,g,b,h,_=n&&n.__k||ni,v=t.length;for(l=Ya(r,t,_,l,v),u=0;u<v;u++)(m=r.__k[u])!=null&&(p=m.__i===-1?Je:_[m.__i]||Je,m.__i=u,h=Wr(e,m,p,o,i,s,a,l,c,d),g=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&zr(p.ref,null,m),d.push(m.ref,m.__c||g,m)),b==null&&g!=null&&(b=g),4&m.__u||p.__k===m.__k?l=si(m,l,e):typeof m.type=="function"&&h!==void 0?l=h:g&&(l=g.nextSibling),m.__u&=-7);return r.__e=b,l}function Ya(e,t,r,n,o){var i,s,a,l,c,d=r.length,u=d,p=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(l=i+p,(s=e.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?_t(null,s,null,null,null):We(s)?_t(ke,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?_t(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,(c=s.__i=Xa(s,r,l,u))!==-1&&(u--,(a=r[c])&&(a.__u|=2)),a==null||a.__v===null?(c==-1&&(o>d?p--:o<d&&p++),typeof s.type!="function"&&(s.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,s.__u|=4))):e.__k[i]=null;if(u)for(i=0;i<d;i++)(a=r[i])!=null&&!(2&a.__u)&&(a.__e==n&&(n=Ae(a)),ci(a,a));return n}function si(e,t,r){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=si(n[o],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Ae(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function yt(e,t){return t=t||[],e==null||typeof e=="boolean"||(We(e)?e.some(function(r){yt(r,t)}):t.push(e)),t}function Xa(e,t,r,n){var o,i,s=e.key,a=e.type,l=t[r];if(l===null&&e.key==null||l&&s==l.key&&a===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(o=r-1,i=r+1;o>=0||i<t.length;){if(o>=0){if((l=t[o])&&!(2&l.__u)&&s==l.key&&a===l.type)return o;o--}if(i<t.length){if((l=t[i])&&!(2&l.__u)&&s==l.key&&a===l.type)return i;i++}}return-1}function Lo(e,t,r){t[0]=="-"?e.setProperty(t,r!=null?r:""):e[t]=r==null?"":typeof r!="number"||Qa.test(t)?r:r+"px"}function ft(e,t,r,n,o){var i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Lo(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Lo(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(ri,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n?r.t=n.t:(r.t=Gr,e.addEventListener(t,i?Br:Mr,i)):e.removeEventListener(t,i?Br:Mr,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r!=null?r:"";break e}catch(s){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Uo(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Gr++;else if(t.u<r.t)return;return r(T.event?T.event(t):t)}}}function Wr(e,t,r,n,o,i,s,a,l,c){var d,u,p,m,g,b,h,_,v,S,R,A,C,H,z,se,Te,X=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[a=t.__e=r.__e]),(d=T.__b)&&d(t);e:if(typeof X=="function")try{if(_=t.props,v="prototype"in X&&X.prototype.render,S=(d=X.contextType)&&n[d.__c],R=d?S?S.props.value:d.__:n,r.__c?h=(u=t.__c=r.__c).__=u.__E:(v?t.__c=u=new X(_,R):(t.__c=u=new de(_,R),u.constructor=X,u.render=el),S&&S.sub(u),u.props=_,u.state||(u.state={}),u.context=R,u.__n=n,p=u.__d=!0,u.__h=[],u._sb=[]),v&&u.__s==null&&(u.__s=u.state),v&&X.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=ue({},u.__s)),ue(u.__s,X.getDerivedStateFromProps(_,u.__s))),m=u.props,g=u.state,u.__v=t,p)v&&X.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),v&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(v&&X.getDerivedStateFromProps==null&&_!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(_,R),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(_,u.__s,R)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(u.props=_,u.state=u.__s,u.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ve){ve&&(ve.__=t)}),A=0;A<u._sb.length;A++)u.__h.push(u._sb[A]);u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(_,u.__s,R),v&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,g,b)})}if(u.context=R,u.props=_,u.__P=e,u.__e=!1,C=T.__r,H=0,v){for(u.state=u.__s,u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),z=0;z<u._sb.length;z++)u.__h.push(u._sb[z]);u._sb=[]}else do u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++H<25);u.state=u.__s,u.getChildContext!=null&&(n=ue(ue({},n),u.getChildContext())),v&&!p&&u.getSnapshotBeforeUpdate!=null&&(b=u.getSnapshotBeforeUpdate(m,g)),se=d,d!=null&&d.type===ke&&d.key==null&&(se=li(d.props.children)),a=ii(e,We(se)?se:[se],t,r,n,o,i,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),h&&(u.__E=u.__=null)}catch(ve){if(t.__v=null,l||i!=null)if(ve.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__e=a}else for(Te=i.length;Te--;)qr(i[Te]);else t.__e=r.__e,t.__k=r.__k;T.__e(ve,t,r)}else i==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=Za(r.__e,t,r,n,o,i,s,l,c);return(d=T.diffed)&&d(t),128&t.__u?void 0:a}function ai(e,t,r){for(var n=0;n<r.length;n++)zr(r[n],r[++n],r[++n]);T.__c&&T.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){T.__e(i,o.__v)}})}function li(e){return typeof e!="object"||e==null?e:We(e)?e.map(li):ue({},e)}function Za(e,t,r,n,o,i,s,a,l){var c,d,u,p,m,g,b,h=r.props,_=t.props,v=t.type;if(v=="svg"?o="http://www.w3.org/2000/svg":v=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((m=i[c])&&"setAttribute"in m==!!v&&(v?m.localName==v:m.nodeType==3)){e=m,i[c]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(o,v,_.is&&_),a&&(T.__m&&T.__m(t,i),a=!1),i=null}if(v===null)h===_||a&&e.data===_||(e.data=_);else{if(i=i&&wt.call(e.childNodes),h=r.props||Je,!a&&i!=null)for(h={},c=0;c<e.attributes.length;c++)h[(m=e.attributes[c]).name]=m.value;for(c in h)if(m=h[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=m;else if(!(c in _)){if(c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _)continue;ft(e,c,null,m,o)}}for(c in _)m=_[c],c=="children"?p=m:c=="dangerouslySetInnerHTML"?d=m:c=="value"?g=m:c=="checked"?b=m:a&&typeof m!="function"||h[c]===m||ft(e,c,m,h[c],o);if(d)a||u&&(d.__html===u.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),ii(t.type==="template"?e.content:e,We(p)?p:[p],t,r,n,v=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:r.__k&&Ae(r,0),a,l),i!=null)for(c=i.length;c--;)qr(i[c]);a||(c="value",v=="progress"&&g==null?e.removeAttribute("value"):g!==void 0&&(g!==e[c]||v=="progress"&&!g||v=="option"&&g!==h[c])&&ft(e,c,g,h[c],o),c="checked",b!==void 0&&b!==e[c]&&ft(e,c,b,h[c],o))}return e}function zr(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){T.__e(o,r)}}function ci(e,t,r){var n,o;if(T.unmount&&T.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||zr(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){T.__e(i,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&ci(n[o],t,r||typeof e.type!="function");r||qr(e.__e),e.__c=e.__=e.__e=void 0}function el(e,t,r){return this.constructor(e,r)}function $r(e,t,r){var n,o,i,s;t==document&&(t=document.documentElement),T.__&&T.__(e,t),o=(n=!1)?null:t.__k,i=[],s=[],Wr(t,e=t.__k=Ee(ke,null,[e]),o||Je,Je,t.namespaceURI,o?null:t.firstChild?wt.call(t.childNodes):null,i,o?o.__e:t.firstChild,n,s),ai(i,e,s)}function Qr(e,t){M.__h&&M.__h(F,e,qe||t),qe=0;var r=F.__H||(F.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Hr(e){return qe=1,tl(mi,e)}function tl(e,t,r){var n=Qr(Ge++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):mi(void 0,t),function(a){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,a);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=F,!F.__f)){var o=function(a,l,c){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return!!p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,a,l,c);var u=n.__c.props!==a;return d.forEach(function(p){if(p.__N){var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(u=!0)}}),i&&i.call(this,a,l,c)||u};F.__f=!0;var i=F.shouldComponentUpdate,s=F.componentWillUpdate;F.componentWillUpdate=function(a,l,c){if(this.__e){var d=i;i=void 0,o(a,l,c),i=d}s&&s.call(this,a,l,c)},F.shouldComponentUpdate=o}return n.__N||n.__}function Ve(e,t){var r=Qr(Ge++,3);!M.__s&&pi(r.__H,t)&&(r.__=e,r.u=t,F.__H.__h.push(r))}function bt(e){return qe=5,di(function(){return{current:e}},[])}function di(e,t){var r=Qr(Ge++,7);return pi(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ee(e,t){return qe=8,di(function(){return e},t)}function rl(){for(var e;e=ui.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(gt),e.__H.__h.forEach(Kr),e.__H.__h=[]}catch(t){e.__H.__h=[],M.__e(t,e.__v)}}function nl(e){var t,r=function(){clearTimeout(n),Vo&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Vo&&(t=requestAnimationFrame(r))}function gt(e){var t=F,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),F=t}function Kr(e){var t=F;e.__c=e.__(),F=t}function pi(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function mi(e,t){return typeof t=="function"?t(e):t}function fi(e,t){for(var r in t)e[r]=t[r];return e}function Vr(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function Jo(e,t){this.props=e,this.context=t}function ol(e,t){function r(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:Vr(this.props,o)}function n(o){return this.shouldComponentUpdate=r,Ee(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function sl(e){function t(r){var n=fi({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=il,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}function hi(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=fi({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return hi(n,t,r)})),e}function _i(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return _i(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Fr(){this.__u=0,this.o=null,this.__b=null}function gi(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ht(){this.i=null,this.l=null}function fl(){}function hl(){return this.cancelBubble}function _l(){return this.defaultPrevented}function I(e,t,r,n,o,i){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--vl,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return T.vnode&&T.vnode(c),c}function xl(a){var l=a,{elementTag:e="Image",src:t="",children:r,handleExposure:n,className:o,imgStyle:i}=l,s=Z(l,["elementTag","src","children","handleExposure","className","imgStyle"]);let c=Tl(()=>{t&&n()});return e==="Image"?I("div",{className:o,style:{borderRadius:"8px"},children:Ee("img",N(w({},s),{ref:c,src:t!=null?t:"",style:w({display:"block",width:"100%",height:"auto",objectFit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"8px"},i||{})}))}):I("div",N(w({},s),{ref:c,className:o,children:r}))}function Il(e,t){if(!e)return null;let r=Array.isArray(t)?t[0]:t,n=Array.isArray(t)?t[1]:0;return Array.isArray(e)?e.map((o,i)=>o&&typeof o=="object"&&"type"in o?Ee(o.type,N(w({},o.props),{style:N(w({},o.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0}),key:o.key||i})):o):e&&typeof e=="object"&&"type"in e?Ee(e.type,N(w({},e.props),{style:N(w({},e.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0})})):e}var wt,T,Zo,we,Oo,ei,ti,ri,Gr,Mr,Br,Je,ni,Qa,We,Ge,F,Ur,Fo,qe,ui,M,jo,Mo,Bo,$o,Ho,Ko,Vo,Go,il,al,qo,Wo,ll,cl,ul,dl,pl,ml,zo,gl,Qo,Yo,Xo,vl,jr,yl,bl,wl,El,kl,Sl,Tl,vi,yi,Rl,Al,Cl,Pl,Jr,Nl,bi,wi=k(()=>{"use strict";Je={},ni=[],Qa=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,We=Array.isArray;wt=ni.slice,T={__e:function(e,t,r,n){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},Zo=0,de.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ue({},this.state),typeof e=="function"&&(e=e(ue({},r),this.props)),e&&ue(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Do(this))},de.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Do(this))},de.prototype.render=ke,we=[],ei=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ti=function(e,t){return e.__v.__b-t.__v.__b},vt.__r=0,ri=/(PointerCapture)$|Capture$/i,Gr=0,Mr=Uo(!1),Br=Uo(!0);qe=0,ui=[],M=T,jo=M.__b,Mo=M.__r,Bo=M.diffed,$o=M.__c,Ho=M.unmount,Ko=M.__;M.__b=function(e){F=null,jo&&jo(e)},M.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ko&&Ko(e,t)},M.__r=function(e){Mo&&Mo(e),Ge=0;var t=(F=e.__c).__H;t&&(Ur===F?(t.__h=[],F.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(gt),t.__h.forEach(Kr),t.__h=[],Ge=0)),Ur=F},M.diffed=function(e){Bo&&Bo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ui.push(t)!==1&&Fo===M.requestAnimationFrame||((Fo=M.requestAnimationFrame)||nl)(rl)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Ur=F=null},M.__c=function(e,t){t.some(function(r){try{r.__h.forEach(gt),r.__h=r.__h.filter(function(n){return!n.__||Kr(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],M.__e(n,r.__v)}}),$o&&$o(e,t)},M.unmount=function(e){Ho&&Ho(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{gt(n)}catch(o){t=o}}),r.__H=void 0,t&&M.__e(t,r.__v))};Vo=typeof requestAnimationFrame=="function";(Jo.prototype=new de).isPureReactComponent=!0,Jo.prototype.shouldComponentUpdate=function(e,t){return Vr(this.props,e)||Vr(this.state,t)};Go=T.__b;T.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Go&&Go(e)};il=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;al=T.__e;T.__e=function(e,t,r,n){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}al(e,t,r,n)};qo=T.unmount;T.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),qo&&qo(e)},(Fr.prototype=new de).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var o=gi(n.__v),i=!1,s=function(){i||(i=!0,r.__R=null,o?o(a):a())};r.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=_i(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(s,s)},Fr.prototype.componentWillUnmount=function(){this.o=[]},Fr.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=hi(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&Ee(ke,null,e.fallback);return o&&(o.__u&=-33),[Ee(ke,null,t.__a?null:e.children),o]};Wo=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(ht.prototype=new de).__a=function(e){var t=this,r=gi(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),Wo(t,e,n)):o()};r?r(i):i()}},ht.prototype.render=function(e){this.i=null,this.l=new Map;var t=yt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},ht.prototype.componentDidUpdate=ht.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Wo(e,r,t)})};ll=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,cl=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ul=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,dl=/[A-Z0-9]/g,pl=typeof document<"u",ml=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};de.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(de.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});zo=T.event;T.event=function(e){return zo&&(e=zo(e)),e.persist=fl,e.isPropagationStopped=hl,e.isDefaultPrevented=_l,e.nativeEvent=e};gl={enumerable:!1,configurable:!0,get:function(){return this.class}},Qo=T.vnode;T.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,o={},i=n.indexOf("-")===-1;for(var s in r){var a=r[s];if(!(s==="value"&&"defaultValue"in r&&a==null||pl&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||ml(r.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":ul.test(s)&&(s=l):l=s="oninput":i&&cl.test(s)?s=s.replace(dl,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&o[s=l]&&(s="oninputCapture"),o[s]=a}}n=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=yt(r.children).forEach(function(c){c.props.selected=o.value.indexOf(c.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=yt(r.children).forEach(function(c){c.props.selected=o.multiple?o.defaultValue.indexOf(c.props.value)!=-1:o.defaultValue==c.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",gl)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o}(e),e.$$typeof=ll,Qo&&Qo(e)};Yo=T.__r;T.__r=function(e){Yo&&Yo(e),e.__c};Xo=T.diffed;T.diffed=function(e){Xo&&Xo(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value)};vl=0;jr={drawerBackdrop:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"flex-end",zIndex:1e3,overflow:"hidden",touchAction:"none"},drawer:{backgroundColor:"white",borderRadius:"16px 16px 0 0",width:"100%",maxWidth:"100%",overflowY:"auto",position:"relative",boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.1)",display:"flex",flexDirection:"column",margin:"0 auto"},drawerContent:{flex:1,width:"100%",height:"100%",overflow:"auto",margin:"0 auto"}},yl=`
|
|
19
|
+
`;e.textContent=i;let s=document.head||document.getElementsByTagName("head")[0];s.insertBefore(e,s.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function i(a){return E(this,null,function*(){let l=a instanceof URL?a.href:a,c=new Promise((d,u)=>{let p=new XMLHttpRequest;p.open("GET",l),p.responseType="arraybuffer",p.addEventListener("load",()=>d(p.response)),p.addEventListener("error",u),p.send()});try{let d=yield c;return new Response(d,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(d){throw console.error("Failed to load wasm:",d),d}})}let s=window.fetch;window.fetch=(a,l)=>{let c=a instanceof URL?a.href:a.toString();return c.endsWith(".wasm")?i(c):s(a,l)}},o=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),o}var Ao=k(()=>{"use strict"});var ut,Co=k(()=>{"use strict";ut=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}}});var dt,Ga,qa,Wa,za,Po=k(()=>{"use strict";dt=class{constructor(t,r,n,o){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let o=this.checkShouldBanHighFreq(t);if(o)return o;let i=this.checkShouldBanForTime(t);return i?{reason:i}:{reason:"ALLOWED"}};var p,m,g,b,h,_,v;let i=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,s=(m=o==null?void 0:o.banForTimeThreshold)!=null?m:6e4,a=(g=o==null?void 0:o.bannedReleaseTime)!=null?g:6e4,l=(b=o==null?void 0:o.maxAllowedAdsForSession)!=null?b:200,c=(h=o==null?void 0:o.banForSessionThreshold)!=null?h:6e5,d=(_=o==null?void 0:o.initialThreshold)!=null?_:2e3,u=(v=o==null?void 0:o.highFreqThreshold)!=null?v:2e3;this.checkShouldBanInitial=Wa(d),this.checkShouldBanHighFreq=za(u),this.checkShouldBanForTime=qa(i,s,a),this.checkShouldBanForSession=Ga(l,c)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Ga=(e,t)=>{let r=!1,n=[];return i=>{if(r)return"BANNED_FOR_SESSION";let s=Date.now();if(n=n.concat({timestamp:s,type:i}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&s-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},qa=(e,t,r)=>{let n=null,o=d=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{l.value=!1,n=null},d)},i="jolibox-sdk-ads-callbreak-timestamps",s="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var d;try{let u=JSON.parse((d=window.__joliboxLocalStorage__.getItem(i))!=null?d:"[]");Array.isArray(u)?this._records=u:this._records=[]}catch(u){this._records=[]}},get values(){return this._records},set values(d){try{window.__joliboxLocalStorage__.setItem(i,JSON.stringify(d))}catch(u){}this._records=d}},l={_record:!1,init(){var d;try{let u=JSON.parse((d=window.__joliboxLocalStorage__.getItem(s))!=null?d:"false");typeof u=="boolean"&&(this._record=u)}catch(u){this._record=!1}if(this._record){let u=a.values[a.values.length-1],p=u?Date.now()-u.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(d){try{window.__joliboxLocalStorage__.setItem(s,JSON.stringify(d))}catch(u){}this._record=d}};return a.init(),l.init(),d=>{if(l.value)return"WAITING_BANNED_RELEASE";let u=Date.now();if(a.values=a.values.concat({timestamp:u,type:d}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&u-a.values[0].timestamp<=t))return l.value=!0,o(r),"BANNED_FOR_TIME"}},Wa=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},za=(e=2e3)=>{let t=0,r=null;return o=>{if(o==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}}});var pt,No=k(()=>{"use strict";J();pt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return E(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let o=(r=y.channel)!=null?r:"",i=this.configs[o],s=(n=i==null?void 0:i.interstitialRate)!=null?n:1;t=Math.random()<s}return this.firstRun=!1,t}}});var Re,mt,Lr=k(()=>{"use strict";Co();Po();J();No();P();Re=new he,mt=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>y.mpId;this.getTestAdsMode=()=>y.testAdsMode;this.asyncLoad=()=>E(this,null,function*(){var s,a,l,c,d;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((s=this.getGameId())!=null?s:"")),i=(a=this.getTestAdsMode())!=null?a:!1;try{let u=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${i}`}});t=(l=u.data)==null?void 0:l.clientId,r=(c=u.data)==null?void 0:c.channelId,n=(d=u.data)==null?void 0:d.unitId}catch(u){console.error("Failed to fetch client info",u)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>E(this,null,function*(){var o;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(o=this.getTestAdsMode())!=null?o:!1;if(!document.getElementById(r)&&this.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.channelId&&i.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(i),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{let r=!1,n=t.adBreakDone,o=s=>{var a;r=!0,this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:s.breakType,breakName:(a=s.breakName)!=null?a:"",breakFormat:s.breakFormat,breakStatus:s.breakStatus}),n&&n(s)};if(t.adBreakDone=o,t.type==="reward"){let s=t.beforeReward,a=c=>()=>{this.track("CallShowAdFn",null),c()},l=c=>{r=!0,s&&s(a(c))};t.beforeReward=l,window.setTimeout(()=>{var c,d;r||(this.track("CallAdBreakTimeout",{type:t.type}),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:(c=t.name)!=null?c:"",breakFormat:"reward",breakStatus:"timeout"}))},5e3)}if((s=>s.type==="preroll")(t)){Re.emit("isAdShowing",!0);let s=t.adBreakDone,a=l=>{Re.emit("isAdShowing",!1),s&&s(l)};return N(w({},t),{adBreakDone:a})}else{let s=t.beforeAd,a=t.afterAd,l=()=>{var d;r=!0,Re.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(d=t.name)!=null?d:""}),s&&s()},c=()=>{var d;r=!0,Re.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(d=t.name)!=null?d:""}),a&&a()};return N(w({},t),{beforeAd:l,afterAd:c})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=Z(o,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var a,l,c,d,u,p;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(l=t.adBreakDone)==null||l.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(u=t.adBreakDone)==null||u.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((d=n==null?void 0:n.count)!=null?d:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let o=t.type,i;switch(o){case"preroll":i={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":i={type:o,name:(p=t.name)!=null?p:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",i);let s=this.wrapAdBreakParams(t);this.push(s),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>E(this,null,function*(){var p,m,g,b;if(this.track("CallAdUnit",{adFormat:(m=(p=t.adFormat)==null?void 0:p.toString())!=null?m:null,fullWidthResponsive:(g=t.fullWidthResponsive)!=null?g:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:o,fullWidthResponsive:i,style:s}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let l=n;if(l||(l=this.unitId),!l)throw new Error("slot is required");let c=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,d=document.createElement("ins");if(d.className="adsbygoogle",d.id="jolibox-ads",d.style.display="block",d.setAttribute("data-ad-client",this.clientId),d.setAttribute("data-ad-slot",l),c&&d.setAttribute("data-ad-format",c),i&&d.setAttribute("data-full-width-responsive",i),s&&d.setAttribute("style",s),(b=this.getTestAdsMode())!=null?b:!1){let h=document.createElement("div");h.style.position="absolute",h.style.top="0",h.style.left="0",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center",h.style.backgroundColor="rgba(0, 0, 0, 0.5)",h.style.color="white",h.innerHTML="Test Ad",d.style.position="relative",a.appendChild(d),d.appendChild(h)}else a.appendChild(d),new MutationObserver(_=>{_.forEach(v=>{if(v.type==="attributes"&&v.attributeName==="data-ad-status"){let S=d.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:S!=null?S:"null"})}})}).observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new dt(t,r,n),this.adsActionDetection=new ut(this.track),this.channelPolicy=new pt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function ue(e,t){for(var r in t)e[r]=t[r];return e}function qr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ee(e,t,r){var n,o,i,s={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?wt.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return _t(e,s,n,o,null)}function _t(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o!=null?o:++Zo,__i:-1,__u:0};return o==null&&T.vnode!=null&&T.vnode(i),i}function ke(e){return e.children}function de(e,t){this.props=e,this.context=t}function Ae(e,t){if(t==null)return e.__?Ae(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Ae(e):null}function oi(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return oi(e)}}function Do(e){(!e.__d&&(e.__d=!0)&&we.push(e)&&!vt.__r++||Oo!==T.debounceRendering)&&((Oo=T.debounceRendering)||ei)(vt)}function vt(){for(var e,t,r,n,o,i,s,a=1;we.length;)we.length>a&&we.sort(ti),e=we.shift(),a=we.length,e.__d&&(r=void 0,o=(n=(t=e).__v).__e,i=[],s=[],t.__P&&((r=ue({},n)).__v=n.__v+1,T.vnode&&T.vnode(r),Wr(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[o]:null,i,o!=null?o:Ae(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,ai(i,r,s),r.__e!=o&&oi(r)));vt.__r=0}function ii(e,t,r,n,o,i,s,a,l,c,d){var u,p,m,g,b,h,_=n&&n.__k||ni,v=t.length;for(l=Ya(r,t,_,l,v),u=0;u<v;u++)(m=r.__k[u])!=null&&(p=m.__i===-1?Je:_[m.__i]||Je,m.__i=u,h=Wr(e,m,p,o,i,s,a,l,c,d),g=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&zr(p.ref,null,m),d.push(m.ref,m.__c||g,m)),b==null&&g!=null&&(b=g),4&m.__u||p.__k===m.__k?l=si(m,l,e):typeof m.type=="function"&&h!==void 0?l=h:g&&(l=g.nextSibling),m.__u&=-7);return r.__e=b,l}function Ya(e,t,r,n,o){var i,s,a,l,c,d=r.length,u=d,p=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(l=i+p,(s=e.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?_t(null,s,null,null,null):We(s)?_t(ke,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?_t(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,(c=s.__i=Xa(s,r,l,u))!==-1&&(u--,(a=r[c])&&(a.__u|=2)),a==null||a.__v===null?(c==-1&&(o>d?p--:o<d&&p++),typeof s.type!="function"&&(s.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,s.__u|=4))):e.__k[i]=null;if(u)for(i=0;i<d;i++)(a=r[i])!=null&&!(2&a.__u)&&(a.__e==n&&(n=Ae(a)),ci(a,a));return n}function si(e,t,r){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=si(n[o],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Ae(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function yt(e,t){return t=t||[],e==null||typeof e=="boolean"||(We(e)?e.some(function(r){yt(r,t)}):t.push(e)),t}function Xa(e,t,r,n){var o,i,s=e.key,a=e.type,l=t[r];if(l===null&&e.key==null||l&&s==l.key&&a===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(o=r-1,i=r+1;o>=0||i<t.length;){if(o>=0){if((l=t[o])&&!(2&l.__u)&&s==l.key&&a===l.type)return o;o--}if(i<t.length){if((l=t[i])&&!(2&l.__u)&&s==l.key&&a===l.type)return i;i++}}return-1}function Lo(e,t,r){t[0]=="-"?e.setProperty(t,r!=null?r:""):e[t]=r==null?"":typeof r!="number"||Qa.test(t)?r:r+"px"}function ft(e,t,r,n,o){var i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Lo(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Lo(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(ri,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n?r.t=n.t:(r.t=Gr,e.addEventListener(t,i?Br:Mr,i)):e.removeEventListener(t,i?Br:Mr,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r!=null?r:"";break e}catch(s){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Uo(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Gr++;else if(t.u<r.t)return;return r(T.event?T.event(t):t)}}}function Wr(e,t,r,n,o,i,s,a,l,c){var d,u,p,m,g,b,h,_,v,S,R,A,C,H,z,se,Te,X=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[a=t.__e=r.__e]),(d=T.__b)&&d(t);e:if(typeof X=="function")try{if(_=t.props,v="prototype"in X&&X.prototype.render,S=(d=X.contextType)&&n[d.__c],R=d?S?S.props.value:d.__:n,r.__c?h=(u=t.__c=r.__c).__=u.__E:(v?t.__c=u=new X(_,R):(t.__c=u=new de(_,R),u.constructor=X,u.render=el),S&&S.sub(u),u.props=_,u.state||(u.state={}),u.context=R,u.__n=n,p=u.__d=!0,u.__h=[],u._sb=[]),v&&u.__s==null&&(u.__s=u.state),v&&X.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=ue({},u.__s)),ue(u.__s,X.getDerivedStateFromProps(_,u.__s))),m=u.props,g=u.state,u.__v=t,p)v&&X.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),v&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(v&&X.getDerivedStateFromProps==null&&_!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(_,R),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(_,u.__s,R)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(u.props=_,u.state=u.__s,u.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ve){ve&&(ve.__=t)}),A=0;A<u._sb.length;A++)u.__h.push(u._sb[A]);u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(_,u.__s,R),v&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,g,b)})}if(u.context=R,u.props=_,u.__P=e,u.__e=!1,C=T.__r,H=0,v){for(u.state=u.__s,u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),z=0;z<u._sb.length;z++)u.__h.push(u._sb[z]);u._sb=[]}else do u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++H<25);u.state=u.__s,u.getChildContext!=null&&(n=ue(ue({},n),u.getChildContext())),v&&!p&&u.getSnapshotBeforeUpdate!=null&&(b=u.getSnapshotBeforeUpdate(m,g)),se=d,d!=null&&d.type===ke&&d.key==null&&(se=li(d.props.children)),a=ii(e,We(se)?se:[se],t,r,n,o,i,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),h&&(u.__E=u.__=null)}catch(ve){if(t.__v=null,l||i!=null)if(ve.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__e=a}else for(Te=i.length;Te--;)qr(i[Te]);else t.__e=r.__e,t.__k=r.__k;T.__e(ve,t,r)}else i==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=Za(r.__e,t,r,n,o,i,s,l,c);return(d=T.diffed)&&d(t),128&t.__u?void 0:a}function ai(e,t,r){for(var n=0;n<r.length;n++)zr(r[n],r[++n],r[++n]);T.__c&&T.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){T.__e(i,o.__v)}})}function li(e){return typeof e!="object"||e==null?e:We(e)?e.map(li):ue({},e)}function Za(e,t,r,n,o,i,s,a,l){var c,d,u,p,m,g,b,h=r.props,_=t.props,v=t.type;if(v=="svg"?o="http://www.w3.org/2000/svg":v=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((m=i[c])&&"setAttribute"in m==!!v&&(v?m.localName==v:m.nodeType==3)){e=m,i[c]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(o,v,_.is&&_),a&&(T.__m&&T.__m(t,i),a=!1),i=null}if(v===null)h===_||a&&e.data===_||(e.data=_);else{if(i=i&&wt.call(e.childNodes),h=r.props||Je,!a&&i!=null)for(h={},c=0;c<e.attributes.length;c++)h[(m=e.attributes[c]).name]=m.value;for(c in h)if(m=h[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=m;else if(!(c in _)){if(c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _)continue;ft(e,c,null,m,o)}}for(c in _)m=_[c],c=="children"?p=m:c=="dangerouslySetInnerHTML"?d=m:c=="value"?g=m:c=="checked"?b=m:a&&typeof m!="function"||h[c]===m||ft(e,c,m,h[c],o);if(d)a||u&&(d.__html===u.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),ii(t.type==="template"?e.content:e,We(p)?p:[p],t,r,n,v=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:r.__k&&Ae(r,0),a,l),i!=null)for(c=i.length;c--;)qr(i[c]);a||(c="value",v=="progress"&&g==null?e.removeAttribute("value"):g!==void 0&&(g!==e[c]||v=="progress"&&!g||v=="option"&&g!==h[c])&&ft(e,c,g,h[c],o),c="checked",b!==void 0&&b!==e[c]&&ft(e,c,b,h[c],o))}return e}function zr(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){T.__e(o,r)}}function ci(e,t,r){var n,o;if(T.unmount&&T.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||zr(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){T.__e(i,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&ci(n[o],t,r||typeof e.type!="function");r||qr(e.__e),e.__c=e.__=e.__e=void 0}function el(e,t,r){return this.constructor(e,r)}function $r(e,t,r){var n,o,i,s;t==document&&(t=document.documentElement),T.__&&T.__(e,t),o=(n=!1)?null:t.__k,i=[],s=[],Wr(t,e=t.__k=Ee(ke,null,[e]),o||Je,Je,t.namespaceURI,o?null:t.firstChild?wt.call(t.childNodes):null,i,o?o.__e:t.firstChild,n,s),ai(i,e,s)}function Qr(e,t){M.__h&&M.__h(F,e,qe||t),qe=0;var r=F.__H||(F.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Hr(e){return qe=1,tl(mi,e)}function tl(e,t,r){var n=Qr(Ge++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):mi(void 0,t),function(a){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,a);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=F,!F.__f)){var o=function(a,l,c){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return!!p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,a,l,c);var u=n.__c.props!==a;return d.forEach(function(p){if(p.__N){var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(u=!0)}}),i&&i.call(this,a,l,c)||u};F.__f=!0;var i=F.shouldComponentUpdate,s=F.componentWillUpdate;F.componentWillUpdate=function(a,l,c){if(this.__e){var d=i;i=void 0,o(a,l,c),i=d}s&&s.call(this,a,l,c)},F.shouldComponentUpdate=o}return n.__N||n.__}function Ve(e,t){var r=Qr(Ge++,3);!M.__s&&pi(r.__H,t)&&(r.__=e,r.u=t,F.__H.__h.push(r))}function bt(e){return qe=5,di(function(){return{current:e}},[])}function di(e,t){var r=Qr(Ge++,7);return pi(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ee(e,t){return qe=8,di(function(){return e},t)}function rl(){for(var e;e=ui.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(gt),e.__H.__h.forEach(Kr),e.__H.__h=[]}catch(t){e.__H.__h=[],M.__e(t,e.__v)}}function nl(e){var t,r=function(){clearTimeout(n),Vo&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Vo&&(t=requestAnimationFrame(r))}function gt(e){var t=F,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),F=t}function Kr(e){var t=F;e.__c=e.__(),F=t}function pi(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function mi(e,t){return typeof t=="function"?t(e):t}function fi(e,t){for(var r in t)e[r]=t[r];return e}function Vr(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function Jo(e,t){this.props=e,this.context=t}function ol(e,t){function r(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:Vr(this.props,o)}function n(o){return this.shouldComponentUpdate=r,Ee(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function sl(e){function t(r){var n=fi({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=il,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}function hi(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=fi({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return hi(n,t,r)})),e}function _i(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return _i(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Fr(){this.__u=0,this.o=null,this.__b=null}function gi(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ht(){this.i=null,this.l=null}function fl(){}function hl(){return this.cancelBubble}function _l(){return this.defaultPrevented}function I(e,t,r,n,o,i){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--vl,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return T.vnode&&T.vnode(c),c}function xl(a){var l=a,{elementTag:e="Image",src:t="",children:r,handleExposure:n,className:o,imgStyle:i}=l,s=Z(l,["elementTag","src","children","handleExposure","className","imgStyle"]);let c=Tl(()=>{t&&n()});return e==="Image"?I("div",{className:o,style:{borderRadius:"8px"},children:Ee("img",N(w({},s),{ref:c,src:t!=null?t:"",style:w({display:"block",width:"100%",height:"auto",objectFit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"8px"},i||{})}))}):I("div",N(w({},s),{ref:c,className:o,children:r}))}function Il(e,t){if(!e)return null;let r=Array.isArray(t)?t[0]:t,n=Array.isArray(t)?t[1]:0;return Array.isArray(e)?e.map((o,i)=>o&&typeof o=="object"&&"type"in o?Ee(o.type,N(w({},o.props),{style:N(w({},o.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0}),key:o.key||i})):o):e&&typeof e=="object"&&"type"in e?Ee(e.type,N(w({},e.props),{style:N(w({},e.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0})})):e}var wt,T,Zo,we,Oo,ei,ti,ri,Gr,Mr,Br,Je,ni,Qa,We,Ge,F,Ur,Fo,qe,ui,M,jo,Mo,Bo,$o,Ho,Ko,Vo,Go,il,al,qo,Wo,ll,cl,ul,dl,pl,ml,zo,gl,Qo,Yo,Xo,vl,jr,yl,bl,wl,El,kl,Sl,Tl,vi,yi,Rl,Al,Cl,Pl,Jr,Nl,bi,wi=k(()=>{"use strict";Je={},ni=[],Qa=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,We=Array.isArray;wt=ni.slice,T={__e:function(e,t,r,n){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},Zo=0,de.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ue({},this.state),typeof e=="function"&&(e=e(ue({},r),this.props)),e&&ue(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Do(this))},de.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Do(this))},de.prototype.render=ke,we=[],ei=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ti=function(e,t){return e.__v.__b-t.__v.__b},vt.__r=0,ri=/(PointerCapture)$|Capture$/i,Gr=0,Mr=Uo(!1),Br=Uo(!0);qe=0,ui=[],M=T,jo=M.__b,Mo=M.__r,Bo=M.diffed,$o=M.__c,Ho=M.unmount,Ko=M.__;M.__b=function(e){F=null,jo&&jo(e)},M.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ko&&Ko(e,t)},M.__r=function(e){Mo&&Mo(e),Ge=0;var t=(F=e.__c).__H;t&&(Ur===F?(t.__h=[],F.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(gt),t.__h.forEach(Kr),t.__h=[],Ge=0)),Ur=F},M.diffed=function(e){Bo&&Bo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ui.push(t)!==1&&Fo===M.requestAnimationFrame||((Fo=M.requestAnimationFrame)||nl)(rl)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Ur=F=null},M.__c=function(e,t){t.some(function(r){try{r.__h.forEach(gt),r.__h=r.__h.filter(function(n){return!n.__||Kr(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],M.__e(n,r.__v)}}),$o&&$o(e,t)},M.unmount=function(e){Ho&&Ho(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{gt(n)}catch(o){t=o}}),r.__H=void 0,t&&M.__e(t,r.__v))};Vo=typeof requestAnimationFrame=="function";(Jo.prototype=new de).isPureReactComponent=!0,Jo.prototype.shouldComponentUpdate=function(e,t){return Vr(this.props,e)||Vr(this.state,t)};Go=T.__b;T.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Go&&Go(e)};il=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;al=T.__e;T.__e=function(e,t,r,n){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}al(e,t,r,n)};qo=T.unmount;T.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),qo&&qo(e)},(Fr.prototype=new de).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var o=gi(n.__v),i=!1,s=function(){i||(i=!0,r.__R=null,o?o(a):a())};r.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=_i(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(s,s)},Fr.prototype.componentWillUnmount=function(){this.o=[]},Fr.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=hi(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&Ee(ke,null,e.fallback);return o&&(o.__u&=-33),[Ee(ke,null,t.__a?null:e.children),o]};Wo=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(ht.prototype=new de).__a=function(e){var t=this,r=gi(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),Wo(t,e,n)):o()};r?r(i):i()}},ht.prototype.render=function(e){this.i=null,this.l=new Map;var t=yt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},ht.prototype.componentDidUpdate=ht.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Wo(e,r,t)})};ll=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,cl=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ul=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,dl=/[A-Z0-9]/g,pl=typeof document<"u",ml=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};de.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(de.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});zo=T.event;T.event=function(e){return zo&&(e=zo(e)),e.persist=fl,e.isPropagationStopped=hl,e.isDefaultPrevented=_l,e.nativeEvent=e};gl={enumerable:!1,configurable:!0,get:function(){return this.class}},Qo=T.vnode;T.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,o={},i=n.indexOf("-")===-1;for(var s in r){var a=r[s];if(!(s==="value"&&"defaultValue"in r&&a==null||pl&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||ml(r.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":ul.test(s)&&(s=l):l=s="oninput":i&&cl.test(s)?s=s.replace(dl,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&o[s=l]&&(s="oninputCapture"),o[s]=a}}n=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=yt(r.children).forEach(function(c){c.props.selected=o.value.indexOf(c.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=yt(r.children).forEach(function(c){c.props.selected=o.multiple?o.defaultValue.indexOf(c.props.value)!=-1:o.defaultValue==c.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",gl)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o}(e),e.$$typeof=ll,Qo&&Qo(e)};Yo=T.__r;T.__r=function(e){Yo&&Yo(e),e.__c};Xo=T.diffed;T.diffed=function(e){Xo&&Xo(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value)};vl=0;jr={drawerBackdrop:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"flex-end",zIndex:1e3,overflow:"hidden",touchAction:"none"},drawer:{backgroundColor:"white",borderRadius:"16px 16px 0 0",width:"100%",maxWidth:"100%",overflowY:"auto",position:"relative",boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.1)",display:"flex",flexDirection:"column",margin:"0 auto"},drawerContent:{flex:1,width:"100%",height:"100%",overflow:"auto",margin:"0 auto"}},yl=`
|
|
20
20
|
@keyframes fadeIn {
|
|
21
21
|
from { opacity: 0; }
|
|
22
22
|
to { opacity: 1; }
|
|
@@ -70,6 +70,7 @@ var ts=Object.create;var Ye=Object.defineProperty,rs=Object.defineProperties,ns=
|
|
|
70
70
|
line-height: 24px;
|
|
71
71
|
text-align: center;
|
|
72
72
|
padding: 20px 10px;
|
|
73
|
+
margin-block-end: 0px;
|
|
73
74
|
}
|
|
74
75
|
.games-container {
|
|
75
76
|
flex: 1;
|
|
@@ -78,7 +79,6 @@ var ts=Object.create;var Ye=Object.defineProperty,rs=Object.defineProperties,ns=
|
|
|
78
79
|
}
|
|
79
80
|
.buttons-container {
|
|
80
81
|
position: fixed;
|
|
81
|
-
bottom: 32px;
|
|
82
82
|
left: 0;
|
|
83
83
|
right: 0;
|
|
84
84
|
width: 100%;
|
|
@@ -89,6 +89,17 @@ var ts=Object.create;var Ye=Object.defineProperty,rs=Object.defineProperties,ns=
|
|
|
89
89
|
padding-bottom: 16px;
|
|
90
90
|
padding-left: 16px;
|
|
91
91
|
padding-right: 16px;
|
|
92
|
+
background-color: #1a1a1a;
|
|
93
|
+
}
|
|
94
|
+
@media (orientation: portrait) {
|
|
95
|
+
.buttons-container {
|
|
96
|
+
bottom: 28px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
@media (orientation: landscape) {
|
|
100
|
+
.buttons-container {
|
|
101
|
+
bottom: 0;
|
|
102
|
+
}
|
|
92
103
|
}
|
|
93
104
|
.button-wrapper {
|
|
94
105
|
flex: 0 0 50%;
|
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.13-beta.
|
|
3
|
+
> @jolibox/implement@1.1.13-beta.6 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.13-beta.
|
|
7
|
+
> @jolibox/implement@1.1.13-beta.6 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,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.13-beta.
|
|
4
|
+
"version": "1.1.13-beta.6",
|
|
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.13-beta.
|
|
10
|
-
"@jolibox/types": "1.1.13-beta.
|
|
11
|
-
"@jolibox/native-bridge": "1.1.13-beta.
|
|
9
|
+
"@jolibox/common": "1.1.13-beta.6",
|
|
10
|
+
"@jolibox/types": "1.1.13-beta.6",
|
|
11
|
+
"@jolibox/native-bridge": "1.1.13-beta.6",
|
|
12
12
|
"localforage": "1.10.0",
|
|
13
13
|
"@jolibox/ui": "1.0.0",
|
|
14
14
|
"web-vitals": "4.2.4"
|
package/src/common/ads/index.ts
CHANGED