@jolibox/implement 1.2.5-beta.3 → 1.2.5

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.
Files changed (48) hide show
  1. package/.rush/temp/package-deps_build.json +17 -24
  2. package/dist/common/cache/request-cache-service.d.ts +111 -0
  3. package/dist/common/rewards/cached-fetch-reward.d.ts +2 -2
  4. package/dist/common/rewards/cached-reward-service.d.ts +2 -2
  5. package/dist/common/rewards/index.d.ts +0 -1
  6. package/dist/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.d.ts +2 -2
  7. package/dist/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.d.ts +2 -2
  8. package/dist/common/rewards/reward-emitter.d.ts +0 -7
  9. package/dist/common/rewards/reward-helper.d.ts +1 -2
  10. package/dist/common/utils/index.d.ts +0 -18
  11. package/dist/h5/api/platformAdsHandle/JoliboxAdsHandler.d.ts +0 -1
  12. package/dist/index.js +9 -9
  13. package/dist/index.native.js +47 -47
  14. package/dist/native/payment/payment-service.d.ts +1 -1
  15. package/implement.build.log +2 -2
  16. package/package.json +7 -7
  17. package/src/common/cache/__tests__/request-cache-service.test.ts +686 -0
  18. package/src/common/cache/request-cache-service.ts +393 -0
  19. package/src/common/rewards/cached-fetch-reward.ts +2 -19
  20. package/src/common/rewards/cached-reward-service.ts +3 -3
  21. package/src/common/rewards/index.ts +0 -1
  22. package/src/common/rewards/registers/utils/coins/commands/use-payment.ts +8 -0
  23. package/src/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.ts +1 -1
  24. package/src/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.ts +1 -1
  25. package/src/common/rewards/reward-emitter.ts +0 -8
  26. package/src/common/rewards/reward-helper.ts +1 -8
  27. package/src/common/utils/index.ts +0 -23
  28. package/src/h5/api/ads.ts +13 -14
  29. package/src/h5/api/platformAdsHandle/JoliboxAdsHandler.ts +1 -25
  30. package/src/h5/bootstrap/index.ts +19 -4
  31. package/src/h5/rewards/index.ts +1 -18
  32. package/src/native/payment/payment-service.ts +1 -1
  33. package/CHANGELOG.json +0 -11
  34. package/CHANGELOG.md +0 -9
  35. package/dist/common/rewards/registers/use-subscription.d.ts +0 -7
  36. package/dist/common/rewards/registers/utils/subscription/commands/index.d.ts +0 -1
  37. package/dist/common/rewards/registers/utils/subscription/commands/use-subscription.d.ts +0 -4
  38. package/dist/common/rewards/registers/utils/subscription/sub-handler.d.ts +0 -13
  39. package/dist/h5/bootstrap/auth/index.d.ts +0 -2
  40. package/dist/h5/bootstrap/auth/sub.d.ts +0 -2
  41. package/src/common/rewards/registers/use-subscription.ts +0 -34
  42. package/src/common/rewards/registers/utils/subscription/commands/index.ts +0 -1
  43. package/src/common/rewards/registers/utils/subscription/commands/use-subscription.ts +0 -29
  44. package/src/common/rewards/registers/utils/subscription/sub-handler.ts +0 -88
  45. package/src/h5/bootstrap/auth/__tests__/auth.test.ts +0 -308
  46. package/src/h5/bootstrap/auth/index.ts +0 -20
  47. package/src/h5/bootstrap/auth/sub.ts +0 -56
  48. /package/dist/{h5/bootstrap/auth/__tests__/auth.test.d.ts → common/cache/__tests__/request-cache-service.test.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- var Ed=Object.create;var wa=Object.defineProperty,Id=Object.defineProperties,Ad=Object.getOwnPropertyDescriptor,Sd=Object.getOwnPropertyDescriptors,Cd=Object.getOwnPropertyNames,Bn=Object.getOwnPropertySymbols,ns=Object.getPrototypeOf,ba=Object.prototype.hasOwnProperty,rs=Object.prototype.propertyIsEnumerable,Rd=Reflect.get;var ts=(e,t,n)=>t in e?wa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t)=>{for(var n in t||(t={}))ba.call(t,n)&&ts(e,n,t[n]);if(Bn)for(var n of Bn(t))rs.call(t,n)&&ts(e,n,t[n]);return e},Ee=(e,t)=>Id(e,Sd(t));var tn=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var as=(e,t)=>{var n={};for(var r in e)ba.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Bn)for(var r of Bn(e))t.indexOf(r)<0&&rs.call(e,r)&&(n[r]=e[r]);return n};var ee=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ea=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Od=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Cd(t))!ba.call(e,a)&&a!==n&&wa(e,a,{get:()=>t[a],enumerable:!(r=Ad(t,a))||r.enumerable});return e};var Ia=(e,t,n)=>(n=e!=null?Ed(ns(e)):{},Od(t||!e||!e.__esModule?wa(n,"default",{value:e,enumerable:!0}):n,e));var is=(e,t,n)=>Rd(ns(e),n,t);var I=(e,t,n)=>new Promise((r,a)=>{var i=l=>{try{s(n.next(l))}catch(d){a(d)}},o=l=>{try{s(n.throw(l))}catch(d){a(d)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,o);s((n=n.apply(e,t)).next())});function Ud(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Pa(e){return typeof e=="string"}function fs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function hs(e){return typeof e=="object"&&Array.isArray(e)}function Bd(e){return typeof e=="undefined"}function Md(e){return Bd(e)||e===null}function Gd(e){return typeof e=="function"}function ms(e){let t=e,n=null,r=function(...a){return n||(n=new t(...a)),n};return r.prototype=t.prototype,r}function ps(e,t,n){if(typeof n!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function r(a,i){for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o)){let s=a[o],l=i[o],d=n(s,l,o,a,i);d!==void 0?a[o]=d:ls(l)&&ls(s)?a[o]=r(xa({},s),l):Array.isArray(l)&&Array.isArray(s)?a[o]=[...s,...l]:a[o]=l}return a}return r(e,t)}function ls(e){return e&&typeof e=="object"&&e.constructor===Object}function vs(e,t){if(Array.isArray(e))return e.concat(t)}function on(e,t,n={}){let r=null,a,i,o,{leading:s=!1,trailing:l=!0}=n,d=()=>(o=e.apply(i,a),a=void 0,i=void 0,o),_=function(...h){a=h,i=this;let p=s&&!r;if(r&&clearTimeout(r),r=setTimeout(()=>{r=null,l&&!p&&d()},t),p)return d()};return _.cancel=()=>{r&&clearTimeout(r),r=null,a=i=void 0},_.flush=()=>{if(r)return clearTimeout(r),r=null,d()},_}function Hd(e,t){return(...n)=>t(e,...n)}function ws(e){return t=>Hd(t,function(n,...r){if(typeof n=="function")try{return n.apply(this,r)}catch(a){e(new Fd(`${a}`))}})}function nn(e){return(...t)=>{var n,r;((r=(n=globalThis.VConsole)==null?void 0:n[e])!=null?r:globalThis.console[e])(...t)}}function Mn(e,t){return t.map(n=>{if(n==="params"&&e[n]){let r=e[n];return Object.keys(r).reduce((a,i)=>(a[i]=String(r[i]),a),{})}return e[n]})}function Kd(e){let t=e.location?Mn(e.location,us):null,n=e.target?Mn(e.target,us):null;return Mn(Dd(xa({},e),{location:t,target:n}),$d)}function Ba(e){let t=e.events.map(r=>Kd(r)),n=Mn(e.device,Wd);return[e.protocolVersion,t,n,e.project]}function zd(){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 r=e.get.call(window);return window.__joliboxLocalStorage__=r,r}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,n=Object.getOwnPropertyDescriptor(t,"localStorage");if(n&&n.get){let r=n.get.call(window);return window.__joliboxLocalStorage__=r,r}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function Ja(e,t,n){let r=window.location.hostname,a=r.split("."),i=n?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(r))return`${i}.jolibox.com`;if(a.length>=2){let o=a.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com")return`${i}.${o}`}return`${i}.jolibox.com`}function Is(e){return Ja("app","stg-app",e)}function kt(e){return`https://${Ja("api","stg-api",e)}`}function nf(e){return Ja("collect","stg-collect",e)}function As(e){return`https://${nf(e)}`}function sf(e){return new Promise(t=>Ss(e)(t))}function Ss(e){return(t,n=null)=>{let r=!1;return e(a=>{if(!r)return r=!0,t.call(n,a)},null)}}function lf(e,t){return(n=>{let r,a={onWillAddFirstListener(){r=n(i.fire,i)}},i=new an(a);return i.event})((n,r=null)=>e(a=>t(a)&&n.call(r,a),null))}function uf(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)df(e[r],t[r])}function df(e,t){if(Pa(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gd(t)){try{if(e instanceof t)return}catch(n){}if(!Md(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 ff(){return typeof globalThis!="undefined"?globalThis[Cs]:void 0}function hf(e){typeof globalThis!="undefined"&&(globalThis[Cs]=e)}function ge(e=!1){let t=ff();if(!e&&t)return t;let n=new Gn,r=new ka,a={registerCommand(i,o,s){n.registerCommand({id:i,handler:o,metadata:s})},executeCommand(i,...o){return r.executeCommand(i,...o)},excuteCommandSync(i,...o){return r.executeCommandThowErr(i,...o)}};return hf(a),a}var Ta,kd,Td,xd,os,Pd,Ld,ss,xa,Dd,Nd,ds,pt,Jd,La,Da,gs,_s,Fd,ys,Jn,Fn,Na,Te,Sa,qd,Ua,cs,jd,vt,Ot,Vd,us,$d,Wd,Ge,Rt,Xd,Ie,Yd,Qd,Zd,bs,Ma,Ga,ef,tf,Es,gt,Ca,ne,rf,af,rn,an,He,Oa,of,Aa,cf,ut,Gn,ka,Cs,G=ee(()=>{"use strict";Ta=Object.defineProperty,kd=Object.defineProperties,Td=Object.getOwnPropertyDescriptor,xd=Object.getOwnPropertyDescriptors,os=Object.getOwnPropertySymbols,Pd=Object.prototype.hasOwnProperty,Ld=Object.prototype.propertyIsEnumerable,ss=(e,t,n)=>t in e?Ta(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xa=(e,t)=>{for(var n in t||(t={}))Pd.call(t,n)&&ss(e,n,t[n]);if(os)for(var n of os(t))Ld.call(t,n)&&ss(e,n,t[n]);return e},Dd=(e,t)=>kd(e,xd(t)),Nd=(e,t)=>{for(var n in t)Ta(e,n,{get:t[n],enumerable:!0})},ds=(e,t,n,r)=>{for(var a=r>1?void 0:r?Td(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=(r?o(t,n,a):o(a))||a);return r&&a&&Ta(t,n,a),a},pt=(e,t,n)=>new Promise((r,a)=>{var i=l=>{try{s(n.next(l))}catch(d){a(d)}},o=l=>{try{s(n.throw(l))}catch(d){a(d)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,o);s((n=n.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 n=new Event("abort");this.signal.dispatchEvent(n)};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(n,r){this._eventListeners[n]||(this._eventListeners[n]=[]),this._eventListeners[n].push(r)},t.prototype.removeEventListener=function(n,r){if(!this._eventListeners[n])return;let a=this._eventListeners[n].indexOf(r);a!==-1&&this._eventListeners[n].splice(a,1)},t.prototype.dispatchEvent=function(n){if(this._eventListeners[n.type])for(let r of this._eventListeners[n.type])r.call(this,n)},window.AbortController=e,window.AbortSignal=t}Jd=(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))(Jd||{}),La=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}},Da=class extends La{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},gs=class extends La{constructor(){super(...arguments),this.kind="USER_ERROR"}},_s=class extends gs{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fd=class extends gs{constructor(e,t,n){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,n&&(this.extra=Object.assign({},this.extra,n))}},ys=class extends Da{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Jn=class extends Da{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Fn=class extends La{constructor(e,t,n,r,a){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",n&&(this.errorType=n),r!==void 0&&(this.stack=r),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Na=class extends Da{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Te={log:nn("log"),warn:nn("warn"),info:nn("info"),error:nn("error"),debug:nn("debug")};Object.assign(globalThis,{logger:Te});Sa=Symbol.for("Jolibox.canIUseMap"),qd={};globalThis[Sa]||(globalThis[Sa]=qd);Ua={get config(){return globalThis[Sa]}},cs=Symbol.for("Jolibox.canIUseMap.native"),jd={};globalThis[cs]||(globalThis[cs]=jd);vt=(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))(vt||{}),Ot=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ot||{}),Vd=(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))(Vd||{}),us=["name","params"],$d=["name","type","location","target","extra","timestamp","userId"],Wd=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Ge=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});zd();Rt=typeof window=="undefined",Xd=()=>!Rt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ie={isiOS:!Rt&&(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:!Rt&&navigator.userAgent.includes("Android"),isMac:!Rt&&navigator.userAgent.includes("Mac"),isFacebook:!Rt&&navigator.userAgent.includes("FB_IAB"),isPC:!Rt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Yd=()=>Ie.isiOS?"iOS":Ie.isAndroid?"Android":Ie.isMac?"Mac":Ie.isFacebook?"Facebook":"PC",Qd="device_id",Zd="advertising_id",bs=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Ge()),window.__joliboxLocalStorage__.getItem(e)),Ma=()=>new URLSearchParams(window.location.search).get("deviceId")||bs(Qd),Ga=()=>new URLSearchParams(window.location.search).get("advertisingId")||bs(Zd),ef=e=>e.charAt(0).toUpperCase()+e.slice(1),tf=()=>{var e;let t=new URLSearchParams(window.location.search);return ef((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Es=e=>{if(Xd())return window.navigator.userAgent;let t="JoliboxWebSDK",n=Yd(),r=navigator.language,a=Ma(),i=Ga();return`${t} (${tf()}${n}; UnknownModel; UnknownSystemVersion; ${r}) uuid/${a} adid/${i} version/${e||""}`};gt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=xa({duration:10*60*1e3,timeout:3e3,keyGenerator:(n,r)=>n,consistencyChecker:()=>!0},t)}request(e,t){return pt(this,null,function*(){let n=this.config.keyGenerator(e,t),r=this.pendingRequests.get(n);if(r)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),r;let a=this.requestInternal(e,t),i=this.createTimeoutPromise(),o=Promise.race([a,i]).catch(s=>pt(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(n);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(n,o),a.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(n)}})}requestInternal(e,t){return pt(this,null,function*(){var n,r,a,i;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 h=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(h),f=(r=(n=this.requestAdapter).extractCacheableData)==null?void 0:r.call(n,h);return f&&!this.config.consistencyChecker(l,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(o,f,s),h):this.requestAdapter.mergeData(l,p)}catch(h){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,h),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 d=yield this.requestAdapter.execute(e,t),_=(i=(a=this.requestAdapter).extractCacheableData)==null?void 0:i.call(a,d);return _&&this.setCachedDataWithSequence(o,_,s),d})}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,n,r){let a=this.cache.get(e);if(a&&a.sequence>n){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${a.sequence}, incoming: ${n})`);return}let i=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:i,expiresAt:i+this.config.duration,key:e,sequence:n,metadata:r}),this.cacheSequences.set(e,n),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${n}`)}refreshCache(e,t){return pt(this,null,function*(){let n=this.config.keyGenerator(e,t);return this.cache.delete(n),this.request(e,t)})}forceRequest(e,t){return pt(this,null,function*(){var n,r;let a=this.config.keyGenerator(e,t),i=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${i})`);let o=yield this.requestAdapter.execute(e,t),s=(r=(n=this.requestAdapter).extractCacheableData)==null?void 0:r.call(n,o);return s&&(this.setCachedDataWithSequence(a,s,i),console.log(`[RequestCacheService] Force updated cache for ${e}`)),o})}warmupCache(e,t){return pt(this,null,function*(){let n=this.config.keyGenerator(e,t);if(this.pendingRequests.has(n)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(n)){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(r){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,r)}})}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,n]of this.cache)e>n.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,n=0;for(let r of this.cache.values())e>r.expiresAt?n++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:n,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)}},Ca=class Ra{constructor(t){this.element=t,this.next=Ra.Undefined,this.prev=Ra.Undefined}};Ca.Undefined=new Ca(void 0);ne=Ca,rf=class{constructor(){this._first=ne.Undefined,this._last=ne.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ne.Undefined}clear(){let e=this._first;for(;e!==ne.Undefined;){let t=e.next;e.prev=ne.Undefined,e.next=ne.Undefined,e=t}this._first=ne.Undefined,this._last=ne.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new ne(e);if(this._first===ne.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==ne.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ne.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ne.Undefined&&e.next!==ne.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ne.Undefined&&e.next===ne.Undefined?(this._first=ne.Undefined,this._last=ne.Undefined):e.next===ne.Undefined?(this._last=this._last.prev,this._last.next=ne.Undefined):e.prev===ne.Undefined&&(this._first=this._first.next,this._first.prev=ne.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ne.Undefined;)yield e.element,e=e.next}},af=0,rn=class{constructor(e){this.value=e,this.id=af++}},an=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,n;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof rn&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(r=>(r==null?void 0:r.value)===e)):(this._listeners=void 0,this._size=0)),(n=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,n)=>{var r,a,i,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};n&&(t=t.bind(n));let d=new rn(t);return this._listeners?this._listeners instanceof rn?this._listeners=[this._listeners,d]:this._listeners.push(d):((a=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||a.call(r,this),this._listeners=d,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var _,h,p,f;if(!this._disposed){if(this._listeners instanceof rn)this._listeners.id===d.id&&(this._listeners=void 0,this._size=0,(h=(_=this.options)==null?void 0:_.onDidRemoveLastListener)==null||h.call(_));else if(this._listeners){let w=this._listeners.indexOf(d);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),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(a){r(a)}}fire(e){this._listeners&&(this._listeners instanceof rn?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},He=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,n=!0){var r;let a=(r=this.listeners.get(e))!=null?r:new an,i=l=>t(...l.args),o=a.event(i);this.listerHandlerMap.set(t,{handler:i,dispose:o}),this.listeners.set(e,a);let s=this.cachedEventQueue.get(e);if(s&&n)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let n=this.listerHandlerMap.get(t);n&&(n.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let n=this.listeners.get(e),r=this.cachedEventQueue.get(e);r||(r=new rf,this.cachedEventQueue.set(e,r)),r.push({args:t}),n&&n.fire({event:e,args:t})}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};this.on(e,n,!1)}},Oa={};Nd(Oa,{None:()=>of,filter:()=>lf,once:()=>Ss,toPromise:()=>sf});of=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Aa=Symbol.for("Jolibox.hostEmitter"),cf=()=>{let e=new He;return globalThis[Aa]||(globalThis[Aa]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Aa]},ut=cf();Gn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new an,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 n=[];for(let a of e.metadata.args)n.push(a.constraint);let r=e.handler;e.handler=function(...a){return uf(a,n),r(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let n=this.getCommand(t);n&&e.set(t,n)}return e}};Gn=ds([ms],Gn);ka=class{constructor(){this._onWillExecuteCommand=new an,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new an,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Gn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Ud(3e4)),this._starActivation}executeCommand(e,...t){return pt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Oa.toPromise(Oa.filter(this.registry.onDidRegisterCommand,n=>n===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let n=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let r=this.invokeFunction(n.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),r}_tryExecuteCommand(e,t){let n=this.registry.getCommand(e);if(!n)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let r=this.invokeFunction(n.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(r)}catch(r){return Promise.reject(r)}}invokeFunction(e,...t){let n=!1;try{return e(...t)}finally{n=!0}}};ka=ds([ms],ka);Cs=Symbol.for("Jolibox.commands")});function xe(e,t={}){Fa.emit("ERROR_REPORT",{error:e,options:t})}var Fa,_t,ze=ee(()=>{"use strict";G();G();Fa=new He,_t=new He;xe.debounce=on(xe,50,{leading:!0})});var Ha,mf,Rs,Os,ks=ee(()=>{"use strict";G();ze();Ha=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4===0?"":"=".repeat(4-t.length%4),r=atob(t+n);try{return JSON.parse(r)}catch(a){return{}}},mf=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rs=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[i,o,s]=a;return{headerJson:Ha(i),payloadJson:Ha(o),signature:Ha(s)}}else throw"joli_source is missing"}catch(n){return xe(new ys(`${e} not a valid schema: ${n}`)),{headerJson:{},payloadJson:{},signature:{}}}},Os=(e,t)=>{let n=t.split(".");if(n&&n.length===3){let r=n[0],a=mf(e),i=n[2];return`${r}.${a}.${i}`}return t}});var pf,Hn,Ts,qa=ee(()=>{"use strict";G();pf="1.2.5-beta.3",Hn=()=>pf,Ts=()=>{let e=Hn();return`${Es(e)}`}});function Va(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var vf,xs,ja,Ps,re,gf,L,ue=ee(()=>{"use strict";G();ks();qa();G();vf={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Ma(),adId:Ga(),pixelRatio:window.devicePixelRatio||1,platform:Ie.isAndroid?"android":Ie.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Hn()},schema:window.location.href,platform:Ie.isAndroid?"android":Ie.isiOS?"ios":"h5"},ja=(xs=globalThis.joliboxJSCore)==null?void 0:xs.env,re=Object.assign({},(Ps=ja==null?void 0:ja())!=null?Ps:vf);gf=()=>{var f,w,A,C,b,x,D,H,j,R,N;let{payloadJson:e,headerJson:t,signature:n}=re.schema.length?Rs(re.schema):{},r=`${re.deviceInfo.did}-${new Date().getTime()}`,i=new URL(re.schema.length?re.schema:window.location.href).searchParams,o=(A=(w=(f=i.get("mpId"))!=null?f:i.get("appId"))!=null?w:i.get("gameId"))!=null?A:"",s=(x=(b=(C=re.clientSessionId)!=null?C:e==null?void 0:e.sessionId)!=null?b:i.get("sessionId"))!=null?x:r,l=!!((H=(D=e==null?void 0:e.testAdsMode)!=null?D:e==null?void 0:e.__testAdsMode)!=null?H:i.get("testAdsMode")==="true"),d=(N=(R=(j=e==null?void 0:e.joliboxEnv)!=null?j:e==null?void 0:e.__joliboxEnv)!=null?R:i.get("joliboxEnv"))!=null?N:"production",_=d==="staging",h=t==null?void 0:t.channel,p=e==null?void 0:e.__shouldInterupt;return{get startTime(){var T;return(T=performance.timeOrigin)!=null?T:performance.timing.navigationStart},get testMode(){return _},get testAdsMode(){return l},get joliboxEnv(){return d},get joliSource(){var T;return(T=i.get("joliSource"))!=null?T:null},get mpId(){var T;return(T=o!=null?o:e==null?void 0:e.id)!=null?T:""},get mpVersion(){var T;return(T=t==null?void 0:t.ver)!=null?T:Hn()},get mpType(){var T,B;return(B=(T=t==null?void 0:t.__mpType)!=null?T:e==null?void 0:e.__mpType)!=null?B:"game"},get platform(){var T;return((T=re.platform)!=null?T:re.deviceInfo.platform).toLowerCase()},get deviceInfo(){return re.deviceInfo},get sdkInfo(){return re.sdkInfo},get hostInfo(){return re.hostInfo},get hostUserInfo(){return re.hostUserInfo},get sessionId(){var T,B;return(B=(T=re.clientSessionId)!=null?T:s)!=null?B:r},get channel(){return h},get webviewId(){var T;return(T=re.webviewId)!=null?T:-1},get shouldInterupt(){return p},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Is(_)},get adId(){var T;return(T=re.deviceInfo.adId)!=null?T:re.deviceInfo.did},get language(){return re.deviceInfo.lang},get sdkEnvironment(){return Va("dlightek","jolibox")?"dlightek":i.get("huaweiQuick")==="true"?"huaweiQuick":Va("gamedistribution","jolibox")?"gamedistribution":Va("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var z,te,me;let T=(z=re.deviceInfo.pixelRatio)!=null?z:1,B=(te=re.deviceInfo.statusBarHeight)!=null?te:e==null?void 0:e.__androidStatusBarHeight,K=(me=re.deviceInfo.navigationBarHeight)!=null?me:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:B!==void 0?B/T:20,navigationBarHeight:K!==void 0?K/T:10}},get abTests(){var T,B;return(B=(T=re.abValues)==null?void 0:T.split(","))!=null?B:[]},get mpInfo(){var T;return(T=re.mpInfo)!=null?T:{mpName:"unknown"}},onEnvConfigChanged:T=>{ps(re,T,vs)},encodeJoliSourceQuery:T=>{var B,K;return t&&n?Os(q(q({},e),T),(B=i.get("joliSource"))!=null?B:""):(K=i.get("joliSource"))!=null?K:""},setDoExitDirectly:()=>{p=!1}}},L=gf()});var $a,Ds,_f,yf,Ls,wf,Ns=ee(()=>{"use strict";G();ze();ue();G();$a=!1,Ds=(e,t)=>e==null?!1:t in e,_f=e=>Ds(e,"kind"),yf=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")},Ls=(e,t={},n)=>{var i,o,s;let r={user_id:(o=(i=L.hostUserInfo)==null?void 0:i.uid)!=null?o:"",device_id:(s=L.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:yf(e.name)},a=Ee(q({},r),{env:t.environment,isFromUser:n});n?_t.emit("GLOBAL_USER_ERROR",e,a):_t.emit("GLOBAL_ERROR",e,a)},wf=e=>Ds(e,"kind")&&e.kind==="USER_ERROR";Fa.on("ERROR_REPORT",({error:e,options:t})=>{if($a)return;$a=!0;let n=_f(e)&&e.raw?e.raw:e;try{let r=wf(e);Ls(e,t,r)}catch(r){let a=r instanceof Error?r.message:String(r),i=new Na(`${a}, origin error: ${n.message}`);Te.error(i),Ls(new Na(i.message),{environment:t.environment},!1)}finally{$a=!1}})});var Wa,Ka=ee(()=>{"use strict";ze();G();ze();Wa=e=>new _s(e)});function Us(e,t){let n=(r,a,i)=>{let d=a!=null?a:{},{eventType:o}=d,s=as(d,["eventType"]),l=Ee(q({tag:r,eventType:i!=null?i:o!=null?o:vt.Other},t),{extra:q({},s)});r=="globalJsError"?xe(new Jn(JSON.stringify(l))):e("systemLog",l,L.webviewId)};return n.debounce=on(n,500,{leading:!0}),n}function Bs(e){let t=(n,r,a)=>{var s;let i=(s=a&&JSON.stringify(a))!=null?s:0,o={speed_value_type:n,total_duration:r};i&&Object.assign(o,{extra:i}),e("joliboxSpeedAnalysis",o)};return t.debounce=on(t,500,{leading:!0}),t}var Ms=ee(()=>{"use strict";G();G();ze();ue()});function Gs(e,t){let n=Us(e,t),r=Bs(n);return{track:n,trackPerformance:r}}var Js=ee(()=>{"use strict";Ms()});var za=ee(()=>{"use strict"});var qn,Fs=ee(()=>{"use strict";ue();G();G();qn=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return I(this,null,function*(){let n=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,r=yield(yield fetch(n)).json();this.samplesConfig=r})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:n}=this.samplesConfig;for(let[r,a]of Object.entries(n))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(r);return!1}getDevice(){var r,a,i,o,s;let{nativeSDKVersion:t,jssdkVersion:n}=L.sdkInfo;return{platform:1e3,os:L.deviceInfo.platform,appVersion:(r=t!=null?t:n)!=null?r:"1.0.0",appId:(i=(a=L.hostInfo)==null?void 0:a.aid)!=null?i:"1",model:(o=L.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=L.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:L.deviceInfo.did,jsSdkVersion:n,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),n={};return t.forEach((r,a)=>{n[a]=r}),{name:"GamePage",params:n}}trackEvent(t,n,r){return I(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),i=t.target||null,o=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let s=this.deviceInfo,d={protocolVersion:"1.0.0",events:[Ee(q({},t),{location:a,target:i,extra:o,timestamp:Date.now(),userId:null})],device:s,project:n};try{r?yield this.doReport(Ba(d),r):yield this.doReport(Ba(d))}catch(_){Te.log("[Jolibox SDK] report API error",_)}})}}});var Xa=ee(()=>{"use strict";Js();za();Fs()});var Ya,Hs,Xe,jn,Je,Tt=ee(()=>{"use strict";qa();ue();G();Ya=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Hs=AbortSignal.timeout)!=null||(AbortSignal.timeout=Ya);Xe=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(r=>r).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let n=new jn(t);return e.getInstance().httpClients.add(n),n}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},jn=class{constructor(t){this.xua=Ts();this.getJoliSource=()=>L.joliSource;var r;let n=kt(L.testMode);this.baseUrl=(r=t==null?void 0:t.baseUrl)!=null?r:n}get(t,n){return I(this,null,function*(){try{let{query:r,timeout:a}=n!=null?n:{},{headers:i}=n!=null?n:{},o=r?new URLSearchParams(r):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,d=this.xua,_=this.getJoliSource();i=Object.assign({},i!=null?i:{},d?{"x-user-agent":d}:{},_?{"x-joli-source":_}:{});let h=yield fetch(l,{method:"GET",headers:i,credentials:"include",signal:Ya(a!=null?a:3e4)});return Xe.getInstance().recordNetworkRequest(!0),yield h.json()}catch(r){throw Xe.getInstance().recordNetworkRequest(!1),r}})}post(t,n){return I(this,null,function*(){try{let{data:r,query:a,timeout:i}=n!=null?n:{},{headers:o}=n!=null?n:{},s=a?new URLSearchParams(a):null,l=s==null?void 0:s.toString(),d=`${this.baseUrl}${t}${l?`?${l}`:""}`,_=this.xua,h=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},h?{"x-joli-source":h}:{},{"x-os-type":Ie.isAndroid?"ANDROID":Ie.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(d,{method:"POST",headers:o,body:JSON.stringify(r),signal:Ya(i!=null?i:3e4),credentials:"include"});Xe.getInstance().recordNetworkRequest(!0);let f=p.headers.get("content-type");if(f!=null&&f.includes("application/octet-stream"))try{return p.blob()}catch(w){return yield p.arrayBuffer()}if(f!=null&&f.includes("multipart/form-data")||f!=null&&f.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(w){return yield p.text()}if(f!=null&&f.includes("application/json"))try{return yield p.json()}catch(w){return yield p.text()}return p}catch(r){throw Xe.getInstance().recordNetworkRequest(!1),r}})}put(t,n){return I(this,null,function*(){try{let{data:r,query:a,timeout:i}=n!=null?n:{},{headers:o}=n!=null?n:{},s=a?new URLSearchParams(a):null,l=s==null?void 0:s.toString(),d=`${this.baseUrl}${t}${l?`?${l}`:""}`,_=this.xua,h=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},h?{"x-joli-source":h}:{});let p=yield fetch(d,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(r!=null?r:{})});if(!p.ok)throw Xe.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return Xe.getInstance().recordNetworkRequest(!0),yield p.json()}catch(r){throw console.error("Error:",r),r}})}};window.JoliboxHttpClient=jn;Je=Xe.getInstance()});var Qa,Vn,Za=ee(()=>{"use strict";ue();Xa();Tt();G();Qa=class extends qn{constructor(){super(...arguments);this.httpClient=Je.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n;return As((n=L.testMode)!=null?n:!1)}doReport(n){this.httpClient.post("/report",{data:n,timeout:5e3}).catch(r=>{console.info("report error",r)})}},Vn=new Qa(kt(L.testMode))});var bf,qs=ee(()=>{"use strict";Ns();G();Ka();G();Za();ue();bf=(e,t)=>{var a,i,o;let n={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},r={name:e,type:vt.ErrorTrace,location:null,target:null,extra:n,timestamp:Date.now(),userId:(o=(i=L.hostUserInfo)==null?void 0:i.uid)!=null?o:null};Vn.trackEvent(r,Ot.WebSDK)};_t.on("GLOBAL_ERROR",(e,t)=>{bf(t.tag,e)});_t.on("GLOBAL_USER_ERROR",(e,t)=>{Te.log("UserError",e,t)})});var $n,js=ee(()=>{"use strict";$n=class{constructor(t,n){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,n)=>{window.parent&&window.parent.postMessage({type:t,data:n},"*")};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=n!=null?n:5*1e3,t.on("visible",r=>{this.visible=r})}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 n=Date.now(),r,a,i=!1,o=0,s=()=>{if(!i)return;let f=Date.now(),w=f-n;w>=this.interval&&(this.visible&&(o+=Math.min(w,this.interval+1e3),t(o)),n=f),r=requestAnimationFrame(s)},l=()=>{_(),n=Date.now(),a=window.setInterval(()=>{if(!i)return;let f=Date.now();f-n>=this.interval&&(n=f)},this.interval)},d=()=>{h(),n=Date.now(),r=requestAnimationFrame(s)},_=()=>{r&&(cancelAnimationFrame(r),r=0)},h=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",f=>{i&&(console.log("visible",f),f?d():l())});let p=this.visible;return{start(){i||(i=!0,p?d():l())},stop(){i=!1,_(),h()}}}}});var Wn,Vs=ee(()=>{"use strict";ue();js();Tt();Wn=class extends $n{constructor(n,r,a){super(r,a);this.httpClient=Je.create();this.gameId=L.mpId,this.sessionId=L.sessionId,this.track=n}reporter(n){return I(this,null,function*(){let{event:r,params:a,extraParams:i}=n,o={eventType:r,gameInfo:q({gameId:this.gameId,sessionId:this.sessionId},a)};i&&Object.assign(o,i),yield this.httpClient.post("/api/base/app-event",{data:o})})}tracker(n,r=null){this.track(n,r)}}});var $s,Ef,Pe,If,ei,Ye,dt=ee(()=>{"use strict";qs();G();G();Xa();Za();Vs();ue();za();$s=ge(),Ef={type:Ot.WebSDK,platform:"h5",jssdk_version:L.sdkInfo.jssdkVersion,mp_id:L.mpId,mp_version:L.mpVersion},{track:Pe,trackPerformance:If}=Gs((...e)=>{var o,s,l,d;let[,t]=e,n=t,r=fs(n.extra)?n.extra:Pa(n.extra)?JSON.parse(n.extra):{},a=Ee(q({},r),{mp_id:(o=n.mp_id)!=null?o:"",mp_version:(s=n.mp_version)!=null?s:""}),i={name:t.tag,type:vt.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(d=(l=L.hostUserInfo)==null?void 0:l.uid)!=null?d:null};Vn.trackEvent(i,Ot.WebSDK)},Ef);$s.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:n})=>{If(e,t,n)});$s.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Pe(e,t)});ei=new He,Ye=new Wn(Pe,ei)});function Ws(e){let t=Ua.config[e];return t||(t={},Ua.config[e]=t),(n,r)=>{if(t[n]){Te.warn(`[can i use] ${n} already registered`);return}t[n]=q({},r)}}var Ks=ee(()=>{"use strict";G()});function ti(e){zs=e}function Kn(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Kn(t)):Object.keys(e).reduce((t,n)=>(t[n]=Kn(e[n]),t),{})}function Qe(e){return typeof e=="number"}function ni(e){let t=ri(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function ri(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var zs,de,zn,Xn,Yn,Qn,xt,Zn,er,tr,nr,rr,ar,ir,or,sr,lr,cr,ur,ai=ee(()=>{"use strict";zs=!1;de=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(zs)if(typeof t=="string")this.errors.push(t);else{let n=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?n+=" or undefined, ":n+=", ",n+=`but got ${ni(t.actual)}`,this.errors.push(n)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Kn(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Kn(this._default)}optional(){return this._optional=!0,this}};zn=class extends de{validate(t){return this._optional&&t===void 0?!0:Qe(t)?Qe(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):Qe(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):Qe(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}},Xn=class extends de{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Yn=class extends de{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(Qe(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(Qe(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}},Qn=class extends de{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},xt=class extends de{validate(t){return!0}},Zn=class extends de{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},er=class extends de{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},tr=class extends de{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},nr=class extends de{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let n=this._items.map(r=>JSON.stringify(r)).join(", ");return this.fail(`expect ${this.path} to be one of ${n}, but got ${ni(t)}`)}return!0}},rr=class extends de{constructor(n){super();this._item=n}validate(n){if(this._optional&&n===void 0)return!0;if(!Array.isArray(n))return this.fail({expect:"array",actual:n});if(Qe(this._minItems)&&n.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(Qe(this._maxItems)&&n.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(Qe(this._length)&&n.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let r=this._item;if(!r)return!0;let a=!0;if(n.forEach((i,o)=>{if(r.path=`${this.path}[${o}]`,r.errors=this.errors,i===void 0&&r.hasDefault){n[o]=r.defaultValue;return}r.validate(i)||(r.hasFallback?n[o]=r.fallbackValue:a=!1)}),this._uniqueItems){let i=new Map;for(let o in n)i.has(n[o])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${i.get(n[o])}] and ${this.path}[${o}] are identical)`):i.set(n[o],o)}return a}minItems(n){return this._minItems=n,this}maxItems(n){return this._maxItems=n,this}uniqueItems(){return this._uniqueItems=!0,this}length(n){return this._length=n,this}},ar=class extends de{constructor(n){super();this._value=n}validate(n){if(this._optional&&n===void 0)return!0;if(ri(n)!=="object")return this.fail({expect:"object",actual:n});let a=n,i=this._value;i.errors=this.errors;let o=!0;for(let s in a){let l=a[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?i.path=`${this.path}.${s}`:i.path=`${this.path}["${s}"]`,!(l===void 0&&i._optional)){if(l===void 0&&i.hasDefault){a[s]=i.defaultValue;continue}i.validate(l)||(i.hasFallback?a[s]=i.fallbackValue:o=!1)}}return o}},ir=class extends de{constructor(n={}){super();this._object=n}validate(n){if(this._optional&&n===void 0)return!0;if(ri(n)!=="object")return this.fail({expect:"object",actual:n});let r=n,a=!0;for(let i in this._object){let o=r[i],s=this._object[i];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(i)?s.path=`${this.path}.${i}`:s.path=`${this.path}["${i}"]`,!(s._optional&&o===void 0)){if(o===void 0&&s.hasDefault){r[i]=s.defaultValue;continue}s.validate(o)||(s.hasFallback?r[i]=s.fallbackValue:a=!1)}}return a}},or=class extends de{constructor(n){super();this.value=n}validate(n){return n===void 0&&this._optional?!0:n!==this.value?this.fail({expect:ni(this.value),actual:n}):!0}},sr=class extends de{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let n=[],r=!1,a=this._items.length;for(let i=0;i<a;i++){let o=this._items[i];if(o.errors=[],o.path=this.path,!o.validate(t))n.push(o.errors.join("; "));else if(!r){r=!0;break}}if(!r){let i=n.join(`
2
- or `);this.errors.push(i)}return r}},lr=class extends de{constructor(...t){super(),this._items=t;let n=0,r=t.length-1;for(;r>=0;r--){let a=t[r];if(a._optional||a.hasDefault)n+=1;else break}this._minItems=t.length-n}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 n=!0;return this._items.forEach((r,a)=>{if(r.path=`${this.path}[${a}]`,r.errors=this.errors,t[a]===void 0&&r.hasDefault){t[a]=r.defaultValue;return}r.validate(t[a])||(r.hasFallback?t[a]=r._fallback:n=!1)}),n}},cr=class extends de{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},ur=class extends de{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 ii(e,t,n="param"){if(e.errors=[],e.path=n,ti(!0),!e.validate(t)){let r=e.errors.join(`
3
- `);throw e.errors.length=0,ti(!1),new TypeError(r)}}var J,oi=ee(()=>{"use strict";ai();ai();J={object(e){return new ir(e)},array(e){return new rr(e)},tuple(...e){return new lr(...e)},literal(e){return new or(e)},or(...e){return new sr(...e)},symbol(){return new Qn},record(e){return new ar(e)},function(){return new tr},boolean(){return new Xn},string(){return new Yn},number(){return new zn},undefined(){return new Zn},null(){return new er},unknown(){return new xt},any(){return new xt},as(){return new xt},arraybuffer(){return new cr},enum(...e){return new nr(...e)},typedarray(e){return new ur(e)}}});var dr,Xs,Ys=ee(()=>{"use strict";G();ze();oi();Ka();dr=1,Xs=e=>{function t(r,a){return(...i)=>{var h,p,f,w;let o=Date.now(),s={method:r,trace_id:dr};dr+=1;let l="SUCCESS",d=`${r}:ok`,_=0;try{if(a.paramsSchema)try{ii(a.paramsSchema,i,"params")}catch(x){throw Wa(`${r}:fail ${x.message}`)}let A=a.implement(...i),C=A,b=`${r}:ok`;if(A&&"code"in A){let{code:x,data:D,message:H}=A;l=x,C=D,b=H}return{code:l,message:b,data:C}}catch(A){let C=A;_=(p=(h=C.code)!=null?h:C.errNo)!=null?p:2e3,l="FAILURE";let b=(w=(f=C.message)!=null?f:C.errMsg)!=null?w:`${A}`;return d=`${r}:${l} ${b.replace(/^\S+:(fail|cancel)\s?/,"")}`,xe(new Fn(d,_)),{code:l,message:d}}finally{let A=Date.now()-o}}}function n(r,a){return(...i)=>I(this,null,function*(){var p,f,w,A;let o=hs(i)?i:[i],s=Date.now(),l={method:r,trace_id:dr};dr+=1;let d=`${r}:ok`,_="SUCCESS",h={code:_,message:d};try{if(a.paramsSchema)try{ii(a.paramsSchema,o,"params")}catch(x){throw Wa(x.message)}let b=yield a.implement(...o);if(b&&"code"in b){let{code:x,data:D,message:H}=b;_=x,d=H,b=D}return Object.assign(h,{code:_,message:d,data:b}),h}catch(C){let b=C,x=(f=(p=b.code)!=null?p:b.errNo)!=null?f:2e3;_="FAILURE";let D=(A=(w=b.message)!=null?w:b.errMsg)!=null?A:`${C}`,H=`${r}:${_} ${D.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(h,{code:_,message:H}),xe(new Fn(H,x)),h}finally{let C=Date.now()-s}})}return{createAPI:n,createSyncAPI:t}}});var Ze,yt,_e,sn=ee(()=>{"use strict";Ks();dt();Ys();oi();({createAPI:Ze,createSyncAPI:yt}=Xs(Pe)),_e=Ws("h5")});var tl=Ea((el,ui)=>{(function(e){if(typeof el=="object"&&typeof ui!="undefined")ui.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,n;return function r(a,i,o){function s(_,h){if(!i[_]){if(!a[_]){var p=typeof tn=="function"&&tn;if(!h&&p)return p(_,!0);if(l)return l(_,!0);var f=new Error("Cannot find module '"+_+"'");throw f.code="MODULE_NOT_FOUND",f}var w=i[_]={exports:{}};a[_][0].call(w.exports,function(A){var C=a[_][1][A];return s(C||A)},w,w.exports,r,a,i,o)}return i[_].exports}for(var l=typeof tn=="function"&&tn,d=0;d<o.length;d++)s(o[d]);return s}({1:[function(r,a,i){(function(o){"use strict";var s=o.MutationObserver||o.WebKitMutationObserver,l;if(s){var d=0,_=new s(A),h=o.document.createTextNode("");_.observe(h,{characterData:!0}),l=function(){h.data=d=++d%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var p=new o.MessageChannel;p.port1.onmessage=A,l=function(){p.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var b=o.document.createElement("script");b.onreadystatechange=function(){A(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},o.document.documentElement.appendChild(b)}:l=function(){setTimeout(A,0)};var f,w=[];function A(){f=!0;for(var b,x,D=w.length;D;){for(x=w,w=[],b=-1;++b<D;)x[b]();D=w.length}f=!1}a.exports=C;function C(b){w.push(b)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(r,a,i){"use strict";var o=r(1);function s(){}var l={},d=["REJECTED"],_=["FULFILLED"],h=["PENDING"];a.exports=p;function p(R){if(typeof R!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,R!==s&&C(this,R)}p.prototype.catch=function(R){return this.then(null,R)},p.prototype.then=function(R,N){if(typeof R!="function"&&this.state===_||typeof N!="function"&&this.state===d)return this;var T=new this.constructor(s);if(this.state!==h){var B=this.state===_?R:N;w(T,B,this.outcome)}else this.queue.push(new f(T,R,N));return T};function f(R,N,T){this.promise=R,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof T=="function"&&(this.onRejected=T,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(R){l.resolve(this.promise,R)},f.prototype.otherCallFulfilled=function(R){w(this.promise,this.onFulfilled,R)},f.prototype.callRejected=function(R){l.reject(this.promise,R)},f.prototype.otherCallRejected=function(R){w(this.promise,this.onRejected,R)};function w(R,N,T){o(function(){var B;try{B=N(T)}catch(K){return l.reject(R,K)}B===R?l.reject(R,new TypeError("Cannot resolve promise with itself")):l.resolve(R,B)})}l.resolve=function(R,N){var T=b(A,N);if(T.status==="error")return l.reject(R,T.value);var B=T.value;if(B)C(R,B);else{R.state=_,R.outcome=N;for(var K=-1,z=R.queue.length;++K<z;)R.queue[K].callFulfilled(N)}return R},l.reject=function(R,N){R.state=d,R.outcome=N;for(var T=-1,B=R.queue.length;++T<B;)R.queue[T].callRejected(N);return R};function A(R){var N=R&&R.then;if(R&&(typeof R=="object"||typeof R=="function")&&typeof N=="function")return function(){N.apply(R,arguments)}}function C(R,N){var T=!1;function B(me){T||(T=!0,l.reject(R,me))}function K(me){T||(T=!0,l.resolve(R,me))}function z(){N(K,B)}var te=b(z);te.status==="error"&&B(te.value)}function b(R,N){var T={};try{T.value=R(N),T.status="success"}catch(B){T.status="error",T.value=B}return T}p.resolve=x;function x(R){return R instanceof this?R:l.resolve(new this(s),R)}p.reject=D;function D(R){var N=new this(s);return l.reject(N,R)}p.all=H;function H(R){var N=this;if(Object.prototype.toString.call(R)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=R.length,B=!1;if(!T)return this.resolve([]);for(var K=new Array(T),z=0,te=-1,me=new this(s);++te<T;)We(R[te],te);return me;function We(Qt,Dn){N.resolve(Qt).then(ua,function(St){B||(B=!0,l.reject(me,St))});function ua(St){K[Dn]=St,++z===T&&!B&&(B=!0,l.resolve(me,K))}}}p.race=j;function j(R){var N=this;if(Object.prototype.toString.call(R)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=R.length,B=!1;if(!T)return this.resolve([]);for(var K=-1,z=new this(s);++K<T;)te(R[K]);return z;function te(me){N.resolve(me).then(function(We){B||(B=!0,l.resolve(z,We))},function(We){B||(B=!0,l.reject(z,We))})}}},{1:1}],3:[function(r,a,i){(function(o){"use strict";typeof o.Promise!="function"&&(o.Promise=r(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(r,a,i){"use strict";var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c};function s(c,m){if(!(c instanceof m))throw new TypeError("Cannot call a class as a function")}function l(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(c){return}}var d=l();function _(){try{if(!d||!d.open)return!1;var c=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!c||m)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(u){return!1}}function h(c,m){c=c||[],m=m||{};try{return new Blob(c,m)}catch(v){if(v.name!=="TypeError")throw v;for(var u=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,g=new u,y=0;y<c.length;y+=1)g.append(c[y]);return g.getBlob(m.type)}}typeof Promise=="undefined"&&r(3);var p=Promise;function f(c,m){m&&c.then(function(u){m(null,u)},function(u){m(u)})}function w(c,m,u){typeof m=="function"&&c.then(m),typeof u=="function"&&c.catch(u)}function A(c){return typeof c!="string"&&(console.warn(c+" used as a key, but it is not a string."),c=String(c)),c}function C(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var b="local-forage-detect-blob-support",x=void 0,D={},H=Object.prototype.toString,j="readonly",R="readwrite";function N(c){for(var m=c.length,u=new ArrayBuffer(m),g=new Uint8Array(u),y=0;y<m;y++)g[y]=c.charCodeAt(y);return u}function T(c){return new p(function(m){var u=c.transaction(b,R),g=h([""]);u.objectStore(b).put(g,"key"),u.onabort=function(y){y.preventDefault(),y.stopPropagation(),m(!1)},u.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),v=navigator.userAgent.match(/Edge\//);m(v||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function B(c){return typeof x=="boolean"?p.resolve(x):T(c).then(function(m){return x=m,x})}function K(c){var m=D[c.name],u={};u.promise=new p(function(g,y){u.resolve=g,u.reject=y}),m.deferredOperations.push(u),m.dbReady?m.dbReady=m.dbReady.then(function(){return u.promise}):m.dbReady=u.promise}function z(c){var m=D[c.name],u=m.deferredOperations.pop();if(u)return u.resolve(),u.promise}function te(c,m){var u=D[c.name],g=u.deferredOperations.pop();if(g)return g.reject(m),g.promise}function me(c,m){return new p(function(u,g){if(D[c.name]=D[c.name]||No(),c.db)if(m)K(c),c.db.close();else return u(c.db);var y=[c.name];m&&y.push(c.version);var v=d.open.apply(d,y);m&&(v.onupgradeneeded=function(E){var S=v.result;try{S.createObjectStore(c.storeName),E.oldVersion<=1&&S.createObjectStore(b)}catch(O){if(O.name==="ConstraintError")console.warn('The database "'+c.name+'" has been upgraded from version '+E.oldVersion+" to version "+E.newVersion+', but the storage "'+c.storeName+'" already exists.');else throw O}}),v.onerror=function(E){E.preventDefault(),g(v.error)},v.onsuccess=function(){var E=v.result;E.onversionchange=function(S){S.target.close()},u(E),z(c)}})}function We(c){return me(c,!1)}function Qt(c){return me(c,!0)}function Dn(c,m){if(!c.db)return!0;var u=!c.db.objectStoreNames.contains(c.storeName),g=c.version<c.db.version,y=c.version>c.db.version;if(g&&(c.version!==m&&console.warn('The database "'+c.name+`" can't be downgraded from version `+c.db.version+" to version "+c.version+"."),c.version=c.db.version),y||u){if(u){var v=c.db.version+1;v>c.version&&(c.version=v)}return!0}return!1}function ua(c){return new p(function(m,u){var g=new FileReader;g.onerror=u,g.onloadend=function(y){var v=btoa(y.target.result||"");m({__local_forage_encoded_blob:!0,data:v,type:c.type})},g.readAsBinaryString(c)})}function St(c){var m=N(atob(c.data));return h([m],{type:c.type})}function Do(c){return c&&c.__local_forage_encoded_blob}function Iu(c){var m=this,u=m._initReady().then(function(){var g=D[m._dbInfo.name];if(g&&g.dbReady)return g.dbReady});return w(u,c,c),u}function Au(c){K(c);for(var m=D[c.name],u=m.forages,g=0;g<u.length;g++){var y=u[g];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return c.db=null,We(c).then(function(v){return c.db=v,Dn(c)?Qt(c):v}).then(function(v){c.db=m.db=v;for(var E=0;E<u.length;E++)u[E]._dbInfo.db=v}).catch(function(v){throw te(c,v),v})}function Ke(c,m,u,g){g===void 0&&(g=1);try{var y=c.db.transaction(c.storeName,m);u(null,y)}catch(v){if(g>0&&(!c.db||v.name==="InvalidStateError"||v.name==="NotFoundError"))return p.resolve().then(function(){if(!c.db||v.name==="NotFoundError"&&!c.db.objectStoreNames.contains(c.storeName)&&c.version<=c.db.version)return c.db&&(c.version=c.db.version+1),Qt(c)}).then(function(){return Au(c).then(function(){Ke(c,m,u,g-1)})}).catch(u);u(v)}}function No(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Su(c){var m=this,u={db:null};if(c)for(var g in c)u[g]=c[g];var y=D[u.name];y||(y=No(),D[u.name]=y),y.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=Iu);var v=[];function E(){return p.resolve()}for(var S=0;S<y.forages.length;S++){var O=y.forages[S];O!==m&&v.push(O._initReady().catch(E))}var k=y.forages.slice(0);return p.all(v).then(function(){return u.db=y.db,We(u)}).then(function(P){return u.db=P,Dn(u,m._defaultConfig.version)?Qt(u):P}).then(function(P){u.db=y.db=P,m._dbInfo=u;for(var U=0;U<k.length;U++){var F=k[U];F!==m&&(F._dbInfo.db=u.db,F._dbInfo.version=u.version)}})}function Cu(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){Ke(u._dbInfo,j,function(E,S){if(E)return v(E);try{var O=S.objectStore(u._dbInfo.storeName),k=O.get(c);k.onsuccess=function(){var P=k.result;P===void 0&&(P=null),Do(P)&&(P=St(P)),y(P)},k.onerror=function(){v(k.error)}}catch(P){v(P)}})}).catch(v)});return f(g,m),g}function Ru(c,m){var u=this,g=new p(function(y,v){u.ready().then(function(){Ke(u._dbInfo,j,function(E,S){if(E)return v(E);try{var O=S.objectStore(u._dbInfo.storeName),k=O.openCursor(),P=1;k.onsuccess=function(){var U=k.result;if(U){var F=U.value;Do(F)&&(F=St(F));var W=c(F,U.key,P++);W!==void 0?y(W):U.continue()}else y()},k.onerror=function(){v(k.error)}}catch(U){v(U)}})}).catch(v)});return f(g,m),g}function Ou(c,m,u){var g=this;c=A(c);var y=new p(function(v,E){var S;g.ready().then(function(){return S=g._dbInfo,H.call(m)==="[object Blob]"?B(S.db).then(function(O){return O?m:ua(m)}):m}).then(function(O){Ke(g._dbInfo,R,function(k,P){if(k)return E(k);try{var U=P.objectStore(g._dbInfo.storeName);O===null&&(O=void 0);var F=U.put(O,c);P.oncomplete=function(){O===void 0&&(O=null),v(O)},P.onabort=P.onerror=function(){var W=F.error?F.error:F.transaction.error;E(W)}}catch(W){E(W)}})}).catch(E)});return f(y,u),y}function ku(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){Ke(u._dbInfo,R,function(E,S){if(E)return v(E);try{var O=S.objectStore(u._dbInfo.storeName),k=O.delete(c);S.oncomplete=function(){y()},S.onerror=function(){v(k.error)},S.onabort=function(){var P=k.error?k.error:k.transaction.error;v(P)}}catch(P){v(P)}})}).catch(v)});return f(g,m),g}function Tu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){Ke(m._dbInfo,R,function(v,E){if(v)return y(v);try{var S=E.objectStore(m._dbInfo.storeName),O=S.clear();E.oncomplete=function(){g()},E.onabort=E.onerror=function(){var k=O.error?O.error:O.transaction.error;y(k)}}catch(k){y(k)}})}).catch(y)});return f(u,c),u}function xu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){Ke(m._dbInfo,j,function(v,E){if(v)return y(v);try{var S=E.objectStore(m._dbInfo.storeName),O=S.count();O.onsuccess=function(){g(O.result)},O.onerror=function(){y(O.error)}}catch(k){y(k)}})}).catch(y)});return f(u,c),u}function Pu(c,m){var u=this,g=new p(function(y,v){if(c<0){y(null);return}u.ready().then(function(){Ke(u._dbInfo,j,function(E,S){if(E)return v(E);try{var O=S.objectStore(u._dbInfo.storeName),k=!1,P=O.openKeyCursor();P.onsuccess=function(){var U=P.result;if(!U){y(null);return}c===0||k?y(U.key):(k=!0,U.advance(c))},P.onerror=function(){v(P.error)}}catch(U){v(U)}})}).catch(v)});return f(g,m),g}function Lu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){Ke(m._dbInfo,j,function(v,E){if(v)return y(v);try{var S=E.objectStore(m._dbInfo.storeName),O=S.openKeyCursor(),k=[];O.onsuccess=function(){var P=O.result;if(!P){g(k);return}k.push(P.key),P.continue()},O.onerror=function(){y(O.error)}}catch(P){y(P)}})}).catch(y)});return f(u,c),u}function Du(c,m){m=C.apply(this,arguments);var u=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||u.name,c.storeName=c.storeName||u.storeName);var g=this,y;if(!c.name)y=p.reject("Invalid arguments");else{var v=c.name===u.name&&g._dbInfo.db,E=v?p.resolve(g._dbInfo.db):We(c).then(function(S){var O=D[c.name],k=O.forages;O.db=S;for(var P=0;P<k.length;P++)k[P]._dbInfo.db=S;return S});c.storeName?y=E.then(function(S){if(S.objectStoreNames.contains(c.storeName)){var O=S.version+1;K(c);var k=D[c.name],P=k.forages;S.close();for(var U=0;U<P.length;U++){var F=P[U];F._dbInfo.db=null,F._dbInfo.version=O}var W=new p(function(X,ce){var oe=d.open(c.name,O);oe.onerror=function(Be){var en=oe.result;en.close(),ce(Be)},oe.onupgradeneeded=function(){var Be=oe.result;Be.deleteObjectStore(c.storeName)},oe.onsuccess=function(){var Be=oe.result;Be.close(),X(Be)}});return W.then(function(X){k.db=X;for(var ce=0;ce<P.length;ce++){var oe=P[ce];oe._dbInfo.db=X,z(oe._dbInfo)}}).catch(function(X){throw(te(c,X)||p.resolve()).catch(function(){}),X})}}):y=E.then(function(S){K(c);var O=D[c.name],k=O.forages;S.close();for(var P=0;P<k.length;P++){var U=k[P];U._dbInfo.db=null}var F=new p(function(W,X){var ce=d.deleteDatabase(c.name);ce.onerror=function(){var oe=ce.result;oe&&oe.close(),X(ce.error)},ce.onblocked=function(){console.warn('dropInstance blocked for database "'+c.name+'" until all open connections are closed')},ce.onsuccess=function(){var oe=ce.result;oe&&oe.close(),W(oe)}});return F.then(function(W){O.db=W;for(var X=0;X<k.length;X++){var ce=k[X];z(ce._dbInfo)}}).catch(function(W){throw(te(c,W)||p.resolve()).catch(function(){}),W})})}return f(y,m),y}var Nu={_driver:"asyncStorage",_initStorage:Su,_support:_(),iterate:Ru,getItem:Cu,setItem:Ou,removeItem:ku,clear:Tu,length:xu,key:Pu,keys:Lu,dropInstance:Du};function Uu(){return typeof openDatabase=="function"}var lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bu="~~local_forage_type~",Uo=/^~~local_forage_type~([^~]+)~/,Nn="__lfsc__:",da=Nn.length,fa="arbf",ha="blob",Bo="si08",Mo="ui08",Go="uic8",Jo="si16",Fo="si32",Ho="ur16",qo="ui32",jo="fl32",Vo="fl64",$o=da+fa.length,Wo=Object.prototype.toString;function Ko(c){var m=c.length*.75,u=c.length,g,y=0,v,E,S,O;c[c.length-1]==="="&&(m--,c[c.length-2]==="="&&m--);var k=new ArrayBuffer(m),P=new Uint8Array(k);for(g=0;g<u;g+=4)v=lt.indexOf(c[g]),E=lt.indexOf(c[g+1]),S=lt.indexOf(c[g+2]),O=lt.indexOf(c[g+3]),P[y++]=v<<2|E>>4,P[y++]=(E&15)<<4|S>>2,P[y++]=(S&3)<<6|O&63;return k}function ma(c){var m=new Uint8Array(c),u="",g;for(g=0;g<m.length;g+=3)u+=lt[m[g]>>2],u+=lt[(m[g]&3)<<4|m[g+1]>>4],u+=lt[(m[g+1]&15)<<2|m[g+2]>>6],u+=lt[m[g+2]&63];return m.length%3===2?u=u.substring(0,u.length-1)+"=":m.length%3===1&&(u=u.substring(0,u.length-2)+"=="),u}function Mu(c,m){var u="";if(c&&(u=Wo.call(c)),c&&(u==="[object ArrayBuffer]"||c.buffer&&Wo.call(c.buffer)==="[object ArrayBuffer]")){var g,y=Nn;c instanceof ArrayBuffer?(g=c,y+=fa):(g=c.buffer,u==="[object Int8Array]"?y+=Bo:u==="[object Uint8Array]"?y+=Mo:u==="[object Uint8ClampedArray]"?y+=Go:u==="[object Int16Array]"?y+=Jo:u==="[object Uint16Array]"?y+=Ho:u==="[object Int32Array]"?y+=Fo:u==="[object Uint32Array]"?y+=qo:u==="[object Float32Array]"?y+=jo:u==="[object Float64Array]"?y+=Vo:m(new Error("Failed to get type for BinaryArray"))),m(y+ma(g))}else if(u==="[object Blob]"){var v=new FileReader;v.onload=function(){var E=Bu+c.type+"~"+ma(this.result);m(Nn+ha+E)},v.readAsArrayBuffer(c)}else try{m(JSON.stringify(c))}catch(E){console.error("Couldn't convert value into a JSON string: ",c),m(null,E)}}function Gu(c){if(c.substring(0,da)!==Nn)return JSON.parse(c);var m=c.substring($o),u=c.substring(da,$o),g;if(u===ha&&Uo.test(m)){var y=m.match(Uo);g=y[1],m=m.substring(y[0].length)}var v=Ko(m);switch(u){case fa:return v;case ha:return h([v],{type:g});case Bo:return new Int8Array(v);case Mo:return new Uint8Array(v);case Go:return new Uint8ClampedArray(v);case Jo:return new Int16Array(v);case Ho:return new Uint16Array(v);case Fo:return new Int32Array(v);case qo:return new Uint32Array(v);case jo:return new Float32Array(v);case Vo:return new Float64Array(v);default:throw new Error("Unkown type: "+u)}}var pa={serialize:Mu,deserialize:Gu,stringToBuffer:Ko,bufferToString:ma};function zo(c,m,u,g){c.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],u,g)}function Ju(c){var m=this,u={db:null};if(c)for(var g in c)u[g]=typeof c[g]!="string"?c[g].toString():c[g];var y=new p(function(v,E){try{u.db=openDatabase(u.name,String(u.version),u.description,u.size)}catch(S){return E(S)}u.db.transaction(function(S){zo(S,u,function(){m._dbInfo=u,v()},function(O,k){E(k)})},E)});return u.serializer=pa,y}function ct(c,m,u,g,y,v){c.executeSql(u,g,y,function(E,S){S.code===S.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(O,k){k.rows.length?v(O,S):zo(O,m,function(){O.executeSql(u,g,y,v)},v)},v):v(E,S)},v)}function Fu(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(S){ct(S,E,"SELECT * FROM "+E.storeName+" WHERE key = ? LIMIT 1",[c],function(O,k){var P=k.rows.length?k.rows.item(0).value:null;P&&(P=E.serializer.deserialize(P)),y(P)},function(O,k){v(k)})})}).catch(v)});return f(g,m),g}function Hu(c,m){var u=this,g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(S){ct(S,E,"SELECT * FROM "+E.storeName,[],function(O,k){for(var P=k.rows,U=P.length,F=0;F<U;F++){var W=P.item(F),X=W.value;if(X&&(X=E.serializer.deserialize(X)),X=c(X,W.key,F+1),X!==void 0){y(X);return}}y()},function(O,k){v(k)})})}).catch(v)});return f(g,m),g}function Xo(c,m,u,g){var y=this;c=A(c);var v=new p(function(E,S){y.ready().then(function(){m===void 0&&(m=null);var O=m,k=y._dbInfo;k.serializer.serialize(m,function(P,U){U?S(U):k.db.transaction(function(F){ct(F,k,"INSERT OR REPLACE INTO "+k.storeName+" (key, value) VALUES (?, ?)",[c,P],function(){E(O)},function(W,X){S(X)})},function(F){if(F.code===F.QUOTA_ERR){if(g>0){E(Xo.apply(y,[c,O,u,g-1]));return}S(F)}})})}).catch(S)});return f(v,u),v}function qu(c,m,u){return Xo.apply(this,[c,m,u,1])}function ju(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(S){ct(S,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[c],function(){y()},function(O,k){v(k)})})}).catch(v)});return f(g,m),g}function Vu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(E){ct(E,v,"DELETE FROM "+v.storeName,[],function(){g()},function(S,O){y(O)})})}).catch(y)});return f(u,c),u}function $u(c){var m=this,u=new p(function(g,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(E){ct(E,v,"SELECT COUNT(key) as c FROM "+v.storeName,[],function(S,O){var k=O.rows.item(0).c;g(k)},function(S,O){y(O)})})}).catch(y)});return f(u,c),u}function Wu(c,m){var u=this,g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(S){ct(S,E,"SELECT key FROM "+E.storeName+" WHERE id = ? LIMIT 1",[c+1],function(O,k){var P=k.rows.length?k.rows.item(0).key:null;y(P)},function(O,k){v(k)})})}).catch(v)});return f(g,m),g}function Ku(c){var m=this,u=new p(function(g,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(E){ct(E,v,"SELECT key FROM "+v.storeName,[],function(S,O){for(var k=[],P=0;P<O.rows.length;P++)k.push(O.rows.item(P).key);g(k)},function(S,O){y(O)})})}).catch(y)});return f(u,c),u}function zu(c){return new p(function(m,u){c.transaction(function(g){g.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,v){for(var E=[],S=0;S<v.rows.length;S++)E.push(v.rows.item(S).name);m({db:c,storeNames:E})},function(y,v){u(v)})},function(g){u(g)})})}function Xu(c,m){m=C.apply(this,arguments);var u=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||u.name,c.storeName=c.storeName||u.storeName);var g=this,y;return c.name?y=new p(function(v){var E;c.name===u.name?E=g._dbInfo.db:E=openDatabase(c.name,"","",0),c.storeName?v({db:E,storeNames:[c.storeName]}):v(zu(E))}).then(function(v){return new p(function(E,S){v.db.transaction(function(O){function k(W){return new p(function(X,ce){O.executeSql("DROP TABLE IF EXISTS "+W,[],function(){X()},function(oe,Be){ce(Be)})})}for(var P=[],U=0,F=v.storeNames.length;U<F;U++)P.push(k(v.storeNames[U]));p.all(P).then(function(){E()}).catch(function(W){S(W)})},function(O){S(O)})})}):y=p.reject("Invalid arguments"),f(y,m),y}var Yu={_driver:"webSQLStorage",_initStorage:Ju,_support:Uu(),iterate:Hu,getItem:Fu,setItem:qu,removeItem:ju,clear:Vu,length:$u,key:Wu,keys:Ku,dropInstance:Xu};function Qu(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(c){return!1}}function Yo(c,m){var u=c.name+"/";return c.storeName!==m.storeName&&(u+=c.storeName+"/"),u}function Zu(){var c="_localforage_support_test";try{return localStorage.setItem(c,!0),localStorage.removeItem(c),!1}catch(m){return!0}}function ed(){return!Zu()||localStorage.length>0}function td(c){var m=this,u={};if(c)for(var g in c)u[g]=c[g];return u.keyPrefix=Yo(c,m._defaultConfig),ed()?(m._dbInfo=u,u.serializer=pa,p.resolve()):p.reject()}function nd(c){var m=this,u=m.ready().then(function(){for(var g=m._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var v=localStorage.key(y);v.indexOf(g)===0&&localStorage.removeItem(v)}});return f(u,c),u}function rd(c,m){var u=this;c=A(c);var g=u.ready().then(function(){var y=u._dbInfo,v=localStorage.getItem(y.keyPrefix+c);return v&&(v=y.serializer.deserialize(v)),v});return f(g,m),g}function ad(c,m){var u=this,g=u.ready().then(function(){for(var y=u._dbInfo,v=y.keyPrefix,E=v.length,S=localStorage.length,O=1,k=0;k<S;k++){var P=localStorage.key(k);if(P.indexOf(v)===0){var U=localStorage.getItem(P);if(U&&(U=y.serializer.deserialize(U)),U=c(U,P.substring(E),O++),U!==void 0)return U}}});return f(g,m),g}function id(c,m){var u=this,g=u.ready().then(function(){var y=u._dbInfo,v;try{v=localStorage.key(c)}catch(E){v=null}return v&&(v=v.substring(y.keyPrefix.length)),v});return f(g,m),g}function od(c){var m=this,u=m.ready().then(function(){for(var g=m._dbInfo,y=localStorage.length,v=[],E=0;E<y;E++){var S=localStorage.key(E);S.indexOf(g.keyPrefix)===0&&v.push(S.substring(g.keyPrefix.length))}return v});return f(u,c),u}function sd(c){var m=this,u=m.keys().then(function(g){return g.length});return f(u,c),u}function ld(c,m){var u=this;c=A(c);var g=u.ready().then(function(){var y=u._dbInfo;localStorage.removeItem(y.keyPrefix+c)});return f(g,m),g}function cd(c,m,u){var g=this;c=A(c);var y=g.ready().then(function(){m===void 0&&(m=null);var v=m;return new p(function(E,S){var O=g._dbInfo;O.serializer.serialize(m,function(k,P){if(P)S(P);else try{localStorage.setItem(O.keyPrefix+c,k),E(v)}catch(U){(U.name==="QuotaExceededError"||U.name==="NS_ERROR_DOM_QUOTA_REACHED")&&S(U),S(U)}})})});return f(y,u),y}function ud(c,m){if(m=C.apply(this,arguments),c=typeof c!="function"&&c||{},!c.name){var u=this.config();c.name=c.name||u.name,c.storeName=c.storeName||u.storeName}var g=this,y;return c.name?y=new p(function(v){c.storeName?v(Yo(c,g._defaultConfig)):v(c.name+"/")}).then(function(v){for(var E=localStorage.length-1;E>=0;E--){var S=localStorage.key(E);S.indexOf(v)===0&&localStorage.removeItem(S)}}):y=p.reject("Invalid arguments"),f(y,m),y}var dd={_driver:"localStorageWrapper",_initStorage:td,_support:Qu(),iterate:ad,getItem:rd,setItem:cd,removeItem:ld,clear:nd,length:sd,key:id,keys:od,dropInstance:ud},fd=function(m,u){return m===u||typeof m=="number"&&typeof u=="number"&&isNaN(m)&&isNaN(u)},hd=function(m,u){for(var g=m.length,y=0;y<g;){if(fd(m[y],u))return!0;y++}return!1},Qo=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},Zt={},Zo={},Ct={INDEXEDDB:Nu,WEBSQL:Yu,LOCALSTORAGE:dd},md=[Ct.INDEXEDDB._driver,Ct.WEBSQL._driver,Ct.LOCALSTORAGE._driver],Un=["dropInstance"],va=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Un),pd={description:"",driver:md.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function vd(c,m){c[m]=function(){var u=arguments;return c.ready().then(function(){return c[m].apply(c,u)})}}function ga(){for(var c=1;c<arguments.length;c++){var m=arguments[c];if(m)for(var u in m)m.hasOwnProperty(u)&&(Qo(m[u])?arguments[0][u]=m[u].slice():arguments[0][u]=m[u])}return arguments[0]}var gd=function(){function c(m){s(this,c);for(var u in Ct)if(Ct.hasOwnProperty(u)){var g=Ct[u],y=g._driver;this[u]=y,Zt[y]||this.defineDriver(g)}this._defaultConfig=ga({},pd),this._config=ga({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return c.prototype.config=function(u){if((typeof u=="undefined"?"undefined":o(u))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var g in u){if(g==="storeName"&&(u[g]=u[g].replace(/\W/g,"_")),g==="version"&&typeof u[g]!="number")return new Error("Database version must be a number.");this._config[g]=u[g]}return"driver"in u&&u.driver?this.setDriver(this._config.driver):!0}else return typeof u=="string"?this._config[u]:this._config},c.prototype.defineDriver=function(u,g,y){var v=new p(function(E,S){try{var O=u._driver,k=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver){S(k);return}for(var P=va.concat("_initStorage"),U=0,F=P.length;U<F;U++){var W=P[U],X=!hd(Un,W);if((X||u[W])&&typeof u[W]!="function"){S(k);return}}var ce=function(){for(var en=function(wd){return function(){var bd=new Error("Method "+wd+" is not implemented by the current driver"),es=p.reject(bd);return f(es,arguments[arguments.length-1]),es}},_a=0,yd=Un.length;_a<yd;_a++){var ya=Un[_a];u[ya]||(u[ya]=en(ya))}};ce();var oe=function(en){Zt[O]&&console.info("Redefining LocalForage driver: "+O),Zt[O]=u,Zo[O]=en,E()};"_support"in u?u._support&&typeof u._support=="function"?u._support().then(oe,S):oe(!!u._support):oe(!0)}catch(Be){S(Be)}});return w(v,g,y),v},c.prototype.driver=function(){return this._driver||null},c.prototype.getDriver=function(u,g,y){var v=Zt[u]?p.resolve(Zt[u]):p.reject(new Error("Driver not found."));return w(v,g,y),v},c.prototype.getSerializer=function(u){var g=p.resolve(pa);return w(g,u),g},c.prototype.ready=function(u){var g=this,y=g._driverSet.then(function(){return g._ready===null&&(g._ready=g._initDriver()),g._ready});return w(y,u,u),y},c.prototype.setDriver=function(u,g,y){var v=this;Qo(u)||(u=[u]);var E=this._getSupportedDrivers(u);function S(){v._config.driver=v.driver()}function O(U){return v._extend(U),S(),v._ready=v._initStorage(v._config),v._ready}function k(U){return function(){var F=0;function W(){for(;F<U.length;){var X=U[F];return F++,v._dbInfo=null,v._ready=null,v.getDriver(X).then(O).catch(W)}S();var ce=new Error("No available storage method found.");return v._driverSet=p.reject(ce),v._driverSet}return W()}}var P=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=P.then(function(){var U=E[0];return v._dbInfo=null,v._ready=null,v.getDriver(U).then(function(F){v._driver=F._driver,S(),v._wrapLibraryMethodsWithReady(),v._initDriver=k(E)})}).catch(function(){S();var U=new Error("No available storage method found.");return v._driverSet=p.reject(U),v._driverSet}),w(this._driverSet,g,y),this._driverSet},c.prototype.supports=function(u){return!!Zo[u]},c.prototype._extend=function(u){ga(this,u)},c.prototype._getSupportedDrivers=function(u){for(var g=[],y=0,v=u.length;y<v;y++){var E=u[y];this.supports(E)&&g.push(E)}return g},c.prototype._wrapLibraryMethodsWithReady=function(){for(var u=0,g=va.length;u<g;u++)vd(this,va[u])},c.prototype.createInstance=function(u){return new c(u)},c}(),_d=new gd;a.exports=_d},{3:3}]},{},[4])(4)})});var rl=Ea(vr=>{"use strict";G();sn();dt();var fi=(e,t)=>{window.parent&&window.parent.postMessage({type:e,data:t},"*")},hi=ge(),Ff=Ze("levelFinished",{paramsSchema:J.tuple(J.object({levelId:J.or(J.string(),J.number()),duration:J.number().optional(),rating:J.number().optional(),score:J.number().optional(),variation:J.string().optional()})),implement:e=>I(vr,null,function*(){let{levelId:t,duration:n,rating:r,score:a,variation:i}=e;Te.info("onLevelFinished",n,r,a,i),fi("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:n,rating:r,score:a,variation:i}),yield Promise.all([Ye.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:n,rating:r,score:a}}}),Ye.tracker("LevelFinished",{levelId:t,duration:n,rating:r,score:a,variation:i})])})}),Hf=Ze("gamePlayEnded",{paramsSchema:J.tuple(J.object({duration:J.number().optional(),rating:J.number().optional(),score:J.number(),variation:J.string().optional()})),implement:e=>I(vr,null,function*(){let{duration:t,rating:n,score:r,variation:a}=e;Te.info("onGamePlayEnded",t,n,r,a),fi("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:n,score:r,variation:a}),yield Promise.all([Ye.tracker("GamePlayEnded",{duration:t,rating:n,score:r,variation:a}),Ye.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:n,score:r}}})])})}),qf=Ze("levelUpgrade",{paramsSchema:J.tuple(J.object({levelId:J.or(J.string(),J.number()),name:J.string().optional()})),implement:n=>I(vr,[n],function*({levelId:e,name:t}){Te.info("onLevelUpgrade",e,t),fi("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:e,name:t}),yield Promise.all([Ye.tracker("LevelUpgrade",{name:t,levelId:e}),Ye.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})])})});hi.registerCommand("TaskTrackerSDK.levelFinished",Ff);hi.registerCommand("TaskTrackerSDK.gamePlayEnded",Hf);hi.registerCommand("TaskTrackerSDK.levelUpgrade",qf);_e("TaskTrackerSDK.onLevelFinished",{version:"1.1.25",properties:{params:{levelId:"1.1.25",duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});_e("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});_e("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var qe,Pt,al,mi,jf,wt,gr=ee(()=>{"use strict";qe=(e,t)=>{var n;window.dispatchEvent(new CustomEvent(e,{detail:t})),(n=window.parent)==null||n.postMessage({type:e,data:{detail:t}},"*")},Pt=new Map,al=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let n=Pt.get(t.type);n&&n.forEach(r=>{try{r(t.data)}catch(a){console.warn("Callback execution failed:",a)}})}}catch(t){console.warn("Failed to parse message:",t)}},mi=!1,jf=()=>{mi||(window.addEventListener("message",al),mi=!0)},wt=(e,t)=>{jf(),Pt.has(e)||Pt.set(e,new Set);let n=Pt.get(e);return n.add(t),()=>{n.delete(t),n.size===0&&Pt.delete(e),Pt.size===0&&(window.removeEventListener("message",al),mi=!1)}}});var _r,yr,wr,br,Er,pi,Ir,Ar,Sr,Cr,Lt,Vf,Y,et,tt,Se=ee(()=>{"use strict";G();_r="UNLOCK_OPTIONS_CHANGED",yr="INVOKE_PAYMENT",wr="ON_PAYMENT_RESULT",br="ON_USE_MODAL_EVENT",Er="ON_USE_MODAL_RESULT",pi="ON_USE_MODAL_FREQUENCY",Ir="ON_USE_UNLOGIN_MODAL_EVENT",Ar="INVOKE_UNLOGIN_MODAL_EVENT",Sr="INVOKE_SUBSCRIPTION_EVENT",Cr="ON_USE_SUBSCRIPTION_RESULT",Lt=new He,Vf=()=>({on:Lt.on.bind(Lt),off:Lt.off.bind(Lt),emit:Lt.emit.bind(Lt)}),Y=Vf(),et={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},tt={show:!0,minInterval:8*60*60*1e3}});var ru=Ea(aa=>{"use strict";ue();Se();gr();G();var nu={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};wt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",nu[e.result],e.result),Y.emit(Er,{useModalResult:nu[e.result]})});Y.on(br,(e,t)=>{var n;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||qe("JOLIBOX_JOLI_COIN_USE_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(n=t.sequenceId)!=null?n:Ge()})});wt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{Y.emit(wr,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});Y.on(yr,(e,t)=>I(aa,null,function*(){var n;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||qe("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(n=t.sequenceId)!=null?n:Ge()})}));wt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,n,r,a,i;Y.emit(Ir,{result:e.result=="ADS"?"FAILED":e.result,rewards:{claimedRewardValue:(a=(r=(n=(t=e.extra)==null?void 0:t.firstLogin)==null?void 0:n.reward)==null?void 0:r.rewardValue)!=null?a:0,isFirstLogin:(i=e.isFirstLogin)!=null?i:!1}}),e.result==="SUCCESS"&&L.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});Y.on(Ar,e=>I(aa,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||qe("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:Ge(),type:e})}));wt("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),Y.emit(Cr,{result:e.result})});Y.on(Sr,e=>I(aa,null,function*(){console.log("----notify custom event-----",e),qe("JOLIBOX_SUB_EVENT",{sequenceId:Ge()})}))});dt();ue();sn();G();var Qs=ge(),Sf="env",Cf="getSystemInfoSync",Rf=()=>{var a,i,o,s;let e={system:L.deviceInfo.system,platform:L.deviceInfo.platform.toLowerCase(),brand:L.deviceInfo.brand,pixelRatio:L.deviceInfo.pixelRatio,language:L.deviceInfo.lang,version:L.sdkInfo.jssdkVersion,appName:(a=L.hostInfo)==null?void 0:a.appName,SDKVersion:L.sdkInfo.nativeSDKVersion},t=(i=L.hostInfo)==null?void 0:i.version;t&&(e=Ee(q({},e),{version:t}));let n=(o=L.hostInfo)==null?void 0:o.appName;n&&(e=Ee(q({},e),{appName:n}));let r=(s=L.sdkInfo)==null?void 0:s.jssdkVersion;return r&&(e=Ee(q({},e),{SDKVersion:r})),e},Of=yt(Cf,{implement:Rf}),kf=yt(Sf,{implement:()=>Ee(q({},L.hostInfo),{sdkInfo:L.sdkInfo,platform:L.platform,deviceInfo:L.deviceInfo})});Qs.registerCommand("API.env",kf);Qs.registerCommand("API.getSystemInfoSync",Of);_e("env",{version:"1.0.0"});_e("getSystemInfoSync",{version:"1.0.0"});G();sn();ze();dt();var Tf="onJoliboxShow",xf="onJoliboxHide",Pf="onReady",li=ge(),ci=ws(xe),si=!0,ln=!0,fr=0,hr=ei;function Lf(){let e=Date.now();if(e-fr<100)return;fr=e;let t=document.visibilityState==="visible";t!==si&&(si=t,hr.emit("visible",si))}function Zs(e){let t=Date.now();t-fr<100||(fr=t,e==="focus"&&!ln?ln=!0:e==="blur"&&ln&&(ln=!1),hr.emit("visible",ln))}document.addEventListener("visibilitychange",Lf);window.addEventListener("focus",()=>Zs("focus"));window.addEventListener("blur",()=>Zs("blur"));var Df=yt(Tf,{paramsSchema:J.tuple(J.function()),implement(e){let t=ci(e);hr.on("visible",n=>{n&&t()})}}),Nf=yt(xf,{paramsSchema:J.tuple(J.function()),implement(e){let t=ci(e);hr.on("visible",n=>{!n&&t()})}}),Uf=yt(Pf,{paramsSchema:J.tuple(J.function()),implement(e){let t=ci(e);ut.on("LifecycleEvent.onReady",n=>{t(n)})}});li.registerCommand("LifecycleSDK.onReady",Uf);li.registerCommand("LifecycleSDK.onJoliboxShow",Df);li.registerCommand("LifecycleSDK.onJoliboxHide",Nf);_e("lifeCycle.onReady",{version:"1.0.0"});_e("lifeCycle.onJoliboxShow",{version:"1.0.0"});_e("lifeCycle.onJoliboxHide",{version:"1.0.0"});sn();G();Tt();ue();var nl=Ia(tl());var mr=ge(),di=class{constructor(){this.httpClient=Je.create({baseUrl:kt(L.testMode)});this.getGameId=()=>L.mpId;this.getItem=t=>I(this,null,function*(){let{code:n,data:r,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),i=r==null?void 0:r.value,o=a;return n!=="SUCCESS"&&(i=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",i),o+="fallback to localstorage"),{code:n,message:o,data:i&&i!=="undefined"?i:null}});this.setItem=(t,n)=>I(this,null,function*(){let r=typeof n=="string"?n:String(n),{code:a,message:i}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:r}});return yield this.gameStore.setItem(t,r),{code:a,message:i}});this.removeItem=t=>I(this,null,function*(){yield this.gameStore.removeItem(t);let{code:n,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:n,message:r}});this.clear=()=>I(this,null,function*(){yield this.gameStore.clear();let{code:t,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:n}});this.gameId=this.getGameId(),this.gameStore=nl.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},pr=new di,Bf=Ze("getLocalStorage",{paramsSchema:J.tuple(J.string()),implement(e){return I(this,null,function*(){return yield pr.getItem(e)})}});mr.registerCommand("StorageSDK.getItem",Bf);_e("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Mf=Ze("setStorage",{paramsSchema:J.tuple(J.string(),J.or(J.string(),J.boolean(),J.number())),implement(e,t){return I(this,null,function*(){return yield pr.setItem(e,t)})}});mr.registerCommand("StorageSDK.setItem",Mf);_e("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Gf=Ze("removeStorage",{paramsSchema:J.tuple(J.string()),implement(e){return I(this,null,function*(){return yield pr.removeItem(e)})}});mr.registerCommand("StorageSDK.removeItem",Gf);_e("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Jf=Ze("clearStorage",{implement(){return I(this,null,function*(){return yield pr.clear()})}});mr.registerCommand("StorageSDK.clear",Jf);_e("storage.clear",{version:"1.0.0"});var QE=Ia(rl());dt();G();Tt();gr();ue();Se();var il=L.testMode;function ol(){let e=new Map,t,n;return{registerRewardHandler(a,i){e.set(a,i)},handleReward(a,...i){return I(this,null,function*(){return yield a.reduce((s,l)=>I(this,null,function*(){let d=yield s;if(d===!0)return!0;il&&console.log(`handleReward ${l}`);let _=e.get(l),h=_?yield _(...i):d;return il&&console.log(`handleReward ${l} ${h}`),h}),Promise.resolve(!1))})},registerRewardsFetcher(a){return I(this,null,function*(){t=(...i)=>I(this,null,function*(){try{return yield a(...i)}catch(o){return console.error("getRewardOptions error:",o),["ADS"]}})})},registerRewardFrequencyConfigFetcher(a){return I(this,null,function*(){n=(...i)=>I(this,null,function*(){try{return yield a(...i)}catch(o){return console.error("getRewardOptions error:",o),{joliCoinUseAndCharge:et,loginGuide:tt}}})})},getRewardsTypes(...a){return I(this,null,function*(){return t?yield t(...a):["ADS"]})},getRewardFrequencyConfig(...a){return I(this,null,function*(){return n?yield n(...a):{joliCoinUseAndCharge:et,loginGuide:tt}})}}}G();var vi=class{constructor(t){this.httpClient=t}execute(t,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"POST",a=(n==null?void 0:n.body)||{};return r==="GET"?yield this.httpClient.get(t,a):yield this.httpClient.post(t,a)})}extractCacheableData(t){var n,r,a;return{unlockOptions:((n=t.data)==null?void 0:n.unlockOptions)||[],joliCoin:(r=t.extra)==null?void 0:r.joliCoin,joliGem:((a=t.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(t,n){return{code:"SUCCESS",message:"success",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}},gi=class{constructor(t){this.httpClient=t}execute(t,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"GET",a=(n==null?void 0:n.body)||{};return r==="GET"?yield this.httpClient.get(t,a):yield this.httpClient.post(t,a)})}extractCacheableData(t){let n=t.data;return q({joliCoinUseAndCharge:n==null?void 0:n.joliCoinUseAndCharge,loginGuide:n==null?void 0:n.loginGuide},n)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},Rr=class{constructor(t){this.unlockOptionsService=new gt(new vi(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:n=>n,consistencyChecker:(n,r)=>n.unlockOptions.length!==r.unlockOptions.length?!1:n.unlockOptions.every((a,i)=>{var s,l;let o=r.unlockOptions[i];return a.type===o.type&&((s=a.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=o.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new gt(new gi(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:n=>n})}getUnlockOptions(){return I(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return I(this,null,function*(){return yield this.globalConfigService.request("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}refreshUnlockOptions(){return I(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return I(this,null,function*(){return yield this.globalConfigService.forceRequest("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}warmupCache(){return I(this,null,function*(){yield Promise.all([this.unlockOptionsService.warmupCache("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",method:"POST"}),this.globalConfigService.warmupCache("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})])})}clearAllCache(){this.unlockOptionsService.clearCache(),this.globalConfigService.clearCache()}getCacheStats(){return{unlockOptions:this.unlockOptionsService.getCacheStats(),globalConfig:this.globalConfigService.getCacheStats()}}clearExpiredCache(){this.unlockOptionsService.clearExpiredCache(),this.globalConfigService.clearExpiredCache()}};Se();G();var $f=()=>(e,t)=>{let n={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return n[t]-n[e]},Wf=e=>{if(!e.length)return["ADS"];if(e.includes("JOLI_GEM")){if(e.length===1)return["JOLI_GEM_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_GEM_ONLY"]}if(e.includes("JOLI_COIN")){if(e.length===1)return["JOLI_COIN_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_COIN_ONLY"]}return e.sort($f())},_i=null;function yi(e){return _i||(_i=new Rr(e)),_i}var wi=e=>{e.registerRewardsFetcher(t=>I(void 0,null,function*(){var a,i,o,s,l;let n=["ADS"],r=yi(t);try{let d=yield r.getUnlockOptions({});if(d.code!=="SUCCESS")return n;Y.emit(_r,{options:((a=d.data)==null?void 0:a.unlockOptions)||[],userJoliCoin:((i=d.extra)==null?void 0:i.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((o=d.extra)==null?void 0:o.joliGem)||{balance:0,enableAutoDeduct:!1}});let _=((l=(s=d.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(h=>h.type))||Array.from(n);return Wf(_)}catch(d){return console.error("getRewardOptions error (cached):",d),n}}))},bi=e=>{e.registerRewardFrequencyConfigFetcher(t=>I(void 0,null,function*(){var r,a,i,o;let n=yi(t);try{let s=yield n.getGlobalConfig();return Y.emit(pi,{joliCoinUseAndCharge:((r=s.data)==null?void 0:r.joliCoinUseAndCharge)||et,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||tt}),s.data&&ut.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((i=s.data)==null?void 0:i.joliCoinUseAndCharge)||et,loginGuide:((o=s.data)==null?void 0:o.loginGuide)||tt}}catch(s){return console.error("getGlobalConfig error (cached):",s),Y.emit(pi,{joliCoinUseAndCharge:et,loginGuide:tt}),ut.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:et,loginGuide:tt}}),{joliCoinUseAndCharge:et,loginGuide:tt}}}))};var Ei=e=>I(void 0,null,function*(){yield yi(e).warmupCache(),console.log("Reward cache warmed up")});var sl=e=>t=>I(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",t),yield e.adBreak(t)}catch(n){console.error("-----createAdsRewardHandler error-----",n)}return!0});Se();function je(e,t){let n=null,r=null,a=null,i=()=>{if(a){n=Promise.resolve(a);return}n=new Promise(o=>{r=o})};return i(),e.on(t,(...o)=>{let s=o[0];a=s,r&&(r(s),r=null)}),{getData:()=>(n||i(),n),getCachedData:()=>a,clearCache:()=>{a=null,n=null},getFreshData:()=>(a=null,n=null,i(),n),updateData:o=>{if(a)return a=q(q({},a),o),n=Promise.resolve(a),r&&(r(a),r=null),a}}}Se();var Le=je(Y,_r);ue();G();var Ii={JOLI_COIN:{balanceEndpoint:"/api/joli-coin/balance",balanceDetailEndpoint:"/api/joli-coin/balance-detail",unlockEndpoint:"/api/joli-coin/unlock",unlockType:"JOLI_COIN"},GEM:{balanceEndpoint:"/api/joli-gem/balance",balanceDetailEndpoint:"/api/joli-gem/balance-detail",unlockEndpoint:"/api/joli-gem/unlock",unlockType:"GEM"}};G();var Me=ge();Se();Se();G();var Si=class{constructor(t){this.httpClient=t}execute(t,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"GET",a=(n==null?void 0:n.query)||{};return r==="GET"?yield this.httpClient.get(t,{query:a}):yield this.httpClient.post(t,{query:a})})}extractCacheableData(t){var n;return{balance:((n=t.data)==null?void 0:n.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Ci=class{constructor(t){this.balanceService=new gt(new Si(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(n,r)=>{let a=r!=null&&r.query?JSON.stringify(r.query):"";return`${n}:${a}`}})}getBalance(t="JOLI_COIN"){return I(this,null,function*(){return(yield this.balanceService.request("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}refreshBalance(t="JOLI_COIN"){return I(this,null,function*(){return(yield this.balanceService.forceRequest("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}warmupBalance(t="JOLI_COIN"){return I(this,null,function*(){yield this.balanceService.warmupCache("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})})}clearBalanceCache(){this.balanceService.clearCache()}getBalanceCacheStats(){return this.balanceService.getCacheStats()}clearExpiredCache(){this.balanceService.clearExpiredCache()}},Ai=null;function Ri(e){return Ai||(Ai=new Ci(e)),Ai}var Oi=(e,t="JOLI_COIN")=>I(void 0,null,function*(){return yield Ri(e).getBalance(t)}),ki=(e,t="JOLI_COIN")=>I(void 0,null,function*(){let r=yield Ri(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),r}),Or=(e,t="JOLI_COIN")=>I(void 0,null,function*(){yield Ri(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});G();var xi=class{constructor(t){this.httpClient=t}execute(t,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"GET",a=(n==null?void 0:n.query)||{};return r==="GET"?yield this.httpClient.get(t,{query:a}):yield this.httpClient.post(t,{query:a})})}extractCacheableData(t){var n;return{balance:((n=t.data)==null?void 0:n.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Pi=class{constructor(t){this.gemBalanceService=new gt(new xi(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(n,r)=>{let a=r!=null&&r.query?JSON.stringify(r.query):"";return`${n}:${a}`}})}getGemBalance(t="GEM"){return I(this,null,function*(){return(yield this.gemBalanceService.request("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}refreshGemBalance(t="GEM"){return I(this,null,function*(){return(yield this.gemBalanceService.forceRequest("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}warmupGemBalance(t="GEM"){return I(this,null,function*(){yield this.gemBalanceService.warmupCache("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})})}clearGemBalanceCache(){this.gemBalanceService.clearCache()}getGemBalanceCacheStats(){return this.gemBalanceService.getCacheStats()}clearExpiredCache(){this.gemBalanceService.clearExpiredCache()}},Ti=null;function Kf(e){return Ti||(Ti=new Pi(e)),Ti}var Li=(e,t="GEM")=>I(void 0,null,function*(){return yield Kf(e).getGemBalance(t)});var cn={JOLI_COIN:{fetchBalance:Oi,getQuantity:e=>{var t,n,r;return(r=(n=(t=e==null?void 0:e.options)==null?void 0:t.find(a=>a.type==="JOLI_COIN"))==null?void 0:n.joliCoinChoices[0].joliCoinQuantity)!=null?r:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userJoliCoin)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userJoliCoin",isEnough:(e,t)=>{var n,r;return(r=(n=e==null?void 0:e.options)==null?void 0:n.some(a=>a.type==="JOLI_COIN"&&a.joliCoinChoices.some(i=>{var o;return i.joliCoinQuantity<=((o=t==null?void 0:t.balance)!=null?o:0)})))!=null?r:!1}},JOLI_GEM:{fetchBalance:Li,getQuantity:e=>{var t,n,r,a;return(a=(r=(n=(t=e==null?void 0:e.options)==null?void 0:t.find(i=>i.type==="JOLI_GEM"))==null?void 0:n.joliGemChoice)==null?void 0:r.joliGemQuantity)!=null?a:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userGem)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userGem",isEnough:(e,t)=>{var r,a,i;let n=e==null?void 0:e.options.find(o=>o.type==="JOLI_GEM");return n?((a=(r=n.joliGemChoice)==null?void 0:r.joliGemQuantity)!=null?a:0)<=((i=t==null?void 0:t.balance)!=null?i:0):!1}}};var kr=(e,t,n)=>{let{showUnlockWithCurrencyModal:r}=n;Me.registerCommand(`Rewards.${e}.useJolicoin`,()=>I(void 0,null,function*(){let a=yield Le.getData(),i=cn[t],o=i.getCurrentUser(a),s=i.getQuantity(a),l=!!(o!=null&&o.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",a,l,s),(yield r({enableAutoDeduct:l,userCurrency:o,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},Dt=(e,t)=>n=>I(void 0,null,function*(){let r=je(Y,Er);return Y.emit(br,e,{enableAutoDeduct:n.enableAutoDeduct,userCurrency:n.userCurrency,quantity:n.quantity,currency:n.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield r.getFreshData()).useModalResult});Se();Se();var Tr=(e,t,n)=>{let{httpClient:r,initiateAndAwaitPayment:a}=n;Me.registerCommand(`Rewards.${e}.usePayment`,()=>I(void 0,null,function*(){var p;let i=yield Le.getData(),o=cn[t],s=yield o.fetchBalance(r),l=o.getQuantity(i),d=o.getCurrentUser(i),_=o.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,d.enableAutoDeduct),h=o.getUpdateKey();return Le.updateData({[h]:_}),console.log("-----unlockOptions payment-----",i,_,l,t),o.isEnough(i,_)?{result:"CONTINUE"}:{result:(yield a({userCurrency:_,currencyQuantity:l,currency:t}))==="SUCCESS"?"SUCCESS":"FAILED"}}))},Nt=(e,t)=>n=>I(void 0,null,function*(){let r=je(Y,wr);return Y.emit(yr,e,{userCurrency:n.userCurrency,quantity:n.currencyQuantity,currency:n.currency,enableAutoDeduct:n.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield r.getFreshData()).paymentResult});ue();Se();Se();G();var Ut=(e,t)=>n=>I(void 0,null,function*(){let r=je(Y,Ir);return Y.emit(Ar,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:n}),yield r.getFreshData()});var Qf=(e,t,n,{handlers:{handleUnlockSuccess:r,handleUnlockFailed:a,unlockOptionsHandler:i,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:s,showUnloginModal:l}})=>{Tr(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:o}),kr(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let d=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return _=>I(void 0,null,function*(){var h,p,f;try{let w=!0;for(let b of d){let x=yield Me.executeCommand(b);if(w=w&&x.result!=="FAILED",x.result!=="CONTINUE")break}if(!w)return a==null||a(_),!1;let A=Ii[n],C=yield t.post(A.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Ge()}-${L.mpType}-${Date.now()}`,gameInfo:{gameId:L.mpId}}});if(console.log("-----unlockWithCurrency request result-----",C),C.code=="SUCCESS"){try{(p=_.adBreakDone)==null||p.call(_,{breakType:_.type,breakName:"name"in _&&(h=_.name)!=null?h:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in _&&((f=_.adViewed)==null||f.call(_)),ki(t)}catch(b){console.error("-----unlockWithJolicoin adBreakDone error-----",b)}return r==null||r({quantity:C.data.quantity,balance:C.data.balance}),!0}return a==null||a(_),!1}catch(w){if(console.info("JolicoinRewardHandler error:",w),w instanceof Error&&w.message=="CANCEL")throw w;return a==null||a(_),!1}finally{i.clearCache()}})},Di=(e,t,n)=>Qf(e,t,"JOLI_COIN",n);var ll=(e,{onUnlockSuccess:t,onUnlockFailed:n})=>{let r=()=>{n==null||n()},a=Dt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),i=Nt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),o=Ut("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return Di("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:r,unlockOptionsHandler:Le,initiateAndAwaitPayment:i,showUnlockWithCurrencyModal:a,showUnloginModal:o}})};ue();G();Se();Se();var cl=e=>{let{showSubscriptionModal:t}=e;Me.registerCommand("Rewards.subscription",()=>I(void 0,null,function*(){return{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},ul=e=>()=>I(void 0,null,function*(){let t=je(Y,Cr);return Y.emit(Sr,e),(yield t.getFreshData()).result});ue();var dl=(e,t,{handlers:{handleSubSuccess:n,handleSubFailed:r,unlockOptionsHandler:a,showSubscriptionModal:i}})=>{cl({showSubscriptionModal:i});let o=["Rewards.subscription"];return s=>I(void 0,null,function*(){var l,d,_,h,p,f;try{let w=!0;for(let A of o){let C=yield Me.executeCommand(A);if(w=w&&C.result!=="FAILED",C.result!=="CONTINUE")break}if(!w)return r==null||r(s),!1;if(console.log("-----unlockWithSubscription result-----"),w){try{(d=s.adBreakDone)==null||d.call(s,{breakType:s.type,breakName:"name"in s&&(l=s.name)!=null?l:"",breakFormat:s.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in s&&((_=s.adViewed)==null||_.call(s)),(f=(p=L).onEnvConfigChanged)==null||f.call(p,{hostUserInfo:Ee(q({},(h=L.hostUserInfo)!=null?h:{isLogin:!1}),{isSubUser:!0})})}catch(A){console.error("-----unlockWithSubscription adBreakDone error-----",A)}return n==null||n(),!0}return r==null||r(s),!1}catch(w){if(console.info("SubscriptionRewardHandler error:",w),w instanceof Error&&w.message=="CANCEL")throw w;return r==null||r(s),!1}finally{a.clearCache()}})};var fl=(e,{onSubSuccess:t,onSubFailed:n})=>{let r=()=>{n==null||n()},a=ul("SUBSCRIPTION");return dl("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:r,unlockOptionsHandler:Le,showSubscriptionModal:a}})};var nt=ol();wi(nt);bi(nt);var Dr,M,gl,Bi,bt,hl,_l,yl,wl,Mi,Ni,Ui,eh,un={},bl=[],th=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,dn=Array.isArray;function rt(e,t){for(var n in t)e[n]=t[n];return e}function Gi(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function fn(e,t,n){var r,a,i,o={};for(i in t)i=="key"?r=t[i]:i=="ref"?a=t[i]:o[i]=t[i];if(arguments.length>2&&(o.children=arguments.length>3?Dr.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)o[i]===void 0&&(o[i]=e.defaultProps[i]);return Pr(e,o,r,a,null)}function Pr(e,t,n,r,a){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a==null?++gl:a,__i:-1,__u:0};return a==null&&M.vnode!=null&&M.vnode(i),i}function ft(e){return e.children}function De(e,t){this.props=e,this.context=t}function Bt(e,t){if(t==null)return e.__?Bt(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Bt(e):null}function El(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return El(e)}}function ml(e){(!e.__d&&(e.__d=!0)&&bt.push(e)&&!Lr.__r++||hl!==M.debounceRendering)&&((hl=M.debounceRendering)||_l)(Lr)}function Lr(){for(var e,t,n,r,a,i,o,s=1;bt.length;)bt.length>s&&bt.sort(yl),e=bt.shift(),s=bt.length,e.__d&&(n=void 0,a=(r=(t=e).__v).__e,i=[],o=[],t.__P&&((n=rt({},r)).__v=r.__v+1,M.vnode&&M.vnode(n),Ji(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[a]:null,i,a==null?Bt(r):a,!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,Sl(i,n,o),n.__e!=a&&El(n)));Lr.__r=0}function Il(e,t,n,r,a,i,o,s,l,d,_){var h,p,f,w,A,C,b=r&&r.__k||bl,x=t.length;for(l=nh(n,t,b,l,x),h=0;h<x;h++)(f=n.__k[h])!=null&&(p=f.__i===-1?un:b[f.__i]||un,f.__i=h,C=Ji(e,f,p,a,i,o,s,l,d,_),w=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&Fi(p.ref,null,f),_.push(f.ref,f.__c||w,f)),A==null&&w!=null&&(A=w),4&f.__u||p.__k===f.__k?l=Al(f,l,e):typeof f.type=="function"&&C!==void 0?l=C:w&&(l=w.nextSibling),f.__u&=-7);return n.__e=A,l}function nh(e,t,n,r,a){var i,o,s,l,d,_=n.length,h=_,p=0;for(e.__k=new Array(a),i=0;i<a;i++)(o=t[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=i+p,(o=e.__k[i]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Pr(null,o,null,null,null):dn(o)?Pr(ft,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Pr(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(d=o.__i=rh(o,n,l,h))!==-1&&(h--,(s=n[d])&&(s.__u|=2)),s==null||s.__v===null?(d==-1&&(a>_?p--:a<_&&p++),typeof o.type!="function"&&(o.__u|=4)):d!=l&&(d==l-1?p--:d==l+1?p++:(d>l?p--:p++,o.__u|=4))):e.__k[i]=null;if(h)for(i=0;i<_;i++)(s=n[i])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Bt(s)),Rl(s,s));return r}function Al(e,t,n){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=Al(r[a],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=Bt(e)),n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function hn(e,t){return t=t||[],e==null||typeof e=="boolean"||(dn(e)?e.some(function(n){hn(n,t)}):t.push(e)),t}function rh(e,t,n,r){var a,i,o=e.key,s=e.type,l=t[n];if(l===null&&e.key==null||l&&o==l.key&&s===l.type&&!(2&l.__u))return n;if(r>(l!=null&&!(2&l.__u)?1:0))for(a=n-1,i=n+1;a>=0||i<t.length;){if(a>=0){if((l=t[a])&&!(2&l.__u)&&o==l.key&&s===l.type)return a;a--}if(i<t.length){if((l=t[i])&&!(2&l.__u)&&o==l.key&&s===l.type)return i;i++}}return-1}function pl(e,t,n){t[0]=="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||th.test(t)?n:n+"px"}function xr(e,t,n,r,a){var i;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||pl(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||pl(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(wl,"$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]=n,n?r?n.t=r.t:(n.t=Mi,e.addEventListener(t,i?Ui:Ni,i)):e.removeEventListener(t,i?Ui:Ni,i);else{if(a=="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]=n==null?"":n;break e}catch(o){}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function vl(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.u==null)t.u=Mi++;else if(t.u<n.t)return;return n(M.event?M.event(t):t)}}}function Ji(e,t,n,r,a,i,o,s,l,d){var _,h,p,f,w,A,C,b,x,D,H,j,R,N,T,B,K,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[s=t.__e=n.__e]),(_=M.__b)&&_(t);e:if(typeof z=="function")try{if(b=t.props,x="prototype"in z&&z.prototype.render,D=(_=z.contextType)&&r[_.__c],H=_?D?D.props.value:_.__:r,n.__c?C=(h=t.__c=n.__c).__=h.__E:(x?t.__c=h=new z(b,H):(t.__c=h=new De(b,H),h.constructor=z,h.render=ih),D&&D.sub(h),h.props=b,h.state||(h.state={}),h.context=H,h.__n=r,p=h.__d=!0,h.__h=[],h._sb=[]),x&&h.__s==null&&(h.__s=h.state),x&&z.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=rt({},h.__s)),rt(h.__s,z.getDerivedStateFromProps(b,h.__s))),f=h.props,w=h.state,h.__v=t,p)x&&z.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),x&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(x&&z.getDerivedStateFromProps==null&&b!==f&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(b,H),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(b,h.__s,H)===!1||t.__v==n.__v)){for(t.__v!=n.__v&&(h.props=b,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(te){te&&(te.__=t)}),j=0;j<h._sb.length;j++)h.__h.push(h._sb[j]);h._sb=[],h.__h.length&&o.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(b,h.__s,H),x&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(f,w,A)})}if(h.context=H,h.props=b,h.__P=e,h.__e=!1,R=M.__r,N=0,x){for(h.state=h.__s,h.__d=!1,R&&R(t),_=h.render(h.props,h.state,h.context),T=0;T<h._sb.length;T++)h.__h.push(h._sb[T]);h._sb=[]}else do h.__d=!1,R&&R(t),_=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++N<25);h.state=h.__s,h.getChildContext!=null&&(r=rt(rt({},r),h.getChildContext())),x&&!p&&h.getSnapshotBeforeUpdate!=null&&(A=h.getSnapshotBeforeUpdate(f,w)),B=_,_!=null&&_.type===ft&&_.key==null&&(B=Cl(_.props.children)),s=Il(e,dn(B)?B:[B],t,n,r,a,i,o,s,l,d),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),C&&(h.__E=h.__=null)}catch(te){if(t.__v=null,l||i!=null)if(te.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,t.__e=s}else for(K=i.length;K--;)Gi(i[K]);else t.__e=n.__e,t.__k=n.__k;M.__e(te,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ah(n.__e,t,n,r,a,i,o,l,d);return(_=M.diffed)&&_(t),128&t.__u?void 0:s}function Sl(e,t,n){for(var r=0;r<n.length;r++)Fi(n[r],n[++r],n[++r]);M.__c&&M.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(i){i.call(a)})}catch(i){M.__e(i,a.__v)}})}function Cl(e){return typeof e!="object"||e==null?e:dn(e)?e.map(Cl):rt({},e)}function ah(e,t,n,r,a,i,o,s,l){var d,_,h,p,f,w,A,C=n.props,b=t.props,x=t.type;if(x=="svg"?a="http://www.w3.org/2000/svg":x=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(d=0;d<i.length;d++)if((f=i[d])&&"setAttribute"in f==!!x&&(x?f.localName==x:f.nodeType==3)){e=f,i[d]=null;break}}if(e==null){if(x==null)return document.createTextNode(b);e=document.createElementNS(a,x,b.is&&b),s&&(M.__m&&M.__m(t,i),s=!1),i=null}if(x===null)C===b||s&&e.data===b||(e.data=b);else{if(i=i&&Dr.call(e.childNodes),C=n.props||un,!s&&i!=null)for(C={},d=0;d<e.attributes.length;d++)C[(f=e.attributes[d]).name]=f.value;for(d in C)if(f=C[d],d!="children"){if(d=="dangerouslySetInnerHTML")h=f;else if(!(d in b)){if(d=="value"&&"defaultValue"in b||d=="checked"&&"defaultChecked"in b)continue;xr(e,d,null,f,a)}}for(d in b)f=b[d],d=="children"?p=f:d=="dangerouslySetInnerHTML"?_=f:d=="value"?w=f:d=="checked"?A=f:s&&typeof f!="function"||C[d]===f||xr(e,d,f,C[d],a);if(_)s||h&&(_.__html===h.__html||_.__html===e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(h&&(e.innerHTML=""),Il(t.type==="template"?e.content:e,dn(p)?p:[p],t,n,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,o,i?i[0]:n.__k&&Bt(n,0),s,l),i!=null)for(d=i.length;d--;)Gi(i[d]);s||(d="value",x=="progress"&&w==null?e.removeAttribute("value"):w!==void 0&&(w!==e[d]||x=="progress"&&!w||x=="option"&&w!==C[d])&&xr(e,d,w,C[d],a),d="checked",A!==void 0&&A!==e[d]&&xr(e,d,A,C[d],a))}return e}function Fi(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(a){M.__e(a,n)}}function Rl(e,t,n){var r,a;if(M.unmount&&M.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Fi(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){M.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&Rl(r[a],t,n||typeof e.type!="function");n||Gi(e.__e),e.__c=e.__=e.__e=void 0}function ih(e,t,n){return this.constructor(e,n)}function Ol(e,t,n){var r,a,i,o;t==document&&(t=document.documentElement),M.__&&M.__(e,t),a=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],o=[],Ji(t,e=(!r&&n||t).__k=fn(ft,null,[e]),a||un,un,t.namespaceURI,!r&&n?[n]:a?null:t.firstChild?Dr.call(t.childNodes):null,i,!r&&n?n:a?a.__e:t.firstChild,r,o),Sl(i,e,o)}Dr=bl.slice,M={__e:function(e,t,n,r){for(var a,i,o;t=t.__;)if((a=t.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(e)),o=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),o=a.__d),o)return a.__E=a}catch(s){e=s}throw e}},gl=0,Bi=function(e){return e!=null&&e.constructor==null},De.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=rt({},this.state),typeof e=="function"&&(e=e(rt({},n),this.props)),e&&rt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ml(this))},De.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ml(this))},De.prototype.render=ft,bt=[],_l=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,yl=function(e,t){return e.__v.__b-t.__v.__b},Lr.__r=0,wl=/(PointerCapture)$|Capture$/i,Mi=0,Ni=vl(!1),Ui=vl(!0),eh=0;var Mt,ie,Hi,kl,mn=0,Bl=[],se=M,Tl=se.__b,xl=se.__r,Pl=se.diffed,Ll=se.__c,Dl=se.unmount,Nl=se.__;function Ur(e,t){se.__h&&se.__h(ie,e,mn||t),mn=0;var n=ie.__H||(ie.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Br(e){return mn=1,Ml(Gl,e)}function Ml(e,t,n){var r=Ur(Mt++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Gl(void 0,t),function(s){var l=r.__N?r.__N[0]:r.__[0],d=r.t(l,s);l!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=ie,!ie.__f)){var a=function(s,l,d){if(!r.__c.__H)return!0;var _=r.__c.__H.__.filter(function(p){return!!p.__c});if(_.every(function(p){return!p.__N}))return!i||i.call(this,s,l,d);var h=r.__c.props!==s;return _.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(h=!0)}}),i&&i.call(this,s,l,d)||h};ie.__f=!0;var i=ie.shouldComponentUpdate,o=ie.componentWillUpdate;ie.componentWillUpdate=function(s,l,d){if(this.__e){var _=i;i=void 0,a(s,l,d),i=_}o&&o.call(this,s,l,d)},ie.shouldComponentUpdate=a}return r.__N||r.__}function pn(e,t){var n=Ur(Mt++,3);!se.__s&&Wi(n.__H,t)&&(n.__=e,n.u=t,ie.__H.__h.push(n))}function ji(e,t){var n=Ur(Mt++,4);!se.__s&&Wi(n.__H,t)&&(n.__=e,n.u=t,ie.__h.push(n))}function Vi(e){return mn=5,vn(function(){return{current:e}},[])}function vn(e,t){var n=Ur(Mt++,7);return Wi(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $i(e,t){return mn=8,vn(function(){return e},t)}function oh(){for(var e;e=Bl.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Nr),e.__H.__h.forEach(qi),e.__H.__h=[]}catch(t){e.__H.__h=[],se.__e(t,e.__v)}}se.__b=function(e){ie=null,Tl&&Tl(e)},se.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Nl&&Nl(e,t)},se.__r=function(e){xl&&xl(e),Mt=0;var t=(ie=e.__c).__H;t&&(Hi===ie?(t.__h=[],ie.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(Nr),t.__h.forEach(qi),t.__h=[],Mt=0)),Hi=ie},se.diffed=function(e){Pl&&Pl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Bl.push(t)!==1&&kl===se.requestAnimationFrame||((kl=se.requestAnimationFrame)||sh)(oh)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Hi=ie=null},se.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Nr),n.__h=n.__h.filter(function(r){return!r.__||qi(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],se.__e(r,n.__v)}}),Ll&&Ll(e,t)},se.unmount=function(e){Dl&&Dl(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Nr(r)}catch(a){t=a}}),n.__H=void 0,t&&se.__e(t,n.__v))};var Ul=typeof requestAnimationFrame=="function";function sh(e){var t,n=function(){clearTimeout(r),Ul&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ul&&(t=requestAnimationFrame(n))}function Nr(e){var t=ie,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ie=t}function qi(e){var t=ie;e.__c=e.__(),ie=t}function Wi(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Gl(e,t){return typeof t=="function"?t(e):t}function ch(e,t){for(var n in t)e[n]=t[n];return e}function Jl(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Fl(e,t){this.props=e,this.context=t}(Fl.prototype=new De).isPureReactComponent=!0,Fl.prototype.shouldComponentUpdate=function(e,t){return Jl(this.props,e)||Jl(this.state,t)};var Hl=M.__b;M.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Hl&&Hl(e)};var zb=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var uh=M.__e;M.__e=function(e,t,n,r){if(e.then){for(var a,i=t;i=i.__;)if((a=i.__c)&&a.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),a.__c(e,t)}uh(e,t,n,r)};var ql=M.unmount;function Xl(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=ch({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Xl(r,t,n)})),e}function Yl(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Yl(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ki(){this.__u=0,this.o=null,this.__b=null}function Ql(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Mr(){this.i=null,this.l=null}M.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),ql&&ql(e)},(Ki.prototype=new De).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var a=Ql(r.__v),i=!1,o=function(){i||(i=!0,n.__R=null,a?a(s):s())};n.__R=o;var s=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Yl(l,l.__c.__P,l.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Ki.prototype.componentWillUnmount=function(){this.o=[]},Ki.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Xl(this.__b,n,r.__O=r.__P)}this.__b=null}var a=t.__a&&fn(ft,null,e.fallback);return a&&(a.__u&=-33),[fn(ft,null,t.__a?null:e.children),a]};var jl=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Mr.prototype=new De).__a=function(e){var t=this,n=Ql(t.__v),r=t.l.get(e);return r[0]++,function(a){var i=function(){t.props.revealOrder?(r.push(a),jl(t,e,r)):a()};n?n(i):i()}},Mr.prototype.render=function(e){this.i=null,this.l=new Map;var t=hn(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Mr.prototype.componentDidUpdate=Mr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){jl(e,n,t)})};var dh=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,fh=/^(?: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]/,hh=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,mh=/[A-Z0-9]/g,ph=typeof document!="undefined",vh=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function zi(e,t,n){return t.__k==null&&(t.textContent=""),Ol(e,t),typeof n=="function"&&n(),e?e.__c:null}De.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(De.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Vl=M.event;function gh(){}function _h(){return this.cancelBubble}function yh(){return this.defaultPrevented}M.event=function(e){return Vl&&(e=Vl(e)),e.persist=gh,e.isPropagationStopped=_h,e.isDefaultPrevented=yh,e.nativeEvent=e};var Zl,wh={enumerable:!1,configurable:!0,get:function(){return this.class}},$l=M.vnode;M.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,a={},i=r.indexOf("-")===-1;for(var o in n){var s=n[o];if(!(o==="value"&&"defaultValue"in n&&s==null||ph&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||vh(n.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":hh.test(o)&&(o=l):l=o="oninput":i&&fh.test(o)?o=o.replace(mh,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&a[o=l]&&(o="oninputCapture"),a[o]=s}}r=="select"&&a.multiple&&Array.isArray(a.value)&&(a.value=hn(n.children).forEach(function(d){d.props.selected=a.value.indexOf(d.props.value)!=-1})),r=="select"&&a.defaultValue!=null&&(a.value=hn(n.children).forEach(function(d){d.props.selected=a.multiple?a.defaultValue.indexOf(d.props.value)!=-1:a.defaultValue==d.props.value})),n.class&&!n.className?(a.class=n.class,Object.defineProperty(a,"className",wh)):(n.className&&!n.class||n.class&&n.className)&&(a.class=a.className=n.className),t.props=a}(e),e.$$typeof=dh,$l&&$l(e)};var Wl=M.__r;M.__r=function(e){Wl&&Wl(e),Zl=e.__c};var Kl=M.diffed;M.diffed=function(e){Kl&&Kl(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Zl=null};var bh=Object.defineProperty,Kr=Object.getOwnPropertySymbols,Sc=Object.prototype.hasOwnProperty,Cc=Object.prototype.propertyIsEnumerable,ec=(e,t,n)=>t in e?bh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eh=(e,t)=>{for(var n in t||(t={}))Sc.call(t,n)&&ec(e,n,t[n]);if(Kr)for(var n of Kr(t))Cc.call(t,n)&&ec(e,n,t[n]);return e},Ih=(e,t)=>{var n={};for(var r in e)Sc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Kr)for(var r of Kr(e))t.indexOf(r)<0&&Cc.call(e,r)&&(n[r]=e[r]);return n},Rc=Object.defineProperty,Ah=Object.defineProperties,Sh=Object.getOwnPropertyDescriptors,tc=Object.getOwnPropertySymbols,Ch=Object.prototype.hasOwnProperty,Rh=Object.prototype.propertyIsEnumerable,nc=(e,t,n)=>t in e?Rc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oh=(e,t)=>{for(var n in t||(t={}))Ch.call(t,n)&&nc(e,n,t[n]);if(tc)for(var n of tc(t))Rh.call(t,n)&&nc(e,n,t[n]);return e},kh=(e,t)=>Ah(e,Sh(t)),Th=(e,t)=>{for(var n in t)Rc(e,n,{get:t[n],enumerable:!0})},Oc=(e,t,n,r)=>{for(var a=t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(a=o(a)||a);return a},xh=(e,t,n)=>new Promise((r,a)=>{var i=l=>{try{s(n.next(l))}catch(d){a(d)}},o=l=>{try{s(n.throw(l))}catch(d){a(d)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,o);s((n=n.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 n=new Event("abort");this.signal.dispatchEvent(n)};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(n,r){this._eventListeners[n]||(this._eventListeners[n]=[]),this._eventListeners[n].push(r)},t.prototype.removeEventListener=function(n,r){if(!this._eventListeners[n])return;let a=this._eventListeners[n].indexOf(r);a!==-1&&this._eventListeners[n].splice(a,1)},t.prototype.dispatchEvent=function(n){if(this._eventListeners[n.type])for(let r of this._eventListeners[n.type])r.call(this,n)},window.AbortController=e,window.AbortSignal=t}function Ph(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Lh(e){return typeof e=="string"}function Dh(e){return typeof e=="undefined"}function Nh(e){return Dh(e)||e===null}function Uh(e){return typeof e=="function"}function kc(e){let t=e,n=null,r=function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return n||(n=new t(...i)),n};return r.prototype=t.prototype,r}var Bh=(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))(Bh||{});function gn(e){return function(){var t,n;((n=(t=globalThis.VConsole)==null?void 0:t[e])!=null?n:globalThis.console[e])(...arguments)}}var Mh={log:gn("log"),warn:gn("warn"),info:gn("info"),error:gn("error"),debug:gn("debug")};Object.assign(globalThis,{logger:Mh});var rc=Symbol.for("Jolibox.canIUseMap"),Gh={};globalThis[rc]||(globalThis[rc]=Gh);var ac=Symbol.for("Jolibox.canIUseMap.native"),Jh={};globalThis[ac]||(globalThis[ac]=Jh);var Tc=(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))(Tc||{}),xc=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(xc||{}),Pc=(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))(Pc||{}),ic=["name","params"],Fh=["name","type","location","target","extra","timestamp","userId"],Hh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function Hr(e,t){return t.map(n=>{if(n==="params"&&e[n]){let r=e[n];return Object.keys(r).reduce((a,i)=>(a[i]=String(r[i]),a),{})}return e[n]})}function qh(e){let t=e.location?Hr(e.location,ic):null,n=e.target?Hr(e.target,ic):null;return Hr(kh(Oh({},e),{location:t,target:n}),Fh)}function jh(e){let t=e.events.map(r=>qh(r)),n=Hr(e.device,Hh);return[e.protocolVersion,t,n,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 r=e.get.call(window);return window.__joliboxLocalStorage__=r,r}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,n=Object.getOwnPropertyDescriptor(t,"localStorage");if(n&&n.get){let r=n.get.call(window);return window.__joliboxLocalStorage__=r,r}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}Vh();var Ft=typeof window=="undefined",oc=()=>!Ft&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!Ft&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!Ft&&navigator.userAgent.includes("Android"),!Ft&&navigator.userAgent.includes("Mac"),!Ft&&navigator.userAgent.includes("FB_IAB"),!Ft&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var no=class ro{constructor(t){this.element=t,this.next=ro.Undefined,this.prev=ro.Undefined}};no.Undefined=new no(void 0);var ae=no,$h=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 n=new ae(e);if(this._first===ae.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}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}},Wh=0,_n=class{constructor(e){this.value=e,this.id=Wh++}},En=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,n;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof _n&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(r=>(r==null?void 0:r.value)===e)):(this._listeners=void 0,this._size=0)),(n=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t))}get event(){return this._event!=null||(this._event=(e,t)=>{var n,r,a,i,o,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new _n(e);return this._listeners?this._listeners instanceof _n?this._listeners=[this._listeners,l]:this._listeners.push(l):((r=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||r.call(n,this),this._listeners=l,(i=(a=this.options)==null?void 0:a.onDidFirstListener)==null||i.call(a,this)),(s=(o=this.options)==null?void 0:o.onDidAddListener)==null||s.call(o,this),this._size++,()=>{var d,_,h,p;if(!this._disposed){if(this._listeners instanceof _n)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(_=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||_.call(d));else if(this._listeners){let f=this._listeners.indexOf(l);f>=0&&(this._listeners.splice(f,1),this._size--,this._size===0&&((p=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||p.call(h)))}}}}),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(a){r(a)}}fire(e){this._listeners&&(this._listeners instanceof _n?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Kh=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var r;let a=(r=this.listeners.get(e))!=null?r:new En,i=l=>t(...l.args),o=a.event(i);this.listerHandlerMap.set(t,{handler:i,dispose:o}),this.listeners.set(e,a);let s=this.cachedEventQueue.get(e);if(s&&n)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let n=this.listerHandlerMap.get(t);n&&(n.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),n=this.cachedEventQueue.get(e);for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];n||(n=new $h,this.cachedEventQueue.set(e,n)),n.push({args:a}),t&&t.fire({event:e,args:a})}once(e,t){var n=this;let r=function(){t(...arguments),n.off(e,r)};this.on(e,r,!1)}},ao={};Th(ao,{None:()=>zh,filter:()=>Yh,once:()=>Lc,toPromise:()=>Xh});var zh=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Xh(e){return new Promise(t=>Lc(e)(t))}function Lc(e){return function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=!1;return e(a=>{if(!r)return r=!0,t.call(n,a)},null)}}function Yh(e,t){return(n=>{let r={onWillAddFirstListener(){n(a.fire,a)}},a=new En(r);return a.event})(function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(a=>t(a)&&n.call(r,a),null)})}var Xi=Symbol.for("Jolibox.hostEmitter"),Qh=()=>{let e=new Kh;return globalThis[Xi]||(globalThis[Xi]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Xi]};Qh();function Zh(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)em(e[r],t[r])}function em(e,t){if(Lh(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Uh(t)){try{if(e instanceof t)return}catch(n){}if(!Nh(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")}}var io=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new En,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 n=[];for(let a of e.metadata.args)n.push(a.constraint);let r=e.handler;e.handler=function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return Zh(i,n),r(...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 n=this.getCommand(t);n&&e.set(t,n)}return e}};io=Oc([kc],io);var sc=class{constructor(){this._onWillExecuteCommand=new En,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new En,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new io,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Ph(3e4)),this._starActivation}executeCommand(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return xh(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,n):(yield Promise.all([Promise.race([this._activateStar(),ao.toPromise(ao.filter(this.registry.onDidRegisterCommand,a=>a===e))])]),this._tryExecuteCommand(e,n))})}executeCommandThowErr(e){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let t=this.registry.getCommand(e);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this._onWillExecuteCommand.fire({commandId:e,args:r});let i=this.invokeFunction(t.handler,...r);return this._onDidExecuteCommand.fire({commandId:e,args:r}),i}_tryExecuteCommand(e,t){let n=this.registry.getCommand(e);if(!n)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let r=this.invokeFunction(n.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(r)}catch(r){return Promise.reject(r)}}invokeFunction(e){try{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e(...n)}finally{}}};sc=Oc([kc],sc);function Ce(e,t,n){return(t=tm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tm(e){var t=nm(e,"string");return typeof t=="symbol"?t:t+""}function nm(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gt=e=>e?function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e==null||e(...n)}catch(a){console.error("Error calling function",a)}}:()=>{console.log("wrapUserFunction: fn is undefined")},oo=class{constructor(t){Ce(this,"context",void 0),Ce(this,"continueCallback",void 0),Ce(this,"adIsShowingCallback",void 0),Ce(this,"isBeforeAdCalled",!1),Ce(this,"isBeforeRewardCalled",!1),Ce(this,"isAdDismissedCalled",!1),Ce(this,"isAdViewedCalled",!1),Ce(this,"isAfterAdCalled",!1),Ce(this,"currentProvider",void 0),Ce(this,"currentClientParams",void 0),Ce(this,"adsHasResponse",!1),Ce(this,"videoChecker",window.document.createElement("video")),Ce(this,"contextInfo",void 0),Ce(this,"wrapShowAdFn",n=>()=>{var r,a,i;this.adsHasResponse=!0;let o=!1;this.videoChecker.play().catch(()=>{o=!1}),o=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:o},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",Eh({userEvent:o},this.paramsToTrack)),oc()&&this.context.track("mmp_ad_impression",{ad_network:(a=(r=this.currentProvider)==null?void 0:r.name)!=null?a:"",ad_format:"rewarded",module:"game",game_id:this.contextInfo.objectId}),(i=this.adIsShowingCallback)==null||i.call(this,!0);let s=Gt(n);s==null||s()}),this.context=t,this.contextInfo=t.getContextInfo()}notifyIframeAdsEvent(t,n){window.parent&&window.parent.postMessage({type:t,data:n},"*"),window.dispatchEvent(new CustomEvent(t,{detail:n}))}get paramsToTrack(){var t,n,r,a,i,o;return{provider:(n=(t=this.currentProvider)==null?void 0:t.name)!=null?n:null,type:(r=this.currentClientParams)==null?void 0:r.type,name:((a=this.currentClientParams)==null?void 0:a.type)==="preroll"?null:(o=(i=this.currentClientParams)==null?void 0:i.name)!=null?o:""}}wrapBeforeAd(t){return()=>{var n,r,a,i;if(this.adsHasResponse=!0,this.context.track("CallBeforeAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_AD",this.paramsToTrack),!this.isBeforeAdCalled){this.isBeforeAdCalled=!0;let o=Gt(t);o==null||o(),((n=this.currentClientParams)==null?void 0:n.type)!=="reward"&&((r=this.adIsShowingCallback)==null||r.call(this,!0),oc()&&this.context.track("mmp_ad_impression",{ad_network:(i=(a=this.currentProvider)==null?void 0:a.name)!=null?i:"",ad_format:"interstitial",module:"game",game_id:this.contextInfo.objectId}))}}}wrapBeforeReward(t){return n=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(n)():(this.isBeforeRewardCalled=!0,t==null||t(this.wrapShowAdFn(n)))}}wrapAdDismissed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdDismissedCalled){this.isAdDismissedCalled=!0;let n=Gt(t);n==null||n()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let n=Gt(t);n==null||n()}}}wrapAfterAd(t){return()=>{if(this.adsHasResponse=!0,this.context.track("CallAfterAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AFTER_AD",this.paramsToTrack),!this.isAfterAdCalled){this.isAfterAdCalled=!0;let n=Gt(t);n==null||n()}}}wrapAdBreakDone(t){return n=>{var r,a,i,o,s,l,d,_,h;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(a=(r=this.currentProvider)==null?void 0:r.name)!=null?a:null,breakType:n.breakType,breakName:(i=n.breakName)!=null?i:"",breakFormat:n.breakFormat,breakStatus:n.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(o=this.currentProvider)==null?void 0:o.name)!=null?s:null,breakType:n.breakType,breakName:(l=n.breakName)!=null?l:"",breakFormat:n.breakFormat,breakStatus:n.breakStatus}),n.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=Gt(t);p==null||p(n),(d=this.adIsShowingCallback)==null||d.call(this,!1),(_=this.continueCallback)==null||_.call(this,[!1,n]);break}default:{(h=this.continueCallback)==null||h.call(this,[!0,n]);break}}}}callAdBreakAndContinue(t,n,r,a){return I(this,null,function*(){return this.currentProvider=t,this.currentClientParams=n,this.adsHasResponse=!1,new Promise(i=>{this.continueCallback=i,this.adIsShowingCallback=a;let o;switch(n.type){case"preroll":{o={type:n.type,adBreakDone:this.wrapAdBreakDone(n.adBreakDone)};break}case"reward":{o={name:n.name,type:n.type,beforeAd:this.wrapBeforeAd(n.beforeAd),beforeReward:this.wrapBeforeReward(n.beforeReward),adDismissed:this.wrapAdDismissed(n.adDismissed),adViewed:this.wrapAdViewed(n.adViewed),afterAd:this.wrapAfterAd(n.afterAd),adBreakDone:this.wrapAdBreakDone(n.adBreakDone)};break}default:{o={name:n.name,type:n.type,beforeAd:this.wrapBeforeAd(n.beforeAd),afterAd:this.wrapAfterAd(n.afterAd),adBreakDone:this.wrapAdBreakDone(n.adBreakDone)};break}}window.setTimeout(()=>{var s,l,d,_,h,p,f;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:n.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:n.type,provider:(_=(d=this.currentProvider)==null?void 0:d.name)!=null?_:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:n.type,breakName:n.type==="preroll"?"":(h=n.name)!=null?h:"",breakFormat:n.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(f=this.adIsShowingCallback)==null||f.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),t.adBreak(o,r),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};function Gr(e,t,n){return(t=rm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rm(e){var t=am(e,"string");return typeof t=="symbol"?t:t+""}function am(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var so=class{constructor(t){Gr(this,"context",void 0),Gr(this,"adBreakIsShowing",!1),Gr(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Gr(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=t,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",n=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};function Jr(e,t,n){return(t=im(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function im(e){var t=om(e,"string");return typeof t=="symbol"?t:t+""}function om(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lo=class{constructor(t){Jr(this,"configs",null),Jr(this,"firstRun",!0),Jr(this,"context",void 0),Jr(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return I(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(t){}})}shouldBypassCallingInterstitial(){var t,n;let r;if(!this.configs)this.init(),r=!this.firstRun;else{let a=(t=this.contextInfo.channel)!=null?t:"",i=this.configs[a],o=(n=i==null?void 0:i.interstitialRate)!=null?n:1;r=Math.random()<o}return this.firstRun=!1,r}};function at(e,t,n){return(t=sm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sm(e){var t=lm(e,"string");return typeof t=="symbol"?t:t+""}function lm(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var co=class{constructor(t,n){at(this,"name","ADSENSE"),at(this,"context",void 0),at(this,"contextInfo",void 0),at(this,"configured",!1),at(this,"initParams",void 0),at(this,"push",function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(r)}),at(this,"adConfig",r=>{let a=r,{onReady:i}=a,o=Ih(a,["onReady"]);this.context.track("CallAdConfig",o),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(r))}),at(this,"adBreak",r=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(r)}),at(this,"adUnit",r=>I(this,null,function*(){var a,i,o,s;if(this.context.track("CallAdUnit",{adFormat:(i=(a=r.adFormat)==null?void 0:a.toString())!=null?i:null,fullWidthResponsive:(o=r.fullWidthResponsive)!=null?o:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:d,adFormat:_,fullWidthResponsive:h,style:p}=r,f;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?f=document.querySelector(l):f=l,!f)throw new Error("targeting element not found");let w=d;if(w||(w=this.initParams.unitId),!w)throw new Error("slot is required");let A=typeof _=="object"&&Array.isArray(_)?_.join(", "):_,C=document.createElement("ins");if(C.className="adsbygoogle",C.id="jolibox-ads",C.style.display="block",C.setAttribute("data-ad-client",this.initParams.clientId),C.setAttribute("data-ad-slot",w),A&&C.setAttribute("data-ad-format",A),h&&C.setAttribute("data-full-width-responsive",h),p&&C.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let b=document.createElement("div");b.style.position="absolute",b.style.top="0",b.style.left="0",b.style.width="100%",b.style.height="100%",b.style.display="flex",b.style.justifyContent="center",b.style.alignItems="center",b.style.backgroundColor="rgba(0, 0, 0, 0.5)",b.style.color="white",b.innerHTML="Test Ad",C.style.position="relative",f.appendChild(C),C.appendChild(b)}else f.appendChild(C),new MutationObserver(b=>{b.forEach(x=>{if(x.type==="attributes"&&x.attributeName==="data-ad-status"){let D=C.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:D!=null?D:"null"})}})}).observe(C,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=n,window.adsbygoogle=window.adsbygoogle||[]}init(){return I(this,null,function*(){var t;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let n="google-adsense",r=(t=this.contextInfo.testAdsMode)!=null?t:!1;if(!document.getElementById(n)&&this.initParams.clientId){let a=document.createElement("script");a.id=n,a.async=!0,a.crossOrigin="anonymous",a.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,r&&a.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&a.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&a.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),this.initParams.admobRewardedSlot&&a.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&a.setAttribute("data-admob-ads-only","on"),document.head.appendChild(a),this.context.track("LoadAdsenseCompleted",null)}})}};function cm(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function um(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var dm=function(){function e(n){var r=this;this._insertTag=function(a){var i;r.tags.length===0?r.insertionPoint?i=r.insertionPoint.nextSibling:r.prepend?i=r.container.firstChild:i=r.before:i=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(a,i),r.tags.push(a)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(n){n.forEach(this._insertTag)},t.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(um(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var a=cm(r);try{a.insertRule(n,a.cssRules.length)}catch(i){}}else r.appendChild(document.createTextNode(n));this.ctr++},t.flush=function(){this.tags.forEach(function(n){var r;return(r=n.parentNode)==null?void 0:r.removeChild(n)}),this.tags=[],this.ctr=0},e}(),we="-ms-",zr="-moz-",V="-webkit-",Dc="comm",So="rule",Co="decl",fm="@import",Nc="@keyframes",hm="@layer",mm=Math.abs,ea=String.fromCharCode,pm=Object.assign;function vm(e,t){return pe(e,0)^45?(((t<<2^pe(e,0))<<2^pe(e,1))<<2^pe(e,2))<<2^pe(e,3):0}function Uc(e){return e.trim()}function gm(e,t){return(e=t.exec(e))?e[0]:e}function $(e,t,n){return e.replace(t,n)}function uo(e,t){return e.indexOf(t)}function pe(e,t){return e.charCodeAt(t)|0}function In(e,t,n){return e.slice(t,n)}function Ve(e){return e.length}function Ro(e){return e.length}function Fr(e,t){return t.push(e),e}function _m(e,t){return e.map(t).join("")}var ta=1,jt=1,Bc=0,ke=0,fe=0,Vt="";function na(e,t,n,r,a,i,o){return{value:e,root:t,parent:n,type:r,props:a,children:i,line:ta,column:jt,length:o,return:""}}function yn(e,t){return pm(na("",null,null,"",null,null,0),e,{length:-e.length},t)}function ym(){return fe}function wm(){return fe=ke>0?pe(Vt,--ke):0,jt--,fe===10&&(jt=1,ta--),fe}function Ue(){return fe=ke<Bc?pe(Vt,ke++):0,jt++,fe===10&&(jt=1,ta++),fe}function $e(){return pe(Vt,ke)}function qr(){return ke}function Cn(e,t){return In(Vt,e,t)}function An(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Mc(e){return ta=jt=1,Bc=Ve(Vt=e),ke=0,[]}function Gc(e){return Vt="",e}function jr(e){return Uc(Cn(ke-1,fo(e===91?e+2:e===40?e+1:e)))}function bm(e){for(;(fe=$e())&&fe<33;)Ue();return An(e)>2||An(fe)>3?"":" "}function Em(e,t){for(;--t&&Ue()&&!(fe<48||fe>102||fe>57&&fe<65||fe>70&&fe<97););return Cn(e,qr()+(t<6&&$e()==32&&Ue()==32))}function fo(e){for(;Ue();)switch(fe){case e:return ke;case 34:case 39:e!==34&&e!==39&&fo(fe);break;case 40:e===41&&fo(e);break;case 92:Ue();break}return ke}function Im(e,t){for(;Ue()&&e+fe!==57&&!(e+fe===84&&$e()===47););return"/*"+Cn(t,ke-1)+"*"+ea(e===47?e:Ue())}function Am(e){for(;!An($e());)Ue();return Cn(e,ke)}function Sm(e){return Gc(Vr("",null,null,null,[""],e=Mc(e),0,[0],e))}function Vr(e,t,n,r,a,i,o,s,l){for(var d=0,_=0,h=o,p=0,f=0,w=0,A=1,C=1,b=1,x=0,D="",H=a,j=i,R=r,N=D;C;)switch(w=x,x=Ue()){case 40:if(w!=108&&pe(N,h-1)==58){uo(N+=$(jr(x),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=jr(x);break;case 9:case 10:case 13:case 32:N+=bm(w);break;case 92:N+=Em(qr()-1,7);continue;case 47:switch($e()){case 42:case 47:Fr(Cm(Im(Ue(),qr()),t,n),l);break;default:N+="/"}break;case 123*A:s[d++]=Ve(N)*b;case 125*A:case 59:case 0:switch(x){case 0:case 125:C=0;case 59+_:b==-1&&(N=$(N,/\f/g,"")),f>0&&Ve(N)-h&&Fr(f>32?cc(N+";",r,n,h-1):cc($(N," ","")+";",r,n,h-2),l);break;case 59:N+=";";default:if(Fr(R=lc(N,t,n,d,_,a,s,D,H=[],j=[],h),i),x===123)if(_===0)Vr(N,t,R,R,H,i,h,s,j);else switch(p===99&&pe(N,3)===110?100:p){case 100:case 108:case 109:case 115:Vr(e,R,R,r&&Fr(lc(e,R,R,0,0,a,s,D,a,H=[],h),j),a,j,h,s,r?H:j);break;default:Vr(N,R,R,R,[""],j,0,s,j)}}d=_=f=0,A=b=1,D=N="",h=o;break;case 58:h=1+Ve(N),f=w;default:if(A<1){if(x==123)--A;else if(x==125&&A++==0&&wm()==125)continue}switch(N+=ea(x),x*A){case 38:b=_>0?1:(N+="\f",-1);break;case 44:s[d++]=(Ve(N)-1)*b,b=1;break;case 64:$e()===45&&(N+=jr(Ue())),p=$e(),_=h=Ve(D=N+=Am(qr())),x++;break;case 45:w===45&&Ve(N)==2&&(A=0)}}return i}function lc(e,t,n,r,a,i,o,s,l,d,_){for(var h=a-1,p=a===0?i:[""],f=Ro(p),w=0,A=0,C=0;w<r;++w)for(var b=0,x=In(e,h+1,h=mm(A=o[w])),D=e;b<f;++b)(D=Uc(A>0?p[b]+" "+x:$(x,/&\f/g,p[b])))&&(l[C++]=D);return na(e,t,n,a===0?So:s,l,d,_)}function Cm(e,t,n){return na(e,t,n,Dc,ea(ym()),In(e,2,-2),0)}function cc(e,t,n,r){return na(e,t,n,Co,In(e,0,r),In(e,r+1,-1),r)}function qt(e,t){for(var n="",r=Ro(e),a=0;a<r;a++)n+=t(e[a],a,e,t)||"";return n}function Rm(e,t,n,r){switch(e.type){case hm:if(e.children.length)break;case fm:case Co:return e.return=e.return||e.value;case Dc:return"";case Nc:return e.return=e.value+"{"+qt(e.children,r)+"}";case So:e.value=e.props.join(",")}return Ve(n=qt(e.children,r))?e.return=e.value+"{"+n+"}":""}function Om(e){var t=Ro(e);return function(n,r,a,i){for(var o="",s=0;s<t;s++)o+=e[s](n,r,a,i)||"";return o}}function km(e){return function(t){t.root||(t=t.return)&&e(t)}}function Tm(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var xm=function(e,t,n){for(var r=0,a=0;r=a,a=$e(),r===38&&a===12&&(t[n]=1),!An(a);)Ue();return Cn(e,ke)},Pm=function(e,t){var n=-1,r=44;do switch(An(r)){case 0:r===38&&$e()===12&&(t[n]=1),e[n]+=xm(ke-1,t,n);break;case 2:e[n]+=jr(r);break;case 4:if(r===44){e[++n]=$e()===58?"&\f":"",t[n]=e[n].length;break}default:e[n]+=ea(r)}while(r=Ue());return e},Lm=function(e,t){return Gc(Pm(Mc(e),t))},uc=new WeakMap,Dm=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!uc.get(n))&&!r){uc.set(e,!0);for(var a=[],i=Lm(t,a),o=n.props,s=0,l=0;s<i.length;s++)for(var d=0;d<o.length;d++,l++)e.props[l]=a[s]?i[s].replace(/&\f/g,o[d]):o[d]+" "+i[s]}}},Nm=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function Jc(e,t){switch(vm(e,t)){case 5103:return V+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return V+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return V+e+zr+e+we+e+e;case 6828:case 4268:return V+e+we+e+e;case 6165:return V+e+we+"flex-"+e+e;case 5187:return V+e+$(e,/(\w+).+(:[^]+)/,V+"box-$1$2"+we+"flex-$1$2")+e;case 5443:return V+e+we+"flex-item-"+$(e,/flex-|-self/,"")+e;case 4675:return V+e+we+"flex-line-pack"+$(e,/align-content|flex-|-self/,"")+e;case 5548:return V+e+we+$(e,"shrink","negative")+e;case 5292:return V+e+we+$(e,"basis","preferred-size")+e;case 6060:return V+"box-"+$(e,"-grow","")+V+e+we+$(e,"grow","positive")+e;case 4554:return V+$(e,/([^-])(transform)/g,"$1"+V+"$2")+e;case 6187:return $($($(e,/(zoom-|grab)/,V+"$1"),/(image-set)/,V+"$1"),e,"")+e;case 5495:case 3959:return $(e,/(image-set\([^]*)/,V+"$1$`$1");case 4968:return $($(e,/(.+:)(flex-)?(.*)/,V+"box-pack:$3"+we+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+V+e+e;case 4095:case 3583:case 4068:case 2532:return $(e,/(.+)-inline(.+)/,V+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ve(e)-1-t>6)switch(pe(e,t+1)){case 109:if(pe(e,t+4)!==45)break;case 102:return $(e,/(.+:)(.+)-([^]+)/,"$1"+V+"$2-$3$1"+zr+(pe(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~uo(e,"stretch")?Jc($(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(pe(e,t+1)!==115)break;case 6444:switch(pe(e,Ve(e)-3-(~uo(e,"!important")&&10))){case 107:return $(e,":",":"+V)+e;case 101:return $(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+V+(pe(e,14)===45?"inline-":"")+"box$3$1"+V+"$2$3$1"+we+"$2box$3")+e}break;case 5936:switch(pe(e,t+11)){case 114:return V+e+we+$(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return V+e+we+$(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return V+e+we+$(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return V+e+we+e+e}return e}var Um=function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Co:e.return=Jc(e.value,e.length);break;case Nc:return qt([yn(e,{value:$(e.value,"@","@"+V)})],r);case So:if(e.length)return _m(e.props,function(a){switch(gm(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return qt([yn(e,{props:[$(a,/:(read-\w+)/,":"+zr+"$1")]})],r);case"::placeholder":return qt([yn(e,{props:[$(a,/:(plac\w+)/,":"+V+"input-$1")]}),yn(e,{props:[$(a,/:(plac\w+)/,":"+zr+"$1")]}),yn(e,{props:[$(a,/:(plac\w+)/,we+"input-$1")]})],r)}return""})}},Bm=[Um],Mm=function(e){var t=e.key;if(t==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(w){var A=w.getAttribute("data-emotion");A.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var r=e.stylisPlugins||Bm,a={},i,o=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(w){for(var A=w.getAttribute("data-emotion").split(" "),C=1;C<A.length;C++)a[A[C]]=!0;o.push(w)});var s,l=[Dm,Nm];{var d,_=[Rm,km(function(w){d.insert(w)})],h=Om(l.concat(r,_)),p=function(w){return qt(Sm(w),h)};s=function(w,A,C,b){d=C,p(w?w+"{"+A.styles+"}":A.styles),b&&(f.inserted[A.name]=!0)}}var f={key:t,sheet:new dm({key:t,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:s};return f.sheet.hydrate(o),f};function Gm(e){for(var t=0,n,r=0,a=e.length;a>=4;++r,a-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Jm={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Fm=/[A-Z]|^ms/g,Hm=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Fc=function(e){return e.charCodeAt(1)===45},dc=function(e){return e!=null&&typeof e!="boolean"},Yi=Tm(function(e){return Fc(e)?e:e.replace(Fm,"-$&").toLowerCase()}),fc=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(Hm,function(n,r,a){return ht={name:r,styles:a,next:ht},r})}return Jm[e]!==1&&!Fc(e)&&typeof t=="number"&&t!==0?t+"px":t};function Xr(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var a=n;if(a.anim===1)return ht={name:a.name,styles:a.styles,next:ht},a.name;var i=n;if(i.styles!==void 0){var o=i.next;if(o!==void 0)for(;o!==void 0;)ht={name:o.name,styles:o.styles,next:ht},o=o.next;var s=i.styles+";";return s}return qm(e,t,n)}}var l=n;if(t==null)return l;var d=t[l];return d!==void 0?d:l}function qm(e,t,n){var r="";if(Array.isArray(n))for(var a=0;a<n.length;a++)r+=Xr(e,t,n[a])+";";else for(var i in n){var o=n[i];if(typeof o!="object"){var s=o;t!=null&&t[s]!==void 0?r+=i+"{"+t[s]+"}":dc(s)&&(r+=Yi(i)+":"+fc(i,s)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(t==null||t[o[0]]===void 0))for(var l=0;l<o.length;l++)dc(o[l])&&(r+=Yi(i)+":"+fc(i,o[l])+";");else{var d=Xr(e,t,o);switch(i){case"animation":case"animationName":{r+=Yi(i)+":"+d+";";break}default:r+=i+"{"+d+"}"}}}return r}var hc=/label:\s*([^\s;{]+)\s*(;|$)/g,ht;function Qi(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var r=!0,a="";ht=void 0;var i=e[0];if(i==null||i.raw===void 0)r=!1,a+=Xr(n,t,i);else{var o=i;a+=o[0]}for(var s=1;s<e.length;s++)if(a+=Xr(n,t,e[s]),r){var l=i;a+=l[s]}hc.lastIndex=0;for(var d="",_;(_=hc.exec(a))!==null;)d+="-"+_[1];var h=Gm(a)+d;return{name:h,styles:a,next:ht}}function Hc(e,t,n){var r="";return n.split(" ").forEach(function(a){e[a]!==void 0?t.push(e[a]+";"):a&&(r+=a+" ")}),r}var jm=function(e,t,n){var r=e.key+"-"+t.name;e.registered[r]===void 0&&(e.registered[r]=t.styles)},Vm=function(e,t,n){jm(e,t);var r=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var a=t;do e.insert(t===a?"."+r:"",a,e.sheet,!0),a=a.next;while(a!==void 0)}};function mc(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function pc(e,t,n){var r=[],a=Hc(e,r,n);return r.length<2?n:a+t(r)}var $m=function(e){var t=Mm(e);t.sheet.speedy=function(o){this.isSpeedy=o},t.compat=!0;var n=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=Qi(s,t.registered,void 0);return Vm(t,d),t.key+"-"+d.name},r=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=Qi(s,t.registered),_="animation-"+d.name;return mc(t,{name:d.name,styles:"@keyframes "+_+"{"+d.styles+"}"}),_},a=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=Qi(s,t.registered);mc(t,d)},i=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return pc(t.registered,n,Wm(s))};return{css:n,cx:i,injectGlobal:a,keyframes:r,hydrate:function(o){o.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:Hc.bind(null,t.registered),merge:pc.bind(null,t.registered,n)}},Wm=function e(t){for(var n="",r=0;r<t.length;r++){var a=t[r];if(a!=null){var i=void 0;switch(typeof a){case"boolean":break;case"object":{if(Array.isArray(a))i=e(a);else{i="";for(var o in a)a[o]&&o&&(i&&(i+=" "),i+=o)}break}default:i=a}i&&(n&&(n+=" "),n+=i)}}return n},Km=$m({key:"css"}),$t=Km.css,ho,Ne,Zi,vc,gc=0,qc=[],he=M,_c=he.__b,yc=he.__r,wc=he.diffed,bc=he.__c,Ec=he.unmount,Ic=he.__;function zm(e,t){he.__h&&he.__h(Ne,e,gc||t),gc=0;var n=Ne.__H||(Ne.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function jc(e,t){var n=zm(ho++,7);return Qm(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Xm(){for(var e;e=qc.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach($r),e.__H.__h.forEach(mo),e.__H.__h=[]}catch(t){e.__H.__h=[],he.__e(t,e.__v)}}he.__b=function(e){Ne=null,_c&&_c(e)},he.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ic&&Ic(e,t)},he.__r=function(e){yc&&yc(e),ho=0;var t=(Ne=e.__c).__H;t&&(Zi===Ne?(t.__h=[],Ne.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach($r),t.__h.forEach(mo),t.__h=[],ho=0)),Zi=Ne},he.diffed=function(e){wc&&wc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qc.push(t)!==1&&vc===he.requestAnimationFrame||((vc=he.requestAnimationFrame)||Ym)(Xm)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Zi=Ne=null},he.__c=function(e,t){t.some(function(n){try{n.__h.forEach($r),n.__h=n.__h.filter(function(r){return!r.__||mo(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],he.__e(r,n.__v)}}),bc&&bc(e,t)},he.unmount=function(e){Ec&&Ec(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{$r(r)}catch(a){t=a}}),n.__H=void 0,t&&he.__e(t,n.__v))};var Ac=typeof requestAnimationFrame=="function";function Ym(e){var t,n=function(){clearTimeout(r),Ac&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ac&&(t=requestAnimationFrame(n))}function $r(e){var t=Ne,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ne=t}function mo(e){var t=Ne;e.__c=e.__(),Ne=t}function Qm(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}var Zm=Symbol.for("preact-signals");function ra(){if(mt>1)mt--;else{for(var e,t=!1;wn!==void 0;){var n=wn;for(wn=void 0,po++;n!==void 0;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&$c(n))try{n.c()}catch(a){t||(e=a,t=!0)}n=r}}if(po=0,mt--,t)throw e}}function Oe(e){if(mt>0)return e();mt++;try{return e()}finally{ra()}}var Q=void 0,wn=void 0,mt=0,po=0,Yr=0;function Vc(e){if(Q!==void 0){var t=e.n;if(t===void 0||t.t!==Q)return t={i:0,S:e,p:Q.s,n:void 0,t:Q,e:void 0,x:void 0,r:t},Q.s!==void 0&&(Q.s.n=t),Q.s=t,e.n=t,32&Q.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Q.s,t.n=void 0,Q.s.n=t,Q.s=t),t}}function ve(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}ve.prototype.brand=Zm;ve.prototype.h=function(){return!0};ve.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};ve.prototype.U=function(e){if(this.t!==void 0){var t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n)}};ve.prototype.subscribe=function(e){var t=this;return On(function(){var n=t.value,r=Q;Q=void 0;try{e(n)}finally{Q=r}})};ve.prototype.valueOf=function(){return this.value};ve.prototype.toString=function(){return this.value+""};ve.prototype.toJSON=function(){return this.value};ve.prototype.peek=function(){var e=Q;Q=void 0;try{return this.value}finally{Q=e}};Object.defineProperty(ve.prototype,"value",{get:function(){var e=Vc(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(po>100)throw new Error("Cycle detected");this.v=e,this.i++,Yr++,mt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ra()}}}});function Z(e){return new ve(e)}function $c(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Wc(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Kc(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Wt(e){ve.call(this,void 0),this.x=e,this.s=void 0,this.g=Yr-1,this.f=4}(Wt.prototype=new ve).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Yr))return!0;if(this.g=Yr,this.f|=1,this.i>0&&!$c(this))return this.f&=-2,!0;var e=Q;try{Wc(this),Q=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Q=e,Kc(this),this.f&=-2,!0};Wt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}ve.prototype.S.call(this,e)};Wt.prototype.U=function(e){if(this.t!==void 0&&(ve.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Wt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Wt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Vc(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function bn(e){return new Wt(e)}function zc(e){var t=e.u;if(e.u=void 0,typeof t=="function"){mt++;var n=Q;Q=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Oo(e),r}finally{Q=n,ra()}}}function Oo(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,zc(e)}function ep(e){if(Q!==this)throw new Error("Out-of-order effect");Kc(this),Q=e,this.f&=-2,8&this.f&&Oo(this),ra()}function Rn(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Rn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};Rn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,zc(this),Wc(this),mt++;var e=Q;return Q=this,ep.bind(this,e)};Rn.prototype.N=function(){2&this.f||(this.f|=2,this.o=wn,wn=this)};Rn.prototype.d=function(){this.f|=8,1&this.f||Oo(this)};function On(e){var t=new Rn(e);try{t.c()}catch(n){throw t.d(),n}return t.d.bind(t)}var Xc,eo,Yc=[];On(function(){Xc=this.N})();function Kt(e,t){M[e]=t.bind(null,M[e]||function(){})}function Qr(e){eo&&eo(),eo=e&&e.S()}function Qc(e){var t=this,n=e.data,r=Zc(n);r.value=n;var a=jc(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var d=bn(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=bn(function(){return!Array.isArray(d.value)&&!Bi(d.value)}),h=On(function(){if(this.N=eu,_.value){var f=d.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),p=t.__$u.d;return t.__$u.d=function(){h(),p.call(this)},[_,d]},[]),i=a[0],o=a[1];return i.value?o.peek():o.value}Qc.displayName="_st";Object.defineProperties(ve.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Qc},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Kt("__b",function(e,t){if(typeof t.type=="string"){var n,r=t.props;for(var a in r)if(a!=="children"){var i=r[a];i instanceof ve&&(n||(t.__np=n={}),n[a]=i,r[a]=i.peek())}}e(t)});Kt("__r",function(e,t){Qr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(a){var i;return On(function(){i=this}),i.c=function(){r.__$f|=1,r.setState({})},i}())),Qr(n),e(t)});Kt("__e",function(e,t,n,r){Qr(),e(t,n,r)});Kt("diffed",function(e,t){Qr();var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,a=t.props;if(r){var i=n.U;if(i)for(var o in i){var s=i[o];s!==void 0&&!(o in r)&&(s.d(),i[o]=void 0)}else i={},n.U=i;for(var l in r){var d=i[l],_=r[l];d===void 0?(d=tp(n,l,_,a),i[l]=d):d.o(_,a)}}}e(t)});function tp(e,t,n,r){var a=t in e&&e.ownerSVGElement===void 0,i=Z(n);return{o:function(o,s){i.value=o,r=s},d:On(function(){this.N=eu;var o=i.value.value;r[t]!==o&&(r[t]=o,a?e[t]=o:o?e.setAttribute(t,o):e.removeAttribute(t))})}}Kt("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var a in r){var i=r[a];i&&i.d()}}}}else{var o=t.__c;if(o){var s=o.__$u;s&&(o.__$u=void 0,s.d())}}e(t)});Kt("__h",function(e,t,n,r){(r<3||r===9)&&(t.__$f|=2),e(t,n,r)});De.prototype.shouldComponentUpdate=function(e,t){var n=this.__$u,r=n&&n.s!==void 0;for(var a in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var i=2&this.__$f;if(!(r||i||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Zc(e){return jc(function(){return Z(e)},[])}var np=function(e){queueMicrotask(function(){queueMicrotask(e)})};function rp(){Oe(function(){for(var e;e=Yc.shift();)Xc.call(e)})}function eu(){Yc.push(this)===1&&(M.requestAnimationFrame||np)(rp)}var be=$t`
1
+ var pd=Object.create;var ga=Object.defineProperty,vd=Object.defineProperties,gd=Object.getOwnPropertyDescriptor,_d=Object.getOwnPropertyDescriptors,yd=Object.getOwnPropertyNames,Un=Object.getOwnPropertySymbols,Qo=Object.getPrototypeOf,_a=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable,wd=Reflect.get;var Yo=(t,e,n)=>e in t?ga(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))_a.call(e,n)&&Yo(t,n,e[n]);if(Un)for(var n of Un(e))Xo.call(e,n)&&Yo(t,n,e[n]);return t},Oe=(t,e)=>vd(t,_d(e));var Zt=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,n)=>(typeof require!="undefined"?require:e)[n]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Zo=(t,e)=>{var n={};for(var r in t)_a.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Un)for(var r of Un(t))e.indexOf(r)<0&&Xo.call(t,r)&&(n[r]=t[r]);return n};var Z=(t,e)=>()=>(t&&(e=t(t=0)),e);var ya=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var bd=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of yd(e))!_a.call(t,a)&&a!==n&&ga(t,a,{get:()=>e[a],enumerable:!(r=gd(e,a))||r.enumerable});return t};var wa=(t,e,n)=>(n=t!=null?pd(Qo(t)):{},bd(e||!t||!t.__esModule?ga(n,"default",{value:t,enumerable:!0}):n,t));var es=(t,e,n)=>wd(Qo(t),n,e);var I=(t,e,n)=>new Promise((r,a)=>{var i=l=>{try{s(n.next(l))}catch(d){a(d)}},o=l=>{try{s(n.throw(l))}catch(d){a(d)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,o);s((n=n.apply(t,e)).next())});function kd(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}function Oa(t){return typeof t=="string"}function ls(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}function cs(t){return typeof t=="object"&&Array.isArray(t)}function xd(t){return typeof t=="undefined"}function Dd(t){return xd(t)||t===null}function Pd(t){return typeof t=="function"}function us(t){let e=t,n=null,r=function(...a){return n||(n=new e(...a)),n};return r.prototype=e.prototype,r}function ds(t,e,n){if(typeof n!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function r(a,i){for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o)){let s=a[o],l=i[o],d=n(s,l,o,a,i);d!==void 0?a[o]=d:rs(l)&&rs(s)?a[o]=r(os({},s),l):Array.isArray(l)&&Array.isArray(s)?a[o]=[...s,...l]:a[o]=l}return a}return r(t,e)}function rs(t){return t&&typeof t=="object"&&t.constructor===Object}function fs(t,e){if(Array.isArray(t))return t.concat(e)}function rn(t,e,n={}){let r=null,a,i,o,{leading:s=!1,trailing:l=!0}=n,d=()=>(o=t.apply(i,a),a=void 0,i=void 0,o),_=function(...h){a=h,i=this;let p=s&&!r;if(r&&clearTimeout(r),r=setTimeout(()=>{r=null,l&&!p&&d()},e),p)return d()};return _.cancel=()=>{r&&clearTimeout(r),r=null,a=i=void 0},_.flush=()=>{if(r)return clearTimeout(r),r=null,d()},_}function Ud(t,e){return(...n)=>e(t,...n)}function vs(t){return e=>Ud(e,function(n,...r){if(typeof n=="function")try{return n.apply(this,r)}catch(a){t(new Nd(`${a}`))}})}function en(t){return(...e)=>{var n,r;((r=(n=globalThis.VConsole)==null?void 0:n[t])!=null?r:globalThis.console[t])(...e)}}function Mn(t,e){return e.map(n=>{if(n==="params"&&t[n]){let r=t[n];return Object.keys(r).reduce((a,i)=>(a[i]=String(r[i]),a),{})}return t[n]})}function qd(t){let e=t.location?Mn(t.location,is):null,n=t.target?Mn(t.target,is):null;return Mn(Rd(os({},t),{location:e,target:n}),Jd)}function Pa(t){let e=t.events.map(r=>qd(r)),n=Mn(t.device,Fd);return[t.protocolVersion,e,n,t.project]}function jd(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let t=Object.getOwnPropertyDescriptor(window,"localStorage");if(t&&t.get){let r=t.get.call(window);return window.__joliboxLocalStorage__=r,r}if(t=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),t&&t.get)return t.get.call(window);let e=Window.prototype,n=Object.getOwnPropertyDescriptor(e,"localStorage");if(n&&n.get){let r=n.get.call(window);return window.__joliboxLocalStorage__=r,r}return localStorage}catch(t){return console.warn("Failed to get original localStorage, fallback to default implementation",t),localStorage}}function Ua(t,e,n){let r=window.location.hostname,a=r.split("."),i=n?e:t;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(r))return`${i}.jolibox.com`;if(a.length>=2){let o=a.slice(-2).join(".");if(o==="jolibox.com"||o==="pico-game.com"||o==="joyslite.com")return`${i}.${o}`}return`${i}.jolibox.com`}function ys(t){return Ua("app","stg-app",t)}function kt(t){return`https://${Ua("api","stg-api",t)}`}function Yd(t){return Ua("collect","stg-collect",t)}function ws(t){return`https://${Yd(t)}`}function ef(t){return new Promise(e=>bs(t)(e))}function bs(t){return(e,n=null)=>{let r=!1;return t(a=>{if(!r)return r=!0,e.call(n,a)},null)}}function tf(t,e){return(n=>{let r,a={onWillAddFirstListener(){r=n(i.fire,i)}},i=new nn(a);return i.event})((n,r=null)=>t(a=>e(a)&&n.call(r,a),null))}function rf(t,e){let n=Math.min(t.length,e.length);for(let r=0;r<n;r++)af(t[r],e[r])}function af(t,e){if(Oa(e)){if(typeof t!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(Pd(e)){try{if(t instanceof e)return}catch(n){}if(!Dd(t)&&t.constructor===e||e.length===1&&e.call(void 0,t)===!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 of(){return typeof globalThis!="undefined"?globalThis[Es]:void 0}function sf(t){typeof globalThis!="undefined"&&(globalThis[Es]=t)}function ge(t=!1){let e=of();if(!t&&e)return e;let n=new Bn,r=new Sa,a={registerCommand(i,o,s){n.registerCommand({id:i,handler:o,metadata:s})},executeCommand(i,...o){return r.executeCommand(i,...o)},excuteCommandSync(i,...o){return r.executeCommandThowErr(i,...o)}};return sf(a),a}var Ra,Ed,Id,Ad,ts,Cd,Sd,ns,os,Rd,Od,ss,Td,Ld,Ta,ka,hs,ms,Nd,ps,Gn,Jn,xa,Te,Ea,Md,Da,as,Bd,pt,Tt,Gd,is,Jd,Fd,st,Ot,Hd,Ee,Vd,$d,Kd,gs,La,Na,Wd,zd,_s,Ia,te,Qd,Xd,tn,nn,Je,Ca,Zd,ba,nf,lt,Bn,Sa,Es,q=Z(()=>{"use strict";Ra=Object.defineProperty,Ed=Object.defineProperties,Id=Object.getOwnPropertyDescriptor,Ad=Object.getOwnPropertyDescriptors,ts=Object.getOwnPropertySymbols,Cd=Object.prototype.hasOwnProperty,Sd=Object.prototype.propertyIsEnumerable,ns=(t,e,n)=>e in t?Ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,os=(t,e)=>{for(var n in e||(e={}))Cd.call(e,n)&&ns(t,n,e[n]);if(ts)for(var n of ts(e))Sd.call(e,n)&&ns(t,n,e[n]);return t},Rd=(t,e)=>Ed(t,Ad(e)),Od=(t,e)=>{for(var n in e)Ra(t,n,{get:e[n],enumerable:!0})},ss=(t,e,n,r)=>{for(var a=r>1?void 0:r?Id(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(a=(r?o(e,n,a):o(a))||a);return r&&a&&Ra(e,n,a),a},Td=(t,e,n)=>new Promise((r,a)=>{var i=l=>{try{s(n.next(l))}catch(d){a(d)}},o=l=>{try{s(n.throw(l))}catch(d){a(d)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,o);s((n=n.apply(t,e)).next())});if(typeof window!="undefined"&&!window.AbortController){let t=function(){this.signal=new e};t.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let n=new Event("abort");this.signal.dispatchEvent(n)};let e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(n,r){this._eventListeners[n]||(this._eventListeners[n]=[]),this._eventListeners[n].push(r)},e.prototype.removeEventListener=function(n,r){if(!this._eventListeners[n])return;let a=this._eventListeners[n].indexOf(r);a!==-1&&this._eventListeners[n].splice(a,1)},e.prototype.dispatchEvent=function(n){if(this._eventListeners[n.type])for(let r of this._eventListeners[n.type])r.call(this,n)},window.AbortController=t,window.AbortSignal=e}Ld=(t=>(t[t.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",t[t.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",t[t.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",t[t.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",t[t.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",t[t.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",t[t.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",t[t.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",t))(Ld||{}),Ta=class extends Error{constructor(t){if(typeof t=="string"){super(t),this.priority="P1";return}super(t.message),this.priority="P1",this.stack=t.stack,this.raw=t}},ka=class extends Ta{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},hs=class extends Ta{constructor(){super(...arguments),this.kind="USER_ERROR"}},ms=class extends hs{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Nd=class extends hs{constructor(t,e,n){super(t),this.message=t,this.errNo=e,this.name="USER_CUSTOM_ERROR",this.errMsg=t,n&&(this.extra=Object.assign({},this.extra,n))}},ps=class extends ka{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Gn=class extends ka{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Jn=class extends Ta{constructor(t,e,n,r,a){super(t),this.message=t,this.code=e,this.kind="API_ERROR",this.name="API_ERROR",n&&(this.errorType=n),r!==void 0&&(this.stack=r),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},xa=class extends ka{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Te={log:en("log"),warn:en("warn"),info:en("info"),error:en("error"),debug:en("debug")};Object.assign(globalThis,{logger:Te});Ea=Symbol.for("Jolibox.canIUseMap"),Md={};globalThis[Ea]||(globalThis[Ea]=Md);Da={get config(){return globalThis[Ea]}},as=Symbol.for("Jolibox.canIUseMap.native"),Bd={};globalThis[as]||(globalThis[as]=Bd);pt=(t=>(t[t.Other=0]="Other",t[t.Route=1]="Route",t[t.Click=2]="Click",t[t.View=3]="View",t[t.Expose=4]="Expose",t[t.Swipe=5]="Swipe",t[t.Input=6]="Input",t[t.Select=7]="Select",t[t.SwitchOn=8]="SwitchOn",t[t.SwitchOff=9]="SwitchOff",t[t.Submit=10]="Submit",t[t.Scroll=11]="Scroll",t[t.Hide=12]="Hide",t[t.System=1e3]="System",t[t.ErrorTrace=1001]="ErrorTrace",t[t.UserDefined=1002]="UserDefined",t))(pt||{}),Tt=(t=>(t.MiniGame="mini-game",t.MiniDrama="mini-drama",t.App="app",t.WebSDK="web-sdk",t.AppSDK="app-sdk",t))(Tt||{}),Gd=(t=>(t[t.App=0]="App",t[t.H5=1]="H5",t[t.Weapp=2]="Weapp",t[t.Alipay=3]="Alipay",t[t.Gcash=4]="Gcash",t[t.Dana=5]="Dana",t[t.Umma=6]="Umma",t[t.WebSDK=1e3]="WebSDK",t[t.AppSDK=1001]="AppSDK",t[t.Other=9999]="Other",t))(Gd||{}),is=["name","params"],Jd=["name","type","location","target","extra","timestamp","userId"],Fd=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];st=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)});jd();Ot=typeof window=="undefined",Hd=()=>!Ot&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ee={isiOS:!Ot&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),iosVersion:()=>{let t=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3]||"0",10)]},isAndroid:!Ot&&navigator.userAgent.includes("Android"),isMac:!Ot&&navigator.userAgent.includes("Mac"),isFacebook:!Ot&&navigator.userAgent.includes("FB_IAB"),isPC:!Ot&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Vd=()=>Ee.isiOS?"iOS":Ee.isAndroid?"Android":Ee.isMac?"Mac":Ee.isFacebook?"Facebook":"PC",$d="device_id",Kd="advertising_id",gs=t=>(window.__joliboxLocalStorage__.getItem(t)||window.__joliboxLocalStorage__.setItem(t,st()),window.__joliboxLocalStorage__.getItem(t)),La=()=>new URLSearchParams(window.location.search).get("deviceId")||gs($d),Na=()=>new URLSearchParams(window.location.search).get("advertisingId")||gs(Kd),Wd=t=>t.charAt(0).toUpperCase()+t.slice(1),zd=()=>{var t;let e=new URLSearchParams(window.location.search);return Wd((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},_s=t=>{if(Hd())return window.navigator.userAgent;let e="JoliboxWebSDK",n=Vd(),r=navigator.language,a=La(),i=Na();return`${e} (${zd()}${n}; UnknownModel; UnknownSystemVersion; ${r}) uuid/${a} adid/${i} version/${t||""}`};Ia=class Aa{constructor(e){this.element=e,this.next=Aa.Undefined,this.prev=Aa.Undefined}};Ia.Undefined=new Ia(void 0);te=Ia,Qd=class{constructor(){this._first=te.Undefined,this._last=te.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===te.Undefined}clear(){let t=this._first;for(;t!==te.Undefined;){let e=t.next;t.prev=te.Undefined,t.next=te.Undefined,t=e}this._first=te.Undefined,this._last=te.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let n=new te(t);if(this._first===te.Undefined)this._first=n,this._last=n;else if(e){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==te.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==te.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==te.Undefined&&t.next!==te.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===te.Undefined&&t.next===te.Undefined?(this._first=te.Undefined,this._last=te.Undefined):t.next===te.Undefined?(this._last=this._last.prev,this._last.next=te.Undefined):t.prev===te.Undefined&&(this._first=this._first.next,this._first.prev=te.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==te.Undefined;)yield t.element,t=t.next}},Xd=0,tn=class{constructor(t){this.value=t,this.id=Xd++}},nn=class{constructor(t){this.options=t,this._size=0}dispose(t){var e,n;this._disposed||(this._disposed=!0,this._listeners&&(t?(this._listeners instanceof tn&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(r=>(r==null?void 0:r.value)===t)):(this._listeners=void 0,this._size=0)),(n=(e=this.options)==null?void 0:e.onDidRemoveLastListener)==null||n.call(e))}get event(){var t;return(t=this._event)!=null||(this._event=(e,n)=>{var r,a,i,o,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};n&&(e=e.bind(n));let d=new tn(e);return this._listeners?this._listeners instanceof tn?this._listeners=[this._listeners,d]:this._listeners.push(d):((a=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||a.call(r,this),this._listeners=d,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var _,h,p,f;if(!this._disposed){if(this._listeners instanceof tn)this._listeners.id===d.id&&(this._listeners=void 0,this._size=0,(h=(_=this.options)==null?void 0:_.onDidRemoveLastListener)==null||h.call(_));else if(this._listeners){let w=this._listeners.indexOf(d);w>=0&&(this._listeners.splice(w,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(t,e){var n;if(!t)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){t.value(e);return}try{t.value(e)}catch(a){r(a)}}fire(t){this._listeners&&(this._listeners instanceof tn?this._deliver(this._listeners,t):this._listeners.forEach(e=>this._deliver(e,t)))}hasListeners(){return this._size>0}},Je=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(t,e,n=!0){var r;let a=(r=this.listeners.get(t))!=null?r:new nn,i=l=>e(...l.args),o=a.event(i);this.listerHandlerMap.set(e,{handler:i,dispose:o}),this.listeners.set(t,a);let s=this.cachedEventQueue.get(t);if(s&&n)for(let l of s)e(...l.args)}flushCachedEvent(t){t?this.cachedEventQueue.delete(t):this.cachedEventQueue.clear()}off(t,e){let n=this.listerHandlerMap.get(e);n&&(n.dispose(),this.listerHandlerMap.delete(e))}emit(t,...e){let n=this.listeners.get(t),r=this.cachedEventQueue.get(t);r||(r=new Qd,this.cachedEventQueue.set(t,r)),r.push({args:e}),n&&n.fire({event:t,args:e})}once(t,e){let n=(...r)=>{e(...r),this.off(t,n)};this.on(t,n,!1)}},Ca={};Od(Ca,{None:()=>Zd,filter:()=>tf,once:()=>bs,toPromise:()=>ef});Zd=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});ba=Symbol.for("Jolibox.hostEmitter"),nf=()=>{let t=new Je;return globalThis[ba]||(globalThis[ba]={on:t.on.bind(t),off:t.off.bind(t),emit:t.emit.bind(t),once:t.once.bind(t)}),globalThis[ba]},lt=nf();Bn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new nn,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(t){if(!t)throw new Error("invalid command");if(t.metadata&&Array.isArray(t.metadata.args)){let n=[];for(let a of t.metadata.args)n.push(a.constraint);let r=t.handler;t.handler=function(...a){return rf(a,n),r(...a)}}let{id:e}=t;this._commands.get(e)&&console.info(`[Jolibox SDK] duplicated command is registered ${e}`),this._commands.set(e,t),this._onDidRegisterCommand.fire(e)}getCommand(t){return this._commands.get(t)}getCommands(){let t=new Map;for(let e of this._commands.keys()){let n=this.getCommand(e);n&&t.set(e,n)}return t}};Bn=ss([us],Bn);Sa=class{constructor(){this._onWillExecuteCommand=new nn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new nn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Bn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=kd(3e4)),this._starActivation}executeCommand(t,...e){return Td(this,null,function*(){return this.registry.getCommand(t)?this._tryExecuteCommand(t,e):(yield Promise.all([Promise.race([this._activateStar(),Ca.toPromise(Ca.filter(this.registry.onDidRegisterCommand,n=>n===t))])]),this._tryExecuteCommand(t,e))})}executeCommandThowErr(t,...e){if(!this.registry.getCommand(t))throw new Error(`command '${t}' not found`);let n=this.registry.getCommand(t);this._onWillExecuteCommand.fire({commandId:t,args:e});let r=this.invokeFunction(n.handler,...e);return this._onDidExecuteCommand.fire({commandId:t,args:e}),r}_tryExecuteCommand(t,e){let n=this.registry.getCommand(t);if(!n)return Promise.reject(new Error(`command '${t}' not found`));try{this._onWillExecuteCommand.fire({commandId:t,args:e});let r=this.invokeFunction(n.handler,...e);return this._onDidExecuteCommand.fire({commandId:t,args:e}),Promise.resolve(r)}catch(r){return Promise.reject(r)}}invokeFunction(t,...e){let n=!1;try{return t(...e)}finally{n=!0}}};Sa=ss([us],Sa);Es=Symbol.for("Jolibox.commands")});function ke(t,e={}){Ma.emit("ERROR_REPORT",{error:t,options:e})}var Ma,vt,Ve=Z(()=>{"use strict";q();q();Ma=new Je,vt=new Je;ke.debounce=rn(ke,50,{leading:!0})});var Ba,lf,Is,As,Cs=Z(()=>{"use strict";q();Ve();Ba=t=>{let e=t.replace(/-/g,"+").replace(/_/g,"/"),n=e.length%4===0?"":"=".repeat(4-e.length%4),r=atob(e+n);try{return JSON.parse(r)}catch(a){return{}}},lf=t=>{let e=JSON.stringify(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Is=t=>{var e;try{let a=(e=new URL(t).searchParams.get("joliSource"))==null?void 0:e.split(".");if(a!=null&&a.length){let[i,o,s]=a;return{headerJson:Ba(i),payloadJson:Ba(o),signature:Ba(s)}}else throw"joli_source is missing"}catch(n){return ke(new ps(`${t} not a valid schema: ${n}`)),{headerJson:{},payloadJson:{},signature:{}}}},As=(t,e)=>{let n=e.split(".");if(n&&n.length===3){let r=n[0],a=lf(t),i=n[2];return`${r}.${a}.${i}`}return e}});var cf,Fn,Ss,Ga=Z(()=>{"use strict";q();cf="1.2.5",Fn=()=>cf,Ss=()=>{let t=Fn();return`${_s(t)}`}});function Fa(t,e){return(document==null?void 0:document.head.querySelector(`meta[name="${t}"][content="${e}"]`))!==null}var uf,Rs,Ja,Os,ne,df,P,me=Z(()=>{"use strict";q();Cs();Ga();q();uf={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:La(),adId:Na(),pixelRatio:window.devicePixelRatio||1,platform:Ee.isAndroid?"android":Ee.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Fn()},schema:window.location.href,platform:Ee.isAndroid?"android":Ee.isiOS?"ios":"h5"},Ja=(Rs=globalThis.joliboxJSCore)==null?void 0:Rs.env,ne=Object.assign({},(Os=Ja==null?void 0:Ja())!=null?Os:uf);df=()=>{var f,w,A,R,b,x,L,F,H,S,N;let{payloadJson:t,headerJson:e,signature:n}=ne.schema.length?Is(ne.schema):{},r=`${ne.deviceInfo.did}-${new Date().getTime()}`,i=new URL(ne.schema.length?ne.schema:window.location.href).searchParams,o=(A=(w=(f=i.get("mpId"))!=null?f:i.get("appId"))!=null?w:i.get("gameId"))!=null?A:"",s=(x=(b=(R=ne.clientSessionId)!=null?R:t==null?void 0:t.sessionId)!=null?b:i.get("sessionId"))!=null?x:r,l=!!((F=(L=t==null?void 0:t.testAdsMode)!=null?L:t==null?void 0:t.__testAdsMode)!=null?F:i.get("testAdsMode")==="true"),d=(N=(S=(H=t==null?void 0:t.joliboxEnv)!=null?H:t==null?void 0:t.__joliboxEnv)!=null?S:i.get("joliboxEnv"))!=null?N:"production",_=d==="staging",h=e==null?void 0:e.channel,p=t==null?void 0:t.__shouldInterupt;return{get startTime(){var k;return(k=performance.timeOrigin)!=null?k:performance.timing.navigationStart},get testMode(){return _},get testAdsMode(){return l},get joliboxEnv(){return d},get joliSource(){var k;return(k=i.get("joliSource"))!=null?k:null},get mpId(){var k;return(k=o!=null?o:t==null?void 0:t.id)!=null?k:""},get mpVersion(){var k;return(k=e==null?void 0:e.ver)!=null?k:Fn()},get mpType(){var k,M;return(M=(k=e==null?void 0:e.__mpType)!=null?k:t==null?void 0:t.__mpType)!=null?M:"game"},get platform(){var k;return((k=ne.platform)!=null?k:ne.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ne.deviceInfo},get sdkInfo(){return ne.sdkInfo},get hostInfo(){return ne.hostInfo},get hostUserInfo(){return ne.hostUserInfo},get sessionId(){var k,M;return(M=(k=ne.clientSessionId)!=null?k:s)!=null?M:r},get channel(){return h},get webviewId(){var k;return(k=ne.webviewId)!=null?k:-1},get shouldInterupt(){return p},get from(){return t==null?void 0:t.__from},get baseApiHost(){return ys(_)},get adId(){var k;return(k=ne.deviceInfo.adId)!=null?k:ne.deviceInfo.did},get language(){return ne.deviceInfo.lang},get sdkEnvironment(){return Fa("dlightek","jolibox")?"dlightek":i.get("huaweiQuick")==="true"?"huaweiQuick":Fa("gamedistribution","jolibox")?"gamedistribution":Fa("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var z,ee,he;let k=(z=ne.deviceInfo.pixelRatio)!=null?z:1,M=(ee=ne.deviceInfo.statusBarHeight)!=null?ee:t==null?void 0:t.__androidStatusBarHeight,W=(he=ne.deviceInfo.navigationBarHeight)!=null?he:t==null?void 0:t.__androidNavigationBarHeight;return{statusBarHeight:M!==void 0?M/k:20,navigationBarHeight:W!==void 0?W/k:10}},get abTests(){var k,M;return(M=(k=ne.abValues)==null?void 0:k.split(","))!=null?M:[]},get mpInfo(){var k;return(k=ne.mpInfo)!=null?k:{mpName:"unknown"}},onEnvConfigChanged:k=>{ds(ne,k,fs)},encodeJoliSourceQuery:k=>{var M,W;return e&&n?As(j(j({},t),k),(M=i.get("joliSource"))!=null?M:""):(W=i.get("joliSource"))!=null?W:""},setDoExitDirectly:()=>{p=!1}}},P=df()});var qa,ks,ff,hf,Ts,mf,xs=Z(()=>{"use strict";q();Ve();me();q();qa=!1,ks=(t,e)=>t==null?!1:e in t,ff=t=>ks(t,"kind"),hf=t=>{let e=t.toLowerCase().split("_");return e[0]+e.slice(1).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")},Ts=(t,e={},n)=>{var i,o,s;let r={user_id:(o=(i=P.hostUserInfo)==null?void 0:i.uid)!=null?o:"",device_id:(s=P.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:hf(t.name)},a=Oe(j({},r),{env:e.environment,isFromUser:n});n?vt.emit("GLOBAL_USER_ERROR",t,a):vt.emit("GLOBAL_ERROR",t,a)},mf=t=>ks(t,"kind")&&t.kind==="USER_ERROR";Ma.on("ERROR_REPORT",({error:t,options:e})=>{if(qa)return;qa=!0;let n=ff(t)&&t.raw?t.raw:t;try{let r=mf(t);Ts(t,e,r)}catch(r){let a=r instanceof Error?r.message:String(r),i=new xa(`${a}, origin error: ${n.message}`);Te.error(i),Ts(new xa(i.message),{environment:e.environment},!1)}finally{qa=!1}})});var ja,Ha=Z(()=>{"use strict";Ve();q();Ve();ja=t=>new ms(t)});function Ds(t,e){let n=(r,a,i)=>{let d=a!=null?a:{},{eventType:o}=d,s=Zo(d,["eventType"]),l=Oe(j({tag:r,eventType:i!=null?i:o!=null?o:pt.Other},e),{extra:j({},s)});r=="globalJsError"?ke(new Gn(JSON.stringify(l))):t("systemLog",l,P.webviewId)};return n.debounce=rn(n,500,{leading:!0}),n}function Ps(t){let e=(n,r,a)=>{var s;let i=(s=a&&JSON.stringify(a))!=null?s:0,o={speed_value_type:n,total_duration:r};i&&Object.assign(o,{extra:i}),t("joliboxSpeedAnalysis",o)};return e.debounce=rn(e,500,{leading:!0}),e}var Ls=Z(()=>{"use strict";q();q();Ve();me()});function Ns(t,e){let n=Ds(t,e),r=Ps(n);return{track:n,trackPerformance:r}}var Us=Z(()=>{"use strict";Ls()});var Va=Z(()=>{"use strict"});var qn,Ms=Z(()=>{"use strict";me();q();q();qn=class{constructor(e){this.apiHost=e;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return I(this,null,function*(){let n=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,r=yield(yield fetch(n)).json();this.samplesConfig=r})}checkIsSampled(e){if(!this.samplesConfig)return!1;let{samples:n}=this.samplesConfig;for(let[r,a]of Object.entries(n))if(a.includes(e.name))return Math.floor(Math.random()*101)<parseFloat(r);return!1}getDevice(){var r,a,i,o,s;let{nativeSDKVersion:e,jssdkVersion:n}=P.sdkInfo;return{platform:1e3,os:P.deviceInfo.platform,appVersion:(r=e!=null?e:n)!=null?r:"1.0.0",appId:(i=(a=P.hostInfo)==null?void 0:a.aid)!=null?i:"1",model:(o=P.deviceInfo.model)!=null?o:"UnknownModel",brand:(s=P.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:P.deviceInfo.did,jsSdkVersion:n,extra:{}}}getLocation(){let e=new URLSearchParams(window.location.search),n={};return e.forEach((r,a)=>{n[a]=r}),{name:"GamePage",params:n}}trackEvent(e,n,r){return I(this,null,function*(){if(this.checkIsSampled(e))return;let a=e.location?e.location:yield this.getLocation(),i=e.target||null,o=e.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let s=this.deviceInfo,d={protocolVersion:"1.0.0",events:[Oe(j({},e),{location:a,target:i,extra:o,timestamp:Date.now(),userId:null})],device:s,project:n};try{r?yield this.doReport(Pa(d),r):yield this.doReport(Pa(d))}catch(_){Te.log("[Jolibox SDK] report API error",_)}})}}});var $a=Z(()=>{"use strict";Us();Va();Ms()});var Ka,Bs,$e,jn,Be,xt=Z(()=>{"use strict";Ga();me();q();Ka=t=>{let e=new AbortController;return setTimeout(()=>e.abort(),t),e.signal};(Bs=AbortSignal.timeout)!=null||(AbortSignal.timeout=Ka);$e=class t{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(r=>r).length/this.networkRequests.length>=.6}static getInstance(){return t._instance||(t._instance=new t),t._instance}create(e){let n=new jn(e);return t.getInstance().httpClients.add(n),n}recordNetworkRequest(e){this.networkRequests.push(e),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},jn=class{constructor(e){this.xua=Ss();this.getJoliSource=()=>P.joliSource;var r;let n=kt(P.testMode);this.baseUrl=(r=e==null?void 0:e.baseUrl)!=null?r:n}get(e,n){return I(this,null,function*(){try{let{query:r,timeout:a}=n!=null?n:{},{headers:i}=n!=null?n:{},o=r?new URLSearchParams(r):null,s=o==null?void 0:o.toString(),l=`${this.baseUrl}${e}${s?`?${s}`:""}`,d=this.xua,_=this.getJoliSource();i=Object.assign({},i!=null?i:{},d?{"x-user-agent":d}:{},_?{"x-joli-source":_}:{});let h=yield fetch(l,{method:"GET",headers:i,credentials:"include",signal:Ka(a!=null?a:3e4)});return $e.getInstance().recordNetworkRequest(!0),yield h.json()}catch(r){throw $e.getInstance().recordNetworkRequest(!1),r}})}post(e,n){return I(this,null,function*(){try{let{data:r,query:a,timeout:i}=n!=null?n:{},{headers:o}=n!=null?n:{},s=a?new URLSearchParams(a):null,l=s==null?void 0:s.toString(),d=`${this.baseUrl}${e}${l?`?${l}`:""}`,_=this.xua,h=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},h?{"x-joli-source":h}:{},{"x-os-type":Ee.isAndroid?"ANDROID":Ee.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(d,{method:"POST",headers:o,body:JSON.stringify(r),signal:Ka(i!=null?i:3e4),credentials:"include"});$e.getInstance().recordNetworkRequest(!0);let f=p.headers.get("content-type");if(f!=null&&f.includes("application/octet-stream"))try{return p.blob()}catch(w){return yield p.arrayBuffer()}if(f!=null&&f.includes("multipart/form-data")||f!=null&&f.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(w){return yield p.text()}if(f!=null&&f.includes("application/json"))try{return yield p.json()}catch(w){return yield p.text()}return p}catch(r){throw $e.getInstance().recordNetworkRequest(!1),r}})}put(e,n){return I(this,null,function*(){try{let{data:r,query:a,timeout:i}=n!=null?n:{},{headers:o}=n!=null?n:{},s=a?new URLSearchParams(a):null,l=s==null?void 0:s.toString(),d=`${this.baseUrl}${e}${l?`?${l}`:""}`,_=this.xua,h=this.getJoliSource();o=Object.assign({},o!=null?o:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},h?{"x-joli-source":h}:{});let p=yield fetch(d,{method:"PUT",headers:o,credentials:"include",body:JSON.stringify(r!=null?r:{})});if(!p.ok)throw $e.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return $e.getInstance().recordNetworkRequest(!0),yield p.json()}catch(r){throw console.error("Error:",r),r}})}};window.JoliboxHttpClient=jn;Be=$e.getInstance()});var Wa,Hn,za=Z(()=>{"use strict";me();$a();xt();q();Wa=class extends qn{constructor(){super(...arguments);this.httpClient=Be.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n;return ws((n=P.testMode)!=null?n:!1)}doReport(n){this.httpClient.post("/report",{data:n,timeout:5e3}).catch(r=>{console.info("report error",r)})}},Hn=new Wa(kt(P.testMode))});var pf,Gs=Z(()=>{"use strict";xs();q();Ha();q();za();me();pf=(t,e)=>{var a,i,o;let n={message:e.message,stack:(a=e.stack)!=null?a:"",errorType:e.name,source:0},r={name:t,type:pt.ErrorTrace,location:null,target:null,extra:n,timestamp:Date.now(),userId:(o=(i=P.hostUserInfo)==null?void 0:i.uid)!=null?o:null};Hn.trackEvent(r,Tt.WebSDK)};vt.on("GLOBAL_ERROR",(t,e)=>{pf(e.tag,t)});vt.on("GLOBAL_USER_ERROR",(t,e)=>{Te.log("UserError",t,e)})});var Vn,Js=Z(()=>{"use strict";Vn=class{constructor(e,n){this.eventEmitter=e;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(e,n)=>{window.parent&&window.parent.postMessage({type:e,data:n},"*")};this.playGame=e=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:e}}),this.tracker("PlayGame",{duration:e}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:e}))};this.timer=this.createRAFTimer(e=>{this.playGame(e)});this.interval=n!=null?n:5*1e3,e.on("visible",r=>{this.visible=r})}start(e){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:e!=null?e:0}}),this.tracker("OpenGame",{duration:e!=null?e:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:e!=null?e:0}),this.timer.start()}close(e){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:e}}),this.tracker("CloseGame",{duration:e}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:e}),this.timer.stop()}createRAFTimer(e){let n=Date.now(),r,a,i=!1,o=0,s=()=>{if(!i)return;let f=Date.now(),w=f-n;w>=this.interval&&(this.visible&&(o+=Math.min(w,this.interval+1e3),e(o)),n=f),r=requestAnimationFrame(s)},l=()=>{_(),n=Date.now(),a=window.setInterval(()=>{if(!i)return;let f=Date.now();f-n>=this.interval&&(n=f)},this.interval)},d=()=>{h(),n=Date.now(),r=requestAnimationFrame(s)},_=()=>{r&&(cancelAnimationFrame(r),r=0)},h=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",f=>{i&&(console.log("visible",f),f?d():l())});let p=this.visible;return{start(){i||(i=!0,p?d():l())},stop(){i=!1,_(),h()}}}}});var $n,Fs=Z(()=>{"use strict";me();Js();xt();$n=class extends Vn{constructor(n,r,a){super(r,a);this.httpClient=Be.create();this.gameId=P.mpId,this.sessionId=P.sessionId,this.track=n}reporter(n){return I(this,null,function*(){let{event:r,params:a,extraParams:i}=n,o={eventType:r,gameInfo:j({gameId:this.gameId,sessionId:this.sessionId},a)};i&&Object.assign(o,i),yield this.httpClient.post("/api/base/app-event",{data:o})})}tracker(n,r=null){this.track(n,r)}}});var qs,vf,xe,gf,Ya,Ke,ct=Z(()=>{"use strict";Gs();q();q();$a();za();Fs();me();Va();qs=ge(),vf={type:Tt.WebSDK,platform:"h5",jssdk_version:P.sdkInfo.jssdkVersion,mp_id:P.mpId,mp_version:P.mpVersion},{track:xe,trackPerformance:gf}=Ns((...t)=>{var o,s,l,d;let[,e]=t,n=e,r=ls(n.extra)?n.extra:Oa(n.extra)?JSON.parse(n.extra):{},a=Oe(j({},r),{mp_id:(o=n.mp_id)!=null?o:"",mp_version:(s=n.mp_version)!=null?s:""}),i={name:e.tag,type:pt.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(d=(l=P.hostUserInfo)==null?void 0:l.uid)!=null?d:null};Hn.trackEvent(i,Tt.WebSDK)},vf);qs.registerCommand("ReportSDK.traceSystemTimeline",({event:t,duration:e,extra:n})=>{gf(t,e,n)});qs.registerCommand("ReportSDK.traceSystem",({event:t,info:e})=>{xe(t,e)});Ya=new Je,Ke=new $n(xe,Ya)});function js(t){let e=Da.config[t];return e||(e={},Da.config[t]=e),(n,r)=>{if(e[n]){Te.warn(`[can i use] ${n} already registered`);return}e[n]=j({},r)}}var Hs=Z(()=>{"use strict";q()});function Qa(t){Vs=t}function Kn(t){return t===null||typeof t!="object"?t:Array.isArray(t)?t.map(e=>Kn(e)):Object.keys(t).reduce((e,n)=>(e[n]=Kn(t[n]),e),{})}function We(t){return typeof t=="number"}function Xa(t){let e=Za(t);switch(e){case"string":return`"${t}"`;case"number":case"boolean":case"null":case"undefined":return String(t);default:return`a(n) ${e}`}}function Za(t){return typeof t=="function"?"function":Object.prototype.toString.call(t).slice(8).slice(0,-1).toLowerCase()}var Vs,ue,Wn,zn,Yn,Qn,Dt,Xn,Zn,er,tr,nr,rr,ar,ir,or,sr,lr,cr,ei=Z(()=>{"use strict";Vs=!1;ue=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(e){if(Vs)if(typeof e=="string")this.errors.push(e);else{let n=`${this.path} should be ${e.expect}`;this._optional&&e.expect!=="undefined"?n+=" or undefined, ":n+=", ",n+=`but got ${Xa(e.actual)}`,this.errors.push(n)}return!1}fallback(e){return this.hasFallback=!0,this._fallback=e,this}get fallbackValue(){return Kn(this._fallback)}default(e){return this.hasDefault=!0,this._default=e,this}get defaultValue(){return typeof this._default=="function"?this._default:Kn(this._default)}optional(){return this._optional=!0,this}};Wn=class extends ue{validate(e){return this._optional&&e===void 0?!0:We(e)?We(this._min)&&e<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):We(this._max)&&e>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):We(this._greater)&&e<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&e!==Math.floor(e)?this.fail(`the value of ${this.path} should be integer but got ${e}`):!0:this.fail({expect:"number",actual:e})}min(e){return this._min=e,this}max(e){return this._max=e,this}isInt(e){return this._isInt=e,this}greater(e){return this._greater=e,this}},zn=class extends ue{validate(e){return this._optional&&e===void 0?!0:typeof e!="boolean"?this.fail({expect:"boolean",actual:e}):!0}},Yn=class extends ue{validate(e){if(this._optional&&e===void 0)return!0;if(typeof e!="string")return this.fail({expect:"string",actual:e});if(We(this._maxLength)&&e.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(We(this._minLength)&&e.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(e))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(e))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(e){return this._minLength=e,this}maxLength(e){return this._maxLength=e,this}pattern(e){return this._pattern=e,this}},Qn=class extends ue{validate(e){return this._optional&&e===void 0?!0:typeof e!="symbol"?this.fail({expect:"symbol",actual:e}):!0}},Dt=class extends ue{validate(e){return!0}},Xn=class extends ue{validate(e){return e!==void 0?this.fail({expect:"undefined",actual:e}):!0}},Zn=class extends ue{validate(e){return this._optional&&e===void 0?!0:e!==null?this.fail({expect:"null",actual:e}):!0}},er=class extends ue{validate(e){return this._optional&&e===void 0?!0:typeof e!="function"?this.fail({expect:"function",actual:e}):!0}},tr=class extends ue{constructor(...e){super(),this._items=e}validate(e){if(this._optional&&e===void 0)return!0;if(!this._items.includes(e)){let n=this._items.map(r=>JSON.stringify(r)).join(", ");return this.fail(`expect ${this.path} to be one of ${n}, but got ${Xa(e)}`)}return!0}},nr=class extends ue{constructor(n){super();this._item=n}validate(n){if(this._optional&&n===void 0)return!0;if(!Array.isArray(n))return this.fail({expect:"array",actual:n});if(We(this._minItems)&&n.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(We(this._maxItems)&&n.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(We(this._length)&&n.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let r=this._item;if(!r)return!0;let a=!0;if(n.forEach((i,o)=>{if(r.path=`${this.path}[${o}]`,r.errors=this.errors,i===void 0&&r.hasDefault){n[o]=r.defaultValue;return}r.validate(i)||(r.hasFallback?n[o]=r.fallbackValue:a=!1)}),this._uniqueItems){let i=new Map;for(let o in n)i.has(n[o])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${i.get(n[o])}] and ${this.path}[${o}] are identical)`):i.set(n[o],o)}return a}minItems(n){return this._minItems=n,this}maxItems(n){return this._maxItems=n,this}uniqueItems(){return this._uniqueItems=!0,this}length(n){return this._length=n,this}},rr=class extends ue{constructor(n){super();this._value=n}validate(n){if(this._optional&&n===void 0)return!0;if(Za(n)!=="object")return this.fail({expect:"object",actual:n});let a=n,i=this._value;i.errors=this.errors;let o=!0;for(let s in a){let l=a[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?i.path=`${this.path}.${s}`:i.path=`${this.path}["${s}"]`,!(l===void 0&&i._optional)){if(l===void 0&&i.hasDefault){a[s]=i.defaultValue;continue}i.validate(l)||(i.hasFallback?a[s]=i.fallbackValue:o=!1)}}return o}},ar=class extends ue{constructor(n={}){super();this._object=n}validate(n){if(this._optional&&n===void 0)return!0;if(Za(n)!=="object")return this.fail({expect:"object",actual:n});let r=n,a=!0;for(let i in this._object){let o=r[i],s=this._object[i];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(i)?s.path=`${this.path}.${i}`:s.path=`${this.path}["${i}"]`,!(s._optional&&o===void 0)){if(o===void 0&&s.hasDefault){r[i]=s.defaultValue;continue}s.validate(o)||(s.hasFallback?r[i]=s.fallbackValue:a=!1)}}return a}},ir=class extends ue{constructor(n){super();this.value=n}validate(n){return n===void 0&&this._optional?!0:n!==this.value?this.fail({expect:Xa(this.value),actual:n}):!0}},or=class extends ue{constructor(...e){super(),this._items=e}validate(e){if(e===void 0&&this._optional)return!0;let n=[],r=!1,a=this._items.length;for(let i=0;i<a;i++){let o=this._items[i];if(o.errors=[],o.path=this.path,!o.validate(e))n.push(o.errors.join("; "));else if(!r){r=!0;break}}if(!r){let i=n.join(`
2
+ or `);this.errors.push(i)}return r}},sr=class extends ue{constructor(...e){super(),this._items=e;let n=0,r=e.length-1;for(;r>=0;r--){let a=e[r];if(a._optional||a.hasDefault)n+=1;else break}this._minItems=e.length-n}validate(e){if(e===void 0&&this._optional)return!0;if(!Array.isArray(e))return this.fail({expect:"array",actual:e});if(e.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let n=!0;return this._items.forEach((r,a)=>{if(r.path=`${this.path}[${a}]`,r.errors=this.errors,e[a]===void 0&&r.hasDefault){e[a]=r.defaultValue;return}r.validate(e[a])||(r.hasFallback?e[a]=r._fallback:n=!1)}),n}},lr=class extends ue{validate(e){return e===void 0&&this._optional||e instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:e})}},cr=class extends ue{constructor(e){super(),this._ctor=e}validate(e){return e===void 0&&this._optional||e instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:e})}}});function ti(t,e,n="param"){if(t.errors=[],t.path=n,Qa(!0),!t.validate(e)){let r=t.errors.join(`
3
+ `);throw t.errors.length=0,Qa(!1),new TypeError(r)}}var G,ni=Z(()=>{"use strict";ei();ei();G={object(t){return new ar(t)},array(t){return new nr(t)},tuple(...t){return new sr(...t)},literal(t){return new ir(t)},or(...t){return new or(...t)},symbol(){return new Qn},record(t){return new rr(t)},function(){return new er},boolean(){return new zn},string(){return new Yn},number(){return new Wn},undefined(){return new Xn},null(){return new Zn},unknown(){return new Dt},any(){return new Dt},as(){return new Dt},arraybuffer(){return new lr},enum(...t){return new tr(...t)},typedarray(t){return new cr(t)}}});var ur,$s,Ks=Z(()=>{"use strict";q();Ve();ni();Ha();ur=1,$s=t=>{function e(r,a){return(...i)=>{var h,p,f,w;let o=Date.now(),s={method:r,trace_id:ur};ur+=1;let l="SUCCESS",d=`${r}:ok`,_=0;try{if(a.paramsSchema)try{ti(a.paramsSchema,i,"params")}catch(x){throw ja(`${r}:fail ${x.message}`)}let A=a.implement(...i),R=A,b=`${r}:ok`;if(A&&"code"in A){let{code:x,data:L,message:F}=A;l=x,R=L,b=F}return{code:l,message:b,data:R}}catch(A){let R=A;_=(p=(h=R.code)!=null?h:R.errNo)!=null?p:2e3,l="FAILURE";let b=(w=(f=R.message)!=null?f:R.errMsg)!=null?w:`${A}`;return d=`${r}:${l} ${b.replace(/^\S+:(fail|cancel)\s?/,"")}`,ke(new Jn(d,_)),{code:l,message:d}}finally{let A=Date.now()-o}}}function n(r,a){return(...i)=>I(this,null,function*(){var p,f,w,A;let o=cs(i)?i:[i],s=Date.now(),l={method:r,trace_id:ur};ur+=1;let d=`${r}:ok`,_="SUCCESS",h={code:_,message:d};try{if(a.paramsSchema)try{ti(a.paramsSchema,o,"params")}catch(x){throw ja(x.message)}let b=yield a.implement(...o);if(b&&"code"in b){let{code:x,data:L,message:F}=b;_=x,d=F,b=L}return Object.assign(h,{code:_,message:d,data:b}),h}catch(R){let b=R,x=(f=(p=b.code)!=null?p:b.errNo)!=null?f:2e3;_="FAILURE";let L=(A=(w=b.message)!=null?w:b.errMsg)!=null?A:`${R}`,F=`${r}:${_} ${L.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(h,{code:_,message:F}),ke(new Jn(F,x)),h}finally{let R=Date.now()-s}})}return{createAPI:n,createSyncAPI:e}}});var ze,gt,_e,an=Z(()=>{"use strict";Hs();ct();Ks();ni();({createAPI:ze,createSyncAPI:gt}=$s(xe)),_e=js("h5")});var Qs=ya((Ys,oi)=>{(function(t){if(typeof Ys=="object"&&typeof oi!="undefined")oi.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=t()}})(function(){var t,e,n;return function r(a,i,o){function s(_,h){if(!i[_]){if(!a[_]){var p=typeof Zt=="function"&&Zt;if(!h&&p)return p(_,!0);if(l)return l(_,!0);var f=new Error("Cannot find module '"+_+"'");throw f.code="MODULE_NOT_FOUND",f}var w=i[_]={exports:{}};a[_][0].call(w.exports,function(A){var R=a[_][1][A];return s(R||A)},w,w.exports,r,a,i,o)}return i[_].exports}for(var l=typeof Zt=="function"&&Zt,d=0;d<o.length;d++)s(o[d]);return s}({1:[function(r,a,i){(function(o){"use strict";var s=o.MutationObserver||o.WebKitMutationObserver,l;if(s){var d=0,_=new s(A),h=o.document.createTextNode("");_.observe(h,{characterData:!0}),l=function(){h.data=d=++d%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var p=new o.MessageChannel;p.port1.onmessage=A,l=function(){p.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var b=o.document.createElement("script");b.onreadystatechange=function(){A(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},o.document.documentElement.appendChild(b)}:l=function(){setTimeout(A,0)};var f,w=[];function A(){f=!0;for(var b,x,L=w.length;L;){for(x=w,w=[],b=-1;++b<L;)x[b]();L=w.length}f=!1}a.exports=R;function R(b){w.push(b)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(r,a,i){"use strict";var o=r(1);function s(){}var l={},d=["REJECTED"],_=["FULFILLED"],h=["PENDING"];a.exports=p;function p(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,S!==s&&R(this,S)}p.prototype.catch=function(S){return this.then(null,S)},p.prototype.then=function(S,N){if(typeof S!="function"&&this.state===_||typeof N!="function"&&this.state===d)return this;var k=new this.constructor(s);if(this.state!==h){var M=this.state===_?S:N;w(k,M,this.outcome)}else this.queue.push(new f(k,S,N));return k};function f(S,N,k){this.promise=S,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},f.prototype.otherCallFulfilled=function(S){w(this.promise,this.onFulfilled,S)},f.prototype.callRejected=function(S){l.reject(this.promise,S)},f.prototype.otherCallRejected=function(S){w(this.promise,this.onRejected,S)};function w(S,N,k){o(function(){var M;try{M=N(k)}catch(W){return l.reject(S,W)}M===S?l.reject(S,new TypeError("Cannot resolve promise with itself")):l.resolve(S,M)})}l.resolve=function(S,N){var k=b(A,N);if(k.status==="error")return l.reject(S,k.value);var M=k.value;if(M)R(S,M);else{S.state=_,S.outcome=N;for(var W=-1,z=S.queue.length;++W<z;)S.queue[W].callFulfilled(N)}return S},l.reject=function(S,N){S.state=d,S.outcome=N;for(var k=-1,M=S.queue.length;++k<M;)S.queue[k].callRejected(N);return S};function A(S){var N=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof N=="function")return function(){N.apply(S,arguments)}}function R(S,N){var k=!1;function M(he){k||(k=!0,l.reject(S,he))}function W(he){k||(k=!0,l.resolve(S,he))}function z(){N(W,M)}var ee=b(z);ee.status==="error"&&M(ee.value)}function b(S,N){var k={};try{k.value=S(N),k.status="success"}catch(M){k.status="error",k.value=M}return k}p.resolve=x;function x(S){return S instanceof this?S:l.resolve(new this(s),S)}p.reject=L;function L(S){var N=new this(s);return l.reject(N,S)}p.all=F;function F(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=S.length,M=!1;if(!k)return this.resolve([]);for(var W=new Array(k),z=0,ee=-1,he=new this(s);++ee<k;)je(S[ee],ee);return he;function je(Yt,Pn){N.resolve(Yt).then(sa,function(St){M||(M=!0,l.reject(he,St))});function sa(St){W[Pn]=St,++z===k&&!M&&(M=!0,l.resolve(he,W))}}}p.race=H;function H(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=S.length,M=!1;if(!k)return this.resolve([]);for(var W=-1,z=new this(s);++W<k;)ee(S[W]);return z;function ee(he){N.resolve(he).then(function(je){M||(M=!0,l.resolve(z,je))},function(je){M||(M=!0,l.reject(z,je))})}}},{1:1}],3:[function(r,a,i){(function(o){"use strict";typeof o.Promise!="function"&&(o.Promise=r(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(r,a,i){"use strict";var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c};function s(c,m){if(!(c instanceof m))throw new TypeError("Cannot call a class as a function")}function l(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(c){return}}var d=l();function _(){try{if(!d||!d.open)return!1;var c=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!c||m)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(u){return!1}}function h(c,m){c=c||[],m=m||{};try{return new Blob(c,m)}catch(v){if(v.name!=="TypeError")throw v;for(var u=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,g=new u,y=0;y<c.length;y+=1)g.append(c[y]);return g.getBlob(m.type)}}typeof Promise=="undefined"&&r(3);var p=Promise;function f(c,m){m&&c.then(function(u){m(null,u)},function(u){m(u)})}function w(c,m,u){typeof m=="function"&&c.then(m),typeof u=="function"&&c.catch(u)}function A(c){return typeof c!="string"&&(console.warn(c+" used as a key, but it is not a string."),c=String(c)),c}function R(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var b="local-forage-detect-blob-support",x=void 0,L={},F=Object.prototype.toString,H="readonly",S="readwrite";function N(c){for(var m=c.length,u=new ArrayBuffer(m),g=new Uint8Array(u),y=0;y<m;y++)g[y]=c.charCodeAt(y);return u}function k(c){return new p(function(m){var u=c.transaction(b,S),g=h([""]);u.objectStore(b).put(g,"key"),u.onabort=function(y){y.preventDefault(),y.stopPropagation(),m(!1)},u.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),v=navigator.userAgent.match(/Edge\//);m(v||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function M(c){return typeof x=="boolean"?p.resolve(x):k(c).then(function(m){return x=m,x})}function W(c){var m=L[c.name],u={};u.promise=new p(function(g,y){u.resolve=g,u.reject=y}),m.deferredOperations.push(u),m.dbReady?m.dbReady=m.dbReady.then(function(){return u.promise}):m.dbReady=u.promise}function z(c){var m=L[c.name],u=m.deferredOperations.pop();if(u)return u.resolve(),u.promise}function ee(c,m){var u=L[c.name],g=u.deferredOperations.pop();if(g)return g.reject(m),g.promise}function he(c,m){return new p(function(u,g){if(L[c.name]=L[c.name]||ko(),c.db)if(m)W(c),c.db.close();else return u(c.db);var y=[c.name];m&&y.push(c.version);var v=d.open.apply(d,y);m&&(v.onupgradeneeded=function(E){var C=v.result;try{C.createObjectStore(c.storeName),E.oldVersion<=1&&C.createObjectStore(b)}catch(O){if(O.name==="ConstraintError")console.warn('The database "'+c.name+'" has been upgraded from version '+E.oldVersion+" to version "+E.newVersion+', but the storage "'+c.storeName+'" already exists.');else throw O}}),v.onerror=function(E){E.preventDefault(),g(v.error)},v.onsuccess=function(){var E=v.result;E.onversionchange=function(C){C.target.close()},u(E),z(c)}})}function je(c){return he(c,!1)}function Yt(c){return he(c,!0)}function Pn(c,m){if(!c.db)return!0;var u=!c.db.objectStoreNames.contains(c.storeName),g=c.version<c.db.version,y=c.version>c.db.version;if(g&&(c.version!==m&&console.warn('The database "'+c.name+`" can't be downgraded from version `+c.db.version+" to version "+c.version+"."),c.version=c.db.version),y||u){if(u){var v=c.db.version+1;v>c.version&&(c.version=v)}return!0}return!1}function sa(c){return new p(function(m,u){var g=new FileReader;g.onerror=u,g.onloadend=function(y){var v=btoa(y.target.result||"");m({__local_forage_encoded_blob:!0,data:v,type:c.type})},g.readAsBinaryString(c)})}function St(c){var m=N(atob(c.data));return h([m],{type:c.type})}function To(c){return c&&c.__local_forage_encoded_blob}function vu(c){var m=this,u=m._initReady().then(function(){var g=L[m._dbInfo.name];if(g&&g.dbReady)return g.dbReady});return w(u,c,c),u}function gu(c){W(c);for(var m=L[c.name],u=m.forages,g=0;g<u.length;g++){var y=u[g];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return c.db=null,je(c).then(function(v){return c.db=v,Pn(c)?Yt(c):v}).then(function(v){c.db=m.db=v;for(var E=0;E<u.length;E++)u[E]._dbInfo.db=v}).catch(function(v){throw ee(c,v),v})}function He(c,m,u,g){g===void 0&&(g=1);try{var y=c.db.transaction(c.storeName,m);u(null,y)}catch(v){if(g>0&&(!c.db||v.name==="InvalidStateError"||v.name==="NotFoundError"))return p.resolve().then(function(){if(!c.db||v.name==="NotFoundError"&&!c.db.objectStoreNames.contains(c.storeName)&&c.version<=c.db.version)return c.db&&(c.version=c.db.version+1),Yt(c)}).then(function(){return gu(c).then(function(){He(c,m,u,g-1)})}).catch(u);u(v)}}function ko(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function _u(c){var m=this,u={db:null};if(c)for(var g in c)u[g]=c[g];var y=L[u.name];y||(y=ko(),L[u.name]=y),y.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=vu);var v=[];function E(){return p.resolve()}for(var C=0;C<y.forages.length;C++){var O=y.forages[C];O!==m&&v.push(O._initReady().catch(E))}var T=y.forages.slice(0);return p.all(v).then(function(){return u.db=y.db,je(u)}).then(function(D){return u.db=D,Pn(u,m._defaultConfig.version)?Yt(u):D}).then(function(D){u.db=y.db=D,m._dbInfo=u;for(var U=0;U<T.length;U++){var J=T[U];J!==m&&(J._dbInfo.db=u.db,J._dbInfo.version=u.version)}})}function yu(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){He(u._dbInfo,H,function(E,C){if(E)return v(E);try{var O=C.objectStore(u._dbInfo.storeName),T=O.get(c);T.onsuccess=function(){var D=T.result;D===void 0&&(D=null),To(D)&&(D=St(D)),y(D)},T.onerror=function(){v(T.error)}}catch(D){v(D)}})}).catch(v)});return f(g,m),g}function wu(c,m){var u=this,g=new p(function(y,v){u.ready().then(function(){He(u._dbInfo,H,function(E,C){if(E)return v(E);try{var O=C.objectStore(u._dbInfo.storeName),T=O.openCursor(),D=1;T.onsuccess=function(){var U=T.result;if(U){var J=U.value;To(J)&&(J=St(J));var K=c(J,U.key,D++);K!==void 0?y(K):U.continue()}else y()},T.onerror=function(){v(T.error)}}catch(U){v(U)}})}).catch(v)});return f(g,m),g}function bu(c,m,u){var g=this;c=A(c);var y=new p(function(v,E){var C;g.ready().then(function(){return C=g._dbInfo,F.call(m)==="[object Blob]"?M(C.db).then(function(O){return O?m:sa(m)}):m}).then(function(O){He(g._dbInfo,S,function(T,D){if(T)return E(T);try{var U=D.objectStore(g._dbInfo.storeName);O===null&&(O=void 0);var J=U.put(O,c);D.oncomplete=function(){O===void 0&&(O=null),v(O)},D.onabort=D.onerror=function(){var K=J.error?J.error:J.transaction.error;E(K)}}catch(K){E(K)}})}).catch(E)});return f(y,u),y}function Eu(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){He(u._dbInfo,S,function(E,C){if(E)return v(E);try{var O=C.objectStore(u._dbInfo.storeName),T=O.delete(c);C.oncomplete=function(){y()},C.onerror=function(){v(T.error)},C.onabort=function(){var D=T.error?T.error:T.transaction.error;v(D)}}catch(D){v(D)}})}).catch(v)});return f(g,m),g}function Iu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){He(m._dbInfo,S,function(v,E){if(v)return y(v);try{var C=E.objectStore(m._dbInfo.storeName),O=C.clear();E.oncomplete=function(){g()},E.onabort=E.onerror=function(){var T=O.error?O.error:O.transaction.error;y(T)}}catch(T){y(T)}})}).catch(y)});return f(u,c),u}function Au(c){var m=this,u=new p(function(g,y){m.ready().then(function(){He(m._dbInfo,H,function(v,E){if(v)return y(v);try{var C=E.objectStore(m._dbInfo.storeName),O=C.count();O.onsuccess=function(){g(O.result)},O.onerror=function(){y(O.error)}}catch(T){y(T)}})}).catch(y)});return f(u,c),u}function Cu(c,m){var u=this,g=new p(function(y,v){if(c<0){y(null);return}u.ready().then(function(){He(u._dbInfo,H,function(E,C){if(E)return v(E);try{var O=C.objectStore(u._dbInfo.storeName),T=!1,D=O.openKeyCursor();D.onsuccess=function(){var U=D.result;if(!U){y(null);return}c===0||T?y(U.key):(T=!0,U.advance(c))},D.onerror=function(){v(D.error)}}catch(U){v(U)}})}).catch(v)});return f(g,m),g}function Su(c){var m=this,u=new p(function(g,y){m.ready().then(function(){He(m._dbInfo,H,function(v,E){if(v)return y(v);try{var C=E.objectStore(m._dbInfo.storeName),O=C.openKeyCursor(),T=[];O.onsuccess=function(){var D=O.result;if(!D){g(T);return}T.push(D.key),D.continue()},O.onerror=function(){y(O.error)}}catch(D){y(D)}})}).catch(y)});return f(u,c),u}function Ru(c,m){m=R.apply(this,arguments);var u=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||u.name,c.storeName=c.storeName||u.storeName);var g=this,y;if(!c.name)y=p.reject("Invalid arguments");else{var v=c.name===u.name&&g._dbInfo.db,E=v?p.resolve(g._dbInfo.db):je(c).then(function(C){var O=L[c.name],T=O.forages;O.db=C;for(var D=0;D<T.length;D++)T[D]._dbInfo.db=C;return C});c.storeName?y=E.then(function(C){if(C.objectStoreNames.contains(c.storeName)){var O=C.version+1;W(c);var T=L[c.name],D=T.forages;C.close();for(var U=0;U<D.length;U++){var J=D[U];J._dbInfo.db=null,J._dbInfo.version=O}var K=new p(function(Y,ce){var oe=d.open(c.name,O);oe.onerror=function(Ne){var Xt=oe.result;Xt.close(),ce(Ne)},oe.onupgradeneeded=function(){var Ne=oe.result;Ne.deleteObjectStore(c.storeName)},oe.onsuccess=function(){var Ne=oe.result;Ne.close(),Y(Ne)}});return K.then(function(Y){T.db=Y;for(var ce=0;ce<D.length;ce++){var oe=D[ce];oe._dbInfo.db=Y,z(oe._dbInfo)}}).catch(function(Y){throw(ee(c,Y)||p.resolve()).catch(function(){}),Y})}}):y=E.then(function(C){W(c);var O=L[c.name],T=O.forages;C.close();for(var D=0;D<T.length;D++){var U=T[D];U._dbInfo.db=null}var J=new p(function(K,Y){var ce=d.deleteDatabase(c.name);ce.onerror=function(){var oe=ce.result;oe&&oe.close(),Y(ce.error)},ce.onblocked=function(){console.warn('dropInstance blocked for database "'+c.name+'" until all open connections are closed')},ce.onsuccess=function(){var oe=ce.result;oe&&oe.close(),K(oe)}});return J.then(function(K){O.db=K;for(var Y=0;Y<T.length;Y++){var ce=T[Y];z(ce._dbInfo)}}).catch(function(K){throw(ee(c,K)||p.resolve()).catch(function(){}),K})})}return f(y,m),y}var Ou={_driver:"asyncStorage",_initStorage:_u,_support:_(),iterate:wu,getItem:yu,setItem:bu,removeItem:Eu,clear:Iu,length:Au,key:Cu,keys:Su,dropInstance:Ru};function Tu(){return typeof openDatabase=="function"}var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ku="~~local_forage_type~",xo=/^~~local_forage_type~([^~]+)~/,Ln="__lfsc__:",la=Ln.length,ca="arbf",ua="blob",Do="si08",Po="ui08",Lo="uic8",No="si16",Uo="si32",Mo="ur16",Bo="ui32",Go="fl32",Jo="fl64",Fo=la+ca.length,qo=Object.prototype.toString;function jo(c){var m=c.length*.75,u=c.length,g,y=0,v,E,C,O;c[c.length-1]==="="&&(m--,c[c.length-2]==="="&&m--);var T=new ArrayBuffer(m),D=new Uint8Array(T);for(g=0;g<u;g+=4)v=it.indexOf(c[g]),E=it.indexOf(c[g+1]),C=it.indexOf(c[g+2]),O=it.indexOf(c[g+3]),D[y++]=v<<2|E>>4,D[y++]=(E&15)<<4|C>>2,D[y++]=(C&3)<<6|O&63;return T}function da(c){var m=new Uint8Array(c),u="",g;for(g=0;g<m.length;g+=3)u+=it[m[g]>>2],u+=it[(m[g]&3)<<4|m[g+1]>>4],u+=it[(m[g+1]&15)<<2|m[g+2]>>6],u+=it[m[g+2]&63];return m.length%3===2?u=u.substring(0,u.length-1)+"=":m.length%3===1&&(u=u.substring(0,u.length-2)+"=="),u}function xu(c,m){var u="";if(c&&(u=qo.call(c)),c&&(u==="[object ArrayBuffer]"||c.buffer&&qo.call(c.buffer)==="[object ArrayBuffer]")){var g,y=Ln;c instanceof ArrayBuffer?(g=c,y+=ca):(g=c.buffer,u==="[object Int8Array]"?y+=Do:u==="[object Uint8Array]"?y+=Po:u==="[object Uint8ClampedArray]"?y+=Lo:u==="[object Int16Array]"?y+=No:u==="[object Uint16Array]"?y+=Mo:u==="[object Int32Array]"?y+=Uo:u==="[object Uint32Array]"?y+=Bo:u==="[object Float32Array]"?y+=Go:u==="[object Float64Array]"?y+=Jo:m(new Error("Failed to get type for BinaryArray"))),m(y+da(g))}else if(u==="[object Blob]"){var v=new FileReader;v.onload=function(){var E=ku+c.type+"~"+da(this.result);m(Ln+ua+E)},v.readAsArrayBuffer(c)}else try{m(JSON.stringify(c))}catch(E){console.error("Couldn't convert value into a JSON string: ",c),m(null,E)}}function Du(c){if(c.substring(0,la)!==Ln)return JSON.parse(c);var m=c.substring(Fo),u=c.substring(la,Fo),g;if(u===ua&&xo.test(m)){var y=m.match(xo);g=y[1],m=m.substring(y[0].length)}var v=jo(m);switch(u){case ca:return v;case ua:return h([v],{type:g});case Do:return new Int8Array(v);case Po:return new Uint8Array(v);case Lo:return new Uint8ClampedArray(v);case No:return new Int16Array(v);case Mo:return new Uint16Array(v);case Uo:return new Int32Array(v);case Bo:return new Uint32Array(v);case Go:return new Float32Array(v);case Jo:return new Float64Array(v);default:throw new Error("Unkown type: "+u)}}var fa={serialize:xu,deserialize:Du,stringToBuffer:jo,bufferToString:da};function Ho(c,m,u,g){c.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],u,g)}function Pu(c){var m=this,u={db:null};if(c)for(var g in c)u[g]=typeof c[g]!="string"?c[g].toString():c[g];var y=new p(function(v,E){try{u.db=openDatabase(u.name,String(u.version),u.description,u.size)}catch(C){return E(C)}u.db.transaction(function(C){Ho(C,u,function(){m._dbInfo=u,v()},function(O,T){E(T)})},E)});return u.serializer=fa,y}function ot(c,m,u,g,y,v){c.executeSql(u,g,y,function(E,C){C.code===C.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(O,T){T.rows.length?v(O,C):Ho(O,m,function(){O.executeSql(u,g,y,v)},v)},v):v(E,C)},v)}function Lu(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(C){ot(C,E,"SELECT * FROM "+E.storeName+" WHERE key = ? LIMIT 1",[c],function(O,T){var D=T.rows.length?T.rows.item(0).value:null;D&&(D=E.serializer.deserialize(D)),y(D)},function(O,T){v(T)})})}).catch(v)});return f(g,m),g}function Nu(c,m){var u=this,g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(C){ot(C,E,"SELECT * FROM "+E.storeName,[],function(O,T){for(var D=T.rows,U=D.length,J=0;J<U;J++){var K=D.item(J),Y=K.value;if(Y&&(Y=E.serializer.deserialize(Y)),Y=c(Y,K.key,J+1),Y!==void 0){y(Y);return}}y()},function(O,T){v(T)})})}).catch(v)});return f(g,m),g}function Vo(c,m,u,g){var y=this;c=A(c);var v=new p(function(E,C){y.ready().then(function(){m===void 0&&(m=null);var O=m,T=y._dbInfo;T.serializer.serialize(m,function(D,U){U?C(U):T.db.transaction(function(J){ot(J,T,"INSERT OR REPLACE INTO "+T.storeName+" (key, value) VALUES (?, ?)",[c,D],function(){E(O)},function(K,Y){C(Y)})},function(J){if(J.code===J.QUOTA_ERR){if(g>0){E(Vo.apply(y,[c,O,u,g-1]));return}C(J)}})})}).catch(C)});return f(v,u),v}function Uu(c,m,u){return Vo.apply(this,[c,m,u,1])}function Mu(c,m){var u=this;c=A(c);var g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(C){ot(C,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[c],function(){y()},function(O,T){v(T)})})}).catch(v)});return f(g,m),g}function Bu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(E){ot(E,v,"DELETE FROM "+v.storeName,[],function(){g()},function(C,O){y(O)})})}).catch(y)});return f(u,c),u}function Gu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(E){ot(E,v,"SELECT COUNT(key) as c FROM "+v.storeName,[],function(C,O){var T=O.rows.item(0).c;g(T)},function(C,O){y(O)})})}).catch(y)});return f(u,c),u}function Ju(c,m){var u=this,g=new p(function(y,v){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(C){ot(C,E,"SELECT key FROM "+E.storeName+" WHERE id = ? LIMIT 1",[c+1],function(O,T){var D=T.rows.length?T.rows.item(0).key:null;y(D)},function(O,T){v(T)})})}).catch(v)});return f(g,m),g}function Fu(c){var m=this,u=new p(function(g,y){m.ready().then(function(){var v=m._dbInfo;v.db.transaction(function(E){ot(E,v,"SELECT key FROM "+v.storeName,[],function(C,O){for(var T=[],D=0;D<O.rows.length;D++)T.push(O.rows.item(D).key);g(T)},function(C,O){y(O)})})}).catch(y)});return f(u,c),u}function qu(c){return new p(function(m,u){c.transaction(function(g){g.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,v){for(var E=[],C=0;C<v.rows.length;C++)E.push(v.rows.item(C).name);m({db:c,storeNames:E})},function(y,v){u(v)})},function(g){u(g)})})}function ju(c,m){m=R.apply(this,arguments);var u=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||u.name,c.storeName=c.storeName||u.storeName);var g=this,y;return c.name?y=new p(function(v){var E;c.name===u.name?E=g._dbInfo.db:E=openDatabase(c.name,"","",0),c.storeName?v({db:E,storeNames:[c.storeName]}):v(qu(E))}).then(function(v){return new p(function(E,C){v.db.transaction(function(O){function T(K){return new p(function(Y,ce){O.executeSql("DROP TABLE IF EXISTS "+K,[],function(){Y()},function(oe,Ne){ce(Ne)})})}for(var D=[],U=0,J=v.storeNames.length;U<J;U++)D.push(T(v.storeNames[U]));p.all(D).then(function(){E()}).catch(function(K){C(K)})},function(O){C(O)})})}):y=p.reject("Invalid arguments"),f(y,m),y}var Hu={_driver:"webSQLStorage",_initStorage:Pu,_support:Tu(),iterate:Nu,getItem:Lu,setItem:Uu,removeItem:Mu,clear:Bu,length:Gu,key:Ju,keys:Fu,dropInstance:ju};function Vu(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(c){return!1}}function $o(c,m){var u=c.name+"/";return c.storeName!==m.storeName&&(u+=c.storeName+"/"),u}function $u(){var c="_localforage_support_test";try{return localStorage.setItem(c,!0),localStorage.removeItem(c),!1}catch(m){return!0}}function Ku(){return!$u()||localStorage.length>0}function Wu(c){var m=this,u={};if(c)for(var g in c)u[g]=c[g];return u.keyPrefix=$o(c,m._defaultConfig),Ku()?(m._dbInfo=u,u.serializer=fa,p.resolve()):p.reject()}function zu(c){var m=this,u=m.ready().then(function(){for(var g=m._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var v=localStorage.key(y);v.indexOf(g)===0&&localStorage.removeItem(v)}});return f(u,c),u}function Yu(c,m){var u=this;c=A(c);var g=u.ready().then(function(){var y=u._dbInfo,v=localStorage.getItem(y.keyPrefix+c);return v&&(v=y.serializer.deserialize(v)),v});return f(g,m),g}function Qu(c,m){var u=this,g=u.ready().then(function(){for(var y=u._dbInfo,v=y.keyPrefix,E=v.length,C=localStorage.length,O=1,T=0;T<C;T++){var D=localStorage.key(T);if(D.indexOf(v)===0){var U=localStorage.getItem(D);if(U&&(U=y.serializer.deserialize(U)),U=c(U,D.substring(E),O++),U!==void 0)return U}}});return f(g,m),g}function Xu(c,m){var u=this,g=u.ready().then(function(){var y=u._dbInfo,v;try{v=localStorage.key(c)}catch(E){v=null}return v&&(v=v.substring(y.keyPrefix.length)),v});return f(g,m),g}function Zu(c){var m=this,u=m.ready().then(function(){for(var g=m._dbInfo,y=localStorage.length,v=[],E=0;E<y;E++){var C=localStorage.key(E);C.indexOf(g.keyPrefix)===0&&v.push(C.substring(g.keyPrefix.length))}return v});return f(u,c),u}function ed(c){var m=this,u=m.keys().then(function(g){return g.length});return f(u,c),u}function td(c,m){var u=this;c=A(c);var g=u.ready().then(function(){var y=u._dbInfo;localStorage.removeItem(y.keyPrefix+c)});return f(g,m),g}function nd(c,m,u){var g=this;c=A(c);var y=g.ready().then(function(){m===void 0&&(m=null);var v=m;return new p(function(E,C){var O=g._dbInfo;O.serializer.serialize(m,function(T,D){if(D)C(D);else try{localStorage.setItem(O.keyPrefix+c,T),E(v)}catch(U){(U.name==="QuotaExceededError"||U.name==="NS_ERROR_DOM_QUOTA_REACHED")&&C(U),C(U)}})})});return f(y,u),y}function rd(c,m){if(m=R.apply(this,arguments),c=typeof c!="function"&&c||{},!c.name){var u=this.config();c.name=c.name||u.name,c.storeName=c.storeName||u.storeName}var g=this,y;return c.name?y=new p(function(v){c.storeName?v($o(c,g._defaultConfig)):v(c.name+"/")}).then(function(v){for(var E=localStorage.length-1;E>=0;E--){var C=localStorage.key(E);C.indexOf(v)===0&&localStorage.removeItem(C)}}):y=p.reject("Invalid arguments"),f(y,m),y}var ad={_driver:"localStorageWrapper",_initStorage:Wu,_support:Vu(),iterate:Qu,getItem:Yu,setItem:nd,removeItem:td,clear:zu,length:ed,key:Xu,keys:Zu,dropInstance:rd},id=function(m,u){return m===u||typeof m=="number"&&typeof u=="number"&&isNaN(m)&&isNaN(u)},od=function(m,u){for(var g=m.length,y=0;y<g;){if(id(m[y],u))return!0;y++}return!1},Ko=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},Qt={},Wo={},Rt={INDEXEDDB:Ou,WEBSQL:Hu,LOCALSTORAGE:ad},sd=[Rt.INDEXEDDB._driver,Rt.WEBSQL._driver,Rt.LOCALSTORAGE._driver],Nn=["dropInstance"],ha=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Nn),ld={description:"",driver:sd.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function cd(c,m){c[m]=function(){var u=arguments;return c.ready().then(function(){return c[m].apply(c,u)})}}function ma(){for(var c=1;c<arguments.length;c++){var m=arguments[c];if(m)for(var u in m)m.hasOwnProperty(u)&&(Ko(m[u])?arguments[0][u]=m[u].slice():arguments[0][u]=m[u])}return arguments[0]}var ud=function(){function c(m){s(this,c);for(var u in Rt)if(Rt.hasOwnProperty(u)){var g=Rt[u],y=g._driver;this[u]=y,Qt[y]||this.defineDriver(g)}this._defaultConfig=ma({},ld),this._config=ma({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return c.prototype.config=function(u){if((typeof u=="undefined"?"undefined":o(u))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var g in u){if(g==="storeName"&&(u[g]=u[g].replace(/\W/g,"_")),g==="version"&&typeof u[g]!="number")return new Error("Database version must be a number.");this._config[g]=u[g]}return"driver"in u&&u.driver?this.setDriver(this._config.driver):!0}else return typeof u=="string"?this._config[u]:this._config},c.prototype.defineDriver=function(u,g,y){var v=new p(function(E,C){try{var O=u._driver,T=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver){C(T);return}for(var D=ha.concat("_initStorage"),U=0,J=D.length;U<J;U++){var K=D[U],Y=!od(Nn,K);if((Y||u[K])&&typeof u[K]!="function"){C(T);return}}var ce=function(){for(var Xt=function(hd){return function(){var md=new Error("Method "+hd+" is not implemented by the current driver"),zo=p.reject(md);return f(zo,arguments[arguments.length-1]),zo}},pa=0,fd=Nn.length;pa<fd;pa++){var va=Nn[pa];u[va]||(u[va]=Xt(va))}};ce();var oe=function(Xt){Qt[O]&&console.info("Redefining LocalForage driver: "+O),Qt[O]=u,Wo[O]=Xt,E()};"_support"in u?u._support&&typeof u._support=="function"?u._support().then(oe,C):oe(!!u._support):oe(!0)}catch(Ne){C(Ne)}});return w(v,g,y),v},c.prototype.driver=function(){return this._driver||null},c.prototype.getDriver=function(u,g,y){var v=Qt[u]?p.resolve(Qt[u]):p.reject(new Error("Driver not found."));return w(v,g,y),v},c.prototype.getSerializer=function(u){var g=p.resolve(fa);return w(g,u),g},c.prototype.ready=function(u){var g=this,y=g._driverSet.then(function(){return g._ready===null&&(g._ready=g._initDriver()),g._ready});return w(y,u,u),y},c.prototype.setDriver=function(u,g,y){var v=this;Ko(u)||(u=[u]);var E=this._getSupportedDrivers(u);function C(){v._config.driver=v.driver()}function O(U){return v._extend(U),C(),v._ready=v._initStorage(v._config),v._ready}function T(U){return function(){var J=0;function K(){for(;J<U.length;){var Y=U[J];return J++,v._dbInfo=null,v._ready=null,v.getDriver(Y).then(O).catch(K)}C();var ce=new Error("No available storage method found.");return v._driverSet=p.reject(ce),v._driverSet}return K()}}var D=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=D.then(function(){var U=E[0];return v._dbInfo=null,v._ready=null,v.getDriver(U).then(function(J){v._driver=J._driver,C(),v._wrapLibraryMethodsWithReady(),v._initDriver=T(E)})}).catch(function(){C();var U=new Error("No available storage method found.");return v._driverSet=p.reject(U),v._driverSet}),w(this._driverSet,g,y),this._driverSet},c.prototype.supports=function(u){return!!Wo[u]},c.prototype._extend=function(u){ma(this,u)},c.prototype._getSupportedDrivers=function(u){for(var g=[],y=0,v=u.length;y<v;y++){var E=u[y];this.supports(E)&&g.push(E)}return g},c.prototype._wrapLibraryMethodsWithReady=function(){for(var u=0,g=ha.length;u<g;u++)cd(this,ha[u])},c.prototype.createInstance=function(u){return new c(u)},c}(),dd=new ud;a.exports=dd},{3:3}]},{},[4])(4)})});var Zs=ya(pr=>{"use strict";q();an();ct();var li=(t,e)=>{window.parent&&window.parent.postMessage({type:t,data:e},"*")},ci=ge(),Nf=ze("levelFinished",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number()),duration:G.number().optional(),rating:G.number().optional(),score:G.number().optional(),variation:G.string().optional()})),implement:t=>I(pr,null,function*(){let{levelId:e,duration:n,rating:r,score:a,variation:i}=t;Te.info("onLevelFinished",n,r,a,i),li("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:e,duration:n,rating:r,score:a,variation:i}),yield Promise.all([Ke.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:e,duration:n,rating:r,score:a}}}),Ke.tracker("LevelFinished",{levelId:e,duration:n,rating:r,score:a,variation:i})])})}),Uf=ze("gamePlayEnded",{paramsSchema:G.tuple(G.object({duration:G.number().optional(),rating:G.number().optional(),score:G.number(),variation:G.string().optional()})),implement:t=>I(pr,null,function*(){let{duration:e,rating:n,score:r,variation:a}=t;Te.info("onGamePlayEnded",e,n,r,a),li("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:e,rating:n,score:r,variation:a}),yield Promise.all([Ke.tracker("GamePlayEnded",{duration:e,rating:n,score:r,variation:a}),Ke.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:e,rating:n,score:r}}})])})}),Mf=ze("levelUpgrade",{paramsSchema:G.tuple(G.object({levelId:G.or(G.string(),G.number()),name:G.string().optional()})),implement:n=>I(pr,[n],function*({levelId:t,name:e}){Te.info("onLevelUpgrade",t,e),li("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:t,name:e}),yield Promise.all([Ke.tracker("LevelUpgrade",{name:e,levelId:t}),Ke.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:t,levelName:e}}})])})});ci.registerCommand("TaskTrackerSDK.levelFinished",Nf);ci.registerCommand("TaskTrackerSDK.gamePlayEnded",Uf);ci.registerCommand("TaskTrackerSDK.levelUpgrade",Mf);_e("TaskTrackerSDK.onLevelFinished",{version:"1.1.25",properties:{params:{levelId:"1.1.25",duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});_e("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});_e("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var _t,Pt,el,ui,Bf,vr,di=Z(()=>{"use strict";_t=(t,e)=>{var n;window.dispatchEvent(new CustomEvent(t,{detail:e})),(n=window.parent)==null||n.postMessage({type:t,data:{detail:e}},"*")},Pt=new Map,el=t=>{if(t.source===window.parent)try{let e=t.data;if(e&&e.type){let n=Pt.get(e.type);n&&n.forEach(r=>{try{r(e.data)}catch(a){console.warn("Callback execution failed:",a)}})}}catch(e){console.warn("Failed to parse message:",e)}},ui=!1,Bf=()=>{ui||(window.addEventListener("message",el),ui=!0)},vr=(t,e)=>{Bf(),Pt.has(t)||Pt.set(t,new Set);let n=Pt.get(t);return n.add(e),()=>{n.delete(e),n.size===0&&Pt.delete(t),Pt.size===0&&(window.removeEventListener("message",el),ui=!1)}}});var gr,_r,yr,wr,br,fi,Er,Ir,Lt,Gf,ae,Ye,Qe,Ue=Z(()=>{"use strict";q();gr="UNLOCK_OPTIONS_CHANGED",_r="INVOKE_PAYMENT",yr="ON_PAYMENT_RESULT",wr="ON_USE_MODAL_EVENT",br="ON_USE_MODAL_RESULT",fi="ON_USE_MODAL_FREQUENCY",Er="ON_USE_UNLOGIN_MODAL_EVENT",Ir="INVOKE_UNLOGIN_MODAL_EVENT",Lt=new Je,Gf=()=>({on:Lt.on.bind(Lt),off:Lt.off.bind(Lt),emit:Lt.emit.bind(Lt)}),ae=Gf(),Ye={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},Qe={show:!0,minInterval:8*60*60*1e3}});var Qc=ya(Ao=>{"use strict";me();Ue();di();q();var Yc={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};vr("ON_JOLIBOX_JOLI_COIN_USE_RESULT",t=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",Yc[t.result],t.result),ae.emit(br,{useModalResult:Yc[t.result]})});ae.on(wr,(t,e)=>{var n;t=="ADS-JOLI_GEM"||t=="JOLI_GEM"||_t("JOLIBOX_JOLI_COIN_USE_EVENT",{JOLI_COIN:{quantity:e.quantity,balance:e.userCurrency.balance,enableAutoDeduct:e.enableAutoDeduct},type:t,sequenceId:(n=e.sequenceId)!=null?n:st()})});vr("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",t=>{ae.emit(yr,{paymentResult:t.result=="ADS"?"FAILED":t.result,userJoliCoin:t.joliCoin,currency:"JOLI_COIN"})});ae.on(_r,(t,e)=>I(Ao,null,function*(){var n;t=="ADS-JOLI_GEM"||t=="JOLI_GEM"||_t("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:e.quantity,balance:e.userCurrency.balance,enableAutoDeduct:e.enableAutoDeduct},type:t,sequenceId:(n=e.sequenceId)!=null?n:st()})}));vr("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",t=>{var e,n,r,a,i;ae.emit(Er,{result:t.result=="ADS"?"FAILED":t.result,rewards:{claimedRewardValue:(a=(r=(n=(e=t.extra)==null?void 0:e.firstLogin)==null?void 0:n.reward)==null?void 0:r.rewardValue)!=null?a:0,isFirstLogin:(i=t.isFirstLogin)!=null?i:!1}}),t.result==="SUCCESS"&&P.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});ae.on(Ir,t=>I(Ao,null,function*(){t=="ADS-JOLI_GEM"||t=="JOLI_GEM"||_t("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:st(),type:t})}))});ct();me();an();q();var Ws=ge(),yf="env",wf="getSystemInfoSync",bf=()=>{var a,i,o,s;let t={system:P.deviceInfo.system,platform:P.deviceInfo.platform.toLowerCase(),brand:P.deviceInfo.brand,pixelRatio:P.deviceInfo.pixelRatio,language:P.deviceInfo.lang,version:P.sdkInfo.jssdkVersion,appName:(a=P.hostInfo)==null?void 0:a.appName,SDKVersion:P.sdkInfo.nativeSDKVersion},e=(i=P.hostInfo)==null?void 0:i.version;e&&(t=Oe(j({},t),{version:e}));let n=(o=P.hostInfo)==null?void 0:o.appName;n&&(t=Oe(j({},t),{appName:n}));let r=(s=P.sdkInfo)==null?void 0:s.jssdkVersion;return r&&(t=Oe(j({},t),{SDKVersion:r})),t},Ef=gt(wf,{implement:bf}),If=gt(yf,{implement:()=>Oe(j({},P.hostInfo),{sdkInfo:P.sdkInfo,platform:P.platform,deviceInfo:P.deviceInfo})});Ws.registerCommand("API.env",If);Ws.registerCommand("API.getSystemInfoSync",Ef);_e("env",{version:"1.0.0"});_e("getSystemInfoSync",{version:"1.0.0"});q();an();Ve();ct();var Af="onJoliboxShow",Cf="onJoliboxHide",Sf="onReady",ai=ge(),ii=vs(ke),ri=!0,on=!0,dr=0,fr=Ya;function Rf(){let t=Date.now();if(t-dr<100)return;dr=t;let e=document.visibilityState==="visible";e!==ri&&(ri=e,fr.emit("visible",ri))}function zs(t){let e=Date.now();e-dr<100||(dr=e,t==="focus"&&!on?on=!0:t==="blur"&&on&&(on=!1),fr.emit("visible",on))}document.addEventListener("visibilitychange",Rf);window.addEventListener("focus",()=>zs("focus"));window.addEventListener("blur",()=>zs("blur"));var Of=gt(Af,{paramsSchema:G.tuple(G.function()),implement(t){let e=ii(t);fr.on("visible",n=>{n&&e()})}}),Tf=gt(Cf,{paramsSchema:G.tuple(G.function()),implement(t){let e=ii(t);fr.on("visible",n=>{!n&&e()})}}),kf=gt(Sf,{paramsSchema:G.tuple(G.function()),implement(t){let e=ii(t);lt.on("LifecycleEvent.onReady",n=>{e(n)})}});ai.registerCommand("LifecycleSDK.onReady",kf);ai.registerCommand("LifecycleSDK.onJoliboxShow",Of);ai.registerCommand("LifecycleSDK.onJoliboxHide",Tf);_e("lifeCycle.onReady",{version:"1.0.0"});_e("lifeCycle.onJoliboxShow",{version:"1.0.0"});_e("lifeCycle.onJoliboxHide",{version:"1.0.0"});an();q();xt();me();var Xs=wa(Qs());var hr=ge(),si=class{constructor(){this.httpClient=Be.create({baseUrl:kt(P.testMode)});this.getGameId=()=>P.mpId;this.getItem=e=>I(this,null,function*(){let{code:n,data:r,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:e}}),i=r==null?void 0:r.value,o=a;return n!=="SUCCESS"&&(i=yield this.gameStore.getItem(e),console.info("[SDK] cloud storage getItem failed, read from localstorage",i),o+="fallback to localstorage"),{code:n,message:o,data:i&&i!=="undefined"?i:null}});this.setItem=(e,n)=>I(this,null,function*(){let r=typeof n=="string"?n:String(n),{code:a,message:i}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:e,value:r}});return yield this.gameStore.setItem(e,r),{code:a,message:i}});this.removeItem=e=>I(this,null,function*(){yield this.gameStore.removeItem(e);let{code:n,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:e}});return{code:n,message:r}});this.clear=()=>I(this,null,function*(){yield this.gameStore.clear();let{code:e,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:e,message:n}});this.gameId=this.getGameId(),this.gameStore=Xs.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},mr=new si,xf=ze("getLocalStorage",{paramsSchema:G.tuple(G.string()),implement(t){return I(this,null,function*(){return yield mr.getItem(t)})}});hr.registerCommand("StorageSDK.getItem",xf);_e("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Df=ze("setStorage",{paramsSchema:G.tuple(G.string(),G.or(G.string(),G.boolean(),G.number())),implement(t,e){return I(this,null,function*(){return yield mr.setItem(t,e)})}});hr.registerCommand("StorageSDK.setItem",Df);_e("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Pf=ze("removeStorage",{paramsSchema:G.tuple(G.string()),implement(t){return I(this,null,function*(){return yield mr.removeItem(t)})}});hr.registerCommand("StorageSDK.removeItem",Pf);_e("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Lf=ze("clearStorage",{implement(){return I(this,null,function*(){return yield mr.clear()})}});hr.registerCommand("StorageSDK.clear",Lf);_e("storage.clear",{version:"1.0.0"});var SE=wa(Zs());ct();q();xt();di();me();Ue();var tl=P.testMode;function nl(){let t=new Map,e,n;return{registerRewardHandler(a,i){t.set(a,i)},handleReward(a,...i){return I(this,null,function*(){return yield a.reduce((s,l)=>I(this,null,function*(){let d=yield s;if(d===!0)return!0;tl&&console.log(`handleReward ${l}`);let _=t.get(l),h=_?yield _(...i):d;return tl&&console.log(`handleReward ${l} ${h}`),h}),Promise.resolve(!1))})},registerRewardsFetcher(a){return I(this,null,function*(){e=(...i)=>I(this,null,function*(){try{return yield a(...i)}catch(o){return console.error("getRewardOptions error:",o),["ADS"]}})})},registerRewardFrequencyConfigFetcher(a){return I(this,null,function*(){n=(...i)=>I(this,null,function*(){try{return yield a(...i)}catch(o){return console.error("getRewardOptions error:",o),{joliCoinUseAndCharge:Ye,loginGuide:Qe}}})})},getRewardsTypes(...a){return I(this,null,function*(){return e?yield e(...a):["ADS"]})},getRewardFrequencyConfig(...a){return I(this,null,function*(){return n?yield n(...a):{joliCoinUseAndCharge:Ye,loginGuide:Qe}})}}}var Xe=class{constructor(e,n={}){this.requestAdapter=e;this.cache=new Map;this.pendingRequests=new Map;this.requestSequence=0;this.cacheSequences=new Map;this.config=j({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,a)=>r,consistencyChecker:()=>!0},n)}request(e,n){return I(this,null,function*(){let r=this.config.keyGenerator(e,n),a=this.pendingRequests.get(r);if(a)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),a;let i=this.requestInternal(e,n),o=this.createTimeoutPromise(),s=Promise.race([i,o]).catch(l=>I(this,null,function*(){if(l.message.includes("timeout")){let d=this.getValidCachedData(r);if(d)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(d):d}throw l}));this.pendingRequests.set(r,s),i.then(l=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(l=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,l)});try{return yield s}finally{this.pendingRequests.delete(r)}})}requestInternal(e,n){return I(this,null,function*(){var l,d,_,h;let r=this.config.keyGenerator(e,n),a=++this.requestSequence,i=this.getValidCachedData(r);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",i),i){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let p=yield this.requestAdapter.execute(e,n),f=this.requestAdapter.extractRealTimeData(p),w=(d=(l=this.requestAdapter).extractCacheableData)==null?void 0:d.call(l,p);return w&&!this.config.consistencyChecker(i,w)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(r,w,a),p):this.requestAdapter.mergeData(i,f)}catch(p){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,p),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(i):i}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(i):i}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${a})`);let o=yield this.requestAdapter.execute(e,n),s=(h=(_=this.requestAdapter).extractCacheableData)==null?void 0:h.call(_,o);return s&&this.setCachedDataWithSequence(r,s,a),o})}createTimeoutPromise(){return new Promise((e,n)=>{setTimeout(()=>{n(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let n=this.cache.get(e);return n?Date.now()>n.expiresAt?(this.cache.delete(e),null):n.data:null}setCachedDataWithSequence(e,n,r,a){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 o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(n)),timestamp:o,expiresAt:o+this.config.duration,key:e,sequence:r,metadata:a}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,n){return I(this,null,function*(){let r=this.config.keyGenerator(e,n);return this.cache.delete(r),this.request(e,n)})}forceRequest(e,n){return I(this,null,function*(){var s,l;let r=this.config.keyGenerator(e,n),a=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${a})`);let i=yield this.requestAdapter.execute(e,n),o=(l=(s=this.requestAdapter).extractCacheableData)==null?void 0:l.call(s,i);return o&&(this.setCachedDataWithSequence(r,o,a),console.log(`[RequestCacheService] Force updated cache for ${e}`)),i})}warmupCache(e,n){return I(this,null,function*(){let r=this.config.keyGenerator(e,n);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,n)}catch(a){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,a)}})}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[n,r]of this.cache)e>r.expiresAt&&(this.cache.delete(n),this.cacheSequences.delete(n));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),n=0,r=0;for(let a of this.cache.values())e>a.expiresAt?r++:n++;return{cacheCount:this.cache.size,validCount:n,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let n=this.cache.get(e);return n?Date.now()<=n.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}};var hi=class{constructor(e){this.httpClient=e}execute(e,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"POST",a=(n==null?void 0:n.body)||{};return r==="GET"?yield this.httpClient.get(e,a):yield this.httpClient.post(e,a)})}extractCacheableData(e){var n;return{unlockOptions:((n=e.data)==null?void 0:n.unlockOptions)||[],joliCoin:e.extra.joliCoin,joliGem:e.extra.joliGem||{balance:0,enableAutoDeduct:!1}}}mergeData(e,n){return{code:"SUCCESS",message:"success",data:{unlockOptions:e.unlockOptions},extra:{joliCoin:e.joliCoin,joliGem:e.joliGem}}}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:e.unlockOptions},extra:{joliCoin:e.joliCoin,joliGem:e.joliGem}}}},mi=class{constructor(e){this.httpClient=e}execute(e,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"GET",a=(n==null?void 0:n.body)||{};return r==="GET"?yield this.httpClient.get(e,a):yield this.httpClient.post(e,a)})}extractCacheableData(e){let n=e.data;return j({joliCoinUseAndCharge:n==null?void 0:n.joliCoinUseAndCharge,loginGuide:n==null?void 0:n.loginGuide},n)}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:e}}},Ar=class{constructor(e){this.unlockOptionsService=new Xe(new hi(e),{duration:30*60*1e3,timeout:1e3,keyGenerator:n=>n,consistencyChecker:(n,r)=>n.unlockOptions.length!==r.unlockOptions.length?!1:n.unlockOptions.every((a,i)=>{var s,l;let o=r.unlockOptions[i];return a.type===o.type&&((s=a.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=o.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new Xe(new mi(e),{duration:60*60*1e3,timeout:1e3,keyGenerator:n=>n})}getUnlockOptions(){return I(this,arguments,function*(e={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:e,method:"POST"})})}getGlobalConfig(){return I(this,null,function*(){return yield this.globalConfigService.request("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}refreshUnlockOptions(){return I(this,arguments,function*(e={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:e,method:"POST"})})}refreshGlobalConfig(){return I(this,null,function*(){return yield this.globalConfigService.forceRequest("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}warmupCache(){return I(this,null,function*(){yield Promise.all([this.unlockOptionsService.warmupCache("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",method:"POST"}),this.globalConfigService.warmupCache("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})])})}clearAllCache(){this.unlockOptionsService.clearCache(),this.globalConfigService.clearCache()}getCacheStats(){return{unlockOptions:this.unlockOptionsService.getCacheStats(),globalConfig:this.globalConfigService.getCacheStats()}}clearExpiredCache(){this.unlockOptionsService.clearExpiredCache(),this.globalConfigService.clearExpiredCache()}};Ue();q();var Jf=()=>(t,e)=>{let n={JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return n[e]-n[t]},Ff=t=>t.length?t.includes("JOLI_GEM")&&t.length<=1?["JOLI_GEM_ONLY"]:t.includes("JOLI_COIN")&&t.length<=1?["JOLI_COIN_ONLY"]:t.sort(Jf()):["ADS"],pi=null;function vi(t){return pi||(pi=new Ar(t)),pi}var gi=t=>{t.registerRewardsFetcher(e=>I(void 0,null,function*(){var a,i,o,s,l;let n=["ADS"],r=vi(e);try{let d=yield r.getUnlockOptions({});if(d.code!=="SUCCESS")return n;ae.emit(gr,{options:((a=d.data)==null?void 0:a.unlockOptions)||[],userJoliCoin:((i=d.extra)==null?void 0:i.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((o=d.extra)==null?void 0:o.joliGem)||{balance:0,enableAutoDeduct:!1}});let _=((l=(s=d.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(h=>h.type))||Array.from(n);return Ff(_)}catch(d){return console.error("getRewardOptions error (cached):",d),n}}))},_i=t=>{t.registerRewardFrequencyConfigFetcher(e=>I(void 0,null,function*(){var r,a,i,o;let n=vi(e);try{let s=yield n.getGlobalConfig();return ae.emit(fi,{joliCoinUseAndCharge:((r=s.data)==null?void 0:r.joliCoinUseAndCharge)||Ye,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||Qe}),s.data&&lt.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((i=s.data)==null?void 0:i.joliCoinUseAndCharge)||Ye,loginGuide:((o=s.data)==null?void 0:o.loginGuide)||Qe}}catch(s){return console.error("getGlobalConfig error (cached):",s),ae.emit(fi,{joliCoinUseAndCharge:Ye,loginGuide:Qe}),lt.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:Ye,loginGuide:Qe}}),{joliCoinUseAndCharge:Ye,loginGuide:Qe}}}))};var yi=t=>I(void 0,null,function*(){yield vi(t).warmupCache(),console.log("Reward cache warmed up")});var rl=t=>e=>I(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",e),yield t.adBreak(e)}catch(n){console.error("-----createAdsRewardHandler error-----",n)}return!0});Ue();function ut(t,e){let n=null,r=null,a=null,i=()=>{if(a){n=Promise.resolve(a);return}n=new Promise(o=>{r=o})};return i(),t.on(e,(...o)=>{let s=o[0];a=s,r&&(r(s),r=null)}),{getData:()=>(n||i(),n),getCachedData:()=>a,clearCache:()=>{a=null,n=null},getFreshData:()=>(a=null,n=null,i(),n),updateData:o=>{if(a)return a=j(j({},a),o),n=Promise.resolve(a),r&&(r(a),r=null),a}}}Ue();var Me=ut(ae,gr);me();q();var wi={JOLI_COIN:{balanceEndpoint:"/api/joli-coin/balance",balanceDetailEndpoint:"/api/joli-coin/balance-detail",unlockEndpoint:"/api/joli-coin/unlock",unlockType:"JOLI_COIN"},GEM:{balanceEndpoint:"/api/joli-gem/balance",balanceDetailEndpoint:"/api/joli-gem/balance-detail",unlockEndpoint:"/api/joli-gem/unlock",unlockType:"GEM"}};q();var dt=ge();Ue();Ue();var Ei=class{constructor(e){this.httpClient=e}execute(e,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"GET",a=(n==null?void 0:n.query)||{};return r==="GET"?yield this.httpClient.get(e,{query:a}):yield this.httpClient.post(e,{query:a})})}extractCacheableData(e){var n;return{balance:((n=e.data)==null?void 0:n.balance)||0,timestamp:Date.now()}}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:{balance:e.balance}}}},Ii=class{constructor(e){this.balanceService=new Xe(new Ei(e),{duration:20*60*1e3,timeout:1e3,keyGenerator:(n,r)=>{let a=r!=null&&r.query?JSON.stringify(r.query):"";return`${n}:${a}`}})}getBalance(e="JOLI_COIN"){return I(this,null,function*(){return(yield this.balanceService.request("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:e},method:"GET"})).data})}refreshBalance(e="JOLI_COIN"){return I(this,null,function*(){return(yield this.balanceService.forceRequest("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:e},method:"GET"})).data})}warmupBalance(e="JOLI_COIN"){return I(this,null,function*(){yield this.balanceService.warmupCache("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:e},method:"GET"})})}clearBalanceCache(){this.balanceService.clearCache()}getBalanceCacheStats(){return this.balanceService.getCacheStats()}clearExpiredCache(){this.balanceService.clearExpiredCache()}},bi=null;function Ai(t){return bi||(bi=new Ii(t)),bi}var Ci=(t,e="JOLI_COIN")=>I(void 0,null,function*(){return yield Ai(t).getBalance(e)}),sn=(t,e="JOLI_COIN")=>I(void 0,null,function*(){let r=yield Ai(t).refreshBalance(e);return console.log(`Balance cache refreshed for type: ${e}`),r}),Cr=(t,e="JOLI_COIN")=>I(void 0,null,function*(){yield Ai(t).warmupBalance(e),console.log(`Balance cache warmed up for type: ${e}`)});var Ri=class{constructor(e){this.httpClient=e}execute(e,n){return I(this,null,function*(){let r=(n==null?void 0:n.method)||"GET",a=(n==null?void 0:n.query)||{};return r==="GET"?yield this.httpClient.get(e,{query:a}):yield this.httpClient.post(e,{query:a})})}extractCacheableData(e){var n;return{balance:((n=e.data)==null?void 0:n.balance)||0,timestamp:Date.now()}}processCachedData(e){return{code:"SUCCESS",message:"success from cache",data:{balance:e.balance}}}},Oi=class{constructor(e){this.gemBalanceService=new Xe(new Ri(e),{duration:20*60*1e3,timeout:1e3,keyGenerator:(n,r)=>{let a=r!=null&&r.query?JSON.stringify(r.query):"";return`${n}:${a}`}})}getGemBalance(e="GEM"){return I(this,null,function*(){return(yield this.gemBalanceService.request("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:e},method:"GET"})).data})}refreshGemBalance(e="GEM"){return I(this,null,function*(){return(yield this.gemBalanceService.forceRequest("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:e},method:"GET"})).data})}warmupGemBalance(e="GEM"){return I(this,null,function*(){yield this.gemBalanceService.warmupCache("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:e},method:"GET"})})}clearGemBalanceCache(){this.gemBalanceService.clearCache()}getGemBalanceCacheStats(){return this.gemBalanceService.getCacheStats()}clearExpiredCache(){this.gemBalanceService.clearExpiredCache()}},Si=null;function al(t){return Si||(Si=new Oi(t)),Si}var Ti=(t,e="GEM")=>I(void 0,null,function*(){return yield al(t).getGemBalance(e)}),Sr=(t,e="GEM")=>I(void 0,null,function*(){let r=yield al(t).refreshGemBalance(e);return console.log(`Gem balance cache refreshed for type: ${e}`),r});var ln={JOLI_COIN:{fetchBalance:Ci,getQuantity:t=>{var e,n,r;return(r=(n=(e=t==null?void 0:t.options)==null?void 0:e.find(a=>a.type==="JOLI_COIN"))==null?void 0:n.joliCoinChoices[0].joliCoinQuantity)!=null?r:0},getCurrentUser:t=>{var e;return(e=t==null?void 0:t.userJoliCoin)!=null?e:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(t,e)=>({balance:t,enableAutoDeduct:e}),getUpdateKey:()=>"userJoliCoin",isEnough:(t,e)=>{var n,r;return(r=(n=t==null?void 0:t.options)==null?void 0:n.some(a=>a.type==="JOLI_COIN"&&a.joliCoinChoices.some(i=>{var o;return i.joliCoinQuantity<=((o=e==null?void 0:e.balance)!=null?o:0)})))!=null?r:!1}},JOLI_GEM:{fetchBalance:Ti,getQuantity:t=>{var e,n,r,a;return(a=(r=(n=(e=t==null?void 0:t.options)==null?void 0:e.find(i=>i.type==="JOLI_GEM"))==null?void 0:n.joliGemChoice)==null?void 0:r.joliGemQuantity)!=null?a:0},getCurrentUser:t=>{var e;return(e=t==null?void 0:t.userGem)!=null?e:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(t,e)=>({balance:t,enableAutoDeduct:e}),getUpdateKey:()=>"userGem",isEnough:(t,e)=>{var r,a,i;let n=t==null?void 0:t.options.find(o=>o.type==="JOLI_GEM");return n?((a=(r=n.joliGemChoice)==null?void 0:r.joliGemQuantity)!=null?a:0)<=((i=e==null?void 0:e.balance)!=null?i:0):!1}}};var Rr=(t,e,n)=>{let{showUnlockWithCurrencyModal:r}=n;dt.registerCommand(`Rewards.${t}.useJolicoin`,()=>I(void 0,null,function*(){let a=yield Me.getData(),i=ln[e],o=i.getCurrentUser(a),s=i.getQuantity(a),l=!!(o!=null&&o.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",a,l,s),(yield r({enableAutoDeduct:l,userCurrency:o,quantity:s,currency:e}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},yt=(t,e)=>n=>I(void 0,null,function*(){let r=ut(ae,br);return ae.emit(wr,t,{enableAutoDeduct:n.enableAutoDeduct,userCurrency:n.userCurrency,quantity:n.quantity,currency:n.currency,confirmButtonText:e.confirmButtonText,cancelButtonText:e.cancelButtonText}),(yield r.getFreshData()).useModalResult});Ue();Ue();var Or=(t,e,n)=>{let{httpClient:r,initiateAndAwaitPayment:a}=n;dt.registerCommand(`Rewards.${t}.usePayment`,()=>I(void 0,null,function*(){var p;let i=yield Me.getData(),o=ln[e],s=yield o.fetchBalance(r),l=o.getQuantity(i),d=o.getCurrentUser(i),_=o.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,d.enableAutoDeduct),h=o.getUpdateKey();if(Me.updateData({[h]:_}),console.log("-----unlockOptions payment-----",i,_,l,e),!o.isEnough(i,_)){let f=yield a({userCurrency:_,currencyQuantity:l,currency:e});return e==="JOLI_GEM"?Sr(r):sn(r),{result:f==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},wt=(t,e)=>n=>I(void 0,null,function*(){let r=ut(ae,yr);return ae.emit(_r,t,{userCurrency:n.userCurrency,quantity:n.currencyQuantity,currency:n.currency,enableAutoDeduct:n.userCurrency.enableAutoDeduct,confirmButtonText:e.confirmButtonText,cancelButtonText:e.cancelButtonText}),(yield r.getFreshData()).paymentResult});me();Ue();Ue();q();var bt=(t,e)=>n=>I(void 0,null,function*(){let r=ut(ae,Er);return ae.emit(Ir,t,{confirmButtonText:e.confirmButtonText,cancelButtonText:e.cancelButtonText,currency:n}),yield r.getFreshData()});var Hf=(t,e,n,{handlers:{handleUnlockSuccess:r,handleUnlockFailed:a,unlockOptionsHandler:i,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:s,showUnloginModal:l}})=>{Or(t,"JOLI_COIN",{httpClient:e,initiateAndAwaitPayment:o}),Rr(t,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let d=[`Rewards.${t}.usePayment`,`Rewards.${t}.useJolicoin`];return _=>I(void 0,null,function*(){var h,p,f;try{let w=!0;for(let b of d){let x=yield dt.executeCommand(b);if(w=w&&x.result!=="FAILED",x.result!=="CONTINUE")break}if(!w)return a==null||a(_),!1;let A=wi[n],R=yield e.post(A.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${st()}-${P.mpType}-${Date.now()}`,gameInfo:{gameId:P.mpId}}});if(console.log("-----unlockWithCurrency request result-----",R),R.code=="SUCCESS"){try{(p=_.adBreakDone)==null||p.call(_,{breakType:_.type,breakName:"name"in _&&(h=_.name)!=null?h:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in _&&((f=_.adViewed)==null||f.call(_)),sn(e)}catch(b){console.error("-----unlockWithJolicoin adBreakDone error-----",b)}return r==null||r({quantity:R.data.quantity,balance:R.data.balance}),!0}return a==null||a(_),!1}catch(w){if(console.info("JolicoinRewardHandler error:",w),w instanceof Error&&w.message=="CANCEL")throw w;return a==null||a(_),!1}finally{i.clearCache()}})},Tr=(t,e,n)=>Hf(t,e,"JOLI_COIN",n);var il=(t,{onUnlockSuccess:e,onUnlockFailed:n})=>{let r=()=>{n==null||n()},a=yt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),i=wt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),o=bt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return Tr("ADS-JOLI_COIN",t,{handlers:{handleUnlockSuccess:e,handleUnlockFailed:r,unlockOptionsHandler:Me,initiateAndAwaitPayment:i,showUnlockWithCurrencyModal:a,showUnloginModal:o}})};var ol=(t,{onUnlockSuccess:e,onUnlockFailed:n})=>{let r=l=>{var d;n==null||n(),(d=l.adBreakDone)==null||d.call(l,{breakType:l.type,breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},a=yt("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),i=wt("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),o=bt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return Tr("JOLI_COIN",t,{handlers:{handleUnlockSuccess:e,handleUnlockFailed:r,unlockOptionsHandler:Me,initiateAndAwaitPayment:i,showUnlockWithCurrencyModal:a,showUnloginModal:o}})};me();q();var Ze=nl();gi(Ze);_i(Ze);var Pr,B,dl,Di,Et,sl,fl,hl,ml,Pi,ki,xi,$f,cn={},pl=[],Kf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,un=Array.isArray;function et(t,e){for(var n in e)t[n]=e[n];return t}function Li(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function dn(t,e,n){var r,a,i,o={};for(i in e)i=="key"?r=e[i]:i=="ref"?a=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?Pr.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)o[i]===void 0&&(o[i]=t.defaultProps[i]);return xr(t,o,r,a,null)}function xr(t,e,n,r,a){var i={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a==null?++dl:a,__i:-1,__u:0};return a==null&&B.vnode!=null&&B.vnode(i),i}function ft(t){return t.children}function De(t,e){this.props=t,this.context=e}function Nt(t,e){if(e==null)return t.__?Nt(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Nt(t):null}function vl(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return vl(t)}}function ll(t){(!t.__d&&(t.__d=!0)&&Et.push(t)&&!Dr.__r++||sl!==B.debounceRendering)&&((sl=B.debounceRendering)||fl)(Dr)}function Dr(){for(var t,e,n,r,a,i,o,s=1;Et.length;)Et.length>s&&Et.sort(hl),t=Et.shift(),s=Et.length,t.__d&&(n=void 0,a=(r=(e=t).__v).__e,i=[],o=[],e.__P&&((n=et({},r)).__v=r.__v+1,B.vnode&&B.vnode(n),Ni(e.__P,n,r,e.__n,e.__P.namespaceURI,32&r.__u?[a]:null,i,a==null?Nt(r):a,!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,yl(i,n,o),n.__e!=a&&vl(n)));Dr.__r=0}function gl(t,e,n,r,a,i,o,s,l,d,_){var h,p,f,w,A,R,b=r&&r.__k||pl,x=e.length;for(l=Wf(n,e,b,l,x),h=0;h<x;h++)(f=n.__k[h])!=null&&(p=f.__i===-1?cn:b[f.__i]||cn,f.__i=h,R=Ni(t,f,p,a,i,o,s,l,d,_),w=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&Ui(p.ref,null,f),_.push(f.ref,f.__c||w,f)),A==null&&w!=null&&(A=w),4&f.__u||p.__k===f.__k?l=_l(f,l,t):typeof f.type=="function"&&R!==void 0?l=R:w&&(l=w.nextSibling),f.__u&=-7);return n.__e=A,l}function Wf(t,e,n,r,a){var i,o,s,l,d,_=n.length,h=_,p=0;for(t.__k=new Array(a),i=0;i<a;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=i+p,(o=t.__k[i]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?xr(null,o,null,null,null):un(o)?xr(ft,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?xr(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,s=null,(d=o.__i=zf(o,n,l,h))!==-1&&(h--,(s=n[d])&&(s.__u|=2)),s==null||s.__v===null?(d==-1&&(a>_?p--:a<_&&p++),typeof o.type!="function"&&(o.__u|=4)):d!=l&&(d==l-1?p--:d==l+1?p++:(d>l?p--:p++,o.__u|=4))):t.__k[i]=null;if(h)for(i=0;i<_;i++)(s=n[i])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Nt(s)),bl(s,s));return r}function _l(t,e,n){var r,a;if(typeof t.type=="function"){for(r=t.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=t,e=_l(r[a],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=Nt(t)),n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function fn(t,e){return e=e||[],t==null||typeof t=="boolean"||(un(t)?t.some(function(n){fn(n,e)}):e.push(t)),e}function zf(t,e,n,r){var a,i,o=t.key,s=t.type,l=e[n];if(l===null&&t.key==null||l&&o==l.key&&s===l.type&&!(2&l.__u))return n;if(r>(l!=null&&!(2&l.__u)?1:0))for(a=n-1,i=n+1;a>=0||i<e.length;){if(a>=0){if((l=e[a])&&!(2&l.__u)&&o==l.key&&s===l.type)return a;a--}if(i<e.length){if((l=e[i])&&!(2&l.__u)&&o==l.key&&s===l.type)return i;i++}}return-1}function cl(t,e,n){e[0]=="-"?t.setProperty(e,n==null?"":n):t[e]=n==null?"":typeof n!="number"||Kf.test(e)?n:n+"px"}function kr(t,e,n,r,a){var i;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||cl(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||cl(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(ml,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=n,n?r?n.t=r.t:(n.t=Pi,t.addEventListener(e,i?xi:ki,i)):t.removeEventListener(e,i?xi:ki,i);else{if(a=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n==null?"":n;break e}catch(o){}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function ul(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.u==null)e.u=Pi++;else if(e.u<n.t)return;return n(B.event?B.event(e):e)}}}function Ni(t,e,n,r,a,i,o,s,l,d){var _,h,p,f,w,A,R,b,x,L,F,H,S,N,k,M,W,z=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[s=e.__e=n.__e]),(_=B.__b)&&_(e);e:if(typeof z=="function")try{if(b=e.props,x="prototype"in z&&z.prototype.render,L=(_=z.contextType)&&r[_.__c],F=_?L?L.props.value:_.__:r,n.__c?R=(h=e.__c=n.__c).__=h.__E:(x?e.__c=h=new z(b,F):(e.__c=h=new De(b,F),h.constructor=z,h.render=Qf),L&&L.sub(h),h.props=b,h.state||(h.state={}),h.context=F,h.__n=r,p=h.__d=!0,h.__h=[],h._sb=[]),x&&h.__s==null&&(h.__s=h.state),x&&z.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=et({},h.__s)),et(h.__s,z.getDerivedStateFromProps(b,h.__s))),f=h.props,w=h.state,h.__v=e,p)x&&z.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),x&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(x&&z.getDerivedStateFromProps==null&&b!==f&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(b,F),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(b,h.__s,F)===!1||e.__v==n.__v)){for(e.__v!=n.__v&&(h.props=b,h.state=h.__s,h.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(ee){ee&&(ee.__=e)}),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[],h.__h.length&&o.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(b,h.__s,F),x&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(f,w,A)})}if(h.context=F,h.props=b,h.__P=t,h.__e=!1,S=B.__r,N=0,x){for(h.state=h.__s,h.__d=!1,S&&S(e),_=h.render(h.props,h.state,h.context),k=0;k<h._sb.length;k++)h.__h.push(h._sb[k]);h._sb=[]}else do h.__d=!1,S&&S(e),_=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++N<25);h.state=h.__s,h.getChildContext!=null&&(r=et(et({},r),h.getChildContext())),x&&!p&&h.getSnapshotBeforeUpdate!=null&&(A=h.getSnapshotBeforeUpdate(f,w)),M=_,_!=null&&_.type===ft&&_.key==null&&(M=wl(_.props.children)),s=gl(t,un(M)?M:[M],e,n,r,a,i,o,s,l,d),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),R&&(h.__E=h.__=null)}catch(ee){if(e.__v=null,l||i!=null)if(ee.then){for(e.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,e.__e=s}else for(W=i.length;W--;)Li(i[W]);else e.__e=n.__e,e.__k=n.__k;B.__e(ee,e,n)}else i==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):s=e.__e=Yf(n.__e,e,n,r,a,i,o,l,d);return(_=B.diffed)&&_(e),128&e.__u?void 0:s}function yl(t,e,n){for(var r=0;r<n.length;r++)Ui(n[r],n[++r],n[++r]);B.__c&&B.__c(e,t),t.some(function(a){try{t=a.__h,a.__h=[],t.some(function(i){i.call(a)})}catch(i){B.__e(i,a.__v)}})}function wl(t){return typeof t!="object"||t==null?t:un(t)?t.map(wl):et({},t)}function Yf(t,e,n,r,a,i,o,s,l){var d,_,h,p,f,w,A,R=n.props,b=e.props,x=e.type;if(x=="svg"?a="http://www.w3.org/2000/svg":x=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(d=0;d<i.length;d++)if((f=i[d])&&"setAttribute"in f==!!x&&(x?f.localName==x:f.nodeType==3)){t=f,i[d]=null;break}}if(t==null){if(x==null)return document.createTextNode(b);t=document.createElementNS(a,x,b.is&&b),s&&(B.__m&&B.__m(e,i),s=!1),i=null}if(x===null)R===b||s&&t.data===b||(t.data=b);else{if(i=i&&Pr.call(t.childNodes),R=n.props||cn,!s&&i!=null)for(R={},d=0;d<t.attributes.length;d++)R[(f=t.attributes[d]).name]=f.value;for(d in R)if(f=R[d],d!="children"){if(d=="dangerouslySetInnerHTML")h=f;else if(!(d in b)){if(d=="value"&&"defaultValue"in b||d=="checked"&&"defaultChecked"in b)continue;kr(t,d,null,f,a)}}for(d in b)f=b[d],d=="children"?p=f:d=="dangerouslySetInnerHTML"?_=f:d=="value"?w=f:d=="checked"?A=f:s&&typeof f!="function"||R[d]===f||kr(t,d,f,R[d],a);if(_)s||h&&(_.__html===h.__html||_.__html===t.innerHTML)||(t.innerHTML=_.__html),e.__k=[];else if(h&&(t.innerHTML=""),gl(e.type==="template"?t.content:t,un(p)?p:[p],e,n,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,o,i?i[0]:n.__k&&Nt(n,0),s,l),i!=null)for(d=i.length;d--;)Li(i[d]);s||(d="value",x=="progress"&&w==null?t.removeAttribute("value"):w!==void 0&&(w!==t[d]||x=="progress"&&!w||x=="option"&&w!==R[d])&&kr(t,d,w,R[d],a),d="checked",A!==void 0&&A!==t[d]&&kr(t,d,A,R[d],a))}return t}function Ui(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(a){B.__e(a,n)}}function bl(t,e,n){var r,a;if(B.unmount&&B.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||Ui(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){B.__e(i,e)}r.base=r.__P=null}if(r=t.__k)for(a=0;a<r.length;a++)r[a]&&bl(r[a],e,n||typeof t.type!="function");n||Li(t.__e),t.__c=t.__=t.__e=void 0}function Qf(t,e,n){return this.constructor(t,n)}function El(t,e,n){var r,a,i,o;e==document&&(e=document.documentElement),B.__&&B.__(t,e),a=(r=typeof n=="function")?null:n&&n.__k||e.__k,i=[],o=[],Ni(e,t=(!r&&n||e).__k=dn(ft,null,[t]),a||cn,cn,e.namespaceURI,!r&&n?[n]:a?null:e.firstChild?Pr.call(e.childNodes):null,i,!r&&n?n:a?a.__e:e.firstChild,r,o),yl(i,t,o)}Pr=pl.slice,B={__e:function(t,e,n,r){for(var a,i,o;e=e.__;)if((a=e.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(t)),o=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(t,r||{}),o=a.__d),o)return a.__E=a}catch(s){t=s}throw t}},dl=0,Di=function(t){return t!=null&&t.constructor==null},De.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=et({},this.state),typeof t=="function"&&(t=t(et({},n),this.props)),t&&et(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),ll(this))},De.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ll(this))},De.prototype.render=ft,Et=[],fl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hl=function(t,e){return t.__v.__b-e.__v.__b},Dr.__r=0,ml=/(PointerCapture)$|Capture$/i,Pi=0,ki=ul(!1),xi=ul(!0),$f=0;var Ut,ie,Mi,Il,hn=0,xl=[],se=B,Al=se.__b,Cl=se.__r,Sl=se.diffed,Rl=se.__c,Ol=se.unmount,Tl=se.__;function Nr(t,e){se.__h&&se.__h(ie,t,hn||e),hn=0;var n=ie.__H||(ie.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function Ur(t){return hn=1,Dl(Pl,t)}function Dl(t,e,n){var r=Nr(Ut++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Pl(void 0,e),function(s){var l=r.__N?r.__N[0]:r.__[0],d=r.t(l,s);l!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=ie,!ie.__f)){var a=function(s,l,d){if(!r.__c.__H)return!0;var _=r.__c.__H.__.filter(function(p){return!!p.__c});if(_.every(function(p){return!p.__N}))return!i||i.call(this,s,l,d);var h=r.__c.props!==s;return _.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(h=!0)}}),i&&i.call(this,s,l,d)||h};ie.__f=!0;var i=ie.shouldComponentUpdate,o=ie.componentWillUpdate;ie.componentWillUpdate=function(s,l,d){if(this.__e){var _=i;i=void 0,a(s,l,d),i=_}o&&o.call(this,s,l,d)},ie.shouldComponentUpdate=a}return r.__N||r.__}function mn(t,e){var n=Nr(Ut++,3);!se.__s&&qi(n.__H,e)&&(n.__=t,n.u=e,ie.__H.__h.push(n))}function Gi(t,e){var n=Nr(Ut++,4);!se.__s&&qi(n.__H,e)&&(n.__=t,n.u=e,ie.__h.push(n))}function Ji(t){return hn=5,pn(function(){return{current:t}},[])}function pn(t,e){var n=Nr(Ut++,7);return qi(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Fi(t,e){return hn=8,pn(function(){return t},e)}function Xf(){for(var t;t=xl.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Lr),t.__H.__h.forEach(Bi),t.__H.__h=[]}catch(e){t.__H.__h=[],se.__e(e,t.__v)}}se.__b=function(t){ie=null,Al&&Al(t)},se.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Tl&&Tl(t,e)},se.__r=function(t){Cl&&Cl(t),Ut=0;var e=(ie=t.__c).__H;e&&(Mi===ie?(e.__h=[],ie.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(Lr),e.__h.forEach(Bi),e.__h=[],Ut=0)),Mi=ie},se.diffed=function(t){Sl&&Sl(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(xl.push(e)!==1&&Il===se.requestAnimationFrame||((Il=se.requestAnimationFrame)||Zf)(Xf)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Mi=ie=null},se.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Lr),n.__h=n.__h.filter(function(r){return!r.__||Bi(r)})}catch(r){e.some(function(a){a.__h&&(a.__h=[])}),e=[],se.__e(r,n.__v)}}),Rl&&Rl(t,e)},se.unmount=function(t){Ol&&Ol(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Lr(r)}catch(a){e=a}}),n.__H=void 0,e&&se.__e(e,n.__v))};var kl=typeof requestAnimationFrame=="function";function Zf(t){var e,n=function(){clearTimeout(r),kl&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);kl&&(e=requestAnimationFrame(n))}function Lr(t){var e=ie,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),ie=e}function Bi(t){var e=ie;t.__c=t.__(),ie=e}function qi(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Pl(t,e){return typeof e=="function"?e(t):e}function th(t,e){for(var n in e)t[n]=e[n];return t}function Ll(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function Nl(t,e){this.props=t,this.context=e}(Nl.prototype=new De).isPureReactComponent=!0,Nl.prototype.shouldComponentUpdate=function(t,e){return Ll(this.props,t)||Ll(this.state,e)};var Ul=B.__b;B.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Ul&&Ul(t)};var Ab=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var nh=B.__e;B.__e=function(t,e,n,r){if(t.then){for(var a,i=e;i=i.__;)if((a=i.__c)&&a.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),a.__c(t,e)}nh(t,e,n,r)};var Ml=B.unmount;function Hl(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),t.__c.__H=null),(t=th({},t)).__c!=null&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(r){return Hl(r,e,n)})),t}function Vl(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return Vl(r,e,n)}),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function ji(){this.__u=0,this.o=null,this.__b=null}function $l(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Mr(){this.i=null,this.l=null}B.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Ml&&Ml(t)},(ji.prototype=new De).__c=function(t,e){var n=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var a=$l(r.__v),i=!1,o=function(){i||(i=!0,n.__R=null,a?a(s):s())};n.__R=o;var s=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Vl(l,l.__c.__P,l.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(o,o)},ji.prototype.componentWillUnmount=function(){this.o=[]},ji.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Hl(this.__b,n,r.__O=r.__P)}this.__b=null}var a=e.__a&&dn(ft,null,t.fallback);return a&&(a.__u&=-33),[dn(ft,null,e.__a?null:t.children),a]};var Bl=function(t,e,n){if(++n[1]===n[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};(Mr.prototype=new De).__a=function(t){var e=this,n=$l(e.__v),r=e.l.get(t);return r[0]++,function(a){var i=function(){e.props.revealOrder?(r.push(a),Bl(e,t,r)):a()};n?n(i):i()}},Mr.prototype.render=function(t){this.i=null,this.l=new Map;var e=fn(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.l.set(e[n],this.i=[1,0,this.i]);return t.children},Mr.prototype.componentDidUpdate=Mr.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,n){Bl(t,n,e)})};var rh=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,ah=/^(?: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]/,ih=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,oh=/[A-Z0-9]/g,sh=typeof document!="undefined",lh=function(t){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function Hi(t,e,n){return e.__k==null&&(e.textContent=""),El(t,e),typeof n=="function"&&n(),t?t.__c:null}De.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(De.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Gl=B.event;function ch(){}function uh(){return this.cancelBubble}function dh(){return this.defaultPrevented}B.event=function(t){return Gl&&(t=Gl(t)),t.persist=ch,t.isPropagationStopped=uh,t.isDefaultPrevented=dh,t.nativeEvent=t};var Kl,fh={enumerable:!1,configurable:!0,get:function(){return this.class}},Jl=B.vnode;B.vnode=function(t){typeof t.type=="string"&&function(e){var n=e.props,r=e.type,a={},i=r.indexOf("-")===-1;for(var o in n){var s=n[o];if(!(o==="value"&&"defaultValue"in n&&s==null||sh&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||lh(n.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":ih.test(o)&&(o=l):l=o="oninput":i&&ah.test(o)?o=o.replace(oh,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&a[o=l]&&(o="oninputCapture"),a[o]=s}}r=="select"&&a.multiple&&Array.isArray(a.value)&&(a.value=fn(n.children).forEach(function(d){d.props.selected=a.value.indexOf(d.props.value)!=-1})),r=="select"&&a.defaultValue!=null&&(a.value=fn(n.children).forEach(function(d){d.props.selected=a.multiple?a.defaultValue.indexOf(d.props.value)!=-1:a.defaultValue==d.props.value})),n.class&&!n.className?(a.class=n.class,Object.defineProperty(a,"className",fh)):(n.className&&!n.class||n.class&&n.className)&&(a.class=a.className=n.className),e.props=a}(t),t.$$typeof=rh,Jl&&Jl(t)};var Fl=B.__r;B.__r=function(t){Fl&&Fl(t),Kl=t.__c};var ql=B.diffed;B.diffed=function(t){ql&&ql(t);var e=t.props,n=t.__e;n!=null&&t.type==="textarea"&&"value"in e&&e.value!==n.value&&(n.value=e.value==null?"":e.value),Kl=null};var hh=Object.defineProperty,Kr=Object.getOwnPropertySymbols,yc=Object.prototype.hasOwnProperty,wc=Object.prototype.propertyIsEnumerable,Wl=(t,e,n)=>e in t?hh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mh=(t,e)=>{for(var n in e||(e={}))yc.call(e,n)&&Wl(t,n,e[n]);if(Kr)for(var n of Kr(e))wc.call(e,n)&&Wl(t,n,e[n]);return t},ph=(t,e)=>{var n={};for(var r in t)yc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Kr)for(var r of Kr(t))e.indexOf(r)<0&&wc.call(t,r)&&(n[r]=t[r]);return n},bc=Object.defineProperty,vh=Object.defineProperties,gh=Object.getOwnPropertyDescriptors,zl=Object.getOwnPropertySymbols,_h=Object.prototype.hasOwnProperty,yh=Object.prototype.propertyIsEnumerable,Yl=(t,e,n)=>e in t?bc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wh=(t,e)=>{for(var n in e||(e={}))_h.call(e,n)&&Yl(t,n,e[n]);if(zl)for(var n of zl(e))yh.call(e,n)&&Yl(t,n,e[n]);return t},bh=(t,e)=>vh(t,gh(e)),Eh=(t,e)=>{for(var n in e)bc(t,n,{get:e[n],enumerable:!0})},Ec=(t,e,n,r)=>{for(var a=e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(a=o(a)||a);return a},Ih=(t,e,n)=>new Promise((r,a)=>{var i=l=>{try{s(n.next(l))}catch(d){a(d)}},o=l=>{try{s(n.throw(l))}catch(d){a(d)}},s=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,o);s((n=n.apply(t,e)).next())});if(typeof window!="undefined"&&!window.AbortController){let t=function(){this.signal=new e};t.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let n=new Event("abort");this.signal.dispatchEvent(n)};let e=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(e.prototype,"aborted",{get:function(){return this._aborted}}),e.prototype.addEventListener=function(n,r){this._eventListeners[n]||(this._eventListeners[n]=[]),this._eventListeners[n].push(r)},e.prototype.removeEventListener=function(n,r){if(!this._eventListeners[n])return;let a=this._eventListeners[n].indexOf(r);a!==-1&&this._eventListeners[n].splice(a,1)},e.prototype.dispatchEvent=function(n){if(this._eventListeners[n.type])for(let r of this._eventListeners[n.type])r.call(this,n)},window.AbortController=t,window.AbortSignal=e}function Ah(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}function Ch(t){return typeof t=="string"}function Sh(t){return typeof t=="undefined"}function Rh(t){return Sh(t)||t===null}function Oh(t){return typeof t=="function"}function Ic(t){let e=t,n=null,r=function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return n||(n=new e(...i)),n};return r.prototype=e.prototype,r}var Th=(t=>(t[t.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",t[t.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",t[t.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",t[t.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",t[t.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",t[t.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",t[t.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",t[t.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",t))(Th||{});function vn(t){return function(){var e,n;((n=(e=globalThis.VConsole)==null?void 0:e[t])!=null?n:globalThis.console[t])(...arguments)}}var kh={log:vn("log"),warn:vn("warn"),info:vn("info"),error:vn("error"),debug:vn("debug")};Object.assign(globalThis,{logger:kh});var Ql=Symbol.for("Jolibox.canIUseMap"),xh={};globalThis[Ql]||(globalThis[Ql]=xh);var Xl=Symbol.for("Jolibox.canIUseMap.native"),Dh={};globalThis[Xl]||(globalThis[Xl]=Dh);var Ac=(t=>(t[t.Other=0]="Other",t[t.Route=1]="Route",t[t.Click=2]="Click",t[t.View=3]="View",t[t.Expose=4]="Expose",t[t.Swipe=5]="Swipe",t[t.Input=6]="Input",t[t.Select=7]="Select",t[t.SwitchOn=8]="SwitchOn",t[t.SwitchOff=9]="SwitchOff",t[t.Submit=10]="Submit",t[t.Scroll=11]="Scroll",t[t.Hide=12]="Hide",t[t.System=1e3]="System",t[t.ErrorTrace=1001]="ErrorTrace",t[t.UserDefined=1002]="UserDefined",t))(Ac||{}),Cc=(t=>(t.MiniGame="mini-game",t.MiniDrama="mini-drama",t.App="app",t.WebSDK="web-sdk",t.AppSDK="app-sdk",t))(Cc||{}),Sc=(t=>(t[t.App=0]="App",t[t.H5=1]="H5",t[t.Weapp=2]="Weapp",t[t.Alipay=3]="Alipay",t[t.Gcash=4]="Gcash",t[t.Dana=5]="Dana",t[t.Umma=6]="Umma",t[t.WebSDK=1e3]="WebSDK",t[t.AppSDK=1001]="AppSDK",t[t.Other=9999]="Other",t))(Sc||{}),Zl=["name","params"],Ph=["name","type","location","target","extra","timestamp","userId"],Lh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function Fr(t,e){return e.map(n=>{if(n==="params"&&t[n]){let r=t[n];return Object.keys(r).reduce((a,i)=>(a[i]=String(r[i]),a),{})}return t[n]})}function Nh(t){let e=t.location?Fr(t.location,Zl):null,n=t.target?Fr(t.target,Zl):null;return Fr(bh(wh({},t),{location:e,target:n}),Ph)}function Uh(t){let e=t.events.map(r=>Nh(r)),n=Fr(t.device,Lh);return[t.protocolVersion,e,n,t.project]}function Mh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let t=Object.getOwnPropertyDescriptor(window,"localStorage");if(t&&t.get){let r=t.get.call(window);return window.__joliboxLocalStorage__=r,r}if(t=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),t&&t.get)return t.get.call(window);let e=Window.prototype,n=Object.getOwnPropertyDescriptor(e,"localStorage");if(n&&n.get){let r=n.get.call(window);return window.__joliboxLocalStorage__=r,r}return localStorage}catch(t){return console.warn("Failed to get original localStorage, fallback to default implementation",t),localStorage}}Mh();var Gt=typeof window=="undefined",ec=()=>!Gt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!Gt&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!Gt&&navigator.userAgent.includes("Android"),!Gt&&navigator.userAgent.includes("Mac"),!Gt&&navigator.userAgent.includes("FB_IAB"),!Gt&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var Qi=class Xi{constructor(e){this.element=e,this.next=Xi.Undefined,this.prev=Xi.Undefined}};Qi.Undefined=new Qi(void 0);var re=Qi,Bh=class{constructor(){this._first=re.Undefined,this._last=re.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===re.Undefined}clear(){let t=this._first;for(;t!==re.Undefined;){let e=t.next;t.prev=re.Undefined,t.next=re.Undefined,t=e}this._first=re.Undefined,this._last=re.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let n=new re(t);if(this._first===re.Undefined)this._first=n,this._last=n;else if(e){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==re.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==re.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==re.Undefined&&t.next!==re.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===re.Undefined&&t.next===re.Undefined?(this._first=re.Undefined,this._last=re.Undefined):t.next===re.Undefined?(this._last=this._last.prev,this._last.next=re.Undefined):t.prev===re.Undefined&&(this._first=this._first.next,this._first.prev=re.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==re.Undefined;)yield t.element,t=t.next}},Gh=0,gn=class{constructor(t){this.value=t,this.id=Gh++}},bn=class{constructor(t){this.options=t,this._size=0}dispose(t){var e,n;this._disposed||(this._disposed=!0,this._listeners&&(t?(this._listeners instanceof gn&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(r=>(r==null?void 0:r.value)===t)):(this._listeners=void 0,this._size=0)),(n=(e=this.options)==null?void 0:e.onDidRemoveLastListener)==null||n.call(e))}get event(){return this._event!=null||(this._event=(t,e)=>{var n,r,a,i,o,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};e&&(t=t.bind(e));let l=new gn(t);return this._listeners?this._listeners instanceof gn?this._listeners=[this._listeners,l]:this._listeners.push(l):((r=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||r.call(n,this),this._listeners=l,(i=(a=this.options)==null?void 0:a.onDidFirstListener)==null||i.call(a,this)),(s=(o=this.options)==null?void 0:o.onDidAddListener)==null||s.call(o,this),this._size++,()=>{var d,_,h,p;if(!this._disposed){if(this._listeners instanceof gn)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(_=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||_.call(d));else if(this._listeners){let f=this._listeners.indexOf(l);f>=0&&(this._listeners.splice(f,1),this._size--,this._size===0&&((p=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||p.call(h)))}}}}),this._event}_deliver(t,e){var n;if(!t)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){t.value(e);return}try{t.value(e)}catch(a){r(a)}}fire(t){this._listeners&&(this._listeners instanceof gn?this._deliver(this._listeners,t):this._listeners.forEach(e=>this._deliver(e,t)))}hasListeners(){return this._size>0}},Jh=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var r;let a=(r=this.listeners.get(t))!=null?r:new bn,i=l=>e(...l.args),o=a.event(i);this.listerHandlerMap.set(e,{handler:i,dispose:o}),this.listeners.set(t,a);let s=this.cachedEventQueue.get(t);if(s&&n)for(let l of s)e(...l.args)}flushCachedEvent(t){t?this.cachedEventQueue.delete(t):this.cachedEventQueue.clear()}off(t,e){let n=this.listerHandlerMap.get(e);n&&(n.dispose(),this.listerHandlerMap.delete(e))}emit(t){let e=this.listeners.get(t),n=this.cachedEventQueue.get(t);for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];n||(n=new Bh,this.cachedEventQueue.set(t,n)),n.push({args:a}),e&&e.fire({event:t,args:a})}once(t,e){var n=this;let r=function(){e(...arguments),n.off(t,r)};this.on(t,r,!1)}},Zi={};Eh(Zi,{None:()=>Fh,filter:()=>jh,once:()=>Rc,toPromise:()=>qh});var Fh=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function qh(t){return new Promise(e=>Rc(t)(e))}function Rc(t){return function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=!1;return t(a=>{if(!r)return r=!0,e.call(n,a)},null)}}function jh(t,e){return(n=>{let r={onWillAddFirstListener(){n(a.fire,a)}},a=new bn(r);return a.event})(function(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return t(a=>e(a)&&n.call(r,a),null)})}var Vi=Symbol.for("Jolibox.hostEmitter"),Hh=()=>{let t=new Jh;return globalThis[Vi]||(globalThis[Vi]={on:t.on.bind(t),off:t.off.bind(t),emit:t.emit.bind(t),once:t.once.bind(t)}),globalThis[Vi]};Hh();function Vh(t,e){let n=Math.min(t.length,e.length);for(let r=0;r<n;r++)$h(t[r],e[r])}function $h(t,e){if(Ch(e)){if(typeof t!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(Oh(e)){try{if(t instanceof e)return}catch(n){}if(!Rh(t)&&t.constructor===e||e.length===1&&e.call(void 0,t)===!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")}}var eo=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new bn,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(t){if(!t)throw new Error("invalid command");if(t.metadata&&Array.isArray(t.metadata.args)){let n=[];for(let a of t.metadata.args)n.push(a.constraint);let r=t.handler;t.handler=function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return Vh(i,n),r(...i)}}let{id:e}=t;this._commands.get(e)&&console.info(`[Jolibox SDK] duplicated command is registered ${e}`),this._commands.set(e,t),this._onDidRegisterCommand.fire(e)}getCommand(t){return this._commands.get(t)}getCommands(){let t=new Map;for(let e of this._commands.keys()){let n=this.getCommand(e);n&&t.set(e,n)}return t}};eo=Ec([Ic],eo);var tc=class{constructor(){this._onWillExecuteCommand=new bn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new bn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new eo,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Ah(3e4)),this._starActivation}executeCommand(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ih(this,null,function*(){return this.registry.getCommand(t)?this._tryExecuteCommand(t,n):(yield Promise.all([Promise.race([this._activateStar(),Zi.toPromise(Zi.filter(this.registry.onDidRegisterCommand,a=>a===t))])]),this._tryExecuteCommand(t,n))})}executeCommandThowErr(t){if(!this.registry.getCommand(t))throw new Error(`command '${t}' not found`);let e=this.registry.getCommand(t);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this._onWillExecuteCommand.fire({commandId:t,args:r});let i=this.invokeFunction(e.handler,...r);return this._onDidExecuteCommand.fire({commandId:t,args:r}),i}_tryExecuteCommand(t,e){let n=this.registry.getCommand(t);if(!n)return Promise.reject(new Error(`command '${t}' not found`));try{this._onWillExecuteCommand.fire({commandId:t,args:e});let r=this.invokeFunction(n.handler,...e);return this._onDidExecuteCommand.fire({commandId:t,args:e}),Promise.resolve(r)}catch(r){return Promise.reject(r)}}invokeFunction(t){try{for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t(...n)}finally{}}};tc=Ec([Ic],tc);function Ae(t,e,n){return(e=Kh(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kh(t){var e=Wh(t,"string");return typeof e=="symbol"?e:e+""}function Wh(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mt=t=>t?function(){try{for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t==null||t(...n)}catch(a){console.error("Error calling function",a)}}:()=>{console.log("wrapUserFunction: fn is undefined")},to=class{constructor(e){Ae(this,"context",void 0),Ae(this,"continueCallback",void 0),Ae(this,"adIsShowingCallback",void 0),Ae(this,"isBeforeAdCalled",!1),Ae(this,"isBeforeRewardCalled",!1),Ae(this,"isAdDismissedCalled",!1),Ae(this,"isAdViewedCalled",!1),Ae(this,"isAfterAdCalled",!1),Ae(this,"currentProvider",void 0),Ae(this,"currentClientParams",void 0),Ae(this,"adsHasResponse",!1),Ae(this,"videoChecker",window.document.createElement("video")),Ae(this,"contextInfo",void 0),Ae(this,"wrapShowAdFn",n=>()=>{var r,a,i;this.adsHasResponse=!0;let o=!1;this.videoChecker.play().catch(()=>{o=!1}),o=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:o},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",mh({userEvent:o},this.paramsToTrack)),ec()&&this.context.track("mmp_ad_impression",{ad_network:(a=(r=this.currentProvider)==null?void 0:r.name)!=null?a:"",ad_format:"rewarded",module:"game",game_id:this.contextInfo.objectId}),(i=this.adIsShowingCallback)==null||i.call(this,!0);let s=Mt(n);s==null||s()}),this.context=e,this.contextInfo=e.getContextInfo()}notifyIframeAdsEvent(e,n){window.parent&&window.parent.postMessage({type:e,data:n},"*"),window.dispatchEvent(new CustomEvent(e,{detail:n}))}get paramsToTrack(){var e,n,r,a,i,o;return{provider:(n=(e=this.currentProvider)==null?void 0:e.name)!=null?n:null,type:(r=this.currentClientParams)==null?void 0:r.type,name:((a=this.currentClientParams)==null?void 0:a.type)==="preroll"?null:(o=(i=this.currentClientParams)==null?void 0:i.name)!=null?o:""}}wrapBeforeAd(e){return()=>{var n,r,a,i;if(this.adsHasResponse=!0,this.context.track("CallBeforeAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_AD",this.paramsToTrack),!this.isBeforeAdCalled){this.isBeforeAdCalled=!0;let o=Mt(e);o==null||o(),((n=this.currentClientParams)==null?void 0:n.type)!=="reward"&&((r=this.adIsShowingCallback)==null||r.call(this,!0),ec()&&this.context.track("mmp_ad_impression",{ad_network:(i=(a=this.currentProvider)==null?void 0:a.name)!=null?i:"",ad_format:"interstitial",module:"game",game_id:this.contextInfo.objectId}))}}}wrapBeforeReward(e){return n=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(n)():(this.isBeforeRewardCalled=!0,e==null||e(this.wrapShowAdFn(n)))}}wrapAdDismissed(e){return()=>{if(this.adsHasResponse=!0,!this.isAdDismissedCalled){this.isAdDismissedCalled=!0;let n=Mt(e);n==null||n()}}}wrapAdViewed(e){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let n=Mt(e);n==null||n()}}}wrapAfterAd(e){return()=>{if(this.adsHasResponse=!0,this.context.track("CallAfterAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AFTER_AD",this.paramsToTrack),!this.isAfterAdCalled){this.isAfterAdCalled=!0;let n=Mt(e);n==null||n()}}}wrapAdBreakDone(e){return n=>{var r,a,i,o,s,l,d,_,h;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(a=(r=this.currentProvider)==null?void 0:r.name)!=null?a:null,breakType:n.breakType,breakName:(i=n.breakName)!=null?i:"",breakFormat:n.breakFormat,breakStatus:n.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(o=this.currentProvider)==null?void 0:o.name)!=null?s:null,breakType:n.breakType,breakName:(l=n.breakName)!=null?l:"",breakFormat:n.breakFormat,breakStatus:n.breakStatus}),n.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=Mt(e);p==null||p(n),(d=this.adIsShowingCallback)==null||d.call(this,!1),(_=this.continueCallback)==null||_.call(this,[!1,n]);break}default:{(h=this.continueCallback)==null||h.call(this,[!0,n]);break}}}}callAdBreakAndContinue(e,n,r,a){return I(this,null,function*(){return this.currentProvider=e,this.currentClientParams=n,this.adsHasResponse=!1,new Promise(i=>{this.continueCallback=i,this.adIsShowingCallback=a;let o;switch(n.type){case"preroll":{o={type:n.type,adBreakDone:this.wrapAdBreakDone(n.adBreakDone)};break}case"reward":{o={name:n.name,type:n.type,beforeAd:this.wrapBeforeAd(n.beforeAd),beforeReward:this.wrapBeforeReward(n.beforeReward),adDismissed:this.wrapAdDismissed(n.adDismissed),adViewed:this.wrapAdViewed(n.adViewed),afterAd:this.wrapAfterAd(n.afterAd),adBreakDone:this.wrapAdBreakDone(n.adBreakDone)};break}default:{o={name:n.name,type:n.type,beforeAd:this.wrapBeforeAd(n.beforeAd),afterAd:this.wrapAfterAd(n.afterAd),adBreakDone:this.wrapAdBreakDone(n.adBreakDone)};break}}window.setTimeout(()=>{var s,l,d,_,h,p,f;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:n.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:n.type,provider:(_=(d=this.currentProvider)==null?void 0:d.name)!=null?_:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:n.type,breakName:n.type==="preroll"?"":(h=n.name)!=null?h:"",breakFormat:n.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(f=this.adIsShowingCallback)==null||f.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),e.adBreak(o,r),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};function Br(t,e,n){return(e=zh(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zh(t){var e=Yh(t,"string");return typeof e=="symbol"?e:e+""}function Yh(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var no=class{constructor(e){Br(this,"context",void 0),Br(this,"adBreakIsShowing",!1),Br(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Br(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=e,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",n=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};function Gr(t,e,n){return(e=Qh(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qh(t){var e=Xh(t,"string");return typeof e=="symbol"?e:e+""}function Xh(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ro=class{constructor(e){Gr(this,"configs",null),Gr(this,"firstRun",!0),Gr(this,"context",void 0),Gr(this,"contextInfo",void 0),this.context=e,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return I(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(e){}})}shouldBypassCallingInterstitial(){var e,n;let r;if(!this.configs)this.init(),r=!this.firstRun;else{let a=(e=this.contextInfo.channel)!=null?e:"",i=this.configs[a],o=(n=i==null?void 0:i.interstitialRate)!=null?n:1;r=Math.random()<o}return this.firstRun=!1,r}};function tt(t,e,n){return(e=Zh(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Zh(t){var e=em(t,"string");return typeof e=="symbol"?e:e+""}function em(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ao=class{constructor(e,n){tt(this,"name","ADSENSE"),tt(this,"context",void 0),tt(this,"contextInfo",void 0),tt(this,"configured",!1),tt(this,"initParams",void 0),tt(this,"push",function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(r)}),tt(this,"adConfig",r=>{let a=r,{onReady:i}=a,o=ph(a,["onReady"]);this.context.track("CallAdConfig",o),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(r))}),tt(this,"adBreak",r=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(r)}),tt(this,"adUnit",r=>I(this,null,function*(){var a,i,o,s;if(this.context.track("CallAdUnit",{adFormat:(i=(a=r.adFormat)==null?void 0:a.toString())!=null?i:null,fullWidthResponsive:(o=r.fullWidthResponsive)!=null?o:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:d,adFormat:_,fullWidthResponsive:h,style:p}=r,f;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?f=document.querySelector(l):f=l,!f)throw new Error("targeting element not found");let w=d;if(w||(w=this.initParams.unitId),!w)throw new Error("slot is required");let A=typeof _=="object"&&Array.isArray(_)?_.join(", "):_,R=document.createElement("ins");if(R.className="adsbygoogle",R.id="jolibox-ads",R.style.display="block",R.setAttribute("data-ad-client",this.initParams.clientId),R.setAttribute("data-ad-slot",w),A&&R.setAttribute("data-ad-format",A),h&&R.setAttribute("data-full-width-responsive",h),p&&R.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let b=document.createElement("div");b.style.position="absolute",b.style.top="0",b.style.left="0",b.style.width="100%",b.style.height="100%",b.style.display="flex",b.style.justifyContent="center",b.style.alignItems="center",b.style.backgroundColor="rgba(0, 0, 0, 0.5)",b.style.color="white",b.innerHTML="Test Ad",R.style.position="relative",f.appendChild(R),R.appendChild(b)}else f.appendChild(R),new MutationObserver(b=>{b.forEach(x=>{if(x.type==="attributes"&&x.attributeName==="data-ad-status"){let L=R.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:L!=null?L:"null"})}})}).observe(R,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=e,this.contextInfo=this.context.getContextInfo(),this.initParams=n,window.adsbygoogle=window.adsbygoogle||[]}init(){return I(this,null,function*(){var e;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let n="google-adsense",r=(e=this.contextInfo.testAdsMode)!=null?e:!1;if(!document.getElementById(n)&&this.initParams.clientId){let a=document.createElement("script");a.id=n,a.async=!0,a.crossOrigin="anonymous",a.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,r&&a.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&a.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&a.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),this.initParams.admobRewardedSlot&&a.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&a.setAttribute("data-admob-ads-only","on"),document.head.appendChild(a),this.context.track("LoadAdsenseCompleted",null)}})}};function tm(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function nm(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var rm=function(){function t(n){var r=this;this._insertTag=function(a){var i;r.tags.length===0?r.insertionPoint?i=r.insertionPoint.nextSibling:r.prepend?i=r.container.firstChild:i=r.before:i=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(a,i),r.tags.push(a)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(n){n.forEach(this._insertTag)},e.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(nm(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var a=tm(r);try{a.insertRule(n,a.cssRules.length)}catch(i){}}else r.appendChild(document.createTextNode(n));this.ctr++},e.flush=function(){this.tags.forEach(function(n){var r;return(r=n.parentNode)==null?void 0:r.removeChild(n)}),this.tags=[],this.ctr=0},t}(),we="-ms-",Wr="-moz-",V="-webkit-",Oc="comm",wo="rule",bo="decl",am="@import",Tc="@keyframes",im="@layer",om=Math.abs,Zr=String.fromCharCode,sm=Object.assign;function lm(t,e){return pe(t,0)^45?(((e<<2^pe(t,0))<<2^pe(t,1))<<2^pe(t,2))<<2^pe(t,3):0}function kc(t){return t.trim()}function cm(t,e){return(t=e.exec(t))?t[0]:t}function $(t,e,n){return t.replace(e,n)}function io(t,e){return t.indexOf(e)}function pe(t,e){return t.charCodeAt(e)|0}function En(t,e,n){return t.slice(e,n)}function Fe(t){return t.length}function Eo(t){return t.length}function Jr(t,e){return e.push(t),t}function um(t,e){return t.map(e).join("")}var ea=1,qt=1,xc=0,Re=0,de=0,jt="";function ta(t,e,n,r,a,i,o){return{value:t,root:e,parent:n,type:r,props:a,children:i,line:ea,column:qt,length:o,return:""}}function _n(t,e){return sm(ta("",null,null,"",null,null,0),t,{length:-t.length},e)}function dm(){return de}function fm(){return de=Re>0?pe(jt,--Re):0,qt--,de===10&&(qt=1,ea--),de}function Le(){return de=Re<xc?pe(jt,Re++):0,qt++,de===10&&(qt=1,ea++),de}function qe(){return pe(jt,Re)}function qr(){return Re}function Cn(t,e){return En(jt,t,e)}function In(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Dc(t){return ea=qt=1,xc=Fe(jt=t),Re=0,[]}function Pc(t){return jt="",t}function jr(t){return kc(Cn(Re-1,oo(t===91?t+2:t===40?t+1:t)))}function hm(t){for(;(de=qe())&&de<33;)Le();return In(t)>2||In(de)>3?"":" "}function mm(t,e){for(;--e&&Le()&&!(de<48||de>102||de>57&&de<65||de>70&&de<97););return Cn(t,qr()+(e<6&&qe()==32&&Le()==32))}function oo(t){for(;Le();)switch(de){case t:return Re;case 34:case 39:t!==34&&t!==39&&oo(de);break;case 40:t===41&&oo(t);break;case 92:Le();break}return Re}function pm(t,e){for(;Le()&&t+de!==57&&!(t+de===84&&qe()===47););return"/*"+Cn(e,Re-1)+"*"+Zr(t===47?t:Le())}function vm(t){for(;!In(qe());)Le();return Cn(t,Re)}function gm(t){return Pc(Hr("",null,null,null,[""],t=Dc(t),0,[0],t))}function Hr(t,e,n,r,a,i,o,s,l){for(var d=0,_=0,h=o,p=0,f=0,w=0,A=1,R=1,b=1,x=0,L="",F=a,H=i,S=r,N=L;R;)switch(w=x,x=Le()){case 40:if(w!=108&&pe(N,h-1)==58){io(N+=$(jr(x),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=jr(x);break;case 9:case 10:case 13:case 32:N+=hm(w);break;case 92:N+=mm(qr()-1,7);continue;case 47:switch(qe()){case 42:case 47:Jr(_m(pm(Le(),qr()),e,n),l);break;default:N+="/"}break;case 123*A:s[d++]=Fe(N)*b;case 125*A:case 59:case 0:switch(x){case 0:case 125:R=0;case 59+_:b==-1&&(N=$(N,/\f/g,"")),f>0&&Fe(N)-h&&Jr(f>32?rc(N+";",r,n,h-1):rc($(N," ","")+";",r,n,h-2),l);break;case 59:N+=";";default:if(Jr(S=nc(N,e,n,d,_,a,s,L,F=[],H=[],h),i),x===123)if(_===0)Hr(N,e,S,S,F,i,h,s,H);else switch(p===99&&pe(N,3)===110?100:p){case 100:case 108:case 109:case 115:Hr(t,S,S,r&&Jr(nc(t,S,S,0,0,a,s,L,a,F=[],h),H),a,H,h,s,r?F:H);break;default:Hr(N,S,S,S,[""],H,0,s,H)}}d=_=f=0,A=b=1,L=N="",h=o;break;case 58:h=1+Fe(N),f=w;default:if(A<1){if(x==123)--A;else if(x==125&&A++==0&&fm()==125)continue}switch(N+=Zr(x),x*A){case 38:b=_>0?1:(N+="\f",-1);break;case 44:s[d++]=(Fe(N)-1)*b,b=1;break;case 64:qe()===45&&(N+=jr(Le())),p=qe(),_=h=Fe(L=N+=vm(qr())),x++;break;case 45:w===45&&Fe(N)==2&&(A=0)}}return i}function nc(t,e,n,r,a,i,o,s,l,d,_){for(var h=a-1,p=a===0?i:[""],f=Eo(p),w=0,A=0,R=0;w<r;++w)for(var b=0,x=En(t,h+1,h=om(A=o[w])),L=t;b<f;++b)(L=kc(A>0?p[b]+" "+x:$(x,/&\f/g,p[b])))&&(l[R++]=L);return ta(t,e,n,a===0?wo:s,l,d,_)}function _m(t,e,n){return ta(t,e,n,Oc,Zr(dm()),En(t,2,-2),0)}function rc(t,e,n,r){return ta(t,e,n,bo,En(t,0,r),En(t,r+1,-1),r)}function Ft(t,e){for(var n="",r=Eo(t),a=0;a<r;a++)n+=e(t[a],a,t,e)||"";return n}function ym(t,e,n,r){switch(t.type){case im:if(t.children.length)break;case am:case bo:return t.return=t.return||t.value;case Oc:return"";case Tc:return t.return=t.value+"{"+Ft(t.children,r)+"}";case wo:t.value=t.props.join(",")}return Fe(n=Ft(t.children,r))?t.return=t.value+"{"+n+"}":""}function wm(t){var e=Eo(t);return function(n,r,a,i){for(var o="",s=0;s<e;s++)o+=t[s](n,r,a,i)||"";return o}}function bm(t){return function(e){e.root||(e=e.return)&&t(e)}}function Em(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var Im=function(t,e,n){for(var r=0,a=0;r=a,a=qe(),r===38&&a===12&&(e[n]=1),!In(a);)Le();return Cn(t,Re)},Am=function(t,e){var n=-1,r=44;do switch(In(r)){case 0:r===38&&qe()===12&&(e[n]=1),t[n]+=Im(Re-1,e,n);break;case 2:t[n]+=jr(r);break;case 4:if(r===44){t[++n]=qe()===58?"&\f":"",e[n]=t[n].length;break}default:t[n]+=Zr(r)}while(r=Le());return t},Cm=function(t,e){return Pc(Am(Dc(t),e))},ac=new WeakMap,Sm=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var e=t.value,n=t.parent,r=t.column===n.column&&t.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(t.props.length===1&&e.charCodeAt(0)!==58&&!ac.get(n))&&!r){ac.set(t,!0);for(var a=[],i=Cm(e,a),o=n.props,s=0,l=0;s<i.length;s++)for(var d=0;d<o.length;d++,l++)t.props[l]=a[s]?i[s].replace(/&\f/g,o[d]):o[d]+" "+i[s]}}},Rm=function(t){if(t.type==="decl"){var e=t.value;e.charCodeAt(0)===108&&e.charCodeAt(2)===98&&(t.return="",t.value="")}};function Lc(t,e){switch(lm(t,e)){case 5103:return V+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return V+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return V+t+Wr+t+we+t+t;case 6828:case 4268:return V+t+we+t+t;case 6165:return V+t+we+"flex-"+t+t;case 5187:return V+t+$(t,/(\w+).+(:[^]+)/,V+"box-$1$2"+we+"flex-$1$2")+t;case 5443:return V+t+we+"flex-item-"+$(t,/flex-|-self/,"")+t;case 4675:return V+t+we+"flex-line-pack"+$(t,/align-content|flex-|-self/,"")+t;case 5548:return V+t+we+$(t,"shrink","negative")+t;case 5292:return V+t+we+$(t,"basis","preferred-size")+t;case 6060:return V+"box-"+$(t,"-grow","")+V+t+we+$(t,"grow","positive")+t;case 4554:return V+$(t,/([^-])(transform)/g,"$1"+V+"$2")+t;case 6187:return $($($(t,/(zoom-|grab)/,V+"$1"),/(image-set)/,V+"$1"),t,"")+t;case 5495:case 3959:return $(t,/(image-set\([^]*)/,V+"$1$`$1");case 4968:return $($(t,/(.+:)(flex-)?(.*)/,V+"box-pack:$3"+we+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+V+t+t;case 4095:case 3583:case 4068:case 2532:return $(t,/(.+)-inline(.+)/,V+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Fe(t)-1-e>6)switch(pe(t,e+1)){case 109:if(pe(t,e+4)!==45)break;case 102:return $(t,/(.+:)(.+)-([^]+)/,"$1"+V+"$2-$3$1"+Wr+(pe(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~io(t,"stretch")?Lc($(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(pe(t,e+1)!==115)break;case 6444:switch(pe(t,Fe(t)-3-(~io(t,"!important")&&10))){case 107:return $(t,":",":"+V)+t;case 101:return $(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+V+(pe(t,14)===45?"inline-":"")+"box$3$1"+V+"$2$3$1"+we+"$2box$3")+t}break;case 5936:switch(pe(t,e+11)){case 114:return V+t+we+$(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return V+t+we+$(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return V+t+we+$(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return V+t+we+t+t}return t}var Om=function(t,e,n,r){if(t.length>-1&&!t.return)switch(t.type){case bo:t.return=Lc(t.value,t.length);break;case Tc:return Ft([_n(t,{value:$(t.value,"@","@"+V)})],r);case wo:if(t.length)return um(t.props,function(a){switch(cm(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ft([_n(t,{props:[$(a,/:(read-\w+)/,":"+Wr+"$1")]})],r);case"::placeholder":return Ft([_n(t,{props:[$(a,/:(plac\w+)/,":"+V+"input-$1")]}),_n(t,{props:[$(a,/:(plac\w+)/,":"+Wr+"$1")]}),_n(t,{props:[$(a,/:(plac\w+)/,we+"input-$1")]})],r)}return""})}},Tm=[Om],km=function(t){var e=t.key;if(e==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(w){var A=w.getAttribute("data-emotion");A.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var r=t.stylisPlugins||Tm,a={},i,o=[];i=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+e+' "]'),function(w){for(var A=w.getAttribute("data-emotion").split(" "),R=1;R<A.length;R++)a[A[R]]=!0;o.push(w)});var s,l=[Sm,Rm];{var d,_=[ym,bm(function(w){d.insert(w)})],h=wm(l.concat(r,_)),p=function(w){return Ft(gm(w),h)};s=function(w,A,R,b){d=R,p(w?w+"{"+A.styles+"}":A.styles),b&&(f.inserted[A.name]=!0)}}var f={key:e,sheet:new rm({key:e,container:i,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:a,registered:{},insert:s};return f.sheet.hydrate(o),f};function xm(t){for(var e=0,n,r=0,a=t.length;a>=4;++r,a-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(a){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var Dm={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Pm=/[A-Z]|^ms/g,Lm=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Nc=function(t){return t.charCodeAt(1)===45},ic=function(t){return t!=null&&typeof t!="boolean"},$i=Em(function(t){return Nc(t)?t:t.replace(Pm,"-$&").toLowerCase()}),oc=function(t,e){switch(t){case"animation":case"animationName":if(typeof e=="string")return e.replace(Lm,function(n,r,a){return ht={name:r,styles:a,next:ht},r})}return Dm[t]!==1&&!Nc(t)&&typeof e=="number"&&e!==0?e+"px":e};function zr(t,e,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var a=n;if(a.anim===1)return ht={name:a.name,styles:a.styles,next:ht},a.name;var i=n;if(i.styles!==void 0){var o=i.next;if(o!==void 0)for(;o!==void 0;)ht={name:o.name,styles:o.styles,next:ht},o=o.next;var s=i.styles+";";return s}return Nm(t,e,n)}}var l=n;if(e==null)return l;var d=e[l];return d!==void 0?d:l}function Nm(t,e,n){var r="";if(Array.isArray(n))for(var a=0;a<n.length;a++)r+=zr(t,e,n[a])+";";else for(var i in n){var o=n[i];if(typeof o!="object"){var s=o;e!=null&&e[s]!==void 0?r+=i+"{"+e[s]+"}":ic(s)&&(r+=$i(i)+":"+oc(i,s)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(e==null||e[o[0]]===void 0))for(var l=0;l<o.length;l++)ic(o[l])&&(r+=$i(i)+":"+oc(i,o[l])+";");else{var d=zr(t,e,o);switch(i){case"animation":case"animationName":{r+=$i(i)+":"+d+";";break}default:r+=i+"{"+d+"}"}}}return r}var sc=/label:\s*([^\s;{]+)\s*(;|$)/g,ht;function Ki(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var r=!0,a="";ht=void 0;var i=t[0];if(i==null||i.raw===void 0)r=!1,a+=zr(n,e,i);else{var o=i;a+=o[0]}for(var s=1;s<t.length;s++)if(a+=zr(n,e,t[s]),r){var l=i;a+=l[s]}sc.lastIndex=0;for(var d="",_;(_=sc.exec(a))!==null;)d+="-"+_[1];var h=xm(a)+d;return{name:h,styles:a,next:ht}}function Uc(t,e,n){var r="";return n.split(" ").forEach(function(a){t[a]!==void 0?e.push(t[a]+";"):a&&(r+=a+" ")}),r}var Um=function(t,e,n){var r=t.key+"-"+e.name;t.registered[r]===void 0&&(t.registered[r]=e.styles)},Mm=function(t,e,n){Um(t,e);var r=t.key+"-"+e.name;if(t.inserted[e.name]===void 0){var a=e;do t.insert(e===a?"."+r:"",a,t.sheet,!0),a=a.next;while(a!==void 0)}};function lc(t,e){if(t.inserted[e.name]===void 0)return t.insert("",e,t.sheet,!0)}function cc(t,e,n){var r=[],a=Uc(t,r,n);return r.length<2?n:a+e(r)}var Bm=function(t){var e=km(t);e.sheet.speedy=function(o){this.isSpeedy=o},e.compat=!0;var n=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=Ki(s,e.registered,void 0);return Mm(e,d),e.key+"-"+d.name},r=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=Ki(s,e.registered),_="animation-"+d.name;return lc(e,{name:d.name,styles:"@keyframes "+_+"{"+d.styles+"}"}),_},a=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];var d=Ki(s,e.registered);lc(e,d)},i=function(){for(var o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return cc(e.registered,n,Gm(s))};return{css:n,cx:i,injectGlobal:a,keyframes:r,hydrate:function(o){o.forEach(function(s){e.inserted[s]=!0})},flush:function(){e.registered={},e.inserted={},e.sheet.flush()},sheet:e.sheet,cache:e,getRegisteredStyles:Uc.bind(null,e.registered),merge:cc.bind(null,e.registered,n)}},Gm=function t(e){for(var n="",r=0;r<e.length;r++){var a=e[r];if(a!=null){var i=void 0;switch(typeof a){case"boolean":break;case"object":{if(Array.isArray(a))i=t(a);else{i="";for(var o in a)a[o]&&o&&(i&&(i+=" "),i+=o)}break}default:i=a}i&&(n&&(n+=" "),n+=i)}}return n},Jm=Bm({key:"css"}),Ht=Jm.css,so,Pe,Wi,uc,dc=0,Mc=[],fe=B,fc=fe.__b,hc=fe.__r,mc=fe.diffed,pc=fe.__c,vc=fe.unmount,gc=fe.__;function Fm(t,e){fe.__h&&fe.__h(Pe,t,dc||e),dc=0;var n=Pe.__H||(Pe.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function Bc(t,e){var n=Fm(so++,7);return Hm(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function qm(){for(var t;t=Mc.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Vr),t.__H.__h.forEach(lo),t.__H.__h=[]}catch(e){t.__H.__h=[],fe.__e(e,t.__v)}}fe.__b=function(t){Pe=null,fc&&fc(t)},fe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),gc&&gc(t,e)},fe.__r=function(t){hc&&hc(t),so=0;var e=(Pe=t.__c).__H;e&&(Wi===Pe?(e.__h=[],Pe.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(Vr),e.__h.forEach(lo),e.__h=[],so=0)),Wi=Pe},fe.diffed=function(t){mc&&mc(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Mc.push(e)!==1&&uc===fe.requestAnimationFrame||((uc=fe.requestAnimationFrame)||jm)(qm)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Wi=Pe=null},fe.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Vr),n.__h=n.__h.filter(function(r){return!r.__||lo(r)})}catch(r){e.some(function(a){a.__h&&(a.__h=[])}),e=[],fe.__e(r,n.__v)}}),pc&&pc(t,e)},fe.unmount=function(t){vc&&vc(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Vr(r)}catch(a){e=a}}),n.__H=void 0,e&&fe.__e(e,n.__v))};var _c=typeof requestAnimationFrame=="function";function jm(t){var e,n=function(){clearTimeout(r),_c&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);_c&&(e=requestAnimationFrame(n))}function Vr(t){var e=Pe,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),Pe=e}function lo(t){var e=Pe;t.__c=t.__(),Pe=e}function Hm(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}var Vm=Symbol.for("preact-signals");function na(){if(mt>1)mt--;else{for(var t,e=!1;yn!==void 0;){var n=yn;for(yn=void 0,co++;n!==void 0;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Jc(n))try{n.c()}catch(a){e||(t=a,e=!0)}n=r}}if(co=0,mt--,e)throw t}}function Se(t){if(mt>0)return t();mt++;try{return t()}finally{na()}}var Q=void 0,yn=void 0,mt=0,co=0,Yr=0;function Gc(t){if(Q!==void 0){var e=t.n;if(e===void 0||e.t!==Q)return e={i:0,S:t,p:Q.s,n:void 0,t:Q,e:void 0,x:void 0,r:e},Q.s!==void 0&&(Q.s.n=e),Q.s=e,t.n=e,32&Q.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=Q.s,e.n=void 0,Q.s.n=e,Q.s=e),e}}function ve(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}ve.prototype.brand=Vm;ve.prototype.h=function(){return!0};ve.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};ve.prototype.U=function(t){if(this.t!==void 0){var e=t.e,n=t.x;e!==void 0&&(e.x=n,t.e=void 0),n!==void 0&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n)}};ve.prototype.subscribe=function(t){var e=this;return Rn(function(){var n=e.value,r=Q;Q=void 0;try{t(n)}finally{Q=r}})};ve.prototype.valueOf=function(){return this.value};ve.prototype.toString=function(){return this.value+""};ve.prototype.toJSON=function(){return this.value};ve.prototype.peek=function(){var t=Q;Q=void 0;try{return this.value}finally{Q=t}};Object.defineProperty(ve.prototype,"value",{get:function(){var t=Gc(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(co>100)throw new Error("Cycle detected");this.v=t,this.i++,Yr++,mt++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{na()}}}});function X(t){return new ve(t)}function Jc(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Fc(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function qc(t){for(var e=t.s,n=void 0;e!==void 0;){var r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}t.s=n}function Vt(t){ve.call(this,void 0),this.x=t,this.s=void 0,this.g=Yr-1,this.f=4}(Vt.prototype=new ve).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Yr))return!0;if(this.g=Yr,this.f|=1,this.i>0&&!Jc(this))return this.f&=-2,!0;var t=Q;try{Fc(this),Q=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Q=t,qc(this),this.f&=-2,!0};Vt.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}ve.prototype.S.call(this,t)};Vt.prototype.U=function(t){if(this.t!==void 0&&(ve.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Vt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Vt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Gc(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function wn(t){return new Vt(t)}function jc(t){var e=t.u;if(t.u=void 0,typeof e=="function"){mt++;var n=Q;Q=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,Io(t),r}finally{Q=n,na()}}}function Io(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,jc(t)}function $m(t){if(Q!==this)throw new Error("Out-of-order effect");qc(this),Q=t,this.f&=-2,8&this.f&&Io(this),na()}function Sn(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Sn.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Sn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,jc(this),Fc(this),mt++;var t=Q;return Q=this,$m.bind(this,t)};Sn.prototype.N=function(){2&this.f||(this.f|=2,this.o=yn,yn=this)};Sn.prototype.d=function(){this.f|=8,1&this.f||Io(this)};function Rn(t){var e=new Sn(t);try{e.c()}catch(n){throw e.d(),n}return e.d.bind(e)}var Hc,zi,Vc=[];Rn(function(){Hc=this.N})();function $t(t,e){B[t]=e.bind(null,B[t]||function(){})}function Qr(t){zi&&zi(),zi=t&&t.S()}function $c(t){var e=this,n=t.data,r=Kc(n);r.value=n;var a=Bc(function(){for(var s=e,l=e.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var d=wn(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=wn(function(){return!Array.isArray(d.value)&&!Di(d.value)}),h=Rn(function(){if(this.N=Wc,_.value){var f=d.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),p=e.__$u.d;return e.__$u.d=function(){h(),p.call(this)},[_,d]},[]),i=a[0],o=a[1];return i.value?o.peek():o.value}$c.displayName="_st";Object.defineProperties(ve.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:$c},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});$t("__b",function(t,e){if(typeof e.type=="string"){var n,r=e.props;for(var a in r)if(a!=="children"){var i=r[a];i instanceof ve&&(n||(e.__np=n={}),n[a]=i,r[a]=i.peek())}}t(e)});$t("__r",function(t,e){Qr();var n,r=e.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(a){var i;return Rn(function(){i=this}),i.c=function(){r.__$f|=1,r.setState({})},i}())),Qr(n),t(e)});$t("__e",function(t,e,n,r){Qr(),t(e,n,r)});$t("diffed",function(t,e){Qr();var n;if(typeof e.type=="string"&&(n=e.__e)){var r=e.__np,a=e.props;if(r){var i=n.U;if(i)for(var o in i){var s=i[o];s!==void 0&&!(o in r)&&(s.d(),i[o]=void 0)}else i={},n.U=i;for(var l in r){var d=i[l],_=r[l];d===void 0?(d=Km(n,l,_,a),i[l]=d):d.o(_,a)}}}t(e)});function Km(t,e,n,r){var a=e in t&&t.ownerSVGElement===void 0,i=X(n);return{o:function(o,s){i.value=o,r=s},d:Rn(function(){this.N=Wc;var o=i.value.value;r[e]!==o&&(r[e]=o,a?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}$t("unmount",function(t,e){if(typeof e.type=="string"){var n=e.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var a in r){var i=r[a];i&&i.d()}}}}else{var o=e.__c;if(o){var s=o.__$u;s&&(o.__$u=void 0,s.d())}}t(e)});$t("__h",function(t,e,n,r){(r<3||r===9)&&(e.__$f|=2),t(e,n,r)});De.prototype.shouldComponentUpdate=function(t,e){var n=this.__$u,r=n&&n.s!==void 0;for(var a in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var i=2&this.__$f;if(!(r||i||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function Kc(t){return Bc(function(){return X(t)},[])}var Wm=function(t){queueMicrotask(function(){queueMicrotask(t)})};function zm(){Se(function(){for(var t;t=Vc.shift();)Hc.call(t)})}function Wc(){Vc.push(this)===1&&(B.requestAnimationFrame||Wm)(zm)}var be=Ht`
4
4
  inset: 0;
5
5
  clear: none;
6
6
  float: none;
@@ -18,7 +18,7 @@ or `);this.errors.push(i)}return r}},lr=class extends de{constructor(...t){super
18
18
  text-decoration: none;
19
19
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
20
20
  'Helvetica Neue', sans-serif;
21
- `;function ap(e,t){let n=Vi(e);ji(()=>{n.current=e},[e]),pn(()=>{if(t===null)return;let r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}var ip=0;function le(e,t,n,r,a,i){t||(t={});var o,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?o=t[s]:l[s]=t[s];var d={type:e,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ip,__i:-1,__u:0,__source:a,__self:i};if(typeof e=="function"&&(o=e.defaultProps))for(s in o)l[s]===void 0&&(l[s]=o[s]);return M.vnode&&M.vnode(d),d}var op=$t`
21
+ `;function Ym(t,e){let n=Ji(t);Gi(()=>{n.current=t},[t]),mn(()=>{if(e===null)return;let r=setInterval(()=>{n.current()},e);return()=>{clearInterval(r)}},[e])}var Qm=0;function le(t,e,n,r,a,i){e||(e={});var o,s,l=e;if("ref"in l)for(s in l={},e)s=="ref"?o=e[s]:l[s]=e[s];var d={type:t,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Qm,__i:-1,__u:0,__source:a,__self:i};if(typeof t=="function"&&(o=t.defaultProps))for(s in o)l[s]===void 0&&(l[s]=o[s]);return B.vnode&&B.vnode(d),d}var Xm=Ht`
22
22
  ${be}
23
23
  position: fixed;
24
24
  top: 0;
@@ -93,7 +93,7 @@ or `);this.errors.push(i)}return r}},lr=class extends de{constructor(...t){super
93
93
  }
94
94
  }
95
95
  }
96
- `,st=Z(null),vo=Z(""),go=Z(""),Wr=Z(!1),sp=()=>{var e;(e=st.value)==null||e.call(st,!1)},lp=()=>{var e;(e=st.value)==null||e.call(st,!0)},cp=e=>I(void 0,null,function*(){let{title:t,content:n}=e;return st.value&&(st.value(!1),Oe(()=>{st.value=null,Wr.value=!1})),Oe(()=>{vo.value=t||"",go.value=n||"",Wr.value=!0}),new Promise(r=>{st.value=a=>{Oe(()=>{st.value=null,Wr.value=!1,vo.value="",go.value=""}),r(a)}})}),up=()=>Wr.value?le("div",{className:op,children:le("div",{className:"card-wrapper",children:[le("div",{className:"body",children:[le("div",{className:"title",children:vo.value}),le("div",{className:"content",children:go.value})]}),le("div",{className:"footer",children:[le("button",{onClick:sp,className:"cancel-btn",children:"Cancel"}),le("button",{onClick:lp,className:"confirm-btm",children:"Confirm"})]})]})}):null,dp=$t`
96
+ `,at=X(null),uo=X(""),fo=X(""),$r=X(!1),Zm=()=>{var t;(t=at.value)==null||t.call(at,!1)},ep=()=>{var t;(t=at.value)==null||t.call(at,!0)},tp=t=>I(void 0,null,function*(){let{title:e,content:n}=t;return at.value&&(at.value(!1),Se(()=>{at.value=null,$r.value=!1})),Se(()=>{uo.value=e||"",fo.value=n||"",$r.value=!0}),new Promise(r=>{at.value=a=>{Se(()=>{at.value=null,$r.value=!1,uo.value="",fo.value=""}),r(a)}})}),np=()=>$r.value?le("div",{className:Xm,children:le("div",{className:"card-wrapper",children:[le("div",{className:"body",children:[le("div",{className:"title",children:uo.value}),le("div",{className:"content",children:fo.value})]}),le("div",{className:"footer",children:[le("button",{onClick:Zm,className:"cancel-btn",children:"Cancel"}),le("button",{onClick:ep,className:"confirm-btm",children:"Confirm"})]})]})}):null,rp=Ht`
97
97
  ${be}
98
98
  position: relative;
99
99
  display: flex;
@@ -126,7 +126,7 @@ or `);this.errors.push(i)}return r}},lr=class extends de{constructor(...t){super
126
126
  cursor: not-allowed;
127
127
  }
128
128
  }
129
- `,fp=()=>{let e=Z(!1),t=Z(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{Oe(()=>{t.value=Date.now(),e.value=!1})}}},hp=e=>{let{countdown:t=0,mode:n,onClose:r,state:a}=e,{startTimestamp:i,timerPaused:o}=a,s=Zc(t);ap(()=>{s.value>0?s.value-=1:Oe(()=>{o.value=!0,s.value=0})},o.value?null:1e3);let l=bn(()=>{if(n==="interstitial"||n==="rewarded_insterstitial"||!i.value)return!1;let f=Date.now()-i.value;return s.value>0&&t-s.value>=5&&f>=5e3}),d=bn(()=>{if(n==="interstitial")return!0;if(!i.value)return!1;let f=Date.now()-i.value;return s.value<=0&&f>=(t-1)*1e3&&t>5}),_=bn(()=>n==="interstitial"?!1:!l.value&&!d.value),h=()=>I(void 0,null,function*(){if(o.value=!0,!(yield cp({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){o.value=!1;return}r("dismiss"),Oe(()=>{o.value=!0,s.value=0,i.value=null})}),p=()=>{r("viewed"),Oe(()=>{o.value=!0,s.value=0,i.value=null})};return le("div",{className:dp,children:[s.value>0&&n!=="interstitial"&&le("div",{className:"timer",children:[s.value,"s"]}),le("button",{onClick:l.value?h:d.value?p:void 0,disabled:_.value,children:le("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:le("path",{d:"M13.3 0.710215C12.91 0.320215 12.28 0.320215 11.89 0.710215L6.99997 5.59022L2.10997 0.700215C1.71997 0.310215 1.08997 0.310215 0.699971 0.700215C0.309971 1.09021 0.309971 1.72022 0.699971 2.11022L5.58997 7.00022L0.699971 11.8902C0.309971 12.2802 0.309971 12.9102 0.699971 13.3002C1.08997 13.6902 1.71997 13.6902 2.10997 13.3002L6.99997 8.41021L11.89 13.3002C12.28 13.6902 12.91 13.6902 13.3 13.3002C13.69 12.9102 13.69 12.2802 13.3 11.8902L8.40997 7.00022L13.3 2.11022C13.68 1.73022 13.68 1.09022 13.3 0.710215Z",fill:"white"})})})]})},mp=()=>{let e=Z(),t=Z(),n=Z(),r=Z(),a=Z(),i=Z(!1),o=Z(15),s=Z(""),l=Z("reward");return{afterAd:e,adDismissed:t,adViewed:n,adBreakDone:r,adLoaded:a,visible:i,countdown:o,src:s,mode:l}},pp=$t`
129
+ `,ap=()=>{let t=X(!1),e=X(null);return{timerPaused:t,startTimestamp:e,startTimer:()=>{Se(()=>{e.value=Date.now(),t.value=!1})}}},ip=t=>{let{countdown:e=0,mode:n,onClose:r,state:a}=t,{startTimestamp:i,timerPaused:o}=a,s=Kc(e);Ym(()=>{s.value>0?s.value-=1:Se(()=>{o.value=!0,s.value=0})},o.value?null:1e3);let l=wn(()=>{if(n==="interstitial"||n==="rewarded_insterstitial"||!i.value)return!1;let f=Date.now()-i.value;return s.value>0&&e-s.value>=5&&f>=5e3}),d=wn(()=>{if(n==="interstitial")return!0;if(!i.value)return!1;let f=Date.now()-i.value;return s.value<=0&&f>=(e-1)*1e3&&e>5}),_=wn(()=>n==="interstitial"?!1:!l.value&&!d.value),h=()=>I(void 0,null,function*(){if(o.value=!0,!(yield tp({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){o.value=!1;return}r("dismiss"),Se(()=>{o.value=!0,s.value=0,i.value=null})}),p=()=>{r("viewed"),Se(()=>{o.value=!0,s.value=0,i.value=null})};return le("div",{className:rp,children:[s.value>0&&n!=="interstitial"&&le("div",{className:"timer",children:[s.value,"s"]}),le("button",{onClick:l.value?h:d.value?p:void 0,disabled:_.value,children:le("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:le("path",{d:"M13.3 0.710215C12.91 0.320215 12.28 0.320215 11.89 0.710215L6.99997 5.59022L2.10997 0.700215C1.71997 0.310215 1.08997 0.310215 0.699971 0.700215C0.309971 1.09021 0.309971 1.72022 0.699971 2.11022L5.58997 7.00022L0.699971 11.8902C0.309971 12.2802 0.309971 12.9102 0.699971 13.3002C1.08997 13.6902 1.71997 13.6902 2.10997 13.3002L6.99997 8.41021L11.89 13.3002C12.28 13.6902 12.91 13.6902 13.3 13.3002C13.69 12.9102 13.69 12.2802 13.3 11.8902L8.40997 7.00022L13.3 2.11022C13.68 1.73022 13.68 1.09022 13.3 0.710215Z",fill:"white"})})})]})},op=()=>{let t=X(),e=X(),n=X(),r=X(),a=X(),i=X(!1),o=X(15),s=X(""),l=X("reward");return{afterAd:t,adDismissed:e,adViewed:n,adBreakDone:r,adLoaded:a,visible:i,countdown:o,src:s,mode:l}},sp=Ht`
130
130
  ${be}
131
131
  position: fixed;
132
132
  z-index: 2147483647;
@@ -145,7 +145,7 @@ or `);this.errors.push(i)}return r}},lr=class extends de{constructor(...t){super
145
145
  width: 100%;
146
146
  height: 100%;
147
147
  }
148
- `,vp=e=>{let{state:t}=e,{afterAd:n,adDismissed:r,adViewed:a,adBreakDone:i,adLoaded:o,visible:s,countdown:l,src:d,mode:_}=t,h=vn(()=>fp(),[]),[p,f]=Br(!1),w=C=>{var b,x,D,H;s.value=!1,C==="dismiss"?(b=r.value)==null||b.call(r):C==="viewed"&&((x=a.value)==null||x.call(a)),(D=n.value)==null||D.call(n),(H=i.value)==null||H.call(i),f(!1)},A=$i(()=>{var C;p||(f(!0),(C=o.value)==null||C.call(o))},[p]);return pn(()=>{p&&(_.value==="reward"||_.value==="rewarded_insterstitial")&&setTimeout(()=>{h.startTimer()},100)},[p,_.value]),s.value?le("div",{className:pp,children:[le(hp,{mode:_.value,onClose:w,countdown:l.value,state:h}),s.value&&le("iframe",{src:d.value,onLoad:A,sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"}),le(up,{})]}):null};function it(e,t,n){return(t=gp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gp(e){var t=_p(e,"string");return typeof t=="symbol"?t:t+""}function _p(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var _o=class{constructor(t,n){it(this,"name","OKSPIN"),it(this,"initialized",!1),it(this,"initCompleter",null),it(this,"context",void 0),it(this,"initParams",void 0),it(this,"adsOverlay",null),it(this,"adsIsShowing",!1),it(this,"lastUnDisplayedAdBreak",null),it(this,"state",mp()),this.context=t,this.initParams=n}init(){return I(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),zi(le(vp,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var n;if(this.initialized){(n=t.onReady)==null||n.call(t);return}this.initCompleter=()=>{var r;(r=t.onReady)==null||r.call(t)}}adBreak(t,n){return I(this,null,function*(){var r,a,i,o,s,l,d,_;if(!this.initialized||!this.adsOverlay||!n.params.url){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}switch(t.type){case"preroll":{(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=t.beforeAd)==null||o.call(t);let h=()=>{var f;this.adsIsShowing=!1,(f=t.afterAd)==null||f.call(t)},p=()=>{var f;this.adsIsShowing=!1,(f=t.adBreakDone)==null||f.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})};Oe(()=>{this.adsIsShowing=!0,this.state.afterAd.value=h,this.state.adBreakDone.value=p,this.state.src.value=n.params.url,this.state.mode.value="interstitial",this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(d=t.beforeAd)==null||d.call(t);let h=()=>{var b;this.adsIsShowing=!1,(b=t.afterAd)==null||b.call(t)},p={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},f=()=>{var b;this.adsIsShowing=!1,p.breakStatus="dismissed",(b=t.adDismissed)==null||b.call(t)},w=()=>{var b;this.adsIsShowing=!1,p.breakStatus="viewed",(b=t.adViewed)==null||b.call(t)},A=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,p)};Oe(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=f,this.state.adViewed.value=w,this.state.adBreakDone.value=A});let C=()=>{var b;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,Oe(()=>{var x;this.state.countdown.value=(x=n.params.countdown)!=null?x:15,this.state.src.value=n.params.url,this.state.mode.value="reward",this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(_=t.beforeReward)==null||_.call(t,C);break}}})}},Ht={};window.addEventListener("message",e=>{e.origin!=="https://ads.appsrockets.com"&&e.origin!=="https://stg-ads.appsrockets.com"||Ht[e.data.type]&&Ht[e.data.type].forEach(t=>{t(e.data.data)})});var Jt=(e,t)=>{pn(()=>(Ht[e]||(Ht[e]=new Set),Ht[e].add(t),()=>{Ht[e].delete(t)}),[e,t])},yp=()=>{let e=Z(),t=Z(),n=Z(),r=Z(),a=Z(),i=Z(),o=Z(),s=Z(!1),l=Z("");return{afterAd:e,adDismissed:t,adViewed:n,adBreakDone:r,adLoaded:a,adLinkClicked:i,adError:o,visible:s,src:l}},wp=$t`
148
+ `,lp=t=>{let{state:e}=t,{afterAd:n,adDismissed:r,adViewed:a,adBreakDone:i,adLoaded:o,visible:s,countdown:l,src:d,mode:_}=e,h=pn(()=>ap(),[]),[p,f]=Ur(!1),w=R=>{var b,x,L,F;s.value=!1,R==="dismiss"?(b=r.value)==null||b.call(r):R==="viewed"&&((x=a.value)==null||x.call(a)),(L=n.value)==null||L.call(n),(F=i.value)==null||F.call(i),f(!1)},A=Fi(()=>{var R;p||(f(!0),(R=o.value)==null||R.call(o))},[p]);return mn(()=>{p&&(_.value==="reward"||_.value==="rewarded_insterstitial")&&setTimeout(()=>{h.startTimer()},100)},[p,_.value]),s.value?le("div",{className:sp,children:[le(ip,{mode:_.value,onClose:w,countdown:l.value,state:h}),s.value&&le("iframe",{src:d.value,onLoad:A,sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"}),le(np,{})]}):null};function nt(t,e,n){return(e=cp(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cp(t){var e=up(t,"string");return typeof e=="symbol"?e:e+""}function up(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ho=class{constructor(e,n){nt(this,"name","OKSPIN"),nt(this,"initialized",!1),nt(this,"initCompleter",null),nt(this,"context",void 0),nt(this,"initParams",void 0),nt(this,"adsOverlay",null),nt(this,"adsIsShowing",!1),nt(this,"lastUnDisplayedAdBreak",null),nt(this,"state",op()),this.context=e,this.initParams=n}init(){return I(this,null,function*(){var e;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),Hi(le(lp,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(e=this.initCompleter)==null||e.call(this)})}adConfig(e){var n;if(this.initialized){(n=e.onReady)==null||n.call(e);return}this.initCompleter=()=>{var r;(r=e.onReady)==null||r.call(e)}}adBreak(e,n){return I(this,null,function*(){var r,a,i,o,s,l,d,_;if(!this.initialized||!this.adsOverlay||!n.params.url){(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}switch(e.type){case"preroll":{(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=e.beforeAd)==null||o.call(e);let h=()=>{var f;this.adsIsShowing=!1,(f=e.afterAd)==null||f.call(e)},p=()=>{var f;this.adsIsShowing=!1,(f=e.adBreakDone)==null||f.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"viewed"})};Se(()=>{this.adsIsShowing=!0,this.state.afterAd.value=h,this.state.adBreakDone.value=p,this.state.src.value=n.params.url,this.state.mode.value="interstitial",this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(d=e.beforeAd)==null||d.call(e);let h=()=>{var b;this.adsIsShowing=!1,(b=e.afterAd)==null||b.call(e)},p={breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"ignored"},f=()=>{var b;this.adsIsShowing=!1,p.breakStatus="dismissed",(b=e.adDismissed)==null||b.call(e)},w=()=>{var b;this.adsIsShowing=!1,p.breakStatus="viewed",(b=e.adViewed)==null||b.call(e)},A=()=>{var b;this.adsIsShowing=!1,(b=e.adBreakDone)==null||b.call(e,p)};Se(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=f,this.state.adViewed.value=w,this.state.adBreakDone.value=A});let R=()=>{var b;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(b=e.adBreakDone)==null||b.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,Se(()=>{var x;this.state.countdown.value=(x=n.params.countdown)!=null?x:15,this.state.src.value=n.params.url,this.state.mode.value="reward",this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=e,(_=e.beforeReward)==null||_.call(e,R);break}}})}},Jt={};window.addEventListener("message",t=>{t.origin!=="https://ads.appsrockets.com"&&t.origin!=="https://stg-ads.appsrockets.com"||Jt[t.data.type]&&Jt[t.data.type].forEach(e=>{e(t.data.data)})});var Bt=(t,e)=>{mn(()=>(Jt[t]||(Jt[t]=new Set),Jt[t].add(e),()=>{Jt[t].delete(e)}),[t,e])},dp=()=>{let t=X(),e=X(),n=X(),r=X(),a=X(),i=X(),o=X(),s=X(!1),l=X("");return{afterAd:t,adDismissed:e,adViewed:n,adBreakDone:r,adLoaded:a,adLinkClicked:i,adError:o,visible:s,src:l}},fp=Ht`
149
149
  ${be}
150
150
  position: fixed;
151
151
  z-index: 2147483647;
@@ -164,7 +164,7 @@ or `);this.errors.push(i)}return r}},lr=class extends de{constructor(...t){super
164
164
  width: 100%;
165
165
  height: 100%;
166
166
  }
167
- `,bp=e=>{let{state:t}=e,{afterAd:n,adDismissed:r,adViewed:a,adBreakDone:i,adLoaded:o,adLinkClicked:s,visible:l,src:d}=t,[_,h]=Br(!1),p=w=>{var A,C,b,x;h(!1),l.value=!1,w==="dismiss"?(A=r.value)==null||A.call(r):w==="viewed"&&((C=a.value)==null||C.call(a)),(b=n.value)==null||b.call(n),(x=i.value)==null||x.call(i)},f=()=>{var w;(w=o.value)==null||w.call(o)};return Jt("appsrockets_ad_dismissed",()=>p("dismiss")),Jt("appsrockets_ad_rewarded",()=>p("viewed")),Jt("appsrockets_ad_completed",()=>p("viewed")),Jt("appsrockets_ad_skipped",()=>p("viewed")),Jt("appsrockets_ad_clicked",w=>{var A;return(A=s.value)==null?void 0:A.call(s,w)}),Jt("appsrockets_ad_loaded",()=>h(!0)),l.value?le("div",{className:wp,style:{display:_?"flex":"none"},children:l.value&&le("iframe",{src:d.value,onLoad:f,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};function ot(e,t,n){return(t=Ep(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ep(e){var t=Ip(e,"string");return typeof t=="symbol"?t:t+""}function Ip(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var yo=class{constructor(t,n){ot(this,"name","APPSROCKETS"),ot(this,"initialized",!1),ot(this,"initCompleter",null),ot(this,"context",void 0),ot(this,"adsOverlay",null),ot(this,"adsIsShowing",!1),ot(this,"lastUnDisplayedAdBreak",null),ot(this,"state",yp()),ot(this,"processUrl",r=>{var a;let i=this.context.getContextInfo(),o=new URL(r),s=new URLSearchParams(o.search);return s.has("joliSource")||s.set("joliSource",i.joliSource),s.get("osType")||s.set("osType",i.osType),s.get("runtimeType")||s.set("runtimeType",i.runtimeType),s.get("mode")||s.set("mode","AFG"),s.get("deviceId")||s.set("deviceId",i.deviceId),s.get("statusBarHeight")||s.set("statusBarHeight",((a=this.context.getWindowInfo().statusBarHeight)!=null?a:0).toString()),o.search=s.toString(),o.toString()}),this.context=t}init(){return I(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),zi(le(bp,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var n;if(this.initialized){(n=t.onReady)==null||n.call(t);return}this.initCompleter=()=>{var r;(r=t.onReady)==null||r.call(t)}}adBreak(t,n){var r,a,i,o,s,l,d,_;if(!this.initialized||!this.adsOverlay||!n.params.url){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let h=p=>{var f,w;(w=(f=this.context).handleLinkClicked)==null||w.call(f,p)};switch(t.type){case"preroll":{(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=t.beforeAd)==null||o.call(t);let p=()=>{var A;this.adsIsShowing=!1,(A=t.afterAd)==null||A.call(t)},f=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},w=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};Oe(()=>{this.adsIsShowing=!0,this.state.afterAd.value=p,this.state.adBreakDone.value=f,this.state.src.value=this.processUrl(n.params.url),this.state.adLinkClicked.value=h,this.state.adError.value=w,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(d=t.beforeAd)==null||d.call(t);let p=()=>{var D;this.adsIsShowing=!1,(D=t.afterAd)==null||D.call(t)},f={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},w=()=>{var D;this.adsIsShowing=!1,f.breakStatus="dismissed",(D=t.adDismissed)==null||D.call(t)},A=()=>{var D;this.adsIsShowing=!1,f.breakStatus="viewed",(D=t.adViewed)==null||D.call(t)},C=()=>{var D;this.adsIsShowing=!1,(D=t.adBreakDone)==null||D.call(t,f)},b=()=>{this.adsIsShowing=!1,f.breakStatus="noAdPreloaded"};Oe(()=>{this.state.afterAd.value=p,this.state.adDismissed.value=w,this.state.adViewed.value=A,this.state.adBreakDone.value=C,this.state.adLinkClicked.value=h,this.state.adError.value=b});let x=()=>{var D;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(D=t.adBreakDone)==null||D.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,Oe(()=>{this.state.src.value=this.processUrl(n.params.url),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(_=t.beforeReward)==null||_.call(t,x);break}}}},tu=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function ye(e,t,n){return(t=Ap(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ap(e){var t=Sp(e,"string");return typeof t=="symbol"?t:t+""}function Sp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wo=class{constructor(t,n,r){ye(this,"adUnit",void 0),ye(this,"project",void 0),ye(this,"keyValue",void 0),ye(this,"adsContext",null),ye(this,"rewardedSlot",null),ye(this,"rewardedPayload",null),ye(this,"readyEvent",null),ye(this,"withCommand",function(){googletag.cmd.push(...arguments)}),ye(this,"init",()=>{var a;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(i=>{var o;(o=this.rewardedSlot)==null||o.setTargeting(i,this.keyValue[i])}),Object.keys(this.keyValue).includes("project")||(a=this.rewardedSlot)==null||a.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),ye(this,"destroy",a=>{var i,o;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,a),this.adsContext=null}),ye(this,"reinit",a=>{this.destroy(a),this.init()}),ye(this,"handleSlotReady",a=>{a.slot===this.rewardedSlot&&(this.readyEvent=a)}),ye(this,"handleSlotClosed",a=>{var i,o;if(this.adsContext&&a.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(i=this.adsContext).afterAd)==null||o.call(i),this.withCommand(()=>{this.reinit(s)})}}),ye(this,"handleSlotGranted",a=>{this.adsContext&&a.slot===this.rewardedSlot&&(this.rewardedPayload=a.payload)}),ye(this,"handleSlotRenderEnded",a=>{a.slot===this.rewardedSlot&&a.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),ye(this,"requestAds",a=>{this.withCommand(()=>{if(this.adsContext&&this.reinit("ignored"),this.rewardedSlot||this.init(),this.adsContext=a,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,o,s;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let i=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=o,this.adsContext.beforeReward(()=>{var s,l,d;(l=(s=this.adsContext)==null?void 0:s.beforeAd)==null||l.call(s),(d=this.readyEvent)==null||d.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=t,this.project=n,this.keyValue=r,tu(),this.withCommand(()=>{this.init()})}};function Re(e,t,n){return(t=Cp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cp(e){var t=Rp(e,"string");return typeof t=="symbol"?t:t+""}function Rp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var bo=class{constructor(t,n,r){var a=this;Re(this,"adUnit",void 0),Re(this,"project",void 0),Re(this,"keyValue",void 0),Re(this,"adsContext",null),Re(this,"gamingInterstitialSlot",null),Re(this,"readyEvent",null),Re(this,"isRetrying",!1),Re(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Re(this,"init",()=>{var i;this.gamingInterstitialSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL),this.gamingInterstitialSlot&&(this.gamingInterstitialSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("gameManualInterstitialSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("gameManualInterstitialSlotClosed",this.handleSlotClosed),this.keyValue&&(Object.keys(this.keyValue).forEach(o=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(i=this.gamingInterstitialSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),Re(this,"destroy",function(i){var o,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(o=a.adsContext)==null?void 0:o.onEnd)==null||s.call(o,i),a.adsContext=null),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",a.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",a.handleSlotClosed),a.gamingInterstitialSlot&&(googletag.destroySlots([a.gamingInterstitialSlot]),a.gamingInterstitialSlot=null,a.readyEvent=null)}),Re(this,"reinit",function(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a.destroy(i,o),a.init()}),Re(this,"handleSlotReady",i=>{this.gamingInterstitialSlot===i.slot&&(this.readyEvent=i)}),Re(this,"handleSlotClosed",i=>{var o,s;this.adsContext&&this.gamingInterstitialSlot===i.slot&&((s=(o=this.adsContext).afterAd)==null||s.call(o),this.withCommand(()=>{this.reinit("viewed")}))}),Re(this,"requestAds",i=>{this.withCommand(()=>{var o,s,l;if(this.adsContext&&this.reinit("ignored"),this.gamingInterstitialSlot||this.init(),this.adsContext=i,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((o=i.beforeAd)==null||o.call(i),this.readyEvent.makeGameManualInterstitialVisible()):((l=(s=this.adsContext).onEnd)==null||l.call(s,"frequencyCapped"),this.adsContext=null,this.isRetrying||(this.isRetrying=!0,window.setTimeout(()=>{this.readyEvent||this.withCommand(()=>{this.reinit("frequencyCapped",!1)}),this.isRetrying=!1},31e3)))})}),tu(),this.adUnit=t,this.project=n,this.keyValue=r,this.withCommand(()=>{this.init()})}};function Et(e,t,n){return(t=Op(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Op(e){var t=kp(e,"string");return typeof t=="symbol"?t:t+""}function kp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Eo=class{constructor(t,n){Et(this,"name","GOOGLE_GPT"),Et(this,"context",void 0),Et(this,"contextInfo",void 0),Et(this,"initParams",void 0),Et(this,"rewardAdManager",void 0),Et(this,"interstitialManager",void 0),Et(this,"insertScript",()=>{let r="jolibox-google-gpt",a=document.getElementById(r);a||(a=window.document.createElement("script"),a.id=r,a.async=!0,a.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",a.crossOrigin="anonymous",document.head.appendChild(a))}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=n,this.insertScript()}init(){return I(this,null,function*(){let t=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,n=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,r=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;t&&(this.rewardAdManager=new wo(t,r,this.initParams.keyValue)),n&&(this.interstitialManager=new bo(n,r,this.initParams.keyValue))})}adConfig(t,n){}adBreak(t,n){var r,a,i;switch(t.type){case"preroll":{(r=t.adBreakDone)==null||r.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o})}});break}default:{if(!this.interstitialManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:o=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:o})}});break}}}};function to(e,t,n){return(t=Tp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tp(e){var t=xp(e,"string");return typeof t=="symbol"?t:t+""}function xp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Io=class{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";to(this,"context",void 0),to(this,"placement","GAME"),to(this,"contextInfo",void 0),this.context=t,this.placement=n,this.contextInfo=this.context.getContextInfo()}getLocation(){let t=new URLSearchParams(window.location.search),n={};return t.forEach((r,a)=>{n[a]=r}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:n}}getDevice(){var t,n,r,a;return{platform:(t=this.contextInfo.platform)!=null?t:Pc.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(n=this.contextInfo.hostAppId)!=null?n:"1",model:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",brand:(a=this.contextInfo.deviceBrand)!=null?a:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,n){var r;let a={protocolVersion:"1.0.0",events:[{name:t,type:Tc.System,location:this.getLocation(),target:null,extra:n,timestamp:Date.now(),userId:(r=this.contextInfo.userId)!=null?r:null}],device:this.getDevice(),project:xc.WebSDK};return jh(a)}};function Ae(e,t,n){return(t=Pp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pp(e){var t=Lp(e,"string");return typeof t=="symbol"?t:t+""}function Lp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zr=class{constructor(t){Ae(this,"context",void 0),Ae(this,"adsTrackSerializer",void 0),Ae(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new Io(this.context)}getRequestContextData(t){var n,r;this.contextInfo=this.context.getContextInfo();let{width:a,height:i}=this.context.getWindowInfo();return{report:JSON.stringify(this.adsTrackSerializer.serialize(t,{sessionId:this.contextInfo.sessionId,objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId,testAdsMode:this.contextInfo.testAdsMode})),osType:this.contextInfo.osType,runtimeType:this.contextInfo.runtimeType,sessionId:this.contextInfo.sessionId,deviceId:this.contextInfo.deviceId,adId:this.contextInfo.adId,deviceModel:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",deviceBrand:(r=this.contextInfo.deviceBrand)!=null?r:"UnknownBrand",dimension:{width:a,height:i}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},Ao=class{constructor(t,n){var r=this;Ae(this,"context",void 0),Ae(this,"contextInfo",void 0),Ae(this,"requestContext",void 0),Ae(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Ae(this,"pendingAFVAdsInfo",Promise.resolve(null)),Ae(this,"doFetchAdsInfo",a=>I(this,null,function*(){let i=a==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",o=a==="afv"?"REWARD_INTERSTITIAL":a==="reward"?"REWARD":"INTERSTITIAL",s=a==="afv"?void 0:"cached",{data:l,code:d}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(i),bizParams:this.requestContext.getRequestBizParams(),adsType:o,testAdsMode:this.contextInfo.testAdsMode,name:s}});return d==="SUCCESS"||d==="BYPASS_ADS"?{code:d,data:l}:null})),Ae(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Ae(this,"cacheInterstitialInfo",a=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(a).catch(()=>null)}),Ae(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Ae(this,"cacheNextAFGAdsInfo",a=>I(this,null,function*(){a==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(a)})),Ae(this,"getAFGAdsInfo",a=>I(this,null,function*(){let i=yield a==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(a),i})),Ae(this,"getAFVAdsInfo",function(){return I(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let a=yield r.pendingAFVAdsInfo;return r.cacheAFVInfo(),a}else return r.cacheAFVInfo(),yield r.pendingAFVAdsInfo})}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.requestContext=new Zr(t),n!=null&&n.reward&&this.cacheRewardInfo(),n!=null&&n.interstitial&&this.cacheInterstitialInfo("start"),n!=null&&n.afv&&this.cacheAFVInfo()}};function Fe(e,t,n){return(t=Dp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dp(e){var t=Np(e,"string");return typeof t=="symbol"?t:t+""}function Np(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Sn=class{constructor(t){if(Fe(this,"context",void 0),Fe(this,"contextInfo",void 0),Fe(this,"providers",{}),Fe(this,"channelPolicy",void 0),Fe(this,"adsActionDetection",void 0),Fe(this,"requestContext",void 0),Fe(this,"adsRequest",void 0),Fe(this,"initialized",!1),Fe(this,"adsIsShowing",!1),Fe(this,"lastAdBreak",void 0),Fe(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new lo(this.context),this.adsActionDetection=new so(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new Ao(t),this.requestContext=new Zr(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return I(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:n}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((n==null?void 0:n.length)>0)for(let r of n)switch(r.provider){case"GOOGLE_GPT":{let a=new Eo(this.context,r.params);yield a.init(),this.providers[r.provider]=a;break}case"ADSENSE":case"ADSENSE_ADMOB":{let a=new co(this.context,r.params);yield a.init(),this.providers[r.provider]=a;break}case"OKSPIN":{let a=new _o(this.context,r.params);yield a.init(),this.providers.OKSPIN=a;break}case"APPSROCKETS":{let a=new yo(this.context,r.params);yield a.init(),this.providers.APPSROCKETS=a;break}}this.adsRequest.cacheInterstitialInfo("start"),this.adsRequest.cacheRewardInfo(),this.initialized=!0})}adConfig(t){this.providers.ADSENSE?this.providers.ADSENSE.adConfig(t):window.adsbygoogle.push(t)}adBreak(t){return I(this,null,function*(){var n,r,a,i,o,s,l,d,_,h,p,f,w,A;let C=Date.now();if(C-this.initializedTimeStamp<3e3){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}if(this.lastAdBreak&&C-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads] You can't call adBreak too frequently"),(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.lastAdBreak=C,this.adsIsShowing){console.warn("[Jolibox SDK Ads] You can't call adBreak while ad is showing"),(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.initialized||(yield this.init()),t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let b=yield this.adsRequest.getAFGAdsInfo(t.type),x=b==null?void 0:b.data,D=b==null?void 0:b.code;if(D==="BYPASS_ADS"){switch(t.type){case"preroll":{(s=t.adBreakDone)==null||s.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{t.beforeReward(()=>{var H,j,R,N;(H=t.beforeAd)==null||H.call(t),(j=t.adViewed)==null||j.call(t),(R=t.afterAd)==null||R.call(t),(N=t.adBreakDone)==null||N.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=t.beforeAd)==null||l.call(t),(d=t.afterAd)==null||d.call(t),(_=t.adBreakDone)==null||_.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!x||D!=="SUCCESS"){(h=t.adBreakDone)==null||h.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{let H=x.sort((T,B)=>T.seq-B.seq);if(H.length===0){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let j=!0,R=null,N=new oo(this.context);for(this.adsActionDetection.adBreakIsShowing=!0;H.length>0;){let T=H.shift(),B=this.providers[T.provider];if(B){let[K,z]=yield N.callAdBreakAndContinue(B,t,T,te=>{var me;this.adsIsShowing=te,(me=this.context.eventEmitter)==null||me.emit("isAdShowing",te)});j=K,R=z}else j=!0,R={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!j)break}j&&R&&((f=t.adBreakDone)==null||f.call(t,R))}}catch(b){(w=t.adBreakDone)==null||w.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(A=this.context.eventEmitter)==null||A.emit("isAdShowing",!1),this.adsActionDetection.adBreakIsShowing=!1}})}adUnit(t){console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.")}};var tE=$t`
167
+ `,hp=t=>{let{state:e}=t,{afterAd:n,adDismissed:r,adViewed:a,adBreakDone:i,adLoaded:o,adLinkClicked:s,visible:l,src:d}=e,[_,h]=Ur(!1),p=w=>{var A,R,b,x;h(!1),l.value=!1,w==="dismiss"?(A=r.value)==null||A.call(r):w==="viewed"&&((R=a.value)==null||R.call(a)),(b=n.value)==null||b.call(n),(x=i.value)==null||x.call(i)},f=()=>{var w;(w=o.value)==null||w.call(o)};return Bt("appsrockets_ad_dismissed",()=>p("dismiss")),Bt("appsrockets_ad_rewarded",()=>p("viewed")),Bt("appsrockets_ad_completed",()=>p("viewed")),Bt("appsrockets_ad_skipped",()=>p("viewed")),Bt("appsrockets_ad_clicked",w=>{var A;return(A=s.value)==null?void 0:A.call(s,w)}),Bt("appsrockets_ad_loaded",()=>h(!0)),l.value?le("div",{className:fp,style:{display:_?"flex":"none"},children:l.value&&le("iframe",{src:d.value,onLoad:f,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};function rt(t,e,n){return(e=mp(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mp(t){var e=pp(t,"string");return typeof e=="symbol"?e:e+""}function pp(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var mo=class{constructor(e,n){rt(this,"name","APPSROCKETS"),rt(this,"initialized",!1),rt(this,"initCompleter",null),rt(this,"context",void 0),rt(this,"adsOverlay",null),rt(this,"adsIsShowing",!1),rt(this,"lastUnDisplayedAdBreak",null),rt(this,"state",dp()),rt(this,"processUrl",r=>{var a;let i=this.context.getContextInfo(),o=new URL(r),s=new URLSearchParams(o.search);return s.has("joliSource")||s.set("joliSource",i.joliSource),s.get("osType")||s.set("osType",i.osType),s.get("runtimeType")||s.set("runtimeType",i.runtimeType),s.get("mode")||s.set("mode","AFG"),s.get("deviceId")||s.set("deviceId",i.deviceId),s.get("statusBarHeight")||s.set("statusBarHeight",((a=this.context.getWindowInfo().statusBarHeight)!=null?a:0).toString()),o.search=s.toString(),o.toString()}),this.context=e}init(){return I(this,null,function*(){var e;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),Hi(le(hp,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(e=this.initCompleter)==null||e.call(this)})}adConfig(e){var n;if(this.initialized){(n=e.onReady)==null||n.call(e);return}this.initCompleter=()=>{var r;(r=e.onReady)==null||r.call(e)}}adBreak(e,n){var r,a,i,o,s,l,d,_;if(!this.initialized||!this.adsOverlay||!n.params.url){(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.type==="preroll"?"":e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let h=p=>{var f,w;(w=(f=this.context).handleLinkClicked)==null||w.call(f,p)};switch(e.type){case"preroll":{(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(o=e.beforeAd)==null||o.call(e);let p=()=>{var A;this.adsIsShowing=!1,(A=e.afterAd)==null||A.call(e)},f=()=>{var A;this.adsIsShowing=!1,(A=e.adBreakDone)==null||A.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"viewed"})},w=()=>{var A;this.adsIsShowing=!1,(A=e.adBreakDone)==null||A.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};Se(()=>{this.adsIsShowing=!0,this.state.afterAd.value=p,this.state.adBreakDone.value=f,this.state.src.value=this.processUrl(n.params.url),this.state.adLinkClicked.value=h,this.state.adError.value=w,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(d=e.beforeAd)==null||d.call(e);let p=()=>{var L;this.adsIsShowing=!1,(L=e.afterAd)==null||L.call(e)},f={breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"ignored"},w=()=>{var L;this.adsIsShowing=!1,f.breakStatus="dismissed",(L=e.adDismissed)==null||L.call(e)},A=()=>{var L;this.adsIsShowing=!1,f.breakStatus="viewed",(L=e.adViewed)==null||L.call(e)},R=()=>{var L;this.adsIsShowing=!1,(L=e.adBreakDone)==null||L.call(e,f)},b=()=>{this.adsIsShowing=!1,f.breakStatus="noAdPreloaded"};Se(()=>{this.state.afterAd.value=p,this.state.adDismissed.value=w,this.state.adViewed.value=A,this.state.adBreakDone.value=R,this.state.adLinkClicked.value=h,this.state.adError.value=b});let x=()=>{var L;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(L=e.adBreakDone)==null||L.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,Se(()=>{this.state.src.value=this.processUrl(n.params.url),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=e,(_=e.beforeReward)==null||_.call(e,x);break}}}},zc=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function ye(t,e,n){return(e=vp(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vp(t){var e=gp(t,"string");return typeof e=="symbol"?e:e+""}function gp(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var po=class{constructor(e,n,r){ye(this,"adUnit",void 0),ye(this,"project",void 0),ye(this,"keyValue",void 0),ye(this,"adsContext",null),ye(this,"rewardedSlot",null),ye(this,"rewardedPayload",null),ye(this,"readyEvent",null),ye(this,"withCommand",function(){googletag.cmd.push(...arguments)}),ye(this,"init",()=>{var a;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(i=>{var o;(o=this.rewardedSlot)==null||o.setTargeting(i,this.keyValue[i])}),Object.keys(this.keyValue).includes("project")||(a=this.rewardedSlot)==null||a.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),ye(this,"destroy",a=>{var i,o;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,a),this.adsContext=null}),ye(this,"reinit",a=>{this.destroy(a),this.init()}),ye(this,"handleSlotReady",a=>{a.slot===this.rewardedSlot&&(this.readyEvent=a)}),ye(this,"handleSlotClosed",a=>{var i,o;if(this.adsContext&&a.slot===this.rewardedSlot){let s=this.rewardedPayload?"viewed":"dismissed";s==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(i=this.adsContext).afterAd)==null||o.call(i),this.withCommand(()=>{this.reinit(s)})}}),ye(this,"handleSlotGranted",a=>{this.adsContext&&a.slot===this.rewardedSlot&&(this.rewardedPayload=a.payload)}),ye(this,"handleSlotRenderEnded",a=>{a.slot===this.rewardedSlot&&a.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),ye(this,"requestAds",a=>{this.withCommand(()=>{if(this.adsContext&&this.reinit("ignored"),this.rewardedSlot||this.init(),this.adsContext=a,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,o,s;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i),(s=this.readyEvent)==null||s.makeRewardedVisible()});else{let i=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=o,this.adsContext.beforeReward(()=>{var s,l,d;(l=(s=this.adsContext)==null?void 0:s.beforeAd)==null||l.call(s),(d=this.readyEvent)==null||d.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=n,this.keyValue=r,zc(),this.withCommand(()=>{this.init()})}};function Ce(t,e,n){return(e=_p(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _p(t){var e=yp(t,"string");return typeof e=="symbol"?e:e+""}function yp(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vo=class{constructor(e,n,r){var a=this;Ce(this,"adUnit",void 0),Ce(this,"project",void 0),Ce(this,"keyValue",void 0),Ce(this,"adsContext",null),Ce(this,"gamingInterstitialSlot",null),Ce(this,"readyEvent",null),Ce(this,"isRetrying",!1),Ce(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ce(this,"init",()=>{var i;this.gamingInterstitialSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL),this.gamingInterstitialSlot&&(this.gamingInterstitialSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("gameManualInterstitialSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("gameManualInterstitialSlotClosed",this.handleSlotClosed),this.keyValue&&(Object.keys(this.keyValue).forEach(o=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(o,this.keyValue[o])}),Object.keys(this.keyValue).includes("project")||(i=this.gamingInterstitialSlot)==null||i.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),Ce(this,"destroy",function(i){var o,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(o=a.adsContext)==null?void 0:o.onEnd)==null||s.call(o,i),a.adsContext=null),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",a.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",a.handleSlotClosed),a.gamingInterstitialSlot&&(googletag.destroySlots([a.gamingInterstitialSlot]),a.gamingInterstitialSlot=null,a.readyEvent=null)}),Ce(this,"reinit",function(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a.destroy(i,o),a.init()}),Ce(this,"handleSlotReady",i=>{this.gamingInterstitialSlot===i.slot&&(this.readyEvent=i)}),Ce(this,"handleSlotClosed",i=>{var o,s;this.adsContext&&this.gamingInterstitialSlot===i.slot&&((s=(o=this.adsContext).afterAd)==null||s.call(o),this.withCommand(()=>{this.reinit("viewed")}))}),Ce(this,"requestAds",i=>{this.withCommand(()=>{var o,s,l;if(this.adsContext&&this.reinit("ignored"),this.gamingInterstitialSlot||this.init(),this.adsContext=i,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((o=i.beforeAd)==null||o.call(i),this.readyEvent.makeGameManualInterstitialVisible()):((l=(s=this.adsContext).onEnd)==null||l.call(s,"frequencyCapped"),this.adsContext=null,this.isRetrying||(this.isRetrying=!0,window.setTimeout(()=>{this.readyEvent||this.withCommand(()=>{this.reinit("frequencyCapped",!1)}),this.isRetrying=!1},31e3)))})}),zc(),this.adUnit=e,this.project=n,this.keyValue=r,this.withCommand(()=>{this.init()})}};function It(t,e,n){return(e=wp(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wp(t){var e=bp(t,"string");return typeof e=="symbol"?e:e+""}function bp(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var go=class{constructor(e,n){It(this,"name","GOOGLE_GPT"),It(this,"context",void 0),It(this,"contextInfo",void 0),It(this,"initParams",void 0),It(this,"rewardAdManager",void 0),It(this,"interstitialManager",void 0),It(this,"insertScript",()=>{let r="jolibox-google-gpt",a=document.getElementById(r);a||(a=window.document.createElement("script"),a.id=r,a.async=!0,a.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",a.crossOrigin="anonymous",document.head.appendChild(a))}),this.context=e,this.contextInfo=this.context.getContextInfo(),this.initParams=n,this.insertScript()}init(){return I(this,null,function*(){let e=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,n=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,r=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;e&&(this.rewardAdManager=new po(e,r,this.initParams.keyValue)),n&&(this.interstitialManager=new vo(n,r,this.initParams.keyValue))})}adConfig(e,n){}adBreak(e,n){var r,a,i;switch(e.type){case"preroll":{(r=e.adBreakDone)==null||r.call(e,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(a=e.adBreakDone)==null||a.call(e,{breakName:e.name,breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:e.beforeAd,afterAd:e.afterAd,adDismissed:e.adDismissed,adViewed:e.adViewed,beforeReward:e.beforeReward,adBreakDone:o=>{var s;(s=e.adBreakDone)==null||s.call(e,{breakName:e.name,breakType:e.type,breakFormat:"reward",breakStatus:o})}});break}default:{if(!this.interstitialManager){(i=e.adBreakDone)==null||i.call(e,{breakName:e.name,breakType:e.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:e.beforeAd,afterAd:e.afterAd,onEnd:o=>{var s;(s=e.adBreakDone)==null||s.call(e,{breakName:e.name,breakType:e.type,breakFormat:"interstitial",breakStatus:o})}});break}}}};function Yi(t,e,n){return(e=Ep(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ep(t){var e=Ip(t,"string");return typeof e=="symbol"?e:e+""}function Ip(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _o=class{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";Yi(this,"context",void 0),Yi(this,"placement","GAME"),Yi(this,"contextInfo",void 0),this.context=e,this.placement=n,this.contextInfo=this.context.getContextInfo()}getLocation(){let e=new URLSearchParams(window.location.search),n={};return e.forEach((r,a)=>{n[a]=r}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:n}}getDevice(){var e,n,r,a;return{platform:(e=this.contextInfo.platform)!=null?e:Sc.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(n=this.contextInfo.hostAppId)!=null?n:"1",model:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",brand:(a=this.contextInfo.deviceBrand)!=null?a:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(e,n){var r;let a={protocolVersion:"1.0.0",events:[{name:e,type:Ac.System,location:this.getLocation(),target:null,extra:n,timestamp:Date.now(),userId:(r=this.contextInfo.userId)!=null?r:null}],device:this.getDevice(),project:Cc.WebSDK};return Uh(a)}};function Ie(t,e,n){return(e=Ap(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ap(t){var e=Cp(t,"string");return typeof e=="symbol"?e:e+""}function Cp(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xr=class{constructor(e){Ie(this,"context",void 0),Ie(this,"adsTrackSerializer",void 0),Ie(this,"contextInfo",void 0),this.context=e,this.contextInfo=e.getContextInfo(),this.adsTrackSerializer=new _o(this.context)}getRequestContextData(e){var n,r;this.contextInfo=this.context.getContextInfo();let{width:a,height:i}=this.context.getWindowInfo();return{report:JSON.stringify(this.adsTrackSerializer.serialize(e,{sessionId:this.contextInfo.sessionId,objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId,testAdsMode:this.contextInfo.testAdsMode})),osType:this.contextInfo.osType,runtimeType:this.contextInfo.runtimeType,sessionId:this.contextInfo.sessionId,deviceId:this.contextInfo.deviceId,adId:this.contextInfo.adId,deviceModel:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",deviceBrand:(r=this.contextInfo.deviceBrand)!=null?r:"UnknownBrand",dimension:{width:a,height:i}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},yo=class{constructor(e,n){var r=this;Ie(this,"context",void 0),Ie(this,"contextInfo",void 0),Ie(this,"requestContext",void 0),Ie(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Ie(this,"pendingAFVAdsInfo",Promise.resolve(null)),Ie(this,"doFetchAdsInfo",a=>I(this,null,function*(){let i=a==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",o=a==="afv"?"REWARD_INTERSTITIAL":a==="reward"?"REWARD":"INTERSTITIAL",s=a==="afv"?void 0:"cached",{data:l,code:d}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(i),bizParams:this.requestContext.getRequestBizParams(),adsType:o,testAdsMode:this.contextInfo.testAdsMode,name:s}});return d==="SUCCESS"||d==="BYPASS_ADS"?{code:d,data:l}:null})),Ie(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Ie(this,"cacheInterstitialInfo",a=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(a).catch(()=>null)}),Ie(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Ie(this,"cacheNextAFGAdsInfo",a=>I(this,null,function*(){a==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(a)})),Ie(this,"getAFGAdsInfo",a=>I(this,null,function*(){let i=yield a==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(a),i})),Ie(this,"getAFVAdsInfo",function(){return I(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let a=yield r.pendingAFVAdsInfo;return r.cacheAFVInfo(),a}else return r.cacheAFVInfo(),yield r.pendingAFVAdsInfo})}),this.context=e,this.contextInfo=this.context.getContextInfo(),this.requestContext=new Xr(e),n!=null&&n.reward&&this.cacheRewardInfo(),n!=null&&n.interstitial&&this.cacheInterstitialInfo("start"),n!=null&&n.afv&&this.cacheAFVInfo()}};function Ge(t,e,n){return(e=Sp(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sp(t){var e=Rp(t,"string");return typeof e=="symbol"?e:e+""}function Rp(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var An=class{constructor(e){if(Ge(this,"context",void 0),Ge(this,"contextInfo",void 0),Ge(this,"providers",{}),Ge(this,"channelPolicy",void 0),Ge(this,"adsActionDetection",void 0),Ge(this,"requestContext",void 0),Ge(this,"adsRequest",void 0),Ge(this,"initialized",!1),Ge(this,"adsIsShowing",!1),Ge(this,"lastAdBreak",void 0),Ge(this,"initializedTimeStamp",Date.now()),e)this.context=e,this.channelPolicy=new ro(this.context),this.adsActionDetection=new no(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new yo(e),this.requestContext=new Xr(e);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(e){return I(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:n}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((n==null?void 0:n.length)>0)for(let r of n)switch(r.provider){case"GOOGLE_GPT":{let a=new go(this.context,r.params);yield a.init(),this.providers[r.provider]=a;break}case"ADSENSE":case"ADSENSE_ADMOB":{let a=new ao(this.context,r.params);yield a.init(),this.providers[r.provider]=a;break}case"OKSPIN":{let a=new ho(this.context,r.params);yield a.init(),this.providers.OKSPIN=a;break}case"APPSROCKETS":{let a=new mo(this.context,r.params);yield a.init(),this.providers.APPSROCKETS=a;break}}this.adsRequest.cacheInterstitialInfo("start"),this.adsRequest.cacheRewardInfo(),this.initialized=!0})}adConfig(e){this.providers.ADSENSE?this.providers.ADSENSE.adConfig(e):window.adsbygoogle.push(e)}adBreak(e){return I(this,null,function*(){var n,r,a,i,o,s,l,d,_,h,p,f,w,A;let R=Date.now();if(R-this.initializedTimeStamp<3e3){(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}if(this.lastAdBreak&&R-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads] You can't call adBreak too frequently"),(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.lastAdBreak=R,this.adsIsShowing){console.warn("[Jolibox SDK Ads] You can't call adBreak while ad is showing"),(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.initialized||(yield this.init()),e.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()){(o=e.adBreakDone)==null||o.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{let b=yield this.adsRequest.getAFGAdsInfo(e.type),x=b==null?void 0:b.data,L=b==null?void 0:b.code;if(L==="BYPASS_ADS"){switch(e.type){case"preroll":{(s=e.adBreakDone)==null||s.call(e,{breakType:e.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{e.beforeReward(()=>{var F,H,S,N;(F=e.beforeAd)==null||F.call(e),(H=e.adViewed)==null||H.call(e),(S=e.afterAd)==null||S.call(e),(N=e.adBreakDone)==null||N.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=e.beforeAd)==null||l.call(e),(d=e.afterAd)==null||d.call(e),(_=e.adBreakDone)==null||_.call(e,{breakType:e.type,breakName:e.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!x||L!=="SUCCESS"){(h=e.adBreakDone)==null||h.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{let F=x.sort((k,M)=>k.seq-M.seq);if(F.length===0){(p=e.adBreakDone)==null||p.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let H=!0,S=null,N=new to(this.context);for(this.adsActionDetection.adBreakIsShowing=!0;F.length>0;){let k=F.shift(),M=this.providers[k.provider];if(M){let[W,z]=yield N.callAdBreakAndContinue(M,e,k,ee=>{var he;this.adsIsShowing=ee,(he=this.context.eventEmitter)==null||he.emit("isAdShowing",ee)});H=W,S=z}else H=!0,S={breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!H)break}H&&S&&((f=e.adBreakDone)==null||f.call(e,S))}}catch(b){(w=e.adBreakDone)==null||w.call(e,{breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(A=this.context.eventEmitter)==null||A.emit("isAdShowing",!1),this.adsActionDetection.adBreakIsShowing=!1}})}adUnit(e){console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.")}};var kb=Ht`
168
168
  ${be}
169
169
  position: fixed;
170
170
  left: 0;
@@ -209,7 +209,7 @@ or `);this.errors.push(i)}return r}},lr=class extends de{constructor(...t){super
209
209
  cursor: pointer;
210
210
  }
211
211
  }
212
- `;ue();var GE=Ia(ru());var kn=class{constructor(t){this.ads=t}getAdsInstance(){return this.ads}init(){}adConfig(t){var n,r;(r=(n=this.ads)==null?void 0:n.adConfig)==null||r.call(n,t)}adBreak(t){this.ads.adBreak(t)}adUnit(){}};var Tn=class e{constructor(){this.callbacksId=0,this.callbackMap=new Map,this.initOnMessage()}static getInstance(){return e.instance||(e.instance=new e),e.instance}initOnMessage(){window.addEventListener("message",t=>{var n,r,a,i,o,s,l,d,_;if(console.log(`HuaweiQuickAdsHandler,event => ${t}`),t.origin==window.location.origin&&t.data&&t.data.type==null){let h=JSON.parse(t.data);switch(console.log(`HuaweiQuickAdsHandler type => ${h.type}`),h.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",h);break;case"huawei_quick_ads_on_message_ad_config":{let p=h.callbackId;if(p){let f=this.callbackMap.get(p);(n=f==null?void 0:f.onReady)==null||n.call(f)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",h)}break;case"huawei_quick_ads_on_message_ad_break":{let p=h.callbackId;if(p){let f=this.callbackMap.get(p),w="noAdPreloaded",A=!1;switch(h.adsRes){case"viewed":w="viewed",(r=f==null?void 0:f.adViewed)==null||r.call(f),A=!1;break;case"dismissed":w="dismissed",(a=f==null?void 0:f.adDismissed)==null||a.call(f),A=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":w=h.adsRes,A=!0;break;case"breakDone":w=h.params,A=!0;break;case"beforeReward":(i=f==null?void 0:f.beforeReward)==null||i.call(f,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),A=!1;break;case"beforeAd":(o=f==null?void 0:f.beforeAd)==null||o.call(f),A=!1;break;case"afterAd":(s=f==null?void 0:f.afterAd)==null||s.call(f),A=!1;break}A&&((_=f==null?void 0:f.adBreakDone)==null||_.call(f,{breakType:(l=f.breakType)!=null?l:"",breakName:f.breakName,breakFormat:(d=f.breakFormat)!=null?d:"interstitial",breakStatus:w}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",h)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",h);break;default:break}}})}getAdsInstance(){return e.getInstance()}init(t){try{this.sendPostMessage("huawei_quick_ads_init",void 0,t)}catch(n){console.error("init failed",n)}}adConfig(t){try{let n;t.onReady&&(n=++this.callbacksId,this.callbackMap.set(n,{onReady:t.onReady})),this.sendPostMessage("huawei_quick_ads_ad_config",n,t)}catch(n){console.error("adConfig failed",n)}}adBreak(t){var n;try{let r=++this.callbacksId,a={};a.breakType=t.type,t.type!=="preroll"&&t.name&&(a.breakName=t.name),a.breakFormat=t.type==="reward"?"reward":"interstitial",t.adBreakDone&&(a.adBreakDone=t.adBreakDone),t.type!=="preroll"&&t.beforeAd&&(a.beforeAd=t.beforeAd),t.type!=="preroll"&&t.afterAd&&(a.afterAd=t.afterAd),t.type==="reward"&&t.beforeReward&&(a.beforeReward=t.beforeReward),t.type==="reward"&&t.adDismissed&&(a.adDismissed=t.adDismissed),t.type==="reward"&&t.adViewed&&(a.adViewed=t.adViewed),this.callbackMap.set(r,a),this.sendPostMessage("huawei_quick_ads_ad_break",r,t)}catch(r){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}}adUnit(t){try{this.sendPostMessage("huawei_quick_ads_ad_unit",void 0,t)}catch(n){console.error("adUnit failed",n)}}sendPostMessage(t,n,r){var a;try{if(!((a=window.system)!=null&&a.postMessage))throw new Error("window.system.postMessage is not available");let i=q(q({type:t},n!==void 0&&{callbackId:n}),r!==void 0&&{data:r});window.system.postMessage(JSON.stringify(i))}catch(i){throw console.error("sendPostMessage failed",i),i}}};var xn=class e{constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}getAdsInstance(){return e.getInstance()}init(){}adConfig(t){t.onReady&&t.onReady()}adBreak(t){var n;try{t.type==="reward"?window.gdsdk.preloadAd("rewarded").then(()=>{var r;(r=t.beforeReward)==null||r.call(t,()=>{t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("rewarded").then(a=>{var i,o,s,l,d;(i=a==null?void 0:a.args)!=null&&i.success?(o=t.adViewed)==null||o.call(t):(s=t.adDismissed)==null||s.call(t),t.afterAd&&t.afterAd(),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:(l=a==null?void 0:a.args)!=null&&l.success?"viewed":"dismissed"})}).catch(a=>{var i;console.log("showReward error => ",a),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})})})}).catch(r=>{var a;console.log("preloadAd error => ",r),(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})}):(t.type!=="preroll"&&t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("interstitial").then(()=>{var r;t.type!=="preroll"&&t.afterAd&&t.afterAd(),(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:"interstitial",breakStatus:"viewed"})}))}catch(r){console.log("adBreak error => ",r),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"error"})}}adUnit(){}};ue();var It=class{constructor(t,n){this.ads=t;this.httpClient=n}getAdsInstance(){return this.ads}init(t){this.ads.init(t)}adConfig(t){this.ads.adConfig(t)}adBreak(t){return I(this,null,function*(){var r,a;if((r=L.hostUserInfo)==null?void 0:r.isSubUser){this.wrapAdBreadDoneViewed(t);return}if(t.type==="reward")try{let i=yield nt.getRewardsTypes(this.httpClient);if(!(yield nt.handleReward(i,t)))throw new Error("handleReward failed: fallback to unlock failed")}catch(i){console.info("handleReward failed",i),(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}else this.ads.adBreak(t)})}adUnit(t){this.ads.adUnit(t)}wrapAdBreadDoneViewed(t){var n,r,a;(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:"name"in t&&(n=t.name)!=null?n:"",breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in t&&((a=t.adViewed)==null||a.call(t))}};var Pn=class e extends It{constructor(t,n){super(t,n),this.startTimes=Date.now()}adBreak(t){return I(this,null,function*(){var n,r;if(t.type!=="reward"){if(t.type==="preroll"){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let a=Date.now();if(console.log("FunmaxAdsHandler time => ",a-this.startTimes),a-this.startTimes<4e4){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}}is(e.prototype,this,"adBreak").call(this,t)})}};var ko=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new kn(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=Tn.getInstance();break}case"gamedistribution":{this.cacheHandler=xn.getInstance();break}case"funmax":{let n=new Sn(this.context);this.cacheHandler=new Pn(n,At);break}default:{let n=new Sn(this.context);this.cacheHandler=new It(n,At);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},ia=ge(),au=new He,At=Je.create(),Up={httpClient:At,checkNetwork:()=>Je.getNetworkStatus(),track:Pe,eventEmitter:au,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:0}),handleLinkClicked:e=>{window.open(e,"_blank")},getContextInfo:()=>{var e,t,n,r,a,i,o,s,l;return{hostAppId:(t=(e=L.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(n=L.deviceInfo.did)!=null?n:"",adId:(r=L.deviceInfo.adId)!=null?r:"",sessionId:(a=L.sessionId)!=null?a:"",userId:(o=(i=L.hostUserInfo)==null?void 0:i.uid)!=null?o:"",objectType:"GAME",objectId:L.mpId,testAdsMode:L.testAdsMode,channel:(s=L.joliSource)!=null?s:"",deviceBrand:L.deviceInfo.brand,deviceModel:L.deviceInfo.model,osType:Ie.isAndroid?"ANDROID":Ie.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=L.joliSource)!=null?l:""}}},Bp=()=>{Pe("subscription_unlock_success",{})},Mp=new ko(Up),Ln=Mp.getAdsHandler(L.sdkEnvironment);nt.registerRewardHandler("ADS",sl(Ln.getAdsInstance()));nt.registerRewardHandler("JOLI_COIN",ll(At,{onUnlockSuccess:e=>{qe("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e})}}));nt.registerRewardHandler("SUBSCRIPTION",fl(At,{onSubSuccess:Bp.bind(void 0)}));Ei(At);Or(At);au.on("isAdShowing",e=>{qe("JOLIBOX_ADS_EVENT",{isAdShowing:e})});ia.registerCommand("AdsSDK.init",e=>{Ln.init(e)});ia.registerCommand("AdsSDK.adConfig",e=>{Ln.adConfig(e)});ia.registerCommand("AdsSDK.adBreak",e=>{Ln.adBreak(e)});ia.registerCommand("AdsSDK.adUnit",e=>{Ln.adUnit(e)});G();dt();var iu=ge();iu.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();Pe("loadFinished",{duration:e})});iu.registerCommand("RuntimeSDK.loadProgressEvent",e=>{console.log("RuntimeSDK.loadProgressEvent",e)});G();dt();var du=-1,sa=function(e){addEventListener("pageshow",function(t){t.persisted&&(du=t.timeStamp,e(t))},!0)},xo=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},la=function(){var e=xo();return e&&e.activationStart||0},Xt=function(e,t){var n=xo(),r="navigate";return du>=0?r="back-forward-cache":n&&(document.prerendering||la()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},fu=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(a){}},Yt=function(e,t,n,r){var a,i;return function(o){t.value>=0&&(o||r)&&((i=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=i,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,n),e(t))}},hu=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},mu=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},pu=function(e){var t=!1;return function(){t||(e(),t=!0)}},zt=-1,ou=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},oa=function(e){document.visibilityState==="hidden"&&zt>-1&&(zt=e.type==="visibilitychange"?e.timeStamp:0,Gp())},su=function(){addEventListener("visibilitychange",oa,!0),addEventListener("prerenderingchange",oa,!0)},Gp=function(){removeEventListener("visibilitychange",oa,!0),removeEventListener("prerenderingchange",oa,!0)},vu=function(){return zt<0&&(zt=ou(),su(),sa(function(){setTimeout(function(){zt=ou(),su()},0)})),{get firstHiddenTime(){return zt}}},Po=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},lu=[1800,3e3],gu=function(e,t){t=t||{},Po(function(){var n,r=vu(),a=Xt("FCP"),i=fu("paint",function(o){o.forEach(function(s){s.name==="first-contentful-paint"&&(i.disconnect(),s.startTime<r.firstHiddenTime&&(a.value=Math.max(s.startTime-la(),0),a.entries.push(s),n(!0)))})});i&&(n=Yt(e,a,lu,t.reportAllChanges),sa(function(o){a=Xt("FCP"),n=Yt(e,a,lu,t.reportAllChanges),hu(function(){a.value=performance.now()-o.timeStamp,n(!0)})}))})};var Jp=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=pu(e),document.visibilityState==="hidden"?e():(n=t(e),mu(e)),n};var cu=[2500,4e3],To={},_u=function(e,t){t=t||{},Po(function(){var n,r=vu(),a=Xt("LCP"),i=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(d){d.startTime<r.firstHiddenTime&&(a.value=Math.max(d.startTime-la(),0),a.entries=[d],n())})},o=fu("largest-contentful-paint",i);if(o){n=Yt(e,a,cu,t.reportAllChanges);var s=pu(function(){To[a.id]||(i(o.takeRecords()),o.disconnect(),To[a.id]=!0,n(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return Jp(s)},{once:!0,capture:!0})}),mu(s),sa(function(l){a=Xt("LCP"),n=Yt(e,a,cu,t.reportAllChanges),hu(function(){a.value=performance.now()-l.timeStamp,To[a.id]=!0,n(!0)})})}})},uu=[800,1800],Fp=function e(t){document.prerendering?Po(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},yu=function(e,t){t=t||{};var n=Xt("TTFB"),r=Yt(e,n,uu,t.reportAllChanges);Fp(function(){var a=xo();a&&(n.value=Math.max(a.responseStart-la(),0),n.entries=[a],r(!0),sa(function(){n=Xt("TTFB",0),(r=Yt(e,n,uu,t.reportAllChanges))(!0)}))})};ue();Tt();ze();G();gr();G();var ca=new Map,wu=!1,Hp=()=>{wu||(wt("ON_GET_USER_SUB_STATUS",e=>{let t=ca.get(e.sequenceId);t&&(clearTimeout(t.timeoutId),t.resolve(e.isSubUser),ca.delete(e.sequenceId))}),wu=!0)};function Lo(){return I(this,null,function*(){return Hp(),new Promise((e,t)=>{let n=Ge(),r=setTimeout(()=>{ca.delete(n),t(new Error("Timeout waiting for user sub status response"))},3e3);ca.set(n,{resolve:e,reject:t,timeoutId:r}),qe("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:n})})})}function bu(){return I(this,null,function*(){let e=Je.create();try{let t=yield e.get("/api/users/info");return!(t.code!=="SUCCESS"||!t.data)}catch(t){return xe(new Jn(t)),!1}})}function qp(){gu(e=>{Pe("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),_u(e=>{Pe("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),yu(e=>{Pe("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function jp(){ut.on("onDocumentReady",e=>I(this,null,function*(){let t=yield bu(),n=yield Lo().catch(()=>!1);L.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:n}}),ut.emit("LifecycleEvent.onReady",q({},L.hostUserInfo?L.hostUserInfo:{isLogin:!1})),L.mpType==="game"&&Ye.start(Date.now()-e)}))}function Eu(){jp(),qp()}Eu();
212
+ `;me();var fE=wa(Qc());var On=class{constructor(e){this.ads=e}getAdsInstance(){return this.ads}init(){}adConfig(e){var n,r;(r=(n=this.ads)==null?void 0:n.adConfig)==null||r.call(n,e)}adBreak(e){this.ads.adBreak(e)}adUnit(){}};var Tn=class t{constructor(){this.callbacksId=0,this.callbackMap=new Map,this.initOnMessage()}static getInstance(){return t.instance||(t.instance=new t),t.instance}initOnMessage(){window.addEventListener("message",e=>{var n,r,a,i,o,s,l,d,_;if(console.log(`HuaweiQuickAdsHandler,event => ${e}`),e.origin==window.location.origin&&e.data&&e.data.type==null){let h=JSON.parse(e.data);switch(console.log(`HuaweiQuickAdsHandler type => ${h.type}`),h.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",h);break;case"huawei_quick_ads_on_message_ad_config":{let p=h.callbackId;if(p){let f=this.callbackMap.get(p);(n=f==null?void 0:f.onReady)==null||n.call(f)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",h)}break;case"huawei_quick_ads_on_message_ad_break":{let p=h.callbackId;if(p){let f=this.callbackMap.get(p),w="noAdPreloaded",A=!1;switch(h.adsRes){case"viewed":w="viewed",(r=f==null?void 0:f.adViewed)==null||r.call(f),A=!1;break;case"dismissed":w="dismissed",(a=f==null?void 0:f.adDismissed)==null||a.call(f),A=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":w=h.adsRes,A=!0;break;case"breakDone":w=h.params,A=!0;break;case"beforeReward":(i=f==null?void 0:f.beforeReward)==null||i.call(f,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),A=!1;break;case"beforeAd":(o=f==null?void 0:f.beforeAd)==null||o.call(f),A=!1;break;case"afterAd":(s=f==null?void 0:f.afterAd)==null||s.call(f),A=!1;break}A&&((_=f==null?void 0:f.adBreakDone)==null||_.call(f,{breakType:(l=f.breakType)!=null?l:"",breakName:f.breakName,breakFormat:(d=f.breakFormat)!=null?d:"interstitial",breakStatus:w}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",h)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",h);break;default:break}}})}getAdsInstance(){return t.getInstance()}init(e){try{this.sendPostMessage("huawei_quick_ads_init",void 0,e)}catch(n){console.error("init failed",n)}}adConfig(e){try{let n;e.onReady&&(n=++this.callbacksId,this.callbackMap.set(n,{onReady:e.onReady})),this.sendPostMessage("huawei_quick_ads_ad_config",n,e)}catch(n){console.error("adConfig failed",n)}}adBreak(e){var n;try{let r=++this.callbacksId,a={};a.breakType=e.type,e.type!=="preroll"&&e.name&&(a.breakName=e.name),a.breakFormat=e.type==="reward"?"reward":"interstitial",e.adBreakDone&&(a.adBreakDone=e.adBreakDone),e.type!=="preroll"&&e.beforeAd&&(a.beforeAd=e.beforeAd),e.type!=="preroll"&&e.afterAd&&(a.afterAd=e.afterAd),e.type==="reward"&&e.beforeReward&&(a.beforeReward=e.beforeReward),e.type==="reward"&&e.adDismissed&&(a.adDismissed=e.adDismissed),e.type==="reward"&&e.adViewed&&(a.adViewed=e.adViewed),this.callbackMap.set(r,a),this.sendPostMessage("huawei_quick_ads_ad_break",r,e)}catch(r){(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}}adUnit(e){try{this.sendPostMessage("huawei_quick_ads_ad_unit",void 0,e)}catch(n){console.error("adUnit failed",n)}}sendPostMessage(e,n,r){var a;try{if(!((a=window.system)!=null&&a.postMessage))throw new Error("window.system.postMessage is not available");let i=j(j({type:e},n!==void 0&&{callbackId:n}),r!==void 0&&{data:r});window.system.postMessage(JSON.stringify(i))}catch(i){throw console.error("sendPostMessage failed",i),i}}};var kn=class t{constructor(){}static getInstance(){return t.instance||(t.instance=new t),t.instance}getAdsInstance(){return t.getInstance()}init(){}adConfig(e){e.onReady&&e.onReady()}adBreak(e){var n;try{e.type==="reward"?window.gdsdk.preloadAd("rewarded").then(()=>{var r;(r=e.beforeReward)==null||r.call(e,()=>{e.beforeAd&&e.beforeAd(),window.gdsdk.showAd("rewarded").then(a=>{var i,o,s,l,d;(i=a==null?void 0:a.args)!=null&&i.success?(o=e.adViewed)==null||o.call(e):(s=e.adDismissed)==null||s.call(e),e.afterAd&&e.afterAd(),(d=e.adBreakDone)==null||d.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:(l=a==null?void 0:a.args)!=null&&l.success?"viewed":"dismissed"})}).catch(a=>{var i;console.log("showReward error => ",a),(i=e.adBreakDone)==null||i.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})})})}).catch(r=>{var a;console.log("preloadAd error => ",r),(a=e.adBreakDone)==null||a.call(e,{breakType:e.type,breakName:e.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})}):(e.type!=="preroll"&&e.beforeAd&&e.beforeAd(),window.gdsdk.showAd("interstitial").then(()=>{var r;e.type!=="preroll"&&e.afterAd&&e.afterAd(),(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:"interstitial",breakStatus:"viewed"})}))}catch(r){console.log("adBreak error => ",r),(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakName:e.type==="preroll"?void 0:e.name,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"error"})}}adUnit(){}};var At=class{constructor(e,n){this.ads=e;this.httpClient=n}getAdsInstance(){return this.ads}init(e){this.ads.init(e)}adConfig(e){this.ads.adConfig(e)}adBreak(e){return I(this,null,function*(){var n;if(e.type==="reward")try{let r=yield Ze.getRewardsTypes(this.httpClient);yield Ze.handleReward(r,e)}catch(r){console.info("handleReward failed",r),(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}else this.ads.adBreak(e)})}adUnit(e){this.ads.adUnit(e)}};var xn=class t extends At{constructor(e,n){super(e,n),this.startTimes=Date.now()}adBreak(e){return I(this,null,function*(){var n,r;if(e.type!=="reward"){if(e.type==="preroll"){(n=e.adBreakDone)==null||n.call(e,{breakType:e.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let a=Date.now();if(console.log("FunmaxAdsHandler time => ",a-this.startTimes),a-this.startTimes<4e4){(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}}es(t.prototype,this,"adBreak").call(this,e)})}};var Co=class{constructor(e){this.cacheHandler=null;this.context=e}createAdsHandler(e){if(this.cacheHandler)return this.cacheHandler;switch(e){case"dlightek":{this.cacheHandler=new On(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=Tn.getInstance();break}case"gamedistribution":{this.cacheHandler=kn.getInstance();break}case"funmax":{let n=new An(this.context);this.cacheHandler=new xn(n,Ct);break}default:{let n=new An(this.context);this.cacheHandler=new At(n,Ct);break}}return this.cacheHandler}getAdsHandler(e){return this.createAdsHandler(e)}},ra=ge(),Xc=new Je,Ct=Be.create(),Op={httpClient:Ct,checkNetwork:()=>Be.getNetworkStatus(),track:xe,eventEmitter:Xc,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:0}),handleLinkClicked:t=>{window.open(t,"_blank")},getContextInfo:()=>{var t,e,n,r,a,i,o,s,l;return{hostAppId:(e=(t=P.hostInfo)==null?void 0:t.aid)!=null?e:"1",deviceId:(n=P.deviceInfo.did)!=null?n:"",adId:(r=P.deviceInfo.adId)!=null?r:"",sessionId:(a=P.sessionId)!=null?a:"",userId:(o=(i=P.hostUserInfo)==null?void 0:i.uid)!=null?o:"",objectType:"GAME",objectId:P.mpId,testAdsMode:P.testAdsMode,channel:(s=P.joliSource)!=null?s:"",deviceBrand:P.deviceInfo.brand,deviceModel:P.deviceInfo.model,osType:Ee.isAndroid?"ANDROID":Ee.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=P.joliSource)!=null?l:""}}},Zc=t=>{_t("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:t}),xe("jolicoin_unlock_success",{quantity:t.quantity})},Tp=new Co(Op),Dn=Tp.getAdsHandler(P.sdkEnvironment);Ze.registerRewardHandler("ADS",rl(Dn.getAdsInstance()));Ze.registerRewardHandler("JOLI_COIN",il(Ct,{onUnlockSuccess:Zc.bind(void 0)}));Ze.registerRewardHandler("JOLI_COIN_ONLY",ol(Ct,{onUnlockSuccess:Zc.bind(void 0)}));yi(Ct);Cr(Ct);Xc.on("isAdShowing",t=>{_t("JOLIBOX_ADS_EVENT",{isAdShowing:t})});ra.registerCommand("AdsSDK.init",t=>{Dn.init(t)});ra.registerCommand("AdsSDK.adConfig",t=>{Dn.adConfig(t)});ra.registerCommand("AdsSDK.adBreak",t=>{Dn.adBreak(t)});ra.registerCommand("AdsSDK.adUnit",t=>{Dn.adUnit(t)});q();ct();var eu=ge();eu.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let t=performance.now();xe("loadFinished",{duration:t})});eu.registerCommand("RuntimeSDK.loadProgressEvent",t=>{console.log("RuntimeSDK.loadProgressEvent",t)});q();ct();var ou=-1,ia=function(t){addEventListener("pageshow",function(e){e.persisted&&(ou=e.timeStamp,t(e))},!0)},Ro=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},oa=function(){var t=Ro();return t&&t.activationStart||0},Wt=function(t,e){var n=Ro(),r="navigate";return ou>=0?r="back-forward-cache":n&&(document.prerendering||oa()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:t,value:e===void 0?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},su=function(t,e,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var r=new PerformanceObserver(function(a){Promise.resolve().then(function(){e(a.getEntries())})});return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch(a){}},zt=function(t,e,n,r){var a,i;return function(o){e.value>=0&&(o||r)&&((i=e.value-(a||0))||a===void 0)&&(a=e.value,e.delta=i,e.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(e.value,n),t(e))}},lu=function(t){requestAnimationFrame(function(){return requestAnimationFrame(function(){return t()})})},cu=function(t){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&t()})},uu=function(t){var e=!1;return function(){e||(t(),e=!0)}},Kt=-1,tu=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},aa=function(t){document.visibilityState==="hidden"&&Kt>-1&&(Kt=t.type==="visibilitychange"?t.timeStamp:0,kp())},nu=function(){addEventListener("visibilitychange",aa,!0),addEventListener("prerenderingchange",aa,!0)},kp=function(){removeEventListener("visibilitychange",aa,!0),removeEventListener("prerenderingchange",aa,!0)},du=function(){return Kt<0&&(Kt=tu(),nu(),ia(function(){setTimeout(function(){Kt=tu(),nu()},0)})),{get firstHiddenTime(){return Kt}}},Oo=function(t){document.prerendering?addEventListener("prerenderingchange",function(){return t()},!0):t()},ru=[1800,3e3],fu=function(t,e){e=e||{},Oo(function(){var n,r=du(),a=Wt("FCP"),i=su("paint",function(o){o.forEach(function(s){s.name==="first-contentful-paint"&&(i.disconnect(),s.startTime<r.firstHiddenTime&&(a.value=Math.max(s.startTime-oa(),0),a.entries.push(s),n(!0)))})});i&&(n=zt(t,a,ru,e.reportAllChanges),ia(function(o){a=Wt("FCP"),n=zt(t,a,ru,e.reportAllChanges),lu(function(){a.value=performance.now()-o.timeStamp,n(!0)})}))})};var xp=function(t){var e=self.requestIdleCallback||self.setTimeout,n=-1;return t=uu(t),document.visibilityState==="hidden"?t():(n=e(t),cu(t)),n};var au=[2500,4e3],So={},hu=function(t,e){e=e||{},Oo(function(){var n,r=du(),a=Wt("LCP"),i=function(l){e.reportAllChanges||(l=l.slice(-1)),l.forEach(function(d){d.startTime<r.firstHiddenTime&&(a.value=Math.max(d.startTime-oa(),0),a.entries=[d],n())})},o=su("largest-contentful-paint",i);if(o){n=zt(t,a,au,e.reportAllChanges);var s=uu(function(){So[a.id]||(i(o.takeRecords()),o.disconnect(),So[a.id]=!0,n(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return xp(s)},{once:!0,capture:!0})}),cu(s),ia(function(l){a=Wt("LCP"),n=zt(t,a,au,e.reportAllChanges),lu(function(){a.value=performance.now()-l.timeStamp,So[a.id]=!0,n(!0)})})}})},iu=[800,1800],Dp=function t(e){document.prerendering?Oo(function(){return t(e)}):document.readyState!=="complete"?addEventListener("load",function(){return t(e)},!0):setTimeout(e,0)},mu=function(t,e){e=e||{};var n=Wt("TTFB"),r=zt(t,n,iu,e.reportAllChanges);Dp(function(){var a=Ro();a&&(n.value=Math.max(a.responseStart-oa(),0),n.entries=[a],r(!0),ia(function(){n=Wt("TTFB",0),(r=zt(t,n,iu,e.reportAllChanges))(!0)}))})};me();xt();Ve();function Pp(){fu(t=>{xe("GameFCP",{value:t.value,rating:t.rating,navigationType:t.navigationType})}),hu(t=>{xe("GameLCP",{value:t.value,rating:t.rating,navigationType:t.navigationType})}),mu(t=>{xe("GameTTFB",{value:t.value,rating:t.rating,navigationType:t.navigationType})})}function Lp(){return I(this,null,function*(){let t=Be.create();try{let e=yield t.get("/api/users/info");return!(e.code!=="SUCCESS"||!e.data)}catch(e){return ke(new Gn(e)),!1}})}function Np(){lt.on("onDocumentReady",t=>I(this,null,function*(){let e=yield Lp();P.onEnvConfigChanged({hostUserInfo:{isLogin:e}}),lt.emit("LifecycleEvent.onReady",j({},P.hostUserInfo?P.hostUserInfo:{isLogin:!1})),P.mpType==="game"&&Ke.start(Date.now()-t)}))}function pu(){Np(),Pp()}pu();
213
213
  /*! Bundled license information:
214
214
 
215
215
  localforage/dist/localforage.js: