@jolibox/implement 1.1.11-beta.1 → 1.1.11-beta.11
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 +16 -15
- package/.rush/temp/shrinkwrap-deps.json +1 -1
- package/dist/common/ads/anti-cheating.d.ts +24 -51
- package/dist/common/ads/anti-cheating.test.d.ts +1 -0
- package/dist/common/ads/index.d.ts +4 -9
- package/dist/common/context/index.d.ts +1 -0
- package/dist/common/context/url-parse.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.native.js +110 -4
- package/dist/native/network/create-fetch.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 +228 -139
- package/src/common/ads/index.ts +33 -20
- package/src/common/context/index.ts +7 -5
- package/src/common/context/url-parse.ts +9 -6
- package/src/native/api/ads.ts +7 -0
- package/src/native/api/navigate.ts +42 -4
- package/src/native/api/request.ts +19 -10
- package/src/native/bootstrap/index.ts +98 -51
- package/src/native/js-core/jolibox-js-core.ts +1 -1
- package/src/native/network/create-fetch.ts +1 -0
- package/src/native/network/utils.ts +13 -6
- package/src/native/types/native-method-map.d.ts +17 -0
- package/src/native/ui/retention.ts +152 -0
- package/src/native/bootstrap/retention.ts +0 -40
- /package/dist/native/{bootstrap → ui}/retention.d.ts +0 -0
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ts=Object.create;var Ce=Object.defineProperty,ks=Object.defineProperties,Es=Object.getOwnPropertyDescriptor,Ss=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertyNames,Pe=Object.getOwnPropertySymbols,Is=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable;var mr=(e,t,r)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))wt.call(t,r)&&mr(e,r,t[r]);if(Pe)for(var r of Pe(t))pr.call(t,r)&&mr(e,r,t[r]);return e},C=(e,t)=>ks(e,Ss(t));var ce=(e,t)=>{var r={};for(var n in e)wt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pe)for(var n of Pe(e))t.indexOf(n)<0&&pr.call(e,n)&&(r[n]=e[n]);return r};var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var fr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hr=(e,t)=>{for(var r in t)Ce(e,r,{get:t[r],enumerable:!0})},_s=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ws(t))!wt.call(e,s)&&s!==r&&Ce(e,s,{get:()=>t[s],enumerable:!(n=Es(t,s))||n.enumerable});return e};var gr=(e,t,r)=>(r=e!=null?Ts(Is(e)):{},_s(t||!e||!e.__esModule?Ce(r,"default",{value:e,enumerable:!0}):r,e));var g=(e,t,r)=>new Promise((n,s)=>{var o=c=>{try{a(r.next(c))}catch(l){s(l)}},i=c=>{try{a(r.throw(c))}catch(l){s(l)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,i);a((r=r.apply(e,t)).next())});function As(e){return!!(e!=null&&e.__nativeBuffers__)}function Ee(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!As(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let s;n.value?s=n.value:n.base64&&(s=Rs(n.base64)),typeof s!="undefined"&&s instanceof ArrayBuffer&&(e[n.key]=s)}}return e}function yr(e={},t=!1){let r=e,n=[];for(let[s,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let i=t?{value:o,key:s}:{base64:xs(o),key:s};n.push(i),delete r[s]}return n.length>0&&(r.__nativeBuffers__=n),r}var Rs,xs,It=f(()=>{"use strict";Rs=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let s=0;s<r;s++)n[s]=t.charCodeAt(s);return n.buffer};xs=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let s=0;s<n;s++)t+=String.fromCharCode(r[s]);return btoa(t)}});function Ns(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function le(e){return typeof e=="string"}function B(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function kr(e){return typeof e=="object"&&Array.isArray(e)}function Ie(e){return e===!0||e===!1}function Os(e){return typeof e>"u"}function Fs(e){return Os(e)||e===null}function Er(e){return typeof e=="function"}function Sr(e){return B(e)&&Er(e.then)}function wr(e){let t=e,r=null,n=function(...s){return r||(r=new t(...s)),r};return n.prototype=t.prototype,n}function Ir(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(s,o){for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i)){let a=s[i],c=o[i],l=r(a,c,i,s,o);l!==void 0?s[i]=l:vr(c)&&vr(a)?s[i]=n(h({},a),c):Array.isArray(c)&&Array.isArray(a)?s[i]=[...a,...c]:s[i]=c}return s}return n(e,t)}function vr(e){return e&&typeof e=="object"&&e.constructor===Object}function _r(e,t){if(Array.isArray(e))return e.concat(t)}function _e(e,t,r={}){let n=null,s,o,i,{leading:a=!1,trailing:c=!0}=r,l=()=>(i=e.apply(o,s),s=void 0,o=void 0,i),u=function(...m){s=m,o=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&l()},t),p)return l()};return u.cancel=()=>{n&&clearTimeout(n),n=null,s=o=void 0},u.flush=()=>{if(n)return clearTimeout(n),n=null,l()},u}function Us(e,t){return(...r)=>t(e,...r)}function Ue(e){return t=>Us(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(s){e(new Ct(`${s}`))}})}function Se(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Qs(e){return new Promise(t=>Mr(e)(t))}function Mr(e){return(t,r=null)=>{let n=!1;return e(s=>{if(!n)return n=!0,t.call(r,s)},null)}}function Ys(e,t){return(r=>{let n,s={onWillAddFirstListener(){n=r(o.fire,o)}},o=new we(s);return o.event})((r,n=null)=>e(s=>t(s)&&r.call(n,s),null))}function Zs(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)eo(e[n],t[n])}function eo(e,t){if(le(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Er(t)){try{if(e instanceof t)return}catch(r){}if(!Fs(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 N(){if(globalThis[At])return globalThis[At];let e=new Fe,t=new xt,r={registerCommand(n,s,o){e.registerCommand({id:n,handler:s,metadata:o})},executeCommand(n,...s){return t.executeCommand(n,...s)},excuteCommandSync(n,...s){return t.executeCommandThowErr(n,...s)}};return globalThis[At]=r,r}var br,Ps,Cs,Tr,se,Ds,Pt,de,Ar,Rr,Ct,xr,Pr,Cr,Nr,Or,Ae,De,Nt,J,Fr,Ms,Ot,Ls,Ft,Bs,js,Ne,Js,$s,Hs,Dr,Dt,Vs,Ks,qs,Ur,Z,x,Gs,zs,Oe,we,q,Rt,Ws,_t,Xs,ee,Fe,xt,At,E=f(()=>{"use strict";br=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,Cs=(e,t)=>{for(var r in t)br(e,r,{get:t[r],enumerable:!0})},Tr=(e,t,r,n)=>{for(var s=n>1?void 0:n?Ps(t,r):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(n?i(t,r,s):i(s))||s);return n&&s&&br(t,r,s),s};se=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};Ds=(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))(Ds||{}),Pt=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}},de=class extends Pt{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ar=class extends Pt{constructor(){super(...arguments),this.kind="USER_ERROR"}},Rr=class extends Ar{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Ct=class extends Ar{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))}},xr=class extends de{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Pr=class extends de{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Cr=class extends de{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Nr=class extends de{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Or=class extends de{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Ae=class extends Pt{constructor(e,t,r,n,s){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),s&&(this.priority=s)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},De=class extends de{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},Nt=class extends de{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};J={log:Se("log"),warn:Se("warn"),info:Se("info"),error:Se("error"),debug:Se("debug")};Object.assign(globalThis,{logger:J});Fr=Symbol.for("Jolibox.canIUseMap"),Ms={};globalThis[Fr]=Ms;Ot={get config(){return globalThis[Fr]}},Ls=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Ls||{}),Ft=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ft||{}),Bs=(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))(Bs||{}),js=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Ne={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")},Js=()=>Ne.isiOS?"iOS":Ne.isAndroid?"Android":Ne.isMac?"Mac":Ne.isFacebook?"Facebook":"PC",$s="device_id",Hs="advertising_id",Dr=e=>(localStorage.getItem(e)||localStorage.setItem(e,js()),localStorage.getItem(e)),Dt=()=>Dr($s),Vs=()=>Dr(Hs),Ks=e=>e.charAt(0).toUpperCase()+e.slice(1),qs=()=>{var t;let e=new URLSearchParams(window.location.search);return Ks((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Ur=e=>{let t="JoliboxWebSDK",r=Js(),n=navigator.language,s=Dt(),o=Vs();return`${t} (${qs()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${s} adid/${o} version/${e||""}`},x=(Z=class{constructor(t){this.element=t,this.next=Z.Undefined,this.prev=Z.Undefined}},Z.Undefined=new Z(void 0),Z),Gs=class{constructor(){this._first=x.Undefined,this._last=x.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===x.Undefined}clear(){let e=this._first;for(;e!==x.Undefined;){let t=e.next;e.prev=x.Undefined,e.next=x.Undefined,e=t}this._first=x.Undefined,this._last=x.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new x(e);if(this._first===x.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==x.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==x.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==x.Undefined&&e.next!==x.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===x.Undefined&&e.next===x.Undefined?(this._first=x.Undefined,this._last=x.Undefined):e.next===x.Undefined?(this._last=this._last.prev,this._last.next=x.Undefined):e.prev===x.Undefined&&(this._first=this._first.next,this._first.prev=x.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==x.Undefined;)yield e.element,e=e.next}},zs=0,Oe=class{constructor(e){this.value=e,this.id=zs++}},we=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 Oe&&(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 s,o,i,a,c,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new Oe(t);this._listeners?this._listeners instanceof Oe?this._listeners=[this._listeners,n]:this._listeners.push(n):((o=(s=this.options)==null?void 0:s.onWillAddFirstListener)==null||o.call(s,this),this._listeners=n,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(l=(c=this.options)==null?void 0:c.onDidAddListener)==null||l.call(c,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}fire(e){this._listeners&&(this._listeners instanceof Oe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},q=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var o;let r=(o=this.listeners.get(e))!=null?o:new we,n=i=>t(...i.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let s=this.cachedEventQueue.get(e);if(s)for(;s.size>0;)r.fire(h({event:e},s.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 Gs,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},Rt={};Cs(Rt,{None:()=>Ws,filter:()=>Ys,once:()=>Mr,toPromise:()=>Qs});Ws=()=>{console.log("[Jolibox SDK] None Event")};_t=Symbol.for("Jolibox.hostEmitter"),Xs=()=>{let e=new q;return globalThis[_t]||(globalThis[_t]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[_t]},ee=Xs();Fe=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new we,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 s of e.metadata.args)r.push(s.constraint);let n=e.handler;e.handler=function(...s){return Zs(s,r),n(...s)}}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}};Fe=Tr([wr],Fe);xt=class{constructor(){this._onWillExecuteCommand=new we,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new we,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Fe,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Ns(3e4)),this._starActivation}executeCommand(e,...t){return g(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Rt.toPromise(Rt.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}}};xt=Tr([wr],xt);At=Symbol.for("Jolibox.commands")});function M(e,t={}){Ut.emit("ERROR_REPORT",{error:e,options:t})}var Ut,ue,G=f(()=>{"use strict";E();E();Ut=new q,ue=new q;M.debounce=_e(M,50,{leading:!0})});function Me(e,t){return`[${e}]:${t}`}var me,Mt,oe=f(()=>{"use strict";G();E();G();me=(e,t)=>{var r,n;return new Ae((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Mt=e=>new Rr(e)});var pe,Lr,Br,jr,Le,Be=f(()=>{"use strict";pe="custom_event_",Lr=[],Br=[],jr=["env","createRequestTask","login"],Le="__batch_event__"});function $r(e,t){Jr||(Lt=new fe({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),Bt=new fe({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),jt=new fe({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),t("onJoliboxEnterBackground",()=>{Lt.flush(),Bt.flush(),jt.flush()}),Jr=!0);function r(s){var T,y;let{method:o,args:i,startTime:a,isForeground:c,errMsg:l=`${o}:fail no errMsg`,errNo:u=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=s,{receiveJSInvoke:p,invokeCallback:b}=m,_=(y=(T=l.match(/\S:(\S+)\s?/))==null?void 0:T[1])!=null?y:"fail";Lt.report({status:_,method:n(o,i),errNo:`${u}`,errMsg:l,isForeground:c,duration:Date.now()-a}),a&&p&&b&&(Bt.report({status:_,method:o,isForeground:c,duration:Number((p-a).toFixed(3))}),jt.report({status:_,method:o,isForeground:c,duration:Number((Date.now()-b).toFixed(3))}))}function n(s,o){return(s==="callHostMethod"||s==="callHostMethodSync")&&o!=null&&o.method?`${s}-${o.method}`:s}return r}var to,fe,Jr,Lt,Bt,jt,Jt=f(()=>{"use strict";E();to=e=>e==="pv"?e:"default",fe=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:s,tagNameOrder:o,metricName:i,type:a}=t;this.reporter=r,this.interval=n,this.eventName=s,this.tagNameOrder=o,this.metricName=i,this.type=to(a)}report(t){this.type==="pv"?this.addPVPoint(t):this.addPoint(t),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(t){if(Object.keys(this.cache).length){if(t){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(t){let r=(n,s,o,i)=>{let a=s.shift();if(a){let c=i[a];n[c]||(n[c]={}),r(n[c],s,o,i)}else n[o]||(n[o]=[]),n[o].push(i[o])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(s,o,i,a)=>{let c=o.shift();if(!c&&B(a))throw new De(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(c){let l=[];if(B(a))l.push(...Object.keys(a));else if(le(a)){if(o.length>0)throw new De(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);l.push(a)}else throw new De(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);l.forEach(u=>{s[u]||(s[u]={});let m=B(a)?a[u]:a;r(s[u],[...o],i,m)})}else s[i]?s[i]++:s[i]=1},n={point:t,metricName:this.metricName,tagNameOrder:this.tagNameOrder};r(this.cache,[...this.tagNameOrder],this.metricName,t)}processPoints(t){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:t}}clearPoints(){this.cache={}}},Jr=!1});function Vr(e,t){let r=0,n=!0,s=new Map,o=$r(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,$t.forEach(p=>g(this,[p],function*({method:l,args:u,resolve:m}){let b=yield a(l,u);m(b)})),$t.length=0});let i=(l,u)=>{let m=s.get(Number(l));if(!m)return;let p=Ee(u);m(p),s.delete(Number(l))},a=(l,u)=>{var U,I;let m=Date.now(),p=`${n}`;r+=1;let b=new se;if(s.set(r,b.resolve),!n&&Br.includes(l))return new Promise(A=>{$t.push({method:l,args:u,resolve:A})});let T=C(h({},{method:l,startTime:m,args:u,isForeground:p}),{invokeType:"js-bridge"}),y=!ro&&Lr.includes(l),S=yr(u,y),R=y?S:JSON.stringify(S),w;if(l.endsWith("Sync")||jr.includes(l)?w=(U=e.call)==null?void 0:U.call(e,l,S,r):typeof R=="string"?w=e.invoke(l,R,r):w=(I=e.call)==null?void 0:I.call(e,l,R,r),w){try{typeof w=="string"&&(w=JSON.parse(w)),w=Ee(w)}catch(A){J.error(A)}return s.delete(r),w.errorCode&&(w.errorCode=Me(l,w.errorCode)),o(h(h({},T),w)),w}return l.endsWith("Sync")&&s.delete(r),b.promise.then(A=>(A.errorCode&&(A.errorCode=Me(l,A.errorCode)),o(h(h({},T),A)),A))};return{invokeNative:a,applyNative:(l,u)=>{let m=a(l,u);return Sr(m)?m.then(p=>Hr(l,p)):Hr(l,m)},invokeHandler:i}}function Hr(e,t){if(!B(t)){J.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:s,errorCode:o}=a,i=ce(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new Cr(r,n,s,o);return i}var $t,ro,Kr=f(()=>{"use strict";It();E();oe();Be();Jt();$t=[],ro=!1});function qr(e){let t=new q,r=new q,n=new fe({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(s,o,i){let a=Ee(o),c;if(a.__extra){c=a.params;let{type:l,startTime:u}=a.__extra;n.report({type:l,event:s,duration:Date.now()-u})}else c=a;if(s===Le){c.forEach(u=>{let[m,p]=u;try{r.emit(m.slice(pe.length),p,i)}catch(b){}});return}if(s.startsWith(pe)){r.emit(s.slice(pe.length),c,i);return}t.emit(s,c,i)}}}var Gr=f(()=>{"use strict";E();It();Jt();Be()});function zr(e){let t=new Map,r;return(s,o,i,a)=>{if(a){let l=i?[i]:"*";e.publish(`${pe}${s}`,o,l);return}r||(r=Promise.resolve().then(()=>{t.forEach((l,u)=>{try{let m=u?[u]:"*";e.publish(Le,l,m)}catch(m){}}),r=void 0,t.clear()}));let c=t.get(i);c||(c=[],t.set(i,c)),c.push([`${pe}${s}`,o])}}var Wr=f(()=>{"use strict";Be()});function Ht(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:s,unsubscribe:o}=qr(e),{invokeNative:i,invokeHandler:a,applyNative:c}=Vr(e,r),l=zr(e);return{invokeHandler:a,subscribeHandler:t,applyNative:c,invokeNative:i,onNative:r,offNative:n,publish:l,subscribe:s,unsubscribe:o}}var Qr=f(()=>{"use strict";Kr();Gr();Wr()});var Yr=f(()=>{"use strict"});var Xr=f(()=>{"use strict";Qr();Yr()});function ge(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var je=f(()=>{"use strict"});var ie,z,Zr,en=f(()=>{"use strict";E();je();G();z={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){z.trigger=e},doExit(e){z.exit=e}},Zr=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)M(new Pr("native env failed"));else{let{data:t}=JSON.parse(e);return t!=null?t:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(s="")=>{z.trigger(),e.onDocumentReady.postMessage({path:s})};ie={onDocumentReady:t,doExit:s=>g(void 0,null,function*(){let o=yield z.exit();e.doExit.postMessage({uuid:s,shouldInterrupt:o})}),invoke(s,o,i){e.invoke.postMessage({event:s,paramsString:o,callbackId:i})},publish(s,o,i){let a=ge(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:s,paramsString:JSON.stringify(a),webviewIds:i}))},call(s,o,i){let a=window.prompt("invoke",JSON.stringify({event:s,paramsString:JSON.stringify(o),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Zr};globalThis.joliboxJSCore=h({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(s="")=>{z.trigger(),e.onDocumentReady(JSON.stringify({path:s}))};ie={onDocumentReady:t,invoke(s,o,i){e.invoke(JSON.stringify({event:s,paramsString:o,callbackId:i}))},doExit:s=>g(void 0,null,function*(){let o=yield z.exit();e.doExit(JSON.stringify({uuid:s,shouldInterrupt:o}))}),publish(s,o,i){let a=ge(o,"joliboxJSCore");e.publish({event:s,paramsString:JSON.stringify(a),webviewIds:i})},call(s,o,i){let a=window.prompt("invoke",JSON.stringify({event:s,paramsString:JSON.stringify(o),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Zr};globalThis.joliboxJSCore=h({},n)}});function Vt(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([ye]=e.ports,ye.onmessage=function(t){let r=JSON.parse(t.data);r[0]==="publish"?globalThis.ttJSBridge.subscribeHandler(r[1],r[2]):r[0]==="invoke"&&globalThis.ttJSBridge.invokeHandler(r[1],r[2])},ye.publish=function(t,r){let n=ge(r,"messagePort");ye.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},ye.postMessage("msg:setup:ok"))}}var ye,tn=f(()=>{"use strict";je()});var Je=f(()=>{"use strict";en();tn();je()});var nn,no,sn,rn,$,P,Q,Fa,so,on,Da,Ua,H=f(()=>{"use strict";Xr();Je();oe();E();Je();nn=ie;if(!nn)throw new Nr("No joliboxJScore is found, native bridge not found.");Vt();no=h({},nn),sn=Ht(no),{invokeHandler:rn}=sn,{applyNative:$,invokeNative:P,onNative:Q,offNative:Fa,subscribeHandler:so,publish:on,subscribe:Da,unsubscribe:Ua}=sn;globalThis.joliboxJSBridge={callHandler:rn,invokeHandler:rn,subscribeHandler:so}});var Kt,qt,an,cn,ln=f(()=>{"use strict";E();G();Kt=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(s){return{}}},qt=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},an=e=>{var t;try{let s=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(s!=null&&s.length){let[o,i,a]=s;return{headerJson:Kt(o),payloadJson:Kt(i),signature:Kt(a)}}else throw"joli_source is missing"}catch(r){return M(new xr(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},cn=e=>{let{headerJson:t,payloadJson:r,signature:n}=e,s=qt(t),o=qt(r),i=qt(n);return`${s}.${o}.${i}`}});var oo,$e,dn,Gt=f(()=>{"use strict";E();oo="1.1.11-beta.1",$e=()=>oo,dn=()=>{let e=$e();return`${Ur(e)}`}});var io,un,zt,mn,L,ao,v,K=f(()=>{"use strict";E();ln();Gt();E();io={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Dt(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:$e()},schema:window.location.href,platform:"h5"},zt=(un=globalThis.joliboxJSCore)==null?void 0:un.env,L=Object.assign({},(mn=zt==null?void 0:zt())!=null?mn:io),ao=()=>{var p,b,_,T,y,S,R,w,U;let{payloadJson:e,headerJson:t,signature:r}=L.schema.length?an(L.schema):{},n=`${L.deviceInfo.did}-${new Date().getTime()}`,o=new URL(L.schema.length?L.schema:window.location.href).searchParams,i=(_=(b=(p=o.get("mpId"))!=null?p:o.get("appId"))!=null?b:o.get("gameId"))!=null?_:"",a=(S=(y=(T=L.clientSessionId)!=null?T:e==null?void 0:e.sessionId)!=null?y:o.get("sessionId"))!=null?S:n,c=!!((R=e==null?void 0:e.testAdsMode)!=null?R:o.get("testAdsMode")==="true"),l=(U=(w=e==null?void 0:e.joliboxEnv)!=null?w:o.get("joliboxEnv"))!=null?U:"production",u=l==="staging",m=t==null?void 0:t.channel;return{get testMode(){return u},get testAdsMode(){return c},get joliboxEnv(){return l},get joliSource(){var I;return(I=o.get("joliSource"))!=null?I:null},get mpId(){var I;return(I=i!=null?i:e==null?void 0:e.id)!=null?I:""},get mpVersion(){var I;return(I=t==null?void 0:t.ver)!=null?I:$e()},get mpType(){var I,A;return(A=(I=t==null?void 0:t.__mpType)!=null?I:e==null?void 0:e.__mpType)!=null?A:"game"},get platform(){var I;return(I=L.platform)!=null?I:L.deviceInfo.platform},get deviceInfo(){return L.deviceInfo},get sdkInfo(){return L.sdkInfo},get hostInfo(){return L.hostInfo},get hostUserInfo(){return L.hostUserInfo},get sessionId(){var I,A;return(A=(I=L.clientSessionId)!=null?I:a)!=null?A:n},get channel(){return m},get webviewId(){var I;return(I=L.webviewId)!=null?I:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:I=>{Ir(L,I,_r)},encodeJoliSourceQuery:I=>{var A;return t&&r?cn({headerJson:t,payloadJson:h(h({},e),I),signature:r}):(A=o.get("joliSource"))!=null?A:""}}},v=ao()});var Wt,fn,co,lo,pn,uo,hn=f(()=>{"use strict";E();G();K();E();Wt=!1,fn=(e,t)=>e==null?!1:t in e,co=e=>fn(e,"kind"),lo=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 o,i,a;let n={user_id:(i=(o=v.hostUserInfo)==null?void 0:o.uid)!=null?i:"",device_id:(a=v.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:lo(e.name)},s=C(h({},n),{env:t.environment,isFromUser:r});r?ue.emit("GLOBAL_USER_ERROR",e,s):ue.emit("GLOBAL_ERROR",e,s)},uo=e=>fn(e,"kind")&&e.kind==="USER_ERROR";Ut.on("ERROR_REPORT",({error:e,options:t})=>{if(Wt)return;Wt=!0;let r=co(e)&&e.raw?e.raw:e;try{let n=uo(e);pn(e,t,n)}catch(n){let s=n instanceof Error?n.message:String(n),o=new Nt(`${s}, origin error: ${r.message}`);J.error(o),pn(new Nt(o.message),{environment:t.environment},!1)}finally{Wt=!1}})});var gn=f(()=>{"use strict";hn();oe();E();H();ue.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};P("trackAsync",{event:"reportJsError",data:r})});ue.on("GLOBAL_USER_ERROR",(e,t)=>{J.log("UserError",e,t)})});var Qt=f(()=>{"use strict"});function yn(e,t){let r=(n,s,o)=>{let i=C(h({tag:n},t),{extra:h({},s)});n=="globalJsError"?M(new Or(JSON.stringify(i))):e("systemLog",i,o)};return r.debounce=_e(r,500,{leading:!0}),r}function vn(e){let t=(r,n,s)=>{var a;let o=(a=s&&JSON.stringify(s))!=null?a:0,i={speed_value_type:r,total_duration:n};o&&Object.assign(i,{extra:o}),e("joliboxSpeedAnalysis",i)};return t.debounce=_e(t,500,{leading:!0}),t}var bn=f(()=>{"use strict";E();E();G()});function Tn(e,t){let r=yn(e,t),n=vn(r);return{track:r,trackPerformance:n}}var kn=f(()=>{"use strict";bn()});var En=f(()=>{"use strict";K();E();E()});var Sn=f(()=>{"use strict";kn();Qt();En()});var He,wn=f(()=>{"use strict";He=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,s,o=!1,i=0,a=()=>{if(!o)return;let b=Date.now(),_=b-r;_>=this.interval&&(this.visible&&(i+=_,t(i)),r=b),n=requestAnimationFrame(a)},c=()=>{u(),r=Date.now(),s=window.setInterval(()=>{if(!o)return;let b=Date.now();b-r>=this.interval&&(r=b)},this.interval)},l=()=>{m(),r=Date.now(),n=requestAnimationFrame(a)},u=()=>{n&&(cancelAnimationFrame(n),n=0)},m=()=>{s&&(clearInterval(s),s=0)};this.eventEmitter.on("visible",b=>{o&&(console.log("visible",b),b?l():c())});let p=this.visible;return{start(){o||(o=!0,p?l():c())},stop(){o=!1,u(),m()}}}}});var Yt=f(()=>{"use strict"});function _n(e,t,r){let{response:n,startTime:s,endTime:o,requestFrom:i}=r,{errMsg:a="",profile:c={}}=n,u={duration:o-s,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:c.socketReused?1:0,request_from:i};(i==="public"&&In<po||i==="inner")&&(u.joli_request_number=In++,setTimeout(()=>{V("joliboxNetRequestResult",u)},500))}var In,po,An=f(()=>{"use strict";Yt();ae();In=0,po=10});function Ve(e,t,r){var c,l,u;let n=new Map,s=(c=r==null?void 0:r.baseUrl)!=null?c:"https://api.jolibox.com",o=(l=r==null?void 0:r.type)!=null?l:"public",i=(u=r==null?void 0:r.defaultHeaders)!=null?u:{};return Q("onRequestTaskStateChange",m=>{if(typeof m.requestTaskId!="string")return;let p=n.get(m.requestTaskId);if(p)if(m.state==="success"){let b=m,{requestTaskId:T,state:y}=b,S=ce(b,["requestTaskId","state"]);p.resolve(S),n.delete(T)}else if(m.state==="fail"){let _=m,{requestTaskId:T,state:y}=_,S=ce(_,["requestTaskId","state"]);p.reject(S),n.delete(T)}else J.warn("onRequestTaskStateChange unknown event",m)}),ee.on("onLoginComplete",({isLogin:m,token:p})=>{m&&p&&(i["X-JOLI-TOKEN"]=p)}),(b,..._)=>g(this,[b,..._],function*(m,p={}){let T=Date.now(),y=fo(m,C(h({},p),{baseUrl:s})),{method:S="GET",responseType:R="text",dataType:w="json",timeout:U,enableCache:I=!1,appendHostCookie:A=!0}=p,ke=Object.assign({"content-type":"application/json"},i,p.header),ne={url:y,method:S,header:ke,enableCache:I,responseType:R,appendHostCookie:A};if(S=="POST"||S=="PUT"){let W=go(p.data,ke["content-type"]);ne.data=W}U&&Object.assign(ne,{timeout:U});let{data:{requestTaskId:St}}=P(e,ne);if(typeof St!="string")throw me({code:-1,msg:"requestTaskId is not a string"});let ur=(W,X)=>{_n("request",y,{state:W,startTime:T,endTime:Date.now(),params:ne,response:X,requestId:St,requestFrom:o=="public"?"public":"inner"})},{resolve:fs,reject:hs,promise:gs}=new se;n.set(St,{resolve:fs,reject:hs});try{let W=yield gs;ur("success",W);let{data:X}=W;return w==="json"&&typeof X=="string"&&(X=ho(X)),{url:y,timeout:U,method:S,response:C(h({},W),{data:X})}}catch(W){let X=W;if(B(X)){let{errMsg:xe,prefetchDetail:ys,isPrefetch:vs,errNo:bs}=X;le(xe)&&(ur("fail",{errMsg:xe,isPrefetch:vs,prefetchDetail:ys}),M(me({code:-1,msg:xe},{errNo:bs,errMsg:xe})))}throw W}})}function ho(e){try{return JSON.parse(e.trim())}catch(t){return e}}function go(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var fo,Xt=f(()=>{"use strict";E();An();Yt();H();G();oe();fo=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,s=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${s?`?${s}`:""}`:`${e}${s?`?${s}`:""}`}});var Zt,Rn,te,Ke=f(()=>{"use strict";Gt();Xt();K();Zt={"x-user-agent":dn()};(Rn=v.hostUserInfo)!=null&&Rn.token&&(Zt["x-joli-token"]=v.hostUserInfo.token);v.joliSource&&(Zt["x-joli-source"]=v.joliSource);te=Ve("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:v.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Zt})});var qe,xn=f(()=>{"use strict";K();wn();Ke();H();qe=class extends He{constructor(t,r,n){super(r,n),this.gameId=v.mpId,this.sessionId=v.sessionId,this.track=t}reporter(t){return g(this,null,function*(){let{event:r,params:n}=t,s=[];s.push(te("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:h({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(s)})}reportToNative(t){return g(this,null,function*(){let{event:r,params:n}=t;yield $("userTrackAsync",{event:r,params:h({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var Fn={};hr(Fn,{nativeTaskEmitter:()=>Re,taskTracker:()=>j,track:()=>V,trackPerformance:()=>Nn});var yo,Pn,Cn,V,Nn,On,Re,j,ae=f(()=>{"use strict";gn();E();Qt();Sn();K();xn();H();yo=(e,t,r)=>{var i,a;let n=t,s=B(n.extra)?n.extra:le(n.extra)?JSON.parse(n.extra):{},o=C(h({},s),{mp_id:(i=n.mp_id)!=null?i:"",mp_version:(a=n.mp_version)!=null?a:""});P("trackAsync",{event:e,data:o,webviewId:r})},{track:V,trackPerformance:Nn}=Tn(yo,{type:Ft.AppSDK,platform:"native",jssdk_version:(Cn=(Pn=v.sdkInfo)==null?void 0:Pn.jssdkVersion)!=null?Cn:"1.0.0",mp_id:v.mpId,mp_version:v.mpVersion}),On=N();On.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Nn(e,t,r)});On.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{V(e,t)});Re=new q,j=new qe(V,Re)});function Dn(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let o=`
|
|
1
|
+
var Xi=Object.create;var Ze=Object.defineProperty,Zi=Object.defineProperties,es=Object.getOwnPropertyDescriptor,ts=Object.getOwnPropertyDescriptors,rs=Object.getOwnPropertyNames,Xe=Object.getOwnPropertySymbols,ns=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,rn=Object.prototype.propertyIsEnumerable;var tn=(e,t,r)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))Zt.call(t,r)&&tn(e,r,t[r]);if(Xe)for(var r of Xe(t))rn.call(t,r)&&tn(e,r,t[r]);return e},P=(e,t)=>Zi(e,ts(t));var Q=(e,t)=>{var r={};for(var n in e)Zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Xe)for(var n of Xe(e))t.indexOf(n)<0&&rn.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var nn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),on=(e,t)=>{for(var r in t)Ze(e,r,{get:t[r],enumerable:!0})},os=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rs(t))!Zt.call(e,o)&&o!==r&&Ze(e,o,{get:()=>t[o],enumerable:!(n=es(t,o))||n.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?Xi(ns(e)):{},os(t||!e||!e.__esModule?Ze(r,"default",{value:e,enumerable:!0}):r,e));var T=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(u){o(u)}},s=l=>{try{a(r.throw(l))}catch(u){o(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())});function is(e){return!!(e!=null&&e.__nativeBuffers__)}function Le(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!is(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let o;n.value?o=n.value:n.base64&&(o=ss(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function an(e={},t=!1){let r=e,n=[];for(let[o,i]of Object.entries(r))if(i!==void 0&&i instanceof ArrayBuffer&&i.byteLength!==void 0){let s=t?{value:i,key:o}:{base64:as(i),key:o};n.push(s),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}var ss,as,er=k(()=>{"use strict";ss=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer};as=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)}});function us(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ke(e){return typeof e=="string"}function K(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function dn(e){return typeof e=="object"&&Array.isArray(e)}function He(e){return e===!0||e===!1}function ds(e){return typeof e>"u"}function ps(e){return ds(e)||e===null}function pn(e){return typeof e=="function"}function mn(e){return K(e)&&pn(e.then)}function fn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function hn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,i){for(let s in i)if(Object.prototype.hasOwnProperty.call(i,s)){let a=o[s],l=i[s],u=r(a,l,s,o,i);u!==void 0?o[s]=u:cn(l)&&cn(a)?o[s]=n(_({},a),l):Array.isArray(l)&&Array.isArray(a)?o[s]=[...a,...l]:o[s]=l}return o}return n(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 $e(e,t,r={}){let n=null,o,i,s,{leading:a=!1,trailing:l=!0}=r,u=()=>(s=e.apply(i,o),o=void 0,i=void 0,s),d=function(...c){o=c,i=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&u()},t),p)return u()};return d.cancel=()=>{n&&clearTimeout(n),n=null,o=i=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,u()},d}function fs(e,t){return(...r)=>t(e,...r)}function ot(e){return t=>fs(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new Je(`${o}`))}})}function Be(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Rs(e){return new Promise(t=>In(e)(t))}function In(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function As(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(i.fire,i)}},i=new je(o);return i.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function Ps(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Ns(e[n],t[n])}function Ns(e,t){if(ke(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(pn(t)){try{if(e instanceof t)return}catch(r){}if(!ps(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 M(){if(globalThis[rr])return globalThis[rr];let e=new rt,t=new or,r={registerCommand(n,o,i){e.registerCommand({id:n,handler:o,metadata:i})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[rr]=r,r}var ln,cs,ls,un,se,ms,ir,we,_n,vn,Je,yn,bn,kn,wn,Tn,Ve,nt,sr,Y,Sn,hs,ar,gs,cr,_s,vs,et,ys,bs,ks,En,lr,ws,Ts,Ss,xn,de,F,Es,xs,tt,je,te,nr,Is,tr,Cs,pe,rt,or,rr,A=k(()=>{"use strict";ln=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,ls=(e,t)=>{for(var r in t)ln(e,r,{get:t[r],enumerable:!0})},un=(e,t,r,n)=>{for(var o=n>1?void 0:n?cs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ln(t,r,o),o};se=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};ms=(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))(ms||{}),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}},we=class extends ir{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},_n=class extends ir{constructor(){super(...arguments),this.kind="USER_ERROR"}},vn=class extends _n{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Je=class extends _n{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))}},yn=class extends we{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},bn=class extends we{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},kn=class extends we{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},wn=class extends we{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Tn=class extends we{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Ve=class extends ir{constructor(e,t,r,n,o){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),o&&(this.priority=o)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},nt=class extends we{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},sr=class extends we{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Y={log:Be("log"),warn:Be("warn"),info:Be("info"),error:Be("error"),debug:Be("debug")};Object.assign(globalThis,{logger:Y});Sn=Symbol.for("Jolibox.canIUseMap"),hs={};globalThis[Sn]=hs;ar={get config(){return globalThis[Sn]}},gs=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(gs||{}),cr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(cr||{}),_s=(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))(_s||{}),vs=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),et={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")},ys=()=>et.isiOS?"iOS":et.isAndroid?"Android":et.isMac?"Mac":et.isFacebook?"Facebook":"PC",bs="device_id",ks="advertising_id",En=e=>(localStorage.getItem(e)||localStorage.setItem(e,vs()),localStorage.getItem(e)),lr=()=>En(bs),ws=()=>En(ks),Ts=e=>e.charAt(0).toUpperCase()+e.slice(1),Ss=()=>{var t;let e=new URLSearchParams(window.location.search);return Ts((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},xn=e=>{let t="JoliboxWebSDK",r=ys(),n=navigator.language,o=lr(),i=ws();return`${t} (${Ss()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${i} version/${e||""}`},F=(de=class{constructor(t){this.element=t,this.next=de.Undefined,this.prev=de.Undefined}},de.Undefined=new de(void 0),de),Es=class{constructor(){this._first=F.Undefined,this._last=F.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===F.Undefined}clear(){let e=this._first;for(;e!==F.Undefined;){let t=e.next;e.prev=F.Undefined,e.next=F.Undefined,e=t}this._first=F.Undefined,this._last=F.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new F(e);if(this._first===F.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==F.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==F.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==F.Undefined&&e.next!==F.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===F.Undefined&&e.next===F.Undefined?(this._first=F.Undefined,this._last=F.Undefined):e.next===F.Undefined?(this._last=this._last.prev,this._last.next=F.Undefined):e.prev===F.Undefined&&(this._first=this._first.next,this._first.prev=F.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==F.Undefined;)yield e.element,e=e.next}},xs=0,tt=class{constructor(e){this.value=e,this.id=xs++}},je=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 tt&&(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 o,i,s,a,l,u;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new tt(t);this._listeners?this._listeners instanceof tt?this._listeners=[this._listeners,n]:this._listeners.push(n):((i=(o=this.options)==null?void 0:o.onWillAddFirstListener)==null||i.call(o,this),this._listeners=n,(a=(s=this.options)==null?void 0:s.onDidFirstListener)==null||a.call(s,this)),(u=(l=this.options)==null?void 0:l.onDidAddListener)==null||u.call(l,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(o){r(o)}}fire(e){this._listeners&&(this._listeners instanceof tt?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},te=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var i;let r=(i=this.listeners.get(e))!=null?i:new je,n=s=>t(...s.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let o=this.cachedEventQueue.get(e);if(o)for(;o.size>0;)r.fire(_({event:e},o.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 Es,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},nr={};ls(nr,{None:()=>Is,filter:()=>As,once:()=>In,toPromise:()=>Rs});Is=()=>{console.log("[Jolibox SDK] None Event")};tr=Symbol.for("Jolibox.hostEmitter"),Cs=()=>{let e=new te;return globalThis[tr]||(globalThis[tr]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[tr]},pe=Cs();rt=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new je,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return Ps(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};rt=un([fn],rt);or=class{constructor(){this._onWillExecuteCommand=new je,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new je,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new rt,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=us(3e4)),this._starActivation}executeCommand(e,...t){return T(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),nr.toPromise(nr.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};or=un([fn],or);rr=Symbol.for("Jolibox.commands")});function $(e,t={}){ur.emit("ERROR_REPORT",{error:e,options:t})}var ur,Te,re=k(()=>{"use strict";A();A();ur=new te,Te=new te;$.debounce=$e($,50,{leading:!0})});function it(e,t){return`[${e}]:${t}`}var ge,dr,_e=k(()=>{"use strict";re();A();re();ge=(e,t)=>{var r,n;return new Ve((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},dr=e=>new vn(e)});var Se,Rn,An,Cn,st,at=k(()=>{"use strict";Se="custom_event_",Rn=[],An=[],Cn=["env","createRequestTask","login"],st="__batch_event__"});function Nn(e,t){Pn||(pr=new Ee({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),mr=new Ee({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),fr=new Ee({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{pr.flush(),mr.flush(),fr.flush()}),Pn=!0);function r(o){var v,h;let{method:i,args:s,startTime:a,isForeground:l,errMsg:u=`${i}:fail no errMsg`,errNo:d=0,__timing:c={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:p,invokeCallback:m}=c,y=(h=(v=u.match(/\S:(\S+)\s?/))==null?void 0:v[1])!=null?h:"fail";pr.report({status:y,method:n(i,s),errNo:`${d}`,errMsg:u,isForeground:l,duration:Date.now()-a}),a&&p&&m&&(mr.report({status:y,method:i,isForeground:l,duration:Number((p-a).toFixed(3))}),fr.report({status:y,method:i,isForeground:l,duration:Number((Date.now()-m).toFixed(3))}))}function n(o,i){return(o==="callHostMethod"||o==="callHostMethodSync")&&i!=null&&i.method?`${o}-${i.method}`:o}return r}var Os,Ee,Pn,pr,mr,fr,hr=k(()=>{"use strict";A();Os=e=>e==="pv"?e:"default",Ee=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:o,tagNameOrder:i,metricName:s,type:a}=t;this.reporter=r,this.interval=n,this.eventName=o,this.tagNameOrder=i,this.metricName=s,this.type=Os(a)}report(t){this.type==="pv"?this.addPVPoint(t):this.addPoint(t),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(t){if(Object.keys(this.cache).length){if(t){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(t){let r=(n,o,i,s)=>{let a=o.shift();if(a){let l=s[a];n[l]||(n[l]={}),r(n[l],o,i,s)}else n[i]||(n[i]=[]),n[i].push(s[i])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(o,i,s,a)=>{let l=i.shift();if(!l&&K(a))throw new nt(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(l){let u=[];if(K(a))u.push(...Object.keys(a));else if(ke(a)){if(i.length>0)throw new nt(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);u.push(a)}else throw new nt(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);u.forEach(d=>{o[d]||(o[d]={});let c=K(a)?a[d]:a;r(o[d],[...i],s,c)})}else o[s]?o[s]++:o[s]=1},n={point:t,metricName:this.metricName,tagNameOrder:this.tagNameOrder};r(this.cache,[...this.tagNameOrder],this.metricName,t)}processPoints(t){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:t}}clearPoints(){this.cache={}}},Pn=!1});function Dn(e,t){let r=0,n=!0,o=new Map,i=Nn(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,gr.forEach(p=>T(this,[p],function*({method:u,args:d,resolve:c}){let m=yield a(u,d);c(m)})),gr.length=0});let s=(u,d)=>{let c=o.get(Number(u));if(!c)return;let p=Le(d);c(p),o.delete(Number(u))},a=(u,d)=>{var N,R;let c=Date.now(),p=`${n}`;r+=1;let m=new se;if(o.set(r,m.resolve),!n&&An.includes(u))return new Promise(S=>{gr.push({method:u,args:d,resolve:S})});let v=P(_({},{method:u,startTime:c,args:d,isForeground:p}),{invokeType:"js-bridge"}),h=!Ds&&Rn.includes(u),g=an(d,h),b=h?g:JSON.stringify(g),E;if(u.endsWith("Sync")||Cn.includes(u)?E=(N=e.call)==null?void 0:N.call(e,u,g,r):typeof b=="string"?E=e.invoke(u,b,r):E=(R=e.call)==null?void 0:R.call(e,u,b,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=Le(E)}catch(S){Y.error(S)}return o.delete(r),E.errorCode&&(E.errorCode=it(u,E.errorCode)),i(_(_({},v),E)),E}return u.endsWith("Sync")&&o.delete(r),m.promise.then(S=>(S.errorCode&&(S.errorCode=it(u,S.errorCode)),i(_(_({},v),S)),S))};return{invokeNative:a,applyNative:(u,d)=>{let c=a(u,d);return mn(c)?c.then(p=>On(u,p)):On(u,c)},invokeHandler:s}}function On(e,t){if(!K(t)){Y.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:o,errorCode:i}=a,s=Q(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new kn(r,n,o,i);return s}var gr,Ds,Fn=k(()=>{"use strict";er();A();_e();at();hr();gr=[],Ds=!1});function Un(e){let t=new te,r=new te,n=new Ee({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(o,i,s){let a=Le(i),l;if(a.__extra){l=a.params;let{type:u,startTime:d}=a.__extra;n.report({type:u,event:o,duration:Date.now()-d})}else l=a;if(o===st){l.forEach(d=>{let[c,p]=d;try{r.emit(c.slice(Se.length),p,s)}catch(m){}});return}if(o.startsWith(Se)){r.emit(o.slice(Se.length),l,s);return}t.emit(o,l,s)}}}var Mn=k(()=>{"use strict";A();er();hr();at()});function Ln(e){let t=new Map,r;return(o,i,s,a)=>{if(a){let u=s?[s]:"*";e.publish(`${Se}${o}`,i,u);return}r||(r=Promise.resolve().then(()=>{t.forEach((u,d)=>{try{let c=d?[d]:"*";e.publish(st,u,c)}catch(c){}}),r=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Se}${o}`,i])}}var Bn=k(()=>{"use strict";at()});function _r(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:i}=Un(e),{invokeNative:s,invokeHandler:a,applyNative:l}=Dn(e,r),u=Ln(e);return{invokeHandler:a,subscribeHandler:t,applyNative:l,invokeNative:s,onNative:r,offNative:n,publish:u,subscribe:o,unsubscribe:i}}var jn=k(()=>{"use strict";Fn();Mn();Bn()});var Hn=k(()=>{"use strict"});var $n=k(()=>{"use strict";jn();Hn()});function Pe(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ct=k(()=>{"use strict"});var ve,ne,Jn,Vn=k(()=>{"use strict";A();ct();re();ne={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){ne.trigger=e},doExit(e){ne.exit=e}},Jn=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)$(new bn("native env failed"));else{let{data:t}=JSON.parse(e);return t!=null?t:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(o="")=>{ne.trigger(),e.onDocumentReady.postMessage({path:o})};ve={onDocumentReady:t,doExit:o=>T(void 0,null,function*(){let i=yield ne.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:i})}),invoke(o,i,s){e.invoke.postMessage({event:o,paramsString:i,callbackId:s})},publish(o,i,s){let a=Pe(i,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:s}))},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Jn};globalThis.joliboxJSCore=_({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{ne.trigger(),e.onDocumentReady(JSON.stringify({path:o}))};ve={onDocumentReady:t,invoke(o,i,s){e.invoke(JSON.stringify({event:o,paramsString:i,callbackId:s}))},doExit:o=>T(void 0,null,function*(){let i=yield ne.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:i}))}),publish(o,i,s){let a=Pe(i,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:s})},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Jn};globalThis.joliboxJSCore=_({},n)}});function vr(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([Ne]=e.ports,Ne.onmessage=function(t){let r=JSON.parse(t.data);r[0]==="publish"?globalThis.ttJSBridge.subscribeHandler(r[1],r[2]):r[0]==="invoke"&&globalThis.ttJSBridge.invokeHandler(r[1],r[2])},Ne.publish=function(t,r){let n=Pe(r,"messagePort");Ne.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},Ne.postMessage("msg:setup:ok"))}}var Ne,Kn=k(()=>{"use strict";ct()});var lt=k(()=>{"use strict";Vn();Kn();ct()});var Gn,Fs,Wn,qn,X,O,ae,ou,Us,zn,iu,su,q=k(()=>{"use strict";$n();lt();_e();A();lt();Gn=ve;if(!Gn)throw new wn("No joliboxJScore is found, native bridge not found.");vr();Fs=_({},Gn),Wn=_r(Fs),{invokeHandler:qn}=Wn,{applyNative:X,invokeNative:O,onNative:ae,offNative:ou,subscribeHandler:Us,publish:zn,subscribe:iu,unsubscribe:su}=Wn;globalThis.joliboxJSBridge={callHandler:qn,invokeHandler:qn,subscribeHandler:Us}});var yr,Ms,Qn,Yn,Xn=k(()=>{"use strict";A();re();yr=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(o){return{}}},Ms=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Qn=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[i,s,a]=o;return{headerJson:yr(i),payloadJson:yr(s),signature:yr(a)}}else throw"joli_source is missing"}catch(r){return $(new yn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Yn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],o=Ms(e),i=r[2];return`${n}.${o}.${i}`}return t}});var Ls,ut,Zn,br=k(()=>{"use strict";A();Ls="1.1.11-beta.11",ut=()=>Ls,Zn=()=>{let e=ut();return`${xn(e)}`}});var Bs,eo,kr,to,J,js,w,V=k(()=>{"use strict";A();Xn();br();A();Bs={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ut()},schema:window.location.href,platform:"h5"},kr=(eo=globalThis.joliboxJSCore)==null?void 0:eo.env,J=Object.assign({},(to=kr==null?void 0:kr())!=null?to:Bs),js=()=>{var p,m,y,v,h,g,b,E,N;let{payloadJson:e,headerJson:t,signature:r}=J.schema.length?Qn(J.schema):{},n=`${J.deviceInfo.did}-${new Date().getTime()}`,i=new URL(J.schema.length?J.schema:window.location.href).searchParams,s=(y=(m=(p=i.get("mpId"))!=null?p:i.get("appId"))!=null?m:i.get("gameId"))!=null?y:"",a=(g=(h=(v=J.clientSessionId)!=null?v:e==null?void 0:e.sessionId)!=null?h:i.get("sessionId"))!=null?g:n,l=!!((b=e==null?void 0:e.testAdsMode)!=null?b:i.get("testAdsMode")==="true"),u=(N=(E=e==null?void 0:e.joliboxEnv)!=null?E:i.get("joliboxEnv"))!=null?N:"production",d=u==="staging",c=t==null?void 0:t.channel;return{get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return u},get joliSource(){var R;return(R=i.get("joliSource"))!=null?R:null},get mpId(){var R;return(R=s!=null?s:e==null?void 0:e.id)!=null?R:""},get mpVersion(){var R;return(R=t==null?void 0:t.ver)!=null?R:ut()},get mpType(){var R,S;return(S=(R=t==null?void 0:t.__mpType)!=null?R:e==null?void 0:e.__mpType)!=null?S:"game"},get platform(){var R;return(R=J.platform)!=null?R:J.deviceInfo.platform},get deviceInfo(){return J.deviceInfo},get sdkInfo(){return J.sdkInfo},get hostInfo(){return J.hostInfo},get hostUserInfo(){return J.hostUserInfo},get sessionId(){var R,S;return(S=(R=J.clientSessionId)!=null?R:a)!=null?S:n},get channel(){return c},get webviewId(){var R;return(R=J.webviewId)!=null?R:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},get baseApiHost(){return d?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:R=>{hn(J,R,gn)},encodeJoliSourceQuery:R=>{var S,H;return t&&r?Yn(_(_({},e),R),(S=i.get("joliSource"))!=null?S:""):(H=i.get("joliSource"))!=null?H:""}}},w=js()});var wr,no,Hs,$s,ro,Js,oo=k(()=>{"use strict";A();re();V();A();wr=!1,no=(e,t)=>e==null?!1:t in e,Hs=e=>no(e,"kind"),$s=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},ro=(e,t={},r)=>{var i,s,a;let n={user_id:(s=(i=w.hostUserInfo)==null?void 0:i.uid)!=null?s:"",device_id:(a=w.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:$s(e.name)},o=P(_({},n),{env:t.environment,isFromUser:r});r?Te.emit("GLOBAL_USER_ERROR",e,o):Te.emit("GLOBAL_ERROR",e,o)},Js=e=>no(e,"kind")&&e.kind==="USER_ERROR";ur.on("ERROR_REPORT",({error:e,options:t})=>{if(wr)return;wr=!0;let r=Hs(e)&&e.raw?e.raw:e;try{let n=Js(e);ro(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),i=new sr(`${o}, origin error: ${r.message}`);Y.error(i),ro(new sr(i.message),{environment:t.environment},!1)}finally{wr=!1}})});var io=k(()=>{"use strict";oo();_e();A();q();Te.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};O("trackAsync",{event:"reportJsError",data:r})});Te.on("GLOBAL_USER_ERROR",(e,t)=>{Y.log("UserError",e,t)})});var Tr=k(()=>{"use strict"});function so(e,t){let r=(n,o,i)=>{let s=P(_({tag:n},t),{extra:_({},o)});n=="globalJsError"?$(new Tn(JSON.stringify(s))):e("systemLog",s,i)};return r.debounce=$e(r,500,{leading:!0}),r}function ao(e){let t=(r,n,o)=>{var a;let i=(a=o&&JSON.stringify(o))!=null?a:0,s={speed_value_type:r,total_duration:n};i&&Object.assign(s,{extra:i}),e("joliboxSpeedAnalysis",s)};return t.debounce=$e(t,500,{leading:!0}),t}var co=k(()=>{"use strict";A();A();re()});function lo(e,t){let r=so(e,t),n=ao(r);return{track:r,trackPerformance:n}}var uo=k(()=>{"use strict";co()});var po=k(()=>{"use strict";V();A();A()});var mo=k(()=>{"use strict";uo();Tr();po()});var dt,fo=k(()=>{"use strict";dt=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,o,i=!1,s=0,a=()=>{if(!i)return;let m=Date.now(),y=m-r;y>=this.interval&&(this.visible&&(s+=y,t(s)),r=m),n=requestAnimationFrame(a)},l=()=>{d(),r=Date.now(),o=window.setInterval(()=>{if(!i)return;let m=Date.now();m-r>=this.interval&&(r=m)},this.interval)},u=()=>{c(),r=Date.now(),n=requestAnimationFrame(a)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},c=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",m=>{i&&(console.log("visible",m),m?u():l())});let p=this.visible;return{start(){i||(i=!0,p?u():l())},stop(){i=!1,d(),c()}}}}});var Sr=k(()=>{"use strict"});function go(e,t,r){let{response:n,startTime:o,endTime:i,requestFrom:s}=r,{errMsg:a="",profile:l={}}=n,d={duration:i-o,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:l.socketReused?1:0,request_from:s};(s==="public"&&ho<Ks||s==="inner")&&(d.joli_request_number=ho++,setTimeout(()=>{Z("joliboxNetRequestResult",d)},500))}var ho,Ks,_o=k(()=>{"use strict";Sr();ye();ho=0,Ks=10});function pt(e,t,r){var l,u,d;let n=new Map,o=(l=r==null?void 0:r.baseUrl)!=null?l:"https://api.jolibox.com",i=(u=r==null?void 0:r.type)!=null?u:"public",s=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return ae("onRequestTaskStateChange",c=>{if(typeof c.requestTaskId!="string")return;let p=n.get(c.requestTaskId);if(p)if(c.state==="success"){let m=c,{requestTaskId:v,state:h}=m,g=Q(m,["requestTaskId","state"]);p.resolve(g),n.delete(v)}else if(c.state==="fail"){let y=c,{requestTaskId:v,state:h}=y,g=Q(y,["requestTaskId","state"]);p.reject(g),n.delete(v)}else Y.warn("onRequestTaskStateChange unknown event",c)}),pe.on("onLoginComplete",({isLogin:c,token:p})=>{c&&p&&(s["X-JOLI-TOKEN"]=p)}),(m,...y)=>T(this,[m,...y],function*(c,p={}){let v=Date.now(),h=qs(c,P(_({},p),{baseUrl:o})),{method:g="GET",responseType:b="text",dataType:E="json",timeout:N,enableCache:R=!1,appendHostCookie:S=!0}=p,H=Object.assign({"content-type":"application/json"},s,p.header),z={url:h,method:g,header:H,enableCache:R,responseType:b,appendHostCookie:S};if(g=="POST"||g=="PUT"){let ie=Ws(p.data,H["content-type"]);z.data=ie}N&&Object.assign(z,{timeout:N});let{data:{requestTaskId:le}}=O(e,z);if(typeof le!="string")throw ge({code:-1,msg:"requestTaskId is not a string"});let Ce=(ie,ue)=>{go("request",h,{state:ie,startTime:v,endTime:Date.now(),params:z,response:ue,requestId:le,requestFrom:i=="public"?"public":"inner"})},{resolve:ee,reject:be,promise:Wi}=new se;n.set(le,{resolve:ee,reject:be});try{let ie=yield Wi;Ce("success",ie);let{data:ue}=ie;return E==="json"&&typeof ue=="string"&&(ue=Gs(ue)),{url:h,timeout:N,method:g,response:P(_({},ie),{data:ue})}}catch(ie){let ue=ie;if(K(ue)){let{errMsg:Ye,prefetchDetail:zi,isPrefetch:Qi,errNo:Yi}=ue;ke(Ye)&&(Ce("fail",{errMsg:Ye,isPrefetch:Qi,prefetchDetail:zi}),$(ge({code:-1,msg:Ye},{errNo:Yi,errMsg:Ye})))}throw ie}})}function Gs(e){try{return JSON.parse(e.trim())}catch(t){return e}}function Ws(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var qs,Er=k(()=>{"use strict";A();_o();Sr();q();re();_e();qs=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,o=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${o?`?${o}`:""}`:`${e}${o?`?${o}`:""}`}});var xr,vo,G,Oe=k(()=>{"use strict";br();Er();V();xr={"x-user-agent":Zn()};(vo=w.hostUserInfo)!=null&&vo.token&&(xr["x-joli-token"]=w.hostUserInfo.token);w.joliSource&&(xr["x-joli-source"]=w.joliSource);G=pt("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:w.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:xr})});var mt,yo=k(()=>{"use strict";V();fo();Oe();q();mt=class extends dt{constructor(t,r,n){super(r,n),this.gameId=w.mpId,this.sessionId=w.sessionId,this.track=t}reporter(t){return T(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(G("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:_({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return T(this,null,function*(){let{event:r,params:n}=t;yield X("userTrackAsync",{event:r,params:_({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var So={};on(So,{nativeTaskEmitter:()=>Ke,taskTracker:()=>W,track:()=>Z,trackPerformance:()=>wo});var zs,bo,ko,Z,wo,To,Ke,W,ye=k(()=>{"use strict";io();A();Tr();mo();V();yo();q();zs=(e,t,r)=>{var s,a;let n=t,o=K(n.extra)?n.extra:ke(n.extra)?JSON.parse(n.extra):{},i=P(_({},o),{mp_id:(s=n.mp_id)!=null?s:"",mp_version:(a=n.mp_version)!=null?a:""});O("trackAsync",{event:e,data:i,webviewId:r})},{track:Z,trackPerformance:wo}=lo(zs,{type:cr.AppSDK,platform:"native",jssdk_version:(ko=(bo=w.sdkInfo)==null?void 0:bo.jssdkVersion)!=null?ko:"1.0.0",mp_id:w.mpId,mp_version:w.mpVersion}),To=M();To.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{wo(e,t,r)});To.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Z(e,t)});Ke=new te,W=new mt(Z,Ke)});function Eo(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let i=`
|
|
2
2
|
html[data-jolibox-root] {
|
|
3
3
|
height: 100%;
|
|
4
4
|
margin: 0;
|
|
@@ -16,6 +16,112 @@ var Ts=Object.create;var Ce=Object.defineProperty,ks=Object.defineProperties,Es=
|
|
|
16
16
|
min-height: 100dvh;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`;e.textContent=o;let i=document.head||document.getElementsByTagName("head")[0];i.insertBefore(e,i.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function o(a){return g(this,null,function*(){let c=a instanceof URL?a.href:a,l=new Promise((u,m)=>{let p=new XMLHttpRequest;p.open("GET",c),p.responseType="arraybuffer",p.addEventListener("load",()=>u(p.response)),p.addEventListener("error",m),p.send()});try{let u=yield l;return new Response(u,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(u){throw console.error("Failed to load wasm:",u),u}})}let i=window.fetch;window.fetch=(a,c)=>{let l=a instanceof URL?a.href:a.toString();return l.endsWith(".wasm")?o(l):i(a,c)}},s=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),s}var Un=f(()=>{"use strict"});var Ge,Mn=f(()=>{"use strict";Ge=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 Ln,ze,Bn=f(()=>{"use strict";Ln="jolibox-sdk-ads-callbreak-timestamps",ze=class{constructor(t,r){this.checkNetwork=t;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(Ln))!=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 n=this.checkShouldBannedForSession(t);if(n)return n;let s=this.checkShouldBannedForTime(t);return s||"ALLOWED"};var n,s,o,i,a,c;if(this.maxAllowedAdsForTime=(n=r==null?void 0:r.maxAllowedAdsForTime)!=null?n:8,this.bannedForTimeThreshold=(s=r==null?void 0:r.bannedForTimeThreshold)!=null?s:6e4,this.bannedReleaseTime=(o=r==null?void 0:r.bannedReleaseTime)!=null?o:6e4,this.maxAllowedAdsForSession=(i=r==null?void 0:r.maxAllowedAdsForSession)!=null?i:200,this.bannedForSessionThreshold=(a=r==null?void 0:r.bannedForSessionThreshold)!=null?a:6e5,this.initialThreshold=(c=r==null?void 0:r.initialThreshold)!=null?c: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(Ln,JSON.stringify(t))}catch(r){console.error("Failed to save timestamps")}this._callAdsTimestampsForTime=t}}});var We,jn=f(()=>{"use strict";K();We=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return g(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 s=(r=v.channel)!=null?r:"",o=this.configs[s],i=(n=o==null?void 0:o.interstitialRate)!=null?n:1;t=Math.random()<i}return this.firstRun=!1,t}}});var ve,Qe,er=f(()=>{"use strict";Mn();Bn();K();jn();E();ve=new q,Qe=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>v.mpId;this.getTestAdsMode=()=>v.testAdsMode;this.asyncLoad=()=>g(this,null,function*(){var i,a,c,l,u;let t="ca-pub-7171363994453626",r,n,s=window.encodeURIComponent(window.btoa((i=this.getGameId())!=null?i:"")),o=(a=this.getTestAdsMode())!=null?a:!1;try{let m=yield this.httpClient.get("/public/ads",{query:{objectId:s,testAdsMode:`${o}`}});t=(c=m.data)==null?void 0:c.clientId,r=(l=m.data)==null?void 0:l.channelId,n=(u=m.data)==null?void 0:u.unitId}catch(m){console.error("Failed to fetch client info",m)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>g(this,null,function*(){var s;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(s=this.getTestAdsMode())!=null?s:!1;if(!document.getElementById(r)&&this.clientId){let o=document.createElement("script");o.id=r,o.async=!0,o.crossOrigin="anonymous",o.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&o.setAttribute("data-adbreak-test","on"),this.channelId&&o.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(o),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){ve.emit("isAdShowing",!0);let n=t.adBreakDone,s=o=>{ve.emit("isAdShowing",!1),n&&n(o)};return C(h({},t),{adBreakDone:s})}else{let n=t.beforeAd,s=t.afterAd,o=()=>{ve.emit("isAdShowing",!0),this.track("CallBeforeAd",{}),n&&n()},i=()=>{ve.emit("isAdShowing",!1),this.track("CallAfterAd",{}),s&&s()};return C(h({},t),{beforeAd:o,afterAd:i})}};this.adConfig=t=>{let s=t,{onReady:r}=s,n=ce(s,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var c,l,u,m;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(c=t.adBreakDone)==null||c.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),(l=t.adBreakDone)==null||l.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.track("PreventAdsCheating",{reason:r});return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":console.warn("Ads not allowed",r),(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),this.track("PreventAdsCheating",{reason:r});return;default:break}let n=t.type,s=t.adBreakDone,o=p=>{var b;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:p.breakType,breakName:(b=p.breakName)!=null?b:"",breakFormat:p.breakFormat,breakStatus:p.breakStatus}),s&&s(p)};if(t.adBreakDone=o,t.type==="reward"){let p=t.beforeReward,b=T=>()=>{this.track("CallShowAdFn",null),T()},_=T=>{p&&p(b(T))};t.beforeReward=_}let i;switch(n){case"preroll":i={type:n};break;case"start":case"pause":case"next":case"browse":case"reward":i={type:n,name:(m=t.name)!=null?m:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",i);let a=this.wrapAdBreakParams(t);this.push(a),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>g(this,null,function*(){var p,b,_,T;if(this.track("CallAdUnit",{adFormat:(b=(p=t.adFormat)==null?void 0:p.toString())!=null?b:null,fullWidthResponsive:(_=t.fullWidthResponsive)!=null?_:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:s,fullWidthResponsive:o,style:i}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let c=n;if(c||(c=this.unitId),!c)throw new Error("slot is required");let l=typeof s=="object"&&Array.isArray(s)?s.join(", "):s,u=document.createElement("ins");if(u.className="adsbygoogle",u.id="jolibox-ads",u.style.display="block",u.setAttribute("data-ad-client",this.clientId),u.setAttribute("data-ad-slot",c),l&&u.setAttribute("data-ad-format",l),o&&u.setAttribute("data-full-width-responsive",o),i&&u.setAttribute("style",i),(T=this.getTestAdsMode())!=null?T:!1){let y=document.createElement("div");y.style.position="absolute",y.style.top="0",y.style.left="0",y.style.width="100%",y.style.height="100%",y.style.display="flex",y.style.justifyContent="center",y.style.alignItems="center",y.style.backgroundColor="rgba(0, 0, 0, 0.5)",y.style.color="white",y.innerHTML="Test Ad",u.style.position="relative",a.appendChild(u),u.appendChild(y)}else a.appendChild(u),new MutationObserver(S=>{S.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let w=u.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:w!=null?w:"null"})}})}).observe(u,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new ze(n),this.adsActionDetection=new Ge(this.track),this.channelPolicy=new We(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});var $n={};hr($n,{config:()=>ko});function vo(){ee.on("onDocumentReady",()=>{var e;(e=ie)==null||e.onDocumentReady(window.location.href),V("onDocumentReady",{start_timestamp:Ze,timestamp:Date.now()})})}function bo(e){v.mpType==="game"&&j.start(e)}function To(){Q("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&v.onEnvConfigChanged({hostUserInfo:e}),ee.emit("LifecycleEvent.onReady",h({},v.hostUserInfo?v.hostUserInfo:{isLogin:!1})),V("joliboxServiceReady",{start_timestamp:Ze,timestamp:Date.now()}),bo(t)}),Q("onBeforeExit",({uuid:e})=>{var t;(t=ie)==null||t.doExit(e)})}function ko(){Ze=Date.now(),To(),vo(),Ye=Dn()}var Ye,Jn,Xe,Ze,Hn=f(()=>{"use strict";H();Je();K();E();ae();Un();er();z.onReady(()=>{});Jn=()=>{V("onBeforeExit",{timestamp:Date.now()}),Ye==null||Ye(),j.close(Date.now()-Ze)};z.doExit(()=>g(void 0,null,function*(){return Xe?!0:Ie(v.shouldInterupt)?(v.shouldInterupt||Jn(),v.shouldInterupt):(Jn(),!1)}));Xe=!1;ve.on("isAdShowing",e=>{Xe=e,Ie(Xe)&&P("updateContainerConfigSync",{displayCapsuleButton:!Xe,webviewId:v.webviewId})})});function Vn(e){let t=Ot.config[e];return t||(t={},Ot.config[e]=t),(r,n)=>{if(t[r]){J.warn(`[can i use] ${r} already registered`);return}t[r]=h({},n)}}var Kn=f(()=>{"use strict";E()});function tr(e){qn=e}function et(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>et(t)):Object.keys(e).reduce((t,r)=>(t[r]=et(e[r]),t),{})}function re(e){return typeof e=="number"}function rr(e){let t=nr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function nr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var qn,O,tt,rt,nt,st,be,ot,it,at,ct,lt,dt,ut,mt,pt,ft,ht,gt,sr=f(()=>{"use strict";qn=!1;O=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(qn)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 ${rr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return et(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:et(this._default)}optional(){return this._optional=!0,this}};tt=class extends O{validate(t){return this._optional&&t===void 0?!0:re(t)?re(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):re(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):re(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}},rt=class extends O{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},nt=class extends O{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(re(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(re(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}},st=class extends O{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},be=class extends O{validate(t){return!0}},ot=class extends O{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},it=class extends O{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},at=class extends O{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},ct=class extends O{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 ${rr(t)}`)}return!0}},lt=class extends O{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(re(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(re(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(re(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 s=!0;if(r.forEach((o,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,o===void 0&&n.hasDefault){r[i]=n.defaultValue;return}n.validate(o)||(n.hasFallback?r[i]=n.fallbackValue:s=!1)}),this._uniqueItems){let o=new Map;for(let i in r)o.has(r[i])?s=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${o.get(r[i])}] and ${this.path}[${i}] are identical)`):o.set(r[i],i)}return s}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}},dt=class extends O{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(nr(r)!=="object")return this.fail({expect:"object",actual:r});let s=r,o=this._value;o.errors=this.errors;let i=!0;for(let a in s){let c=s[a];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?o.path=`${this.path}.${a}`:o.path=`${this.path}["${a}"]`,!(c===void 0&&o._optional)){if(c===void 0&&o.hasDefault){s[a]=o.defaultValue;continue}o.validate(c)||(o.hasFallback?s[a]=o.fallbackValue:i=!1)}}return i}},ut=class extends O{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(nr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,s=!0;for(let o in this._object){let i=n[o],a=this._object[o];if(a.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(o)?a.path=`${this.path}.${o}`:a.path=`${this.path}["${o}"]`,!(a._optional&&i===void 0)){if(i===void 0&&a.hasDefault){n[o]=a.defaultValue;continue}a.validate(i)||(a.hasFallback?n[o]=a.fallbackValue:s=!1)}}return s}},mt=class extends O{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:rr(this.value),actual:r}):!0}},pt=class extends O{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,s=this._items.length;for(let o=0;o<s;o++){let i=this._items[o];if(i.errors=[],i.path=this.path,!i.validate(t))r.push(i.errors.join("; "));else if(!n){n=!0;break}}if(!n){let o=r.join(`
|
|
20
|
-
|
|
21
|
-
`);throw e.errors.length=0,tr(!1),new TypeError(n)}}var d,ir=f(()=>{"use strict";sr();sr();d={object(e){return new ut(e)},array(e){return new lt(e)},tuple(...e){return new ft(...e)},literal(e){return new mt(e)},or(...e){return new pt(...e)},symbol(){return new st},record(e){return new dt(e)},function(){return new at},boolean(){return new rt},string(){return new nt},number(){return new tt},undefined(){return new ot},null(){return new it},unknown(){return new be},any(){return new be},as(){return new be},arraybuffer(){return new ht},enum(...e){return new ct(...e)},typedarray(e){return new gt(e)}}});var yt,Gn,zn=f(()=>{"use strict";E();G();ir();oe();yt=1,Gn=e=>{function t(n,s){return(...o)=>{var m,p,b,_;let i=Date.now(),a={method:n,trace_id:yt};yt+=1;let c="SUCCESS",l=`${n}:ok`,u=0;try{if(s.paramsSchema)try{or(s.paramsSchema,o,"params")}catch(R){throw Mt(`${n}:fail ${R.message}`)}let T=s.implement(...o),y=T,S=`${n}:ok`;if(T&&"code"in T){let{code:R,data:w,message:U}=T;c=R,y=w,S=U}return{code:c,message:S,data:y}}catch(T){let y=T;u=(p=(m=y.code)!=null?m:y.errNo)!=null?p:2e3,c="FAILURE";let S=(_=(b=y.message)!=null?b:y.errMsg)!=null?_:`${T}`;return l=`${n}:${c} ${S.replace(/^\S+:(fail|cancel)\s?/,"")}`,M(new Ae(l,u)),{code:c,message:l}}finally{let T=Date.now()-i;e("apiInvoked",C(h({},a),{duration:T,status:c}))}}}function r(n,s){return(...o)=>g(this,null,function*(){var p,b,_,T;let i=kr(o)?o:[o],a=Date.now(),c={method:n,trace_id:yt};yt+=1;let l=`${n}:ok`,u="SUCCESS",m={code:u,message:l};try{if(s.paramsSchema)try{or(s.paramsSchema,i,"params")}catch(R){throw Mt(R.message)}let S=yield s.implement(...i);if(S&&"code"in S){let{code:R,data:w,message:U}=S;u=R,l=U,S=w}return Object.assign(m,{code:u,message:l,data:S}),m}catch(y){let S=y,R=(b=(p=S.code)!=null?p:S.errNo)!=null?b:2e3;u="FAILURE";let w=(T=(_=S.message)!=null?_:S.errMsg)!=null?T:`${y}`,U=`${n}:${u} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(m,{code:u,message:U}),M(new Ae(U,R)),m}finally{let y=Date.now()-a;e("apiInvoked",C(h({},c),{duration:y,status:u}))}})}return{createAPI:r,createSyncAPI:t}}});var F,D,k,Y=f(()=>{"use strict";Kn();ae();zn();ir();({createAPI:F,createSyncAPI:D}=Gn(V)),k=Vn("native")});var Wn,So,wo,Io,_o,Qn=f(()=>{"use strict";E();Y();H();Wn=N(),So="env",wo="getSystemInfoSync",Io=D(wo,{implement:()=>{var r;let e=P("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform,version:t.sdkInfo.jssdkVersion,pixelRatio:t.deviceInfo.pixelRatio,language:t.deviceInfo.lang,brand:t.deviceInfo.brand,appName:(r=t.hostInfo)==null?void 0:r.appName,SDKVersion:t.sdkInfo.jssdkVersion}}}),_o=D(So,{implement:()=>{var t;let e=P("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Wn.registerCommand("API.getSystemInfoSync",Io);Wn.registerCommand("API.env",_o);k("env",{version:"1.0.0"});k("getSystemInfoSync",{version:"1.0.0"})});var Yn=fr(ar=>{"use strict";E();Y();G();H();ae();K();var Ao="exitGame",Ro="onReady",xo="onJoliboxShow",Po="onJoliboxHide",vt=N(),bt=Ue(M),Co=F(Ao,{paramsSchema:d.tuple(d.function(),d.boolean().optional().default(!1)),implement:(e,t=!1)=>g(ar,null,function*(){bt(e).call(ar),Ie(v.shouldInterupt)&&!v.shouldInterupt&&v.from&&on("onRetentionResult",{shouldStay:t},v.from,!0),yield $("exitAppAsync")})}),No=D(xo,{paramsSchema:d.tuple(d.function()),implement(e){let t=bt(e);Q("onJoliboxEnterForeground",()=>{t.call(this),Re.emit("visible",!0)})}}),Oo=D(Po,{paramsSchema:d.tuple(d.function()),implement(e){let t=bt(e);Q("onJoliboxEnterBackground",()=>{t.call(this),Re.emit("visible",!1)})}}),Fo=D(Ro,{paramsSchema:d.tuple(d.function()),implement(e){let t=bt(e);ee.on("LifecycleEvent.onReady",r=>{t(r)})}});vt.registerCommand("LifecycleSDK.exit",Co);vt.registerCommand("LifecycleSDK.onReady",Fo);vt.registerCommand("LifecycleSDK.onJoliboxShow",No);vt.registerCommand("LifecycleSDK.onJoliboxHide",Oo);k("lifeCycle.exit",{version:"1.0.0"});k("lifeCycle.onReady",{version:"1.0.0"});k("lifeCycle.onJoliboxShow",{version:"1.0.0"});k("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Xn(e){let t={};if(!B(e))return t;for(let[r,n]of Object.entries(e)){let s=r.toLocaleLowerCase();n?typeof n=="object"?t[s]=Object.prototype.toString.call(n):t[s]=String(n):t[s]=""}return t}function Zn(e="GET"){if(e==="")return"POST";let t=e.toUpperCase();return["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"].includes(t)?t:"GET"}function es(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function ts(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!B(r))return e;let[n,s=""]=e.split("?"),o=JSON.stringify(h(h({},JSON.parse(s)),r));return`${n}?${o}`}var rs=f(()=>{"use strict";E()});var Do,Uo,cr,lr,ns,Mo,Lo,Bo,ss=f(()=>{"use strict";oe();Xt();Y();rs();E();G();Do=15,Uo=Ve("createRequestTaskSync","operateRequestTaskSync",{type:"public"}),cr=0,lr=[],ns=Ue(M),Mo=(e,t)=>{let r=e.filter(t),n=e.filter(s=>!t(s));return e.length=0,e.push(...n),r},Lo=e=>{let t=new se,r=()=>{};return F("request",{paramsSchema:d.tuple(d.object({url:d.string(),method:d.string(),header:d.object(),data:d.object().optional(),query:d.object().optional(),dataType:d.string().default("json"),responseType:d.string().default("text"),enableCache:d.boolean().default(!1),appendHostCookie:d.boolean().default(!0),timeout:d.number().default(3e4),success:d.function(),fail:d.function()})),implement(s){let o=()=>g(this,null,function*(){var a,c;let i=ns(s.fail);try{if(cr+=1,t.state!=="pending")return;let{data:l,dataType:u,responseType:m,enableCache:p,appendHostCookie:b}=s,_=Xn(s.header),T=Zn(s.method),y=es(s.timeout),S=ts(s.url,T,l),R=ns(s.success),w=Object.assign({},s,{method:T,header:_,data:T==="GET"||T==="HEAD"?void 0:l,enableCache:p,query:(a=s.query)!=null?a:{},dataType:u,responseType:m,appendHostCookie:b});y&&(w.timeout=y);let U=Uo(S,w);{let{response:I}=yield U,{code:A,data:ke,message:ne}=I;t.resolve({code:A!=null?A:"SUCCESS",data:ke,message:ne!=null?ne:"request:ok"}),R({code:"SUCCESS",message:"request:ok",data:ke})}}catch(l){t.reject(l),i({code:"FAILURE",message:"httpRequst: failed"})}finally{cr-=1,(c=lr.shift())==null||c()}});return cr>=Do?(r=()=>{Mo(lr,i=>i===o)},lr.push(o)):o(),t.promise}})(e),{abort(){t.reject(me({code:-1,msg:"request:fail abort"})),r()}}},Bo=N();Bo.registerCommand("HttpSDK.request",Lo);k("request",{version:"1.0.0"})});function Ko(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return Vo.includes(t)?t:""}function qo(e,t){try{switch(t){case"string":return e;case"object":return JSON.parse(e);case"number":return parseFloat(e);case"boolean":return e==="true";default:return""}}catch(r){return""}}function Go(e,t){try{switch(t){case"string":case"number":case"boolean":return`${e}`;case"object":return JSON.stringify(e);default:return""}}catch(r){return""}}var Tt,jo,Jo,$o,Ho,Cd,Nd,Vo,os=f(()=>{"use strict";Y();H();E();Ke();K();Tt=N(),jo=F("getLocalStorage",{paramsSchema:d.tuple(d.string()),implement(e){return g(this,null,function*(){let{response:t}=yield te(`/api/games/user-storage/${v.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:s}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:s==null?void 0:s.value};try{let{data:{data:o,dataType:i}}=yield $("getLocalStorageAsync",{key:e}),a=qo(o,i);return{code:r,message:`${n}. fallback to native`,data:a}}catch(o){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});Tt.registerCommand("StorageSDK.getItem",jo);k("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});Jo=F("setStorage",{paramsSchema:d.tuple(d.string(),d.or(d.string(),d.boolean(),d.number())),implement(e,t){return g(this,null,function*(){let r=v.mpId,n=typeof t=="string"?t:String(t),{response:s}=yield te(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:o,message:i}}=s,a=Ko(t),c=Go(t,a);return yield $("setLocalStorageAsync",{key:e,data:c,dataType:a}),o=="SUCCESS"?{code:o,message:i}:{code:o,message:`${i}. fallback to native`}})}});Tt.registerCommand("StorageSDK.setItem",Jo);k("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});$o=F("removeStorage",{paramsSchema:d.tuple(d.string()),implement(e){return g(this,null,function*(){let t=v.mpId,{response:r}=yield te(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:s}}=r;return yield $("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:s}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Tt.registerCommand("StorageSDK.removeItem",$o);k("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});Ho=F("clearStorage",{implement(){return g(this,null,function*(){let e=v.mpId,{response:t}=yield te(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});$("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});Tt.registerCommand("StorageSDK.clear",Ho);k("storage.clear",{version:"1.0.0"});Cd=F("getStorageInfo",{implement(){return g(this,null,function*(){let{data:e}=yield $("getStorageInfoAsync");return e})}});k("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});Nd=D("getStorageInfoSync",{implement(){return P("getStorageInfoSync")}}),Vo=["string","number","boolean","object",""]});var zo,Wo,Qo,dr,is=f(()=>{"use strict";E();H();Y();zo=D("showKeyboard",{paramsSchema:d.tuple(d.object({defaultValue:d.string().optional().default(""),multiple:d.boolean().optional().default(!1),maxLength:d.unknown().optional().default(1e5)})),implement(e){var n;let t=Math.floor((n=Number(e.maxLength))!=null?n:1e5),{defaultValue:r}=e;r&&t&&(r=r.slice(0,t)),P("showKeyboardSync",C(h({},e),{defaultValue:r,maxLength:t}))}});k("keyboard.showKeyboard",{version:"1.0.0",properties:{params:{defaultValue:"1.0.0",multiple:"1.0.0",confirmHold:"1.0.0",confirmType:"1.0.0",maxLength:"1.0.0"}},success:{errMsg:"1.0.0"}});Wo=D("updateKeyboard",{paramsSchema:d.tuple(d.object({value:d.string()})),implement(e){P("updateKeyboardSync",e)}});k("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});Qo=D("hideKeyboard",{implement(){P("hideKeyboardSync")}});k("keyboard.hideKeyboard",{version:"1.0.0"});dr=N();dr.registerCommand("KeyboardSDK.showKeyboard",zo);dr.registerCommand("KeyboardSDK.updateKeyboard",Wo);dr.registerCommand("KeyboardSDK.hideKeyboard",Qo)});var as=fr(he=>{"use strict";E();Y();ae();var Te=N(),Yo=F("levelFinished",{paramsSchema:d.tuple(d.string(),d.object({result:d.boolean(),duration:d.number()})),implement:(e,t)=>g(he,null,function*(){let{result:r,duration:n}=t,s=[];s.push(j.tracker("LevelFinished",{levelId:e,result:r,duration:n})),s.push(j.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(s)})}),Xo=F("taskFinished",{paramsSchema:d.tuple(d.string(),d.object({duration:d.number()})),implement:(e,t)=>g(he,null,function*(){let{duration:r}=t;return yield j.reportToNative({event:"TaskFinished",params:{duration:r,taskId:e}})})}),Zo=F("levelUpgrade",{paramsSchema:d.tuple(d.string(),d.string()),implement:(e,t)=>g(he,null,function*(){let r=[];r.push(j.reportToNative({event:"LevelUpgrade",params:{name:t,levelId:e}})),yield Promise.all(r)})}),ei=F("onHistoryUserLevel",{paramsSchema:d.tuple(d.number()),implement:e=>g(he,null,function*(){return yield j.reportToNative({event:"HistoryUserLevel",params:{level:e}})})}),ti=F("onHistoryUserScore",{paramsSchema:d.tuple(d.number()),implement:e=>g(he,null,function*(){return yield j.reportToNative({event:"HistoryUserScore",params:{score:e}})})}),ri=F("taskEvent",{paramsSchema:d.tuple(d.string(),d.object({tools:d.array(d.object({id:d.string(),name:d.string(),count:d.number(),description:d.string().optional(),price:d.object({amount:d.number(),unit:d.string()}).optional()})).optional(),awards:d.array(d.object({id:d.string(),name:d.string()})).optional()})),implement:(e,t)=>g(he,null,function*(){var n,s;let r=[];r.push(j.reportToNative({event:"TaskEvent",params:h({taskId:e},t)})),(s=(n=t.tools)==null?void 0:n.length)!=null&&s&&(r.push(j.reporter({event:"USE_GAME_ITEM"})),r.push(j.reportToNative({event:"UseGameItem",params:h({taskId:e},t)}))),yield Promise.all(r)})});Te.registerCommand("TaskTrackerSDK.levelFinished",Yo);Te.registerCommand("TaskTrackerSDK.taskFinished",Xo);Te.registerCommand("TaskTrackerSDK.levelUpgrade",Zo);Te.registerCommand("TaskTrackerSDK.historyUserLevel",ei);Te.registerCommand("TaskTrackerSDK.historyUserScore",ti);Te.registerCommand("TaskTrackerSDK.taskEvent",ri);k("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});k("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});k("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});k("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});k("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});k("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"}}}})});var ni,si,cs,ls=f(()=>{"use strict";K();H();Y();E();oe();k("login",{version:"1.0.0",properties:{force:"1.0.0"},success:{errMsg:"1.0.0",code:"1.0.0",token:"1.0.0",isLogin:"1.0.0"}});k("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});ni=F("login",{implement(){return g(this,null,function*(){var i;let{data:{isLogin:e}}=yield $("checkLoginAsync");if(e)return{isLogin:!0,token:(i=v.hostUserInfo)==null?void 0:i.token};Q("onLoginStateChange",({isLogin:a,token:c,uuid:l})=>{l==r&&s({isLogin:a,token:c})});let t=P("loginSync"),{data:{uuid:r}}=t;if(!r)throw me({code:-1,msg:"login failed"});let{promise:n,resolve:s}=new se,o=yield n;return v.onEnvConfigChanged({hostUserInfo:o}),ee.emit("onLoginComplete",o),o})}}),si=F("checkSession",{implement(){return g(this,null,function*(){let{data:{isLogin:e}}=yield $("checkLoginAsync");return{isLogin:e}})}}),cs=N();cs.registerCommand("API.login",ni);cs.registerCommand("API.checkSession",si)});var kt,oi,Et,ii,ai,ci,li,ds=f(()=>{"use strict";E();Y();er();ae();Ke();H();kt=N(),oi=()=>{let{data:e}=P("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},Et=new Qe(V,{get:(e,t)=>te(e,h({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data)},oi),ii=D("adInit",{implement:e=>{Et.init(e)}}),ai=D("adConfig",{implement:e=>{Et.adConfig(e)}}),ci=D("adBreak",{implement:e=>{Et.adBreak(e)}}),li=D("adUnit",{implement:e=>{Et.adUnit(e)}});kt.registerCommand("AdsSDK.init",ii);kt.registerCommand("AdsSDK.adConfig",ai);kt.registerCommand("AdsSDK.adBreak",ci);kt.registerCommand("AdsSDK.adUnit",li);k("AdsSDK.init",{version:"1.0.0"});k("AdsSDK.adConfig",{version:"1.0.0"});k("AdsSDK.adBreak",{version:"1.0.0"});k("AdsSDK.adUnit",{version:"1.0.0"})});var di,ui,us=f(()=>{"use strict";E();H();Y();di=N(),ui=D("openSchemaSync",{paramsSchema:d.tuple(d.string()),implement:e=>{let t=P("openSchemaSync",{schema:e});if(t.errNo!==0)throw new Ct(t.errMsg,t.errNo)}});di.registerCommand("API.openSchemaSync",ui);k("openSchemaSync",{version:"1.1.9"})});var mi={};var fu,vu,ms=f(()=>{"use strict";Qn();fu=gr(Yn());ss();os();is();vu=gr(as());ls();ds();us()});var ps=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[ps])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[ps]=!0;g(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(Hn(),$n)),Promise.resolve().then(()=>(ms(),mi)),Promise.resolve().then(()=>(ae(),Fn))]);e()});
|
|
19
|
+
`;e.textContent=i;let s=document.head||document.getElementsByTagName("head")[0];s.insertBefore(e,s.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function i(a){return T(this,null,function*(){let l=a instanceof URL?a.href:a,u=new Promise((d,c)=>{let p=new XMLHttpRequest;p.open("GET",l),p.responseType="arraybuffer",p.addEventListener("load",()=>d(p.response)),p.addEventListener("error",c),p.send()});try{let d=yield u;return new Response(d,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(d){throw console.error("Failed to load wasm:",d),d}})}let s=window.fetch;window.fetch=(a,l)=>{let u=a instanceof URL?a.href:a.toString();return u.endsWith(".wasm")?i(u):s(a,l)}},o=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),o}var xo=k(()=>{"use strict"});var ft,Io=k(()=>{"use strict";ft=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 ht,Qs,Ys,Xs,Zs,Ro=k(()=>{"use strict";ht=class{constructor(t,r,n,o){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let o=this.checkShouldBanHighFreq(t);if(o)return o;let i=this.checkShouldBanForTime(t);return i?{reason:i}:{reason:"ALLOWED"}};var p,m,y,v,h,g,b;let i=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,s=(m=o==null?void 0:o.banForTimeThreshold)!=null?m:6e4,a=(y=o==null?void 0:o.bannedReleaseTime)!=null?y:6e4,l=(v=o==null?void 0:o.maxAllowedAdsForSession)!=null?v:200,u=(h=o==null?void 0:o.banForSessionThreshold)!=null?h:6e5,d=(g=o==null?void 0:o.initialThreshold)!=null?g:2e3,c=(b=o==null?void 0:o.highFreqThreshold)!=null?b:2e3;this.checkShouldBanInitial=Xs(d),this.checkShouldBanHighFreq=Zs(c),this.checkShouldBanForTime=Ys(i,s,a),this.checkShouldBanForSession=Qs(l,u)}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}})}},Qs=(e,t)=>{let r=!1,n=[];return i=>{if(r)return"BANNED_FOR_SESSION";let s=Date.now();if(n=n.concat({timestamp:s,type:i}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&s-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Ys=(e,t,r)=>{let n=null,o=d=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{l.value=!1,n=null},d)},i="jolibox-sdk-ads-callbreak-timestamps",s="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var d;try{let c=JSON.parse((d=window.localStorage.getItem(i))!=null?d:"[]");Array.isArray(c)?this._records=c:this._records=[]}catch(c){this._records=[]}},get values(){return this._records},set values(d){try{window.localStorage.setItem(i,JSON.stringify(d))}catch(c){}this._records=d}},l={_record:!1,init(){var d;try{let c=JSON.parse((d=window.localStorage.getItem(s))!=null?d:"false");typeof c=="boolean"&&(this._record=c)}catch(c){this._record=!1}if(this._record){let c=a.values[a.values.length-1],p=c?Date.now()-c.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(d){try{window.localStorage.setItem(s,JSON.stringify(d))}catch(c){}this._record=d}};return a.init(),l.init(),d=>{if(l.value)return"WAITING_BANNED_RELEASE";let c=Date.now();if(a.values=a.values.concat({timestamp:c,type:d}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&c-a.values[0].timestamp<=t))return l.value=!0,o(r),"BANNED_FOR_TIME"}},Xs=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Zs=(e=2e3)=>{let t=0,r=null;return o=>{if(o==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}}});var gt,Ao=k(()=>{"use strict";V();gt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return T(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let o=(r=w.channel)!=null?r:"",i=this.configs[o],s=(n=i==null?void 0:i.interstitialRate)!=null?n:1;t=Math.random()<s}return this.firstRun=!1,t}}});var De,_t,Ir=k(()=>{"use strict";Io();Ro();V();Ao();A();De=new te,_t=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>w.mpId;this.getTestAdsMode=()=>w.testAdsMode;this.asyncLoad=()=>T(this,null,function*(){var s,a,l,u,d;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((s=this.getGameId())!=null?s:"")),i=(a=this.getTestAdsMode())!=null?a:!1;try{let c=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${i}`}});t=(l=c.data)==null?void 0:l.clientId,r=(u=c.data)==null?void 0:u.channelId,n=(d=c.data)==null?void 0:d.unitId}catch(c){console.error("Failed to fetch client info",c)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>T(this,null,function*(){var o;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(o=this.getTestAdsMode())!=null?o:!1;if(!document.getElementById(r)&&this.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.channelId&&i.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(i),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){De.emit("isAdShowing",!0);let n=t.adBreakDone,o=i=>{De.emit("isAdShowing",!1),n&&n(i)};return P(_({},t),{adBreakDone:o})}else{let n=t.beforeAd,o=t.afterAd,i=()=>{var a;De.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(a=t.name)!=null?a:""}),n&&n()},s=()=>{var a;De.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(a=t.name)!=null?a:""}),o&&o()};return P(_({},t),{beforeAd:i,afterAd:s})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=Q(o,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var u,d,c,p,m,y;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(u=t.adBreakDone)==null||u.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":(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(m=t.adBreakDone)==null||m.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((p=n==null?void 0:n.count)!=null?p:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let o=t.type,i=t.adBreakDone,s=v=>{var h;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:v.breakType,breakName:(h=v.breakName)!=null?h:"",breakFormat:v.breakFormat,breakStatus:v.breakStatus}),i&&i(v)};if(t.adBreakDone=s,t.type==="reward"){let v=t.beforeReward,h=b=>()=>{this.track("CallShowAdFn",null),b()},g=b=>{v&&v(h(b))};t.beforeReward=g}let a;switch(o){case"preroll":a={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":a={type:o,name:(y=t.name)!=null?y:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",a);let l=this.wrapAdBreakParams(t);this.push(l),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>T(this,null,function*(){var p,m,y,v;if(this.track("CallAdUnit",{adFormat:(m=(p=t.adFormat)==null?void 0:p.toString())!=null?m:null,fullWidthResponsive:(y=t.fullWidthResponsive)!=null?y:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:o,fullWidthResponsive:i,style:s}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let l=n;if(l||(l=this.unitId),!l)throw new Error("slot is required");let u=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,d=document.createElement("ins");if(d.className="adsbygoogle",d.id="jolibox-ads",d.style.display="block",d.setAttribute("data-ad-client",this.clientId),d.setAttribute("data-ad-slot",l),u&&d.setAttribute("data-ad-format",u),i&&d.setAttribute("data-full-width-responsive",i),s&&d.setAttribute("style",s),(v=this.getTestAdsMode())!=null?v:!1){let h=document.createElement("div");h.style.position="absolute",h.style.top="0",h.style.left="0",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center",h.style.backgroundColor="rgba(0, 0, 0, 0.5)",h.style.color="white",h.innerHTML="Test Ad",d.style.position="relative",a.appendChild(d),d.appendChild(h)}else a.appendChild(d),new MutationObserver(g=>{g.forEach(b=>{if(b.type==="attributes"&&b.attributeName==="data-ad-status"){let E=d.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:E!=null?E:"null"})}})}).observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new ht(t,r,n),this.adsActionDetection=new ft(this.track),this.channelPolicy=new gt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function me(e,t){for(var r in t)e[r]=t[r];return e}function Br(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ie(e,t,r){var n,o,i,s={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?Et.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return bt(e,s,n,o,null)}function bt(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o!=null?o:++Qo,__i:-1,__u:0};return o==null&&x.vnode!=null&&x.vnode(i),i}function Re(e){return e.children}function fe(e,t){this.props=e,this.context=t}function Fe(e,t){if(t==null)return e.__?Fe(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Fe(e):null}function ti(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return ti(e)}}function Po(e){(!e.__d&&(e.__d=!0)&&xe.push(e)&&!wt.__r++||Co!==x.debounceRendering)&&((Co=x.debounceRendering)||Yo)(wt)}function wt(){for(var e,t,r,n,o,i,s,a=1;xe.length;)xe.length>a&&xe.sort(Xo),e=xe.shift(),a=xe.length,e.__d&&(r=void 0,o=(n=(t=e).__v).__e,i=[],s=[],t.__P&&((r=me({},n)).__v=n.__v+1,x.vnode&&x.vnode(r),jr(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[o]:null,i,o!=null?o:Fe(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,oi(i,r,s),r.__e!=o&&ti(r)));wt.__r=0}function ri(e,t,r,n,o,i,s,a,l,u,d){var c,p,m,y,v,h,g=n&&n.__k||ei,b=t.length;for(l=ta(r,t,g,l,b),c=0;c<b;c++)(m=r.__k[c])!=null&&(p=m.__i===-1?Ge:g[m.__i]||Ge,m.__i=c,h=jr(e,m,p,o,i,s,a,l,u,d),y=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Hr(p.ref,null,m),d.push(m.ref,m.__c||y,m)),v==null&&y!=null&&(v=y),4&m.__u||p.__k===m.__k?l=ni(m,l,e):typeof m.type=="function"&&h!==void 0?l=h:y&&(l=y.nextSibling),m.__u&=-7);return r.__e=v,l}function ta(e,t,r,n,o){var i,s,a,l,u,d=r.length,c=d,p=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(l=i+p,(s=e.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?bt(null,s,null,null,null):Qe(s)?bt(Re,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?bt(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,(u=s.__i=ra(s,r,l,c))!==-1&&(c--,(a=r[u])&&(a.__u|=2)),a==null||a.__v===null?(u==-1&&(o>d?p--:o<d&&p++),typeof s.type!="function"&&(s.__u|=4)):u!=l&&(u==l-1?p--:u==l+1?p++:(u>l?p--:p++,s.__u|=4))):e.__k[i]=null;if(c)for(i=0;i<d;i++)(a=r[i])!=null&&!(2&a.__u)&&(a.__e==n&&(n=Fe(a)),si(a,a));return n}function ni(e,t,r){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=ni(n[o],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Fe(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Tt(e,t){return t=t||[],e==null||typeof e=="boolean"||(Qe(e)?e.some(function(r){Tt(r,t)}):t.push(e)),t}function ra(e,t,r,n){var o,i,s=e.key,a=e.type,l=t[r];if(l===null&&e.key==null||l&&s==l.key&&a===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(o=r-1,i=r+1;o>=0||i<t.length;){if(o>=0){if((l=t[o])&&!(2&l.__u)&&s==l.key&&a===l.type)return o;o--}if(i<t.length){if((l=t[i])&&!(2&l.__u)&&s==l.key&&a===l.type)return i;i++}}return-1}function No(e,t,r){t[0]=="-"?e.setProperty(t,r!=null?r:""):e[t]=r==null?"":typeof r!="number"||ea.test(t)?r:r+"px"}function vt(e,t,r,n,o){var i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||No(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||No(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Zo,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n?r.t=n.t:(r.t=Lr,e.addEventListener(t,i?Nr:Pr,i)):e.removeEventListener(t,i?Nr:Pr,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r!=null?r:"";break e}catch(s){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Oo(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Lr++;else if(t.u<r.t)return;return r(x.event?x.event(t):t)}}}function jr(e,t,r,n,o,i,s,a,l,u){var d,c,p,m,y,v,h,g,b,E,N,R,S,H,z,le,Ce,ee=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[a=t.__e=r.__e]),(d=x.__b)&&d(t);e:if(typeof ee=="function")try{if(g=t.props,b="prototype"in ee&&ee.prototype.render,E=(d=ee.contextType)&&n[d.__c],N=d?E?E.props.value:d.__:n,r.__c?h=(c=t.__c=r.__c).__=c.__E:(b?t.__c=c=new ee(g,N):(t.__c=c=new fe(g,N),c.constructor=ee,c.render=oa),E&&E.sub(c),c.props=g,c.state||(c.state={}),c.context=N,c.__n=n,p=c.__d=!0,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&ee.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=me({},c.__s)),me(c.__s,ee.getDerivedStateFromProps(g,c.__s))),m=c.props,y=c.state,c.__v=t,p)b&&ee.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&ee.getDerivedStateFromProps==null&&g!==m&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,N),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,N)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(be){be&&(be.__=t)}),R=0;R<c._sb.length;R++)c.__h.push(c._sb[R]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,N),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(m,y,v)})}if(c.context=N,c.props=g,c.__P=e,c.__e=!1,S=x.__r,H=0,b){for(c.state=c.__s,c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),z=0;z<c._sb.length;z++)c.__h.push(c._sb[z]);c._sb=[]}else do c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++H<25);c.state=c.__s,c.getChildContext!=null&&(n=me(me({},n),c.getChildContext())),b&&!p&&c.getSnapshotBeforeUpdate!=null&&(v=c.getSnapshotBeforeUpdate(m,y)),le=d,d!=null&&d.type===Re&&d.key==null&&(le=ii(d.props.children)),a=ri(e,Qe(le)?le:[le],t,r,n,o,i,s,a,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&s.push(c),h&&(c.__E=c.__=null)}catch(be){if(t.__v=null,l||i!=null)if(be.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__e=a}else for(Ce=i.length;Ce--;)Br(i[Ce]);else t.__e=r.__e,t.__k=r.__k;x.__e(be,t,r)}else i==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=na(r.__e,t,r,n,o,i,s,l,u);return(d=x.diffed)&&d(t),128&t.__u?void 0:a}function oi(e,t,r){for(var n=0;n<r.length;n++)Hr(r[n],r[++n],r[++n]);x.__c&&x.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){x.__e(i,o.__v)}})}function ii(e){return typeof e!="object"||e==null?e:Qe(e)?e.map(ii):me({},e)}function na(e,t,r,n,o,i,s,a,l){var u,d,c,p,m,y,v,h=r.props,g=t.props,b=t.type;if(b=="svg"?o="http://www.w3.org/2000/svg":b=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((m=i[u])&&"setAttribute"in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,i[u]=null;break}}if(e==null){if(b==null)return document.createTextNode(g);e=document.createElementNS(o,b,g.is&&g),a&&(x.__m&&x.__m(t,i),a=!1),i=null}if(b===null)h===g||a&&e.data===g||(e.data=g);else{if(i=i&&Et.call(e.childNodes),h=r.props||Ge,!a&&i!=null)for(h={},u=0;u<e.attributes.length;u++)h[(m=e.attributes[u]).name]=m.value;for(u in h)if(m=h[u],u!="children"){if(u=="dangerouslySetInnerHTML")c=m;else if(!(u in g)){if(u=="value"&&"defaultValue"in g||u=="checked"&&"defaultChecked"in g)continue;vt(e,u,null,m,o)}}for(u in g)m=g[u],u=="children"?p=m:u=="dangerouslySetInnerHTML"?d=m:u=="value"?y=m:u=="checked"?v=m:a&&typeof m!="function"||h[u]===m||vt(e,u,m,h[u],o);if(d)a||c&&(d.__html===c.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),ri(t.type==="template"?e.content:e,Qe(p)?p:[p],t,r,n,b=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:r.__k&&Fe(r,0),a,l),i!=null)for(u=i.length;u--;)Br(i[u]);a||(u="value",b=="progress"&&y==null?e.removeAttribute("value"):y!==void 0&&(y!==e[u]||b=="progress"&&!y||b=="option"&&y!==h[u])&&vt(e,u,y,h[u],o),u="checked",v!==void 0&&v!==e[u]&&vt(e,u,v,h[u],o))}return e}function Hr(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){x.__e(o,r)}}function si(e,t,r){var n,o;if(x.unmount&&x.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Hr(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){x.__e(i,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&si(n[o],t,r||typeof e.type!="function");r||Br(e.__e),e.__c=e.__=e.__e=void 0}function oa(e,t,r){return this.constructor(e,r)}function Or(e,t,r){var n,o,i,s;t==document&&(t=document.documentElement),x.__&&x.__(e,t),o=(n=!1)?null:t.__k,i=[],s=[],jr(t,e=t.__k=Ie(Re,null,[e]),o||Ge,Ge,t.namespaceURI,o?null:t.firstChild?Et.call(t.childNodes):null,i,o?o.__e:t.firstChild,n,s),oi(i,e,s)}function $r(e,t){L.__h&&L.__h(U,e,ze||t),ze=0;var r=U.__H||(U.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Dr(e){return ze=1,ia(ui,e)}function ia(e,t,r){var n=$r(We++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):ui(void 0,t),function(a){var l=n.__N?n.__N[0]:n.__[0],u=n.t(l,a);l!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=U,!U.__f)){var o=function(a,l,u){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return!!p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,a,l,u);var c=n.__c.props!==a;return d.forEach(function(p){if(p.__N){var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(c=!0)}}),i&&i.call(this,a,l,u)||c};U.__f=!0;var i=U.shouldComponentUpdate,s=U.componentWillUpdate;U.componentWillUpdate=function(a,l,u){if(this.__e){var d=i;i=void 0,o(a,l,u),i=d}s&&s.call(this,a,l,u)},U.shouldComponentUpdate=o}return n.__N||n.__}function qe(e,t){var r=$r(We++,3);!L.__s&&li(r.__H,t)&&(r.__=e,r.u=t,U.__H.__h.push(r))}function St(e){return ze=5,ci(function(){return{current:e}},[])}function ci(e,t){var r=$r(We++,7);return li(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function oe(e,t){return ze=8,ci(function(){return e},t)}function sa(){for(var e;e=ai.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(kt),e.__H.__h.forEach(Fr),e.__H.__h=[]}catch(t){e.__H.__h=[],L.__e(t,e.__v)}}function aa(e){var t,r=function(){clearTimeout(n),Ho&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Ho&&(t=requestAnimationFrame(r))}function kt(e){var t=U,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),U=t}function Fr(e){var t=U;e.__c=e.__(),U=t}function li(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function ui(e,t){return typeof t=="function"?t(e):t}function di(e,t){for(var r in t)e[r]=t[r];return e}function Ur(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function $o(e,t){this.props=e,this.context=t}function ca(e,t){function r(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:Ur(this.props,o)}function n(o){return this.shouldComponentUpdate=r,Ie(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function ua(e){function t(r){var n=di({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=la,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}function pi(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=di({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return pi(n,t,r)})),e}function mi(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return mi(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Ar(){this.__u=0,this.o=null,this.__b=null}function fi(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function yt(){this.i=null,this.l=null}function va(){}function ya(){return this.cancelBubble}function ba(){return this.defaultPrevented}function C(e,t,r,n,o,i){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?s=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wa,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return x.vnode&&x.vnode(u),u}function Ca(a){var l=a,{elementTag:e="Image",src:t="",children:r,handleExposure:n,className:o,imgStyle:i}=l,s=Q(l,["elementTag","src","children","handleExposure","className","imgStyle"]);let u=Aa(()=>{t&&n()});return e==="Image"?C("div",{className:o,style:{borderRadius:"8px"},children:Ie("img",P(_({},s),{ref:u,src:t!=null?t:"",style:_({display:"block",width:"100%",height:"auto",objectFit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"8px"},i||{})}))}):C("div",P(_({},s),{ref:u,className:o,children:r}))}function Pa(e,t){if(!e)return null;let r=Array.isArray(t)?t[0]:t,n=Array.isArray(t)?t[1]:0;return Array.isArray(e)?e.map((o,i)=>o&&typeof o=="object"&&"type"in o?Ie(o.type,P(_({},o.props),{style:P(_({},o.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0}),key:o.key||i})):o):e&&typeof e=="object"&&"type"in e?Ie(e.type,P(_({},e.props),{style:P(_({},e.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0})})):e}var Et,x,Qo,xe,Co,Yo,Xo,Zo,Lr,Pr,Nr,Ge,ei,ea,Qe,We,U,Rr,Do,ze,ai,L,Fo,Uo,Mo,Lo,Bo,jo,Ho,Jo,la,da,Vo,Ko,pa,ma,fa,ha,ga,_a,qo,ka,Go,Wo,zo,wa,Cr,Ta,Sa,Ea,xa,Ia,Ra,Aa,hi,gi,Na,Oa,Da,Fa,Mr,Ua,_i,vi=k(()=>{"use strict";Ge={},ei=[],ea=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qe=Array.isArray;Et=ei.slice,x={__e:function(e,t,r,n){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},Qo=0,fe.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=me({},this.state),typeof e=="function"&&(e=e(me({},r),this.props)),e&&me(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Po(this))},fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Po(this))},fe.prototype.render=Re,xe=[],Yo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xo=function(e,t){return e.__v.__b-t.__v.__b},wt.__r=0,Zo=/(PointerCapture)$|Capture$/i,Lr=0,Pr=Oo(!1),Nr=Oo(!0);ze=0,ai=[],L=x,Fo=L.__b,Uo=L.__r,Mo=L.diffed,Lo=L.__c,Bo=L.unmount,jo=L.__;L.__b=function(e){U=null,Fo&&Fo(e)},L.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),jo&&jo(e,t)},L.__r=function(e){Uo&&Uo(e),We=0;var t=(U=e.__c).__H;t&&(Rr===U?(t.__h=[],U.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(kt),t.__h.forEach(Fr),t.__h=[],We=0)),Rr=U},L.diffed=function(e){Mo&&Mo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ai.push(t)!==1&&Do===L.requestAnimationFrame||((Do=L.requestAnimationFrame)||aa)(sa)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Rr=U=null},L.__c=function(e,t){t.some(function(r){try{r.__h.forEach(kt),r.__h=r.__h.filter(function(n){return!n.__||Fr(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],L.__e(n,r.__v)}}),Lo&&Lo(e,t)},L.unmount=function(e){Bo&&Bo(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{kt(n)}catch(o){t=o}}),r.__H=void 0,t&&L.__e(t,r.__v))};Ho=typeof requestAnimationFrame=="function";($o.prototype=new fe).isPureReactComponent=!0,$o.prototype.shouldComponentUpdate=function(e,t){return Ur(this.props,e)||Ur(this.state,t)};Jo=x.__b;x.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Jo&&Jo(e)};la=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;da=x.__e;x.__e=function(e,t,r,n){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}da(e,t,r,n)};Vo=x.unmount;x.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Vo&&Vo(e)},(Ar.prototype=new fe).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var o=fi(n.__v),i=!1,s=function(){i||(i=!0,r.__R=null,o?o(a):a())};r.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=mi(l,l.__c.__P,l.__c.__O)}var u;for(n.setState({__a:n.__b=null});u=n.o.pop();)u.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(s,s)},Ar.prototype.componentWillUnmount=function(){this.o=[]},Ar.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=pi(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&Ie(Re,null,e.fallback);return o&&(o.__u&=-33),[Ie(Re,null,t.__a?null:e.children),o]};Ko=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(yt.prototype=new fe).__a=function(e){var t=this,r=fi(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),Ko(t,e,n)):o()};r?r(i):i()}},yt.prototype.render=function(e){this.i=null,this.l=new Map;var t=Tt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},yt.prototype.componentDidUpdate=yt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Ko(e,r,t)})};pa=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ma=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,fa=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ha=/[A-Z0-9]/g,ga=typeof document<"u",_a=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};fe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(fe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});qo=x.event;x.event=function(e){return qo&&(e=qo(e)),e.persist=va,e.isPropagationStopped=ya,e.isDefaultPrevented=ba,e.nativeEvent=e};ka={enumerable:!1,configurable:!0,get:function(){return this.class}},Go=x.vnode;x.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,o={},i=n.indexOf("-")===-1;for(var s in r){var a=r[s];if(!(s==="value"&&"defaultValue"in r&&a==null||ga&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||_a(r.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":fa.test(s)&&(s=l):l=s="oninput":i&&ma.test(s)?s=s.replace(ha,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&o[s=l]&&(s="oninputCapture"),o[s]=a}}n=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=Tt(r.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=Tt(r.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",ka)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o}(e),e.$$typeof=pa,Go&&Go(e)};Wo=x.__r;x.__r=function(e){Wo&&Wo(e),e.__c};zo=x.diffed;x.diffed=function(e){zo&&zo(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value)};wa=0;Cr={drawerBackdrop:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"flex-end",zIndex:1e3,overflow:"hidden",touchAction:"none"},drawer:{backgroundColor:"white",borderRadius:"16px 16px 0 0",width:"100%",maxWidth:"100%",overflowY:"auto",position:"relative",boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.1)",display:"flex",flexDirection:"column",margin:"0 auto"},drawerContent:{flex:1,width:"100%",height:"100%",overflow:"auto",margin:"0 auto"}},Ta=`
|
|
20
|
+
@keyframes fadeIn {
|
|
21
|
+
from { opacity: 0; }
|
|
22
|
+
to { opacity: 1; }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@keyframes fadeOut {
|
|
26
|
+
from { opacity: 1; }
|
|
27
|
+
to { opacity: 0; }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes slideUp {
|
|
31
|
+
from { transform: translateY(100%); }
|
|
32
|
+
to { transform: translateY(0); }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@keyframes slideDown {
|
|
36
|
+
from { transform: translateY(0); }
|
|
37
|
+
to { transform: translateY(100%); }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.backdrop-enter {
|
|
41
|
+
animation: fadeIn 0.3s ease forwards;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.backdrop-leave {
|
|
45
|
+
animation: fadeOut 0.3s ease forwards;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.drawer-enter {
|
|
49
|
+
animation: slideUp 0.3s ease forwards;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.drawer-leave {
|
|
53
|
+
animation: slideDown 0.3s ease forwards;
|
|
54
|
+
}
|
|
55
|
+
`,Sa=({children:e,isOpen:t=!1,onClose:r,height:n="50%",className:o="",backdropColor:i},s)=>{let[a,l]=Dr(t),[u,d]=Dr(null),c=St(null),p=St(!1);qe(()=>{let S=document.createElement("style");return S.innerHTML=Ta,document.head.appendChild(S),()=>{document.head.removeChild(S)}},[]),qe(()=>{t!==a&&!p.current&&(l(t),d(t?"enter":"leave"))},[t,a]);let m=oe(()=>{u==="leave"&&(d(null),l(!1),p.current=!1)},[u]),y=oe(S=>{S.preventDefault(),S.stopPropagation(),S.target===c.current&&h()},[]),v=oe(()=>{p.current=!1,l(!0),d("enter")},[]),h=oe(()=>{p.current=!0,d("leave"),r&&r()},[r]),g=oe(()=>a&&!p.current,[a]);if(qe(()=>{if(s){let S={show:v,hide:h,isOpen:g};typeof s=="function"?s(S):s&&(s.current=S)}},[v,h,g,s]),!a&&!u)return null;let b=P(_({},Cr.drawer),{height:typeof n=="number"?`${n}px`:n,backgroundColor:i||"rgba(255, 255, 255, 1)"}),E=_({},Cr.drawerBackdrop),N=u?`drawer-${u}`:"",R=u?`backdrop-${u}`:"";return C("div",{ref:c,style:E,className:R,onClick:y,onTouchMove:S=>S.preventDefault(),children:C("div",{style:b,className:`${N} ${o}`,onAnimationEnd:m,onTouchMove:S=>S.stopPropagation(),children:C("div",{style:Cr.drawerContent,children:e})})})},Ea=ua(Sa),xa=({title:e,content:t,noHeader:r,padding:n="16px",footerButtons:o,onClose:i})=>{let s={container:{display:"flex",flexDirection:"column",height:"100%",width:"100%",maxWidth:"440px",margin:"0 auto"},header:{padding:"16px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center"},content:{padding:n,flex:1,overflow:"auto"},footer:{padding:"16px",borderTop:"1px solid #eee",display:"flex",justifyContent:"flex-end",gap:"8px"},closeButton:{background:"none",border:"none",cursor:"pointer",fontSize:"20px"},button:{padding:"8px 16px",borderRadius:"4px",border:"1px solid #ddd",cursor:"pointer"}};return C("div",{style:s.container,children:[!r&&C("div",{style:s.header,children:[C("h3",{children:e}),C("button",{style:s.closeButton,onClick:i,children:"\xD7"})]}),C("div",{style:s.content,children:t}),o&&o.length>0&&C("div",{style:s.footer,children:o.map((a,l)=>C("button",{style:P(_({},s.button),{backgroundColor:a.variant==="primary"?"#1677ff":"#fff",color:a.variant==="primary"?"#fff":"#333"}),onClick:u=>{var d;return(d=a.onClick)==null?void 0:d.call(a,u,{hide:i})},children:a.text},l))})]})},Ia=(()=>{let e=null;return()=>(e||(e=document.createElement("div"),e.id=`jolibox-ui-modal-container-${Math.random().toString(36).substring(2,15)}`,document.body.appendChild(e)),e)})(),Ra=e=>{let t=Ia(),r=null,n=!1,o=!1,i=()=>{o||(n=!1,e.onClose&&e.onClose(),a())},s=()=>window.innerWidth>window.innerHeight,a=()=>{Or(C(Ea,{ref:u=>{r=u},isOpen:n,onClose:i,height:s()?"90vh":"50vh",backdropColor:e.backdropColor,children:C(xa,P(_({},e),{onClose:i}))}),t)},l=()=>{!o&&n&&a()};return window.addEventListener("resize",l),a(),{show:()=>{o||(n=!0,a(),setTimeout(()=>{r&&(r.show(),e.onOpen&&e.onOpen())},0))},hide:()=>{o||r&&r.hide()},isOpen:()=>n,destroy:()=>{o=!0,window.removeEventListener("resize",l),r&&r.hide(),setTimeout(()=>{Or(null,t)},300)}}},Aa=(e,t={threshold:.6})=>{let r=St(null),n=St(!1),o=oe(i=>{let[s]=i;s.isIntersecting&&!n.current?(n.current=!0,e()):s.isIntersecting||(n.current=!1)},[e]);return qe(()=>{if(r.current){let i=new IntersectionObserver(o,t);return i.observe(r.current),()=>{r.current&&i.unobserve(r.current)}}},[o,t]),r};hi=i=>{var s=i,{children:e,fluid:t=!1,className:r="",style:n={}}=s,o=Q(s,["children","fluid","className","style"]);let a=_({width:"100%",marginLeft:"auto",marginRight:"auto",paddingLeft:"15px",paddingRight:"15px",boxSizing:"border-box",maxWidth:t?"100%":void 0},n);return C("div",P(_({className:r,style:a},o),{children:e}))},gi=a=>{var l=a,{children:e,gutter:t=0,justify:r="start",align:n="top",className:o="",style:i={}}=l,s=Q(l,["children","gutter","justify","align","className","style"]);let u={start:"flex-start",end:"flex-end",center:"center","space-around":"space-around","space-between":"space-between"},d={top:"flex-start",middle:"center",bottom:"flex-end"},c=_({display:"flex",flexWrap:"wrap",boxSizing:"border-box",justifyContent:u[r],alignItems:d[n]},i);if(t){let m=Array.isArray(t)?t[0]:t,y=Array.isArray(t)?t[1]:0;m>0&&(c.marginLeft=`-${m/2}px`,c.marginRight=`-${m/2}px`),y>0&&(c.marginTop=`-${y/2}px`,c.marginBottom=`-${y/2}px`)}let p=t?Pa(e,t):e;return C("div",P(_({className:o,style:c},s),{children:p}))};Na=c=>{var p=c,{children:e,span:t,offset:r,xs:n,sm:o,md:i,lg:s,xl:a,className:l="",style:u={}}=p,d=Q(p,["children","span","offset","xs","sm","md","lg","xl","className","style"]);let m=_({position:"relative",width:"100%",paddingLeft:"15px",paddingRight:"15px",boxSizing:"border-box"},u);if(t!==void 0){let y=t/24*100;m.flex=`0 0 ${y}%`,m.maxWidth=`${y}%`}return r!==void 0&&(m.marginLeft=`${r/24*100}%`),C("div",P(_({className:l,style:m},d),{children:e}))},Oa=({game:e,layerName:t,routeMode:r,onGameClick:n})=>{var s,a;let o=oe(l=>{l.preventDefault(),n==null||n(e)},[n,e]),i=oe(()=>{},[e,t]);return C(Na,{span:8,className:"relative px-[4px] box-border mb-[8px]",style:{marginBottom:"8px"},onClick:o,role:"button",tabIndex:0,onTouchEnd:o,children:[C("div",{className:"relative w-full mb-[2px] ion-no-margin",children:C(Ca,{src:(a=(s=e.logo)!=null?s:e.cover)!=null?a:"",className:"w-full h-full absolute top-0 left-0 aspect-square rounded-[8px] object-cover",style:{display:"block",objectFit:"cover"},handleExposure:i})}),C("div",{className:"block text-white max-w-full text-[15px] leading-[1.2] overflow-hidden whitespace-nowrap text-ellipsis font-normal break-words",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",wordBreak:"break-word",color:"white",maxWidth:"100%",fontSize:"15px",lineHeight:1.2,fontWeight:"normal"},children:e.name})]},e.gameId)},Da=i=>{var s=i,{list:e,routeMode:t,layerName:r,onGameClick:n}=s,o=Q(s,["list","routeMode","layerName","onGameClick"]);return C(hi,{className:"w-full max-w-[440px] mx-auto flex-grow overflow-y-auto",children:C(gi,{gutter:8,className:"flex-wrap",children:e==null?void 0:e.map(a=>C(Oa,{game:a,routeMode:t,layerName:r,onGameClick:n},a.gameId))})})},Fa=ca(Da),Mr=(e=>(e.Dismiss="DISMISS",e.Quit="QUIT",e))(Mr||{}),Ua=e=>{let{games:t,title:r,buttons:n,onClose:o}=e,[i,s]=Dr(null),a=oe(d=>{o==null||o({type:d.type===Mr.Quit?"quit":"dismiss"})},[o]),l=oe(d=>{o==null||o({type:"navigate",data:{game:d}})},[o]);if(!t.length)return C(Re,{});let u=oe(d=>{if(d!==null&&!d.shadowRoot){let c=d.attachShadow({mode:"open"}),p=document.createElement("style");p.textContent=`
|
|
56
|
+
.recommend-panel {
|
|
57
|
+
background-color: #1a1a1a;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
}
|
|
61
|
+
.container {
|
|
62
|
+
height: 100%;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
position: relative;
|
|
66
|
+
}
|
|
67
|
+
.title {
|
|
68
|
+
color: #ffffff;
|
|
69
|
+
font-size: 18px;
|
|
70
|
+
line-height: 24px;
|
|
71
|
+
text-align: center;
|
|
72
|
+
padding: 20px 10px;
|
|
73
|
+
}
|
|
74
|
+
.games-container {
|
|
75
|
+
flex: 1;
|
|
76
|
+
overflow: auto;
|
|
77
|
+
margin-bottom: 88px;
|
|
78
|
+
}
|
|
79
|
+
.buttons-container {
|
|
80
|
+
position: fixed;
|
|
81
|
+
bottom: 32px;
|
|
82
|
+
left: 0;
|
|
83
|
+
right: 0;
|
|
84
|
+
width: 100%;
|
|
85
|
+
max-width: 440px;
|
|
86
|
+
margin: 0 auto;
|
|
87
|
+
background: inherit;
|
|
88
|
+
padding-top: 16px;
|
|
89
|
+
padding-bottom: 16px;
|
|
90
|
+
padding-left: 16px;
|
|
91
|
+
padding-right: 16px;
|
|
92
|
+
}
|
|
93
|
+
.button-wrapper {
|
|
94
|
+
flex: 0 0 50%;
|
|
95
|
+
box-sizing: border-box;
|
|
96
|
+
}
|
|
97
|
+
.button {
|
|
98
|
+
width: 100%;
|
|
99
|
+
height: 40px;
|
|
100
|
+
border-radius: 21px;
|
|
101
|
+
white-space: nowrap;
|
|
102
|
+
line-height: 40px;
|
|
103
|
+
padding-left: 8px;
|
|
104
|
+
padding-right: 8px;
|
|
105
|
+
border: 1px solid;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
flex: 1;
|
|
108
|
+
text-align: center;
|
|
109
|
+
font-size: 14px;
|
|
110
|
+
font-weight: normal;
|
|
111
|
+
outline: none;
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
text-overflow: ellipsis;
|
|
114
|
+
}
|
|
115
|
+
.quit-button {
|
|
116
|
+
border-color: #ffffff30;
|
|
117
|
+
background-color: #ffffff2c;
|
|
118
|
+
color: #fff;
|
|
119
|
+
}
|
|
120
|
+
.action-button {
|
|
121
|
+
border-color: #7817FF;
|
|
122
|
+
background-color: #7817FF;
|
|
123
|
+
color: #fff;
|
|
124
|
+
}
|
|
125
|
+
`;let m=document.createElement("div");m.id="recommend-panel-content",c.appendChild(p),c.appendChild(m),s(c)}},[]);return qe(()=>{if(i){let d=i.getElementById("recommend-panel-content");d&&Or(C("div",{className:"recommend-panel",children:C("div",{className:"container",children:[C("p",{className:"title",children:r}),C("div",{className:"games-container",children:C(Fa,{list:t||[],routeMode:"REDIRECT",layerName:"RecommendedGuide",onGameClick:l})}),C("div",{className:"buttons-container",children:C(hi,{children:C(gi,{gutter:10,children:(n!=null?n:[]).map((c,p)=>C("div",{className:"button-wrapper",children:C("button",{className:`button ${c.type===Mr.Quit?"quit-button":"action-button"}`,onClick:()=>a(c),children:c.text})},p))})})})]})}),d)}},[i,t,r,n,a,l]),C("div",{ref:u})},_i=e=>{let t=Ra({title:e.title,content:C(Ua,{games:e.games,title:e.title,buttons:e.buttons,onClose:e.onClose}),backdropColor:"#1a1a1a",placement:"bottom",noHeader:!0,padding:"0px",onClose:()=>{console.log("onClose")},onOpen:e.onOpen});return t.show(),t}});function yi(){return T(this,null,function*(){if(Jr)return Jr;let t=`${w.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com"}/api/user-retention/exit-recommendations?objectId=${w.mpId}&from=GAME_DETAIL`,{response:{data:r}}=yield G(t);return Jr=r,r})}function bi(){return T(this,null,function*(){let e=new se;if(w.mpType!=="game")return e.resolve(!1),e.promise;let t=yield yi();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:o}=t.data,i=_i({games:r.games,title:n,buttons:o,onClose:s=>{var a;switch(s.type){case"quit":e.resolve(!1);break;case"dismiss":e.resolve(!0),i.hide();break;case"navigate":(a=s.data)!=null&&a.game?Ma(s.data.game):e.resolve(!0),i.hide();break;default:e.resolve(!0);break}}});return e.promise})}var Jr,Ma,ki=k(()=>{"use strict";V();q();A();vi();Oe();Jr=null;yi();Ma=e=>{var s;let{data:t}=O("envSync"),r=new URL(t.schema),n=new URLSearchParams(r.search);n.set("gameId",e.gameId),n.set("joliSource",w.encodeJoliSourceQuery({__mpType:"game",__orientation:(s=e.orientation)!=null?s:"VERTICAL"}));let i=`${`https://${e.gameId}.content.jolibox.com/`}index.html?${n.toString()}`;O("openSchemaSync",{schema:i})}});var wi={};on(wi,{config:()=>Va});function La(){De.on("isAdShowing",e=>{It=e,He(It)&&O("updateContainerConfigSync",{displayCapsuleButton:!It,webviewId:w.webviewId})})}function Ba(){pe.on("onDocumentReady",()=>{var e;(e=ve)==null||e.onDocumentReady(window.location.href),Z("onDocumentReady",{start_timestamp:At,timestamp:Date.now()})})}function ja(e){w.mpType==="game"&&W.start(e)}function Ha(){ae("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&w.onEnvConfigChanged({hostUserInfo:e}),pe.emit("LifecycleEvent.onReady",_({},w.hostUserInfo?w.hostUserInfo:{isLogin:!1})),Z("joliboxServiceReady",{start_timestamp:At,timestamp:Date.now()}),ja(t)}),ae("onBeforeExit",({uuid:e})=>{var t;(t=ve)==null||t.doExit(e)})}function $a(){let e=()=>{Z("onBeforeExit",{timestamp:Date.now()}),xt==null||xt(),W.close(Date.now()-At)};ne.doExit(()=>T(this,null,function*(){return It?!0:He(w.shouldInterupt)?(w.shouldInterupt||e(),w.shouldInterupt):Rt!=null&&Rt.canShowRecommended&&(yield bi())?!0:(e(),!1)}))}function Ja(){return T(this,null,function*(){let e=`${w.baseApiHost}/api/fe-configs/js-sdk/basic-meta`,{response:{data:t}}=yield G(e);t&&(Rt=t)})}function Va(){At=Date.now(),Ha(),La(),$a(),Ba(),Ja(),xt=Eo()}var xt,At,It,Rt,Ti=k(()=>{"use strict";q();lt();V();A();ye();xo();Ir();ki();Oe();It=!1,Rt=null;ne.onReady(()=>{})});function Si(e){let t=ar.config[e];return t||(t={},ar.config[e]=t),(r,n)=>{if(t[r]){Y.warn(`[can i use] ${r} already registered`);return}t[r]=_({},n)}}var Ei=k(()=>{"use strict";A()});function Vr(e){xi=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 he(e){return typeof e=="number"}function Kr(e){let t=qr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function qr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var xi,B,Pt,Nt,Ot,Dt,Ue,Ft,Ut,Mt,Lt,Bt,jt,Ht,$t,Jt,Vt,Kt,qt,Gr=k(()=>{"use strict";xi=!1;B=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(xi)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${Kr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return 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}};Pt=class extends B{validate(t){return this._optional&&t===void 0?!0:he(t)?he(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):he(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):he(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}},Nt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ot=class extends B{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(he(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(he(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 B{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Ue=class extends B{validate(t){return!0}},Ft=class extends B{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Ut=class extends B{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Mt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Lt=class extends B{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Kr(t)}`)}return!0}},Bt=class extends B{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(he(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(he(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(he(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 o=!0;if(r.forEach((i,s)=>{if(n.path=`${this.path}[${s}]`,n.errors=this.errors,i===void 0&&n.hasDefault){r[s]=n.defaultValue;return}n.validate(i)||(n.hasFallback?r[s]=n.fallbackValue:o=!1)}),this._uniqueItems){let i=new Map;for(let s in r)i.has(r[s])?o=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${i.get(r[s])}] and ${this.path}[${s}] are identical)`):i.set(r[s],s)}return o}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}},jt=class extends B{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(qr(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,i=this._value;i.errors=this.errors;let s=!0;for(let a in o){let l=o[a];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?i.path=`${this.path}.${a}`:i.path=`${this.path}["${a}"]`,!(l===void 0&&i._optional)){if(l===void 0&&i.hasDefault){o[a]=i.defaultValue;continue}i.validate(l)||(i.hasFallback?o[a]=i.fallbackValue:s=!1)}}return s}},Ht=class extends B{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(qr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,o=!0;for(let i in this._object){let s=n[i],a=this._object[i];if(a.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(i)?a.path=`${this.path}.${i}`:a.path=`${this.path}["${i}"]`,!(a._optional&&s===void 0)){if(s===void 0&&a.hasDefault){n[i]=a.defaultValue;continue}a.validate(s)||(a.hasFallback?n[i]=a.fallbackValue:o=!1)}}return o}},$t=class extends B{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Kr(this.value),actual:r}):!0}},Jt=class extends B{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,o=this._items.length;for(let i=0;i<o;i++){let s=this._items[i];if(s.errors=[],s.path=this.path,!s.validate(t))r.push(s.errors.join("; "));else if(!n){n=!0;break}}if(!n){let i=r.join(`
|
|
126
|
+
or `);this.errors.push(i)}return n}},Vt=class extends B{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let o=t[n];if(o._optional||o.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,o)=>{if(n.path=`${this.path}[${o}]`,n.errors=this.errors,t[o]===void 0&&n.hasDefault){t[o]=n.defaultValue;return}n.validate(t[o])||(n.hasFallback?t[o]=n._fallback:r=!1)}),r}},Kt=class extends B{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},qt=class extends B{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 Wr(e,t,r="param"){if(e.errors=[],e.path=r,Vr(!0),!e.validate(t)){let n=e.errors.join(`
|
|
127
|
+
`);throw e.errors.length=0,Vr(!1),new TypeError(n)}}var f,zr=k(()=>{"use strict";Gr();Gr();f={object(e){return new Ht(e)},array(e){return new Bt(e)},tuple(...e){return new Vt(...e)},literal(e){return new $t(e)},or(...e){return new Jt(...e)},symbol(){return new Dt},record(e){return new jt(e)},function(){return new Mt},boolean(){return new Nt},string(){return new Ot},number(){return new Pt},undefined(){return new Ft},null(){return new Ut},unknown(){return new Ue},any(){return new Ue},as(){return new Ue},arraybuffer(){return new Kt},enum(...e){return new Lt(...e)},typedarray(e){return new qt(e)}}});var Gt,Ii,Ri=k(()=>{"use strict";A();re();zr();_e();Gt=1,Ii=e=>{function t(n,o){return(...i)=>{var c,p,m,y;let s=Date.now(),a={method:n,trace_id:Gt};Gt+=1;let l="SUCCESS",u=`${n}:ok`,d=0;try{if(o.paramsSchema)try{Wr(o.paramsSchema,i,"params")}catch(b){throw dr(`${n}:fail ${b.message}`)}let v=o.implement(...i),h=v,g=`${n}:ok`;if(v&&"code"in v){let{code:b,data:E,message:N}=v;l=b,h=E,g=N}return{code:l,message:g,data:h}}catch(v){let h=v;d=(p=(c=h.code)!=null?c:h.errNo)!=null?p:2e3,l="FAILURE";let g=(y=(m=h.message)!=null?m:h.errMsg)!=null?y:`${v}`;return u=`${n}:${l} ${g.replace(/^\S+:(fail|cancel)\s?/,"")}`,$(new Ve(u,d)),{code:l,message:u}}finally{let v=Date.now()-s;e("apiInvoked",P(_({},a),{duration:v,status:l}))}}}function r(n,o){return(...i)=>T(this,null,function*(){var p,m,y,v;let s=dn(i)?i:[i],a=Date.now(),l={method:n,trace_id:Gt};Gt+=1;let u=`${n}:ok`,d="SUCCESS",c={code:d,message:u};try{if(o.paramsSchema)try{Wr(o.paramsSchema,s,"params")}catch(b){throw dr(b.message)}let g=yield o.implement(...s);if(g&&"code"in g){let{code:b,data:E,message:N}=g;d=b,u=N,g=E}return Object.assign(c,{code:d,message:u,data:g}),c}catch(h){let g=h,b=(m=(p=g.code)!=null?p:g.errNo)!=null?m:2e3;d="FAILURE";let E=(v=(y=g.message)!=null?y:g.errMsg)!=null?v:`${h}`,N=`${n}:${d} ${E.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(c,{code:d,message:N}),$(new Ve(N,b)),c}finally{let h=Date.now()-a;e("apiInvoked",P(_({},l),{duration:h,status:d}))}})}return{createAPI:r,createSyncAPI:t}}});var j,D,I,ce=k(()=>{"use strict";Ei();ye();Ri();zr();({createAPI:j,createSyncAPI:D}=Ii(Z)),I=Si("native")});var Ai,qa,Ga,Wa,za,Ci=k(()=>{"use strict";A();ce();q();Ai=M(),qa="env",Ga="getSystemInfoSync",Wa=D(Ga,{implement:()=>{var r;let e=O("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform,version:t.sdkInfo.jssdkVersion,pixelRatio:t.deviceInfo.pixelRatio,language:t.deviceInfo.lang,brand:t.deviceInfo.brand,appName:(r=t.hostInfo)==null?void 0:r.appName,SDKVersion:t.sdkInfo.jssdkVersion}}}),za=D(qa,{implement:()=>{var t;let e=O("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Ai.registerCommand("API.getSystemInfoSync",Wa);Ai.registerCommand("API.env",za);I("env",{version:"1.0.0"});I("getSystemInfoSync",{version:"1.0.0"})});var Pi=nn(Qr=>{"use strict";A();ce();re();q();ye();V();var Qa="exitGame",Ya="onReady",Xa="onJoliboxShow",Za="onJoliboxHide",Wt=M(),zt=ot($),ec=j(Qa,{paramsSchema:f.tuple(f.function(),f.boolean().optional().default(!1)),implement:(e,t=!1)=>T(Qr,null,function*(){zt(e).call(Qr),He(w.shouldInterupt)&&!w.shouldInterupt&&w.from&&zn("onRetentionResult",{shouldStay:t},w.from,!0),yield X("exitAppAsync")})}),tc=D(Xa,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);ae("onJoliboxEnterForeground",()=>{t.call(this),Ke.emit("visible",!0)})}}),rc=D(Za,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);ae("onJoliboxEnterBackground",()=>{t.call(this),Ke.emit("visible",!1)})}}),nc=D(Ya,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);pe.on("LifecycleEvent.onReady",r=>{t(r)})}});Wt.registerCommand("LifecycleSDK.exit",ec);Wt.registerCommand("LifecycleSDK.onReady",nc);Wt.registerCommand("LifecycleSDK.onJoliboxShow",tc);Wt.registerCommand("LifecycleSDK.onJoliboxHide",rc);I("lifeCycle.exit",{version:"1.0.0"});I("lifeCycle.onReady",{version:"1.0.0"});I("lifeCycle.onJoliboxShow",{version:"1.0.0"});I("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Ni(e){let t={};if(!K(e))return t;for(let[r,n]of Object.entries(e)){let o=r.toLocaleLowerCase();n?typeof n=="object"?t[o]=Object.prototype.toString.call(n):t[o]=String(n):t[o]=""}return t}function Oi(e="GET"){if(e==="")return"POST";let t=e.toUpperCase();return["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"].includes(t)?t:"GET"}function Di(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Fi(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!K(r))return e;let[n,o=""]=e.split("?"),i=new URLSearchParams(o);for(let[a,l]of Object.entries(r))l!=null&&i.append(a,String(l));let s=i.toString();return s?`${n}?${s}`:n}var Ui=k(()=>{"use strict";A()});var oc,ic,Yr,Xr,Mi,sc,ac,cc,Li=k(()=>{"use strict";_e();Er();ce();Ui();A();re();V();oc=15,ic=pt("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:w.baseApiHost}),Yr=0,Xr=[],Mi=ot($),sc=(e,t)=>{let r=e.filter(t),n=e.filter(o=>!t(o));return e.length=0,e.push(...n),r},ac=e=>{let t=new se,r=()=>{};return D("request",{paramsSchema:f.tuple(f.object({url:f.string(),method:f.string(),headers:f.object(),data:f.object().optional(),query:f.object().optional(),dataType:f.string().default("json"),responseType:f.string().default("text"),enableCache:f.boolean().default(!1),appendHostCookie:f.boolean().default(!0),timeout:f.number().default(3e4),success:f.function(),fail:f.function()})),implement(o){let i=()=>T(this,null,function*(){var a,l;let s=Mi(o.fail);try{if(Yr+=1,t.state!=="pending")return;let{data:u,dataType:d,responseType:c,enableCache:p,appendHostCookie:m}=o,y=Ni(o.headers),v=Oi(o.method),h=Di(o.timeout),g=Fi(o.url,v,u),b=Mi(o.success),E=Object.assign({},o,{method:v,header:y,data:v==="GET"||v==="HEAD"?void 0:u,enableCache:p,query:(a=o.query)!=null?a:{},dataType:d,responseType:c,appendHostCookie:m});h&&(E.timeout=h);let N=ic(g,E);{let{response:R}=yield N,{code:S,data:H,message:z}=R;if(H&&typeof H=="object"&&"status"in H&&H.status!==200)throw ge({code:H.status||-1,msg:`request:fail status ${H.status}`});t.resolve({code:S!=null?S:"SUCCESS",data:H,message:z!=null?z:"request:ok"}),b({code:"SUCCESS",message:"request:ok",data:H})}}catch(u){t.reject(u),s({code:"FAILURE",message:"httpRequst: failed"})}finally{Yr-=1,(l=Xr.shift())==null||l()}});return Yr>=oc?(r=()=>{sc(Xr,s=>s===i)},Xr.push(i)):i(),t.promise}})(e),{abort(){t.reject(ge({code:-1,msg:"request:fail abort"})),r()}}},cc=M();cc.registerCommand("HttpSDK.request",ac);I("request",{version:"1.0.0"})});function fc(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return mc.includes(t)?t:""}function hc(e,t){try{switch(t){case"string":return e;case"object":return JSON.parse(e);case"number":return parseFloat(e);case"boolean":return e==="true";default:return""}}catch(r){return""}}function gc(e,t){try{switch(t){case"string":case"number":case"boolean":return`${e}`;case"object":return JSON.stringify(e);default:return""}}catch(r){return""}}var Qt,lc,uc,dc,pc,hm,gm,mc,Bi=k(()=>{"use strict";ce();q();A();Oe();V();Qt=M(),lc=j("getLocalStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let{response:t}=yield G(`/api/games/user-storage/${w.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:o}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:o==null?void 0:o.value};try{let{data:{data:i,dataType:s}}=yield X("getLocalStorageAsync",{key:e}),a=hc(i,s);return{code:r,message:`${n}. fallback to native`,data:a}}catch(i){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});Qt.registerCommand("StorageSDK.getItem",lc);I("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});uc=j("setStorage",{paramsSchema:f.tuple(f.string(),f.or(f.string(),f.boolean(),f.number())),implement(e,t){return T(this,null,function*(){let r=w.mpId,n=typeof t=="string"?t:String(t),{response:o}=yield G(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:i,message:s}}=o,a=fc(t),l=gc(t,a);return yield X("setLocalStorageAsync",{key:e,data:l,dataType:a}),i=="SUCCESS"?{code:i,message:s}:{code:i,message:`${s}. fallback to native`}})}});Qt.registerCommand("StorageSDK.setItem",uc);I("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});dc=j("removeStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let t=w.mpId,{response:r}=yield G(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:o}}=r;return yield X("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:o}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Qt.registerCommand("StorageSDK.removeItem",dc);I("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});pc=j("clearStorage",{implement(){return T(this,null,function*(){let e=w.mpId,{response:t}=yield G(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});X("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});Qt.registerCommand("StorageSDK.clear",pc);I("storage.clear",{version:"1.0.0"});hm=j("getStorageInfo",{implement(){return T(this,null,function*(){let{data:e}=yield X("getStorageInfoAsync");return e})}});I("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});gm=D("getStorageInfoSync",{implement(){return O("getStorageInfoSync")}}),mc=["string","number","boolean","object",""]});var _c,vc,yc,Zr,ji=k(()=>{"use strict";A();q();ce();_c=D("showKeyboard",{paramsSchema:f.tuple(f.object({defaultValue:f.string().optional().default(""),multiple:f.boolean().optional().default(!1),maxLength:f.unknown().optional().default(1e5)})),implement(e){var n;let t=Math.floor((n=Number(e.maxLength))!=null?n:1e5),{defaultValue:r}=e;r&&t&&(r=r.slice(0,t)),O("showKeyboardSync",P(_({},e),{defaultValue:r,maxLength:t}))}});I("keyboard.showKeyboard",{version:"1.0.0",properties:{params:{defaultValue:"1.0.0",multiple:"1.0.0",confirmHold:"1.0.0",confirmType:"1.0.0",maxLength:"1.0.0"}},success:{errMsg:"1.0.0"}});vc=D("updateKeyboard",{paramsSchema:f.tuple(f.object({value:f.string()})),implement(e){O("updateKeyboardSync",e)}});I("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});yc=D("hideKeyboard",{implement(){O("hideKeyboardSync")}});I("keyboard.hideKeyboard",{version:"1.0.0"});Zr=M();Zr.registerCommand("KeyboardSDK.showKeyboard",_c);Zr.registerCommand("KeyboardSDK.updateKeyboard",vc);Zr.registerCommand("KeyboardSDK.hideKeyboard",yc)});var Hi=nn(Ae=>{"use strict";A();ce();ye();var Me=M(),bc=j("levelFinished",{paramsSchema:f.tuple(f.string(),f.object({result:f.boolean(),duration:f.number()})),implement:(e,t)=>T(Ae,null,function*(){let{result:r,duration:n}=t,o=[];o.push(W.tracker("LevelFinished",{levelId:e,result:r,duration:n})),o.push(W.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),kc=j("taskFinished",{paramsSchema:f.tuple(f.string(),f.object({duration:f.number()})),implement:(e,t)=>T(Ae,null,function*(){let{duration:r}=t;return yield W.reportToNative({event:"TaskFinished",params:{duration:r,taskId:e}})})}),wc=j("levelUpgrade",{paramsSchema:f.tuple(f.string(),f.string()),implement:(e,t)=>T(Ae,null,function*(){let r=[];r.push(W.reportToNative({event:"LevelUpgrade",params:{name:t,levelId:e}})),yield Promise.all(r)})}),Tc=j("onHistoryUserLevel",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield W.reportToNative({event:"HistoryUserLevel",params:{level:e}})})}),Sc=j("onHistoryUserScore",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield W.reportToNative({event:"HistoryUserScore",params:{score:e}})})}),Ec=j("taskEvent",{paramsSchema:f.tuple(f.string(),f.object({tools:f.array(f.object({id:f.string(),name:f.string(),count:f.number(),description:f.string().optional(),price:f.object({amount:f.number(),unit:f.string()}).optional()})).optional(),awards:f.array(f.object({id:f.string(),name:f.string()})).optional()})),implement:(e,t)=>T(Ae,null,function*(){var n,o;let r=[];r.push(W.reportToNative({event:"TaskEvent",params:_({taskId:e},t)})),(o=(n=t.tools)==null?void 0:n.length)!=null&&o&&(r.push(W.reporter({event:"USE_GAME_ITEM"})),r.push(W.reportToNative({event:"UseGameItem",params:_({taskId:e},t)}))),yield Promise.all(r)})});Me.registerCommand("TaskTrackerSDK.levelFinished",bc);Me.registerCommand("TaskTrackerSDK.taskFinished",kc);Me.registerCommand("TaskTrackerSDK.levelUpgrade",wc);Me.registerCommand("TaskTrackerSDK.historyUserLevel",Tc);Me.registerCommand("TaskTrackerSDK.historyUserScore",Sc);Me.registerCommand("TaskTrackerSDK.taskEvent",Ec);I("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});I("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});I("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});I("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});I("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});I("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"}}}})});var xc,Ic,$i,Ji=k(()=>{"use strict";V();q();ce();A();_e();I("login",{version:"1.0.0",properties:{force:"1.0.0"},success:{errMsg:"1.0.0",code:"1.0.0",token:"1.0.0",isLogin:"1.0.0"}});I("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});xc=j("login",{implement(){return T(this,null,function*(){var s;let{data:{isLogin:e}}=yield X("checkLoginAsync");if(e)return{isLogin:!0,token:(s=w.hostUserInfo)==null?void 0:s.token};ae("onLoginStateChange",({isLogin:a,token:l,uuid:u})=>{u==r&&o({isLogin:a,token:l})});let t=O("loginSync"),{data:{uuid:r}}=t;if(!r)throw ge({code:-1,msg:"login failed"});let{promise:n,resolve:o}=new se,i=yield n;return w.onEnvConfigChanged({hostUserInfo:i}),pe.emit("onLoginComplete",i),i})}}),Ic=j("checkSession",{implement(){return T(this,null,function*(){let{data:{isLogin:e}}=yield X("checkLoginAsync");return{isLogin:e}})}}),$i=M();$i.registerCommand("API.login",xc);$i.registerCommand("API.checkSession",Ic)});var Yt,Rc,Xt,Ac,Cc,Pc,Nc,Vi=k(()=>{"use strict";A();ce();Ir();ye();Oe();q();Yt=M(),Rc=()=>{let{data:e}=O("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},Xt=new _t(Z,{get:(e,t)=>G(e,_({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t,r)=>G(e,_({method:"POST",responseType:"json",appendHostCookie:!0},r)).then(n=>n.response.data)},Rc),Ac=D("adInit",{implement:e=>{Xt.init(e)}}),Cc=D("adConfig",{implement:e=>{Xt.adConfig(e)}}),Pc=D("adBreak",{implement:e=>{Xt.adBreak(e)}}),Nc=D("adUnit",{implement:e=>{Xt.adUnit(e)}});Yt.registerCommand("AdsSDK.init",Ac);Yt.registerCommand("AdsSDK.adConfig",Cc);Yt.registerCommand("AdsSDK.adBreak",Pc);Yt.registerCommand("AdsSDK.adUnit",Nc);I("AdsSDK.init",{version:"1.0.0"});I("AdsSDK.adConfig",{version:"1.0.0"});I("AdsSDK.adBreak",{version:"1.0.0"});I("AdsSDK.adUnit",{version:"1.0.0"})});var en,Oc,Dc,Fc,Ki=k(()=>{"use strict";A();q();ce();V();en=M(),Oc=D("openSchemaSync",{paramsSchema:f.tuple(f.string()),implement:e=>{let t=e;e.match(/^https?:\/\//)||(t=`https://${w.mpId}.app.jolibox.com${e.startsWith("/")?"":"/"}${e}`);let r=O("openSchemaSync",{schema:t});if(r.errNo!==0)throw new Je(r.errMsg,r.errNo)}}),Dc=D("openPageSync",{paramsSchema:f.tuple(f.string()),implement:e=>{let{errNo:t,errMsg:r,data:n}=O("openPageSync",{url:e});if(t!==0||!n)throw new Je(r,t);return{webviewId:n.webviewId}}}),Fc=D("closePageSync",{paramsSchema:f.tuple(f.number()),implement:e=>{let{errNo:t,errMsg:r}=O("closePageSync",{webviewId:e});if(t!==0)throw new Je(r,t)}});en.registerCommand("RouterSDK.openSchema",Oc);en.registerCommand("RouterSDK.openPage",Dc);en.registerCommand("RouterSDK.closePage",Fc);I("router.openSchema",{version:"1.1.10"});I("router.openPage",{version:"1.1.10"});I("router.closePage",{version:"1.1.10"})});var Uc={};var Zm,nf,qi=k(()=>{"use strict";Ci();Zm=sn(Pi());Li();Bi();ji();nf=sn(Hi());Ji();Vi();Ki()});var Gi=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[Gi])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[Gi]=!0;T(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(Ti(),wi)),Promise.resolve().then(()=>(qi(),Uc)),Promise.resolve().then(()=>(ye(),So))]);e()});
|
|
@@ -15,6 +15,7 @@ type PublicFetch = <T>(url: string, options?: FetchOptions) => Promise<{
|
|
|
15
15
|
}>;
|
|
16
16
|
export declare function createFetch(createMethod: 'createRequestTaskSync', operateMethod: 'operateRequestTaskSync', options?: {
|
|
17
17
|
baseUrl?: string;
|
|
18
|
+
defaultHeaders?: Record<string, string>;
|
|
18
19
|
type: 'public';
|
|
19
20
|
}): PublicFetch;
|
|
20
21
|
export declare function createFetch(createMethod: 'createRequestTaskSync', operateMethod: 'operateRequestTaskSync', options?: {
|
package/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.1.11-beta.
|
|
3
|
+
> @jolibox/implement@1.1.11-beta.11 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.11-beta.
|
|
7
|
+
> @jolibox/implement@1.1.11-beta.11 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|