@jolibox/implement 1.1.13-beta.7 → 1.1.13-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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.7",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
- 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"}))},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();
1
+ var Di=Object.create;var Qt=Object.defineProperty,Ni=Object.defineProperties,Li=Object.getOwnPropertyDescriptor,Ui=Object.getOwnPropertyDescriptors,Fi=Object.getOwnPropertyNames,Qe=Object.getOwnPropertySymbols,Bi=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty,fn=Object.prototype.propertyIsEnumerable;var dn=(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={}))Xt.call(t,r)&&dn(e,r,t[r]);if(Qe)for(var r of Qe(t))fn.call(t,r)&&dn(e,r,t[r]);return e},z=(e,t)=>Ni(e,Ui(t));var Me=(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 mn=(e,t)=>{var r={};for(var n in e)Xt.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&&fn.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);var Mi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Fi(t))!Xt.call(e,i)&&i!==r&&Qt(e,i,{get:()=>t[i],enumerable:!(n=Li(t,i))||n.enumerable});return e};var hn=(e,t,r)=>(r=e!=null?Di(Bi(e)):{},Mi(t||!e||!e.__esModule?Qt(r,"default",{value:e,enumerable:!0}):r,e));var C=(e,t,r)=>new Promise((n,i)=>{var c=p=>{try{m(r.next(p))}catch(b){i(b)}},d=p=>{try{m(r.throw(p))}catch(b){i(b)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(c,d);m((r=r.apply(e,t)).next())});function Wi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function sr(e){return typeof e=="string"}function wn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function En(e){return typeof e=="object"&&Array.isArray(e)}function Yi(e){return typeof e=="undefined"}function zi(e){return Yi(e)||e===null}function Qi(e){return typeof e=="function"}function In(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Tn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,c){for(let d in c)if(Object.prototype.hasOwnProperty.call(c,d)){let m=i[d],p=c[d],b=r(m,p,d,i,c);b!==void 0?i[d]=b:yn(p)&&yn(m)?i[d]=n(ar({},m),p):Array.isArray(p)&&Array.isArray(m)?i[d]=[...m,...p]:i[d]=p}return i}return n(e,t)}function yn(e){return e&&typeof e=="object"&&e.constructor===Object}function Sn(e,t){if(Array.isArray(e))return e.concat(t)}function Ve(e,t,r={}){let n=null,i,c,d,{leading:m=!1,trailing:p=!0}=r,b=()=>(d=e.apply(c,i),i=void 0,c=void 0,d),v=function(...S){i=S,c=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p&&!g&&b()},t),g)return b()};return v.cancel=()=>{n&&clearTimeout(n),n=null,i=c=void 0},v.flush=()=>{if(n)return clearTimeout(n),n=null,b()},v}function ea(e,t){return(...r)=>t(e,...r)}function Cn(e){return t=>ea(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Zi(`${i}`))}})}function je(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function et(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,c)=>(i[c]=String(n[c]),i),{})}return e[r]})}function ia(e){let t=e.location?et(e.location,bn):null,r=e.target?et(e.target,bn):null;return et(Ki(ar({},e),{location:t,target:r}),na)}function fr(e){let t=e.events.map(n=>ia(n)),r=et(e.device,oa);return[e.protocolVersion,t,r,e.project]}function ha(e){return new Promise(t=>Nn(e)(t))}function Nn(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function ga(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(c.fire,c)}},c=new $e(i);return c.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function ya(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ba(e[n],t[n])}function ba(e,t){if(sr(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Qi(t)){try{if(e instanceof t)return}catch(r){}if(!zi(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[er])return globalThis[er];let e=new tt,t=new or,r={registerCommand(n,i,c){e.registerCommand({id:n,handler:i,metadata:c})},executeCommand(n,...i){return t.executeCommand(n,...i)},excuteCommandSync(n,...i){return t.executeCommandThowErr(n,...i)}};return globalThis[er]=r,r}var ir,ji,$i,Vi,gn,Hi,Ji,vn,ar,Ki,Gi,_n,qi,Xi,cr,ur,Rn,An,Zi,xn,kn,rt,lr,ce,Pn,ta,dr,He,xe,ra,bn,na,oa,mr,Xe,aa,sa,ca,On,pr,ua,la,da,Dn,tr,G,fa,ma,Ze,$e,de,nr,pa,Zt,va,Je,tt,or,er,V=K(()=>{"use strict";ir=Object.defineProperty,ji=Object.defineProperties,$i=Object.getOwnPropertyDescriptor,Vi=Object.getOwnPropertyDescriptors,gn=Object.getOwnPropertySymbols,Hi=Object.prototype.hasOwnProperty,Ji=Object.prototype.propertyIsEnumerable,vn=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ar=(e,t)=>{for(var r in t||(t={}))Hi.call(t,r)&&vn(e,r,t[r]);if(gn)for(var r of gn(t))Ji.call(t,r)&&vn(e,r,t[r]);return e},Ki=(e,t)=>ji(e,Vi(t)),Gi=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})},_n=(e,t,r,n)=>{for(var i=n>1?void 0:n?$i(t,r):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&ir(t,r,i),i},qi=(e,t,r)=>new Promise((n,i)=>{var c=p=>{try{m(r.next(p))}catch(b){i(b)}},d=p=>{try{m(r.throw(p))}catch(b){i(b)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(c,d);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 i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Xi=(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))(Xi||{}),cr=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}},ur=class extends cr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Rn=class extends cr{constructor(){super(...arguments),this.kind="USER_ERROR"}},An=class extends Rn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Zi=class extends Rn{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))}},xn=class extends ur{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},kn=class extends ur{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},rt=class extends cr{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},lr=class extends ur{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:je("log"),warn:je("warn"),info:je("info"),error:je("error"),debug:je("debug")};Object.assign(globalThis,{logger:ce});Pn=Symbol.for("Jolibox.canIUseMap"),ta={};globalThis[Pn]=ta;dr={get config(){return globalThis[Pn]}},He=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(He||{}),xe=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(xe||{}),ra=(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))(ra||{}),bn=["name","params"],na=["name","type","location","target","extra","timestamp","userId"],oa=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];mr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Xe={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")},aa=()=>Xe.isiOS?"iOS":Xe.isAndroid?"Android":Xe.isMac?"Mac":Xe.isFacebook?"Facebook":"PC",sa="device_id",ca="advertising_id",On=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,mr()),window.__joliboxLocalStorage__.getItem(e)),pr=()=>On(sa),ua=()=>On(ca),la=e=>e.charAt(0).toUpperCase()+e.slice(1),da=()=>{var e;let t=new URLSearchParams(window.location.search);return la((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Dn=e=>{let t="JoliboxWebSDK",r=aa(),n=navigator.language,i=pr(),c=ua();return`${t} (${da()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${c} version/${e||""}`},tr=class rr{constructor(t){this.element=t,this.next=rr.Undefined,this.prev=rr.Undefined}};tr.Undefined=new tr(void 0);G=tr,fa=class{constructor(){this._first=G.Undefined,this._last=G.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===G.Undefined}clear(){let e=this._first;for(;e!==G.Undefined;){let t=e.next;e.prev=G.Undefined,e.next=G.Undefined,e=t}this._first=G.Undefined,this._last=G.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new G(e);if(this._first===G.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==G.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==G.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==G.Undefined&&e.next!==G.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===G.Undefined&&e.next===G.Undefined?(this._first=G.Undefined,this._last=G.Undefined):e.next===G.Undefined?(this._last=this._last.prev,this._last.next=G.Undefined):e.prev===G.Undefined&&(this._first=this._first.next,this._first.prev=G.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==G.Undefined;)yield e.element,e=e.next}},ma=0,Ze=class{constructor(e){this.value=e,this.id=ma++}},$e=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 Ze&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,c,d,m,p;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let b=new Ze(t);this._listeners?this._listeners instanceof Ze?this._listeners=[this._listeners,b]:this._listeners.push(b):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=b,(d=(c=this.options)==null?void 0:c.onDidFirstListener)==null||d.call(c,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(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Ze?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},de=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 $e,i=d=>t(...d.args);this.listerHandlerMap.set(t,i),n.event(i),this.listeners.set(e,n);let c=this.cachedEventQueue.get(e);if(c)for(;c.size>0;)n.fire(ar({event:e},c.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 fa,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},nr={};Gi(nr,{None:()=>pa,filter:()=>ga,once:()=>Nn,toPromise:()=>ha});pa=()=>{console.log("[Jolibox SDK] None Event")};Zt=Symbol.for("Jolibox.hostEmitter"),va=()=>{let e=new de;return globalThis[Zt]||(globalThis[Zt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Zt]},Je=va();tt=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new $e,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return ya(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};tt=_n([In],tt);or=class{constructor(){this._onWillExecuteCommand=new $e,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new $e,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new tt,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Wi(3e4)),this._starActivation}executeCommand(e,...t){return qi(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),nr.toPromise(nr.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}}};or=_n([In],or);er=Symbol.for("Jolibox.commands")});function ue(e,t={}){hr.emit("ERROR_REPORT",{error:e,options:t})}var hr,we,_e=K(()=>{"use strict";V();V();hr=new de,we=new de;ue.debounce=Ve(ue,50,{leading:!0})});var gr,_a,Ln,Un,Fn=K(()=>{"use strict";V();_e();gr=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},_a=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Ln=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[c,d,m]=i;return{headerJson:gr(c),payloadJson:gr(d),signature:gr(m)}}else throw"joli_source is missing"}catch(r){return ue(new xn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Un=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=_a(e),c=r[2];return`${n}.${i}.${c}`}return t}});var wa,nt,Bn,vr=K(()=>{"use strict";V();wa="1.1.13-beta.8",nt=()=>wa,Bn=()=>{let e=nt();return`${Dn(e)}`}});var Ea,Mn,yr,jn,Z,Ia,A,ee=K(()=>{"use strict";V();Fn();vr();V();Ea={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:pr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:nt()},schema:window.location.href,platform:"h5"},yr=(Mn=globalThis.joliboxJSCore)==null?void 0:Mn.env,Z=Object.assign({},(jn=yr==null?void 0:yr())!=null?jn:Ea),Ia=()=>{var g,I,O,D,k,P,H,F,te;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?Ln(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,c=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,d=(O=(I=(g=c.get("mpId"))!=null?g:c.get("appId"))!=null?I:c.get("gameId"))!=null?O:"",m=(P=(k=(D=Z.clientSessionId)!=null?D:e==null?void 0:e.sessionId)!=null?k:c.get("sessionId"))!=null?P:n,p=!!((H=e==null?void 0:e.testAdsMode)!=null?H:c.get("testAdsMode")==="true"),b=(te=(F=e==null?void 0:e.joliboxEnv)!=null?F:c.get("joliboxEnv"))!=null?te:"production",v=b==="staging",S=t==null?void 0:t.channel;return{get testMode(){return v},get testAdsMode(){return p},get joliboxEnv(){return b},get joliSource(){var B;return(B=c.get("joliSource"))!=null?B:null},get mpId(){var B;return(B=d!=null?d:e==null?void 0:e.id)!=null?B:""},get mpVersion(){var B;return(B=t==null?void 0:t.ver)!=null?B:nt()},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 v?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:B=>{Tn(Z,B,Sn)},encodeJoliSourceQuery:B=>{var T,U;return t&&r?Un($($({},e),B),(T=c.get("joliSource"))!=null?T:""):(U=c.get("joliSource"))!=null?U:""}}},A=Ia()});var br,Vn,Ta,Sa,$n,Ra,Hn=K(()=>{"use strict";V();_e();ee();V();br=!1,Vn=(e,t)=>e==null?!1:t in e,Ta=e=>Vn(e,"kind"),Sa=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},$n=(e,t={},r)=>{var c,d,m;let n={user_id:(d=(c=A.hostUserInfo)==null?void 0:c.uid)!=null?d:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:Sa(e.name)},i=z($({},n),{env:t.environment,isFromUser:r});r?we.emit("GLOBAL_USER_ERROR",e,i):we.emit("GLOBAL_ERROR",e,i)},Ra=e=>Vn(e,"kind")&&e.kind==="USER_ERROR";hr.on("ERROR_REPORT",({error:e,options:t})=>{if(br)return;br=!0;let r=Ta(e)&&e.raw?e.raw:e;try{let n=Ra(e);$n(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),c=new lr(`${i}, origin error: ${r.message}`);ce.error(c),$n(new lr(c.message),{environment:t.environment},!1)}finally{br=!1}})});var _r,wr=K(()=>{"use strict";_e();V();_e();_r=e=>new An(e)});function Jn(e,t){let r=(n,i,c)=>{let d=z($({tag:n},t),{extra:$({},i)});n=="globalJsError"?ue(new kn(JSON.stringify(d))):e("systemLog",d,c)};return r.debounce=Ve(r,500,{leading:!0}),r}function Kn(e){let t=(r,n,i)=>{var m;let c=(m=i&&JSON.stringify(i))!=null?m:0,d={speed_value_type:r,total_duration:n};c&&Object.assign(d,{extra:c}),e("joliboxSpeedAnalysis",d)};return t.debounce=Ve(t,500,{leading:!0}),t}var Gn=K(()=>{"use strict";V();V();_e()});function qn(e,t){let r=Jn(e,t),n=Kn(r);return{track:r,trackPerformance:n}}var Wn=K(()=>{"use strict";Gn()});var Er=K(()=>{"use strict"});var ot,Yn=K(()=>{"use strict";ee();V();V();ot=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return C(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,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,c,d,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:(c=(i=A.hostInfo)==null?void 0:i.aid)!=null?c:"1",model:(d=A.deviceInfo.model)!=null?d:"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,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return C(this,null,function*(){if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),c=t.target||null,d=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,b={protocolVersion:"1.0.0",events:[z($({},t),{location:i,target:c,extra:d,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(fr(b),n):yield this.doReport(fr(b))}catch(v){ce.log("[Jolibox SDK] report API error",v)}})}}});var Ir=K(()=>{"use strict";Wn();Er();Yn()});var Tr,zn,he,it,ge,Ke=K(()=>{"use strict";vr();ee();Tr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(zn=AbortSignal.timeout)!=null||(AbortSignal.timeout=Tr);he=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 it(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}},it=class{constructor(t){this.xua=Bn();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 C(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:c}=r!=null?r:{},d=n?new URLSearchParams(n):null,m=d==null?void 0:d.toString(),p=`${this.baseUrl}${t}${m?`?${m}`:""}`,b=this.xua,v=this.getJoliSource();c=Object.assign({},c!=null?c:{},b?{"x-user-agent":b}:{},v?{"x-joli-source":v}:{});let S=yield fetch(p,{method:"GET",headers:c,credentials:"include",signal:Tr(i!=null?i:3e4)});return he.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return C(this,null,function*(){try{let{data:n,query:i,timeout:c}=r!=null?r:{},{headers:d}=r!=null?r:{},m=i?new URLSearchParams(i):null,p=m==null?void 0:m.toString(),b=`${this.baseUrl}${t}${p?`?${p}`:""}`,v=this.xua,S=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},S?{"x-joli-source":S}:{});let g=yield fetch(b,{method:"POST",headers:d,body:JSON.stringify(n),signal:Tr(c!=null?c:3e4),credentials:"include"});he.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(O){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(O){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(O){return yield g.text()}return g}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return C(this,null,function*(){try{let{data:n,query:i,timeout:c}=r!=null?r:{},{headers:d}=r!=null?r:{},m=i?new URLSearchParams(i):null,p=m==null?void 0:m.toString(),b=`${this.baseUrl}${t}${p?`?${p}`:""}`,v=this.xua,S=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},S?{"x-joli-source":S}:{});let g=yield fetch(b,{method:"PUT",headers:d,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!g.ok)throw he.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return he.getInstance().recordNetworkRequest(!0),yield g.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=it;ge=he.getInstance()});var Sr,at,Rr=K(()=>{"use strict";ee();Ir();Ke();Sr=class extends ot{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=ge.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n,i;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(i=A.testMode)!=null&&i?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},at=new Sr});var Aa,Qn=K(()=>{"use strict";Hn();V();wr();V();Rr();ee();Aa=(e,t)=>{var i,c,d;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:He.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(d=(c=A.hostUserInfo)==null?void 0:c.uid)!=null?d:null};at.trackEvent(n,xe.WebSDK)};we.on("GLOBAL_ERROR",(e,t)=>{Aa(t.tag,e)});we.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var st,Xn=K(()=>{"use strict";st=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,c=!1,d=0,m=()=>{if(!c)return;let I=Date.now(),O=I-r;O>=this.interval&&(this.visible&&(d+=O,t(d)),r=I),n=requestAnimationFrame(m)},p=()=>{v(),r=Date.now(),i=window.setInterval(()=>{if(!c)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},b=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},v=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",I=>{c&&(console.log("visible",I),I?b():p())});let g=this.visible;return{start(){c||(c=!0,g?b():p())},stop(){c=!1,v(),S()}}}}});var ct,Zn=K(()=>{"use strict";ee();Xn();Ke();ct=class extends st{constructor(r,n,i){super(n,i);this.httpClient=ge.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return C(this,null,function*(){let{event:n,params:i}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:$({gameId:this.gameId,sessionId:this.sessionId},i)}})})}tracker(r,n=null){this.track(r,n)}}});var eo,xa,fe,ka,Ar,le,Ee=K(()=>{"use strict";Qn();V();V();Ir();Rr();Zn();ee();Er();eo=ae(),xa={type:xe.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:fe,trackPerformance:ka}=qn((...e)=>{var d,m,p,b;let[,t]=e,r=t,n=wn(r.extra)?r.extra:sr(r.extra)?JSON.parse(r.extra):{},i=z($({},n),{mp_id:(d=r.mp_id)!=null?d:"",mp_version:(m=r.mp_version)!=null?m:""}),c={name:t.tag,type:He.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(b=(p=A.hostUserInfo)==null?void 0:p.uid)!=null?b:null};at.trackEvent(c,xe.WebSDK)},xa);eo.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{ka(e,t,r)});eo.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{fe(e,t)});Ar=new de,le=new ct(fe,Ar)});function to(e){let t=dr.config[e];return t||(t={},dr.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=$({},n)}}var ro=K(()=>{"use strict";V()});function xr(e){no=e}function ut(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>ut(t)):Object.keys(e).reduce((t,r)=>(t[r]=ut(e[r]),t),{})}function ve(e){return typeof e=="number"}function kr(e){let t=Cr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Cr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var no,Y,lt,dt,ft,mt,ke,pt,ht,gt,vt,yt,bt,_t,wt,Et,It,Tt,St,Pr=K(()=>{"use strict";no=!1;Y=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(no)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 ${kr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return ut(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:ut(this._default)}optional(){return this._optional=!0,this}};lt=class extends Y{validate(t){return this._optional&&t===void 0?!0:ve(t)?ve(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ve(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ve(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}},dt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},ft=class extends Y{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ve(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ve(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}},mt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends Y{validate(t){return!0}},pt=class extends Y{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends Y{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},gt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},vt=class extends Y{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 ${kr(t)}`)}return!0}},yt=class extends Y{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(ve(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ve(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ve(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((c,d)=>{if(n.path=`${this.path}[${d}]`,n.errors=this.errors,c===void 0&&n.hasDefault){r[d]=n.defaultValue;return}n.validate(c)||(n.hasFallback?r[d]=n.fallbackValue:i=!1)}),this._uniqueItems){let c=new Map;for(let d in r)c.has(r[d])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${c.get(r[d])}] and ${this.path}[${d}] are identical)`):c.set(r[d],d)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},bt=class extends Y{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Cr(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,c=this._value;c.errors=this.errors;let d=!0;for(let m in i){let p=i[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?c.path=`${this.path}.${m}`:c.path=`${this.path}["${m}"]`,!(p===void 0&&c._optional)){if(p===void 0&&c.hasDefault){i[m]=c.defaultValue;continue}c.validate(p)||(c.hasFallback?i[m]=c.fallbackValue:d=!1)}}return d}},_t=class extends Y{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Cr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let c in this._object){let d=n[c],m=this._object[c];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(c)?m.path=`${this.path}.${c}`:m.path=`${this.path}["${c}"]`,!(m._optional&&d===void 0)){if(d===void 0&&m.hasDefault){n[c]=m.defaultValue;continue}m.validate(d)||(m.hasFallback?n[c]=m.fallbackValue:i=!1)}}return i}},wt=class extends Y{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:kr(this.value),actual:r}):!0}},Et=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let c=0;c<i;c++){let d=this._items[c];if(d.errors=[],d.path=this.path,!d.validate(t))r.push(d.errors.join("; "));else if(!n){n=!0;break}}if(!n){let c=r.join(`
2
+ or `);this.errors.push(c)}return n}},It=class extends Y{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let i=t[n];if(i._optional||i.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,t[i]===void 0&&n.hasDefault){t[i]=n.defaultValue;return}n.validate(t[i])||(n.hasFallback?t[i]=n._fallback:r=!1)}),r}},Tt=class extends Y{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},St=class extends Y{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 Or(e,t,r="param"){if(e.errors=[],e.path=r,xr(!0),!e.validate(t)){let n=e.errors.join(`
3
+ `);throw e.errors.length=0,xr(!1),new TypeError(n)}}var x,Dr=K(()=>{"use strict";Pr();Pr();x={object(e){return new _t(e)},array(e){return new yt(e)},tuple(...e){return new It(...e)},literal(e){return new wt(e)},or(...e){return new Et(...e)},symbol(){return new mt},record(e){return new bt(e)},function(){return new gt},boolean(){return new dt},string(){return new ft},number(){return new lt},undefined(){return new pt},null(){return new ht},unknown(){return new ke},any(){return new ke},as(){return new ke},arraybuffer(){return new Tt},enum(...e){return new vt(...e)},typedarray(e){return new St(e)}}});var Rt,oo,io=K(()=>{"use strict";V();_e();Dr();wr();Rt=1,oo=e=>{function t(n,i){return(...c)=>{var S,g,I,O;let d=Date.now(),m={method:n,trace_id:Rt};Rt+=1;let p="SUCCESS",b=`${n}:ok`,v=0;try{if(i.paramsSchema)try{Or(i.paramsSchema,c,"params")}catch(H){throw _r(`${n}:fail ${H.message}`)}let D=i.implement(...c),k=D,P=`${n}:ok`;if(D&&"code"in D){let{code:H,data:F,message:te}=D;p=H,k=F,P=te}return{code:p,message:P,data:k}}catch(D){let k=D;v=(g=(S=k.code)!=null?S:k.errNo)!=null?g:2e3,p="FAILURE";let P=(O=(I=k.message)!=null?I:k.errMsg)!=null?O:`${D}`;return b=`${n}:${p} ${P.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new rt(b,v)),{code:p,message:b}}finally{let D=Date.now()-d;e("apiInvoked",z($({},m),{duration:D,status:p}))}}}function r(n,i){return(...c)=>C(this,null,function*(){var g,I,O,D;let d=En(c)?c:[c],m=Date.now(),p={method:n,trace_id:Rt};Rt+=1;let b=`${n}:ok`,v="SUCCESS",S={code:v,message:b};try{if(i.paramsSchema)try{Or(i.paramsSchema,d,"params")}catch(H){throw _r(H.message)}let P=yield i.implement(...d);if(P&&"code"in P){let{code:H,data:F,message:te}=P;v=H,b=te,P=F}return Object.assign(S,{code:v,message:b,data:P}),S}catch(k){let P=k,H=(I=(g=P.code)!=null?g:P.errNo)!=null?I:2e3;v="FAILURE";let F=(D=(O=P.message)!=null?O:P.errMsg)!=null?D:`${k}`,te=`${n}:${v} ${F.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:v,message:te}),ue(new rt(te,H)),S}finally{let k=Date.now()-m;e("apiInvoked",z($({},p),{duration:k,status:v}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Ie,Q,Ge=K(()=>{"use strict";ro();Ee();io();Dr();({createAPI:se,createSyncAPI:Ie}=oo(fe)),Q=to("h5")});var uo=pn((co,Fr)=>{(function(e){if(typeof co=="object"&&typeof Fr!="undefined")Fr.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(i,c,d){function m(v,S){if(!c[v]){if(!i[v]){var g=typeof Me=="function"&&Me;if(!S&&g)return g(v,!0);if(p)return p(v,!0);var I=new Error("Cannot find module '"+v+"'");throw I.code="MODULE_NOT_FOUND",I}var O=c[v]={exports:{}};i[v][0].call(O.exports,function(D){var k=i[v][1][D];return m(k||D)},O,O.exports,n,i,c,d)}return c[v].exports}for(var p=typeof Me=="function"&&Me,b=0;b<d.length;b++)m(d[b]);return m}({1:[function(n,i,c){(function(d){"use strict";var m=d.MutationObserver||d.WebKitMutationObserver,p;if(m){var b=0,v=new m(D),S=d.document.createTextNode("");v.observe(S,{characterData:!0}),p=function(){S.data=b=++b%2}}else if(!d.setImmediate&&typeof d.MessageChannel!="undefined"){var g=new d.MessageChannel;g.port1.onmessage=D,p=function(){g.port2.postMessage(0)}}else"document"in d&&"onreadystatechange"in d.document.createElement("script")?p=function(){var P=d.document.createElement("script");P.onreadystatechange=function(){D(),P.onreadystatechange=null,P.parentNode.removeChild(P),P=null},d.document.documentElement.appendChild(P)}:p=function(){setTimeout(D,0)};var I,O=[];function D(){I=!0;for(var P,H,F=O.length;F;){for(H=O,O=[],P=-1;++P<F;)H[P]();F=O.length}I=!1}i.exports=k;function k(P){O.push(P)===1&&!I&&p()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,c){"use strict";var d=n(1);function m(){}var p={},b=["REJECTED"],v=["FULFILLED"],S=["PENDING"];i.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&&k(this,T)}g.prototype.catch=function(T){return this.then(null,T)},g.prototype.then=function(T,U){if(typeof T!="function"&&this.state===v||typeof U!="function"&&this.state===b)return this;var L=new this.constructor(m);if(this.state!==S){var J=this.state===v?T:U;O(L,J,this.outcome)}else this.queue.push(new I(L,T,U));return L};function I(T,U,L){this.promise=T,typeof U=="function"&&(this.onFulfilled=U,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){O(this.promise,this.onFulfilled,T)},I.prototype.callRejected=function(T){p.reject(this.promise,T)},I.prototype.otherCallRejected=function(T){O(this.promise,this.onRejected,T)};function O(T,U,L){d(function(){var J;try{J=U(L)}catch(X){return p.reject(T,X)}J===T?p.reject(T,new TypeError("Cannot resolve promise with itself")):p.resolve(T,J)})}p.resolve=function(T,U){var L=P(D,U);if(L.status==="error")return p.reject(T,L.value);var J=L.value;if(J)k(T,J);else{T.state=v,T.outcome=U;for(var X=-1,re=T.queue.length;++X<re;)T.queue[X].callFulfilled(U)}return T},p.reject=function(T,U){T.state=b,T.outcome=U;for(var L=-1,J=T.queue.length;++L<J;)T.queue[L].callRejected(U);return T};function D(T){var U=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof U=="function")return function(){U.apply(T,arguments)}}function k(T,U){var L=!1;function J(oe){L||(L=!0,p.reject(T,oe))}function X(oe){L||(L=!0,p.resolve(T,oe))}function re(){U(X,J)}var ne=P(re);ne.status==="error"&&J(ne.value)}function P(T,U){var L={};try{L.value=T(U),L.status="success"}catch(J){L.status="error",L.value=J}return L}g.resolve=H;function H(T){return T instanceof this?T:p.resolve(new this(m),T)}g.reject=F;function F(T){var U=new this(m);return p.reject(U,T)}g.all=te;function te(T){var U=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,J=!1;if(!L)return this.resolve([]);for(var X=new Array(L),re=0,ne=-1,oe=new this(m);++ne<L;)me(T[ne],ne);return oe;function me(Ue,We){U.resolve(Ue).then($t,function(Re){J||(J=!0,p.reject(oe,Re))});function $t(Re){X[We]=Re,++re===L&&!J&&(J=!0,p.resolve(oe,X))}}}g.race=B;function B(T){var U=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,J=!1;if(!L)return this.resolve([]);for(var X=-1,re=new this(m);++X<L;)ne(T[X]);return re;function ne(oe){U.resolve(oe).then(function(me){J||(J=!0,p.resolve(re,me))},function(me){J||(J=!0,p.reject(re,me))})}}},{1:1}],3:[function(n,i,c){(function(d){"use strict";typeof d.Promise!="function"&&(d.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,i,c){"use strict";var d=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 b=p();function v(){try{if(!b||!b.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(a){return!1}}function S(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(u){if(u.name!=="TypeError")throw u;for(var a=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new a,f=0;f<o.length;f+=1)l.append(o[f]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function I(o,s){s&&o.then(function(a){s(null,a)},function(a){s(a)})}function O(o,s,a){typeof s=="function"&&o.then(s),typeof a=="function"&&o.catch(a)}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 k(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var P="local-forage-detect-blob-support",H=void 0,F={},te=Object.prototype.toString,B="readonly",T="readwrite";function U(o){for(var s=o.length,a=new ArrayBuffer(s),l=new Uint8Array(a),f=0;f<s;f++)l[f]=o.charCodeAt(f);return a}function L(o){return new g(function(s){var a=o.transaction(P,T),l=S([""]);a.objectStore(P).put(l,"key"),a.onabort=function(f){f.preventDefault(),f.stopPropagation(),s(!1)},a.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),u=navigator.userAgent.match(/Edge\//);s(u||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function J(o){return typeof H=="boolean"?g.resolve(H):L(o).then(function(s){return H=s,H})}function X(o){var s=F[o.name],a={};a.promise=new g(function(l,f){a.resolve=l,a.reject=f}),s.deferredOperations.push(a),s.dbReady?s.dbReady=s.dbReady.then(function(){return a.promise}):s.dbReady=a.promise}function re(o){var s=F[o.name],a=s.deferredOperations.pop();if(a)return a.resolve(),a.promise}function ne(o,s){var a=F[o.name],l=a.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(o,s){return new g(function(a,l){if(F[o.name]=F[o.name]||Jr(),o.db)if(s)X(o),o.db.close();else return a(o.db);var f=[o.name];s&&f.push(o.version);var u=b.open.apply(b,f);s&&(u.onupgradeneeded=function(h){var y=u.result;try{y.createObjectStore(o.storeName),h.oldVersion<=1&&y.createObjectStore(P)}catch(_){if(_.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 _}}),u.onerror=function(h){h.preventDefault(),l(u.error)},u.onsuccess=function(){var h=u.result;h.onversionchange=function(y){y.target.close()},a(h),re(o)}})}function me(o){return oe(o,!1)}function Ue(o){return oe(o,!0)}function We(o,s){if(!o.db)return!0;var a=!o.db.objectStoreNames.contains(o.storeName),l=o.version<o.db.version,f=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),f||a){if(a){var u=o.db.version+1;u>o.version&&(o.version=u)}return!0}return!1}function $t(o){return new g(function(s,a){var l=new FileReader;l.onerror=a,l.onloadend=function(f){var u=btoa(f.target.result||"");s({__local_forage_encoded_blob:!0,data:u,type:o.type})},l.readAsBinaryString(o)})}function Re(o){var s=U(atob(o.data));return S([s],{type:o.type})}function Hr(o){return o&&o.__local_forage_encoded_blob}function No(o){var s=this,a=s._initReady().then(function(){var l=F[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return O(a,o,o),a}function Lo(o){X(o);for(var s=F[o.name],a=s.forages,l=0;l<a.length;l++){var f=a[l];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return o.db=null,me(o).then(function(u){return o.db=u,We(o)?Ue(o):u}).then(function(u){o.db=s.db=u;for(var h=0;h<a.length;h++)a[h]._dbInfo.db=u}).catch(function(u){throw ne(o,u),u})}function pe(o,s,a,l){l===void 0&&(l=1);try{var f=o.db.transaction(o.storeName,s);a(null,f)}catch(u){if(l>0&&(!o.db||u.name==="InvalidStateError"||u.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||u.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Ue(o)}).then(function(){return Lo(o).then(function(){pe(o,s,a,l-1)})}).catch(a);a(u)}}function Jr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Uo(o){var s=this,a={db:null};if(o)for(var l in o)a[l]=o[l];var f=F[a.name];f||(f=Jr(),F[a.name]=f),f.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=No);var u=[];function h(){return g.resolve()}for(var y=0;y<f.forages.length;y++){var _=f.forages[y];_!==s&&u.push(_._initReady().catch(h))}var w=f.forages.slice(0);return g.all(u).then(function(){return a.db=f.db,me(a)}).then(function(E){return a.db=E,We(a,s._defaultConfig.version)?Ue(a):E}).then(function(E){a.db=f.db=E,s._dbInfo=a;for(var R=0;R<w.length;R++){var N=w[R];N!==s&&(N._dbInfo.db=a.db,N._dbInfo.version=a.version)}})}function Fo(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){pe(a._dbInfo,B,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.get(o);w.onsuccess=function(){var E=w.result;E===void 0&&(E=null),Hr(E)&&(E=Re(E)),f(E)},w.onerror=function(){u(w.error)}}catch(E){u(E)}})}).catch(u)});return I(l,s),l}function Bo(o,s){var a=this,l=new g(function(f,u){a.ready().then(function(){pe(a._dbInfo,B,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.openCursor(),E=1;w.onsuccess=function(){var R=w.result;if(R){var N=R.value;Hr(N)&&(N=Re(N));var M=o(N,R.key,E++);M!==void 0?f(M):R.continue()}else f()},w.onerror=function(){u(w.error)}}catch(R){u(R)}})}).catch(u)});return I(l,s),l}function Mo(o,s,a){var l=this;o=D(o);var f=new g(function(u,h){var y;l.ready().then(function(){return y=l._dbInfo,te.call(s)==="[object Blob]"?J(y.db).then(function(_){return _?s:$t(s)}):s}).then(function(_){pe(l._dbInfo,T,function(w,E){if(w)return h(w);try{var R=E.objectStore(l._dbInfo.storeName);_===null&&(_=void 0);var N=R.put(_,o);E.oncomplete=function(){_===void 0&&(_=null),u(_)},E.onabort=E.onerror=function(){var M=N.error?N.error:N.transaction.error;h(M)}}catch(M){h(M)}})}).catch(h)});return I(f,a),f}function jo(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){pe(a._dbInfo,T,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.delete(o);y.oncomplete=function(){f()},y.onerror=function(){u(w.error)},y.onabort=function(){var E=w.error?w.error:w.transaction.error;u(E)}}catch(E){u(E)}})}).catch(u)});return I(l,s),l}function $o(o){var s=this,a=new g(function(l,f){s.ready().then(function(){pe(s._dbInfo,T,function(u,h){if(u)return f(u);try{var y=h.objectStore(s._dbInfo.storeName),_=y.clear();h.oncomplete=function(){l()},h.onabort=h.onerror=function(){var w=_.error?_.error:_.transaction.error;f(w)}}catch(w){f(w)}})}).catch(f)});return I(a,o),a}function Vo(o){var s=this,a=new g(function(l,f){s.ready().then(function(){pe(s._dbInfo,B,function(u,h){if(u)return f(u);try{var y=h.objectStore(s._dbInfo.storeName),_=y.count();_.onsuccess=function(){l(_.result)},_.onerror=function(){f(_.error)}}catch(w){f(w)}})}).catch(f)});return I(a,o),a}function Ho(o,s){var a=this,l=new g(function(f,u){if(o<0){f(null);return}a.ready().then(function(){pe(a._dbInfo,B,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=!1,E=_.openKeyCursor();E.onsuccess=function(){var R=E.result;if(!R){f(null);return}o===0||w?f(R.key):(w=!0,R.advance(o))},E.onerror=function(){u(E.error)}}catch(R){u(R)}})}).catch(u)});return I(l,s),l}function Jo(o){var s=this,a=new g(function(l,f){s.ready().then(function(){pe(s._dbInfo,B,function(u,h){if(u)return f(u);try{var y=h.objectStore(s._dbInfo.storeName),_=y.openKeyCursor(),w=[];_.onsuccess=function(){var E=_.result;if(!E){l(w);return}w.push(E.key),E.continue()},_.onerror=function(){f(_.error)}}catch(E){f(E)}})}).catch(f)});return I(a,o),a}function Ko(o,s){s=k.apply(this,arguments);var a=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||a.name,o.storeName=o.storeName||a.storeName);var l=this,f;if(!o.name)f=g.reject("Invalid arguments");else{var u=o.name===a.name&&l._dbInfo.db,h=u?g.resolve(l._dbInfo.db):me(o).then(function(y){var _=F[o.name],w=_.forages;_.db=y;for(var E=0;E<w.length;E++)w[E]._dbInfo.db=y;return y});o.storeName?f=h.then(function(y){if(y.objectStoreNames.contains(o.storeName)){var _=y.version+1;X(o);var w=F[o.name],E=w.forages;y.close();for(var R=0;R<E.length;R++){var N=E[R];N._dbInfo.db=null,N._dbInfo.version=_}var M=new g(function(j,W){var q=b.open(o.name,_);q.onerror=function(ie){var Be=q.result;Be.close(),W(ie)},q.onupgradeneeded=function(){var ie=q.result;ie.deleteObjectStore(o.storeName)},q.onsuccess=function(){var ie=q.result;ie.close(),j(ie)}});return M.then(function(j){w.db=j;for(var W=0;W<E.length;W++){var q=E[W];q._dbInfo.db=j,re(q._dbInfo)}}).catch(function(j){throw(ne(o,j)||g.resolve()).catch(function(){}),j})}}):f=h.then(function(y){X(o);var _=F[o.name],w=_.forages;y.close();for(var E=0;E<w.length;E++){var R=w[E];R._dbInfo.db=null}var N=new g(function(M,j){var W=b.deleteDatabase(o.name);W.onerror=function(){var q=W.result;q&&q.close(),j(W.error)},W.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},W.onsuccess=function(){var q=W.result;q&&q.close(),M(q)}});return N.then(function(M){_.db=M;for(var j=0;j<w.length;j++){var W=w[j];re(W._dbInfo)}}).catch(function(M){throw(ne(o,M)||g.resolve()).catch(function(){}),M})})}return I(f,s),f}var Go={_driver:"asyncStorage",_initStorage:Uo,_support:v(),iterate:Bo,getItem:Fo,setItem:Mo,removeItem:jo,clear:$o,length:Vo,key:Ho,keys:Jo,dropInstance:Ko};function qo(){return typeof openDatabase=="function"}var ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wo="~~local_forage_type~",Kr=/^~~local_forage_type~([^~]+)~/,Ye="__lfsc__:",Vt=Ye.length,Ht="arbf",Jt="blob",Gr="si08",qr="ui08",Wr="uic8",Yr="si16",zr="si32",Qr="ur16",Xr="ui32",Zr="fl32",en="fl64",tn=Vt+Ht.length,rn=Object.prototype.toString;function nn(o){var s=o.length*.75,a=o.length,l,f=0,u,h,y,_;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var w=new ArrayBuffer(s),E=new Uint8Array(w);for(l=0;l<a;l+=4)u=ye.indexOf(o[l]),h=ye.indexOf(o[l+1]),y=ye.indexOf(o[l+2]),_=ye.indexOf(o[l+3]),E[f++]=u<<2|h>>4,E[f++]=(h&15)<<4|y>>2,E[f++]=(y&3)<<6|_&63;return w}function Kt(o){var s=new Uint8Array(o),a="",l;for(l=0;l<s.length;l+=3)a+=ye[s[l]>>2],a+=ye[(s[l]&3)<<4|s[l+1]>>4],a+=ye[(s[l+1]&15)<<2|s[l+2]>>6],a+=ye[s[l+2]&63];return s.length%3===2?a=a.substring(0,a.length-1)+"=":s.length%3===1&&(a=a.substring(0,a.length-2)+"=="),a}function Yo(o,s){var a="";if(o&&(a=rn.call(o)),o&&(a==="[object ArrayBuffer]"||o.buffer&&rn.call(o.buffer)==="[object ArrayBuffer]")){var l,f=Ye;o instanceof ArrayBuffer?(l=o,f+=Ht):(l=o.buffer,a==="[object Int8Array]"?f+=Gr:a==="[object Uint8Array]"?f+=qr:a==="[object Uint8ClampedArray]"?f+=Wr:a==="[object Int16Array]"?f+=Yr:a==="[object Uint16Array]"?f+=Qr:a==="[object Int32Array]"?f+=zr:a==="[object Uint32Array]"?f+=Xr:a==="[object Float32Array]"?f+=Zr:a==="[object Float64Array]"?f+=en:s(new Error("Failed to get type for BinaryArray"))),s(f+Kt(l))}else if(a==="[object Blob]"){var u=new FileReader;u.onload=function(){var h=Wo+o.type+"~"+Kt(this.result);s(Ye+Jt+h)},u.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 zo(o){if(o.substring(0,Vt)!==Ye)return JSON.parse(o);var s=o.substring(tn),a=o.substring(Vt,tn),l;if(a===Jt&&Kr.test(s)){var f=s.match(Kr);l=f[1],s=s.substring(f[0].length)}var u=nn(s);switch(a){case Ht:return u;case Jt:return S([u],{type:l});case Gr:return new Int8Array(u);case qr:return new Uint8Array(u);case Wr:return new Uint8ClampedArray(u);case Yr:return new Int16Array(u);case Qr:return new Uint16Array(u);case zr:return new Int32Array(u);case Xr:return new Uint32Array(u);case Zr:return new Float32Array(u);case en:return new Float64Array(u);default:throw new Error("Unkown type: "+a)}}var Gt={serialize:Yo,deserialize:zo,stringToBuffer:nn,bufferToString:Kt};function on(o,s,a,l){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],a,l)}function Qo(o){var s=this,a={db:null};if(o)for(var l in o)a[l]=typeof o[l]!="string"?o[l].toString():o[l];var f=new g(function(u,h){try{a.db=openDatabase(a.name,String(a.version),a.description,a.size)}catch(y){return h(y)}a.db.transaction(function(y){on(y,a,function(){s._dbInfo=a,u()},function(_,w){h(w)})},h)});return a.serializer=Gt,f}function be(o,s,a,l,f,u){o.executeSql(a,l,f,function(h,y){y.code===y.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(_,w){w.rows.length?u(_,y):on(_,s,function(){_.executeSql(a,l,f,u)},u)},u):u(h,y)},u)}function Xo(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[o],function(_,w){var E=w.rows.length?w.rows.item(0).value:null;E&&(E=h.serializer.deserialize(E)),f(E)},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function Zo(o,s){var a=this,l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"SELECT * FROM "+h.storeName,[],function(_,w){for(var E=w.rows,R=E.length,N=0;N<R;N++){var M=E.item(N),j=M.value;if(j&&(j=h.serializer.deserialize(j)),j=o(j,M.key,N+1),j!==void 0){f(j);return}}f()},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function an(o,s,a,l){var f=this;o=D(o);var u=new g(function(h,y){f.ready().then(function(){s===void 0&&(s=null);var _=s,w=f._dbInfo;w.serializer.serialize(s,function(E,R){R?y(R):w.db.transaction(function(N){be(N,w,"INSERT OR REPLACE INTO "+w.storeName+" (key, value) VALUES (?, ?)",[o,E],function(){h(_)},function(M,j){y(j)})},function(N){if(N.code===N.QUOTA_ERR){if(l>0){h(an.apply(f,[o,_,a,l-1]));return}y(N)}})})}).catch(y)});return I(u,a),u}function ei(o,s,a){return an.apply(this,[o,s,a,1])}function ti(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[o],function(){f()},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function ri(o){var s=this,a=new g(function(l,f){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){be(h,u,"DELETE FROM "+u.storeName,[],function(){l()},function(y,_){f(_)})})}).catch(f)});return I(a,o),a}function ni(o){var s=this,a=new g(function(l,f){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){be(h,u,"SELECT COUNT(key) as c FROM "+u.storeName,[],function(y,_){var w=_.rows.item(0).c;l(w)},function(y,_){f(_)})})}).catch(f)});return I(a,o),a}function oi(o,s){var a=this,l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[o+1],function(_,w){var E=w.rows.length?w.rows.item(0).key:null;f(E)},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function ii(o){var s=this,a=new g(function(l,f){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){be(h,u,"SELECT key FROM "+u.storeName,[],function(y,_){for(var w=[],E=0;E<_.rows.length;E++)w.push(_.rows.item(E).key);l(w)},function(y,_){f(_)})})}).catch(f)});return I(a,o),a}function ai(o){return new g(function(s,a){o.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,u){for(var h=[],y=0;y<u.rows.length;y++)h.push(u.rows.item(y).name);s({db:o,storeNames:h})},function(f,u){a(u)})},function(l){a(l)})})}function si(o,s){s=k.apply(this,arguments);var a=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||a.name,o.storeName=o.storeName||a.storeName);var l=this,f;return o.name?f=new g(function(u){var h;o.name===a.name?h=l._dbInfo.db:h=openDatabase(o.name,"","",0),o.storeName?u({db:h,storeNames:[o.storeName]}):u(ai(h))}).then(function(u){return new g(function(h,y){u.db.transaction(function(_){function w(M){return new g(function(j,W){_.executeSql("DROP TABLE IF EXISTS "+M,[],function(){j()},function(q,ie){W(ie)})})}for(var E=[],R=0,N=u.storeNames.length;R<N;R++)E.push(w(u.storeNames[R]));g.all(E).then(function(){h()}).catch(function(M){y(M)})},function(_){y(_)})})}):f=g.reject("Invalid arguments"),I(f,s),f}var ci={_driver:"webSQLStorage",_initStorage:Qo,_support:qo(),iterate:Zo,getItem:Xo,setItem:ei,removeItem:ti,clear:ri,length:ni,key:oi,keys:ii,dropInstance:si};function ui(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function sn(o,s){var a=o.name+"/";return o.storeName!==s.storeName&&(a+=o.storeName+"/"),a}function li(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function di(){return!li()||localStorage.length>0}function fi(o){var s=this,a={};if(o)for(var l in o)a[l]=o[l];return a.keyPrefix=sn(o,s._defaultConfig),di()?(s._dbInfo=a,a.serializer=Gt,g.resolve()):g.reject()}function mi(o){var s=this,a=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var u=localStorage.key(f);u.indexOf(l)===0&&localStorage.removeItem(u)}});return I(a,o),a}function pi(o,s){var a=this;o=D(o);var l=a.ready().then(function(){var f=a._dbInfo,u=localStorage.getItem(f.keyPrefix+o);return u&&(u=f.serializer.deserialize(u)),u});return I(l,s),l}function hi(o,s){var a=this,l=a.ready().then(function(){for(var f=a._dbInfo,u=f.keyPrefix,h=u.length,y=localStorage.length,_=1,w=0;w<y;w++){var E=localStorage.key(w);if(E.indexOf(u)===0){var R=localStorage.getItem(E);if(R&&(R=f.serializer.deserialize(R)),R=o(R,E.substring(h),_++),R!==void 0)return R}}});return I(l,s),l}function gi(o,s){var a=this,l=a.ready().then(function(){var f=a._dbInfo,u;try{u=localStorage.key(o)}catch(h){u=null}return u&&(u=u.substring(f.keyPrefix.length)),u});return I(l,s),l}function vi(o){var s=this,a=s.ready().then(function(){for(var l=s._dbInfo,f=localStorage.length,u=[],h=0;h<f;h++){var y=localStorage.key(h);y.indexOf(l.keyPrefix)===0&&u.push(y.substring(l.keyPrefix.length))}return u});return I(a,o),a}function yi(o){var s=this,a=s.keys().then(function(l){return l.length});return I(a,o),a}function bi(o,s){var a=this;o=D(o);var l=a.ready().then(function(){var f=a._dbInfo;localStorage.removeItem(f.keyPrefix+o)});return I(l,s),l}function _i(o,s,a){var l=this;o=D(o);var f=l.ready().then(function(){s===void 0&&(s=null);var u=s;return new g(function(h,y){var _=l._dbInfo;_.serializer.serialize(s,function(w,E){if(E)y(E);else try{localStorage.setItem(_.keyPrefix+o,w),h(u)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&y(R),y(R)}})})});return I(f,a),f}function wi(o,s){if(s=k.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var a=this.config();o.name=o.name||a.name,o.storeName=o.storeName||a.storeName}var l=this,f;return o.name?f=new g(function(u){o.storeName?u(sn(o,l._defaultConfig)):u(o.name+"/")}).then(function(u){for(var h=localStorage.length-1;h>=0;h--){var y=localStorage.key(h);y.indexOf(u)===0&&localStorage.removeItem(y)}}):f=g.reject("Invalid arguments"),I(f,s),f}var Ei={_driver:"localStorageWrapper",_initStorage:fi,_support:ui(),iterate:hi,getItem:pi,setItem:_i,removeItem:bi,clear:mi,length:yi,key:gi,keys:vi,dropInstance:wi},Ii=function(s,a){return s===a||typeof s=="number"&&typeof a=="number"&&isNaN(s)&&isNaN(a)},Ti=function(s,a){for(var l=s.length,f=0;f<l;){if(Ii(s[f],a))return!0;f++}return!1},cn=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Fe={},un={},Ae={INDEXEDDB:Go,WEBSQL:ci,LOCALSTORAGE:Ei},Si=[Ae.INDEXEDDB._driver,Ae.WEBSQL._driver,Ae.LOCALSTORAGE._driver],ze=["dropInstance"],qt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ze),Ri={description:"",driver:Si.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Ai(o,s){o[s]=function(){var a=arguments;return o.ready().then(function(){return o[s].apply(o,a)})}}function Wt(){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var a in s)s.hasOwnProperty(a)&&(cn(s[a])?arguments[0][a]=s[a].slice():arguments[0][a]=s[a])}return arguments[0]}var xi=function(){function o(s){m(this,o);for(var a in Ae)if(Ae.hasOwnProperty(a)){var l=Ae[a],f=l._driver;this[a]=f,Fe[f]||this.defineDriver(l)}this._defaultConfig=Wt({},Ri),this._config=Wt({},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(a){if((typeof a=="undefined"?"undefined":d(a))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in a){if(l==="storeName"&&(a[l]=a[l].replace(/\W/g,"_")),l==="version"&&typeof a[l]!="number")return new Error("Database version must be a number.");this._config[l]=a[l]}return"driver"in a&&a.driver?this.setDriver(this._config.driver):!0}else return typeof a=="string"?this._config[a]:this._config},o.prototype.defineDriver=function(a,l,f){var u=new g(function(h,y){try{var _=a._driver,w=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!a._driver){y(w);return}for(var E=qt.concat("_initStorage"),R=0,N=E.length;R<N;R++){var M=E[R],j=!Ti(ze,M);if((j||a[M])&&typeof a[M]!="function"){y(w);return}}var W=function(){for(var Be=function(Pi){return function(){var Oi=new Error("Method "+Pi+" is not implemented by the current driver"),ln=g.reject(Oi);return I(ln,arguments[arguments.length-1]),ln}},Yt=0,Ci=ze.length;Yt<Ci;Yt++){var zt=ze[Yt];a[zt]||(a[zt]=Be(zt))}};W();var q=function(Be){Fe[_]&&console.info("Redefining LocalForage driver: "+_),Fe[_]=a,un[_]=Be,h()};"_support"in a?a._support&&typeof a._support=="function"?a._support().then(q,y):q(!!a._support):q(!0)}catch(ie){y(ie)}});return O(u,l,f),u},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(a,l,f){var u=Fe[a]?g.resolve(Fe[a]):g.reject(new Error("Driver not found."));return O(u,l,f),u},o.prototype.getSerializer=function(a){var l=g.resolve(Gt);return O(l,a),l},o.prototype.ready=function(a){var l=this,f=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return O(f,a,a),f},o.prototype.setDriver=function(a,l,f){var u=this;cn(a)||(a=[a]);var h=this._getSupportedDrivers(a);function y(){u._config.driver=u.driver()}function _(R){return u._extend(R),y(),u._ready=u._initStorage(u._config),u._ready}function w(R){return function(){var N=0;function M(){for(;N<R.length;){var j=R[N];return N++,u._dbInfo=null,u._ready=null,u.getDriver(j).then(_).catch(M)}y();var W=new Error("No available storage method found.");return u._driverSet=g.reject(W),u._driverSet}return M()}}var E=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=E.then(function(){var R=h[0];return u._dbInfo=null,u._ready=null,u.getDriver(R).then(function(N){u._driver=N._driver,y(),u._wrapLibraryMethodsWithReady(),u._initDriver=w(h)})}).catch(function(){y();var R=new Error("No available storage method found.");return u._driverSet=g.reject(R),u._driverSet}),O(this._driverSet,l,f),this._driverSet},o.prototype.supports=function(a){return!!un[a]},o.prototype._extend=function(a){Wt(this,a)},o.prototype._getSupportedDrivers=function(a){for(var l=[],f=0,u=a.length;f<u;f++){var h=a[f];this.supports(h)&&l.push(h)}return l},o.prototype._wrapLibraryMethodsWithReady=function(){for(var a=0,l=qt.length;a<l;a++)Ai(this,qt[a])},o.prototype.createInstance=function(a){return new o(a)},o}(),ki=new xi;i.exports=ki},{3:3}]},{},[4])(4)})});var fo=pn(Te=>{"use strict";V();Ge();Ee();var Ce=ae(),qa=se("levelFinished",{paramsSchema:x.tuple(x.string(),x.object({result:x.boolean(),duration:x.number()})),implement:(e,t)=>C(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})])})}),Wa=se("taskFinished",{paramsSchema:x.tuple(x.string(),x.object({duration:x.number()})),implement:(e,t)=>C(Te,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),Ya=se("levelUpgrade",{paramsSchema:x.tuple(x.string(),x.string()),implement:(e,t)=>C(Te,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),za=se("onHistoryUserLevel",{paramsSchema:x.tuple(x.number()),implement:e=>C(Te,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Qa=se("onHistoryUserScore",{paramsSchema:x.tuple(x.number()),implement:e=>C(Te,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Xa=se("taskEvent",{paramsSchema:x.tuple(x.string(),x.object({tools:x.array(x.object({id:x.string(),name:x.string(),count:x.number(),description:x.string().optional(),price:x.object({amount:x.number(),unit:x.string()}).optional()})).optional(),awards:x.array(x.object({id:x.string(),name:x.string()})).optional()})),implement:(e,t)=>C(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))]))})});Ce.registerCommand("TaskTrackerSDK.levelFinished",qa);Ce.registerCommand("TaskTrackerSDK.taskFinished",Wa);Ce.registerCommand("TaskTrackerSDK.levelUpgrade",Ya);Ce.registerCommand("TaskTrackerSDK.historyUserLevel",za);Ce.registerCommand("TaskTrackerSDK.historyUserScore",Qa);Ce.registerCommand("TaskTrackerSDK.taskEvent",Xa);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"}}}})});Ee();ee();Ge();V();var ao=ae(),Pa="env",Oa="getSystemInfoSync",Da=()=>{var i,c,d,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform.toLowerCase(),brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(i=A.hostInfo)==null?void 0:i.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(c=A.hostInfo)==null?void 0:c.version;t&&(e=z($({},e),{version:t}));let r=(d=A.hostInfo)==null?void 0:d.appName;r&&(e=z($({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=z($({},e),{SDKVersion:n})),e},Na=Ie(Oa,{implement:Da}),La=Ie(Pa,{implement:()=>z($({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});ao.registerCommand("API.env",La);ao.registerCommand("API.getSystemInfoSync",Na);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});V();Ge();_e();Ee();var Ua="onJoliboxShow",Fa="onJoliboxHide",Ba="onReady",Lr=ae(),Ur=Cn(ue),Nr=!0,qe=!0,At=0,xt=Ar;function Ma(){let e=Date.now();if(e-At<100)return;At=e;let t=document.visibilityState==="visible";t!==Nr&&(Nr=t,xt.emit("visible",Nr))}function so(e){let t=Date.now();t-At<100||(At=t,e==="focus"&&!qe?qe=!0:e==="blur"&&qe&&(qe=!1),xt.emit("visible",qe))}document.addEventListener("visibilitychange",Ma);window.addEventListener("focus",()=>so("focus"));window.addEventListener("blur",()=>so("blur"));var ja=Ie(Ua,{paramsSchema:x.tuple(x.function()),implement(e){let t=Ur(e);xt.on("visible",r=>{r&&t()})}}),$a=Ie(Fa,{paramsSchema:x.tuple(x.function()),implement(e){let t=Ur(e);xt.on("visible",r=>{!r&&t()})}}),Va=Ie(Ba,{paramsSchema:x.tuple(x.function()),implement(e){let t=Ur(e);Je.on("LifecycleEvent.onReady",r=>{t(r)})}});Lr.registerCommand("LifecycleSDK.onReady",Va);Lr.registerCommand("LifecycleSDK.onJoliboxShow",ja);Lr.registerCommand("LifecycleSDK.onJoliboxHide",$a);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ge();V();Ke();ee();var lo=hn(uo());var kt=ae(),Br=class{constructor(){this.httpClient=ge.create({baseUrl:A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"});this.getGameId=()=>A.mpId;this.getItem=t=>C(this,null,function*(){let{code:r,data:n,message:i}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),c=n==null?void 0:n.value,d=i;return r!=="SUCCESS"&&(c=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",c),d+="fallback to localstorage"),{code:r,message:d,data:c&&c!=="undefined"?c:null}});this.setItem=(t,r)=>C(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:i,message:c}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:i,message:c}});this.removeItem=t=>C(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=()=>C(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=lo.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Ct=new Br,Ha=se("getLocalStorage",{paramsSchema:x.tuple(x.string()),implement(e){return C(this,null,function*(){return yield Ct.getItem(e)})}});kt.registerCommand("StorageSDK.getItem",Ha);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ja=se("setStorage",{paramsSchema:x.tuple(x.string(),x.or(x.string(),x.boolean(),x.number())),implement(e,t){return C(this,null,function*(){return yield Ct.setItem(e,t)})}});kt.registerCommand("StorageSDK.setItem",Ja);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ka=se("removeStorage",{paramsSchema:x.tuple(x.string()),implement(e){return C(this,null,function*(){return yield Ct.removeItem(e)})}});kt.registerCommand("StorageSDK.removeItem",Ka);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Ga=se("clearStorage",{implement(){return C(this,null,function*(){return yield Ct.clear()})}});kt.registerCommand("StorageSDK.clear",Ga);Q("storage.clear",{version:"1.0.0"});var Nl=hn(fo());var Pt=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 Ot=class{constructor(t,r,n,i){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 i=this.checkShouldBanHighFreq(t);if(i)return i;let c=this.checkShouldBanForTime(t);return c?{reason:c}:{reason:"ALLOWED"}};var g,I,O,D,k,P,H;let c=(g=i==null?void 0:i.maxAllowedAdsForTime)!=null?g:8,d=(I=i==null?void 0:i.banForTimeThreshold)!=null?I:6e4,m=(O=i==null?void 0:i.bannedReleaseTime)!=null?O:6e4,p=(D=i==null?void 0:i.maxAllowedAdsForSession)!=null?D:200,b=(k=i==null?void 0:i.banForSessionThreshold)!=null?k:6e5,v=(P=i==null?void 0:i.initialThreshold)!=null?P:2e3,S=(H=i==null?void 0:i.highFreqThreshold)!=null?H:2e3;this.checkShouldBanInitial=ts(v),this.checkShouldBanHighFreq=rs(S),this.checkShouldBanForTime=es(c,d,m),this.checkShouldBanForSession=Za(p,b)}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}})}},Za=(e,t)=>{let r=!1,n=[];return c=>{if(r)return"BANNED_FOR_SESSION";let d=Date.now();if(n=n.concat({timestamp:d,type:c}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&d-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},es=(e,t,r)=>{let n=null,i=v=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{p.value=!1,n=null},v)},c="jolibox-sdk-ads-callbreak-timestamps",d="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var v;try{let S=JSON.parse((v=window.__joliboxLocalStorage__.getItem(c))!=null?v:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(v){try{window.__joliboxLocalStorage__.setItem(c,JSON.stringify(v))}catch(S){}this._records=v}},p={_record:!1,init(){var v;try{let S=JSON.parse((v=window.__joliboxLocalStorage__.getItem(d))!=null?v:"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?i(g):this._record=!1}},get value(){return this._record},set value(v){try{window.__joliboxLocalStorage__.setItem(d,JSON.stringify(v))}catch(S){}this._record=v}};return m.init(),p.init(),v=>{if(p.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:v}),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,i(r),"BANNED_FOR_TIME"}},ts=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},rs=(e=2e3)=>{let t=0,r=null;return i=>{if(i==="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)}}};ee();ee();var Dt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return C(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 i=(r=A.channel)!=null?r:"",c=this.configs[i],d=(n=c==null?void 0:c.interstitialRate)!=null?n:1;t=Math.random()<d}return this.firstRun=!1,t}};V();var Pe=new de,Nt=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=()=>C(this,null,function*(){var d,m,p,b,v;let t="ca-pub-7171363994453626",r,n,i=window.encodeURIComponent(window.btoa((d=this.getGameId())!=null?d:"")),c=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:i,testAdsMode:`${c}`}});t=(p=S.data)==null?void 0:p.clientId,r=(b=S.data)==null?void 0:b.channelId,n=(v=S.data)==null?void 0:v.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>C(this,null,function*(){var i;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(i=this.getTestAdsMode())!=null?i:!1;if(!document.getElementById(r)&&this.clientId){let c=document.createElement("script");c.id=r,c.async=!0,c.crossOrigin="anonymous",c.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&c.setAttribute("data-adbreak-test","on"),this.channelId&&c.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(c),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{let r=!1,n=t.adBreakDone,i=d=>{var m;r=!0,this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:d.breakType,breakName:(m=d.breakName)!=null?m:"",breakFormat:d.breakFormat,breakStatus:d.breakStatus}),n&&n(d)};if(t.adBreakDone=i,t.type==="reward"){let d=t.beforeReward,m=b=>()=>{this.track("CallShowAdFn",null),b()},p=b=>{r=!0,d&&d(m(b))};t.beforeReward=p,window.setTimeout(()=>{var b,v;r||(this.track("CallAdBreakTimeout",{type:t.type}),(v=t.adBreakDone)==null||v.call(t,{breakType:t.type,breakName:(b=t.name)!=null?b:"",breakFormat:"reward",breakStatus:"timeout"}))},5e3)}if((d=>d.type==="preroll")(t)){Pe.emit("isAdShowing",!0);let d=t.adBreakDone,m=p=>{Pe.emit("isAdShowing",!1),d&&d(p)};return z($({},t),{adBreakDone:m})}else{let d=t.beforeAd,m=t.afterAd,p=()=>{var v;r=!0,Pe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(v=t.name)!=null?v:""}),d&&d()},b=()=>{var v;r=!0,Pe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(v=t.name)!=null?v:""}),m&&m()};return z($({},t),{beforeAd:p,afterAd:b})}};this.adConfig=t=>{let i=t,{onReady:r}=i,n=mn(i,["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,b,v,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":(b=t.adBreakDone)==null||b.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:((v=n==null?void 0:n.count)!=null?v: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 i=t.type,c;switch(i){case"preroll":c={type:i};break;case"start":case"pause":case"next":case"browse":case"reward":c={type:i,name:(g=t.name)!=null?g:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",c);let d=this.wrapAdBreakParams(t);this.push(d),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>C(this,null,function*(){var g,I,O,D;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(O=t.fullWidthResponsive)!=null?O:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:i,fullWidthResponsive:c,style:d}=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 b=typeof i=="object"&&Array.isArray(i)?i.join(", "):i,v=document.createElement("ins");if(v.className="adsbygoogle",v.id="jolibox-ads",v.style.display="block",v.setAttribute("data-ad-client",this.clientId),v.setAttribute("data-ad-slot",p),b&&v.setAttribute("data-ad-format",b),c&&v.setAttribute("data-full-width-responsive",c),d&&v.setAttribute("style",d),(D=this.getTestAdsMode())!=null?D:!1){let k=document.createElement("div");k.style.position="absolute",k.style.top="0",k.style.left="0",k.style.width="100%",k.style.height="100%",k.style.display="flex",k.style.justifyContent="center",k.style.alignItems="center",k.style.backgroundColor="rgba(0, 0, 0, 0.5)",k.style.color="white",k.innerHTML="Test Ad",v.style.position="relative",m.appendChild(v),v.appendChild(k)}else m.appendChild(v),new MutationObserver(P=>{P.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="data-ad-status"){let F=v.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:F!=null?F:"null"})}})}).observe(v,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Ot(t,r,n),this.adsActionDetection=new Pt(this.track),this.channelPolicy=new Dt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}};Ee();V();Ke();var Mr=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};ee();var mo=A.testMode;function po(){let e=new Map,t;return{registerRewardHandler(n,i){e.set(n,i)},handleReward(n,...i){return C(this,null,function*(){return yield n.reduce((d,m)=>C(this,null,function*(){let p=yield d;if(p===!0)return!0;mo&&console.log(`handleReward ${m}`);let b=e.get(m),v=b?yield b(...i):p;return mo&&console.log(`handleReward ${m} ${v}`),v}),Promise.resolve(!1))})},registerRewardsFetcher(n){return C(this,null,function*(){t=(...i)=>C(this,null,function*(){try{return yield n(...i)}catch(c){return console.error("getRewardOptions error:",c),["ADS"]}})})},getRewardsTypes(...n){return C(this,null,function*(){return t?yield t(...n):["ADS"]})}}}var ns=()=>(e,t)=>e==="JOLI_COIN"&&t==="ADS"?-1:e==="ADS"&&t==="JOLI_COIN"?1:0,ho=e=>{e.registerRewardsFetcher(t=>C(void 0,null,function*(){var c,d,m,p;let r=[],n=yield t.post("/api/games/unlock-options",{});return n.code!=="SUCCESS"?r:(Ut.emit(Lt,{options:((c=n.data)==null?void 0:c.unlockOptions)||[],userJoliCoin:((d=n.extra)==null?void 0:d.joliCoin)||{balance:0,enableAutoDeduct:!1}}),(((p=(m=n.data)==null?void 0:m.unlockOptions)==null?void 0:p.map(b=>b.type))||Array.from(r)).sort(ns()))}))};V();var go=e=>t=>C(void 0,null,function*(){return e.adBreak(t),!0});ee();V();var vo=(e,t)=>e.some(r=>r.type==="JOLI_COIN"&&r.joliCoinChoices.some(n=>{var i;return n.joliCoinQuantity<=((i=t==null?void 0:t.balance)!=null?i:0)&&!!(t!=null&&t.enableAutoDeduct)}));var yo=(e,{onUnlockSuccess:t,onUnlockFailed:r})=>{let n=null,i=null,c=null,d=()=>{if(c){n=Promise.resolve(c);return}n=new Promise(m=>{i=m})};return d(),Ut.on(Lt,m=>{c=m,i&&(i(m),i=null)}),()=>C(void 0,null,function*(){try{n||d();let m=yield n;if(!vo((m==null?void 0:m.options)||[],m==null?void 0:m.userJoliCoin))return r==null||r(),!1;let p=yield e.post("/api/joli-coin/unlock",{data:{type:"GAME_REWARD",reqId:`${mr()}-${A.mpType}-${Date.now()}`,gameInfo:{gameId:A.mpId}}});return p.code=="SUCCESS"?(t==null||t({quantity:p.data.quantity,balance:p.data.balance}),!0):(r==null||r(),!1)}catch(m){return console.error("JolicoinRewardHandler error:",m),r==null||r(),!1}})};var Oe=po();ho(Oe);var Lt="UNLOCK_OPTIONS_CHANGED",Ut=new de;var Ft=ae(),os=ge.create(),Se=new Nt(fe,os,()=>ge.getNetworkStatus());Oe.registerRewardHandler("ADS",go(Se));Oe.registerRewardHandler("JOLI_COIN",yo(Se.httpClient,{onUnlockSuccess:e=>{Mr("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e})}}));Pe.on("isAdShowing",e=>{Mr("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Ft.registerCommand("AdsSDK.init",e=>{Se.init(e)});Ft.registerCommand("AdsSDK.adConfig",e=>{Se.adConfig(e)});Ft.registerCommand("AdsSDK.adBreak",e=>{e.type==="reward"?Oe.getRewardsTypes(Se.httpClient).then(t=>{Oe.handleReward(t,e)}):Se.adBreak(e)});Ft.registerCommand("AdsSDK.adUnit",e=>{Se.adUnit(e)});V();Ee();var To=-1,Mt=function(e){addEventListener("pageshow",function(t){t.persisted&&(To=t.timeStamp,e(t))},!0)},$r=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},jt=function(){var e=$r();return e&&e.activationStart||0},Ne=function(e,t){var r=$r(),n="navigate";return To>=0?n="back-forward-cache":r&&(document.prerendering||jt()>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}},So=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Le=function(e,t,r,n){var i,c;return function(d){t.value>=0&&(d||n)&&((c=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=c,t.rating=function(m,p){return m>p[1]?"poor":m>p[0]?"needs-improvement":"good"}(t.value,r),e(t))}},Ro=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},Ao=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},xo=function(e){var t=!1;return function(){t||(e(),t=!0)}},De=-1,bo=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Bt=function(e){document.visibilityState==="hidden"&&De>-1&&(De=e.type==="visibilitychange"?e.timeStamp:0,is())},_o=function(){addEventListener("visibilitychange",Bt,!0),addEventListener("prerenderingchange",Bt,!0)},is=function(){removeEventListener("visibilitychange",Bt,!0),removeEventListener("prerenderingchange",Bt,!0)},ko=function(){return De<0&&(De=bo(),_o(),Mt(function(){setTimeout(function(){De=bo(),_o()},0)})),{get firstHiddenTime(){return De}}},Vr=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},wo=[1800,3e3],Co=function(e,t){t=t||{},Vr(function(){var r,n=ko(),i=Ne("FCP"),c=So("paint",function(d){d.forEach(function(m){m.name==="first-contentful-paint"&&(c.disconnect(),m.startTime<n.firstHiddenTime&&(i.value=Math.max(m.startTime-jt(),0),i.entries.push(m),r(!0)))})});c&&(r=Le(e,i,wo,t.reportAllChanges),Mt(function(d){i=Ne("FCP"),r=Le(e,i,wo,t.reportAllChanges),Ro(function(){i.value=performance.now()-d.timeStamp,r(!0)})}))})};var as=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=xo(e),document.visibilityState==="hidden"?e():(r=t(e),Ao(e)),r};var Eo=[2500,4e3],jr={},Po=function(e,t){t=t||{},Vr(function(){var r,n=ko(),i=Ne("LCP"),c=function(p){t.reportAllChanges||(p=p.slice(-1)),p.forEach(function(b){b.startTime<n.firstHiddenTime&&(i.value=Math.max(b.startTime-jt(),0),i.entries=[b],r())})},d=So("largest-contentful-paint",c);if(d){r=Le(e,i,Eo,t.reportAllChanges);var m=xo(function(){jr[i.id]||(c(d.takeRecords()),d.disconnect(),jr[i.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return as(m)},{once:!0,capture:!0})}),Ao(m),Mt(function(p){i=Ne("LCP"),r=Le(e,i,Eo,t.reportAllChanges),Ro(function(){i.value=performance.now()-p.timeStamp,jr[i.id]=!0,r(!0)})})}})},Io=[800,1800],ss=function e(t){document.prerendering?Vr(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Oo=function(e,t){t=t||{};var r=Ne("TTFB"),n=Le(e,r,Io,t.reportAllChanges);ss(function(){var i=$r();i&&(r.value=Math.max(i.responseStart-jt(),0),r.entries=[i],n(!0),Mt(function(){r=Ne("TTFB",0),(n=Le(e,r,Io,t.reportAllChanges))(!0)}))})};ee();function cs(){Co(e=>{fe("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Po(e=>{fe("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Oo(e=>{fe("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function us(){Je.on("onDocumentReady",e=>{Je.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function Do(){us(),cs()}Do();
4
4
  /*! Bundled license information:
5
5
 
6
6
  localforage/dist/localforage.js: