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