@jolibox/implement 1.1.11-beta.4 → 1.1.11-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +8 -8
- package/.rush/temp/shrinkwrap-deps.json +1 -1
- package/dist/common/context/url-parse.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.native.js +40 -4
- package/implement.build.log +2 -2
- package/package.json +4 -3
- package/src/common/ads/index.ts +7 -3
- package/src/common/context/index.ts +4 -5
- package/src/common/context/url-parse.ts +9 -6
- package/src/native/bootstrap/index.ts +1 -1
- package/src/native/js-core/jolibox-js-core.ts +1 -1
- package/src/native/ui/retention.ts +130 -0
- package/src/native/bootstrap/retention.ts +0 -44
- /package/dist/native/{bootstrap → ui}/retention.d.ts +0 -0
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _o=Object.create;var Ne=Object.defineProperty,Io=Object.defineProperties,wo=Object.getOwnPropertyDescriptor,Ro=Object.getOwnPropertyDescriptors,Ao=Object.getOwnPropertyNames,Ce=Object.getOwnPropertySymbols,xo=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable;var pr=(e,t,r)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))It.call(t,r)&&pr(e,r,t[r]);if(Ce)for(var r of Ce(t))fr.call(t,r)&&pr(e,r,t[r]);return e},P=(e,t)=>Io(e,Ro(t));var ce=(e,t)=>{var r={};for(var n in e)It.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ce)for(var n of Ce(e))t.indexOf(n)<0&&fr.call(e,n)&&(r[n]=e[n]);return r};var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var hr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gr=(e,t)=>{for(var r in t)Ne(e,r,{get:t[r],enumerable:!0})},Po=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ao(t))!It.call(e,o)&&o!==r&&Ne(e,o,{get:()=>t[o],enumerable:!(n=wo(t,o))||n.enumerable});return e};var yr=(e,t,r)=>(r=e!=null?_o(xo(e)):{},Po(t||!e||!e.__esModule?Ne(r,"default",{value:e,enumerable:!0}):r,e));var v=(e,t,r)=>new Promise((n,o)=>{var s=c=>{try{a(r.next(c))}catch(u){o(u)}},i=c=>{try{a(r.throw(c))}catch(u){o(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,i);a((r=r.apply(e,t)).next())});function Co(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(!Co(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=No(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function vr(e={},t=!1){let r=e,n=[];for(let[o,s]of Object.entries(r))if(s!==void 0&&s instanceof ArrayBuffer&&s.byteLength!==void 0){let i=t?{value:s,key:o}:{base64:Oo(s),key:o};n.push(i),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}var No,Oo,wt=f(()=>{"use strict";No=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};Oo=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 Uo(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 Er(e){return typeof e=="object"&&Array.isArray(e)}function Ie(e){return e===!0||e===!1}function Mo(e){return typeof e>"u"}function Lo(e){return Mo(e)||e===null}function Sr(e){return typeof e=="function"}function _r(e){return B(e)&&Sr(e.then)}function Ir(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function wr(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,s){for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i)){let a=o[i],c=s[i],u=r(a,c,i,o,s);u!==void 0?o[i]=u:br(c)&&br(a)?o[i]=n(h({},a),c):Array.isArray(c)&&Array.isArray(a)?o[i]=[...a,...c]:o[i]=c}return o}return n(e,t)}function br(e){return e&&typeof e=="object"&&e.constructor===Object}function Rr(e,t){if(Array.isArray(e))return e.concat(t)}function we(e,t,r={}){let n=null,o,s,i,{leading:a=!1,trailing:c=!0}=r,u=()=>(i=e.apply(s,o),o=void 0,s=void 0,i),l=function(...m){o=m,s=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&u()},t),p)return u()};return l.cancel=()=>{n&&clearTimeout(n),n=null,o=s=void 0},l.flush=()=>{if(n)return clearTimeout(n),n=null,u()},l}function jo(e,t){return(...r)=>t(e,...r)}function Me(e){return t=>jo(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new Re(`${o}`))}})}function Se(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function es(e){return new Promise(t=>Lr(e)(t))}function Lr(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function ts(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(s.fire,s)}},s=new _e(o);return s.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function ns(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)os(e[n],t[n])}function os(e,t){if(le(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Sr(t)){try{if(e instanceof t)return}catch(r){}if(!Lo(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 O(){if(globalThis[At])return globalThis[At];let e=new Fe,t=new Pt,r={registerCommand(n,o,s){e.registerCommand({id:n,handler:o,metadata:s})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[At]=r,r}var kr,Do,Fo,Tr,Q,Bo,Ct,ue,Ar,xr,Re,Pr,Cr,Nr,Or,Dr,Ae,Ue,Nt,$,Fr,Jo,Ot,Ho,Dt,$o,Vo,Oe,Ko,qo,Go,Ur,Ft,zo,Wo,Qo,Mr,te,C,Yo,Xo,De,_e,q,xt,Zo,Rt,rs,re,Fe,Pt,At,S=f(()=>{"use strict";kr=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Fo=(e,t)=>{for(var r in t)kr(e,r,{get:t[r],enumerable:!0})},Tr=(e,t,r,n)=>{for(var o=n>1?void 0:n?Do(t,r):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&kr(t,r,o),o};Q=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))}})}};Bo=(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))(Bo||{}),Ct=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}},ue=class extends Ct{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ar=class extends Ct{constructor(){super(...arguments),this.kind="USER_ERROR"}},xr=class extends Ar{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Re=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))}},Pr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Cr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Nr=class extends ue{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Or=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Dr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Ae=class extends Ct{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}}},Ue=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},Nt=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};$={log:Se("log"),warn:Se("warn"),info:Se("info"),error:Se("error"),debug:Se("debug")};Object.assign(globalThis,{logger:$});Fr=Symbol.for("Jolibox.canIUseMap"),Jo={};globalThis[Fr]=Jo;Ot={get config(){return globalThis[Fr]}},Ho=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Ho||{}),Dt=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Dt||{}),$o=(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))($o||{}),Vo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Oe={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")},Ko=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",qo="device_id",Go="advertising_id",Ur=e=>(localStorage.getItem(e)||localStorage.setItem(e,Vo()),localStorage.getItem(e)),Ft=()=>Ur(qo),zo=()=>Ur(Go),Wo=e=>e.charAt(0).toUpperCase()+e.slice(1),Qo=()=>{var t;let e=new URLSearchParams(window.location.search);return Wo((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Mr=e=>{let t="JoliboxWebSDK",r=Ko(),n=navigator.language,o=Ft(),s=zo();return`${t} (${Qo()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${s} version/${e||""}`},C=(te=class{constructor(t){this.element=t,this.next=te.Undefined,this.prev=te.Undefined}},te.Undefined=new te(void 0),te),Yo=class{constructor(){this._first=C.Undefined,this._last=C.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===C.Undefined}clear(){let e=this._first;for(;e!==C.Undefined;){let t=e.next;e.prev=C.Undefined,e.next=C.Undefined,e=t}this._first=C.Undefined,this._last=C.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new C(e);if(this._first===C.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!==C.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==C.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==C.Undefined&&e.next!==C.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===C.Undefined&&e.next===C.Undefined?(this._first=C.Undefined,this._last=C.Undefined):e.next===C.Undefined?(this._last=this._last.prev,this._last.next=C.Undefined):e.prev===C.Undefined&&(this._first=this._first.next,this._first.prev=C.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==C.Undefined;)yield e.element,e=e.next}},Xo=0,De=class{constructor(e){this.value=e,this.id=Xo++}},_e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof De&&(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,s,i,a,c,u;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new De(t);this._listeners?this._listeners instanceof De?this._listeners=[this._listeners,n]:this._listeners.push(n):((s=(o=this.options)==null?void 0:o.onWillAddFirstListener)==null||s.call(o,this),this._listeners=n,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(u=(c=this.options)==null?void 0:c.onDidAddListener)==null||u.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(o){r(o)}}fire(e){this._listeners&&(this._listeners instanceof De?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 s;let r=(s=this.listeners.get(e))!=null?s:new _e,n=i=>t(...i.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(h({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 Yo,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},xt={};Fo(xt,{None:()=>Zo,filter:()=>ts,once:()=>Lr,toPromise:()=>es});Zo=()=>{console.log("[Jolibox SDK] None Event")};Rt=Symbol.for("Jolibox.hostEmitter"),rs=()=>{let e=new q;return globalThis[Rt]||(globalThis[Rt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Rt]},re=rs();Fe=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new _e,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return ns(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}};Fe=Tr([Ir],Fe);Pt=class{constructor(){this._onWillExecuteCommand=new _e,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new _e,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Fe,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uo(3e4)),this._starActivation}executeCommand(e,...t){return v(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),xt.toPromise(xt.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}}};Pt=Tr([Ir],Pt);At=Symbol.for("Jolibox.commands")});function M(e,t={}){Ut.emit("ERROR_REPORT",{error:e,options:t})}var Ut,de,G=f(()=>{"use strict";S();S();Ut=new q,de=new q;M.debounce=we(M,50,{leading:!0})});function Le(e,t){return`[${e}]:${t}`}var me,Mt,se=f(()=>{"use strict";G();S();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 xr(e)});var pe,Br,jr,Jr,Be,je=f(()=>{"use strict";pe="custom_event_",Br=[],jr=[],Jr=["env","createRequestTask","login"],Be="__batch_event__"});function $r(e,t){Hr||(Lt=new fe({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),Bt=new fe({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),jt=new fe({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{Lt.flush(),Bt.flush(),jt.flush()}),Hr=!0);function r(o){var b,g;let{method:s,args:i,startTime:a,isForeground:c,errMsg:u=`${s}:fail no errMsg`,errNo:l=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:p,invokeCallback:k}=m,I=(g=(b=u.match(/\S:(\S+)\s?/))==null?void 0:b[1])!=null?g:"fail";Lt.report({status:I,method:n(s,i),errNo:`${l}`,errMsg:u,isForeground:c,duration:Date.now()-a}),a&&p&&k&&(Bt.report({status:I,method:s,isForeground:c,duration:Number((p-a).toFixed(3))}),jt.report({status:I,method:s,isForeground:c,duration:Number((Date.now()-k).toFixed(3))}))}function n(o,s){return(o==="callHostMethod"||o==="callHostMethodSync")&&s!=null&&s.method?`${o}-${s.method}`:o}return r}var ss,fe,Hr,Lt,Bt,jt,Jt=f(()=>{"use strict";S();ss=e=>e==="pv"?e:"default",fe=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:o,tagNameOrder:s,metricName:i,type:a}=t;this.reporter=r,this.interval=n,this.eventName=o,this.tagNameOrder=s,this.metricName=i,this.type=ss(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,s,i)=>{let a=o.shift();if(a){let c=i[a];n[c]||(n[c]={}),r(n[c],o,s,i)}else n[s]||(n[s]=[]),n[s].push(i[s])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(o,s,i,a)=>{let c=s.shift();if(!c&&B(a))throw new Ue(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(c){let u=[];if(B(a))u.push(...Object.keys(a));else if(le(a)){if(s.length>0)throw new Ue(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);u.push(a)}else throw new Ue(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);u.forEach(l=>{o[l]||(o[l]={});let m=B(a)?a[l]:a;r(o[l],[...s],i,m)})}else o[i]?o[i]++:o[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={}}},Hr=!1});function Kr(e,t){let r=0,n=!0,o=new Map,s=$r(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Ht.forEach(p=>v(this,[p],function*({method:u,args:l,resolve:m}){let k=yield a(u,l);m(k)})),Ht.length=0});let i=(u,l)=>{let m=o.get(Number(u));if(!m)return;let p=Ee(l);m(p),o.delete(Number(u))},a=(u,l)=>{var U,w;let m=Date.now(),p=`${n}`;r+=1;let k=new Q;if(o.set(r,k.resolve),!n&&jr.includes(u))return new Promise(x=>{Ht.push({method:u,args:l,resolve:x})});let b=P(h({},{method:u,startTime:m,args:l,isForeground:p}),{invokeType:"js-bridge"}),g=!is&&Br.includes(u),T=vr(l,g),R=g?T:JSON.stringify(T),_;if(u.endsWith("Sync")||Jr.includes(u)?_=(U=e.call)==null?void 0:U.call(e,u,T,r):typeof R=="string"?_=e.invoke(u,R,r):_=(w=e.call)==null?void 0:w.call(e,u,R,r),_){try{typeof _=="string"&&(_=JSON.parse(_)),_=Ee(_)}catch(x){$.error(x)}return o.delete(r),_.errorCode&&(_.errorCode=Le(u,_.errorCode)),s(h(h({},b),_)),_}return u.endsWith("Sync")&&o.delete(r),k.promise.then(x=>(x.errorCode&&(x.errorCode=Le(u,x.errorCode)),s(h(h({},b),x)),x))};return{invokeNative:a,applyNative:(u,l)=>{let m=a(u,l);return _r(m)?m.then(p=>Vr(u,p)):Vr(u,m)},invokeHandler:i}}function Vr(e,t){if(!B(t)){$.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:o,errorCode:s}=a,i=ce(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new Nr(r,n,o,s);return i}var Ht,is,qr=f(()=>{"use strict";wt();S();se();je();Jt();Ht=[],is=!1});function Gr(e){let t=new q,r=new q,n=new fe({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,s,i){let a=Ee(s),c;if(a.__extra){c=a.params;let{type:u,startTime:l}=a.__extra;n.report({type:u,event:o,duration:Date.now()-l})}else c=a;if(o===Be){c.forEach(l=>{let[m,p]=l;try{r.emit(m.slice(pe.length),p,i)}catch(k){}});return}if(o.startsWith(pe)){r.emit(o.slice(pe.length),c,i);return}t.emit(o,c,i)}}}var zr=f(()=>{"use strict";S();wt();Jt();je()});function Wr(e){let t=new Map,r;return(o,s,i,a)=>{if(a){let u=i?[i]:"*";e.publish(`${pe}${o}`,s,u);return}r||(r=Promise.resolve().then(()=>{t.forEach((u,l)=>{try{let m=l?[l]:"*";e.publish(Be,u,m)}catch(m){}}),r=void 0,t.clear()}));let c=t.get(i);c||(c=[],t.set(i,c)),c.push([`${pe}${o}`,s])}}var Qr=f(()=>{"use strict";je()});function $t(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:s}=Gr(e),{invokeNative:i,invokeHandler:a,applyNative:c}=Kr(e,r),u=Wr(e);return{invokeHandler:a,subscribeHandler:t,applyNative:c,invokeNative:i,onNative:r,offNative:n,publish:u,subscribe:o,unsubscribe:s}}var Yr=f(()=>{"use strict";qr();zr();Qr()});var Xr=f(()=>{"use strict"});var Zr=f(()=>{"use strict";Yr();Xr()});function ge(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Je=f(()=>{"use strict"});var ie,z,en,tn=f(()=>{"use strict";S();Je();G();z={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){z.trigger=e},doExit(e){z.exit=e}},en=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)M(new Cr("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="")=>{z.trigger(),e.onDocumentReady.postMessage({path:o})};ie={onDocumentReady:t,doExit:o=>v(void 0,null,function*(){let s=yield z.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:s})}),invoke(o,s,i){e.invoke.postMessage({event:o,paramsString:s,callbackId:i})},publish(o,s,i){let a=ge(s,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:i}))},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:en};globalThis.joliboxJSCore=h({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{z.trigger(),e.onDocumentReady(JSON.stringify({path:o}))};ie={onDocumentReady:t,invoke(o,s,i){e.invoke(JSON.stringify({event:o,paramsString:s,callbackId:i}))},doExit:o=>v(void 0,null,function*(){let s=yield z.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:s}))}),publish(o,s,i){let a=ge(s,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:i})},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:en};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,rn=f(()=>{"use strict";Je()});var He=f(()=>{"use strict";tn();rn();Je()});var on,as,sn,nn,V,A,Y,Ha,cs,an,cn,$a,j=f(()=>{"use strict";Zr();He();se();S();He();on=ie;if(!on)throw new Or("No joliboxJScore is found, native bridge not found.");Vt();as=h({},on),sn=$t(as),{invokeHandler:nn}=sn,{applyNative:V,invokeNative:A,onNative:Y,offNative:Ha,subscribeHandler:cs,publish:an,subscribe:cn,unsubscribe:$a}=sn;globalThis.joliboxJSBridge={callHandler:nn,invokeHandler:nn,subscribeHandler:cs}});var Kt,qt,ln,un,dn=f(()=>{"use strict";S();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(o){return{}}},qt=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},ln=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[s,i,a]=o;return{headerJson:Kt(s),payloadJson:Kt(i),signature:Kt(a)}}else throw"joli_source is missing"}catch(r){return M(new Pr(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},un=e=>{let{headerJson:t,payloadJson:r,signature:n}=e,o=qt(t),s=qt(r),i=qt(n);return`${o}.${s}.${i}`}});var ls,$e,mn,Gt=f(()=>{"use strict";S();ls="1.1.11-beta.4",$e=()=>ls,mn=()=>{let e=$e();return`${Mr(e)}`}});var us,pn,zt,fn,L,ds,y,J=f(()=>{"use strict";S();dn();Gt();S();us={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Ft(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:$e()},schema:window.location.href,platform:"h5"},zt=(pn=globalThis.joliboxJSCore)==null?void 0:pn.env,L=Object.assign({},(fn=zt==null?void 0:zt())!=null?fn:us),ds=()=>{var p,k,I,b,g,T,R,_,U;let{payloadJson:e,headerJson:t,signature:r}=L.schema.length?ln(L.schema):{},n=`${L.deviceInfo.did}-${new Date().getTime()}`,s=new URL(L.schema.length?L.schema:window.location.href).searchParams,i=(I=(k=(p=s.get("mpId"))!=null?p:s.get("appId"))!=null?k:s.get("gameId"))!=null?I:"",a=(T=(g=(b=L.clientSessionId)!=null?b:e==null?void 0:e.sessionId)!=null?g:s.get("sessionId"))!=null?T:n,c=!!((R=e==null?void 0:e.testAdsMode)!=null?R:s.get("testAdsMode")==="true"),u=(U=(_=e==null?void 0:e.joliboxEnv)!=null?_:s.get("joliboxEnv"))!=null?U:"production",l=u==="staging",m=t==null?void 0:t.channel;return{get testMode(){return l},get testAdsMode(){return c},get joliboxEnv(){return u},get joliSource(){var w;return(w=s.get("joliSource"))!=null?w:null},get mpId(){var w;return(w=i!=null?i:e==null?void 0:e.id)!=null?w:""},get mpVersion(){var w;return(w=t==null?void 0:t.ver)!=null?w:$e()},get mpType(){var w,x;return(x=(w=t==null?void 0:t.__mpType)!=null?w:e==null?void 0:e.__mpType)!=null?x:"game"},get platform(){var w;return(w=L.platform)!=null?w: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 w,x;return(x=(w=L.clientSessionId)!=null?w:a)!=null?x:n},get channel(){return m},get webviewId(){var w;return(w=L.webviewId)!=null?w:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:w=>{wr(L,w,Rr)},encodeJoliSourceQuery:w=>{var x;return t&&r?un({headerJson:t,payloadJson:h(h({},e),w),signature:r}):(x=s.get("joliSource"))!=null?x:""}}},y=ds()});var Wt,gn,ms,ps,hn,fs,yn=f(()=>{"use strict";S();G();J();S();Wt=!1,gn=(e,t)=>e==null?!1:t in e,ms=e=>gn(e,"kind"),ps=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},hn=(e,t={},r)=>{var s,i,a;let n={user_id:(i=(s=y.hostUserInfo)==null?void 0:s.uid)!=null?i:"",device_id:(a=y.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:ps(e.name)},o=P(h({},n),{env:t.environment,isFromUser:r});r?de.emit("GLOBAL_USER_ERROR",e,o):de.emit("GLOBAL_ERROR",e,o)},fs=e=>gn(e,"kind")&&e.kind==="USER_ERROR";Ut.on("ERROR_REPORT",({error:e,options:t})=>{if(Wt)return;Wt=!0;let r=ms(e)&&e.raw?e.raw:e;try{let n=fs(e);hn(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),s=new Nt(`${o}, origin error: ${r.message}`);$.error(s),hn(new Nt(s.message),{environment:t.environment},!1)}finally{Wt=!1}})});var vn=f(()=>{"use strict";yn();se();S();j();de.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};A("trackAsync",{event:"reportJsError",data:r})});de.on("GLOBAL_USER_ERROR",(e,t)=>{$.log("UserError",e,t)})});var Qt=f(()=>{"use strict"});function bn(e,t){let r=(n,o,s)=>{let i=P(h({tag:n},t),{extra:h({},o)});n=="globalJsError"?M(new Dr(JSON.stringify(i))):e("systemLog",i,s)};return r.debounce=we(r,500,{leading:!0}),r}function kn(e){let t=(r,n,o)=>{var a;let s=(a=o&&JSON.stringify(o))!=null?a:0,i={speed_value_type:r,total_duration:n};s&&Object.assign(i,{extra:s}),e("joliboxSpeedAnalysis",i)};return t.debounce=we(t,500,{leading:!0}),t}var Tn=f(()=>{"use strict";S();S();G()});function En(e,t){let r=bn(e,t),n=kn(r);return{track:r,trackPerformance:n}}var Sn=f(()=>{"use strict";Tn()});var _n=f(()=>{"use strict";J();S();S()});var In=f(()=>{"use strict";Sn();Qt();_n()});var Ve,wn=f(()=>{"use strict";Ve=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,s=!1,i=0,a=()=>{if(!s)return;let k=Date.now(),I=k-r;I>=this.interval&&(this.visible&&(i+=I,t(i)),r=k),n=requestAnimationFrame(a)},c=()=>{l(),r=Date.now(),o=window.setInterval(()=>{if(!s)return;let k=Date.now();k-r>=this.interval&&(r=k)},this.interval)},u=()=>{m(),r=Date.now(),n=requestAnimationFrame(a)},l=()=>{n&&(cancelAnimationFrame(n),n=0)},m=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",k=>{s&&(console.log("visible",k),k?u():c())});let p=this.visible;return{start(){s||(s=!0,p?u():c())},stop(){s=!1,l(),m()}}}}});var Yt=f(()=>{"use strict"});function An(e,t,r){let{response:n,startTime:o,endTime:s,requestFrom:i}=r,{errMsg:a="",profile:c={}}=n,l={duration:s-o,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"&&Rn<gs||i==="inner")&&(l.joli_request_number=Rn++,setTimeout(()=>{K("joliboxNetRequestResult",l)},500))}var Rn,gs,xn=f(()=>{"use strict";Yt();ae();Rn=0,gs=10});function Ke(e,t,r){var c,u,l;let n=new Map,o=(c=r==null?void 0:r.baseUrl)!=null?c:"https://api.jolibox.com",s=(u=r==null?void 0:r.type)!=null?u:"public",i=(l=r==null?void 0:r.defaultHeaders)!=null?l:{};return Y("onRequestTaskStateChange",m=>{if(typeof m.requestTaskId!="string")return;let p=n.get(m.requestTaskId);if(p)if(m.state==="success"){let k=m,{requestTaskId:b,state:g}=k,T=ce(k,["requestTaskId","state"]);p.resolve(T),n.delete(b)}else if(m.state==="fail"){let I=m,{requestTaskId:b,state:g}=I,T=ce(I,["requestTaskId","state"]);p.reject(T),n.delete(b)}else $.warn("onRequestTaskStateChange unknown event",m)}),re.on("onLoginComplete",({isLogin:m,token:p})=>{m&&p&&(i["X-JOLI-TOKEN"]=p)}),(k,...I)=>v(this,[k,...I],function*(m,p={}){let b=Date.now(),g=ys(m,P(h({},p),{baseUrl:o})),{method:T="GET",responseType:R="text",dataType:_="json",timeout:U,enableCache:w=!1,appendHostCookie:x=!0}=p,Te=Object.assign({"content-type":"application/json"},i,p.header),oe={url:g,method:T,header:Te,enableCache:w,responseType:R,appendHostCookie:x};if(T=="POST"||T=="PUT"){let W=bs(p.data,Te["content-type"]);oe.data=W}U&&Object.assign(oe,{timeout:U});let{data:{requestTaskId:_t}}=A(e,oe);if(typeof _t!="string")throw me({code:-1,msg:"requestTaskId is not a string"});let mr=(W,ee)=>{An("request",g,{state:W,startTime:b,endTime:Date.now(),params:oe,response:ee,requestId:_t,requestFrom:s=="public"?"public":"inner"})},{resolve:vo,reject:bo,promise:ko}=new Q;n.set(_t,{resolve:vo,reject:bo});try{let W=yield ko;mr("success",W);let{data:ee}=W;return _==="json"&&typeof ee=="string"&&(ee=vs(ee)),{url:g,timeout:U,method:T,response:P(h({},W),{data:ee})}}catch(W){let ee=W;if(B(ee)){let{errMsg:Pe,prefetchDetail:To,isPrefetch:Eo,errNo:So}=ee;le(Pe)&&(mr("fail",{errMsg:Pe,isPrefetch:Eo,prefetchDetail:To}),M(me({code:-1,msg:Pe},{errNo:So,errMsg:Pe})))}throw W}})}function vs(e){try{return JSON.parse(e.trim())}catch(t){return e}}function bs(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 ys,Xt=f(()=>{"use strict";S();xn();Yt();j();G();se();ys=(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 Zt,Pn,X,qe=f(()=>{"use strict";Gt();Xt();J();Zt={"x-user-agent":mn()};(Pn=y.hostUserInfo)!=null&&Pn.token&&(Zt["x-joli-token"]=y.hostUserInfo.token);y.joliSource&&(Zt["x-joli-source"]=y.joliSource);X=Ke("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:y.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Zt})});var Ge,Cn=f(()=>{"use strict";J();wn();qe();j();Ge=class extends Ve{constructor(t,r,n){super(r,n),this.gameId=y.mpId,this.sessionId=y.sessionId,this.track=t}reporter(t){return v(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(X("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:h({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return v(this,null,function*(){let{event:r,params:n}=t;yield V("userTrackAsync",{event:r,params:h({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var Un={};gr(Un,{nativeTaskEmitter:()=>xe,taskTracker:()=>H,track:()=>K,trackPerformance:()=>Dn});var ks,Nn,On,K,Dn,Fn,xe,H,ae=f(()=>{"use strict";vn();S();Qt();In();J();Cn();j();ks=(e,t,r)=>{var i,a;let n=t,o=B(n.extra)?n.extra:le(n.extra)?JSON.parse(n.extra):{},s=P(h({},o),{mp_id:(i=n.mp_id)!=null?i:"",mp_version:(a=n.mp_version)!=null?a:""});A("trackAsync",{event:e,data:s,webviewId:r})},{track:K,trackPerformance:Dn}=En(ks,{type:Dt.AppSDK,platform:"native",jssdk_version:(On=(Nn=y.sdkInfo)==null?void 0:Nn.jssdkVersion)!=null?On:"1.0.0",mp_id:y.mpId,mp_version:y.mpVersion}),Fn=O();Fn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Dn(e,t,r)});Fn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{K(e,t)});xe=new q,H=new Ge(K,xe)});function Mn(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let s=`
|
|
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,Zr=Object.prototype.propertyIsEnumerable;var Xr=(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)&&Xr(e,r,t[r]);if(Xe)for(var r of Xe(t))Zr.call(t,r)&&Xr(e,r,t[r]);return e},N=(e,t)=>Zi(e,ts(t));var W=(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&&Zr.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var en=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tn=(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 rn=(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 nn(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 be(e){return typeof e=="string"}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function cn(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 ln(e){return typeof e=="function"}function un(e){return J(e)&&ln(e.then)}function dn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function pn(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:on(l)&&on(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 on(e){return e&&typeof e=="object"&&e.constructor===Object}function mn(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=>Sn(e)(t))}function Sn(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 Ns(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Ps(e[n],t[n])}function Ps(e,t){if(be(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ln(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 sn,cs,ls,an,ie,ms,ir,ke,fn,hn,Je,gn,_n,vn,yn,bn,Ve,nt,sr,z,kn,hs,ar,gs,cr,_s,vs,et,ys,bs,ks,wn,lr,ws,Ts,Ss,Tn,de,D,Es,xs,tt,je,te,nr,Is,tr,Cs,pe,rt,or,rr,A=k(()=>{"use strict";sn=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,ls=(e,t)=>{for(var r in t)sn(e,r,{get:t[r],enumerable:!0})},an=(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&&sn(t,r,o),o};ie=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}},ke=class extends ir{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},fn=class extends ir{constructor(){super(...arguments),this.kind="USER_ERROR"}},hn=class extends fn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Je=class extends fn{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))}},gn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},_n=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},vn=class extends ke{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},yn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},bn=class extends ke{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 ke{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},sr=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};z={log:Be("log"),warn:Be("warn"),info:Be("info"),error:Be("error"),debug:Be("debug")};Object.assign(globalThis,{logger:z});kn=Symbol.for("Jolibox.canIUseMap"),hs={};globalThis[kn]=hs;ar={get config(){return globalThis[kn]}},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",wn=e=>(localStorage.getItem(e)||localStorage.setItem(e,vs()),localStorage.getItem(e)),lr=()=>wn(bs),ws=()=>wn(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"},Tn=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||""}`},D=(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=D.Undefined,this._last=D.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===D.Undefined}clear(){let e=this._first;for(;e!==D.Undefined;){let t=e.next;e.prev=D.Undefined,e.next=D.Undefined,e=t}this._first=D.Undefined,this._last=D.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new D(e);if(this._first===D.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!==D.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==D.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==D.Undefined&&e.next!==D.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===D.Undefined&&e.next===D.Undefined?(this._first=D.Undefined,this._last=D.Undefined):e.next===D.Undefined?(this._last=this._last.prev,this._last.next=D.Undefined):e.prev===D.Undefined&&(this._first=this._first.next,this._first.prev=D.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==D.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:()=>Sn,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 Ns(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=an([dn],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=an([dn],or);rr=Symbol.for("Jolibox.commands")});function H(e,t={}){ur.emit("ERROR_REPORT",{error:e,options:t})}var ur,we,re=k(()=>{"use strict";A();A();ur=new te,we=new te;H.debounce=$e(H,50,{leading:!0})});function it(e,t){return`[${e}]:${t}`}var Te,dr,ge=k(()=>{"use strict";re();A();re();Te=(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 hn(e)});var Se,En,xn,In,st,at=k(()=>{"use strict";Se="custom_event_",En=[],xn=[],In=["env","createRequestTask","login"],st="__batch_event__"});function An(e,t){Rn||(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()}),Rn=!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,Rn,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&&J(a))throw new nt(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(l){let u=[];if(J(a))u.push(...Object.keys(a));else if(be(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=J(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={}}},Rn=!1});function Nn(e,t){let r=0,n=!0,o=new Map,i=An(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 P,R;let c=Date.now(),p=`${n}`;r+=1;let m=new ie;if(o.set(r,m.resolve),!n&&xn.includes(u))return new Promise(S=>{gr.push({method:u,args:d,resolve:S})});let v=N(_({},{method:u,startTime:c,args:d,isForeground:p}),{invokeType:"js-bridge"}),h=!Ds&&En.includes(u),g=nn(d,h),b=h?g:JSON.stringify(g),E;if(u.endsWith("Sync")||In.includes(u)?E=(P=e.call)==null?void 0:P.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){z.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 un(c)?c.then(p=>Cn(u,p)):Cn(u,c)},invokeHandler:s}}function Cn(e,t){if(!J(t)){z.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:o,errorCode:i}=a,s=W(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new vn(r,n,o,i);return s}var gr,Ds,Pn=k(()=>{"use strict";er();A();ge();at();hr();gr=[],Ds=!1});function On(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 Dn=k(()=>{"use strict";A();er();hr();at()});function Fn(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 Un=k(()=>{"use strict";at()});function _r(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:i}=On(e),{invokeNative:s,invokeHandler:a,applyNative:l}=Nn(e,r),u=Fn(e);return{invokeHandler:a,subscribeHandler:t,applyNative:l,invokeNative:s,onNative:r,offNative:n,publish:u,subscribe:o,unsubscribe:i}}var Mn=k(()=>{"use strict";Pn();Dn();Un()});var Ln=k(()=>{"use strict"});var Bn=k(()=>{"use strict";Mn();Ln()});function Ne(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ct=k(()=>{"use strict"});var _e,ne,jn,Hn=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)H(new _n("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})};_e={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=Ne(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}))};_e={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=Ne(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"&&([Pe]=e.ports,Pe.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])},Pe.publish=function(t,r){let n=Ne(r,"messagePort");Pe.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},Pe.postMessage("msg:setup:ok"))}}var Pe,$n=k(()=>{"use strict";ct()});var lt=k(()=>{"use strict";Hn();$n();ct()});var Vn,Fs,Kn,Jn,Q,O,se,tu,Us,qn,ru,nu,V=k(()=>{"use strict";Bn();lt();ge();A();lt();Vn=_e;if(!Vn)throw new yn("No joliboxJScore is found, native bridge not found.");vr();Fs=_({},Vn),Kn=_r(Fs),{invokeHandler:Jn}=Kn,{applyNative:Q,invokeNative:O,onNative:se,offNative:tu,subscribeHandler:Us,publish:qn,subscribe:ru,unsubscribe:nu}=Kn;globalThis.joliboxJSBridge={callHandler:Jn,invokeHandler:Jn,subscribeHandler:Us}});var yr,Ms,Gn,Wn,zn=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,"")},Gn=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 H(new gn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Wn=(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,Qn,br=k(()=>{"use strict";A();Ls="1.1.11-beta.6",ut=()=>Ls,Qn=()=>{let e=ut();return`${Tn(e)}`}});var Bs,Yn,kr,Xn,$,js,w,K=k(()=>{"use strict";A();zn();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=(Yn=globalThis.joliboxJSCore)==null?void 0:Yn.env,$=Object.assign({},(Xn=kr==null?void 0:kr())!=null?Xn:Bs),js=()=>{var p,m,y,v,h,g,b,E,P;let{payloadJson:e,headerJson:t,signature:r}=$.schema.length?Gn($.schema):{},n=`${$.deviceInfo.did}-${new Date().getTime()}`,i=new URL($.schema.length?$.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=$.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=(P=(E=e==null?void 0:e.joliboxEnv)!=null?E:i.get("joliboxEnv"))!=null?P:"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=$.platform)!=null?R:$.deviceInfo.platform},get deviceInfo(){return $.deviceInfo},get sdkInfo(){return $.sdkInfo},get hostInfo(){return $.hostInfo},get hostUserInfo(){return $.hostUserInfo},get sessionId(){var R,S;return(S=(R=$.clientSessionId)!=null?R:a)!=null?S:n},get channel(){return c},get webviewId(){var R;return(R=$.webviewId)!=null?R:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:R=>{pn($,R,mn)},encodeJoliSourceQuery:R=>{var S,ee;return t&&r?Wn(_(_({},e),R),(S=i.get("joliSource"))!=null?S:""):(ee=i.get("joliSource"))!=null?ee:""}}},w=js()});var wr,eo,Hs,$s,Zn,Js,to=k(()=>{"use strict";A();re();K();A();wr=!1,eo=(e,t)=>e==null?!1:t in e,Hs=e=>eo(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("")},Zn=(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=N(_({},n),{env:t.environment,isFromUser:r});r?we.emit("GLOBAL_USER_ERROR",e,o):we.emit("GLOBAL_ERROR",e,o)},Js=e=>eo(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);Zn(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),i=new sr(`${o}, origin error: ${r.message}`);z.error(i),Zn(new sr(i.message),{environment:t.environment},!1)}finally{wr=!1}})});var ro=k(()=>{"use strict";to();ge();A();V();we.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})});we.on("GLOBAL_USER_ERROR",(e,t)=>{z.log("UserError",e,t)})});var Tr=k(()=>{"use strict"});function no(e,t){let r=(n,o,i)=>{let s=N(_({tag:n},t),{extra:_({},o)});n=="globalJsError"?H(new bn(JSON.stringify(s))):e("systemLog",s,i)};return r.debounce=$e(r,500,{leading:!0}),r}function oo(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 io=k(()=>{"use strict";A();A();re()});function so(e,t){let r=no(e,t),n=oo(r);return{track:r,trackPerformance:n}}var ao=k(()=>{"use strict";io()});var co=k(()=>{"use strict";K();A();A()});var lo=k(()=>{"use strict";ao();Tr();co()});var dt,uo=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 mo(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"&&po<Ks||s==="inner")&&(d.joli_request_number=po++,setTimeout(()=>{Y("joliboxNetRequestResult",d)},500))}var po,Ks,fo=k(()=>{"use strict";Sr();ve();po=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 se("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=W(m,["requestTaskId","state"]);p.resolve(g),n.delete(v)}else if(c.state==="fail"){let y=c,{requestTaskId:v,state:h}=y,g=W(y,["requestTaskId","state"]);p.reject(g),n.delete(v)}else z.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,N(_({},p),{baseUrl:o})),{method:g="GET",responseType:b="text",dataType:E="json",timeout:P,enableCache:R=!1,appendHostCookie:S=!0}=p,ee=Object.assign({"content-type":"application/json"},s,p.header),G={url:h,method:g,header:ee,enableCache:R,responseType:b,appendHostCookie:S};if(g=="POST"||g=="PUT"){let oe=Ws(p.data,ee["content-type"]);G.data=oe}P&&Object.assign(G,{timeout:P});let{data:{requestTaskId:le}}=O(e,G);if(typeof le!="string")throw Te({code:-1,msg:"requestTaskId is not a string"});let Ce=(oe,ue)=>{mo("request",h,{state:oe,startTime:v,endTime:Date.now(),params:G,response:ue,requestId:le,requestFrom:i=="public"?"public":"inner"})},{resolve:X,reject:ye,promise:Wi}=new ie;n.set(le,{resolve:X,reject:ye});try{let oe=yield Wi;Ce("success",oe);let{data:ue}=oe;return E==="json"&&typeof ue=="string"&&(ue=Gs(ue)),{url:h,timeout:P,method:g,response:N(_({},oe),{data:ue})}}catch(oe){let ue=oe;if(J(ue)){let{errMsg:Ye,prefetchDetail:zi,isPrefetch:Qi,errNo:Yi}=ue;be(Ye)&&(Ce("fail",{errMsg:Ye,isPrefetch:Qi,prefetchDetail:zi}),H(Te({code:-1,msg:Ye},{errNo:Yi,errMsg:Ye})))}throw oe}})}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();fo();Sr();V();re();ge();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,ho,Z,Ke=k(()=>{"use strict";br();Er();K();xr={"x-user-agent":Qn()};(ho=w.hostUserInfo)!=null&&ho.token&&(xr["x-joli-token"]=w.hostUserInfo.token);w.joliSource&&(xr["x-joli-source"]=w.joliSource);Z=pt("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:w.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:xr})});var mt,go=k(()=>{"use strict";K();uo();Ke();V();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(Z("/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 Q("userTrackAsync",{event:r,params:_({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var ko={};tn(ko,{nativeTaskEmitter:()=>qe,taskTracker:()=>q,track:()=>Y,trackPerformance:()=>yo});var zs,_o,vo,Y,yo,bo,qe,q,ve=k(()=>{"use strict";ro();A();Tr();lo();K();go();V();zs=(e,t,r)=>{var s,a;let n=t,o=J(n.extra)?n.extra:be(n.extra)?JSON.parse(n.extra):{},i=N(_({},o),{mp_id:(s=n.mp_id)!=null?s:"",mp_version:(a=n.mp_version)!=null?a:""});O("trackAsync",{event:e,data:i,webviewId:r})},{track:Y,trackPerformance:yo}=so(zs,{type:cr.AppSDK,platform:"native",jssdk_version:(vo=(_o=w.sdkInfo)==null?void 0:_o.jssdkVersion)!=null?vo:"1.0.0",mp_id:w.mpId,mp_version:w.mpVersion}),bo=M();bo.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{yo(e,t,r)});bo.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Y(e,t)});qe=new te,q=new mt(Y,qe)});function wo(){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,42 @@ var _o=Object.create;var Ne=Object.defineProperty,Io=Object.defineProperties,wo=
|
|
|
16
16
|
min-height: 100dvh;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`;e.textContent=s;let i=document.head||document.getElementsByTagName("head")[0];i.insertBefore(e,i.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function s(a){return v(this,null,function*(){let c=a instanceof URL?a.href:a,u=new Promise((l,m)=>{let p=new XMLHttpRequest;p.open("GET",c),p.responseType="arraybuffer",p.addEventListener("load",()=>l(p.response)),p.addEventListener("error",m),p.send()});try{let l=yield u;return new Response(l,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(l){throw console.error("Failed to load wasm:",l),l}})}let i=window.fetch;window.fetch=(a,c)=>{let u=a instanceof URL?a.href:a.toString();return u.endsWith(".wasm")?s(u):i(a,c)}},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 Ln=f(()=>{"use strict"});var ze,Bn=f(()=>{"use strict";ze=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 We,Ts,Es,Ss,_s,jn=f(()=>{"use strict";We=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 s=this.checkShouldBanForTime(t);return s?{reason:s}:{reason:"ALLOWED"}};var p,k,I,b,g,T,R;let s=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,i=(k=o==null?void 0:o.banForTimeThreshold)!=null?k:6e4,a=(I=o==null?void 0:o.bannedReleaseTime)!=null?I:6e4,c=(b=o==null?void 0:o.maxAllowedAdsForSession)!=null?b:200,u=(g=o==null?void 0:o.banForSessionThreshold)!=null?g:6e5,l=(T=o==null?void 0:o.initialThreshold)!=null?T:2e3,m=(R=o==null?void 0:o.highFreqThreshold)!=null?R:2e3;this.checkShouldBanInitial=Ss(l),this.checkShouldBanHighFreq=_s(m),this.checkShouldBanForTime=Es(s,i,a),this.checkShouldBanForSession=Ts(c,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}})}},Ts=(e,t)=>{let r=!1,n=[];return s=>{if(r)return"BANNED_FOR_SESSION";let i=Date.now();if(n=n.concat({timestamp:i,type:s}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&i-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Es=(e,t,r)=>{let n=null,o=l=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{c.value=!1,n=null},l)},s="jolibox-sdk-ads-callbreak-timestamps",i="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var l;try{let m=JSON.parse((l=window.localStorage.getItem(s))!=null?l:"[]");Array.isArray(m)?this._records=m:this._records=[]}catch(m){this._records=[]}},get values(){return this._records},set values(l){try{window.localStorage.setItem(s,JSON.stringify(l))}catch(m){}this._records=l}},c={_record:!1,init(){var l;try{let m=JSON.parse((l=window.localStorage.getItem(i))!=null?l:"false");typeof m=="boolean"&&(this._record=m)}catch(m){this._record=!1}if(this._record){let m=a.values[a.values.length-1],p=m?Date.now()-m.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(l){try{window.localStorage.setItem(i,JSON.stringify(l))}catch(m){}this._record=l}};return a.init(),c.init(),l=>{if(c.value)return"WAITING_BANNED_RELEASE";let m=Date.now();if(a.values=a.values.concat({timestamp:m,type:l}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&m-a.values[0].timestamp<=t))return c.value=!0,o(r),"BANNED_FOR_TIME"}},Ss=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},_s=(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 Qe,Jn=f(()=>{"use strict";J();Qe=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return v(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let o=(r=y.channel)!=null?r:"",s=this.configs[o],i=(n=s==null?void 0:s.interstitialRate)!=null?n:1;t=Math.random()<i}return this.firstRun=!1,t}}});var ve,Ye,er=f(()=>{"use strict";Bn();jn();J();Jn();S();ve=new q,Ye=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>y.mpId;this.getTestAdsMode=()=>y.testAdsMode;this.asyncLoad=()=>v(this,null,function*(){var i,a,c,u,l;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((i=this.getGameId())!=null?i:"")),s=(a=this.getTestAdsMode())!=null?a:!1;try{let m=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${s}`}});t=(c=m.data)==null?void 0:c.clientId,r=(u=m.data)==null?void 0:u.channelId,n=(l=m.data)==null?void 0:l.unitId}catch(m){console.error("Failed to fetch client info",m)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>v(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 s=document.createElement("script");s.id=r,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&s.setAttribute("data-adbreak-test","on"),this.channelId&&s.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(s),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,o=s=>{ve.emit("isAdShowing",!1),n&&n(s)};return P(h({},t),{adBreakDone:o})}else{let n=t.beforeAd,o=t.afterAd,s=()=>{var a;ve.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(a=t.name)!=null?a:""}),n&&n()},i=()=>{var a;ve.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(a=t.name)!=null?a:""}),o&&o()};return P(h({},t),{beforeAd:s,afterAd:i})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=ce(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,l,m,p,k,I;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":(l=t.adBreakDone)==null||l.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),((k=n==null?void 0:n.count)!=null?k:0)===3&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let o=t.type,s=t.adBreakDone,i=b=>{var g;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:b.breakType,breakName:(g=b.breakName)!=null?g:"",breakFormat:b.breakFormat,breakStatus:b.breakStatus}),s&&s(b)};if(t.adBreakDone=i,t.type==="reward"){let b=t.beforeReward,g=R=>()=>{this.track("CallShowAdFn",null),R()},T=R=>{b&&b(g(R))};t.beforeReward=T}let a;switch(o){case"preroll":a={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":a={type:o,name:(I=t.name)!=null?I:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",a);let c=this.wrapAdBreakParams(t);this.push(c),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>v(this,null,function*(){var p,k,I,b;if(this.track("CallAdUnit",{adFormat:(k=(p=t.adFormat)==null?void 0:p.toString())!=null?k:null,fullWidthResponsive:(I=t.fullWidthResponsive)!=null?I: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:s,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 u=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,l=document.createElement("ins");if(l.className="adsbygoogle",l.id="jolibox-ads",l.style.display="block",l.setAttribute("data-ad-client",this.clientId),l.setAttribute("data-ad-slot",c),u&&l.setAttribute("data-ad-format",u),s&&l.setAttribute("data-full-width-responsive",s),i&&l.setAttribute("style",i),(b=this.getTestAdsMode())!=null?b:!1){let g=document.createElement("div");g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.width="100%",g.style.height="100%",g.style.display="flex",g.style.justifyContent="center",g.style.alignItems="center",g.style.backgroundColor="rgba(0, 0, 0, 0.5)",g.style.color="white",g.innerHTML="Test Ad",l.style.position="relative",a.appendChild(l),l.appendChild(g)}else a.appendChild(l),new MutationObserver(T=>{T.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let _=l.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:_!=null?_:"null"})}})}).observe(l,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new We(t,r,n),this.adsActionDetection=new ze(this.track),this.channelPolicy=new Qe(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function Hn(){return v(this,null,function*(){let{data:e}=A("envSync"),{orientation:t,webviewId:r}=e,n={__mpType:"miniApp",__transparent:!0,__orientation:t!=null?t:"VERTICAL",__showStatusBar:!1,__shouldInterupt:!1,__showCapsuleButton:!1};r&&(n=P(h({},n),{__from:r}));let o=y.encodeJoliSourceQuery(n),i=`${y.testMode,"https://G32115508989327465281365749294.app.jolibox.com"}/recommended-guide/${y.mpId}?appId=${y.mpId}&joliSource=${o}&navigationStyle=present`,a=new Q;return cn("onRetentionResult",({shouldStay:c})=>{a.resolve(c)}),setTimeout(()=>{A("openSchemaSync",{schema:i})},0),a.promise})}var $n=f(()=>{"use strict";J();j();S()});var Kn={};gr(Kn,{config:()=>As});function Is(){re.on("onDocumentReady",()=>{var e;(e=ie)==null||e.onDocumentReady(window.location.href),K("onDocumentReady",{start_timestamp:et,timestamp:Date.now()})})}function ws(e){y.mpType==="game"&&H.start(e)}function Rs(){Y("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&y.onEnvConfigChanged({hostUserInfo:e}),re.emit("LifecycleEvent.onReady",h({},y.hostUserInfo?y.hostUserInfo:{isLogin:!1})),K("joliboxServiceReady",{start_timestamp:et,timestamp:Date.now()}),ws(t)}),Y("onBeforeExit",({uuid:e})=>{var t;(t=ie)==null||t.doExit(e)})}function As(){et=Date.now(),Rs(),Is(),Xe=Mn()}var Xe,Vn,Ze,et,qn=f(()=>{"use strict";j();He();J();S();ae();Ln();er();$n();z.onReady(()=>{});Vn=()=>{K("onBeforeExit",{timestamp:Date.now()}),Xe==null||Xe(),H.close(Date.now()-et)};z.doExit(()=>v(void 0,null,function*(){return Ze?!0:Ie(y.shouldInterupt)?(y.shouldInterupt||Vn(),y.shouldInterupt):(yield Hn())?!0:(Vn(),!1)}));Ze=!1;ve.on("isAdShowing",e=>{Ze=e,Ie(Ze)&&A("updateContainerConfigSync",{displayCapsuleButton:!Ze,webviewId:y.webviewId})})});function Gn(e){let t=Ot.config[e];return t||(t={},Ot.config[e]=t),(r,n)=>{if(t[r]){$.warn(`[can i use] ${r} already registered`);return}t[r]=h({},n)}}var zn=f(()=>{"use strict";S()});function tr(e){Wn=e}function tt(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>tt(t)):Object.keys(e).reduce((t,r)=>(t[r]=tt(e[r]),t),{})}function ne(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 Wn,D,rt,nt,ot,st,be,it,at,ct,lt,ut,dt,mt,pt,ft,ht,gt,yt,or=f(()=>{"use strict";Wn=!1;D=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Wn)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${rr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return tt(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:tt(this._default)}optional(){return this._optional=!0,this}};rt=class extends D{validate(t){return this._optional&&t===void 0?!0:ne(t)?ne(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ne(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ne(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 D{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},ot=class extends D{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ne(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ne(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 D{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},be=class extends D{validate(t){return!0}},it=class extends D{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},at=class extends D{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ct=class extends D{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},lt=class extends D{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}},ut=class extends D{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(ne(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ne(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ne(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((s,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,s===void 0&&n.hasDefault){r[i]=n.defaultValue;return}n.validate(s)||(n.hasFallback?r[i]=n.fallbackValue:o=!1)}),this._uniqueItems){let s=new Map;for(let i in r)s.has(r[i])?o=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${s.get(r[i])}] and ${this.path}[${i}] are identical)`):s.set(r[i],i)}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}},dt=class extends D{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 o=r,s=this._value;s.errors=this.errors;let i=!0;for(let a in o){let c=o[a];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?s.path=`${this.path}.${a}`:s.path=`${this.path}["${a}"]`,!(c===void 0&&s._optional)){if(c===void 0&&s.hasDefault){o[a]=s.defaultValue;continue}s.validate(c)||(s.hasFallback?o[a]=s.fallbackValue:i=!1)}}return i}},mt=class extends D{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,o=!0;for(let s in this._object){let i=n[s],a=this._object[s];if(a.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?a.path=`${this.path}.${s}`:a.path=`${this.path}["${s}"]`,!(a._optional&&i===void 0)){if(i===void 0&&a.hasDefault){n[s]=a.defaultValue;continue}a.validate(i)||(a.hasFallback?n[s]=a.fallbackValue:o=!1)}}return o}},pt=class extends D{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}},ft=class extends D{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 s=0;s<o;s++){let i=this._items[s];if(i.errors=[],i.path=this.path,!i.validate(t))r.push(i.errors.join("; "));else if(!n){n=!0;break}}if(!n){let s=r.join(`
|
|
20
|
-
|
|
21
|
-
`);throw e.errors.length=0,tr(!1),new TypeError(n)}}var d,ir=f(()=>{"use strict";or();or();d={object(e){return new mt(e)},array(e){return new ut(e)},tuple(...e){return new ht(...e)},literal(e){return new pt(e)},or(...e){return new ft(...e)},symbol(){return new st},record(e){return new dt(e)},function(){return new ct},boolean(){return new nt},string(){return new ot},number(){return new rt},undefined(){return new it},null(){return new at},unknown(){return new be},any(){return new be},as(){return new be},arraybuffer(){return new gt},enum(...e){return new lt(...e)},typedarray(e){return new yt(e)}}});var vt,Qn,Yn=f(()=>{"use strict";S();G();ir();se();vt=1,Qn=e=>{function t(n,o){return(...s)=>{var m,p,k,I;let i=Date.now(),a={method:n,trace_id:vt};vt+=1;let c="SUCCESS",u=`${n}:ok`,l=0;try{if(o.paramsSchema)try{sr(o.paramsSchema,s,"params")}catch(R){throw Mt(`${n}:fail ${R.message}`)}let b=o.implement(...s),g=b,T=`${n}:ok`;if(b&&"code"in b){let{code:R,data:_,message:U}=b;c=R,g=_,T=U}return{code:c,message:T,data:g}}catch(b){let g=b;l=(p=(m=g.code)!=null?m:g.errNo)!=null?p:2e3,c="FAILURE";let T=(I=(k=g.message)!=null?k:g.errMsg)!=null?I:`${b}`;return u=`${n}:${c} ${T.replace(/^\S+:(fail|cancel)\s?/,"")}`,M(new Ae(u,l)),{code:c,message:u}}finally{let b=Date.now()-i;e("apiInvoked",P(h({},a),{duration:b,status:c}))}}}function r(n,o){return(...s)=>v(this,null,function*(){var p,k,I,b;let i=Er(s)?s:[s],a=Date.now(),c={method:n,trace_id:vt};vt+=1;let u=`${n}:ok`,l="SUCCESS",m={code:l,message:u};try{if(o.paramsSchema)try{sr(o.paramsSchema,i,"params")}catch(R){throw Mt(R.message)}let T=yield o.implement(...i);if(T&&"code"in T){let{code:R,data:_,message:U}=T;l=R,u=U,T=_}return Object.assign(m,{code:l,message:u,data:T}),m}catch(g){let T=g,R=(k=(p=T.code)!=null?p:T.errNo)!=null?k:2e3;l="FAILURE";let _=(b=(I=T.message)!=null?I:T.errMsg)!=null?b:`${g}`,U=`${n}:${l} ${_.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(m,{code:l,message:U}),M(new Ae(U,R)),m}finally{let g=Date.now()-a;e("apiInvoked",P(h({},c),{duration:g,status:l}))}})}return{createAPI:r,createSyncAPI:t}}});var F,N,E,Z=f(()=>{"use strict";zn();ae();Yn();ir();({createAPI:F,createSyncAPI:N}=Qn(K)),E=Gn("native")});var Xn,Ps,Cs,Ns,Os,Zn=f(()=>{"use strict";S();Z();j();Xn=O(),Ps="env",Cs="getSystemInfoSync",Ns=N(Cs,{implement:()=>{var r;let e=A("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}}}),Os=N(Ps,{implement:()=>{var t;let e=A("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Xn.registerCommand("API.getSystemInfoSync",Ns);Xn.registerCommand("API.env",Os);E("env",{version:"1.0.0"});E("getSystemInfoSync",{version:"1.0.0"})});var eo=hr(ar=>{"use strict";S();Z();G();j();ae();J();var Ds="exitGame",Fs="onReady",Us="onJoliboxShow",Ms="onJoliboxHide",bt=O(),kt=Me(M),Ls=F(Ds,{paramsSchema:d.tuple(d.function(),d.boolean().optional().default(!1)),implement:(e,t=!1)=>v(ar,null,function*(){kt(e).call(ar),Ie(y.shouldInterupt)&&!y.shouldInterupt&&y.from&&an("onRetentionResult",{shouldStay:t},y.from,!0),yield V("exitAppAsync")})}),Bs=N(Us,{paramsSchema:d.tuple(d.function()),implement(e){let t=kt(e);Y("onJoliboxEnterForeground",()=>{t.call(this),xe.emit("visible",!0)})}}),js=N(Ms,{paramsSchema:d.tuple(d.function()),implement(e){let t=kt(e);Y("onJoliboxEnterBackground",()=>{t.call(this),xe.emit("visible",!1)})}}),Js=N(Fs,{paramsSchema:d.tuple(d.function()),implement(e){let t=kt(e);re.on("LifecycleEvent.onReady",r=>{t(r)})}});bt.registerCommand("LifecycleSDK.exit",Ls);bt.registerCommand("LifecycleSDK.onReady",Js);bt.registerCommand("LifecycleSDK.onJoliboxShow",Bs);bt.registerCommand("LifecycleSDK.onJoliboxHide",js);E("lifeCycle.exit",{version:"1.0.0"});E("lifeCycle.onReady",{version:"1.0.0"});E("lifeCycle.onJoliboxShow",{version:"1.0.0"});E("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function to(e){let t={};if(!B(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 ro(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 no(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function oo(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!B(r))return e;let[n,o=""]=e.split("?"),s=JSON.stringify(h(h({},JSON.parse(o)),r));return`${n}?${s}`}var so=f(()=>{"use strict";S()});var Hs,$s,cr,lr,io,Vs,Ks,qs,ao=f(()=>{"use strict";se();Xt();Z();so();S();G();Hs=15,$s=Ke("createRequestTaskSync","operateRequestTaskSync",{type:"public"}),cr=0,lr=[],io=Me(M),Vs=(e,t)=>{let r=e.filter(t),n=e.filter(o=>!t(o));return e.length=0,e.push(...n),r},Ks=e=>{let t=new Q,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(o){let s=()=>v(this,null,function*(){var a,c;let i=io(o.fail);try{if(cr+=1,t.state!=="pending")return;let{data:u,dataType:l,responseType:m,enableCache:p,appendHostCookie:k}=o,I=to(o.header),b=ro(o.method),g=no(o.timeout),T=oo(o.url,b,u),R=io(o.success),_=Object.assign({},o,{method:b,header:I,data:b==="GET"||b==="HEAD"?void 0:u,enableCache:p,query:(a=o.query)!=null?a:{},dataType:l,responseType:m,appendHostCookie:k});g&&(_.timeout=g);let U=$s(T,_);{let{response:w}=yield U,{code:x,data:Te,message:oe}=w;t.resolve({code:x!=null?x:"SUCCESS",data:Te,message:oe!=null?oe:"request:ok"}),R({code:"SUCCESS",message:"request:ok",data:Te})}}catch(u){t.reject(u),i({code:"FAILURE",message:"httpRequst: failed"})}finally{cr-=1,(c=lr.shift())==null||c()}});return cr>=Hs?(r=()=>{Vs(lr,i=>i===s)},lr.push(s)):s(),t.promise}})(e),{abort(){t.reject(me({code:-1,msg:"request:fail abort"})),r()}}},qs=O();qs.registerCommand("HttpSDK.request",Ks);E("request",{version:"1.0.0"})});function Xs(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return Ys.includes(t)?t:""}function Zs(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 ei(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,Gs,zs,Ws,Qs,Vu,Ku,Ys,co=f(()=>{"use strict";Z();j();S();qe();J();Tt=O(),Gs=F("getLocalStorage",{paramsSchema:d.tuple(d.string()),implement(e){return v(this,null,function*(){let{response:t}=yield X(`/api/games/user-storage/${y.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:s,dataType:i}}=yield V("getLocalStorageAsync",{key:e}),a=Zs(s,i);return{code:r,message:`${n}. fallback to native`,data:a}}catch(s){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});Tt.registerCommand("StorageSDK.getItem",Gs);E("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});zs=F("setStorage",{paramsSchema:d.tuple(d.string(),d.or(d.string(),d.boolean(),d.number())),implement(e,t){return v(this,null,function*(){let r=y.mpId,n=typeof t=="string"?t:String(t),{response:o}=yield X(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:s,message:i}}=o,a=Xs(t),c=ei(t,a);return yield V("setLocalStorageAsync",{key:e,data:c,dataType:a}),s=="SUCCESS"?{code:s,message:i}:{code:s,message:`${i}. fallback to native`}})}});Tt.registerCommand("StorageSDK.setItem",zs);E("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});Ws=F("removeStorage",{paramsSchema:d.tuple(d.string()),implement(e){return v(this,null,function*(){let t=y.mpId,{response:r}=yield X(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:o}}=r;return yield V("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:o}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Tt.registerCommand("StorageSDK.removeItem",Ws);E("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});Qs=F("clearStorage",{implement(){return v(this,null,function*(){let e=y.mpId,{response:t}=yield X(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});V("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",Qs);E("storage.clear",{version:"1.0.0"});Vu=F("getStorageInfo",{implement(){return v(this,null,function*(){let{data:e}=yield V("getStorageInfoAsync");return e})}});E("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});Ku=N("getStorageInfoSync",{implement(){return A("getStorageInfoSync")}}),Ys=["string","number","boolean","object",""]});var ti,ri,ni,ur,lo=f(()=>{"use strict";S();j();Z();ti=N("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)),A("showKeyboardSync",P(h({},e),{defaultValue:r,maxLength:t}))}});E("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"}});ri=N("updateKeyboard",{paramsSchema:d.tuple(d.object({value:d.string()})),implement(e){A("updateKeyboardSync",e)}});E("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});ni=N("hideKeyboard",{implement(){A("hideKeyboardSync")}});E("keyboard.hideKeyboard",{version:"1.0.0"});ur=O();ur.registerCommand("KeyboardSDK.showKeyboard",ti);ur.registerCommand("KeyboardSDK.updateKeyboard",ri);ur.registerCommand("KeyboardSDK.hideKeyboard",ni)});var uo=hr(he=>{"use strict";S();Z();ae();var ke=O(),oi=F("levelFinished",{paramsSchema:d.tuple(d.string(),d.object({result:d.boolean(),duration:d.number()})),implement:(e,t)=>v(he,null,function*(){let{result:r,duration:n}=t,o=[];o.push(H.tracker("LevelFinished",{levelId:e,result:r,duration:n})),o.push(H.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),si=F("taskFinished",{paramsSchema:d.tuple(d.string(),d.object({duration:d.number()})),implement:(e,t)=>v(he,null,function*(){let{duration:r}=t;return yield H.reportToNative({event:"TaskFinished",params:{duration:r,taskId:e}})})}),ii=F("levelUpgrade",{paramsSchema:d.tuple(d.string(),d.string()),implement:(e,t)=>v(he,null,function*(){let r=[];r.push(H.reportToNative({event:"LevelUpgrade",params:{name:t,levelId:e}})),yield Promise.all(r)})}),ai=F("onHistoryUserLevel",{paramsSchema:d.tuple(d.number()),implement:e=>v(he,null,function*(){return yield H.reportToNative({event:"HistoryUserLevel",params:{level:e}})})}),ci=F("onHistoryUserScore",{paramsSchema:d.tuple(d.number()),implement:e=>v(he,null,function*(){return yield H.reportToNative({event:"HistoryUserScore",params:{score:e}})})}),li=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)=>v(he,null,function*(){var n,o;let r=[];r.push(H.reportToNative({event:"TaskEvent",params:h({taskId:e},t)})),(o=(n=t.tools)==null?void 0:n.length)!=null&&o&&(r.push(H.reporter({event:"USE_GAME_ITEM"})),r.push(H.reportToNative({event:"UseGameItem",params:h({taskId:e},t)}))),yield Promise.all(r)})});ke.registerCommand("TaskTrackerSDK.levelFinished",oi);ke.registerCommand("TaskTrackerSDK.taskFinished",si);ke.registerCommand("TaskTrackerSDK.levelUpgrade",ii);ke.registerCommand("TaskTrackerSDK.historyUserLevel",ai);ke.registerCommand("TaskTrackerSDK.historyUserScore",ci);ke.registerCommand("TaskTrackerSDK.taskEvent",li);E("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});E("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});E("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});E("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});E("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});E("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 ui,di,mo,po=f(()=>{"use strict";J();j();Z();S();se();E("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"}});E("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});ui=F("login",{implement(){return v(this,null,function*(){var i;let{data:{isLogin:e}}=yield V("checkLoginAsync");if(e)return{isLogin:!0,token:(i=y.hostUserInfo)==null?void 0:i.token};Y("onLoginStateChange",({isLogin:a,token:c,uuid:u})=>{u==r&&o({isLogin:a,token:c})});let t=A("loginSync"),{data:{uuid:r}}=t;if(!r)throw me({code:-1,msg:"login failed"});let{promise:n,resolve:o}=new Q,s=yield n;return y.onEnvConfigChanged({hostUserInfo:s}),re.emit("onLoginComplete",s),s})}}),di=F("checkSession",{implement(){return v(this,null,function*(){let{data:{isLogin:e}}=yield V("checkLoginAsync");return{isLogin:e}})}}),mo=O();mo.registerCommand("API.login",ui);mo.registerCommand("API.checkSession",di)});var Et,mi,St,pi,fi,hi,gi,fo=f(()=>{"use strict";S();Z();er();ae();qe();j();Et=O(),mi=()=>{let{data:e}=A("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},St=new Ye(K,{get:(e,t)=>X(e,h({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t,r)=>X(e,h({method:"POST",responseType:"json",appendHostCookie:!0},r)).then(n=>n.response.data)},mi),pi=N("adInit",{implement:e=>{St.init(e)}}),fi=N("adConfig",{implement:e=>{St.adConfig(e)}}),hi=N("adBreak",{implement:e=>{St.adBreak(e)}}),gi=N("adUnit",{implement:e=>{St.adUnit(e)}});Et.registerCommand("AdsSDK.init",pi);Et.registerCommand("AdsSDK.adConfig",fi);Et.registerCommand("AdsSDK.adBreak",hi);Et.registerCommand("AdsSDK.adUnit",gi);E("AdsSDK.init",{version:"1.0.0"});E("AdsSDK.adConfig",{version:"1.0.0"});E("AdsSDK.adBreak",{version:"1.0.0"});E("AdsSDK.adUnit",{version:"1.0.0"})});var dr,yi,vi,bi,ho=f(()=>{"use strict";S();j();Z();J();dr=O(),yi=N("openSchemaSync",{paramsSchema:d.tuple(d.string()),implement:e=>{let t=e;e.match(/^https?:\/\//)||(t=`https://${y.mpId}.app.jolibox.com${e.startsWith("/")?"":"/"}${e}`);let r=A("openSchemaSync",{schema:t});if(r.errNo!==0)throw new Re(r.errMsg,r.errNo)}}),vi=N("openPageSync",{paramsSchema:d.tuple(d.string()),implement:e=>{let{errNo:t,errMsg:r,data:n}=A("openPageSync",{url:e});if(t!==0||!n)throw new Re(r,t);return{webviewId:n.webviewId}}}),bi=N("closePageSync",{paramsSchema:d.tuple(d.number()),implement:e=>{let{errNo:t,errMsg:r}=A("closePageSync",{webviewId:e});if(t!==0)throw new Re(r,t)}});dr.registerCommand("RouterSDK.openSchema",yi);dr.registerCommand("RouterSDK.openPage",vi);dr.registerCommand("RouterSDK.closePage",bi);E("router.openSchema",{version:"1.1.10"});E("router.openPage",{version:"1.1.10"});E("router.closePage",{version:"1.1.10"})});var ki={};var Ad,Nd,go=f(()=>{"use strict";Zn();Ad=yr(eo());ao();co();lo();Nd=yr(uo());po();fo();ho()});var yo=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[yo])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[yo]=!0;v(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(qn(),Kn)),Promise.resolve().then(()=>(go(),ki)),Promise.resolve().then(()=>(ae(),Un))]);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 To=k(()=>{"use strict"});var ft,So=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,Eo=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,xo=k(()=>{"use strict";K();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 Oe,_t,Ir=k(()=>{"use strict";So();Eo();K();xo();A();Oe=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)){Oe.emit("isAdShowing",!0);let n=t.adBreakDone,o=i=>{Oe.emit("isAdShowing",!1),n&&n(i)};return N(_({},t),{adBreakDone:o})}else{let n=t.beforeAd,o=t.afterAd,i=()=>{var a;Oe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(a=t.name)!=null?a:""}),n&&n()},s=()=>{var a;Oe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(a=t.name)!=null?a:""}),o&&o()};return N(_({},t),{beforeAd:i,afterAd:s})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=W(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 Ur(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?xt.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:++zo,__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 ei(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 ei(e)}}function Ro(e){(!e.__d&&(e.__d=!0)&&xe.push(e)&&!Tt.__r++||Io!==x.debounceRendering)&&((Io=x.debounceRendering)||Qo)(Tt)}function Tt(){for(var e,t,r,n,o,i,s,a=1;xe.length;)xe.length>a&&xe.sort(Yo),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),Mr(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,ni(i,r,s),r.__e!=o&&ei(r)));Tt.__r=0}function ti(e,t,r,n,o,i,s,a,l,u,d){var c,p,m,y,v,h,g=n&&n.__k||Zo,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=Mr(e,m,p,o,i,s,a,l,u,d),y=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Lr(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=ri(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)),ii(a,a));return n}function ri(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=ri(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 St(e,t){return t=t||[],e==null||typeof e=="boolean"||(Qe(e)?e.some(function(r){St(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 Ao(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||Ao(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Ao(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Xo,"$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=Fr,e.addEventListener(t,i?Pr:Nr,i)):e.removeEventListener(t,i?Pr:Nr,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 Co(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Fr++;else if(t.u<r.t)return;return r(x.event?x.event(t):t)}}}function Mr(e,t,r,n,o,i,s,a,l,u){var d,c,p,m,y,v,h,g,b,E,P,R,S,ee,G,le,Ce,X=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 X=="function")try{if(g=t.props,b="prototype"in X&&X.prototype.render,E=(d=X.contextType)&&n[d.__c],P=d?E?E.props.value:d.__:n,r.__c?h=(c=t.__c=r.__c).__=c.__E:(b?t.__c=c=new X(g,P):(t.__c=c=new fe(g,P),c.constructor=X,c.render=oa),E&&E.sub(c),c.props=g,c.state||(c.state={}),c.context=P,c.__n=n,p=c.__d=!0,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&X.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=me({},c.__s)),me(c.__s,X.getDerivedStateFromProps(g,c.__s))),m=c.props,y=c.state,c.__v=t,p)b&&X.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&X.getDerivedStateFromProps==null&&g!==m&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,P),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,P)===!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(ye){ye&&(ye.__=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,P),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(m,y,v)})}if(c.context=P,c.props=g,c.__P=e,c.__e=!1,S=x.__r,ee=0,b){for(c.state=c.__s,c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),G=0;G<c._sb.length;G++)c.__h.push(c._sb[G]);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&&++ee<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=oi(d.props.children)),a=ti(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(ye){if(t.__v=null,l||i!=null)if(ye.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--;)Ur(i[Ce]);else t.__e=r.__e,t.__k=r.__k;x.__e(ye,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 ni(e,t,r){for(var n=0;n<r.length;n++)Lr(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 oi(e){return typeof e!="object"||e==null?e:Qe(e)?e.map(oi):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&&xt.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=""),ti(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--;)Ur(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 Lr(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 ii(e,t,r){var n,o;if(x.unmount&&x.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Lr(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]&&ii(n[o],t,r||typeof e.type!="function");r||Ur(e.__e),e.__c=e.__=e.__e=void 0}function oa(e,t,r){return this.constructor(e,r)}function No(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=[],Mr(t,e=t.__k=Ie(Re,null,[e]),o||Ge,Ge,t.namespaceURI,o?null:t.firstChild?xt.call(t.childNodes):null,i,o?o.__e:t.firstChild,n,s),ni(i,e,s)}function Br(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 Bo(e){return ze=1,ia(li,e)}function ia(e,t,r){var n=Br(We++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):li(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 kt(e,t){var r=Br(We++,3);!L.__s&&ci(r.__H,t)&&(r.__=e,r.u=t,U.__H.__h.push(r))}function Et(e){return ze=5,ai(function(){return{current:e}},[])}function ai(e,t){var r=Br(We++,7);return ci(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ae(e,t){return ze=8,ai(function(){return e},t)}function sa(){for(var e;e=si.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wt),e.__H.__h.forEach(Or),e.__H.__h=[]}catch(t){e.__H.__h=[],L.__e(t,e.__v)}}function aa(e){var t,r=function(){clearTimeout(n),jo&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);jo&&(t=requestAnimationFrame(r))}function wt(e){var t=U,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),U=t}function Or(e){var t=U;e.__c=e.__(),U=t}function ci(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function li(e,t){return typeof t=="function"?t(e):t}function ui(e,t){for(var r in t)e[r]=t[r];return e}function Dr(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 Ho(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:Dr(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=ui({},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 di(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=ui({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return di(n,t,r)})),e}function pi(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return pi(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 mi(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=W(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",N(_({},s),{ref:u,src:t!=null?t:"",style:_({display:"block",width:"100%",height:"100%",objectFit:"cover",maxWidth:"100%",maxHeight:"100%",borderRadius:"8px"},i||{})}))}):C("div",N(_({},s),{ref:u,className:o,children:r}))}function Na(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,N(_({},o.props),{style:N(_({},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,N(_({},e.props),{style:N(_({},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 xt,x,zo,xe,Io,Qo,Yo,Xo,Fr,Nr,Pr,Ge,Zo,ea,Qe,We,U,Rr,Po,ze,si,L,Oo,Do,Fo,Uo,Mo,Lo,jo,$o,la,da,Jo,Vo,pa,ma,fa,ha,ga,_a,Ko,ka,qo,Go,Wo,wa,Cr,Ta,Sa,Ea,xa,Ia,Ra,Aa,fi,hi,Pa,Oa,Da,Fa,De,Ua,gi,_i=k(()=>{"use strict";Ge={},Zo=[],ea=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qe=Array.isArray;xt=Zo.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}},zo=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),Ro(this))},fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ro(this))},fe.prototype.render=Re,xe=[],Qo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yo=function(e,t){return e.__v.__b-t.__v.__b},Tt.__r=0,Xo=/(PointerCapture)$|Capture$/i,Fr=0,Nr=Co(!1),Pr=Co(!0);ze=0,si=[],L=x,Oo=L.__b,Do=L.__r,Fo=L.diffed,Uo=L.__c,Mo=L.unmount,Lo=L.__;L.__b=function(e){U=null,Oo&&Oo(e)},L.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Lo&&Lo(e,t)},L.__r=function(e){Do&&Do(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(wt),t.__h.forEach(Or),t.__h=[],We=0)),Rr=U},L.diffed=function(e){Fo&&Fo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(si.push(t)!==1&&Po===L.requestAnimationFrame||((Po=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(wt),r.__h=r.__h.filter(function(n){return!n.__||Or(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],L.__e(n,r.__v)}}),Uo&&Uo(e,t)},L.unmount=function(e){Mo&&Mo(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{wt(n)}catch(o){t=o}}),r.__H=void 0,t&&L.__e(t,r.__v))};jo=typeof requestAnimationFrame=="function";(Ho.prototype=new fe).isPureReactComponent=!0,Ho.prototype.shouldComponentUpdate=function(e,t){return Dr(this.props,e)||Dr(this.state,t)};$o=x.__b;x.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),$o&&$o(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)};Jo=x.unmount;x.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Jo&&Jo(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=mi(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]=pi(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]=di(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]};Vo=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=mi(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),Vo(t,e,n)):o()};r?r(i):i()}},yt.prototype.render=function(e){this.i=null,this.l=new Map;var t=St(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){Vo(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})}})});Ko=x.event;x.event=function(e){return Ko&&(e=Ko(e)),e.persist=va,e.isPropagationStopped=ya,e.isDefaultPrevented=ba,e.nativeEvent=e};ka={enumerable:!1,configurable:!0,get:function(){return this.class}},qo=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=St(r.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=St(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,qo&&qo(e)};Go=x.__r;x.__r=function(e){Go&&Go(e),e.__c};Wo=x.diffed;x.diffed=function(e){Wo&&Wo(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]=Bo(t),[u,d]=Bo(null),c=Et(null),p=Et(!1);kt(()=>{let S=document.createElement("style");return S.innerHTML=Ta,document.head.appendChild(S),()=>{document.head.removeChild(S)}},[]),kt(()=>{t!==a&&!p.current&&(l(t),d(t?"enter":"leave"))},[t,a]);let m=ae(()=>{u==="leave"&&(d(null),l(!1),p.current=!1)},[u]),y=ae(S=>{S.preventDefault(),S.stopPropagation(),S.target===c.current&&h()},[]),v=ae(()=>{p.current=!1,l(!0),d("enter")},[]),h=ae(()=>{p.current=!0,d("leave"),r&&r()},[r]),g=ae(()=>a&&!p.current,[a]);if(kt(()=>{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=N(_({},Cr.drawer),{height:typeof n=="number"?`${n}px`:n,backgroundColor:i||"rgba(255, 255, 255, 1)"}),E=_({},Cr.drawerBackdrop),P=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:`${P} ${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:N(_({},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=()=>{No(C(Ea,{ref:u=>{r=u},isOpen:n,onClose:i,height:s()?"90vh":"50vh",backdropColor:e.backdropColor,children:C(xa,N(_({},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(()=>{t.parentNode&&(No(null,t),t.remove())},300)}}},Aa=(e,t={threshold:.6})=>{let r=Et(null),n=Et(!1),o=ae(i=>{let[s]=i;s.isIntersecting&&!n.current?(n.current=!0,e()):s.isIntersecting||(n.current=!1)},[e]);return kt(()=>{if(r.current){let i=new IntersectionObserver(o,t);return i.observe(r.current),()=>{r.current&&i.unobserve(r.current)}}},[o,t]),r};fi=i=>{var s=i,{children:e,fluid:t=!1,className:r="",style:n={}}=s,o=W(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",N(_({className:r,style:a},o),{children:e}))},hi=a=>{var l=a,{children:e,gutter:t=0,justify:r="start",align:n="top",className:o="",style:i={}}=l,s=W(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?Na(e,t):e;return C("div",N(_({className:o,style:c},s),{children:p}))};Pa=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=W(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",N(_({className:l,style:m},d),{children:e}))},Oa=({game:e,layerName:t,routeMode:r,onGameClick:n})=>{var s,a;let o=ae(l=>{l.preventDefault(),n==null||n(e)},[n,e]),i=ae(()=>{},[e,t]);return C(Pa,{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=W(s,["list","routeMode","layerName","onGameClick"]);return C(fi,{className:"w-full max-w-[440px] mx-auto flex-grow overflow-y-auto",children:C(hi,{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),De=(e=>(e.Dismiss="DISMISS",e.Quit="QUIT",e))(De||{}),Ua=e=>{let{games:t,title:r,buttons:n,onClose:o}=e,i=ae(a=>{o==null||o({type:a.type===De.Quit?"quit":"dismiss"})},[]),s=ae(a=>{o==null||o({type:"navigate",data:{game:a}})},[o]);return t.length?C("div",{className:"recommend-panel",style:{backgroundColor:"#1a1a1a",width:"100%",height:"100%"},children:C("div",{className:"container",style:{height:"100%",display:"flex",flexDirection:"column",position:"relative"},children:[C("p",{className:"text-white text-[18px] leading-[24px] text-center py-[20px] px-[10px]",style:{color:"#ffffff",fontSize:"18px",lineHeight:"24px",textAlign:"center",paddingTop:"20px",paddingBottom:"20px",paddingLeft:"10px",paddingRight:"10px"},children:r}),C("div",{style:{flex:1,overflow:"auto",marginBottom:"88px"},children:C(Fa,{list:t||[],routeMode:"REDIRECT",layerName:"RecommendedGuide",onGameClick:s})}),C("div",{className:"pb-[16px] px-[16px] w-full",style:{position:"fixed",bottom:"32px",left:"0",right:"0",width:"100%",maxWidth:"440px",margin:"0 auto",background:"inherit",paddingTop:"16px"},children:C(fi,{children:C(hi,{gutter:10,children:(n!=null?n:[]).map((a,l)=>C("div",{style:{flex:"0 0 50%",boxSizing:"border-box"},children:C("button",{style:{width:"100%",height:"40px",borderRadius:"21px",whiteSpace:"nowrap",lineHeight:"40px",paddingLeft:"8px",paddingRight:"8px",border:"1px solid",borderColor:a.type===De.Quit?"#ffffff30":"#7817FF",backgroundColor:a.type===De.Quit?"#ffffff2c":"#7817FF",color:(a.type,De.Quit,"#fff"),cursor:"pointer",flex:1,textAlign:"center",fontSize:"14px",fontWeight:"normal",outline:"none",overflow:"hidden",textOverflow:"ellipsis"},className:`h-[40px] rounded-[21px] whitespace-nowrap leading-[40px] px-[8px] border-solid border-[1px] flex-1 bg-[#ffffff2c] ${a.type,De.Quit,"active:border-[#7E41FF] border-[#ffffff30]"}`,onClick:()=>i(a),children:a.text})},l))})})})]})}):C(Re,{})},gi=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 vi(){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 Z(t);return jr=r,r})}function yi(){return T(this,null,function*(){let e=new ie,t=yield vi();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:o}=t.data,i=gi({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);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,bi=k(()=>{"use strict";K();V();A();_i();Ke();jr=null;vi();Ma=e=>{var n;let r=`${`https://${e.gameId}.content.jolibox.com`}/?gameId=${w.mpId}&joliSource=${w.encodeJoliSourceQuery({__mpType:"game",__orientation:(n=e.orientation)!=null?n:"VERTICAL"})}`;O("openSchemaSync",{schema:r})}});var wi={};tn(wi,{config:()=>Ha});function La(){pe.on("onDocumentReady",()=>{var e;(e=_e)==null||e.onDocumentReady(window.location.href),Y("onDocumentReady",{start_timestamp:At,timestamp:Date.now()})})}function Ba(e){w.mpType==="game"&&q.start(e)}function ja(){se("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&w.onEnvConfigChanged({hostUserInfo:e}),pe.emit("LifecycleEvent.onReady",_({},w.hostUserInfo?w.hostUserInfo:{isLogin:!1})),Y("joliboxServiceReady",{start_timestamp:At,timestamp:Date.now()}),Ba(t)}),se("onBeforeExit",({uuid:e})=>{var t;(t=_e)==null||t.doExit(e)})}function Ha(){At=Date.now(),ja(),La(),It=wo()}var It,ki,Rt,At,Ti=k(()=>{"use strict";V();lt();K();A();ve();To();Ir();bi();ne.onReady(()=>{});ki=()=>{Y("onBeforeExit",{timestamp:Date.now()}),It==null||It(),q.close(Date.now()-At)};ne.doExit(()=>T(void 0,null,function*(){return Rt?!0:He(w.shouldInterupt)?(w.shouldInterupt||ki(),w.shouldInterupt):(yield yi())?!0:(ki(),!1)}));Rt=!1;Oe.on("isAdShowing",e=>{Rt=e,He(Rt)&&O("updateContainerConfigSync",{displayCapsuleButton:!Rt,webviewId:w.webviewId})})});function Si(e){let t=ar.config[e];return t||(t={},ar.config[e]=t),(r,n)=>{if(t[r]){z.warn(`[can i use] ${r} already registered`);return}t[r]=_({},n)}}var Ei=k(()=>{"use strict";A()});function Hr(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 $r(e){let t=Jr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Jr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var xi,B,Nt,Pt,Ot,Dt,Ue,Ft,Ut,Mt,Lt,Bt,jt,Ht,$t,Jt,Vt,Kt,qt,Vr=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 ${$r(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Ct(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Ct(this._default)}optional(){return this._optional=!0,this}};Nt=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}},Pt=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 ${$r(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(Jr(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(Jr(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:$r(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(`
|
|
56
|
+
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 Kr(e,t,r="param"){if(e.errors=[],e.path=r,Hr(!0),!e.validate(t)){let n=e.errors.join(`
|
|
57
|
+
`);throw e.errors.length=0,Hr(!1),new TypeError(n)}}var f,qr=k(()=>{"use strict";Vr();Vr();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 Pt},string(){return new Ot},number(){return new Nt},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();qr();ge();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{Kr(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:P}=v;l=b,h=E,g=P}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?/,"")}`,H(new Ve(u,d)),{code:l,message:u}}finally{let v=Date.now()-s;e("apiInvoked",N(_({},a),{duration:v,status:l}))}}}function r(n,o){return(...i)=>T(this,null,function*(){var p,m,y,v;let s=cn(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{Kr(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:P}=g;d=b,u=P,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}`,P=`${n}:${d} ${E.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(c,{code:d,message:P}),H(new Ve(P,b)),c}finally{let h=Date.now()-a;e("apiInvoked",N(_({},l),{duration:h,status:d}))}})}return{createAPI:r,createSyncAPI:t}}});var j,F,I,ce=k(()=>{"use strict";Ei();ve();Ri();qr();({createAPI:j,createSyncAPI:F}=Ii(Y)),I=Si("native")});var Ai,Ja,Va,Ka,qa,Ci=k(()=>{"use strict";A();ce();V();Ai=M(),Ja="env",Va="getSystemInfoSync",Ka=F(Va,{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}}}),qa=F(Ja,{implement:()=>{var t;let e=O("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Ai.registerCommand("API.getSystemInfoSync",Ka);Ai.registerCommand("API.env",qa);I("env",{version:"1.0.0"});I("getSystemInfoSync",{version:"1.0.0"})});var Ni=en(Gr=>{"use strict";A();ce();re();V();ve();K();var Ga="exitGame",Wa="onReady",za="onJoliboxShow",Qa="onJoliboxHide",Wt=M(),zt=ot(H),Ya=j(Ga,{paramsSchema:f.tuple(f.function(),f.boolean().optional().default(!1)),implement:(e,t=!1)=>T(Gr,null,function*(){zt(e).call(Gr),He(w.shouldInterupt)&&!w.shouldInterupt&&w.from&&qn("onRetentionResult",{shouldStay:t},w.from,!0),yield Q("exitAppAsync")})}),Xa=F(za,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);se("onJoliboxEnterForeground",()=>{t.call(this),qe.emit("visible",!0)})}}),Za=F(Qa,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);se("onJoliboxEnterBackground",()=>{t.call(this),qe.emit("visible",!1)})}}),ec=F(Wa,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);pe.on("LifecycleEvent.onReady",r=>{t(r)})}});Wt.registerCommand("LifecycleSDK.exit",Ya);Wt.registerCommand("LifecycleSDK.onReady",ec);Wt.registerCommand("LifecycleSDK.onJoliboxShow",Xa);Wt.registerCommand("LifecycleSDK.onJoliboxHide",Za);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 Pi(e){let t={};if(!J(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)||!J(r))return e;let[n,o=""]=e.split("?"),i=JSON.stringify(_(_({},JSON.parse(o)),r));return`${n}?${i}`}var Ui=k(()=>{"use strict";A()});var tc,rc,Wr,zr,Mi,nc,oc,ic,Li=k(()=>{"use strict";ge();Er();ce();Ui();A();re();tc=15,rc=pt("createRequestTaskSync","operateRequestTaskSync",{type:"public"}),Wr=0,zr=[],Mi=ot(H),nc=(e,t)=>{let r=e.filter(t),n=e.filter(o=>!t(o));return e.length=0,e.push(...n),r},oc=e=>{let t=new ie,r=()=>{};return j("request",{paramsSchema:f.tuple(f.object({url:f.string(),method:f.string(),header: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(Wr+=1,t.state!=="pending")return;let{data:u,dataType:d,responseType:c,enableCache:p,appendHostCookie:m}=o,y=Pi(o.header),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 P=rc(g,E);{let{response:R}=yield P,{code:S,data:ee,message:G}=R;t.resolve({code:S!=null?S:"SUCCESS",data:ee,message:G!=null?G:"request:ok"}),b({code:"SUCCESS",message:"request:ok",data:ee})}}catch(u){t.reject(u),s({code:"FAILURE",message:"httpRequst: failed"})}finally{Wr-=1,(l=zr.shift())==null||l()}});return Wr>=tc?(r=()=>{nc(zr,s=>s===i)},zr.push(i)):i(),t.promise}})(e),{abort(){t.reject(Te({code:-1,msg:"request:fail abort"})),r()}}},ic=M();ic.registerCommand("HttpSDK.request",oc);I("request",{version:"1.0.0"})});function dc(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return uc.includes(t)?t:""}function pc(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 mc(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,sc,ac,cc,lc,pm,mm,uc,Bi=k(()=>{"use strict";ce();V();A();Ke();K();Qt=M(),sc=j("getLocalStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let{response:t}=yield Z(`/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 Q("getLocalStorageAsync",{key:e}),a=pc(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",sc);I("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});ac=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 Z(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:i,message:s}}=o,a=dc(t),l=mc(t,a);return yield Q("setLocalStorageAsync",{key:e,data:l,dataType:a}),i=="SUCCESS"?{code:i,message:s}:{code:i,message:`${s}. fallback to native`}})}});Qt.registerCommand("StorageSDK.setItem",ac);I("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});cc=j("removeStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let t=w.mpId,{response:r}=yield Z(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:o}}=r;return yield Q("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:o}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Qt.registerCommand("StorageSDK.removeItem",cc);I("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});lc=j("clearStorage",{implement(){return T(this,null,function*(){let e=w.mpId,{response:t}=yield Z(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});Q("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",lc);I("storage.clear",{version:"1.0.0"});pm=j("getStorageInfo",{implement(){return T(this,null,function*(){let{data:e}=yield Q("getStorageInfoAsync");return e})}});I("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});mm=F("getStorageInfoSync",{implement(){return O("getStorageInfoSync")}}),uc=["string","number","boolean","object",""]});var fc,hc,gc,Qr,ji=k(()=>{"use strict";A();V();ce();fc=F("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",N(_({},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"}});hc=F("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"}}});gc=F("hideKeyboard",{implement(){O("hideKeyboardSync")}});I("keyboard.hideKeyboard",{version:"1.0.0"});Qr=M();Qr.registerCommand("KeyboardSDK.showKeyboard",fc);Qr.registerCommand("KeyboardSDK.updateKeyboard",hc);Qr.registerCommand("KeyboardSDK.hideKeyboard",gc)});var Hi=en(Ae=>{"use strict";A();ce();ve();var Me=M(),_c=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(q.tracker("LevelFinished",{levelId:e,result:r,duration:n})),o.push(q.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),vc=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 q.reportToNative({event:"TaskFinished",params:{duration:r,taskId:e}})})}),yc=j("levelUpgrade",{paramsSchema:f.tuple(f.string(),f.string()),implement:(e,t)=>T(Ae,null,function*(){let r=[];r.push(q.reportToNative({event:"LevelUpgrade",params:{name:t,levelId:e}})),yield Promise.all(r)})}),bc=j("onHistoryUserLevel",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield q.reportToNative({event:"HistoryUserLevel",params:{level:e}})})}),kc=j("onHistoryUserScore",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield q.reportToNative({event:"HistoryUserScore",params:{score:e}})})}),wc=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(q.reportToNative({event:"TaskEvent",params:_({taskId:e},t)})),(o=(n=t.tools)==null?void 0:n.length)!=null&&o&&(r.push(q.reporter({event:"USE_GAME_ITEM"})),r.push(q.reportToNative({event:"UseGameItem",params:_({taskId:e},t)}))),yield Promise.all(r)})});Me.registerCommand("TaskTrackerSDK.levelFinished",_c);Me.registerCommand("TaskTrackerSDK.taskFinished",vc);Me.registerCommand("TaskTrackerSDK.levelUpgrade",yc);Me.registerCommand("TaskTrackerSDK.historyUserLevel",bc);Me.registerCommand("TaskTrackerSDK.historyUserScore",kc);Me.registerCommand("TaskTrackerSDK.taskEvent",wc);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 Tc,Sc,$i,Ji=k(()=>{"use strict";K();V();ce();A();ge();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"}});Tc=j("login",{implement(){return T(this,null,function*(){var s;let{data:{isLogin:e}}=yield Q("checkLoginAsync");if(e)return{isLogin:!0,token:(s=w.hostUserInfo)==null?void 0:s.token};se("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 Te({code:-1,msg:"login failed"});let{promise:n,resolve:o}=new ie,i=yield n;return w.onEnvConfigChanged({hostUserInfo:i}),pe.emit("onLoginComplete",i),i})}}),Sc=j("checkSession",{implement(){return T(this,null,function*(){let{data:{isLogin:e}}=yield Q("checkLoginAsync");return{isLogin:e}})}}),$i=M();$i.registerCommand("API.login",Tc);$i.registerCommand("API.checkSession",Sc)});var Yt,Ec,Xt,xc,Ic,Rc,Ac,Vi=k(()=>{"use strict";A();ce();Ir();ve();Ke();V();Yt=M(),Ec=()=>{let{data:e}=O("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},Xt=new _t(Y,{get:(e,t)=>Z(e,_({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t,r)=>Z(e,_({method:"POST",responseType:"json",appendHostCookie:!0},r)).then(n=>n.response.data)},Ec),xc=F("adInit",{implement:e=>{Xt.init(e)}}),Ic=F("adConfig",{implement:e=>{Xt.adConfig(e)}}),Rc=F("adBreak",{implement:e=>{Xt.adBreak(e)}}),Ac=F("adUnit",{implement:e=>{Xt.adUnit(e)}});Yt.registerCommand("AdsSDK.init",xc);Yt.registerCommand("AdsSDK.adConfig",Ic);Yt.registerCommand("AdsSDK.adBreak",Rc);Yt.registerCommand("AdsSDK.adUnit",Ac);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 Yr,Cc,Nc,Pc,Ki=k(()=>{"use strict";A();V();ce();K();Yr=M(),Cc=F("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)}}),Nc=F("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}}}),Pc=F("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)}});Yr.registerCommand("RouterSDK.openSchema",Cc);Yr.registerCommand("RouterSDK.openPage",Nc);Yr.registerCommand("RouterSDK.closePage",Pc);I("router.openSchema",{version:"1.1.10"});I("router.openPage",{version:"1.1.10"});I("router.closePage",{version:"1.1.10"})});var Oc={};var Qm,ef,qi=k(()=>{"use strict";Ci();Qm=rn(Ni());Li();Bi();ji();ef=rn(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(),Oc)),Promise.resolve().then(()=>(ve(),ko))]);e()});
|
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.6 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.11-beta.
|
|
7
|
+
> @jolibox/implement@1.1.11-beta.6 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.11-beta.
|
|
4
|
+
"version": "1.1.11-beta.6",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.1.11-beta.
|
|
10
|
-
"@jolibox/types": "1.1.11-beta.
|
|
9
|
+
"@jolibox/common": "1.1.11-beta.6",
|
|
10
|
+
"@jolibox/types": "1.1.11-beta.6",
|
|
11
11
|
"localforage": "1.10.0",
|
|
12
|
+
"@jolibox/ui": "1.0.0",
|
|
12
13
|
"web-vitals": "4.2.4"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
package/src/common/ads/index.ts
CHANGED
|
@@ -509,12 +509,16 @@ export class JoliboxAdsImpl {
|
|
|
509
509
|
this.antiCheating.report(reason);
|
|
510
510
|
return;
|
|
511
511
|
case 'HOLDING_HIGH_FREQ':
|
|
512
|
+
// follow google's style to forbid high freq request
|
|
512
513
|
params.adBreakDone?.({
|
|
513
|
-
breakType: params.type,
|
|
514
514
|
breakFormat: params.type === 'reward' ? 'reward' : 'interstitial',
|
|
515
|
-
|
|
515
|
+
breakName: '',
|
|
516
|
+
breakStatus: (info?.count ?? 0) > 6 ? 'other' : 'frequencyCapped',
|
|
517
|
+
breakType: params.type
|
|
516
518
|
});
|
|
517
|
-
|
|
519
|
+
// every 3 hit, report to anti-cheating system
|
|
520
|
+
// if a user click 1 time every 1 second, it will cause 20 reports for 1 minute
|
|
521
|
+
if (info?.count && info.count !== 0 && info.count % 3 === 0) {
|
|
518
522
|
this.antiCheating.report(reason, info?.count);
|
|
519
523
|
}
|
|
520
524
|
return;
|
|
@@ -105,11 +105,10 @@ const wrapContext = () => {
|
|
|
105
105
|
},
|
|
106
106
|
encodeJoliSourceQuery: (newPayloadJson: QueryParams['payloadJson']) => {
|
|
107
107
|
if (headerJson && signature) {
|
|
108
|
-
return encodeJoliSourceQuery(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
108
|
+
return encodeJoliSourceQuery(
|
|
109
|
+
{ ...payloadJson, ...newPayloadJson },
|
|
110
|
+
urlParams.get('joliSource') ?? ''
|
|
111
|
+
);
|
|
113
112
|
}
|
|
114
113
|
return urlParams.get('joliSource') ?? '';
|
|
115
114
|
}
|
|
@@ -76,10 +76,13 @@ export const parseUrlQuery = (url: string): QueryParams => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
export const encodeJoliSourceQuery = (
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
export const encodeJoliSourceQuery = (payloadJson: PayloadJson, originJoliSource: string): string => {
|
|
80
|
+
const joli_source = originJoliSource.split('.');
|
|
81
|
+
if (joli_source && joli_source.length === 3) {
|
|
82
|
+
const headerJsonStr = joli_source[0];
|
|
83
|
+
const payloadJsonStr = base64UrlEncode(payloadJson);
|
|
84
|
+
const signatureJsonStr = joli_source[2];
|
|
85
|
+
return `${headerJsonStr}.${payloadJsonStr}.${signatureJsonStr}`;
|
|
86
|
+
}
|
|
87
|
+
return originJoliSource;
|
|
85
88
|
};
|