@jolibox/implement 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
|
|
5
5
|
"packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
|
|
6
6
|
"packages/implement/esbuild.config.js": "876db4e384d8543b66a0b61d8f7b277a36dfb4e0",
|
|
7
|
-
"packages/implement/package.json": "
|
|
7
|
+
"packages/implement/package.json": "99dcdbecbfbbde7b4165610ceacaac3cfea17d06",
|
|
8
8
|
"packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
|
|
9
9
|
"packages/implement/src/common/ads/anti-cheating.test.ts": "e2ff3dc6760cfd28d0f8c15703d7fb20d43df583",
|
|
10
10
|
"packages/implement/src/common/ads/anti-cheating.ts": "a3ffb6a78e289e1c0ce45c7f7c0cee000e75e541",
|
|
@@ -153,14 +153,14 @@
|
|
|
153
153
|
"packages/implement/src/native/rewards/check-frequency.ts": "8680a102e765fc0e4deec42e6b12a313d2ff575f",
|
|
154
154
|
"packages/implement/src/native/rewards/index.ts": "f45622ed8c07fa53e5213fca6b439b03ab81e0da",
|
|
155
155
|
"packages/implement/src/native/rewards/ui/payment-modal.ts": "42a577caa41abe01e40cf113dcbe242e80079e25",
|
|
156
|
-
"packages/implement/src/native/rewards/ui/subscription-modal.ts": "
|
|
156
|
+
"packages/implement/src/native/rewards/ui/subscription-modal.ts": "d3fac293c302ddb4bcc3a6bf49dc5e087d5f03f6",
|
|
157
157
|
"packages/implement/src/native/rewards/ui/unlogin-modal.ts": "da6f18bd2cc575592e216fed584d09f6765f1e96",
|
|
158
158
|
"packages/implement/src/native/rewards/ui/use-modal.ts": "7ec80b389daac9660c20c46979e875fc00ebd0ac",
|
|
159
159
|
"packages/implement/src/native/rewards/ui/utils.ts": "4ac58033bd35757b9519c1490abb70c4e6af66af",
|
|
160
160
|
"packages/implement/src/native/rewards/utils.ts": "af00dd225556ab61332cb2cbf5e8da426136bc0b",
|
|
161
161
|
"packages/implement/src/native/subscription/index.ts": "c2583698dbe32520c475d9ca504cf062cf50b2a3",
|
|
162
162
|
"packages/implement/src/native/subscription/registers/base.ts": "a8034966b4db4c1e6883104900f27b28cfe1d586",
|
|
163
|
-
"packages/implement/src/native/subscription/registers/sub-app.ts": "
|
|
163
|
+
"packages/implement/src/native/subscription/registers/sub-app.ts": "15a677ef1b7202b0166e843c0de5e765114bf3ef",
|
|
164
164
|
"packages/implement/src/native/subscription/registers/type.ts": "ebfdd101a297bb86e9dc4ea2c320065c1252f7c5",
|
|
165
165
|
"packages/implement/src/native/subscription/subscription-helper.ts": "5c7f3d52b0c0ec9899f6542c5aec21c2e4d7cf9f",
|
|
166
166
|
"packages/implement/src/native/subscription/subscription-service.ts": "26336a186d5ef4bfaa12aad5527eb45ef108083d",
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Hf=Object.create;var Wi=Object.defineProperty,qf=Object.defineProperties,Vf=Object.getOwnPropertyDescriptor,$f=Object.getOwnPropertyDescriptors,Kf=Object.getOwnPropertyNames,nn=Object.getOwnPropertySymbols,Ks=Object.getPrototypeOf,zi=Object.prototype.hasOwnProperty,Ws=Object.prototype.propertyIsEnumerable,Wf=Reflect.get;var $s=(e,t,r)=>t in e?Wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,z=(e,t)=>{for(var r in t||(t={}))zi.call(t,r)&&$s(e,r,t[r]);if(nn)for(var r of nn(t))Ws.call(t,r)&&$s(e,r,t[r]);return e},Re=(e,t)=>qf(e,$f(t));var gr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var zs=(e,t)=>{var r={};for(var n in e)zi.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nn)for(var n of nn(e))t.indexOf(n)<0&&Ws.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kf(t))!zi.call(e,i)&&i!==r&&Wi(e,i,{get:()=>t[i],enumerable:!(n=Vf(t,i))||n.enumerable});return e};var Xi=(e,t,r)=>(r=e!=null?Hf(Ks(e)):{},zf(t||!e||!e.__esModule?Wi(r,"default",{value:e,enumerable:!0}):r,e));var Ys=(e,t,r)=>Wf(Ks(e),r,t);var A=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function nh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function oa(e){return typeof e=="string"}function nl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function il(e){return typeof e=="object"&&Array.isArray(e)}function ih(e){return typeof e=="undefined"}function ah(e){return ih(e)||e===null}function oh(e){return typeof e=="function"}function al(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function ol(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,a){for(let o in a)if(Object.prototype.hasOwnProperty.call(a,o)){let s=i[o],l=a[o],c=r(s,l,o,i,a);c!==void 0?i[o]=c:Zs(l)&&Zs(s)?i[o]=n(aa({},s),l):Array.isArray(l)&&Array.isArray(s)?i[o]=[...s,...l]:i[o]=l}return i}return n(e,t)}function Zs(e){return e&&typeof e=="object"&&e.constructor===Object}function sl(e,t){if(Array.isArray(e))return e.concat(t)}function wr(e,t,r={}){let n=null,i,a,o,{leading:s=!1,trailing:l=!0}=r,c=()=>(o=e.apply(a,i),i=void 0,a=void 0,o),p=function(...u){i=u,a=this;let m=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!m&&c()},t),m)return c()};return p.cancel=()=>{n&&clearTimeout(n),n=null,i=a=void 0},p.flush=()=>{if(n)return clearTimeout(n),n=null,c()},p}function ch(e,t){return(...r)=>t(e,...r)}function ul(e){return t=>ch(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new lh(`${i}`))}})}function _r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function an(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,a)=>(i[a]=String(n[a]),i),{})}return e[r]})}function ph(e){let t=e.location?an(e.location,tl):null,r=e.target?an(e.target,tl):null;return an(th(aa({},e),{location:t,target:r}),hh)}function ua(e){let t=e.events.map(n=>ph(n)),r=an(e.device,mh);return[e.protocolVersion,t,r,e.project]}function vh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function ma(e,t,r){let n=window.location.hostname,i=n.split("."),a=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${a}.jolibox.com`;if(i.length>=2){let o=i.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com"||o==="mporia.com"||o==="pingplus.ai")return`${a}.${o}`}return`${a}.jolibox.com`}function ml(e){return ma("app","stg-app",e)}function Kt(e){return`https://${ma("api","stg-api",e)}`}function Ih(e){return ma("collect","stg-collect",e)}function pl(e){return`https://${Ih(e)}`}function Rh(e){return new Promise(t=>vl(e)(t))}function vl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Oh(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new br(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function Th(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xh(e[n],t[n])}function xh(e,t){if(oa(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(oh(t)){try{if(e instanceof t)return}catch(r){}if(!ah(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 Ph(){return typeof globalThis!="undefined"?globalThis[gl]:void 0}function Nh(e){typeof globalThis!="undefined"&&(globalThis[gl]=e)}function we(e=!1){let t=Ph();if(!e&&t)return t;let r=new on,n=new na,i={registerCommand(a,o,s){r.registerCommand({id:a,handler:o,metadata:s})},executeCommand(a,...o){return n.executeCommand(a,...o)},excuteCommandSync(a,...o){return n.executeCommandThowErr(a,...o)}};return Nh(i),i}var ia,Yf,Xf,Qf,Xs,Zf,eh,Qs,aa,th,rh,rl,Ot,sh,sa,la,ll,cl,lh,dl,sn,ln,ca,Be,Zi,dh,da,el,uh,kt,$t,fh,tl,hh,mh,$e,Vt,gh,Oe,_h,yh,bh,fl,fa,ha,wh,Eh,hl,Tt,ea,ae,Ah,Sh,yr,br,ze,ra,Ch,Qi,kh,bt,on,na,gl,q=re(()=>{"use strict";ia=Object.defineProperty,Yf=Object.defineProperties,Xf=Object.getOwnPropertyDescriptor,Qf=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable,Qs=(e,t,r)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aa=(e,t)=>{for(var r in t||(t={}))Zf.call(t,r)&&Qs(e,r,t[r]);if(Xs)for(var r of Xs(t))eh.call(t,r)&&Qs(e,r,t[r]);return e},th=(e,t)=>Yf(e,Qf(t)),rh=(e,t)=>{for(var r in t)ia(e,r,{get:t[r],enumerable:!0})},rl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Xf(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ia(t,r,i),i},Ot=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}sh=(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))(sh||{}),sa=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}},la=class extends sa{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},ll=class extends sa{constructor(){super(...arguments),this.kind="USER_ERROR"}},cl=class extends ll{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},lh=class extends ll{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))}},dl=class extends la{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},sn=class extends la{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},ln=class extends sa{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},ca=class extends la{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Be={log:_r("log"),warn:_r("warn"),info:_r("info"),error:_r("error"),debug:_r("debug")};Object.assign(globalThis,{logger:Be});Zi=Symbol.for("Jolibox.canIUseMap"),dh={};globalThis[Zi]||(globalThis[Zi]=dh);da={get config(){return globalThis[Zi]}},el=Symbol.for("Jolibox.canIUseMap.native"),uh={};globalThis[el]||(globalThis[el]=uh);kt=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(kt||{}),$t=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))($t||{}),fh=(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))(fh||{}),tl=["name","params"],hh=["name","type","location","target","extra","timestamp","userId"],mh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];$e=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});vh();Vt=typeof window=="undefined",gh=()=>!Vt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Oe={isiOS:!Vt&&(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:!Vt&&navigator.userAgent.includes("Android"),isMac:!Vt&&navigator.userAgent.includes("Mac"),isFacebook:!Vt&&navigator.userAgent.includes("FB_IAB"),isPC:!Vt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},_h=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",yh="device_id",bh="advertising_id",fl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,$e()),window.__joliboxLocalStorage__.getItem(e)),fa=()=>new URLSearchParams(window.location.search).get("deviceId")||fl(yh),ha=()=>new URLSearchParams(window.location.search).get("advertisingId")||fl(bh),wh=e=>e.charAt(0).toUpperCase()+e.slice(1),Eh=()=>{var e;let t=new URLSearchParams(window.location.search);return wh((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},hl=e=>{if(gh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=_h(),n=navigator.language,i=fa(),a=ha();return`${t} (${Eh()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${a} version/${e||""}`};Tt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=aa({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),a=this.createTimeoutPromise(),o=Promise.race([i,a]).catch(s=>Ot(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,o),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield o}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Ot(this,null,function*(){var r,n,i,a;let o=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(o);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),m=this.requestAdapter.extractRealTimeData(u),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(o,h,s),u):this.requestAdapter.mergeData(l,m)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),p=(a=(i=this.requestAdapter).extractCacheableData)==null?void 0:a.call(i,c);return p&&this.setCachedDataWithSequence(o,p,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let a=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:a,expiresAt:a+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Ot(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),a=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${a})`);let o=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,o);return s&&(this.setCachedDataWithSequence(i,s,a),console.log(`[RequestCacheService] Force updated cache for ${e}`)),o})}warmupCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},ea=class ta{constructor(t){this.element=t,this.next=ta.Undefined,this.prev=ta.Undefined}};ea.Undefined=new ea(void 0);ae=ea,Ah=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},Sh=0,yr=class{constructor(e){this.value=e,this.id=Sh++}},br=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 yr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,a,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new yr(t);return this._listeners?this._listeners instanceof yr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(o=(a=this.options)==null?void 0:a.onDidFirstListener)==null||o.call(a,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var p,u,m,h;if(!this._disposed){if(this._listeners instanceof yr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||u.call(p));else if(this._listeners){let w=this._listeners.indexOf(c);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((h=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||h.call(m)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof yr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ze=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new br,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new Ah,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},ra={};rh(ra,{None:()=>Ch,filter:()=>Oh,once:()=>vl,toPromise:()=>Rh});Ch=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Qi=Symbol.for("Jolibox.hostEmitter"),kh=()=>{let e=new ze;return globalThis[Qi]||(globalThis[Qi]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Qi]},bt=kh();on=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new br,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return Th(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};on=rl([al],on);na=class{constructor(){this._onWillExecuteCommand=new br,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new br,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new on,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nh(3e4)),this._starActivation}executeCommand(e,...t){return Ot(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ra.toPromise(ra.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}}};na=rl([al],na);gl=Symbol.for("Jolibox.commands")});function Me(e,t={}){pa.emit("ERROR_REPORT",{error:e,options:t})}var pa,xt,rt=re(()=>{"use strict";q();q();pa=new ze,xt=new ze;Me.debounce=wr(Me,50,{leading:!0})});var va,Dh,_l,yl,bl=re(()=>{"use strict";q();rt();va=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},Dh=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},_l=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[a,o,s]=i;return{headerJson:va(a),payloadJson:va(o),signature:va(s)}}else throw"joli_source is missing"}catch(r){return Me(new dl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},yl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Dh(e),a=r[2];return`${n}.${i}.${a}`}return t}});var Lh,cn,wl,ga=re(()=>{"use strict";q();Lh="1.3.6",cn=()=>Lh,wl=()=>{let e=cn();return`${hl(e)}`}});function ya(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var Uh,El,_a,Il,oe,Bh,D,he=re(()=>{"use strict";q();bl();ga();q();Uh={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:fa(),adId:ha(),pixelRatio:window.devicePixelRatio||1,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:cn()},schema:window.location.href,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5"},_a=(El=globalThis.joliboxJSCore)==null?void 0:El.env,oe=Object.assign({},(Il=_a==null?void 0:_a())!=null?Il:Uh);Bh=()=>{var E,I,b,R,k,L,J,S,N,F,H;let{payloadJson:e,headerJson:t,signature:r}=oe.schema.length?_l(oe.schema):{},n=`${oe.deviceInfo.did}-${new Date().getTime()}`,a=new URL(oe.schema.length?oe.schema:window.location.href).searchParams,o=(b=(I=(E=a.get("mpId"))!=null?E:a.get("appId"))!=null?I:a.get("gameId"))!=null?b:"",s=(L=(k=(R=oe.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?k:a.get("sessionId"))!=null?L:n,l=!!((S=(J=e==null?void 0:e.testAdsMode)!=null?J:e==null?void 0:e.__testAdsMode)!=null?S:a.get("testAdsMode")==="true"),c=(H=(F=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?F:a.get("joliboxEnv"))!=null?H:"production",p=c==="staging",u=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,w=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return p},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=h.get("joliSource"))!=null?U:a.get("joliSource"))!=null?G:null},get mpId(){var U;return(U=o!=null?o:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:cn()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=oe.platform)!=null?U:oe.deviceInfo.platform).toLowerCase()},get deviceInfo(){return oe.deviceInfo},get sdkInfo(){return oe.sdkInfo},get hostInfo(){return oe.hostInfo},get hostUserInfo(){return oe.hostUserInfo},get sessionId(){var U,G;return(G=(U=oe.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return u},get webviewId(){var U;return(U=oe.webviewId)!=null?U:-1},get shouldInterupt(){return w},get from(){return e==null?void 0:e.__from},get baseApiHost(){return ml(p)},get adId(){var U;return(U=oe.deviceInfo.adId)!=null?U:oe.deviceInfo.did},get language(){return oe.deviceInfo.lang},get sdkEnvironment(){return ya("dlightek","jolibox")?"dlightek":a.get("huaweiQuick")==="true"?"huaweiQuick":ya("gamedistribution","jolibox")?"gamedistribution":ya("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var $,Y,Ue;let U=($=oe.deviceInfo.pixelRatio)!=null?$:1,G=(Y=oe.deviceInfo.statusBarHeight)!=null?Y:e==null?void 0:e.__androidStatusBarHeight,B=(Ue=oe.deviceInfo.navigationBarHeight)!=null?Ue:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:B!==void 0?B/U:10}},get abTests(){var U,G;return(G=(U=oe.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=oe.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{ol(oe,U,sl)},encodeJoliSourceQuery:U=>{var G,B;return t&&r?yl(z(z({},e),U),(G=a.get("joliSource"))!=null?G:""):(B=a.get("joliSource"))!=null?B:""},setDoExitDirectly:()=>{w=!1}}},D=Bh()});var ba,Sl,Mh,Gh,Al,Jh,Cl=re(()=>{"use strict";q();rt();he();q();ba=!1,Sl=(e,t)=>e==null?!1:t in e,Mh=e=>Sl(e,"kind"),Gh=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Al=(e,t={},r)=>{var a,o,s;let n={user_id:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:"",device_id:(s=D.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:Gh(e.name)},i=Re(z({},n),{env:t.environment,isFromUser:r});r?xt.emit("GLOBAL_USER_ERROR",e,i):xt.emit("GLOBAL_ERROR",e,i)},Jh=e=>Sl(e,"kind")&&e.kind==="USER_ERROR";pa.on("ERROR_REPORT",({error:e,options:t})=>{if(ba)return;ba=!0;let r=Mh(e)&&e.raw?e.raw:e;try{let n=Jh(e);Al(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),a=new ca(`${i}, origin error: ${r.message}`);Be.error(a),Al(new ca(a.message),{environment:t.environment},!1)}finally{ba=!1}})});var wa,Ea=re(()=>{"use strict";rt();q();rt();wa=e=>new cl(e)});function Rl(e,t){let r=(n,i,a)=>{let c=i!=null?i:{},{eventType:o}=c,s=zs(c,["eventType"]),l=Re(z({tag:n,eventType:a!=null?a:o!=null?o:kt.Other},t),{extra:z({},s)});n=="globalJsError"?Me(new sn(JSON.stringify(l))):e("systemLog",l,D.webviewId)};return r.debounce=wr(r,500,{leading:!0}),r}function Ol(e){let t=(r,n,i)=>{var s;let a=(s=i&&JSON.stringify(i))!=null?s:0,o={speed_value_type:r,total_duration:n};a&&Object.assign(o,{extra:a}),e("joliboxSpeedAnalysis",o)};return t.debounce=wr(t,500,{leading:!0}),t}var kl=re(()=>{"use strict";q();q();rt();he()});function Tl(e,t){let r=Rl(e,t),n=Ol(r);return{track:r,trackPerformance:n}}var xl=re(()=>{"use strict";kl()});var Ia=re(()=>{"use strict"});var dn,Pl=re(()=>{"use strict";he();q();q();dn=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return A(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,a,o,s;let{nativeSDKVersion:t,jssdkVersion:r}=D.sdkInfo;return{platform:1e3,os:D.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(a=(i=D.hostInfo)==null?void 0:i.aid)!=null?a:"1",model:(o=D.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=D.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:D.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return A(this,null,function*(){var u;if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),a=t.target||null,o=t.extra||null,{hostUserInfo:s}=D;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,p={protocolVersion:"1.0.0",events:[Re(z({},t),{location:i,target:a,extra:o,timestamp:Date.now(),userId:(u=s==null?void 0:s.uid)!=null?u:null})],device:l,project:r};try{n?yield this.doReport(ua(p),n):yield this.doReport(ua(p))}catch(m){Be.log("[Jolibox SDK] report API error",m)}})}}});var Aa=re(()=>{"use strict";xl();Ia();Pl()});var Sa,Nl,nt,un,Ke,Wt=re(()=>{"use strict";ga();he();q();Sa=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Nl=AbortSignal.timeout)!=null||(AbortSignal.timeout=Sa);nt=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new un(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},un=class{constructor(t){this.xua=wl();this.getJoliSource=()=>D.joliSource;var n;let r=Kt(D.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return A(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:a}=r!=null?r:{},o=n?new URLSearchParams(n):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,p=this.getJoliSource();a=Object.assign({},a!=null?a:{},c?{"x-user-agent":c}:{},p?{"x-joli-source":p}:{});let u=yield fetch(l,{method:"GET",headers:a,credentials:"include",signal:Sa(i!=null?i:3e4)});return nt.getInstance().recordNetworkRequest(!0),yield u.json()}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{},{"x-os-type":Oe.isAndroid?"ANDROID":Oe.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let m=yield fetch(c,{method:"POST",headers:o,body:JSON.stringify(n),signal:Sa(a!=null?a:3e4),credentials:"include"});nt.getInstance().recordNetworkRequest(!0);let h=m.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return m.blob()}catch(w){return yield m.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return m.formData()}catch(w){return yield m.text()}if(h!=null&&h.includes("application/json"))try{return yield m.json()}catch(w){return yield m.text()}return m}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{});let m=yield fetch(c,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!m.ok)throw nt.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${m.status}`);return nt.getInstance().recordNetworkRequest(!0),yield m.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=un;Ke=nt.getInstance()});var Ca,fn,Ra=re(()=>{"use strict";he();Aa();Wt();q();Ca=class extends dn{constructor(){super(...arguments);this.httpClient=Ke.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return pl((r=D.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},fn=new Ca(Kt(D.testMode))});var Fh,Dl=re(()=>{"use strict";Cl();q();Ea();q();Ra();he();Fh=(e,t)=>{var i,a,o;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:kt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:null};fn.trackEvent(n,$t.WebSDK)};xt.on("GLOBAL_ERROR",(e,t)=>{Fh(t.tag,e)});xt.on("GLOBAL_USER_ERROR",(e,t)=>{Be.log("UserError",e,t)})});var hn,Ll=re(()=>{"use strict";hn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(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.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{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.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,a=!1,o=0,s=()=>{if(!a)return;let h=Date.now(),w=h-r;w>=this.interval&&(this.visible&&(o+=Math.min(w,this.interval+1e3),t(o)),r=h),n=requestAnimationFrame(s)},l=()=>{p(),r=Date.now(),i=window.setInterval(()=>{if(!a)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},p=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{a&&(console.log("visible",h),h?c():l())});let m=this.visible;return{start(){a||(a=!0,m?c():l())},stop(){a=!1,p(),u()}}}}});var Ul,Bl=re(()=>{"use strict";Ul=`-----BEGIN PUBLIC KEY-----
|
|
1
|
+
var Hf=Object.create;var Wi=Object.defineProperty,qf=Object.defineProperties,Vf=Object.getOwnPropertyDescriptor,$f=Object.getOwnPropertyDescriptors,Kf=Object.getOwnPropertyNames,nn=Object.getOwnPropertySymbols,Ks=Object.getPrototypeOf,zi=Object.prototype.hasOwnProperty,Ws=Object.prototype.propertyIsEnumerable,Wf=Reflect.get;var $s=(e,t,r)=>t in e?Wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,z=(e,t)=>{for(var r in t||(t={}))zi.call(t,r)&&$s(e,r,t[r]);if(nn)for(var r of nn(t))Ws.call(t,r)&&$s(e,r,t[r]);return e},Re=(e,t)=>qf(e,$f(t));var gr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var zs=(e,t)=>{var r={};for(var n in e)zi.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nn)for(var n of nn(e))t.indexOf(n)<0&&Ws.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var Yi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kf(t))!zi.call(e,i)&&i!==r&&Wi(e,i,{get:()=>t[i],enumerable:!(n=Vf(t,i))||n.enumerable});return e};var Xi=(e,t,r)=>(r=e!=null?Hf(Ks(e)):{},zf(t||!e||!e.__esModule?Wi(r,"default",{value:e,enumerable:!0}):r,e));var Ys=(e,t,r)=>Wf(Ks(e),r,t);var A=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});function nh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function oa(e){return typeof e=="string"}function nl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function il(e){return typeof e=="object"&&Array.isArray(e)}function ih(e){return typeof e=="undefined"}function ah(e){return ih(e)||e===null}function oh(e){return typeof e=="function"}function al(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function ol(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,a){for(let o in a)if(Object.prototype.hasOwnProperty.call(a,o)){let s=i[o],l=a[o],c=r(s,l,o,i,a);c!==void 0?i[o]=c:Zs(l)&&Zs(s)?i[o]=n(aa({},s),l):Array.isArray(l)&&Array.isArray(s)?i[o]=[...s,...l]:i[o]=l}return i}return n(e,t)}function Zs(e){return e&&typeof e=="object"&&e.constructor===Object}function sl(e,t){if(Array.isArray(e))return e.concat(t)}function wr(e,t,r={}){let n=null,i,a,o,{leading:s=!1,trailing:l=!0}=r,c=()=>(o=e.apply(a,i),i=void 0,a=void 0,o),p=function(...u){i=u,a=this;let m=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!m&&c()},t),m)return c()};return p.cancel=()=>{n&&clearTimeout(n),n=null,i=a=void 0},p.flush=()=>{if(n)return clearTimeout(n),n=null,c()},p}function ch(e,t){return(...r)=>t(e,...r)}function ul(e){return t=>ch(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new lh(`${i}`))}})}function _r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function an(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,a)=>(i[a]=String(n[a]),i),{})}return e[r]})}function ph(e){let t=e.location?an(e.location,tl):null,r=e.target?an(e.target,tl):null;return an(th(aa({},e),{location:t,target:r}),hh)}function ua(e){let t=e.events.map(n=>ph(n)),r=an(e.device,mh);return[e.protocolVersion,t,r,e.project]}function vh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function ma(e,t,r){let n=window.location.hostname,i=n.split("."),a=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${a}.jolibox.com`;if(i.length>=2){let o=i.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com"||o==="mporia.com"||o==="pingplus.ai")return`${a}.${o}`}return`${a}.jolibox.com`}function ml(e){return ma("app","stg-app",e)}function Kt(e){return`https://${ma("api","stg-api",e)}`}function Ih(e){return ma("collect","stg-collect",e)}function pl(e){return`https://${Ih(e)}`}function Rh(e){return new Promise(t=>vl(e)(t))}function vl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function Oh(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(a.fire,a)}},a=new br(i);return a.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function Th(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xh(e[n],t[n])}function xh(e,t){if(oa(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(oh(t)){try{if(e instanceof t)return}catch(r){}if(!ah(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 Ph(){return typeof globalThis!="undefined"?globalThis[gl]:void 0}function Nh(e){typeof globalThis!="undefined"&&(globalThis[gl]=e)}function we(e=!1){let t=Ph();if(!e&&t)return t;let r=new on,n=new na,i={registerCommand(a,o,s){r.registerCommand({id:a,handler:o,metadata:s})},executeCommand(a,...o){return n.executeCommand(a,...o)},excuteCommandSync(a,...o){return n.executeCommandThowErr(a,...o)}};return Nh(i),i}var ia,Yf,Xf,Qf,Xs,Zf,eh,Qs,aa,th,rh,rl,Ot,sh,sa,la,ll,cl,lh,dl,sn,ln,ca,Be,Zi,dh,da,el,uh,kt,$t,fh,tl,hh,mh,$e,Vt,gh,Oe,_h,yh,bh,fl,fa,ha,wh,Eh,hl,Tt,ea,ae,Ah,Sh,yr,br,ze,ra,Ch,Qi,kh,bt,on,na,gl,q=re(()=>{"use strict";ia=Object.defineProperty,Yf=Object.defineProperties,Xf=Object.getOwnPropertyDescriptor,Qf=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable,Qs=(e,t,r)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aa=(e,t)=>{for(var r in t||(t={}))Zf.call(t,r)&&Qs(e,r,t[r]);if(Xs)for(var r of Xs(t))eh.call(t,r)&&Qs(e,r,t[r]);return e},th=(e,t)=>Yf(e,Qf(t)),rh=(e,t)=>{for(var r in t)ia(e,r,{get:t[r],enumerable:!0})},rl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Xf(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ia(t,r,i),i},Ot=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{s(r.next(l))}catch(c){i(c)}},o=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,o);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}sh=(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))(sh||{}),sa=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}},la=class extends sa{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},ll=class extends sa{constructor(){super(...arguments),this.kind="USER_ERROR"}},cl=class extends ll{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},lh=class extends ll{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))}},dl=class extends la{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},sn=class extends la{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},ln=class extends sa{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},ca=class extends la{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Be={log:_r("log"),warn:_r("warn"),info:_r("info"),error:_r("error"),debug:_r("debug")};Object.assign(globalThis,{logger:Be});Zi=Symbol.for("Jolibox.canIUseMap"),dh={};globalThis[Zi]||(globalThis[Zi]=dh);da={get config(){return globalThis[Zi]}},el=Symbol.for("Jolibox.canIUseMap.native"),uh={};globalThis[el]||(globalThis[el]=uh);kt=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(kt||{}),$t=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))($t||{}),fh=(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))(fh||{}),tl=["name","params"],hh=["name","type","location","target","extra","timestamp","userId"],mh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];$e=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});vh();Vt=typeof window=="undefined",gh=()=>!Vt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Oe={isiOS:!Vt&&(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:!Vt&&navigator.userAgent.includes("Android"),isMac:!Vt&&navigator.userAgent.includes("Mac"),isFacebook:!Vt&&navigator.userAgent.includes("FB_IAB"),isPC:!Vt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},_h=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",yh="device_id",bh="advertising_id",fl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,$e()),window.__joliboxLocalStorage__.getItem(e)),fa=()=>new URLSearchParams(window.location.search).get("deviceId")||fl(yh),ha=()=>new URLSearchParams(window.location.search).get("advertisingId")||fl(bh),wh=e=>e.charAt(0).toUpperCase()+e.slice(1),Eh=()=>{var e;let t=new URLSearchParams(window.location.search);return wh((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},hl=e=>{if(gh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=_h(),n=navigator.language,i=fa(),a=ha();return`${t} (${Eh()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${a} version/${e||""}`};Tt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=aa({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),a=this.createTimeoutPromise(),o=Promise.race([i,a]).catch(s=>Ot(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,o),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield o}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Ot(this,null,function*(){var r,n,i,a;let o=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(o);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),m=this.requestAdapter.extractRealTimeData(u),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(o,h,s),u):this.requestAdapter.mergeData(l,m)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),p=(a=(i=this.requestAdapter).extractCacheableData)==null?void 0:a.call(i,c);return p&&this.setCachedDataWithSequence(o,p,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let a=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:a,expiresAt:a+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Ot(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),a=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${a})`);let o=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,o);return s&&(this.setCachedDataWithSequence(i,s,a),console.log(`[RequestCacheService] Force updated cache for ${e}`)),o})}warmupCache(e,t){return Ot(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},ea=class ta{constructor(t){this.element=t,this.next=ta.Undefined,this.prev=ta.Undefined}};ea.Undefined=new ea(void 0);ae=ea,Ah=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},Sh=0,yr=class{constructor(e){this.value=e,this.id=Sh++}},br=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 yr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,a,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new yr(t);return this._listeners?this._listeners instanceof yr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(o=(a=this.options)==null?void 0:a.onDidFirstListener)==null||o.call(a,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var p,u,m,h;if(!this._disposed){if(this._listeners instanceof yr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||u.call(p));else if(this._listeners){let w=this._listeners.indexOf(c);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((h=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||h.call(m)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof yr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},ze=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new br,a=l=>t(...l.args),o=i.event(a);this.listerHandlerMap.set(t,{handler:a,dispose:o}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new Ah,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},ra={};rh(ra,{None:()=>Ch,filter:()=>Oh,once:()=>vl,toPromise:()=>Rh});Ch=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Qi=Symbol.for("Jolibox.hostEmitter"),kh=()=>{let e=new ze;return globalThis[Qi]||(globalThis[Qi]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Qi]},bt=kh();on=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new br,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return Th(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};on=rl([al],on);na=class{constructor(){this._onWillExecuteCommand=new br,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new br,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new on,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nh(3e4)),this._starActivation}executeCommand(e,...t){return Ot(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ra.toPromise(ra.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}}};na=rl([al],na);gl=Symbol.for("Jolibox.commands")});function Me(e,t={}){pa.emit("ERROR_REPORT",{error:e,options:t})}var pa,xt,rt=re(()=>{"use strict";q();q();pa=new ze,xt=new ze;Me.debounce=wr(Me,50,{leading:!0})});var va,Dh,_l,yl,bl=re(()=>{"use strict";q();rt();va=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},Dh=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},_l=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[a,o,s]=i;return{headerJson:va(a),payloadJson:va(o),signature:va(s)}}else throw"joli_source is missing"}catch(r){return Me(new dl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},yl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Dh(e),a=r[2];return`${n}.${i}.${a}`}return t}});var Lh,cn,wl,ga=re(()=>{"use strict";q();Lh="1.3.7",cn=()=>Lh,wl=()=>{let e=cn();return`${hl(e)}`}});function ya(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var Uh,El,_a,Il,oe,Bh,D,he=re(()=>{"use strict";q();bl();ga();q();Uh={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:fa(),adId:ha(),pixelRatio:window.devicePixelRatio||1,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:cn()},schema:window.location.href,platform:Oe.isAndroid?"android":Oe.isiOS?"ios":"h5"},_a=(El=globalThis.joliboxJSCore)==null?void 0:El.env,oe=Object.assign({},(Il=_a==null?void 0:_a())!=null?Il:Uh);Bh=()=>{var E,I,b,R,k,L,J,S,N,F,H;let{payloadJson:e,headerJson:t,signature:r}=oe.schema.length?_l(oe.schema):{},n=`${oe.deviceInfo.did}-${new Date().getTime()}`,a=new URL(oe.schema.length?oe.schema:window.location.href).searchParams,o=(b=(I=(E=a.get("mpId"))!=null?E:a.get("appId"))!=null?I:a.get("gameId"))!=null?b:"",s=(L=(k=(R=oe.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?k:a.get("sessionId"))!=null?L:n,l=!!((S=(J=e==null?void 0:e.testAdsMode)!=null?J:e==null?void 0:e.__testAdsMode)!=null?S:a.get("testAdsMode")==="true"),c=(H=(F=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?F:a.get("joliboxEnv"))!=null?H:"production",p=c==="staging",u=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,w=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return p},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=h.get("joliSource"))!=null?U:a.get("joliSource"))!=null?G:null},get mpId(){var U;return(U=o!=null?o:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:cn()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=oe.platform)!=null?U:oe.deviceInfo.platform).toLowerCase()},get deviceInfo(){return oe.deviceInfo},get sdkInfo(){return oe.sdkInfo},get hostInfo(){return oe.hostInfo},get hostUserInfo(){return oe.hostUserInfo},get sessionId(){var U,G;return(G=(U=oe.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return u},get webviewId(){var U;return(U=oe.webviewId)!=null?U:-1},get shouldInterupt(){return w},get from(){return e==null?void 0:e.__from},get baseApiHost(){return ml(p)},get adId(){var U;return(U=oe.deviceInfo.adId)!=null?U:oe.deviceInfo.did},get language(){return oe.deviceInfo.lang},get sdkEnvironment(){return ya("dlightek","jolibox")?"dlightek":a.get("huaweiQuick")==="true"?"huaweiQuick":ya("gamedistribution","jolibox")?"gamedistribution":ya("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var $,Y,Ue;let U=($=oe.deviceInfo.pixelRatio)!=null?$:1,G=(Y=oe.deviceInfo.statusBarHeight)!=null?Y:e==null?void 0:e.__androidStatusBarHeight,B=(Ue=oe.deviceInfo.navigationBarHeight)!=null?Ue:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:B!==void 0?B/U:10}},get abTests(){var U,G;return(G=(U=oe.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=oe.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{ol(oe,U,sl)},encodeJoliSourceQuery:U=>{var G,B;return t&&r?yl(z(z({},e),U),(G=a.get("joliSource"))!=null?G:""):(B=a.get("joliSource"))!=null?B:""},setDoExitDirectly:()=>{w=!1}}},D=Bh()});var ba,Sl,Mh,Gh,Al,Jh,Cl=re(()=>{"use strict";q();rt();he();q();ba=!1,Sl=(e,t)=>e==null?!1:t in e,Mh=e=>Sl(e,"kind"),Gh=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Al=(e,t={},r)=>{var a,o,s;let n={user_id:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:"",device_id:(s=D.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:Gh(e.name)},i=Re(z({},n),{env:t.environment,isFromUser:r});r?xt.emit("GLOBAL_USER_ERROR",e,i):xt.emit("GLOBAL_ERROR",e,i)},Jh=e=>Sl(e,"kind")&&e.kind==="USER_ERROR";pa.on("ERROR_REPORT",({error:e,options:t})=>{if(ba)return;ba=!0;let r=Mh(e)&&e.raw?e.raw:e;try{let n=Jh(e);Al(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),a=new ca(`${i}, origin error: ${r.message}`);Be.error(a),Al(new ca(a.message),{environment:t.environment},!1)}finally{ba=!1}})});var wa,Ea=re(()=>{"use strict";rt();q();rt();wa=e=>new cl(e)});function Rl(e,t){let r=(n,i,a)=>{let c=i!=null?i:{},{eventType:o}=c,s=zs(c,["eventType"]),l=Re(z({tag:n,eventType:a!=null?a:o!=null?o:kt.Other},t),{extra:z({},s)});n=="globalJsError"?Me(new sn(JSON.stringify(l))):e("systemLog",l,D.webviewId)};return r.debounce=wr(r,500,{leading:!0}),r}function Ol(e){let t=(r,n,i)=>{var s;let a=(s=i&&JSON.stringify(i))!=null?s:0,o={speed_value_type:r,total_duration:n};a&&Object.assign(o,{extra:a}),e("joliboxSpeedAnalysis",o)};return t.debounce=wr(t,500,{leading:!0}),t}var kl=re(()=>{"use strict";q();q();rt();he()});function Tl(e,t){let r=Rl(e,t),n=Ol(r);return{track:r,trackPerformance:n}}var xl=re(()=>{"use strict";kl()});var Ia=re(()=>{"use strict"});var dn,Pl=re(()=>{"use strict";he();q();q();dn=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return A(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,a,o,s;let{nativeSDKVersion:t,jssdkVersion:r}=D.sdkInfo;return{platform:1e3,os:D.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(a=(i=D.hostInfo)==null?void 0:i.aid)!=null?a:"1",model:(o=D.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=D.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:D.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return A(this,null,function*(){var u;if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),a=t.target||null,o=t.extra||null,{hostUserInfo:s}=D;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,p={protocolVersion:"1.0.0",events:[Re(z({},t),{location:i,target:a,extra:o,timestamp:Date.now(),userId:(u=s==null?void 0:s.uid)!=null?u:null})],device:l,project:r};try{n?yield this.doReport(ua(p),n):yield this.doReport(ua(p))}catch(m){Be.log("[Jolibox SDK] report API error",m)}})}}});var Aa=re(()=>{"use strict";xl();Ia();Pl()});var Sa,Nl,nt,un,Ke,Wt=re(()=>{"use strict";ga();he();q();Sa=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Nl=AbortSignal.timeout)!=null||(AbortSignal.timeout=Sa);nt=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new un(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},un=class{constructor(t){this.xua=wl();this.getJoliSource=()=>D.joliSource;var n;let r=Kt(D.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return A(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:a}=r!=null?r:{},o=n?new URLSearchParams(n):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,p=this.getJoliSource();a=Object.assign({},a!=null?a:{},c?{"x-user-agent":c}:{},p?{"x-joli-source":p}:{});let u=yield fetch(l,{method:"GET",headers:a,credentials:"include",signal:Sa(i!=null?i:3e4)});return nt.getInstance().recordNetworkRequest(!0),yield u.json()}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{},{"x-os-type":Oe.isAndroid?"ANDROID":Oe.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let m=yield fetch(c,{method:"POST",headers:o,body:JSON.stringify(n),signal:Sa(a!=null?a:3e4),credentials:"include"});nt.getInstance().recordNetworkRequest(!0);let h=m.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return m.blob()}catch(w){return yield m.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return m.formData()}catch(w){return yield m.text()}if(h!=null&&h.includes("application/json"))try{return yield m.json()}catch(w){return yield m.text()}return m}catch(n){throw nt.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:a}=r!=null?r:{},{headers:o}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,p=this.xua,u=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},p?{"x-user-agent":p}:{},u?{"x-joli-source":u}:{});let m=yield fetch(c,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!m.ok)throw nt.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${m.status}`);return nt.getInstance().recordNetworkRequest(!0),yield m.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=un;Ke=nt.getInstance()});var Ca,fn,Ra=re(()=>{"use strict";he();Aa();Wt();q();Ca=class extends dn{constructor(){super(...arguments);this.httpClient=Ke.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return pl((r=D.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},fn=new Ca(Kt(D.testMode))});var Fh,Dl=re(()=>{"use strict";Cl();q();Ea();q();Ra();he();Fh=(e,t)=>{var i,a,o;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:kt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(o=(a=D.hostUserInfo)==null?void 0:a.uid)!=null?o:null};fn.trackEvent(n,$t.WebSDK)};xt.on("GLOBAL_ERROR",(e,t)=>{Fh(t.tag,e)});xt.on("GLOBAL_USER_ERROR",(e,t)=>{Be.log("UserError",e,t)})});var hn,Ll=re(()=>{"use strict";hn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(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.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{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.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,a=!1,o=0,s=()=>{if(!a)return;let h=Date.now(),w=h-r;w>=this.interval&&(this.visible&&(o+=Math.min(w,this.interval+1e3),t(o)),r=h),n=requestAnimationFrame(s)},l=()=>{p(),r=Date.now(),i=window.setInterval(()=>{if(!a)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},p=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{a&&(console.log("visible",h),h?c():l())});let m=this.visible;return{start(){a||(a=!0,m?c():l())},stop(){a=!1,p(),u()}}}}});var Ul,Bl=re(()=>{"use strict";Ul=`-----BEGIN PUBLIC KEY-----
|
|
2
2
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs29BUZPZdQwNDEYtXufp
|
|
3
3
|
IGF40RBoddFzoD2ixl6PjyKWFXF8kxGS++HNtLspxhLvWoE12IZvrP7+whSpgHcy
|
|
4
4
|
4ryuW86mOdHnP9iyeK69GosHz3lVhQjF9UdhJDXB7P/zdj3VlVzZIj0yL+YvZjO0
|