@jolibox/implement 1.4.15 → 1.4.18-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Eh=Object.create;var ho=Object.defineProperty,Ih=Object.defineProperties,Ah=Object.getOwnPropertyDescriptor,Sh=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertyNames,_n=Object.getOwnPropertySymbols,vl=Object.getPrototypeOf,mo=Object.prototype.hasOwnProperty,gl=Object.prototype.propertyIsEnumerable,Rh=Reflect.get;var pl=(e,t,r)=>t in e?ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))mo.call(t,r)&&pl(e,r,t[r]);if(_n)for(var r of _n(t))gl.call(t,r)&&pl(e,r,t[r]);return e},xe=(e,t)=>Ih(e,Sh(t));var Rr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _l=(e,t)=>{var r={};for(var n in e)mo.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_n)for(var n of _n(e))t.indexOf(n)<0&&gl.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var po=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ch(t))!mo.call(e,i)&&i!==r&&ho(e,i,{get:()=>t[i],enumerable:!(n=Ah(t,i))||n.enumerable});return e};var vo=(e,t,r)=>(r=e!=null?Eh(vl(e)):{},Oh(t||!e||!e.__esModule?ho(r,"default",{value:e,enumerable:!0}):r,e));var yl=(e,t,r)=>Rh(vl(e),r,t);var E=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function Uh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function So(e){return typeof e=="string"}function Cl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Rl(e){return typeof e=="object"&&Array.isArray(e)}function Bh(e){return typeof e=="undefined"}function Mh(e){return Bh(e)||e===null}function Gh(e){return typeof e=="function"}function Ol(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function kl(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:El(l)&&El(s)?i[a]=n(Ao({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function El(e){return e&&typeof e=="object"&&e.constructor===Object}function Tl(e,t){if(Array.isArray(e))return e.concat(t)}function xr(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),m=function(...d){i=d,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return m.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},m.flush=()=>{if(n)return clearTimeout(n),n=null,c()},m}function jh(e,t){return(...r)=>t(e,...r)}function Dl(e){return t=>jh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Fh(`${i}`))}})}function Or(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function yn(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function Wh(e){let t=e.location?yn(e.location,Al):null,r=e.target?yn(e.target,Al):null;return yn(Dh(Ao({},e),{location:t,target:r}),$h)}function To(e){let t=e.events.map(n=>Wh(n)),r=yn(e.device,Kh);return[e.protocolVersion,t,r,e.project]}function zh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function Po(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function Bl(e){return Po("app","stg-app",e)}function tr(e){return`https://${Po("api","stg-api",e)}`}function rm(e){return Po("collect","stg-collect",e)}function Ml(e){return`https://${rm(e)}`}function am(e){return new Promise(t=>Gl(e)(t))}function Gl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function sm(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Tr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function cm(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)dm(e[n],t[n])}function dm(e,t){if(So(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gh(t)){try{if(e instanceof t)return}catch(r){}if(!Mh(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 um(){return typeof globalThis!="undefined"?globalThis[Jl]:void 0}function fm(e){typeof globalThis!="undefined"&&(globalThis[Jl]=e)}function Ae(e=!1){let t=um();if(!e&&t)return t;let r=new bn,n=new Eo,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return fm(i),i}var Io,kh,Th,xh,bl,Nh,Ph,wl,Ao,Dh,Lh,Sl,Bt,Jh,Co,Ro,xl,Nl,Fh,Pl,wn,En,Oo,Pe,_o,Hh,ko,Il,qh,Mt,er,Vh,Al,$h,Kh,We,Zt,Yh,Ne,Xh,Qh,Zh,Ll,xo,No,em,tm,Ul,Gt,yo,ae,nm,im,kr,Tr,et,wo,om,go,lm,kt,bn,Eo,Jl,W=re(()=>{"use strict";Io=Object.defineProperty,kh=Object.defineProperties,Th=Object.getOwnPropertyDescriptor,xh=Object.getOwnPropertyDescriptors,bl=Object.getOwnPropertySymbols,Nh=Object.prototype.hasOwnProperty,Ph=Object.prototype.propertyIsEnumerable,wl=(e,t,r)=>t in e?Io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ao=(e,t)=>{for(var r in t||(t={}))Nh.call(t,r)&&wl(e,r,t[r]);if(bl)for(var r of bl(t))Ph.call(t,r)&&wl(e,r,t[r]);return e},Dh=(e,t)=>kh(e,xh(t)),Lh=(e,t)=>{for(var r in t)Io(e,r,{get:t[r],enumerable:!0})},Sl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Th(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&Io(t,r,i),i},Bt=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Jh=(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))(Jh||{}),Co=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}},Ro=class extends Co{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},xl=class extends Co{constructor(){super(...arguments),this.kind="USER_ERROR"}},Nl=class extends xl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fh=class extends xl{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Pl=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},wn=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},En=class extends Co{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Oo=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Pe={log:Or("log"),warn:Or("warn"),info:Or("info"),error:Or("error"),debug:Or("debug")};Object.assign(globalThis,{logger:Pe});_o=Symbol.for("Jolibox.canIUseMap"),Hh={};globalThis[_o]||(globalThis[_o]=Hh);ko={get config(){return globalThis[_o]}},Il=Symbol.for("Jolibox.canIUseMap.native"),qh={};globalThis[Il]||(globalThis[Il]=qh);Mt=(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))(Mt||{}),er=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(er||{}),Vh=(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))(Vh||{}),Al=["name","params"],$h=["name","type","location","target","extra","timestamp","userId"],Kh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];We=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});zh();Zt=typeof window=="undefined",Yh=()=>!Zt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ne={isiOS:!Zt&&(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:!Zt&&navigator.userAgent.includes("Android"),isMac:!Zt&&navigator.userAgent.includes("Mac"),isFacebook:!Zt&&navigator.userAgent.includes("FB_IAB"),isPC:!Zt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Xh=()=>Ne.isiOS?"iOS":Ne.isAndroid?"Android":Ne.isMac?"Mac":Ne.isFacebook?"Facebook":"PC",Qh="device_id",Zh="advertising_id",Ll=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,We()),window.__joliboxLocalStorage__.getItem(e)),xo=()=>new URLSearchParams(window.location.search).get("deviceId")||Ll(Qh),No=()=>new URLSearchParams(window.location.search).get("advertisingId")||Ll(Zh),em=e=>e.charAt(0).toUpperCase()+e.slice(1),tm=()=>{var e;let t=new URLSearchParams(window.location.search);return em((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Ul=e=>{if(Yh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=Xh(),n=navigator.language,i=xo(),o=No();return`${t} (${tm()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${o} 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=Ao({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Bt(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),o=this.createTimeoutPromise(),a=Promise.race([i,o]).catch(s=>Bt(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,a),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Bt(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let d=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(d),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,d);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,h,s),d):this.requestAdapter.mergeData(l,p)}catch(d){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,d),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),m=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return m&&this.setCachedDataWithSequence(a,m,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Bt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Bt(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),o=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${o})`);let a=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,a);return s&&(this.setCachedDataWithSequence(i,s,o),console.log(`[RequestCacheService] Force updated cache for ${e}`)),a})}warmupCache(e,t){return Bt(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},yo=class bo{constructor(t){this.element=t,this.next=bo.Undefined,this.prev=bo.Undefined}};yo.Undefined=new yo(void 0);ae=yo,nm=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},im=0,kr=class{constructor(e){this.value=e,this.id=im++}},Tr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof kr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new kr(t);return this._listeners?this._listeners instanceof kr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var m,d,p,h;if(!this._disposed){if(this._listeners instanceof kr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||d.call(m));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((h=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||h.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof kr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},et=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new Tr,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new nm,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},wo={};Lh(wo,{None:()=>om,filter:()=>sm,once:()=>Gl,toPromise:()=>am});om=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});go=Symbol.for("Jolibox.hostEmitter"),lm=()=>{let e=new et;return globalThis[go]||(globalThis[go]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[go]},kt=lm();bn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Tr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return cm(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};bn=Sl([Ol],bn);Eo=class{constructor(){this._onWillExecuteCommand=new Tr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Tr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new bn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uh(3e4)),this._starActivation}executeCommand(e,...t){return Bt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),wo.toPromise(wo.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};Eo=Sl([Ol],Eo);Jl=Symbol.for("Jolibox.commands")});function je(e,t={}){Do.emit("ERROR_REPORT",{error:e,options:t})}var Do,Jt,ut=re(()=>{"use strict";W();W();Do=new et,Jt=new et;je.debounce=xr(je,50,{leading:!0})});var Lo,hm,Fl,jl,Hl=re(()=>{"use strict";W();ut();Lo=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},hm=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Fl=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[o,a,s]=i;return{headerJson:Lo(o),payloadJson:Lo(a),signature:Lo(s)}}else throw"joli_source is missing"}catch(r){return je(new Pl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},jl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=hm(e),o=r[2];return`${n}.${i}.${o}`}return t}});var mm,In,ql,Uo=re(()=>{"use strict";W();mm="1.4.15",In=()=>mm,ql=()=>{let e=In();return`${Ul(e)}`}});function Mo(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var pm,Vl,Bo,$l,se,vm,L,pe=re(()=>{"use strict";W();Hl();Uo();W();pm={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:xo(),adId:No(),pixelRatio:window.devicePixelRatio||1,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:In()},schema:window.location.href,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5"},Bo=(Vl=globalThis.joliboxJSCore)==null?void 0:Vl.env,se=Object.assign({},($l=Bo==null?void 0:Bo())!=null?$l:pm);vm=()=>{var I,A,w,R,O,D,M,S,N,J,q;let{payloadJson:e,headerJson:t,signature:r}=se.schema.length?Fl(se.schema):{},n=`${se.deviceInfo.did}-${new Date().getTime()}`,o=new URL(se.schema.length?se.schema:window.location.href).searchParams,a=(w=(A=(I=o.get("mpId"))!=null?I:o.get("appId"))!=null?A:o.get("gameId"))!=null?w:"",s=(D=(O=(R=se.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?O:o.get("sessionId"))!=null?D:n,l=!!((S=(M=e==null?void 0:e.testAdsMode)!=null?M:e==null?void 0:e.__testAdsMode)!=null?S:o.get("testAdsMode")==="true"),c=(q=(J=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?J:o.get("joliboxEnv"))!=null?q:"production",m=c==="staging",d=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,b=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return m},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=h.get("joliSource"))!=null?U:o.get("joliSource"))!=null?G:null},get mpId(){var U;return(U=a!=null?a:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:In()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=se.platform)!=null?U:se.deviceInfo.platform).toLowerCase()},get deviceInfo(){return se.deviceInfo},get sdkInfo(){return se.sdkInfo},get hostInfo(){return se.hostInfo},get hostUserInfo(){return se.hostUserInfo},get sessionId(){var U,G;return(G=(U=se.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return d},get webviewId(){var U;return(U=se.webviewId)!=null?U:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Bl(m)},get adId(){var U;return(U=se.deviceInfo.adId)!=null?U:se.deviceInfo.did},get language(){return se.deviceInfo.lang},get sdkEnvironment(){return Mo("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Mo("gamedistribution","jolibox")?"gamedistribution":Mo("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var V,K,Fe;let U=(V=se.deviceInfo.pixelRatio)!=null?V:1,G=(K=se.deviceInfo.statusBarHeight)!=null?K:e==null?void 0:e.__androidStatusBarHeight,j=(Fe=se.deviceInfo.navigationBarHeight)!=null?Fe:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:j!==void 0?j/U:10}},get abTests(){var U,G;return(G=(U=se.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=se.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{kl(se,U,Tl)},encodeJoliSourceQuery:U=>{var G,j;return t&&r?jl(X(X({},e),U),(G=o.get("joliSource"))!=null?G:""):(j=o.get("joliSource"))!=null?j:""},setDoExitDirectly:()=>{b=!1}}},L=vm()});var Go,Wl,gm,_m,Kl,ym,zl=re(()=>{"use strict";W();ut();pe();W();Go=!1,Wl=(e,t)=>e==null?!1:t in e,gm=e=>Wl(e,"kind"),_m=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Kl=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=L.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=L.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_m(e.name)},i=xe(X({},n),{env:t.environment,isFromUser:r});r?Jt.emit("GLOBAL_USER_ERROR",e,i):Jt.emit("GLOBAL_ERROR",e,i)},ym=e=>Wl(e,"kind")&&e.kind==="USER_ERROR";Do.on("ERROR_REPORT",({error:e,options:t})=>{if(Go)return;Go=!0;let r=gm(e)&&e.raw?e.raw:e;try{let n=ym(e);Kl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new Oo(`${i}, origin error: ${r.message}`);Pe.error(o),Kl(new Oo(o.message),{environment:t.environment},!1)}finally{Go=!1}})});var Jo,Fo=re(()=>{"use strict";ut();W();ut();Jo=e=>new Nl(e)});function Yl(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=_l(c,["eventType"]),l=xe(X({tag:n,eventType:o!=null?o:a!=null?a:Mt.Other},t),{extra:X({},s)});n=="globalJsError"?je(new wn(JSON.stringify(l))):e("systemLog",l,L.webviewId)};return r.debounce=xr(r,500,{leading:!0}),r}function Xl(e){let t=(r,n,i)=>{var s;let o=(s=i&&JSON.stringify(i))!=null?s:0,a={speed_value_type:r,total_duration:n};o&&Object.assign(a,{extra:o}),e("joliboxSpeedAnalysis",a)};return t.debounce=xr(t,500,{leading:!0}),t}var Ql=re(()=>{"use strict";W();W();ut();pe()});function Zl(e,t){let r=Yl(e,t),n=Xl(r);return{track:r,trackPerformance:n}}var ec=re(()=>{"use strict";Ql()});var jo=re(()=>{"use strict"});var An,tc=re(()=>{"use strict";pe();W();W();An=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return E(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,o,a,s;let{nativeSDKVersion:t,jssdkVersion:r}=L.sdkInfo;return{platform:1e3,os:L.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(o=(i=L.hostInfo)==null?void 0:i.aid)!=null?o:"1",model:(a=L.deviceInfo.model)!=null?a:"UnknownModel",brand:(s=L.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:L.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return E(this,null,function*(){var d;if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),o=t.target||null,a=t.extra||null,{hostUserInfo:s}=L;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,m={protocolVersion:"1.0.0",events:[xe(X({},t),{location:i,target:o,extra:a,timestamp:Date.now(),userId:(d=s==null?void 0:s.uid)!=null?d:null})],device:l,project:r};try{n?yield this.doReport(To(m),n):yield this.doReport(To(m))}catch(p){Pe.log("[Jolibox SDK] report API error",p)}})}}});var Ho=re(()=>{"use strict";ec();jo();tc()});var qo,rc,ft,Sn,ze,rr=re(()=>{"use strict";Uo();pe();W();qo=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(rc=AbortSignal.timeout)!=null||(AbortSignal.timeout=qo);ft=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new Sn(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},Sn=class{constructor(t){this.xua=ql();this.getJoliSource=()=>L.joliSource;var n;let r=tr(L.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return E(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:o}=r!=null?r:{},a=n?new URLSearchParams(n):null,s=a==null?void 0:a.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,m=this.getJoliSource();o=Object.assign({},o!=null?o:{},c?{"x-user-agent":c}:{},m?{"x-joli-source":m}:{});let d=yield fetch(l,{method:"GET",headers:o,credentials:"include",signal:qo(i!=null?i:3e4)});return ft.getInstance().recordNetworkRequest(!0),yield d.json()}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return E(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,m=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},d?{"x-joli-source":d}:{},{"x-os-type":Ne.isAndroid?"ANDROID":Ne.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(c,{method:"POST",headers:a,body:JSON.stringify(n),signal:qo(o!=null?o:3e4),credentials:"include"});ft.getInstance().recordNetworkRequest(!0);let h=p.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return p.blob()}catch(b){return yield p.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(b){return yield p.text()}if(h!=null&&h.includes("application/json"))try{return yield p.json()}catch(b){return yield p.text()}return p}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return E(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,m=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},d?{"x-joli-source":d}:{});let p=yield fetch(c,{method:"PUT",headers:a,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!p.ok)throw ft.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return ft.getInstance().recordNetworkRequest(!0),yield p.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=Sn;ze=ft.getInstance()});var Vo,Cn,$o=re(()=>{"use strict";pe();Ho();rr();W();Vo=class extends An{constructor(){super(...arguments);this.httpClient=ze.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return Ml((r=L.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},Cn=new Vo(tr(L.testMode))});var bm,nc=re(()=>{"use strict";zl();W();Fo();W();$o();pe();bm=(e,t)=>{var i,o,a;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:Mt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(a=(o=L.hostUserInfo)==null?void 0:o.uid)!=null?a:null};Cn.trackEvent(n,er.WebSDK)};Jt.on("GLOBAL_ERROR",(e,t)=>{bm(t.tag,e)});Jt.on("GLOBAL_USER_ERROR",(e,t)=>{Pe.log("UserError",e,t)})});var Rn,ic=re(()=>{"use strict";Rn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(t)});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,o=!1,a=0,s=()=>{if(!o)return;let h=Date.now(),b=h-r;b>=this.interval&&(this.visible&&(a+=Math.min(b,this.interval+1e3),t(a)),r=h),n=requestAnimationFrame(s)},l=()=>{m(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{d(),r=Date.now(),n=requestAnimationFrame(s)},m=()=>{n&&(cancelAnimationFrame(n),n=0)},d=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{o&&(console.log("visible",h),h?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,m(),d()}}}}});var oc,ac=re(()=>{"use strict";oc=`-----BEGIN PUBLIC KEY-----
1
+ var Ah=Object.create;var vo=Object.defineProperty,Eh=Object.defineProperties,Ih=Object.getOwnPropertyDescriptor,Sh=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertyNames,wn=Object.getOwnPropertySymbols,_l=Object.getPrototypeOf,go=Object.prototype.hasOwnProperty,yl=Object.prototype.propertyIsEnumerable,Rh=Reflect.get;var gl=(e,t,r)=>t in e?vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,z=(e,t)=>{for(var r in t||(t={}))go.call(t,r)&&gl(e,r,t[r]);if(wn)for(var r of wn(t))yl.call(t,r)&&gl(e,r,t[r]);return e},Pe=(e,t)=>Eh(e,Sh(t));var Or=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var bl=(e,t)=>{var r={};for(var n in e)go.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&wn)for(var n of wn(e))t.indexOf(n)<0&&yl.call(e,n)&&(r[n]=e[n]);return r};var ne=(e,t)=>()=>(e&&(t=e(e=0)),t);var _o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ch(t))!go.call(e,i)&&i!==r&&vo(e,i,{get:()=>t[i],enumerable:!(n=Ih(t,i))||n.enumerable});return e};var yo=(e,t,r)=>(r=e!=null?Ah(_l(e)):{},Oh(t||!e||!e.__esModule?vo(r,"default",{value:e,enumerable:!0}):r,e));var wl=(e,t,r)=>Rh(_l(e),r,t);var A=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function Uh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Oo(e){return typeof e=="string"}function Ol(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Tl(e){return typeof e=="object"&&Array.isArray(e)}function Bh(e){return typeof e=="undefined"}function Mh(e){return Bh(e)||e===null}function Gh(e){return typeof e=="function"}function kl(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function xl(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:Il(l)&&Il(s)?i[a]=n(Ro({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function Il(e){return e&&typeof e=="object"&&e.constructor===Object}function Dl(e,t){if(Array.isArray(e))return e.concat(t)}function Dr(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),h=function(...d){i=d,o=this;let m=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!m&&c()},t),m)return c()};return h.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},h.flush=()=>{if(n)return clearTimeout(n),n=null,c()},h}function jh(e,t){return(...r)=>t(e,...r)}function Ul(e){return t=>jh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Fh(`${i}`))}})}function Tr(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function An(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function Wh(e){let t=e.location?An(e.location,Cl):null,r=e.target?An(e.target,Cl):null;return An(Ph(Ro({},e),{location:t,target:r}),Kh)}function No(e){let t=e.events.map(n=>Wh(n)),r=An(e.device,$h);return[e.protocolVersion,t,r,e.project]}function zh(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function Uo(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function Gl(e){return Uo("app","stg-app",e)}function tr(e){return`https://${Uo("api","stg-api",e)}`}function rp(e){return Uo("collect","stg-collect",e)}function Jl(e){return`https://${rp(e)}`}function ap(e){return new Promise(t=>Fl(e)(t))}function Fl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function sp(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new xr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function cp(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)dp(e[n],t[n])}function dp(e,t){if(Oo(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gh(t)){try{if(e instanceof t)return}catch(r){}if(!Mh(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 up(){return typeof globalThis!="undefined"?globalThis[jl]:void 0}function fp(e){typeof globalThis!="undefined"&&(globalThis[jl]=e)}function Ce(e=!1){let t=up();if(!e&&t)return t;let r=new En,n=new So,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return fp(i),i}var Co,Th,kh,xh,Al,Dh,Nh,El,Ro,Ph,Lh,Rl,Gt,Jh,To,ko,Nl,Pl,Fh,Ll,In,Sn,xo,Ue,wo,Hh,Do,Sl,qh,Jt,er,Vh,Cl,Kh,$h,Ye,Zt,Yh,Le,Xh,Qh,Zh,Bl,Po,Lo,ep,tp,Ml,Ft,Ao,se,np,ip,kr,xr,rt,Io,op,bo,lp,xt,En,So,jl,K=ne(()=>{"use strict";Co=Object.defineProperty,Th=Object.defineProperties,kh=Object.getOwnPropertyDescriptor,xh=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,Dh=Object.prototype.hasOwnProperty,Nh=Object.prototype.propertyIsEnumerable,El=(e,t,r)=>t in e?Co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ro=(e,t)=>{for(var r in t||(t={}))Dh.call(t,r)&&El(e,r,t[r]);if(Al)for(var r of Al(t))Nh.call(t,r)&&El(e,r,t[r]);return e},Ph=(e,t)=>Th(e,xh(t)),Lh=(e,t)=>{for(var r in t)Co(e,r,{get:t[r],enumerable:!0})},Rl=(e,t,r,n)=>{for(var i=n>1?void 0:n?kh(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&Co(t,r,i),i},Gt=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Jh=(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))(Jh||{}),To=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}},ko=class extends To{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Nl=class extends To{constructor(){super(...arguments),this.kind="USER_ERROR"}},Pl=class extends Nl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fh=class extends Nl{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Ll=class extends ko{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},In=class extends ko{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Sn=class extends To{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},xo=class extends ko{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Ue={log:Tr("log"),warn:Tr("warn"),info:Tr("info"),error:Tr("error"),debug:Tr("debug")};Object.assign(globalThis,{logger:Ue});wo=Symbol.for("Jolibox.canIUseMap"),Hh={};globalThis[wo]||(globalThis[wo]=Hh);Do={get config(){return globalThis[wo]}},Sl=Symbol.for("Jolibox.canIUseMap.native"),qh={};globalThis[Sl]||(globalThis[Sl]=qh);Jt=(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))(Jt||{}),er=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(er||{}),Vh=(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))(Vh||{}),Cl=["name","params"],Kh=["name","type","location","target","extra","timestamp","userId"],$h=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Ye=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});zh();Zt=typeof window=="undefined",Yh=()=>!Zt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Le={isiOS:!Zt&&(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:!Zt&&navigator.userAgent.includes("Android"),isMac:!Zt&&navigator.userAgent.includes("Mac"),isFacebook:!Zt&&navigator.userAgent.includes("FB_IAB"),isPC:!Zt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Xh=()=>Le.isiOS?"iOS":Le.isAndroid?"Android":Le.isMac?"Mac":Le.isFacebook?"Facebook":"PC",Qh="device_id",Zh="advertising_id",Bl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Ye()),window.__joliboxLocalStorage__.getItem(e)),Po=()=>new URLSearchParams(window.location.search).get("deviceId")||Bl(Qh),Lo=()=>new URLSearchParams(window.location.search).get("advertisingId")||Bl(Zh),ep=e=>e.charAt(0).toUpperCase()+e.slice(1),tp=()=>{var e;let t=new URLSearchParams(window.location.search);return ep((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Ml=e=>{if(Yh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=Xh(),n=navigator.language,i=Po(),o=Lo();return`${t} (${tp()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${o} version/${e||""}`};Ft=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=Ro({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Gt(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),o=this.createTimeoutPromise(),a=Promise.race([i,o]).catch(s=>Gt(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,a),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Gt(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let d=yield this.requestAdapter.execute(e,t),m=this.requestAdapter.extractRealTimeData(d),p=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,d);return p&&!this.config.consistencyChecker(l,p)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,p,s),d):this.requestAdapter.mergeData(l,m)}catch(d){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,d),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),h=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return h&&this.setCachedDataWithSequence(a,h,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Gt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Gt(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),o=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${o})`);let a=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,a);return s&&(this.setCachedDataWithSequence(i,s,o),console.log(`[RequestCacheService] Force updated cache for ${e}`)),a})}warmupCache(e,t){return Gt(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},Ao=class Eo{constructor(t){this.element=t,this.next=Eo.Undefined,this.prev=Eo.Undefined}};Ao.Undefined=new Ao(void 0);se=Ao,np=class{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let e=this._first;for(;e!==se.Undefined;){let t=e.next;e.prev=se.Undefined,e.next=se.Undefined,e=t}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new se(e);if(this._first===se.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==se.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==se.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==se.Undefined&&e.next!==se.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===se.Undefined&&e.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):e.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):e.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==se.Undefined;)yield e.element,e=e.next}},ip=0,kr=class{constructor(e){this.value=e,this.id=ip++}},xr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof kr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new kr(t);return this._listeners?this._listeners instanceof kr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var h,d,m,p;if(!this._disposed){if(this._listeners instanceof kr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((p=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||p.call(m)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof kr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},rt=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new xr,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new np,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},Io={};Lh(Io,{None:()=>op,filter:()=>sp,once:()=>Fl,toPromise:()=>ap});op=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});bo=Symbol.for("Jolibox.hostEmitter"),lp=()=>{let e=new rt;return globalThis[bo]||(globalThis[bo]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[bo]},xt=lp();En=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new xr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return cp(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};En=Rl([kl],En);So=class{constructor(){this._onWillExecuteCommand=new xr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new xr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new En,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uh(3e4)),this._starActivation}executeCommand(e,...t){return Gt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Io.toPromise(Io.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};So=Rl([kl],So);jl=Symbol.for("Jolibox.commands")});function qe(e,t={}){Bo.emit("ERROR_REPORT",{error:e,options:t})}var Bo,jt,ht=ne(()=>{"use strict";K();K();Bo=new rt,jt=new rt;qe.debounce=Dr(qe,50,{leading:!0})});var Mo,hp,Hl,ql,Vl=ne(()=>{"use strict";K();ht();Mo=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},hp=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Hl=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[o,a,s]=i;return{headerJson:Mo(o),payloadJson:Mo(a),signature:Mo(s)}}else throw"joli_source is missing"}catch(r){return qe(new Ll(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},ql=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=hp(e),o=r[2];return`${n}.${i}.${o}`}return t}});var pp,Cn,Kl,Go=ne(()=>{"use strict";K();pp="1.4.18-beta.1",Cn=()=>pp,Kl=()=>{let e=Cn();return`${Ml(e)}`}});function Fo(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var mp,$l,Jo,Wl,le,vp,U,ve=ne(()=>{"use strict";K();Vl();Go();K();mp={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Po(),adId:Lo(),pixelRatio:window.devicePixelRatio||1,platform:Le.isAndroid?"android":Le.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Cn()},schema:window.location.href,platform:Le.isAndroid?"android":Le.isiOS?"ios":"h5"},Jo=($l=globalThis.joliboxJSCore)==null?void 0:$l.env,le=Object.assign({},(Wl=Jo==null?void 0:Jo())!=null?Wl:mp);vp=()=>{var E,I,w,R,O,P,B,S,D,J,H;let{payloadJson:e,headerJson:t,signature:r}=le.schema.length?Hl(le.schema):{},n=`${le.deviceInfo.did}-${new Date().getTime()}`,o=new URL(le.schema.length?le.schema:window.location.href).searchParams,a=(w=(I=(E=o.get("mpId"))!=null?E:o.get("appId"))!=null?I:o.get("gameId"))!=null?w:"",s=(P=(O=(R=le.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?O:o.get("sessionId"))!=null?P:n,l=!!((S=(B=e==null?void 0:e.testAdsMode)!=null?B:e==null?void 0:e.__testAdsMode)!=null?S:o.get("testAdsMode")==="true"),c=(H=(J=(D=e==null?void 0:e.joliboxEnv)!=null?D:e==null?void 0:e.__joliboxEnv)!=null?J:o.get("joliboxEnv"))!=null?H:"production",h=c==="staging",d=t==null?void 0:t.channel,p=new URL(window.location.href).searchParams,b=e==null?void 0:e.__shouldInterupt;return{get startTime(){var L;return(L=performance.timeOrigin)!=null?L:performance.timing.navigationStart},get testMode(){return h},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var L,G;return(G=(L=p.get("joliSource"))!=null?L:o.get("joliSource"))!=null?G:null},get mpId(){var L;return(L=a!=null?a:e==null?void 0:e.id)!=null?L:""},get mpVersion(){var L;return(L=t==null?void 0:t.ver)!=null?L:Cn()},get mpType(){var L,G;return(G=(L=t==null?void 0:t.__mpType)!=null?L:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var L;return((L=le.platform)!=null?L:le.deviceInfo.platform).toLowerCase()},get deviceInfo(){return le.deviceInfo},get sdkInfo(){return le.sdkInfo},get hostInfo(){return le.hostInfo},get hostUserInfo(){return le.hostUserInfo},get sessionId(){var L,G;return(G=(L=le.clientSessionId)!=null?L:s)!=null?G:n},get channel(){return d},get webviewId(){var L;return(L=le.webviewId)!=null?L:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Gl(h)},get adId(){var L;return(L=le.deviceInfo.adId)!=null?L:le.deviceInfo.did},get language(){return le.deviceInfo.lang},get sdkEnvironment(){return Fo("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Fo("gamedistribution","jolibox")?"gamedistribution":Fo("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var Y,X,ye;let L=(Y=le.deviceInfo.pixelRatio)!=null?Y:1,G=(X=le.deviceInfo.statusBarHeight)!=null?X:e==null?void 0:e.__androidStatusBarHeight,F=(ye=le.deviceInfo.navigationBarHeight)!=null?ye:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/L:20,navigationBarHeight:F!==void 0?F/L:10}},get abTests(){var L,G;return(G=(L=le.abValues)==null?void 0:L.split(","))!=null?G:[]},get mpInfo(){var L;return(L=le.mpInfo)!=null?L:{mpName:"unknown"}},onEnvConfigChanged:L=>{xl(le,L,Dl)},encodeJoliSourceQuery:L=>{var G,F;return t&&r?ql(z(z({},e),L),(G=o.get("joliSource"))!=null?G:""):(F=o.get("joliSource"))!=null?F:""},setDoExitDirectly:()=>{b=!1}}},U=vp()});var jo,Yl,gp,_p,zl,yp,Xl=ne(()=>{"use strict";K();ht();ve();K();jo=!1,Yl=(e,t)=>e==null?!1:t in e,gp=e=>Yl(e,"kind"),_p=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},zl=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=U.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=U.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_p(e.name)},i=Pe(z({},n),{env:t.environment,isFromUser:r});r?jt.emit("GLOBAL_USER_ERROR",e,i):jt.emit("GLOBAL_ERROR",e,i)},yp=e=>Yl(e,"kind")&&e.kind==="USER_ERROR";Bo.on("ERROR_REPORT",({error:e,options:t})=>{if(jo)return;jo=!0;let r=gp(e)&&e.raw?e.raw:e;try{let n=yp(e);zl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new xo(`${i}, origin error: ${r.message}`);Ue.error(o),zl(new xo(o.message),{environment:t.environment},!1)}finally{jo=!1}})});var Ho,qo=ne(()=>{"use strict";ht();K();ht();Ho=e=>new Pl(e)});function Ql(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=bl(c,["eventType"]),l=Pe(z({tag:n,eventType:o!=null?o:a!=null?a:Jt.Other},t),{extra:z({},s)});n=="globalJsError"?qe(new In(JSON.stringify(l))):e("systemLog",l,U.webviewId)};return r.debounce=Dr(r,500,{leading:!0}),r}function Zl(e){let t=(r,n,i)=>{var s;let o=(s=i&&JSON.stringify(i))!=null?s:0,a={speed_value_type:r,total_duration:n};o&&Object.assign(a,{extra:o}),e("joliboxSpeedAnalysis",a)};return t.debounce=Dr(t,500,{leading:!0}),t}var ec=ne(()=>{"use strict";K();K();ht();ve()});function tc(e,t){let r=Ql(e,t),n=Zl(r);return{track:r,trackPerformance:n}}var rc=ne(()=>{"use strict";ec()});var Vo=ne(()=>{"use strict"});var Rn,nc=ne(()=>{"use strict";ve();K();K();Rn=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return A(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,o,a,s;let{nativeSDKVersion:t,jssdkVersion:r}=U.sdkInfo;return{platform:1e3,os:U.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(o=(i=U.hostInfo)==null?void 0:i.aid)!=null?o:"1",model:(a=U.deviceInfo.model)!=null?a:"UnknownModel",brand:(s=U.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:U.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return A(this,null,function*(){var d;if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),o=t.target||null,a=t.extra||null,{hostUserInfo:s}=U;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,h={protocolVersion:"1.0.0",events:[Pe(z({},t),{location:i,target:o,extra:a,timestamp:Date.now(),userId:(d=s==null?void 0:s.uid)!=null?d:null})],device:l,project:r};try{n?yield this.doReport(No(h),n):yield this.doReport(No(h))}catch(m){Ue.log("[Jolibox SDK] report API error",m)}})}}});var Ko=ne(()=>{"use strict";rc();Vo();nc()});var $o,ic,pt,On,Xe,rr=ne(()=>{"use strict";Go();ve();K();$o=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(ic=AbortSignal.timeout)!=null||(AbortSignal.timeout=$o);pt=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new On(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},On=class{constructor(t){this.xua=Kl();this.getJoliSource=()=>U.joliSource;var n;let r=tr(U.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return A(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:o}=r!=null?r:{},a=n?new URLSearchParams(n):null,s=a==null?void 0:a.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,h=this.getJoliSource();o=Object.assign({},o!=null?o:{},c?{"x-user-agent":c}:{},h?{"x-joli-source":h}:{});let d=yield fetch(l,{method:"GET",headers:o,credentials:"include",signal:$o(i!=null?i:3e4)});return pt.getInstance().recordNetworkRequest(!0),yield d.json()}catch(n){throw pt.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,h=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},h?{"x-user-agent":h}:{},d?{"x-joli-source":d}:{},{"x-os-type":Le.isAndroid?"ANDROID":Le.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let m=yield fetch(c,{method:"POST",headers:a,body:JSON.stringify(n),signal:$o(o!=null?o:3e4),credentials:"include"});pt.getInstance().recordNetworkRequest(!0);let p=m.headers.get("content-type");if(p!=null&&p.includes("application/octet-stream"))try{return m.blob()}catch(b){return yield m.arrayBuffer()}if(p!=null&&p.includes("multipart/form-data")||p!=null&&p.includes("application/x-www-form-urlencoded"))try{return m.formData()}catch(b){return yield m.text()}if(p!=null&&p.includes("application/json"))try{return yield m.json()}catch(b){return yield m.text()}return m}catch(n){throw pt.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,h=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},h?{"x-user-agent":h}:{},d?{"x-joli-source":d}:{});let m=yield fetch(c,{method:"PUT",headers:a,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!m.ok)throw pt.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${m.status}`);return pt.getInstance().recordNetworkRequest(!0),yield m.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=On;Xe=pt.getInstance()});var Wo,Tn,zo=ne(()=>{"use strict";ve();Ko();rr();K();Wo=class extends Rn{constructor(){super(...arguments);this.httpClient=Xe.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return Jl((r=U.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},Tn=new Wo(tr(U.testMode))});var bp,oc=ne(()=>{"use strict";Xl();K();qo();K();zo();ve();bp=(e,t)=>{var i,o,a;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:Jt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(a=(o=U.hostUserInfo)==null?void 0:o.uid)!=null?a:null};Tn.trackEvent(n,er.WebSDK)};jt.on("GLOBAL_ERROR",(e,t)=>{bp(t.tag,e)});jt.on("GLOBAL_USER_ERROR",(e,t)=>{Ue.log("UserError",e,t)})});var kn,ac=ne(()=>{"use strict";kn=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{let n=window.parent;n&&n!==window&&typeof n.postMessage=="function"&&n.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(t)});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,o=!1,a=0,s=()=>{if(!o)return;let p=Date.now(),b=p-r;b>=this.interval&&(this.visible&&(a+=Math.min(b,this.interval+1e3),t(a)),r=p),n=requestAnimationFrame(s)},l=()=>{h(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let p=Date.now();p-r>=this.interval&&(r=p)},this.interval)},c=()=>{d(),r=Date.now(),n=requestAnimationFrame(s)},h=()=>{n&&(cancelAnimationFrame(n),n=0)},d=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",p=>{o&&(console.log("visible",p),p?c():l())});let m=this.visible;return{start(){o||(o=!0,m?c():l())},stop(){o=!1,h(),d()}}}}});var sc,lc=ne(()=>{"use strict";sc=`-----BEGIN PUBLIC KEY-----
2
2
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs29BUZPZdQwNDEYtXufp
3
3
  IGF40RBoddFzoD2ixl6PjyKWFXF8kxGS++HNtLspxhLvWoE12IZvrP7+whSpgHcy
4
4
  4ryuW86mOdHnP9iyeK69GosHz3lVhQjF9UdhJDXB7P/zdj3VlVzZIj0yL+YvZjO0
@@ -6,9 +6,9 @@ F9vHrK8GMr1/gf3HKAroVJUVmJlWjqhBGoQzb58mqbTSWSN0HkDdYwXHNh/Xc1le
6
6
  DJDbBmfKOQdlBjABR9gb1wGz2LPFA40kzROV9mMiVePXpCOKNMy+b0UOW4RoF7pi
7
7
  Rq0jHJ4fRrMWvf/GugT0mv8YyuU9DaXLqTGP+jOEVvzvgtkO84XtLW1vh5ggINPW
8
8
  2wIDAQAB
9
- -----END PUBLIC KEY-----`});function sc(e){let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return window.btoa(t)}function wm(e){let t="-----BEGIN PUBLIC KEY-----",n=e.substring(e.indexOf(t)+t.length,e.indexOf("-----END PUBLIC KEY-----")).replace(/\s+/g,""),i=window.atob(n),o=new Uint8Array(i.length);for(let a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return o.buffer}function lc(e){return E(this,null,function*(){let t=window.crypto,r=t.subtle,n=wm(oc),i=yield r.importKey("spki",n,{name:"RSA-OAEP",hash:"SHA-1"},!1,["encrypt"]),o=t.getRandomValues(new Uint8Array(32)),a=yield r.importKey("raw",o,"AES-GCM",!1,["encrypt"]),s=yield r.encrypt({name:"RSA-OAEP"},i,o),l=sc(s),m={timestamp:Date.now(),data:e},p=new TextEncoder().encode(JSON.stringify(m)),h=t.getRandomValues(new Uint8Array(12)),b=yield r.encrypt({name:"AES-GCM",iv:h,tagLength:128},a,p),I=new Uint8Array(b),A=new Uint8Array(h.length+I.length);A.set(h,0),A.set(I,h.length);let w=sc(A.buffer);return{k:l,v:"1.0",payload:w}})}var cc=re(()=>{"use strict";ac()});var On,dc=re(()=>{"use strict";pe();ic();rr();cc();On=class extends Rn{constructor(r,n,i){super(n,i);this.httpClient=ze.create();this.gameId=L.mpId,this.sessionId=L.sessionId,this.track=r}reporter(r){return E(this,null,function*(){let{event:n,params:i,extraParams:o}=r,a={eventType:n,gameInfo:X({gameId:this.gameId,sessionId:this.sessionId},i)};o&&Object.assign(a,o);try{let s=yield lc(a);yield this.httpClient.post("/api/base/app-event/v2",{data:s})}catch(s){yield this.httpClient.post("/api/base/app-event",{data:a})}})}tracker(r,n=null){this.track(r,n)}}});var uc,Em,be,Im,Ko,Ye,ht=re(()=>{"use strict";nc();W();W();Ho();$o();dc();pe();jo();uc=Ae(),Em={type:er.WebSDK,platform:"h5",jssdk_version:L.sdkInfo.jssdkVersion,mp_id:L.mpId,mp_version:L.mpVersion},{track:be,trackPerformance:Im}=Zl((...e)=>{var a,s,l,c;let[,t]=e,r=t,n=Cl(r.extra)?r.extra:So(r.extra)?JSON.parse(r.extra):{},i=xe(X({},n),{mp_id:(a=r.mp_id)!=null?a:"",mp_version:(s=r.mp_version)!=null?s:""}),o={name:t.tag,type:Mt.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(c=(l=L.hostUserInfo)==null?void 0:l.uid)!=null?c:null};Cn.trackEvent(o,er.WebSDK)},Em);uc.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Im(e,t,r)});uc.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{be(e,t)});Ko=new et,Ye=new On(be,Ko)});function fc(e){let t=ko.config[e];return t||(t={},ko.config[e]=t),(r,n)=>{if(t[r]){Pe.warn(`[can i use] ${r} already registered`);return}t[r]=X({},n)}}var hc=re(()=>{"use strict";W()});function Wo(e){mc=e}function kn(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>kn(t)):Object.keys(e).reduce((t,r)=>(t[r]=kn(e[r]),t),{})}function mt(e){return typeof e=="number"}function zo(e){let t=Yo(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Yo(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var mc,ve,Tn,xn,Nn,Pn,nr,Dn,Ln,Un,Bn,Mn,Gn,Jn,Fn,jn,Hn,qn,Vn,Xo=re(()=>{"use strict";mc=!1;ve=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(mc)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${zo(t.actual)}`,this.errors.push(r)}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}};Tn=class extends ve{validate(t){return this._optional&&t===void 0?!0:mt(t)?mt(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):mt(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):mt(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 ve{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Nn=class extends ve{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(mt(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(mt(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}},Pn=class extends ve{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},nr=class extends ve{validate(t){return!0}},Dn=class extends ve{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Ln=class extends ve{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Un=class extends ve{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Bn=class extends ve{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${zo(t)}`)}return!0}},Mn=class extends ve{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(mt(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(mt(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(mt(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((o,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,o===void 0&&n.hasDefault){r[a]=n.defaultValue;return}n.validate(o)||(n.hasFallback?r[a]=n.fallbackValue:i=!1)}),this._uniqueItems){let o=new Map;for(let a in r)o.has(r[a])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${o.get(r[a])}] and ${this.path}[${a}] are identical)`):o.set(r[a],a)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},Gn=class extends ve{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Yo(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,o=this._value;o.errors=this.errors;let a=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?o.path=`${this.path}.${s}`:o.path=`${this.path}["${s}"]`,!(l===void 0&&o._optional)){if(l===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(l)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Jn=class extends ve{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Yo(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let o in this._object){let a=n[o],s=this._object[o];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(o)?s.path=`${this.path}.${o}`:s.path=`${this.path}["${o}"]`,!(s._optional&&a===void 0)){if(a===void 0&&s.hasDefault){n[o]=s.defaultValue;continue}s.validate(a)||(s.hasFallback?n[o]=s.fallbackValue:i=!1)}}return i}},Fn=class extends ve{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:zo(this.value),actual:r}):!0}},jn=class extends ve{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let o=0;o<i;o++){let a=this._items[o];if(a.errors=[],a.path=this.path,!a.validate(t))r.push(a.errors.join("; "));else if(!n){n=!0;break}}if(!n){let o=r.join(`
10
- or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let i=t[n];if(i._optional||i.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,t[i]===void 0&&n.hasDefault){t[i]=n.defaultValue;return}n.validate(t[i])||(n.hasFallback?t[i]=n._fallback:r=!1)}),r}},qn=class extends ve{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Vn=class extends ve{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 Qo(e,t,r="param"){if(e.errors=[],e.path=r,Wo(!0),!e.validate(t)){let n=e.errors.join(`
11
- `);throw e.errors.length=0,Wo(!1),new TypeError(n)}}var F,Zo=re(()=>{"use strict";Xo();Xo();F={object(e){return new Jn(e)},array(e){return new Mn(e)},tuple(...e){return new Hn(...e)},literal(e){return new Fn(e)},or(...e){return new jn(...e)},symbol(){return new Pn},record(e){return new Gn(e)},function(){return new Un},boolean(){return new xn},string(){return new Nn},number(){return new Tn},undefined(){return new Dn},null(){return new Ln},unknown(){return new nr},any(){return new nr},as(){return new nr},arraybuffer(){return new qn},enum(...e){return new Bn(...e)},typedarray(e){return new Vn(e)}}});var $n,pc,vc=re(()=>{"use strict";W();ut();Zo();Fo();$n=1,pc=e=>{function t(n,i){return(...o)=>{var d,p,h,b;let a=Date.now(),s={method:n,trace_id:$n};$n+=1;let l="SUCCESS",c=`${n}:ok`,m=0;try{if(i.paramsSchema)try{Qo(i.paramsSchema,o,"params")}catch(R){throw Jo(`${n}:fail ${R.message}`)}let I=i.implement(...o),A=I,w=`${n}:ok`;if(I&&"code"in I){let{code:R,data:O,message:D}=I;l=R,A=O,w=D}return{code:l,message:w,data:A}}catch(I){let A=I;m=(p=(d=A.code)!=null?d:A.errNo)!=null?p:2e3,l="FAILURE";let w=(b=(h=A.message)!=null?h:A.errMsg)!=null?b:`${I}`;return c=`${n}:${l} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`,je(new En(c,m)),{code:l,message:c}}finally{let I=Date.now()-a}}}function r(n,i){return(...o)=>E(this,null,function*(){var p,h,b,I;let a=Rl(o)?o:[o],s=Date.now(),l={method:n,trace_id:$n};$n+=1;let c=`${n}:ok`,m="SUCCESS",d={code:m,message:c};try{if(i.paramsSchema)try{Qo(i.paramsSchema,a,"params")}catch(R){throw Jo(R.message)}let w=yield i.implement(...a);if(w&&"code"in w){let{code:R,data:O,message:D}=w;m=R,c=D,w=O}return Object.assign(d,{code:m,message:c,data:w}),d}catch(A){let w=A,R=(h=(p=w.code)!=null?p:w.errNo)!=null?h:2e3;m="FAILURE";let O=(I=(b=w.message)!=null?b:w.errMsg)!=null?I:`${A}`,D=`${n}:${m} ${O.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(d,{code:m,message:D}),je(new En(D,R)),d}finally{let A=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var Xe,Ft,we,Nr=re(()=>{"use strict";hc();ht();vc();Zo();({createAPI:Xe,createSyncAPI:Ft}=pc(be)),we=fc("h5")});var bc=po((yc,na)=>{(function(e){if(typeof yc=="object"&&typeof na!="undefined")na.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(i,o,a){function s(m,d){if(!o[m]){if(!i[m]){var p=typeof Rr=="function"&&Rr;if(!d&&p)return p(m,!0);if(l)return l(m,!0);var h=new Error("Cannot find module '"+m+"'");throw h.code="MODULE_NOT_FOUND",h}var b=o[m]={exports:{}};i[m][0].call(b.exports,function(I){var A=i[m][1][I];return s(A||I)},b,b.exports,n,i,o,a)}return o[m].exports}for(var l=typeof Rr=="function"&&Rr,c=0;c<a.length;c++)s(a[c]);return s}({1:[function(n,i,o){(function(a){"use strict";var s=a.MutationObserver||a.WebKitMutationObserver,l;if(s){var c=0,m=new s(I),d=a.document.createTextNode("");m.observe(d,{characterData:!0}),l=function(){d.data=c=++c%2}}else if(!a.setImmediate&&typeof a.MessageChannel!="undefined"){var p=new a.MessageChannel;p.port1.onmessage=I,l=function(){p.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?l=function(){var w=a.document.createElement("script");w.onreadystatechange=function(){I(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},a.document.documentElement.appendChild(w)}:l=function(){setTimeout(I,0)};var h,b=[];function I(){h=!0;for(var w,R,O=b.length;O;){for(R=b,b=[],w=-1;++w<O;)R[w]();O=b.length}h=!1}i.exports=A;function A(w){b.push(w)===1&&!h&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,o){"use strict";var a=n(1);function s(){}var l={},c=["REJECTED"],m=["FULFILLED"],d=["PENDING"];i.exports=p;function p(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,S!==s&&A(this,S)}p.prototype.catch=function(S){return this.then(null,S)},p.prototype.then=function(S,N){if(typeof S!="function"&&this.state===m||typeof N!="function"&&this.state===c)return this;var J=new this.constructor(s);if(this.state!==d){var q=this.state===m?S:N;b(J,q,this.outcome)}else this.queue.push(new h(J,S,N));return J};function h(S,N,J){this.promise=S,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof J=="function"&&(this.onRejected=J,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},h.prototype.otherCallFulfilled=function(S){b(this.promise,this.onFulfilled,S)},h.prototype.callRejected=function(S){l.reject(this.promise,S)},h.prototype.otherCallRejected=function(S){b(this.promise,this.onRejected,S)};function b(S,N,J){a(function(){var q;try{q=N(J)}catch(U){return l.reject(S,U)}q===S?l.reject(S,new TypeError("Cannot resolve promise with itself")):l.resolve(S,q)})}l.resolve=function(S,N){var J=w(I,N);if(J.status==="error")return l.reject(S,J.value);var q=J.value;if(q)A(S,q);else{S.state=m,S.outcome=N;for(var U=-1,G=S.queue.length;++U<G;)S.queue[U].callFulfilled(N)}return S},l.reject=function(S,N){S.state=c,S.outcome=N;for(var J=-1,q=S.queue.length;++J<q;)S.queue[J].callRejected(N);return S};function I(S){var N=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof N=="function")return function(){N.apply(S,arguments)}}function A(S,N){var J=!1;function q(V){J||(J=!0,l.reject(S,V))}function U(V){J||(J=!0,l.resolve(S,V))}function G(){N(U,q)}var j=w(G);j.status==="error"&&q(j.value)}function w(S,N){var J={};try{J.value=S(N),J.status="success"}catch(q){J.status="error",J.value=q}return J}p.resolve=R;function R(S){return S instanceof this?S:l.resolve(new this(s),S)}p.reject=O;function O(S){var N=new this(s);return l.reject(N,S)}p.all=D;function D(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=S.length,q=!1;if(!J)return this.resolve([]);for(var U=new Array(J),G=0,j=-1,V=new this(s);++j<J;)K(S[j],j);return V;function K(Fe,Yt){N.resolve(Fe).then(Xt,function(ct){q||(q=!0,l.reject(V,ct))});function Xt(ct){U[Yt]=ct,++G===J&&!q&&(q=!0,l.resolve(V,U))}}}p.race=M;function M(S){var N=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=S.length,q=!1;if(!J)return this.resolve([]);for(var U=-1,G=new this(s);++U<J;)j(S[U]);return G;function j(V){N.resolve(V).then(function(K){q||(q=!0,l.resolve(G,K))},function(K){q||(q=!0,l.reject(G,K))})}}},{1:1}],3:[function(n,i,o){(function(a){"use strict";typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u};function s(u,v){if(!(u instanceof v))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(u){return}}var c=l();function m(){try{if(!c||!c.open)return!1;var u=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),v=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!u||v)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(f){return!1}}function d(u,v){u=u||[],v=v||{};try{return new Blob(u,v)}catch(g){if(g.name!=="TypeError")throw g;for(var f=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,_=new f,y=0;y<u.length;y+=1)_.append(u[y]);return _.getBlob(v.type)}}typeof Promise=="undefined"&&n(3);var p=Promise;function h(u,v){v&&u.then(function(f){v(null,f)},function(f){v(f)})}function b(u,v,f){typeof v=="function"&&u.then(v),typeof f=="function"&&u.catch(f)}function I(u){return typeof u!="string"&&(console.warn(u+" used as a key, but it is not a string."),u=String(u)),u}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var w="local-forage-detect-blob-support",R=void 0,O={},D=Object.prototype.toString,M="readonly",S="readwrite";function N(u){for(var v=u.length,f=new ArrayBuffer(v),_=new Uint8Array(f),y=0;y<v;y++)_[y]=u.charCodeAt(y);return f}function J(u){return new p(function(v){var f=u.transaction(w,S),_=d([""]);f.objectStore(w).put(_,"key"),f.onabort=function(y){y.preventDefault(),y.stopPropagation(),v(!1)},f.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),g=navigator.userAgent.match(/Edge\//);v(g||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function q(u){return typeof R=="boolean"?p.resolve(R):J(u).then(function(v){return R=v,R})}function U(u){var v=O[u.name],f={};f.promise=new p(function(_,y){f.resolve=_,f.reject=y}),v.deferredOperations.push(f),v.dbReady?v.dbReady=v.dbReady.then(function(){return f.promise}):v.dbReady=f.promise}function G(u){var v=O[u.name],f=v.deferredOperations.pop();if(f)return f.resolve(),f.promise}function j(u,v){var f=O[u.name],_=f.deferredOperations.pop();if(_)return _.reject(v),_.promise}function V(u,v){return new p(function(f,_){if(O[u.name]=O[u.name]||zs(),u.db)if(v)U(u),u.db.close();else return f(u.db);var y=[u.name];v&&y.push(u.version);var g=c.open.apply(c,y);v&&(g.onupgradeneeded=function(C){var k=g.result;try{k.createObjectStore(u.storeName),C.oldVersion<=1&&k.createObjectStore(w)}catch(T){if(T.name==="ConstraintError")console.warn('The database "'+u.name+'" has been upgraded from version '+C.oldVersion+" to version "+C.newVersion+', but the storage "'+u.storeName+'" already exists.');else throw T}}),g.onerror=function(C){C.preventDefault(),_(g.error)},g.onsuccess=function(){var C=g.result;C.onversionchange=function(k){k.target.close()},f(C),G(u)}})}function K(u){return V(u,!1)}function Fe(u){return V(u,!0)}function Yt(u,v){if(!u.db)return!0;var f=!u.db.objectStoreNames.contains(u.storeName),_=u.version<u.db.version,y=u.version>u.db.version;if(_&&(u.version!==v&&console.warn('The database "'+u.name+`" can't be downgraded from version `+u.db.version+" to version "+u.version+"."),u.version=u.db.version),y||f){if(f){var g=u.db.version+1;g>u.version&&(u.version=g)}return!0}return!1}function Xt(u){return new p(function(v,f){var _=new FileReader;_.onerror=f,_.onloadend=function(y){var g=btoa(y.target.result||"");v({__local_forage_encoded_blob:!0,data:g,type:u.type})},_.readAsBinaryString(u)})}function ct(u){var v=N(atob(u.data));return d([v],{type:u.type})}function Ws(u){return u&&u.__local_forage_encoded_blob}function If(u){var v=this,f=v._initReady().then(function(){var _=O[v._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return b(f,u,u),f}function Af(u){U(u);for(var v=O[u.name],f=v.forages,_=0;_<f.length;_++){var y=f[_];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return u.db=null,K(u).then(function(g){return u.db=g,Yt(u)?Fe(u):g}).then(function(g){u.db=v.db=g;for(var C=0;C<f.length;C++)f[C]._dbInfo.db=g}).catch(function(g){throw j(u,g),g})}function dt(u,v,f,_){_===void 0&&(_=1);try{var y=u.db.transaction(u.storeName,v);f(null,y)}catch(g){if(_>0&&(!u.db||g.name==="InvalidStateError"||g.name==="NotFoundError"))return p.resolve().then(function(){if(!u.db||g.name==="NotFoundError"&&!u.db.objectStoreNames.contains(u.storeName)&&u.version<=u.db.version)return u.db&&(u.version=u.db.version+1),Fe(u)}).then(function(){return Af(u).then(function(){dt(u,v,f,_-1)})}).catch(f);f(g)}}function zs(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Sf(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=u[_];var y=O[f.name];y||(y=zs(),O[f.name]=y),y.forages.push(v),v._initReady||(v._initReady=v.ready,v.ready=If);var g=[];function C(){return p.resolve()}for(var k=0;k<y.forages.length;k++){var T=y.forages[k];T!==v&&g.push(T._initReady().catch(C))}var x=y.forages.slice(0);return p.all(g).then(function(){return f.db=y.db,K(f)}).then(function(P){return f.db=P,Yt(f,v._defaultConfig.version)?Fe(f):P}).then(function(P){f.db=y.db=P,v._dbInfo=f;for(var B=0;B<x.length;B++){var z=x[B];z!==v&&(z._dbInfo.db=f.db,z._dbInfo.version=f.version)}})}function Cf(u,v){var f=this;u=I(u);var _=new p(function(y,g){f.ready().then(function(){dt(f._dbInfo,M,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=T.get(u);x.onsuccess=function(){var P=x.result;P===void 0&&(P=null),Ws(P)&&(P=ct(P)),y(P)},x.onerror=function(){g(x.error)}}catch(P){g(P)}})}).catch(g)});return h(_,v),_}function Rf(u,v){var f=this,_=new p(function(y,g){f.ready().then(function(){dt(f._dbInfo,M,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=T.openCursor(),P=1;x.onsuccess=function(){var B=x.result;if(B){var z=B.value;Ws(z)&&(z=ct(z));var ee=u(z,B.key,P++);ee!==void 0?y(ee):B.continue()}else y()},x.onerror=function(){g(x.error)}}catch(B){g(B)}})}).catch(g)});return h(_,v),_}function Of(u,v,f){var _=this;u=I(u);var y=new p(function(g,C){var k;_.ready().then(function(){return k=_._dbInfo,D.call(v)==="[object Blob]"?q(k.db).then(function(T){return T?v:Xt(v)}):v}).then(function(T){dt(_._dbInfo,S,function(x,P){if(x)return C(x);try{var B=P.objectStore(_._dbInfo.storeName);T===null&&(T=void 0);var z=B.put(T,u);P.oncomplete=function(){T===void 0&&(T=null),g(T)},P.onabort=P.onerror=function(){var ee=z.error?z.error:z.transaction.error;C(ee)}}catch(ee){C(ee)}})}).catch(C)});return h(y,f),y}function kf(u,v){var f=this;u=I(u);var _=new p(function(y,g){f.ready().then(function(){dt(f._dbInfo,S,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=T.delete(u);k.oncomplete=function(){y()},k.onerror=function(){g(x.error)},k.onabort=function(){var P=x.error?x.error:x.transaction.error;g(P)}}catch(P){g(P)}})}).catch(g)});return h(_,v),_}function Tf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){dt(v._dbInfo,S,function(g,C){if(g)return y(g);try{var k=C.objectStore(v._dbInfo.storeName),T=k.clear();C.oncomplete=function(){_()},C.onabort=C.onerror=function(){var x=T.error?T.error:T.transaction.error;y(x)}}catch(x){y(x)}})}).catch(y)});return h(f,u),f}function xf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){dt(v._dbInfo,M,function(g,C){if(g)return y(g);try{var k=C.objectStore(v._dbInfo.storeName),T=k.count();T.onsuccess=function(){_(T.result)},T.onerror=function(){y(T.error)}}catch(x){y(x)}})}).catch(y)});return h(f,u),f}function Nf(u,v){var f=this,_=new p(function(y,g){if(u<0){y(null);return}f.ready().then(function(){dt(f._dbInfo,M,function(C,k){if(C)return g(C);try{var T=k.objectStore(f._dbInfo.storeName),x=!1,P=T.openKeyCursor();P.onsuccess=function(){var B=P.result;if(!B){y(null);return}u===0||x?y(B.key):(x=!0,B.advance(u))},P.onerror=function(){g(P.error)}}catch(B){g(B)}})}).catch(g)});return h(_,v),_}function Pf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){dt(v._dbInfo,M,function(g,C){if(g)return y(g);try{var k=C.objectStore(v._dbInfo.storeName),T=k.openKeyCursor(),x=[];T.onsuccess=function(){var P=T.result;if(!P){_(x);return}x.push(P.key),P.continue()},T.onerror=function(){y(T.error)}}catch(P){y(P)}})}).catch(y)});return h(f,u),f}function Df(u,v){v=A.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;if(!u.name)y=p.reject("Invalid arguments");else{var g=u.name===f.name&&_._dbInfo.db,C=g?p.resolve(_._dbInfo.db):K(u).then(function(k){var T=O[u.name],x=T.forages;T.db=k;for(var P=0;P<x.length;P++)x[P]._dbInfo.db=k;return k});u.storeName?y=C.then(function(k){if(k.objectStoreNames.contains(u.storeName)){var T=k.version+1;U(u);var x=O[u.name],P=x.forages;k.close();for(var B=0;B<P.length;B++){var z=P[B];z._dbInfo.db=null,z._dbInfo.version=T}var ee=new p(function(te,me){var fe=c.open(u.name,T);fe.onerror=function($e){var Cr=fe.result;Cr.close(),me($e)},fe.onupgradeneeded=function(){var $e=fe.result;$e.deleteObjectStore(u.storeName)},fe.onsuccess=function(){var $e=fe.result;$e.close(),te($e)}});return ee.then(function(te){x.db=te;for(var me=0;me<P.length;me++){var fe=P[me];fe._dbInfo.db=te,G(fe._dbInfo)}}).catch(function(te){throw(j(u,te)||p.resolve()).catch(function(){}),te})}}):y=C.then(function(k){U(u);var T=O[u.name],x=T.forages;k.close();for(var P=0;P<x.length;P++){var B=x[P];B._dbInfo.db=null}var z=new p(function(ee,te){var me=c.deleteDatabase(u.name);me.onerror=function(){var fe=me.result;fe&&fe.close(),te(me.error)},me.onblocked=function(){console.warn('dropInstance blocked for database "'+u.name+'" until all open connections are closed')},me.onsuccess=function(){var fe=me.result;fe&&fe.close(),ee(fe)}});return z.then(function(ee){T.db=ee;for(var te=0;te<x.length;te++){var me=x[te];G(me._dbInfo)}}).catch(function(ee){throw(j(u,ee)||p.resolve()).catch(function(){}),ee})})}return h(y,v),y}var Lf={_driver:"asyncStorage",_initStorage:Sf,_support:m(),iterate:Rf,getItem:Cf,setItem:Of,removeItem:kf,clear:Tf,length:xf,key:Nf,keys:Pf,dropInstance:Df};function Uf(){return typeof openDatabase=="function"}var Rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bf="~~local_forage_type~",Ys=/^~~local_forage_type~([^~]+)~/,vn="__lfsc__:",no=vn.length,io="arbf",oo="blob",Xs="si08",Qs="ui08",Zs="uic8",el="si16",tl="si32",rl="ur16",nl="ui32",il="fl32",ol="fl64",al=no+io.length,sl=Object.prototype.toString;function ll(u){var v=u.length*.75,f=u.length,_,y=0,g,C,k,T;u[u.length-1]==="="&&(v--,u[u.length-2]==="="&&v--);var x=new ArrayBuffer(v),P=new Uint8Array(x);for(_=0;_<f;_+=4)g=Rt.indexOf(u[_]),C=Rt.indexOf(u[_+1]),k=Rt.indexOf(u[_+2]),T=Rt.indexOf(u[_+3]),P[y++]=g<<2|C>>4,P[y++]=(C&15)<<4|k>>2,P[y++]=(k&3)<<6|T&63;return x}function ao(u){var v=new Uint8Array(u),f="",_;for(_=0;_<v.length;_+=3)f+=Rt[v[_]>>2],f+=Rt[(v[_]&3)<<4|v[_+1]>>4],f+=Rt[(v[_+1]&15)<<2|v[_+2]>>6],f+=Rt[v[_+2]&63];return v.length%3===2?f=f.substring(0,f.length-1)+"=":v.length%3===1&&(f=f.substring(0,f.length-2)+"=="),f}function Mf(u,v){var f="";if(u&&(f=sl.call(u)),u&&(f==="[object ArrayBuffer]"||u.buffer&&sl.call(u.buffer)==="[object ArrayBuffer]")){var _,y=vn;u instanceof ArrayBuffer?(_=u,y+=io):(_=u.buffer,f==="[object Int8Array]"?y+=Xs:f==="[object Uint8Array]"?y+=Qs:f==="[object Uint8ClampedArray]"?y+=Zs:f==="[object Int16Array]"?y+=el:f==="[object Uint16Array]"?y+=rl:f==="[object Int32Array]"?y+=tl:f==="[object Uint32Array]"?y+=nl:f==="[object Float32Array]"?y+=il:f==="[object Float64Array]"?y+=ol:v(new Error("Failed to get type for BinaryArray"))),v(y+ao(_))}else if(f==="[object Blob]"){var g=new FileReader;g.onload=function(){var C=Bf+u.type+"~"+ao(this.result);v(vn+oo+C)},g.readAsArrayBuffer(u)}else try{v(JSON.stringify(u))}catch(C){console.error("Couldn't convert value into a JSON string: ",u),v(null,C)}}function Gf(u){if(u.substring(0,no)!==vn)return JSON.parse(u);var v=u.substring(al),f=u.substring(no,al),_;if(f===oo&&Ys.test(v)){var y=v.match(Ys);_=y[1],v=v.substring(y[0].length)}var g=ll(v);switch(f){case io:return g;case oo:return d([g],{type:_});case Xs:return new Int8Array(g);case Qs:return new Uint8Array(g);case Zs:return new Uint8ClampedArray(g);case el:return new Int16Array(g);case rl:return new Uint16Array(g);case tl:return new Int32Array(g);case nl:return new Uint32Array(g);case il:return new Float32Array(g);case ol:return new Float64Array(g);default:throw new Error("Unkown type: "+f)}}var so={serialize:Mf,deserialize:Gf,stringToBuffer:ll,bufferToString:ao};function cl(u,v,f,_){u.executeSql("CREATE TABLE IF NOT EXISTS "+v.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,_)}function Jf(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=typeof u[_]!="string"?u[_].toString():u[_];var y=new p(function(g,C){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch(k){return C(k)}f.db.transaction(function(k){cl(k,f,function(){v._dbInfo=f,g()},function(T,x){C(x)})},C)});return f.serializer=so,y}function Ot(u,v,f,_,y,g){u.executeSql(f,_,y,function(C,k){k.code===k.SYNTAX_ERR?C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[v.storeName],function(T,x){x.rows.length?g(T,k):cl(T,v,function(){T.executeSql(f,_,y,g)},g)},g):g(C,k)},g)}function Ff(u,v){var f=this;u=I(u);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[u],function(T,x){var P=x.rows.length?x.rows.item(0).value:null;P&&(P=C.serializer.deserialize(P)),y(P)},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function jf(u,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"SELECT * FROM "+C.storeName,[],function(T,x){for(var P=x.rows,B=P.length,z=0;z<B;z++){var ee=P.item(z),te=ee.value;if(te&&(te=C.serializer.deserialize(te)),te=u(te,ee.key,z+1),te!==void 0){y(te);return}}y()},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function dl(u,v,f,_){var y=this;u=I(u);var g=new p(function(C,k){y.ready().then(function(){v===void 0&&(v=null);var T=v,x=y._dbInfo;x.serializer.serialize(v,function(P,B){B?k(B):x.db.transaction(function(z){Ot(z,x,"INSERT OR REPLACE INTO "+x.storeName+" (key, value) VALUES (?, ?)",[u,P],function(){C(T)},function(ee,te){k(te)})},function(z){if(z.code===z.QUOTA_ERR){if(_>0){C(dl.apply(y,[u,T,f,_-1]));return}k(z)}})})}).catch(k)});return h(g,f),g}function Hf(u,v,f){return dl.apply(this,[u,v,f,1])}function qf(u,v){var f=this;u=I(u);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[u],function(){y()},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function Vf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){Ot(C,g,"DELETE FROM "+g.storeName,[],function(){_()},function(k,T){y(T)})})}).catch(y)});return h(f,u),f}function $f(u){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){Ot(C,g,"SELECT COUNT(key) as c FROM "+g.storeName,[],function(k,T){var x=T.rows.item(0).c;_(x)},function(k,T){y(T)})})}).catch(y)});return h(f,u),f}function Kf(u,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(k){Ot(k,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[u+1],function(T,x){var P=x.rows.length?x.rows.item(0).key:null;y(P)},function(T,x){g(x)})})}).catch(g)});return h(_,v),_}function Wf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){Ot(C,g,"SELECT key FROM "+g.storeName,[],function(k,T){for(var x=[],P=0;P<T.rows.length;P++)x.push(T.rows.item(P).key);_(x)},function(k,T){y(T)})})}).catch(y)});return h(f,u),f}function zf(u){return new p(function(v,f){u.transaction(function(_){_.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,g){for(var C=[],k=0;k<g.rows.length;k++)C.push(g.rows.item(k).name);v({db:u,storeNames:C})},function(y,g){f(g)})},function(_){f(_)})})}function Yf(u,v){v=A.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;return u.name?y=new p(function(g){var C;u.name===f.name?C=_._dbInfo.db:C=openDatabase(u.name,"","",0),u.storeName?g({db:C,storeNames:[u.storeName]}):g(zf(C))}).then(function(g){return new p(function(C,k){g.db.transaction(function(T){function x(ee){return new p(function(te,me){T.executeSql("DROP TABLE IF EXISTS "+ee,[],function(){te()},function(fe,$e){me($e)})})}for(var P=[],B=0,z=g.storeNames.length;B<z;B++)P.push(x(g.storeNames[B]));p.all(P).then(function(){C()}).catch(function(ee){k(ee)})},function(T){k(T)})})}):y=p.reject("Invalid arguments"),h(y,v),y}var Xf={_driver:"webSQLStorage",_initStorage:Jf,_support:Uf(),iterate:jf,getItem:Ff,setItem:Hf,removeItem:qf,clear:Vf,length:$f,key:Kf,keys:Wf,dropInstance:Yf};function Qf(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(u){return!1}}function ul(u,v){var f=u.name+"/";return u.storeName!==v.storeName&&(f+=u.storeName+"/"),f}function Zf(){var u="_localforage_support_test";try{return localStorage.setItem(u,!0),localStorage.removeItem(u),!1}catch(v){return!0}}function eh(){return!Zf()||localStorage.length>0}function th(u){var v=this,f={};if(u)for(var _ in u)f[_]=u[_];return f.keyPrefix=ul(u,v._defaultConfig),eh()?(v._dbInfo=f,f.serializer=so,p.resolve()):p.reject()}function rh(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var g=localStorage.key(y);g.indexOf(_)===0&&localStorage.removeItem(g)}});return h(f,u),f}function nh(u,v){var f=this;u=I(u);var _=f.ready().then(function(){var y=f._dbInfo,g=localStorage.getItem(y.keyPrefix+u);return g&&(g=y.serializer.deserialize(g)),g});return h(_,v),_}function ih(u,v){var f=this,_=f.ready().then(function(){for(var y=f._dbInfo,g=y.keyPrefix,C=g.length,k=localStorage.length,T=1,x=0;x<k;x++){var P=localStorage.key(x);if(P.indexOf(g)===0){var B=localStorage.getItem(P);if(B&&(B=y.serializer.deserialize(B)),B=u(B,P.substring(C),T++),B!==void 0)return B}}});return h(_,v),_}function oh(u,v){var f=this,_=f.ready().then(function(){var y=f._dbInfo,g;try{g=localStorage.key(u)}catch(C){g=null}return g&&(g=g.substring(y.keyPrefix.length)),g});return h(_,v),_}function ah(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo,y=localStorage.length,g=[],C=0;C<y;C++){var k=localStorage.key(C);k.indexOf(_.keyPrefix)===0&&g.push(k.substring(_.keyPrefix.length))}return g});return h(f,u),f}function sh(u){var v=this,f=v.keys().then(function(_){return _.length});return h(f,u),f}function lh(u,v){var f=this;u=I(u);var _=f.ready().then(function(){var y=f._dbInfo;localStorage.removeItem(y.keyPrefix+u)});return h(_,v),_}function ch(u,v,f){var _=this;u=I(u);var y=_.ready().then(function(){v===void 0&&(v=null);var g=v;return new p(function(C,k){var T=_._dbInfo;T.serializer.serialize(v,function(x,P){if(P)k(P);else try{localStorage.setItem(T.keyPrefix+u,x),C(g)}catch(B){(B.name==="QuotaExceededError"||B.name==="NS_ERROR_DOM_QUOTA_REACHED")&&k(B),k(B)}})})});return h(y,f),y}function dh(u,v){if(v=A.apply(this,arguments),u=typeof u!="function"&&u||{},!u.name){var f=this.config();u.name=u.name||f.name,u.storeName=u.storeName||f.storeName}var _=this,y;return u.name?y=new p(function(g){u.storeName?g(ul(u,_._defaultConfig)):g(u.name+"/")}).then(function(g){for(var C=localStorage.length-1;C>=0;C--){var k=localStorage.key(C);k.indexOf(g)===0&&localStorage.removeItem(k)}}):y=p.reject("Invalid arguments"),h(y,v),y}var uh={_driver:"localStorageWrapper",_initStorage:th,_support:Qf(),iterate:ih,getItem:nh,setItem:ch,removeItem:lh,clear:rh,length:sh,key:oh,keys:ah,dropInstance:dh},fh=function(v,f){return v===f||typeof v=="number"&&typeof f=="number"&&isNaN(v)&&isNaN(f)},hh=function(v,f){for(var _=v.length,y=0;y<_;){if(fh(v[y],f))return!0;y++}return!1},fl=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"},Sr={},hl={},Qt={INDEXEDDB:Lf,WEBSQL:Xf,LOCALSTORAGE:uh},mh=[Qt.INDEXEDDB._driver,Qt.WEBSQL._driver,Qt.LOCALSTORAGE._driver],gn=["dropInstance"],lo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(gn),ph={description:"",driver:mh.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function vh(u,v){u[v]=function(){var f=arguments;return u.ready().then(function(){return u[v].apply(u,f)})}}function co(){for(var u=1;u<arguments.length;u++){var v=arguments[u];if(v)for(var f in v)v.hasOwnProperty(f)&&(fl(v[f])?arguments[0][f]=v[f].slice():arguments[0][f]=v[f])}return arguments[0]}var gh=function(){function u(v){s(this,u);for(var f in Qt)if(Qt.hasOwnProperty(f)){var _=Qt[f],y=_._driver;this[f]=y,Sr[y]||this.defineDriver(_)}this._defaultConfig=co({},ph),this._config=co({},this._defaultConfig,v),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return u.prototype.config=function(f){if((typeof f=="undefined"?"undefined":a(f))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var _ in f){if(_==="storeName"&&(f[_]=f[_].replace(/\W/g,"_")),_==="version"&&typeof f[_]!="number")return new Error("Database version must be a number.");this._config[_]=f[_]}return"driver"in f&&f.driver?this.setDriver(this._config.driver):!0}else return typeof f=="string"?this._config[f]:this._config},u.prototype.defineDriver=function(f,_,y){var g=new p(function(C,k){try{var T=f._driver,x=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){k(x);return}for(var P=lo.concat("_initStorage"),B=0,z=P.length;B<z;B++){var ee=P[B],te=!hh(gn,ee);if((te||f[ee])&&typeof f[ee]!="function"){k(x);return}}var me=function(){for(var Cr=function(bh){return function(){var wh=new Error("Method "+bh+" is not implemented by the current driver"),ml=p.reject(wh);return h(ml,arguments[arguments.length-1]),ml}},uo=0,yh=gn.length;uo<yh;uo++){var fo=gn[uo];f[fo]||(f[fo]=Cr(fo))}};me();var fe=function(Cr){Sr[T]&&console.info("Redefining LocalForage driver: "+T),Sr[T]=f,hl[T]=Cr,C()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(fe,k):fe(!!f._support):fe(!0)}catch($e){k($e)}});return b(g,_,y),g},u.prototype.driver=function(){return this._driver||null},u.prototype.getDriver=function(f,_,y){var g=Sr[f]?p.resolve(Sr[f]):p.reject(new Error("Driver not found."));return b(g,_,y),g},u.prototype.getSerializer=function(f){var _=p.resolve(so);return b(_,f),_},u.prototype.ready=function(f){var _=this,y=_._driverSet.then(function(){return _._ready===null&&(_._ready=_._initDriver()),_._ready});return b(y,f,f),y},u.prototype.setDriver=function(f,_,y){var g=this;fl(f)||(f=[f]);var C=this._getSupportedDrivers(f);function k(){g._config.driver=g.driver()}function T(B){return g._extend(B),k(),g._ready=g._initStorage(g._config),g._ready}function x(B){return function(){var z=0;function ee(){for(;z<B.length;){var te=B[z];return z++,g._dbInfo=null,g._ready=null,g.getDriver(te).then(T).catch(ee)}k();var me=new Error("No available storage method found.");return g._driverSet=p.reject(me),g._driverSet}return ee()}}var P=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=P.then(function(){var B=C[0];return g._dbInfo=null,g._ready=null,g.getDriver(B).then(function(z){g._driver=z._driver,k(),g._wrapLibraryMethodsWithReady(),g._initDriver=x(C)})}).catch(function(){k();var B=new Error("No available storage method found.");return g._driverSet=p.reject(B),g._driverSet}),b(this._driverSet,_,y),this._driverSet},u.prototype.supports=function(f){return!!hl[f]},u.prototype._extend=function(f){co(this,f)},u.prototype._getSupportedDrivers=function(f){for(var _=[],y=0,g=f.length;y<g;y++){var C=f[y];this.supports(C)&&_.push(C)}return _},u.prototype._wrapLibraryMethodsWithReady=function(){for(var f=0,_=lo.length;f<_;f++)vh(this,lo[f])},u.prototype.createInstance=function(f){return new u(f)},u}(),_h=new gh;i.exports=_h},{3:3}]},{},[4])(4)})});var Ec=po(ir=>{"use strict";W();Nr();ht();var Dr=(e,t)=>{window.parent&&window.parent.postMessage({type:e,data:t},"*")},Lr=Ae(),Fm=Xe("levelFinished",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number()),duration:F.number().optional(),rating:F.number().optional(),score:F.number().optional(),variation:F.string().optional()})),implement:e=>E(ir,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e;Pe.info("onLevelFinished",r,n,i,o),Dr("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:r,rating:n,score:i,variation:o}),yield Promise.all([Ye.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}}),Ye.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})])})}),jm=Xe("gamePlayEnded",{paramsSchema:F.tuple(F.object({duration:F.number().optional(),rating:F.number().optional(),score:F.number(),variation:F.string().optional()})),implement:e=>E(ir,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e;Pe.info("onGamePlayEnded",t,r,n,i),Dr("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:r,score:n,variation:i}),yield Promise.all([Ye.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i}),Ye.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})])})}),Hm=Xe("levelUpgrade",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number()),name:F.string().optional()})),implement:r=>E(ir,[r],function*({levelId:e,name:t}){Pe.info("onLevelUpgrade",e,t),Dr("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}}})])})}),qm=Xe("levelStart",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number())})),implement:e=>E(ir,null,function*(){let{levelId:t}=e;Pe.info("onLevelStart",t),Dr("JOLIBOX_GAME_TASK_LEVEL_START",{levelId:t}),yield Ye.tracker("LevelStart",{levelId:t})})}),Vm=Xe("levelFailed",{paramsSchema:F.tuple(F.object({levelId:F.or(F.string(),F.number()),score:F.number().optional(),rating:F.number().optional(),duration:F.number().optional()})),implement:e=>E(ir,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;Pe.info("onLevelFailed",t,r,n,i),Dr("JOLIBOX_GAME_TASK_LEVEL_FAILED",{levelId:t,score:r,rating:n,duration:i}),yield Ye.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});Lr.registerCommand("TaskTrackerSDK.levelFinished",Fm);Lr.registerCommand("TaskTrackerSDK.gamePlayEnded",jm);Lr.registerCommand("TaskTrackerSDK.levelUpgrade",Hm);Lr.registerCommand("TaskTrackerSDK.levelStart",qm);Lr.registerCommand("TaskTrackerSDK.levelFailed",Vm);we("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"}}});we("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});we("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});we("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});we("TaskTrackerSDK.onLevelFailed",{version:"1.3.8",properties:{params:{levelId:"1.3.8",score:"1.3.8",rating:"1.3.8",duration:"1.3.8"}}})});var Ue,or,Ic,oa,$m,jt,Ur=re(()=>{"use strict";Ue=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")},or=new Map,Ic=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let r=or.get(t.type);r&&r.forEach(n=>{try{n(t.data)}catch(i){console.warn("Callback execution failed:",i)}})}}catch(t){console.warn("Failed to parse message:",t)}},oa=!1,$m=()=>{oa||(window.addEventListener("message",Ic),oa=!0)},jt=(e,t)=>{$m(),or.has(e)||or.set(e,new Set);let r=or.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&or.delete(e),or.size===0&&(window.removeEventListener("message",Ic),oa=!1)}}});var Xn,Qn,Zn,ei,ti,aa,ri,ni,ii,oi,ar,Km,ne,pt,vt,Be=re(()=>{"use strict";W();Xn="UNLOCK_OPTIONS_CHANGED",Qn="INVOKE_PAYMENT",Zn="ON_PAYMENT_RESULT",ei="ON_USE_MODAL_EVENT",ti="ON_USE_MODAL_RESULT",aa="ON_USE_MODAL_FREQUENCY",ri="ON_USE_UNLOGIN_MODAL_EVENT",ni="INVOKE_UNLOGIN_MODAL_EVENT",ii="INVOKE_SUBSCRIPTION_EVENT",oi="ON_USE_SUBSCRIPTION_RESULT",ar=new et,Km=()=>({on:ar.on.bind(ar),off:ar.off.bind(ar),emit:ar.emit.bind(ar)}),ne=Km(),pt={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},vt={show:!0,minInterval:8*60*60*1e3}});var rf=po(Xi=>{"use strict";pe();Be();Ur();W();var tf={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};jt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",tf[e.result],e.result),ne.emit(ti,{useModalResult:tf[e.result]})});ne.on(ei,(e,t)=>{var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ue("JOLIBOX_JOLI_COIN_USE_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:We()})});jt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{ne.emit(Zn,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});ne.on(Qn,(e,t)=>E(Xi,null,function*(){var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ue("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:We()})}));jt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,r,n,i,o;ne.emit(ri,{result:e.result=="ADS"?"FAILED":e.result,rewards:{claimedRewardValue:(i=(n=(r=(t=e.extra)==null?void 0:t.firstLogin)==null?void 0:r.reward)==null?void 0:n.rewardValue)!=null?i:0,isFirstLogin:(o=e.isFirstLogin)!=null?o:!1}}),e.result==="SUCCESS"&&L.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});ne.on(ni,e=>E(Xi,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ue("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:We(),type:e})}));jt("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),ne.emit(oi,{result:e.result})});ne.on(ii,e=>E(Xi,null,function*(){console.log("----notify custom event-----",e),Ue("JOLIBOX_SUB_EVENT",{sequenceId:We()})}))});ht();pe();Nr();W();var gc=Ae(),Sm="env",Cm="getSystemInfoSync",Rm=()=>{var i,o,a,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:(i=L.hostInfo)==null?void 0:i.appName,SDKVersion:L.sdkInfo.nativeSDKVersion},t=(o=L.hostInfo)==null?void 0:o.version;t&&(e=xe(X({},e),{version:t}));let r=(a=L.hostInfo)==null?void 0:a.appName;r&&(e=xe(X({},e),{appName:r}));let n=(s=L.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(e=xe(X({},e),{SDKVersion:n})),e},Om=Ft(Cm,{implement:Rm}),km=Ft(Sm,{implement:()=>xe(X({},L.hostInfo),{sdkInfo:L.sdkInfo,platform:L.platform,deviceInfo:L.deviceInfo})});gc.registerCommand("API.env",km);gc.registerCommand("API.getSystemInfoSync",Om);we("env",{version:"1.0.0"});we("getSystemInfoSync",{version:"1.0.0"});W();Nr();ut();ht();var Tm="onJoliboxShow",xm="onJoliboxHide",Nm="onReady",ta=Ae(),ra=Dl(je),ea=!0,Pr=!0,Kn=0,Wn=Ko;function Pm(){let e=Date.now();if(e-Kn<100)return;Kn=e;let t=document.visibilityState==="visible";t!==ea&&(ea=t,Wn.emit("visible",ea))}function _c(e){let t=Date.now();t-Kn<100||(Kn=t,e==="focus"&&!Pr?Pr=!0:e==="blur"&&Pr&&(Pr=!1),Wn.emit("visible",Pr))}document.addEventListener("visibilitychange",Pm);window.addEventListener("focus",()=>_c("focus"));window.addEventListener("blur",()=>_c("blur"));var Dm=Ft(Tm,{paramsSchema:F.tuple(F.function()),implement(e){let t=ra(e);Wn.on("visible",r=>{r&&t()})}}),Lm=Ft(xm,{paramsSchema:F.tuple(F.function()),implement(e){let t=ra(e);Wn.on("visible",r=>{!r&&t()})}}),Um=Ft(Nm,{paramsSchema:F.tuple(F.function()),implement(e){let t=ra(e);kt.on("LifecycleEvent.onReady",r=>{t(r)})}});ta.registerCommand("LifecycleSDK.onReady",Um);ta.registerCommand("LifecycleSDK.onJoliboxShow",Dm);ta.registerCommand("LifecycleSDK.onJoliboxHide",Lm);we("lifeCycle.onReady",{version:"1.0.0"});we("lifeCycle.onJoliboxShow",{version:"1.0.0"});we("lifeCycle.onJoliboxHide",{version:"1.0.0"});Nr();W();rr();pe();var wc=vo(bc());var zn=Ae(),ia=class{constructor(){this.httpClient=ze.create({baseUrl:tr(L.testMode)});this.getGameId=()=>L.mpId;this.getItem=t=>E(this,null,function*(){let{code:r,data:n,message:i}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),o=n==null?void 0:n.value,a=i;return r!=="SUCCESS"&&(o=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",o),a+="fallback to localstorage"),{code:r,message:a,data:o&&o!=="undefined"?o:null}});this.setItem=(t,r)=>E(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:i,message:o}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:i,message:o}});this.removeItem=t=>E(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>E(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=wc.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Yn=new ia,Bm=Xe("getLocalStorage",{paramsSchema:F.tuple(F.string()),implement(e){return E(this,null,function*(){return yield Yn.getItem(e)})}});zn.registerCommand("StorageSDK.getItem",Bm);we("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Mm=Xe("setStorage",{paramsSchema:F.tuple(F.string(),F.or(F.string(),F.boolean(),F.number())),implement(e,t){return E(this,null,function*(){return yield Yn.setItem(e,t)})}});zn.registerCommand("StorageSDK.setItem",Mm);we("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Gm=Xe("removeStorage",{paramsSchema:F.tuple(F.string()),implement(e){return E(this,null,function*(){return yield Yn.removeItem(e)})}});zn.registerCommand("StorageSDK.removeItem",Gm);we("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Jm=Xe("clearStorage",{implement(){return E(this,null,function*(){return yield Yn.clear()})}});zn.registerCommand("StorageSDK.clear",Jm);we("storage.clear",{version:"1.0.0"});var L0=vo(Ec());ht();W();rr();Ur();pe();Be();var Ac=L.testMode;function Sc(){let e=new Map,t,r;return{registerRewardHandler(i,o){e.set(i,o)},handleReward(i,...o){return E(this,null,function*(){return yield i.reduce((s,l)=>E(this,null,function*(){let c=yield s;if(c===!0)return!0;Ac&&console.log(`handleReward ${l}`);let m=e.get(l),d=m?yield m(...o):c;return Ac&&console.log(`handleReward ${l} ${d}`),d}),Promise.resolve(!1))})},registerRewardsFetcher(i){return E(this,null,function*(){t=(...o)=>E(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return E(this,null,function*(){r=(...o)=>E(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),{joliCoinUseAndCharge:pt,loginGuide:vt}}})})},getRewardsTypes(...i){return E(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return E(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:pt,loginGuide:vt}})}}}W();var sa=class{constructor(t){this.httpClient=t}execute(t,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"POST",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){var r,n,i;return{unlockOptions:((r=t.data)==null?void 0:r.unlockOptions)||[],joliCoin:((n=t.extra)==null?void 0:n.joliCoin)||{balance:0,enableAutoDeduct:!1},joliGem:((i=t.extra)==null?void 0:i.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(t,r){return{code:"SUCCESS",message:"success",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin||{balance:0,enableAutoDeduct:!1},joliGem:t.joliGem||{balance:0,enableAutoDeduct:!1}}}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}},la=class{constructor(t){this.httpClient=t}execute(t,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return X({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},ai=class{constructor(t){this.unlockOptionsService=new Gt(new sa(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((i,o)=>{var s,l;let a=n.unlockOptions[o];return i.type===a.type&&((s=i.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=a.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new Gt(new la(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return E(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return E(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 E(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return E(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 E(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()}};Be();W();var Wm=()=>(e,t)=>{let r={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return r[t]-r[e]},zm=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],Ym=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(Wm())},ca=null;function da(e){return ca||(ca=new ai(e)),ca}var ua=e=>{e.registerRewardsFetcher(t=>E(void 0,null,function*(){var i,o,a,s,l;let r=["ADS"],n=da(t);try{let c=yield n.getUnlockOptions({});if(c.code!=="SUCCESS")return r;ne.emit(Xn,{options:((i=c.data)==null?void 0:i.unlockOptions)||[],userJoliCoin:((o=c.extra)==null?void 0:o.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((a=c.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}});let m=((l=(s=c.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(d=>d.type))||Array.from(r);return Ym(m)}catch(c){return console.error("getRewardOptions error (cached):",c),r}}))},fa=e=>{e.registerRewardFrequencyConfigFetcher(t=>E(void 0,null,function*(){var n,i,o,a;let r=da(t);try{let s=yield r.getGlobalConfig();return ne.emit(aa,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||pt,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||vt}),s.data&&kt.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((o=s.data)==null?void 0:o.joliCoinUseAndCharge)||pt,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||vt}}catch(s){return console.error("getGlobalConfig error (cached):",s),ne.emit(aa,{joliCoinUseAndCharge:pt,loginGuide:vt}),kt.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:pt,loginGuide:vt,supportedHostMethods:zm}}),{joliCoinUseAndCharge:pt,loginGuide:vt}}}))};var ha=e=>E(void 0,null,function*(){yield da(e).warmupCache(),console.log("Reward cache warmed up")});var Cc=e=>t=>E(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",t),yield e.adBreak(t)}catch(r){console.error("-----createAdsRewardHandler error-----",r)}return!0});Be();function tt(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r),updateData:a=>{if(i)return i=X(X({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}Be();var Se=tt(ne,Xn),Br=(e,t)=>{var n;let r=(n=e.options)==null?void 0:n.some(i=>i.type==="SUBSCRIPTION");return console.log("typeof extraCheck",typeof t,t==null?void 0:t()),r&&(!t||(t==null?void 0:t()))};pe();W();var ma={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"}};W();var Ke=Ae();Be();Be();W();var va=class{constructor(t){this.httpClient=t}execute(t,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},ga=class{constructor(t){this.balanceService=new Gt(new va(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getBalance(t="JOLI_COIN"){return E(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 E(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 E(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()}},pa=null;function _a(e){return pa||(pa=new ga(e)),pa}var ya=(e,t="JOLI_COIN")=>E(void 0,null,function*(){return yield _a(e).getBalance(t)}),Ht=(e,t="JOLI_COIN")=>E(void 0,null,function*(){let n=yield _a(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n}),si=(e,t="JOLI_COIN")=>E(void 0,null,function*(){yield _a(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});W();var wa=class{constructor(t){this.httpClient=t}execute(t,r){return E(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Ea=class{constructor(t){this.gemBalanceService=new Gt(new wa(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getGemBalance(t="GEM"){return E(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 E(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 E(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()}},ba=null;function Rc(e){return ba||(ba=new Ea(e)),ba}var Ia=(e,t="GEM")=>E(void 0,null,function*(){return yield Rc(e).getGemBalance(t)}),sr=(e,t="GEM")=>E(void 0,null,function*(){let n=yield Rc(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n});var rt={JOLI_COIN:{fetchBalance:ya,getQuantity:e=>{var t,r,n;return(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(i=>i.type==="JOLI_COIN"))==null?void 0:r.joliCoinChoices[0].joliCoinQuantity)!=null?n: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 r,n;return(n=(r=e==null?void 0:e.options)==null?void 0:r.some(i=>i.type==="JOLI_COIN"&&i.joliCoinChoices.some(o=>{var a;return o.joliCoinQuantity<=((a=t==null?void 0:t.balance)!=null?a:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:Ia,getQuantity:e=>{var t,r,n,i;return(i=(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(o=>o.type==="JOLI_GEM"))==null?void 0:r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i: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 n,i,o;let r=e==null?void 0:e.options.find(a=>a.type==="JOLI_GEM");return r?((i=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0)<=((o=t==null?void 0:t.balance)!=null?o:0):!1}}};var li=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;Ke.registerCommand(`Rewards.${e}.useJolicoin`,()=>E(void 0,null,function*(){let i=yield Se.getData(),o=rt[t],a=o.getCurrentUser(i),s=o.getQuantity(i),l=!!(a!=null&&a.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",i,l,s),(yield n({enableAutoDeduct:l,userCurrency:a,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},qt=(e,t)=>r=>E(void 0,null,function*(){let n=tt(ne,ti);return ne.emit(ei,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult});Be();Be();var ci=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;Ke.registerCommand(`Rewards.${e}.usePayment`,()=>E(void 0,null,function*(){var p;let o=yield Se.getData(),a=rt[t],s=yield a.fetchBalance(n),l=a.getQuantity(o),c=a.getCurrentUser(o),m=a.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,c.enableAutoDeduct),d=a.getUpdateKey();if(Se.updateData({[d]:m}),console.log("-----unlockOptions payment-----",o,m,l,t),!a.isEnough(o,m)){let h=yield i({userCurrency:m,currencyQuantity:l,currency:t});return t==="JOLI_GEM"?sr(n):Ht(n),{result:h==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Vt=(e,t)=>r=>E(void 0,null,function*(){let n=tt(ne,Zn);return ne.emit(Qn,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult});pe();Be();Be();W();var $t=(e,t)=>r=>E(void 0,null,function*(){let n=tt(ne,ri);return ne.emit(ni,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()});var Zm=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:o,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:c}})=>{ci(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:a}),li(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let m=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return d=>E(void 0,null,function*(){var p,h,b,I;try{let A=yield o.getData();if(Br(A,c)){let D=rt.JOLI_COIN,M=yield D.fetchBalance(t),S=D.getCurrentUser(A),N=D.createUpdatedUser((p=M==null?void 0:M.balance)!=null?p:0,S.enableAutoDeduct);if(!D.isEnough(A,N))return i==null||i(d),!1}else{let D=!0;for(let M of m){let S=yield Ke.executeCommand(M);if(D=D&&S.result!=="FAILED",S.result!=="CONTINUE")break}if(!D)return i==null||i(d),!1}let R=ma[r],O=yield t.post(R.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${We()}-${L.mpType}-${Date.now()}`,gameInfo:{gameId:L.mpId}}});if(console.log("-----unlockWithCurrency request result-----",O),O.code=="SUCCESS"){try{(b=d.adBreakDone)==null||b.call(d,{breakType:d.type,breakName:"name"in d&&(h=d.name)!=null?h:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in d&&((I=d.adViewed)==null||I.call(d)),Ht(t)}catch(D){console.error("-----unlockWithJolicoin adBreakDone error-----",D)}return n==null||n({quantity:O.data.quantity,balance:O.data.balance}),!0}return i==null||i(d),!1}catch(A){if(console.info("JolicoinRewardHandler error:",A),A instanceof Error&&A.message=="CANCEL")throw A;return i==null||i(d),!1}finally{o.clearCache()}})},di=(e,t,r)=>Zm(e,t,"JOLI_COIN",r);var Oc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=qt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=Vt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=$t("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return di("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Se,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};var kc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=c=>{var m;r==null||r(),(m=c.adBreakDone)==null||m.call(c,{breakType:c.type,breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=qt("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=Vt("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=$t("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return di("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Se,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};pe();W();Be();Be();var Tc=e=>{let{showSubscriptionModal:t}=e;Ke.registerCommand("Rewards.subscription",()=>E(void 0,null,function*(){var s,l;let r=yield Se.getData(),n=(l=(s=r==null?void 0:r.options)==null?void 0:s.find(c=>c.type==="JOLI_GEM"))==null?void 0:l.type,i=rt[n?"JOLI_GEM":"JOLI_COIN"],o=i.getCurrentUser(r);return i.isEnough(r,o)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},xc=e=>()=>E(void 0,null,function*(){let t=tt(ne,oi);return ne.emit(ii,e),(yield t.getFreshData()).result});pe();var Nc=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:o,hasSubscription:a}})=>{Tc({showSubscriptionModal:o});let s=["Rewards.subscription"];return l=>E(void 0,null,function*(){var c,m,d,p,h,b;try{let I=yield i.getData();if(!Br(I,a))return!1;let w=!0;for(let R of s){let O=yield Ke.executeCommand(R);if(w=w&&O.result!=="FAILED",O.result!=="CONTINUE")break}if(Ht(t),sr(t),console.log("-----unlockWithSubscription result-----",w),w){try{(m=l.adBreakDone)==null||m.call(l,{breakType:l.type,breakName:"name"in l&&(c=l.name)!=null?c:"",breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in l&&((d=l.adViewed)==null||d.call(l)),(b=(h=L).onEnvConfigChanged)==null||b.call(h,{hostUserInfo:xe(X({},(p=L.hostUserInfo)!=null?p:{isLogin:!1}),{isSubUser:!0})})}catch(R){console.error("-----unlockWithSubscription adBreakDone error-----",R)}return r==null||r(),!0}return n==null||n(l),!1}catch(I){if(console.info("SubscriptionRewardHandler error:",I),I instanceof Error&&I.message=="CANCEL")throw I;return n==null||n(l),!1}finally{}})};var Pc=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=xc("SUBSCRIPTION");return Nc("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Se,showSubscriptionModal:o,hasSubscription:n}})};var nt=Sc();ua(nt);fa(nt);var mi,H,Mc,Ca,Kt,Dc,Gc,Jc,Fc,Ra,Aa,Sa,tp,Mr={},jc=[],rp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Gr=Array.isArray;function gt(e,t){for(var r in t)e[r]=t[r];return e}function Oa(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Jr(e,t,r){var n,i,o,a={};for(o in t)o=="key"?n=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?mi.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return fi(e,a,n,i,null)}function fi(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++Mc:i,__i:-1,__u:0};return i==null&&H.vnode!=null&&H.vnode(o),o}function Fr(){return{current:null}}function Tt(e){return e.children}function He(e,t){this.props=e,this.context=t}function lr(e,t){if(t==null)return e.__?lr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?lr(e):null}function Hc(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Hc(e)}}function Lc(e){(!e.__d&&(e.__d=!0)&&Kt.push(e)&&!hi.__r++||Dc!==H.debounceRendering)&&((Dc=H.debounceRendering)||Gc)(hi)}function hi(){for(var e,t,r,n,i,o,a,s=1;Kt.length;)Kt.length>s&&Kt.sort(Jc),e=Kt.shift(),s=Kt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,o=[],a=[],t.__P&&((r=gt({},n)).__v=n.__v+1,H.vnode&&H.vnode(r),ka(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,o,i==null?lr(n):i,!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,$c(o,r,a),r.__e!=i&&Hc(r)));hi.__r=0}function qc(e,t,r,n,i,o,a,s,l,c,m){var d,p,h,b,I,A,w=n&&n.__k||jc,R=t.length;for(l=np(r,t,w,l,R),d=0;d<R;d++)(h=r.__k[d])!=null&&(p=h.__i===-1?Mr:w[h.__i]||Mr,h.__i=d,A=ka(e,h,p,i,o,a,s,l,c,m),b=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&Ta(p.ref,null,h),m.push(h.ref,h.__c||b,h)),I==null&&b!=null&&(I=b),4&h.__u||p.__k===h.__k?l=Vc(h,l,e):typeof h.type=="function"&&A!==void 0?l=A:b&&(l=b.nextSibling),h.__u&=-7);return r.__e=I,l}function np(e,t,r,n,i){var o,a,s,l,c,m=r.length,d=m,p=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(l=o+p,(a=e.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?fi(null,a,null,null,null):Gr(a)?fi(Tt,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?fi(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,(c=a.__i=ip(a,r,l,d))!==-1&&(d--,(s=r[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&(i>m?p--:i<m&&p++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,a.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<m;o++)(s=r[o])!=null&&!(2&s.__u)&&(s.__e==n&&(n=lr(s)),Wc(s,s));return n}function Vc(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=Vc(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=lr(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function jr(e,t){return t=t||[],e==null||typeof e=="boolean"||(Gr(e)?e.some(function(r){jr(r,t)}):t.push(e)),t}function ip(e,t,r,n){var i,o,a=e.key,s=e.type,l=t[r];if(l===null&&e.key==null||l&&a==l.key&&s===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(i=r-1,o=r+1;i>=0||o<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&a==l.key&&s===l.type)return i;i--}if(o<t.length){if((l=t[o])&&!(2&l.__u)&&a==l.key&&s===l.type)return o;o++}}return-1}function Uc(e,t,r){t[0]=="-"?e.setProperty(t,r==null?"":r):e[t]=r==null?"":typeof r!="number"||rp.test(t)?r:r+"px"}function ui(e,t,r,n,i){var o;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Uc(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Uc(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Fc,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.t=n.t:(r.t=Ra,e.addEventListener(t,o?Sa:Aa,o)):e.removeEventListener(t,o?Sa:Aa,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r==null?"":r;break e}catch(a){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Bc(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Ra++;else if(t.u<r.t)return;return r(H.event?H.event(t):t)}}}function ka(e,t,r,n,i,o,a,s,l,c){var m,d,p,h,b,I,A,w,R,O,D,M,S,N,J,q,U,G=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[s=t.__e=r.__e]),(m=H.__b)&&m(t);e:if(typeof G=="function")try{if(w=t.props,R="prototype"in G&&G.prototype.render,O=(m=G.contextType)&&n[m.__c],D=m?O?O.props.value:m.__:n,r.__c?A=(d=t.__c=r.__c).__=d.__E:(R?t.__c=d=new G(w,D):(t.__c=d=new He(w,D),d.constructor=G,d.render=ap),O&&O.sub(d),d.props=w,d.state||(d.state={}),d.context=D,d.__n=n,p=d.__d=!0,d.__h=[],d._sb=[]),R&&d.__s==null&&(d.__s=d.state),R&&G.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=gt({},d.__s)),gt(d.__s,G.getDerivedStateFromProps(w,d.__s))),h=d.props,b=d.state,d.__v=t,p)R&&G.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),R&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(R&&G.getDerivedStateFromProps==null&&w!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,D),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,D)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(d.props=w,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(j){j&&(j.__=t)}),M=0;M<d._sb.length;M++)d.__h.push(d._sb[M]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(w,d.__s,D),R&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,b,I)})}if(d.context=D,d.props=w,d.__P=e,d.__e=!1,S=H.__r,N=0,R){for(d.state=d.__s,d.__d=!1,S&&S(t),m=d.render(d.props,d.state,d.context),J=0;J<d._sb.length;J++)d.__h.push(d._sb[J]);d._sb=[]}else do d.__d=!1,S&&S(t),m=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++N<25);d.state=d.__s,d.getChildContext!=null&&(n=gt(gt({},n),d.getChildContext())),R&&!p&&d.getSnapshotBeforeUpdate!=null&&(I=d.getSnapshotBeforeUpdate(h,b)),q=m,m!=null&&m.type===Tt&&m.key==null&&(q=Kc(m.props.children)),s=qc(e,Gr(q)?q:[q],t,r,n,i,o,a,s,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),A&&(d.__E=d.__=null)}catch(j){if(t.__v=null,l||o!=null)if(j.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else for(U=o.length;U--;)Oa(o[U]);else t.__e=r.__e,t.__k=r.__k;H.__e(j,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):s=t.__e=op(r.__e,t,r,n,i,o,a,l,c);return(m=H.diffed)&&m(t),128&t.__u?void 0:s}function $c(e,t,r){for(var n=0;n<r.length;n++)Ta(r[n],r[++n],r[++n]);H.__c&&H.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){H.__e(o,i.__v)}})}function Kc(e){return typeof e!="object"||e==null?e:Gr(e)?e.map(Kc):gt({},e)}function op(e,t,r,n,i,o,a,s,l){var c,m,d,p,h,b,I,A=r.props,w=t.props,R=t.type;if(R=="svg"?i="http://www.w3.org/2000/svg":R=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!R&&(R?h.localName==R:h.nodeType==3)){e=h,o[c]=null;break}}if(e==null){if(R==null)return document.createTextNode(w);e=document.createElementNS(i,R,w.is&&w),s&&(H.__m&&H.__m(t,o),s=!1),o=null}if(R===null)A===w||s&&e.data===w||(e.data=w);else{if(o=o&&mi.call(e.childNodes),A=r.props||Mr,!s&&o!=null)for(A={},c=0;c<e.attributes.length;c++)A[(h=e.attributes[c]).name]=h.value;for(c in A)if(h=A[c],c!="children"){if(c=="dangerouslySetInnerHTML")d=h;else if(!(c in w)){if(c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w)continue;ui(e,c,null,h,i)}}for(c in w)h=w[c],c=="children"?p=h:c=="dangerouslySetInnerHTML"?m=h:c=="value"?b=h:c=="checked"?I=h:s&&typeof h!="function"||A[c]===h||ui(e,c,h,A[c],i);if(m)s||d&&(m.__html===d.__html||m.__html===e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(d&&(e.innerHTML=""),qc(t.type==="template"?e.content:e,Gr(p)?p:[p],t,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:r.__k&&lr(r,0),s,l),o!=null)for(c=o.length;c--;)Oa(o[c]);s||(c="value",R=="progress"&&b==null?e.removeAttribute("value"):b!==void 0&&(b!==e[c]||R=="progress"&&!b||R=="option"&&b!==A[c])&&ui(e,c,b,A[c],i),c="checked",I!==void 0&&I!==e[c]&&ui(e,c,I,A[c],i))}return e}function Ta(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){H.__e(i,r)}}function Wc(e,t,r){var n,i;if(H.unmount&&H.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Ta(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){H.__e(o,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Wc(n[i],t,r||typeof e.type!="function");r||Oa(e.__e),e.__c=e.__=e.__e=void 0}function ap(e,t,r){return this.constructor(e,r)}function zc(e,t,r){var n,i,o,a;t==document&&(t=document.documentElement),H.__&&H.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,o=[],a=[],ka(t,e=(!n&&r||t).__k=Jr(Tt,null,[e]),i||Mr,Mr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?mi.call(t.childNodes):null,o,!n&&r?r:i?i.__e:t.firstChild,n,a),$c(o,e,a)}mi=jc.slice,H={__e:function(e,t,r,n){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},Mc=0,Ca=function(e){return e!=null&&e.constructor==null},He.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=gt({},this.state),typeof e=="function"&&(e=e(gt({},r),this.props)),e&&gt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Lc(this))},He.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Lc(this))},He.prototype.render=Tt,Kt=[],Gc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Jc=function(e,t){return e.__v.__b-t.__v.__b},hi.__r=0,Fc=/(PointerCapture)$|Capture$/i,Ra=0,Aa=Bc(!1),Sa=Bc(!0),tp=0;var cr,de,xa,Yc,Hr=0,id=[],he=H,Xc=he.__b,Qc=he.__r,Zc=he.diffed,ed=he.__c,td=he.unmount,rd=he.__;function vi(e,t){he.__h&&he.__h(de,e,Hr||t),Hr=0;var r=de.__H||(de.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function _t(e){return Hr=1,od(ad,e)}function od(e,t,r){var n=vi(cr++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):ad(void 0,t),function(s){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,s);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=de,!de.__f)){var i=function(s,l,c){if(!n.__c.__H)return!0;var m=n.__c.__H.__.filter(function(p){return!!p.__c});if(m.every(function(p){return!p.__N}))return!o||o.call(this,s,l,c);var d=n.__c.props!==s;return m.forEach(function(p){if(p.__N){var h=p.__[0];p.__=p.__N,p.__N=void 0,h!==p.__[0]&&(d=!0)}}),o&&o.call(this,s,l,c)||d};de.__f=!0;var o=de.shouldComponentUpdate,a=de.componentWillUpdate;de.componentWillUpdate=function(s,l,c){if(this.__e){var m=o;o=void 0,i(s,l,c),o=m}a&&a.call(this,s,l,c)},de.shouldComponentUpdate=i}return n.__N||n.__}function xt(e,t){var r=vi(cr++,3);!he.__s&&Da(r.__H,t)&&(r.__=e,r.u=t,de.__H.__h.push(r))}function Pa(e,t){var r=vi(cr++,4);!he.__s&&Da(r.__H,t)&&(r.__=e,r.u=t,de.__h.push(r))}function gi(e){return Hr=5,qr(function(){return{current:e}},[])}function qr(e,t){var r=vi(cr++,7);return Da(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Vr(e,t){return Hr=8,qr(function(){return e},t)}function sp(){for(var e;e=id.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(pi),e.__H.__h.forEach(Na),e.__H.__h=[]}catch(t){e.__H.__h=[],he.__e(t,e.__v)}}he.__b=function(e){de=null,Xc&&Xc(e)},he.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),rd&&rd(e,t)},he.__r=function(e){Qc&&Qc(e),cr=0;var t=(de=e.__c).__H;t&&(xa===de?(t.__h=[],de.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(pi),t.__h.forEach(Na),t.__h=[],cr=0)),xa=de},he.diffed=function(e){Zc&&Zc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(id.push(t)!==1&&Yc===he.requestAnimationFrame||((Yc=he.requestAnimationFrame)||lp)(sp)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),xa=de=null},he.__c=function(e,t){t.some(function(r){try{r.__h.forEach(pi),r.__h=r.__h.filter(function(n){return!n.__||Na(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],he.__e(n,r.__v)}}),ed&&ed(e,t)},he.unmount=function(e){td&&td(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{pi(n)}catch(i){t=i}}),r.__H=void 0,t&&he.__e(t,r.__v))};var nd=typeof requestAnimationFrame=="function";function lp(e){var t,r=function(){clearTimeout(n),nd&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);nd&&(t=requestAnimationFrame(r))}function pi(e){var t=de,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),de=t}function Na(e){var t=de;e.__c=e.__(),de=t}function Da(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function ad(e,t){return typeof t=="function"?t(e):t}function dp(e,t){for(var r in t)e[r]=t[r];return e}function sd(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function ld(e,t){this.props=e,this.context=t}(ld.prototype=new He).isPureReactComponent=!0,ld.prototype.shouldComponentUpdate=function(e,t){return sd(this.props,e)||sd(this.state,t)};var cd=H.__b;H.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),cd&&cd(e)};var sC=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var up=H.__e;H.__e=function(e,t,r,n){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t)}up(e,t,r,n)};var dd=H.unmount;function vd(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=dp({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return vd(n,t,r)})),e}function gd(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return gd(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function La(){this.__u=0,this.o=null,this.__b=null}function _d(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function _i(){this.i=null,this.l=null}H.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),dd&&dd(e)},(La.prototype=new He).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=_d(n.__v),o=!1,a=function(){o||(o=!0,r.__R=null,i?i(s):s())};r.__R=a;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=gd(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(a,a)},La.prototype.componentWillUnmount=function(){this.o=[]},La.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=vd(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&Jr(Tt,null,e.fallback);return i&&(i.__u&=-33),[Jr(Tt,null,t.__a?null:e.children),i]};var ud=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(_i.prototype=new He).__a=function(e){var t=this,r=_d(t.__v),n=t.l.get(e);return n[0]++,function(i){var o=function(){t.props.revealOrder?(n.push(i),ud(t,e,n)):i()};r?r(o):o()}},_i.prototype.render=function(e){this.i=null,this.l=new Map;var t=jr(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},_i.prototype.componentDidUpdate=_i.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){ud(e,r,t)})};var fp=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,hp=/^(?: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]/,mp=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,pp=/[A-Z0-9]/g,vp=typeof document!="undefined",gp=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function it(e,t,r){return t.__k==null&&(t.textContent=""),zc(e,t),typeof r=="function"&&r(),e?e.__c:null}He.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(He.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var fd=H.event;function _p(){}function yp(){return this.cancelBubble}function bp(){return this.defaultPrevented}H.event=function(e){return fd&&(e=fd(e)),e.persist=_p,e.isPropagationStopped=yp,e.isDefaultPrevented=bp,e.nativeEvent=e};var yd,wp={enumerable:!1,configurable:!0,get:function(){return this.class}},hd=H.vnode;H.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={},o=n.indexOf("-")===-1;for(var a in r){var s=r[a];if(!(a==="value"&&"defaultValue"in r&&s==null||vp&&a==="children"&&n==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in r&&r.value==null?a="value":a==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||gp(r.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":mp.test(a)&&(a=l):l=a="oninput":o&&hp.test(a)?a=a.replace(pp,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&i[a=l]&&(a="oninputCapture"),i[a]=s}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=jr(r.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=jr(r.children).forEach(function(c){c.props.selected=i.multiple?i.defaultValue.indexOf(c.props.value)!=-1:i.defaultValue==c.props.value})),r.class&&!r.className?(i.class=r.class,Object.defineProperty(i,"className",wp)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=fp,hd&&hd(e)};var md=H.__r;H.__r=function(e){md&&md(e),yd=e.__c};var pd=H.diffed;H.diffed=function(e){pd&&pd(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),yd=null};var Ep=Object.defineProperty,Ip=Object.defineProperties,Ap=Object.getOwnPropertyDescriptors,wi=Object.getOwnPropertySymbols,Od=Object.prototype.hasOwnProperty,kd=Object.prototype.propertyIsEnumerable,bd=(e,t,r)=>t in e?Ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yt=(e,t)=>{for(var r in t||(t={}))Od.call(t,r)&&bd(e,r,t[r]);if(wi)for(var r of wi(t))kd.call(t,r)&&bd(e,r,t[r]);return e},Sp=(e,t)=>Ip(e,Ap(t)),Cp=(e,t)=>{var r={};for(var n in e)Od.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&wi)for(var n of wi(e))t.indexOf(n)<0&&kd.call(e,n)&&(r[n]=e[n]);return r},Ei=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function Rp(e){return!!(e!=null&&e.__nativeBuffers__)}var Op=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=t.charCodeAt(i);return n.buffer};function ja(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!Rp(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let i;n.value?i=n.value:n.base64&&(i=Op(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var kp=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return btoa(t)};function Tp(e={},t=!1){let r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:kp(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var Td=Object.defineProperty,xp=Object.getOwnPropertyDescriptor,Np=(e,t)=>{for(var r in t)Td(e,r,{get:t[r],enumerable:!0})},xd=(e,t,r,n)=>{for(var i=n>1?void 0:n?xp(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&Td(t,r,i),i},Pp=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}function Dp(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var Lp=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};function Nd(e){return typeof e=="string"}function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function wd(e){return typeof e=="number"&&!isNaN(e)}function Up(e){return typeof e=="undefined"}function Bp(e){return Up(e)||e===null}function Pd(e){return typeof e=="function"}function Mp(e){return ur(e)&&Pd(e.then)}function Dd(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}var Gp=(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))(Gp||{}),Jp=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}},Ii=class extends Jp{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Fp=class extends Ii{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},jp=class extends Ii{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Hp=class extends Ii{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Ua=class extends Ii{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function $r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var Ai={log:$r("log"),warn:$r("warn"),info:$r("info"),error:$r("error"),debug:$r("debug")};Object.assign(globalThis,{logger:Ai});var Ed=Symbol.for("Jolibox.canIUseMap"),qp={};globalThis[Ed]||(globalThis[Ed]=qp);function Vp(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}var Ha=Symbol.for("Jolibox.canIUseMap.native"),$p={};globalThis[Ha]||(globalThis[Ha]=$p);var qa={get config(){return globalThis[Ha]}},Kp=(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))(Kp||{}),Wp=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Wp||{}),zp=(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))(zp||{});function Yp(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}Yp();var dr=typeof window=="undefined",Xp=()=>!dr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),uC={isiOS:!dr&&(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:!dr&&navigator.userAgent.includes("Android"),isMac:!dr&&navigator.userAgent.includes("Mac"),isFacebook:!dr&&navigator.userAgent.includes("FB_IAB"),isPC:!dr&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Va=class $a{constructor(t){this.element=t,this.next=$a.Undefined,this.prev=$a.Undefined}};Va.Undefined=new Va(void 0);var le=Va,Qp=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},Zp=0,Kr=class{constructor(e){this.value=e,this.id=Zp++}},zr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Kr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Kr(t);return this._listeners?this._listeners instanceof Kr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var m,d,p,h;if(!this._disposed){if(this._listeners instanceof Kr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||d.call(m));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((h=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||h.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Kr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Ka=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new zr,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new Qp,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},Wa={};Np(Wa,{None:()=>ev,filter:()=>rv,once:()=>Ld,toPromise:()=>tv});var ev=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function tv(e){return new Promise(t=>Ld(e)(t))}function Ld(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function rv(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new zr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}var Ba=Symbol.for("Jolibox.hostEmitter"),nv=()=>{let e=new Ka;return globalThis[Ba]||(globalThis[Ba]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Ba]},fC=nv();function iv(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ov(e[n],t[n])}function ov(e,t){if(Nd(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Pd(t)){try{if(e instanceof t)return}catch(r){}if(!Bp(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 za=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new zr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return iv(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};za=xd([Dd],za);var Id=class{constructor(){this._onWillExecuteCommand=new zr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new zr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new za,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Dp(3e4)),this._starActivation}executeCommand(e,...t){return Pp(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Wa.toPromise(Wa.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};Id=xd([Dd],Id);var hC=Symbol.for("Jolibox.commands");Ce("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ce("requestProductDetailsAsync",{version:102e4});Ce("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ce("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ce("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ce("userTrackAsync",{version:1e6});Ce("openMiniapp",{version:1050100});Ce("requestCoinDetailsSync",{version:1070100});Ce("requestCoinDetailsAsync",{version:1070100});Ce("sendServerEventAsync",{version:1070100});Ce("requestGameLeaderboardSync",{version:108e4});Ce("requestGameLeaderboardAsync",{version:108e4});Ce("notifyTaskGameInfoAsync",{version:1080100});Ce("loadAdsAsync",{version:1070200});Ce("showAdAsync",{version:1070200});Ce("onJoliboxHideLoading",{version:1070300});function Ce(e,t){if(qa.config[e]){Ai.warn(`[can i use] ${e} already registered`);return}qa.config[e]=yt({},t)}var Ud=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=qa.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",m=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(m=p)}if(typeof m!="number")return!1;let d=e();return typeof d!="number"||d<m?!1:s.length===0?!0:n(l,s,d)||n(l.properties,s,d)}function n(i,o,a){if(!i)return!1;let s=Vp(i,o);if(!s)return!1;if(ur(s)){let l=s.version;return wd(l)?typeof a=="number"&&a>=l:!0}return wd(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};function Ad(e,t){return`[${e}]:${t}`}var av=()=>Xp(),Wr="custom_event_",sv=[],lv=[],cv=["env","createRequestTask","login"],Bd="__batch_event__",dv="__native_batch_event__",uv=e=>e==="pv"?e:"default",bi=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=uv(a)}report(e){this.type==="pv"?this.addPVPoint(e):this.addPoint(e),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(e){if(Object.keys(this.cache).length){if(e){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(e){let t=(r,n,i,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&ur(a))throw new Ua(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(ur(a))l.push(...Object.keys(a));else if(Nd(a)){if(i.length>0)throw new Ua(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Ua(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let m=ur(a)?a[c]:a;t(n[c],[...i],o,m)})}else n[o]?n[o]++:n[o]=1},r={point:e,metricName:this.metricName,tagNameOrder:this.tagNameOrder};t(this.cache,[...this.tagNameOrder],this.metricName,e)}processPoints(e){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:e}}clearPoints(){this.cache={}}},Sd=!1,Ma,Ga,Ja;function fv(e,t){Sd||(Ma=new bi({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ga=new bi({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ja=new bi({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Ma.flush(),Ga.flush(),Ja.flush()}),Sd=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:m,errMsg:d=`${s}:fail no errMsg`,errNo:p=0,__timing:h={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:b,invokeCallback:I}=h,A=(a=(o=d.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Ma.report({status:A,method:n(s,l),errNo:`${p}`,errMsg:d,isForeground:m,duration:Date.now()-c}),c&&b&&I&&(Ga.report({status:A,method:s,isForeground:m,duration:Number((b-c).toFixed(3))}),Ja.report({status:A,method:s,isForeground:m,duration:Number((Date.now()-I).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}var Fa=[],hv=!1,Ya=Symbol.for("Jolibox.invokeResolverInstance"),mv=new Map;globalThis[Ya]||(globalThis[Ya]=mv);var pv={get resolveMap(){return globalThis[Ya]}};function vv(e,t){let r=0,n=!0,i=pv.resolveMap,o=fv(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Fa.forEach(l=>Ei(this,[l],function*({method:c,args:m,resolve:d}){let p=yield s(c,m);d(p)})),Fa.length=0});let a=(l,c)=>{let m=i.get(Number(l));if(!m)return;let d=ja(c);m(d),i.delete(Number(l))},s=(l,c)=>{var m,d;let p=Date.now(),h=`${n}`;r+=1;let b=new Lp;if(i.set(r,b.resolve),!n&&lv.includes(l))return new Promise(D=>{Fa.push({method:l,args:c,resolve:D})});let I=Sp(yt({},{method:l,startTime:p,args:c,isForeground:h}),{invokeType:"js-bridge"}),A=!hv&&sv.includes(l),w=Tp(c,A),R=A?w:JSON.stringify(w),O;if(l.endsWith("Sync")||cv.includes(l)?O=(m=e.call)==null?void 0:m.call(e,l,w,r):typeof R=="string"?O=e.invoke(l,R,r):O=(d=e.call)==null?void 0:d.call(e,l,R,r),O){try{typeof O=="string"&&(O=JSON.parse(O)),O=ja(O)}catch(D){Ai.error(D)}return i.delete(r),O.errorCode&&(O.errorCode=Ad(l,O.errorCode)),o(yt(yt({},I),O)),O}return l.endsWith("Sync")&&i.delete(r),b.promise.then(D=>(D.errorCode&&(D.errorCode=Ad(l,D.errorCode)),o(yt(yt({},I),D)),D))};return{invokeNative:s,applyNative:(l,c)=>{let m=s(l,c);return Mp(m)?m.then(d=>Cd(l,d)):Cd(l,m)},invokeHandler:a}}function Cd(e,t){if(!ur(t)){Ai.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=Cp(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new jp(n,i,o,a);return s}var yi=Symbol.for("Jolibox.subscribeInstance");function gv(e){if(globalThis[yi])return globalThis[yi];let t=new Ka,r=new Ka,n=new bi({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[yi]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=ja(o),l;if(s.__extra){l=s.params;let{type:c,startTime:m}=s.__extra;n.report({type:c,event:i,duration:Date.now()-m})}else l=s;if(i===Bd){l.forEach(c=>{let[m,d]=c;try{r.emit(m.slice(Wr.length),d,a)}catch(p){}});return}if(i.startsWith(Wr)){r.emit(i.slice(Wr.length),l,a);return}t.emit(i,l,a)}},globalThis[yi]}function _v(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let m=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Wr}${o}`,a,m);return}n||(n=Promise.resolve().then(()=>{t.forEach((m,d)=>{try{let p=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(Bd,m,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Wr}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let m=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,m),console.log("emitNative",o,a,m);return}i||(i=Promise.resolve().then(()=>{r.forEach((m,d)=>{try{let p=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(dv,m,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function yv(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=gv(e),{invokeNative:a,invokeHandler:s,applyNative:l}=vv(e,r),{publish:c,emitNative:m}=_v(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:m,publish:c,subscribe:i,unsubscribe:o}}function Md(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Xa,Nt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Nt.trigger=e},onDoExit(e){Nt.exit=e},onDoBackPress(e){Nt.backPress=e}},Gd=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Fp("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{Nt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ei(void 0,null,function*(){let o=yield Nt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});Xa={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=Md(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:Gd,doExit:r};globalThis.joliboxJSCore=yt({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Nt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ei(void 0,null,function*(){let a=yield Nt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});Xa={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=Md(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Ei(this,null,function*(){let a=yield Nt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:Gd,doExit:n};globalThis.joliboxJSCore=yt({},i)}var Jd=Xa;if(!Jd&&av())throw new Hp("No joliboxJScore is found, native bridge not found.");var bv=yt({},Jd),Fd=yv(bv),{invokeHandler:Rd}=Fd,{applyNative:mC,invokeNative:Si,onNative:jd,offNative:Hd,subscribeHandler:wv,publish:pC,emitNative:vC,subscribe:gC,unsubscribe:_C}=Fd;globalThis.joliboxJSBridge={callHandler:Rd,invokeHandler:Rd,subscribeHandler:wv};var Ev=Object.defineProperty,Iv=Object.defineProperties,Av=Object.getOwnPropertyDescriptors,Mi=Object.getOwnPropertySymbols,gu=Object.prototype.hasOwnProperty,_u=Object.prototype.propertyIsEnumerable,qd=(e,t,r)=>t in e?Ev(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yu=(e,t)=>{for(var r in t||(t={}))gu.call(t,r)&&qd(e,r,t[r]);if(Mi)for(var r of Mi(t))_u.call(t,r)&&qd(e,r,t[r]);return e},Sv=(e,t)=>Iv(e,Av(t)),Cv=(e,t)=>{var r={};for(var n in e)gu.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Mi)for(var n of Mi(e))t.indexOf(n)<0&&_u.call(e,n)&&(r[n]=e[n]);return r},bu=Object.defineProperty,Rv=Object.defineProperties,Ov=Object.getOwnPropertyDescriptors,Vd=Object.getOwnPropertySymbols,kv=Object.prototype.hasOwnProperty,Tv=Object.prototype.propertyIsEnumerable,$d=(e,t,r)=>t in e?bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xv=(e,t)=>{for(var r in t||(t={}))kv.call(t,r)&&$d(e,r,t[r]);if(Vd)for(var r of Vd(t))Tv.call(t,r)&&$d(e,r,t[r]);return e},Nv=(e,t)=>Rv(e,Ov(t)),Pv=(e,t)=>{for(var r in t)bu(e,r,{get:t[r],enumerable:!0})},wu=(e,t,r,n)=>{for(var i=t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},Dv=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}function Lv(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Uv(e){return typeof e=="string"}function Bv(e){return typeof e=="undefined"}function Mv(e){return Bv(e)||e===null}function Gv(e){return typeof e=="function"}function Eu(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}var Jv=(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))(Jv||{});function Yr(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var Fv={log:Yr("log"),warn:Yr("warn"),info:Yr("info"),error:Yr("error"),debug:Yr("debug")};Object.assign(globalThis,{logger:Fv});var Kd=Symbol.for("Jolibox.canIUseMap"),jv={};globalThis[Kd]||(globalThis[Kd]=jv);var Wd=Symbol.for("Jolibox.canIUseMap.native"),Hv={};globalThis[Wd]||(globalThis[Wd]=Hv);var Iu=(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))(Iu||{}),Au=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Au||{}),Su=(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))(Su||{}),zd=["name","params"],qv=["name","type","location","target","extra","timestamp","userId"],Vv=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function Ti(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function $v(e){let t=e.location?Ti(e.location,zd):null,r=e.target?Ti(e.target,zd):null;return Ti(Nv(xv({},e),{location:t,target:r}),qv)}function Kv(e){let t=e.events.map(n=>$v(n)),r=Ti(e.device,Vv);return[e.protocolVersion,t,r,e.project]}function Wv(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}Wv();var pr=typeof window=="undefined",Gi=()=>!pr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!pr&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!pr&&navigator.userAgent.includes("Android"),!pr&&navigator.userAgent.includes("Mac"),!pr&&navigator.userAgent.includes("FB_IAB"),!pr&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var as=class ss{constructor(t){this.element=t,this.next=ss.Undefined,this.prev=ss.Undefined}};as.Undefined=new as(void 0);var ce=as,zv=class{constructor(){this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ce.Undefined}clear(){let e=this._first;for(;e!==ce.Undefined;){let t=e.next;e.prev=ce.Undefined,e.next=ce.Undefined,e=t}this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ce(e);if(this._first===ce.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ce.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ce.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ce.Undefined&&e.next!==ce.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ce.Undefined&&e.next===ce.Undefined?(this._first=ce.Undefined,this._last=ce.Undefined):e.next===ce.Undefined?(this._last=this._last.prev,this._last.next=ce.Undefined):e.prev===ce.Undefined&&(this._first=this._first.next,this._first.prev=ce.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ce.Undefined;)yield e.element,e=e.next}},Yv=0,Xr=class{constructor(e){this.value=e,this.id=Yv++}},rn=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Xr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new Xr(e);return this._listeners?this._listeners instanceof Xr?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,m,d,p;if(!this._disposed){if(this._listeners instanceof Xr)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(m=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||m.call(c));else if(this._listeners){let h=this._listeners.indexOf(l);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((p=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||p.call(d)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Xr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Xv=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var n;let i=(n=this.listeners.get(e))!=null?n:new rn,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new zv,this.cachedEventQueue.set(e,r)),r.push({args:i}),t&&t.fire({event:e,args:i})}once(e,t){var r=this;let n=function(){t(...arguments),r.off(e,n)};this.on(e,n,!1)}},ls={};Pv(ls,{None:()=>Qv,filter:()=>eg,once:()=>Cu,toPromise:()=>Zv});var Qv=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Zv(e){return new Promise(t=>Cu(e)(t))}function Cu(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function eg(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new rn(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}var Qa=Symbol.for("Jolibox.hostEmitter"),tg=()=>{let e=new Xv;return globalThis[Qa]||(globalThis[Qa]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Qa]};tg();function rg(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ng(e[n],t[n])}function ng(e,t){if(Uv(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gv(t)){try{if(e instanceof t)return}catch(r){}if(!Mv(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 cs=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new rn,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return rg(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};cs=wu([Eu],cs);var Yd=class{constructor(){this._onWillExecuteCommand=new rn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new rn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new cs,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Lv(3e4)),this._starActivation}executeCommand(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Dv(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),ls.toPromise(ls.filter(this.registry.onDidRegisterCommand,i=>i===e))])]),this._tryExecuteCommand(e,r))})}executeCommandThowErr(e){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let t=this.registry.getCommand(e);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._onWillExecuteCommand.fire({commandId:e,args:n});let o=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),o}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e(...r)}finally{}}};Yd=wu([Eu],Yd);function Me(e,t,r){return(t=ig(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ig(e){var t=og(e,"string");return typeof t=="symbol"?t:t+""}function og(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fr=e=>e?function(){try{for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e==null||e(...r)}catch(i){console.error("Error calling function",i)}}:()=>{console.log("wrapUserFunction: fn is undefined")},ds=class{constructor(t){Me(this,"context",void 0),Me(this,"continueCallback",void 0),Me(this,"adIsShowingCallback",void 0),Me(this,"isBeforeAdCalled",!1),Me(this,"isBeforeRewardCalled",!1),Me(this,"isAdDismissedCalled",!1),Me(this,"isAdViewedCalled",!1),Me(this,"isAfterAdCalled",!1),Me(this,"currentProvider",void 0),Me(this,"currentClientParams",void 0),Me(this,"adsHasResponse",!1),Me(this,"videoChecker",window.document.createElement("video")),Me(this,"contextInfo",void 0),Me(this,"wrapShowAdFn",r=>()=>{var n,i,o;this.adsHasResponse=!0;let a=!1;this.videoChecker.play().catch(()=>{a=!1}),a=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:a},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",yu({userEvent:a},this.paramsToTrack)),Gi()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"rewarded",module:"game",game_id:this.contextInfo.objectId}),(o=this.adIsShowingCallback)==null||o.call(this,!0);let s=fr(r);s==null||s()}),this.context=t,this.contextInfo=t.getContextInfo()}notifyIframeAdsEvent(t,r){window.parent&&window.parent.postMessage({type:t,data:r},"*"),window.dispatchEvent(new CustomEvent(t,{detail:r}))}get paramsToTrack(){var t,r,n,i,o,a;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null,type:(n=this.currentClientParams)==null?void 0:n.type,name:((i=this.currentClientParams)==null?void 0:i.type)==="preroll"?null:(a=(o=this.currentClientParams)==null?void 0:o.name)!=null?a:""}}wrapBeforeAd(t){return()=>{var r,n,i,o;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 a=fr(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),Gi()&&this.context.track("mmp_ad_impression",{ad_network:(o=(i=this.currentProvider)==null?void 0:i.name)!=null?o:"",ad_format:"interstitial",module:"game",game_id:this.contextInfo.objectId}))}}}wrapBeforeReward(t){return r=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(r)():(this.isBeforeRewardCalled=!0,t==null||t(this.wrapShowAdFn(r)))}}wrapAdDismissed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdDismissedCalled){this.isAdDismissedCalled=!0;let r=fr(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=fr(t);r==null||r()}}}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 r=fr(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l,c,m,d;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(o=r.breakName)!=null?o:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(a=this.currentProvider)==null?void 0:a.name)!=null?s:null,breakType:r.breakType,breakName:(l=r.breakName)!=null?l:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=fr(t);p==null||p(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(m=this.continueCallback)==null||m.call(this,[!1,r]);break}default:{(d=this.continueCallback)==null||d.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return E(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,m,d,p,h;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(m=(c=this.currentProvider)==null?void 0:c.name)!=null?m:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(d=r.name)!=null?d:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(h=this.adIsShowingCallback)==null||h.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),t.adBreak(a,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};function Ci(e,t,r){return(t=ag(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ag(e){var t=sg(e,"string");return typeof t=="symbol"?t:t+""}function sg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var us=class{constructor(t){Ci(this,"context",void 0),Ci(this,"adBreakIsShowing",!1),Ci(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Ci(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=t,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};function Ri(e,t,r){return(t=lg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lg(e){var t=cg(e,"string");return typeof t=="symbol"?t:t+""}function cg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fs=class{constructor(t){Ri(this,"configs",null),Ri(this,"firstRun",!0),Ri(this,"context",void 0),Ri(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return E(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(t){}})}shouldBypassCallingInterstitial(){var t,r;let n;if(!this.configs)this.init(),n=!this.firstRun;else{let i=(t=this.contextInfo.channel)!=null?t:"",o=this.configs[i],a=(r=o==null?void 0:o.interstitialRate)!=null?r:1;n=Math.random()<a}return this.firstRun=!1,n}};function bt(e,t,r){return(t=dg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dg(e){var t=ug(e,"string");return typeof t=="symbol"?t:t+""}function ug(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hs=class{constructor(t,r){bt(this,"name","ADSENSE"),bt(this,"context",void 0),bt(this,"contextInfo",void 0),bt(this,"configured",!1),bt(this,"initParams",void 0),bt(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),bt(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=Cv(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),bt(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),bt(this,"adUnit",n=>E(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:m,fullWidthResponsive:d,style:p}=n,h;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?h=document.querySelector(l):h=l,!h)throw new Error("targeting element not found");let b=c;if(b||(b=this.initParams.unitId),!b)throw new Error("slot is required");let I=typeof m=="object"&&Array.isArray(m)?m.join(", "):m,A=document.createElement("ins");if(A.className="adsbygoogle",A.id="jolibox-ads",A.style.display="block",A.setAttribute("data-ad-client",this.initParams.clientId),A.setAttribute("data-ad-slot",b),I&&A.setAttribute("data-ad-format",I),d&&A.setAttribute("data-full-width-responsive",d),p&&A.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let w=document.createElement("div");w.style.position="absolute",w.style.top="0",w.style.left="0",w.style.width="100%",w.style.height="100%",w.style.display="flex",w.style.justifyContent="center",w.style.alignItems="center",w.style.backgroundColor="rgba(0, 0, 0, 0.5)",w.style.color="white",w.innerHTML="Test Ad",A.style.position="relative",h.appendChild(A),A.appendChild(w)}else h.appendChild(A),new MutationObserver(w=>{w.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let O=A.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:O!=null?O:"null"})}})}).observe(A,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,window.adsbygoogle=window.adsbygoogle||[]}init(){return E(this,null,function*(){var t;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let r="google-adsense",n=(t=this.contextInfo.testAdsMode)!=null?t:!1;if(!document.getElementById(r)&&this.initParams.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&i.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&i.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),this.initParams.admobRewardedSlot&&i.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&i.setAttribute("data-admob-ads-only","on"),document.head.appendChild(i),this.context.track("LoadAdsenseCompleted",null)}})}};function fg(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 hg(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 mg=function(){function e(r){var n=this;this._insertTag=function(i){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,o),n.tags.push(i)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(hg(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=fg(n);try{i.insertRule(r,i.cssRules.length)}catch(o){}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e}(),Oe="-ms-",Ji="-moz-",Q="-webkit-",Ru="comm",Ms="rule",Gs="decl",pg="@import",Ou="@keyframes",vg="@layer",gg=Math.abs,Ki=String.fromCharCode,_g=Object.assign;function yg(e,t){return Ee(e,0)^45?(((t<<2^Ee(e,0))<<2^Ee(e,1))<<2^Ee(e,2))<<2^Ee(e,3):0}function ku(e){return e.trim()}function bg(e,t){return(e=t.exec(e))?e[0]:e}function Z(e,t,r){return e.replace(t,r)}function ms(e,t){return e.indexOf(t)}function Ee(e,t){return e.charCodeAt(t)|0}function nn(e,t,r){return e.slice(t,r)}function st(e){return e.length}function Js(e){return e.length}function Oi(e,t){return t.push(e),e}function wg(e,t){return e.map(t).join("")}var Wi=1,_r=1,Tu=0,Je=0,ge=0,yr="";function zi(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Wi,column:_r,length:a,return:""}}function Qr(e,t){return _g(zi("",null,null,"",null,null,0),e,{length:-e.length},t)}function Eg(){return ge}function Ig(){return ge=Je>0?Ee(yr,--Je):0,_r--,ge===10&&(_r=1,Wi--),ge}function Ve(){return ge=Je<Tu?Ee(yr,Je++):0,_r++,ge===10&&(_r=1,Wi++),ge}function lt(){return Ee(yr,Je)}function xi(){return Je}function ln(e,t){return nn(yr,e,t)}function on(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 xu(e){return Wi=_r=1,Tu=st(yr=e),Je=0,[]}function Nu(e){return yr="",e}function Ni(e){return ku(ln(Je-1,ps(e===91?e+2:e===40?e+1:e)))}function Ag(e){for(;(ge=lt())&&ge<33;)Ve();return on(e)>2||on(ge)>3?"":" "}function Sg(e,t){for(;--t&&Ve()&&!(ge<48||ge>102||ge>57&&ge<65||ge>70&&ge<97););return ln(e,xi()+(t<6&&lt()==32&&Ve()==32))}function ps(e){for(;Ve();)switch(ge){case e:return Je;case 34:case 39:e!==34&&e!==39&&ps(ge);break;case 40:e===41&&ps(e);break;case 92:Ve();break}return Je}function Cg(e,t){for(;Ve()&&e+ge!==57&&!(e+ge===84&&lt()===47););return"/*"+ln(t,Je-1)+"*"+Ki(e===47?e:Ve())}function Rg(e){for(;!on(lt());)Ve();return ln(e,Je)}function Og(e){return Nu(Pi("",null,null,null,[""],e=xu(e),0,[0],e))}function Pi(e,t,r,n,i,o,a,s,l){for(var c=0,m=0,d=a,p=0,h=0,b=0,I=1,A=1,w=1,R=0,O="",D=i,M=o,S=n,N=O;A;)switch(b=R,R=Ve()){case 40:if(b!=108&&Ee(N,d-1)==58){ms(N+=Z(Ni(R),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:N+=Ni(R);break;case 9:case 10:case 13:case 32:N+=Ag(b);break;case 92:N+=Sg(xi()-1,7);continue;case 47:switch(lt()){case 42:case 47:Oi(kg(Cg(Ve(),xi()),t,r),l);break;default:N+="/"}break;case 123*I:s[c++]=st(N)*w;case 125*I:case 59:case 0:switch(R){case 0:case 125:A=0;case 59+m:w==-1&&(N=Z(N,/\f/g,"")),h>0&&st(N)-d&&Oi(h>32?Qd(N+";",n,r,d-1):Qd(Z(N," ","")+";",n,r,d-2),l);break;case 59:N+=";";default:if(Oi(S=Xd(N,t,r,c,m,i,s,O,D=[],M=[],d),o),R===123)if(m===0)Pi(N,t,S,S,D,o,d,s,M);else switch(p===99&&Ee(N,3)===110?100:p){case 100:case 108:case 109:case 115:Pi(e,S,S,n&&Oi(Xd(e,S,S,0,0,i,s,O,i,D=[],d),M),i,M,d,s,n?D:M);break;default:Pi(N,S,S,S,[""],M,0,s,M)}}c=m=h=0,I=w=1,O=N="",d=a;break;case 58:d=1+st(N),h=b;default:if(I<1){if(R==123)--I;else if(R==125&&I++==0&&Ig()==125)continue}switch(N+=Ki(R),R*I){case 38:w=m>0?1:(N+="\f",-1);break;case 44:s[c++]=(st(N)-1)*w,w=1;break;case 64:lt()===45&&(N+=Ni(Ve())),p=lt(),m=d=st(O=N+=Rg(xi())),R++;break;case 45:b===45&&st(N)==2&&(I=0)}}return o}function Xd(e,t,r,n,i,o,a,s,l,c,m){for(var d=i-1,p=i===0?o:[""],h=Js(p),b=0,I=0,A=0;b<n;++b)for(var w=0,R=nn(e,d+1,d=gg(I=a[b])),O=e;w<h;++w)(O=ku(I>0?p[w]+" "+R:Z(R,/&\f/g,p[w])))&&(l[A++]=O);return zi(e,t,r,i===0?Ms:s,l,c,m)}function kg(e,t,r){return zi(e,t,r,Ru,Ki(Eg()),nn(e,2,-2),0)}function Qd(e,t,r,n){return zi(e,t,r,Gs,nn(e,0,n),nn(e,n+1,-1),n)}function gr(e,t){for(var r="",n=Js(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function Tg(e,t,r,n){switch(e.type){case vg:if(e.children.length)break;case pg:case Gs:return e.return=e.return||e.value;case Ru:return"";case Ou:return e.return=e.value+"{"+gr(e.children,n)+"}";case Ms:e.value=e.props.join(",")}return st(r=gr(e.children,n))?e.return=e.value+"{"+r+"}":""}function xg(e){var t=Js(e);return function(r,n,i,o){for(var a="",s=0;s<t;s++)a+=e[s](r,n,i,o)||"";return a}}function Ng(e){return function(t){t.root||(t=t.return)&&e(t)}}function Pg(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Dg=function(e,t,r){for(var n=0,i=0;n=i,i=lt(),n===38&&i===12&&(t[r]=1),!on(i);)Ve();return ln(e,Je)},Lg=function(e,t){var r=-1,n=44;do switch(on(n)){case 0:n===38&&lt()===12&&(t[r]=1),e[r]+=Dg(Je-1,t,r);break;case 2:e[r]+=Ni(n);break;case 4:if(n===44){e[++r]=lt()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Ki(n)}while(n=Ve());return e},Ug=function(e,t){return Nu(Lg(xu(e),t))},Zd=new WeakMap,Bg=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!Zd.get(r))&&!n){Zd.set(e,!0);for(var i=[],o=Ug(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},Mg=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function Pu(e,t){switch(yg(e,t)){case 5103:return Q+"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 Q+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Q+e+Ji+e+Oe+e+e;case 6828:case 4268:return Q+e+Oe+e+e;case 6165:return Q+e+Oe+"flex-"+e+e;case 5187:return Q+e+Z(e,/(\w+).+(:[^]+)/,Q+"box-$1$2"+Oe+"flex-$1$2")+e;case 5443:return Q+e+Oe+"flex-item-"+Z(e,/flex-|-self/,"")+e;case 4675:return Q+e+Oe+"flex-line-pack"+Z(e,/align-content|flex-|-self/,"")+e;case 5548:return Q+e+Oe+Z(e,"shrink","negative")+e;case 5292:return Q+e+Oe+Z(e,"basis","preferred-size")+e;case 6060:return Q+"box-"+Z(e,"-grow","")+Q+e+Oe+Z(e,"grow","positive")+e;case 4554:return Q+Z(e,/([^-])(transform)/g,"$1"+Q+"$2")+e;case 6187:return Z(Z(Z(e,/(zoom-|grab)/,Q+"$1"),/(image-set)/,Q+"$1"),e,"")+e;case 5495:case 3959:return Z(e,/(image-set\([^]*)/,Q+"$1$`$1");case 4968:return Z(Z(e,/(.+:)(flex-)?(.*)/,Q+"box-pack:$3"+Oe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Q+e+e;case 4095:case 3583:case 4068:case 2532:return Z(e,/(.+)-inline(.+)/,Q+"$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(st(e)-1-t>6)switch(Ee(e,t+1)){case 109:if(Ee(e,t+4)!==45)break;case 102:return Z(e,/(.+:)(.+)-([^]+)/,"$1"+Q+"$2-$3$1"+Ji+(Ee(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~ms(e,"stretch")?Pu(Z(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ee(e,t+1)!==115)break;case 6444:switch(Ee(e,st(e)-3-(~ms(e,"!important")&&10))){case 107:return Z(e,":",":"+Q)+e;case 101:return Z(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Q+(Ee(e,14)===45?"inline-":"")+"box$3$1"+Q+"$2$3$1"+Oe+"$2box$3")+e}break;case 5936:switch(Ee(e,t+11)){case 114:return Q+e+Oe+Z(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Q+e+Oe+Z(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Q+e+Oe+Z(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Q+e+Oe+e+e}return e}var Gg=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Gs:e.return=Pu(e.value,e.length);break;case Ou:return gr([Qr(e,{value:Z(e.value,"@","@"+Q)})],n);case Ms:if(e.length)return wg(e.props,function(i){switch(bg(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return gr([Qr(e,{props:[Z(i,/:(read-\w+)/,":"+Ji+"$1")]})],n);case"::placeholder":return gr([Qr(e,{props:[Z(i,/:(plac\w+)/,":"+Q+"input-$1")]}),Qr(e,{props:[Z(i,/:(plac\w+)/,":"+Ji+"$1")]}),Qr(e,{props:[Z(i,/:(plac\w+)/,Oe+"input-$1")]})],n)}return""})}},Jg=[Gg],Fg=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(b){var I=b.getAttribute("data-emotion");I.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var n=e.stylisPlugins||Jg,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(b){for(var I=b.getAttribute("data-emotion").split(" "),A=1;A<I.length;A++)i[I[A]]=!0;a.push(b)});var s,l=[Bg,Mg];{var c,m=[Tg,Ng(function(b){c.insert(b)})],d=xg(l.concat(n,m)),p=function(b){return gr(Og(b),d)};s=function(b,I,A,w){c=A,p(b?b+"{"+I.styles+"}":I.styles),w&&(h.inserted[I.name]=!0)}}var h={key:t,sheet:new mg({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:s};return h.sheet.hydrate(a),h};function jg(e){for(var t=0,r,n=0,i=e.length;i>=4;++n,i-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&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 Hg={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},qg=/[A-Z]|^ms/g,Vg=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Du=function(e){return e.charCodeAt(1)===45},eu=function(e){return e!=null&&typeof e!="boolean"},Za=Pg(function(e){return Du(e)?e:e.replace(qg,"-$&").toLowerCase()}),tu=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(Vg,function(r,n,i){return Dt={name:n,styles:i,next:Dt},n})}return Hg[e]!==1&&!Du(e)&&typeof t=="number"&&t!==0?t+"px":t};function Fi(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return Dt={name:i.name,styles:i.styles,next:Dt},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)Dt={name:a.name,styles:a.styles,next:Dt},a=a.next;var s=o.styles+";";return s}return $g(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function $g(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Fi(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":eu(s)&&(n+=Za(o)+":"+tu(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)eu(a[l])&&(n+=Za(o)+":"+tu(o,a[l])+";");else{var c=Fi(e,t,a);switch(o){case"animation":case"animationName":{n+=Za(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}var ru=/label:\s*([^\s;{]+)\s*(;|$)/g,Dt;function es(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,i="";Dt=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=Fi(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=Fi(r,t,e[s]),n){var l=o;i+=l[s]}ru.lastIndex=0;for(var c="",m;(m=ru.exec(i))!==null;)c+="-"+m[1];var d=jg(i)+c;return{name:d,styles:i,next:Dt}}function Lu(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}var Kg=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},Wg=function(e,t,r){Kg(e,t);var n=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var i=t;do e.insert(t===i?"."+n:"",i,e.sheet,!0),i=i.next;while(i!==void 0)}};function nu(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function iu(e,t,r){var n=[],i=Lu(e,n,r);return n.length<2?r:i+t(n)}var zg=function(e){var t=Fg(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=es(s,t.registered,void 0);return Wg(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=es(s,t.registered),m="animation-"+c.name;return nu(t,{name:c.name,styles:"@keyframes "+m+"{"+c.styles+"}"}),m},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=es(s,t.registered);nu(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return iu(t.registered,r,Yg(s))};return{css:r,cx:o,injectGlobal:i,keyframes:n,hydrate:function(a){a.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:Lu.bind(null,t.registered),merge:iu.bind(null,t.registered,r)}},Yg=function e(t){for(var r="",n=0;n<t.length;n++){var i=t[n];if(i!=null){var o=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))o=e(i);else{o="";for(var a in i)i[a]&&a&&(o&&(o+=" "),o+=a)}break}default:o=i}o&&(r&&(r+=" "),r+=o)}}return r},Xg=zg({key:"css"}),Te=Xg.css,vs,qe,ts,ou,au=0,Uu=[],_e=H,su=_e.__b,lu=_e.__r,cu=_e.diffed,du=_e.__c,uu=_e.unmount,fu=_e.__;function Qg(e,t){_e.__h&&_e.__h(qe,e,au||t),au=0;var r=qe.__H||(qe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Bu(e,t){var r=Qg(vs++,7);return t_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Zg(){for(var e;e=Uu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Di),e.__H.__h.forEach(gs),e.__H.__h=[]}catch(t){e.__H.__h=[],_e.__e(t,e.__v)}}_e.__b=function(e){qe=null,su&&su(e)},_e.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),fu&&fu(e,t)},_e.__r=function(e){lu&&lu(e),vs=0;var t=(qe=e.__c).__H;t&&(ts===qe?(t.__h=[],qe.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Di),t.__h.forEach(gs),t.__h=[],vs=0)),ts=qe},_e.diffed=function(e){cu&&cu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Uu.push(t)!==1&&ou===_e.requestAnimationFrame||((ou=_e.requestAnimationFrame)||e_)(Zg)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),ts=qe=null},_e.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Di),r.__h=r.__h.filter(function(n){return!n.__||gs(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],_e.__e(n,r.__v)}}),du&&du(e,t)},_e.unmount=function(e){uu&&uu(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Di(n)}catch(i){t=i}}),r.__H=void 0,t&&_e.__e(t,r.__v))};var hu=typeof requestAnimationFrame=="function";function e_(e){var t,r=function(){clearTimeout(n),hu&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);hu&&(t=requestAnimationFrame(r))}function Di(e){var t=qe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),qe=t}function gs(e){var t=qe;e.__c=e.__(),qe=t}function t_(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var r_=Symbol.for("preact-signals");function Yi(){if(Lt>1)Lt--;else{for(var e,t=!1;en!==void 0;){var r=en;for(en=void 0,_s++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Gu(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(_s=0,Lt--,t)throw e}}function ue(e){if(Lt>0)return e();Lt++;try{return e()}finally{Yi()}}var ie=void 0,en=void 0,Lt=0,_s=0,ji=0;function Mu(e){if(ie!==void 0){var t=e.n;if(t===void 0||t.t!==ie)return t={i:0,S:e,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:t},ie.s!==void 0&&(ie.s.n=t),ie.s=t,e.n=t,32&ie.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=ie.s,t.n=void 0,ie.s.n=t,ie.s=t),t}}function Ie(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Ie.prototype.brand=r_;Ie.prototype.h=function(){return!0};Ie.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)};Ie.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Ie.prototype.subscribe=function(e){var t=this;return dn(function(){var r=t.value,n=ie;ie=void 0;try{e(r)}finally{ie=n}})};Ie.prototype.valueOf=function(){return this.value};Ie.prototype.toString=function(){return this.value+""};Ie.prototype.toJSON=function(){return this.value};Ie.prototype.peek=function(){var e=ie;ie=void 0;try{return this.value}finally{ie=e}};Object.defineProperty(Ie.prototype,"value",{get:function(){var e=Mu(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(_s>100)throw new Error("Cycle detected");this.v=e,this.i++,ji++,Lt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Yi()}}}});function Y(e){return new Ie(e)}function Gu(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 Ju(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Fu(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function br(e){Ie.call(this,void 0),this.x=e,this.s=void 0,this.g=ji-1,this.f=4}(br.prototype=new Ie).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ji))return!0;if(this.g=ji,this.f|=1,this.i>0&&!Gu(this))return this.f&=-2,!0;var e=ie;try{Ju(this),ie=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return ie=e,Fu(this),this.f&=-2,!0};br.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)}Ie.prototype.S.call(this,e)};br.prototype.U=function(e){if(this.t!==void 0&&(Ie.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)}};br.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(br.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Mu(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function tn(e){return new br(e)}function ju(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Lt++;var r=ie;ie=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Fs(e),n}finally{ie=r,Yi()}}}function Fs(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ju(e)}function n_(e){if(ie!==this)throw new Error("Out-of-order effect");Fu(this),ie=e,this.f&=-2,8&this.f&&Fs(this),Yi()}function cn(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}cn.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()}};cn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ju(this),Ju(this),Lt++;var e=ie;return ie=this,n_.bind(this,e)};cn.prototype.N=function(){2&this.f||(this.f|=2,this.o=en,en=this)};cn.prototype.d=function(){this.f|=8,1&this.f||Fs(this)};function dn(e){var t=new cn(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Hu,rs,qu=[];dn(function(){Hu=this.N})();function wr(e,t){H[e]=t.bind(null,H[e]||function(){})}function Hi(e){rs&&rs(),rs=e&&e.S()}function Vu(e){var t=this,r=e.data,n=$u(r);n.value=r;var i=Bu(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=tn(function(){var h=n.value.value;return h===0?0:h===!0?"":h||""}),m=tn(function(){return!Array.isArray(c.value)&&!Ca(c.value)}),d=dn(function(){if(this.N=Ku,m.value){var h=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=h)}}),p=t.__$u.d;return t.__$u.d=function(){d(),p.call(this)},[m,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}Vu.displayName="_st";Object.defineProperties(Ie.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Vu},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});wr("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Ie&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});wr("__r",function(e,t){Hi();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return dn(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Hi(r),e(t)});wr("__e",function(e,t,r,n){Hi(),e(t,r,n)});wr("diffed",function(e,t){Hi();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],m=n[l];c===void 0?(c=i_(r,l,m,i),o[l]=c):c.o(m,i)}}}e(t)});function i_(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=Y(r);return{o:function(a,s){o.value=a,n=s},d:dn(function(){this.N=Ku;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}wr("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)});wr("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});He.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(n||o||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var a in e)if(a!=="__source"&&e[a]!==this.props[a])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function $u(e){return Bu(function(){return Y(e)},[])}var o_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function a_(){ue(function(){for(var e;e=qu.shift();)Hu.call(e)})}function Ku(){qu.push(this)===1&&(H.requestAnimationFrame||o_)(a_)}var ye=Te`
9
+ -----END PUBLIC KEY-----`});function cc(e){let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return window.btoa(t)}function wp(e){let t="-----BEGIN PUBLIC KEY-----",n=e.substring(e.indexOf(t)+t.length,e.indexOf("-----END PUBLIC KEY-----")).replace(/\s+/g,""),i=window.atob(n),o=new Uint8Array(i.length);for(let a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return o.buffer}function dc(e){return A(this,null,function*(){let t=window.crypto,r=t.subtle,n=wp(sc),i=yield r.importKey("spki",n,{name:"RSA-OAEP",hash:"SHA-1"},!1,["encrypt"]),o=t.getRandomValues(new Uint8Array(32)),a=yield r.importKey("raw",o,"AES-GCM",!1,["encrypt"]),s=yield r.encrypt({name:"RSA-OAEP"},i,o),l=cc(s),h={timestamp:Date.now(),data:e},m=new TextEncoder().encode(JSON.stringify(h)),p=t.getRandomValues(new Uint8Array(12)),b=yield r.encrypt({name:"AES-GCM",iv:p,tagLength:128},a,m),E=new Uint8Array(b),I=new Uint8Array(p.length+E.length);I.set(p,0),I.set(E,p.length);let w=cc(I.buffer);return{k:l,v:"1.0",payload:w}})}var uc=ne(()=>{"use strict";lc()});var xn,fc=ne(()=>{"use strict";ve();ac();rr();uc();xn=class extends kn{constructor(r,n,i){super(n,i);this.httpClient=Xe.create();this.gameId=U.mpId,this.sessionId=U.sessionId,this.track=r}reporter(r){return A(this,null,function*(){let{event:n,params:i,extraParams:o}=r,a={eventType:n,gameInfo:z({gameId:this.gameId,sessionId:this.sessionId},i)};o&&Object.assign(a,o);try{let s=yield dc(a);yield this.httpClient.post("/api/base/app-event/v2",{data:s})}catch(s){yield this.httpClient.post("/api/base/app-event",{data:a})}})}tracker(r,n=null){this.track(r,n)}}});var hc,Ap,Ae,Ep,Yo,Qe,mt=ne(()=>{"use strict";oc();K();K();Ko();zo();fc();ve();Vo();hc=Ce(),Ap={type:er.WebSDK,platform:"h5",jssdk_version:U.sdkInfo.jssdkVersion,mp_id:U.mpId,mp_version:U.mpVersion},{track:Ae,trackPerformance:Ep}=tc((...e)=>{var a,s,l,c;let[,t]=e,r=t,n=Ol(r.extra)?r.extra:Oo(r.extra)?JSON.parse(r.extra):{},i=Pe(z({},n),{mp_id:(a=r.mp_id)!=null?a:"",mp_version:(s=r.mp_version)!=null?s:""}),o={name:t.tag,type:Jt.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(c=(l=U.hostUserInfo)==null?void 0:l.uid)!=null?c:null};Tn.trackEvent(o,er.WebSDK)},Ap);hc.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Ep(e,t,r)});hc.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Ae(e,t)});Yo=new rt,Qe=new xn(Ae,Yo)});function pc(e){let t=Do.config[e];return t||(t={},Do.config[e]=t),(r,n)=>{if(t[r]){Ue.warn(`[can i use] ${r} already registered`);return}t[r]=z({},n)}}var mc=ne(()=>{"use strict";K()});function Xo(e){vc=e}function Dn(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Dn(t)):Object.keys(e).reduce((t,r)=>(t[r]=Dn(e[r]),t),{})}function vt(e){return typeof e=="number"}function Qo(e){let t=Zo(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Zo(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var vc,ge,Nn,Pn,Ln,Un,nr,Bn,Mn,Gn,Jn,Fn,jn,Hn,qn,Vn,Kn,$n,Wn,ea=ne(()=>{"use strict";vc=!1;ge=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(vc)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${Qo(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Dn(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Dn(this._default)}optional(){return this._optional=!0,this}};Nn=class extends ge{validate(t){return this._optional&&t===void 0?!0:vt(t)?vt(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):vt(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):vt(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}},Pn=class extends ge{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ln=class extends ge{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(vt(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(vt(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}},Un=class extends ge{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},nr=class extends ge{validate(t){return!0}},Bn=class extends ge{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Mn=class extends ge{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Gn=class extends ge{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Jn=class extends ge{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Qo(t)}`)}return!0}},Fn=class extends ge{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(vt(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(vt(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(vt(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((o,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,o===void 0&&n.hasDefault){r[a]=n.defaultValue;return}n.validate(o)||(n.hasFallback?r[a]=n.fallbackValue:i=!1)}),this._uniqueItems){let o=new Map;for(let a in r)o.has(r[a])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${o.get(r[a])}] and ${this.path}[${a}] are identical)`):o.set(r[a],a)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},jn=class extends ge{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Zo(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,o=this._value;o.errors=this.errors;let a=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?o.path=`${this.path}.${s}`:o.path=`${this.path}["${s}"]`,!(l===void 0&&o._optional)){if(l===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(l)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Hn=class extends ge{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Zo(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let o in this._object){let a=n[o],s=this._object[o];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(o)?s.path=`${this.path}.${o}`:s.path=`${this.path}["${o}"]`,!(s._optional&&a===void 0)){if(a===void 0&&s.hasDefault){n[o]=s.defaultValue;continue}s.validate(a)||(s.hasFallback?n[o]=s.fallbackValue:i=!1)}}return i}},qn=class extends ge{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Qo(this.value),actual:r}):!0}},Vn=class extends ge{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let o=0;o<i;o++){let a=this._items[o];if(a.errors=[],a.path=this.path,!a.validate(t))r.push(a.errors.join("; "));else if(!n){n=!0;break}}if(!n){let o=r.join(`
10
+ or `);this.errors.push(o)}return n}},Kn=class extends ge{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let i=t[n];if(i._optional||i.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,t[i]===void 0&&n.hasDefault){t[i]=n.defaultValue;return}n.validate(t[i])||(n.hasFallback?t[i]=n._fallback:r=!1)}),r}},$n=class extends ge{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Wn=class extends ge{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 ta(e,t,r="param"){if(e.errors=[],e.path=r,Xo(!0),!e.validate(t)){let n=e.errors.join(`
11
+ `);throw e.errors.length=0,Xo(!1),new TypeError(n)}}var j,ra=ne(()=>{"use strict";ea();ea();j={object(e){return new Hn(e)},array(e){return new Fn(e)},tuple(...e){return new Kn(...e)},literal(e){return new qn(e)},or(...e){return new Vn(...e)},symbol(){return new Un},record(e){return new jn(e)},function(){return new Gn},boolean(){return new Pn},string(){return new Ln},number(){return new Nn},undefined(){return new Bn},null(){return new Mn},unknown(){return new nr},any(){return new nr},as(){return new nr},arraybuffer(){return new $n},enum(...e){return new Jn(...e)},typedarray(e){return new Wn(e)}}});var zn,gc,_c=ne(()=>{"use strict";K();ht();ra();qo();zn=1,gc=e=>{function t(n,i){return(...o)=>{var d,m,p,b;let a=Date.now(),s={method:n,trace_id:zn};zn+=1;let l="SUCCESS",c=`${n}:ok`,h=0;try{if(i.paramsSchema)try{ta(i.paramsSchema,o,"params")}catch(R){throw Ho(`${n}:fail ${R.message}`)}let E=i.implement(...o),I=E,w=`${n}:ok`;if(E&&"code"in E){let{code:R,data:O,message:P}=E;l=R,I=O,w=P}return{code:l,message:w,data:I}}catch(E){let I=E;h=(m=(d=I.code)!=null?d:I.errNo)!=null?m:2e3,l="FAILURE";let w=(b=(p=I.message)!=null?p:I.errMsg)!=null?b:`${E}`;return c=`${n}:${l} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`,qe(new Sn(c,h)),{code:l,message:c}}finally{let E=Date.now()-a}}}function r(n,i){return(...o)=>A(this,null,function*(){var m,p,b,E;let a=Tl(o)?o:[o],s=Date.now(),l={method:n,trace_id:zn};zn+=1;let c=`${n}:ok`,h="SUCCESS",d={code:h,message:c};try{if(i.paramsSchema)try{ta(i.paramsSchema,a,"params")}catch(R){throw Ho(R.message)}let w=yield i.implement(...a);if(w&&"code"in w){let{code:R,data:O,message:P}=w;h=R,c=P,w=O}return Object.assign(d,{code:h,message:c,data:w}),d}catch(I){let w=I,R=(p=(m=w.code)!=null?m:w.errNo)!=null?p:2e3;h="FAILURE";let O=(E=(b=w.message)!=null?b:w.errMsg)!=null?E:`${I}`,P=`${n}:${h} ${O.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(d,{code:h,message:P}),qe(new Sn(P,R)),d}finally{let I=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var Ze,Ht,Ee,Nr=ne(()=>{"use strict";mc();mt();_c();ra();({createAPI:Ze,createSyncAPI:Ht}=gc(Ae)),Ee=pc("h5")});var Ac=_o((wc,aa)=>{(function(e){if(typeof wc=="object"&&typeof aa!="undefined")aa.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(i,o,a){function s(h,d){if(!o[h]){if(!i[h]){var m=typeof Or=="function"&&Or;if(!d&&m)return m(h,!0);if(l)return l(h,!0);var p=new Error("Cannot find module '"+h+"'");throw p.code="MODULE_NOT_FOUND",p}var b=o[h]={exports:{}};i[h][0].call(b.exports,function(E){var I=i[h][1][E];return s(I||E)},b,b.exports,n,i,o,a)}return o[h].exports}for(var l=typeof Or=="function"&&Or,c=0;c<a.length;c++)s(a[c]);return s}({1:[function(n,i,o){(function(a){"use strict";var s=a.MutationObserver||a.WebKitMutationObserver,l;if(s){var c=0,h=new s(E),d=a.document.createTextNode("");h.observe(d,{characterData:!0}),l=function(){d.data=c=++c%2}}else if(!a.setImmediate&&typeof a.MessageChannel!="undefined"){var m=new a.MessageChannel;m.port1.onmessage=E,l=function(){m.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?l=function(){var w=a.document.createElement("script");w.onreadystatechange=function(){E(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},a.document.documentElement.appendChild(w)}:l=function(){setTimeout(E,0)};var p,b=[];function E(){p=!0;for(var w,R,O=b.length;O;){for(R=b,b=[],w=-1;++w<O;)R[w]();O=b.length}p=!1}i.exports=I;function I(w){b.push(w)===1&&!p&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,o){"use strict";var a=n(1);function s(){}var l={},c=["REJECTED"],h=["FULFILLED"],d=["PENDING"];i.exports=m;function m(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,S!==s&&I(this,S)}m.prototype.catch=function(S){return this.then(null,S)},m.prototype.then=function(S,D){if(typeof S!="function"&&this.state===h||typeof D!="function"&&this.state===c)return this;var J=new this.constructor(s);if(this.state!==d){var H=this.state===h?S:D;b(J,H,this.outcome)}else this.queue.push(new p(J,S,D));return J};function p(S,D,J){this.promise=S,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof J=="function"&&(this.onRejected=J,this.callRejected=this.otherCallRejected)}p.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},p.prototype.otherCallFulfilled=function(S){b(this.promise,this.onFulfilled,S)},p.prototype.callRejected=function(S){l.reject(this.promise,S)},p.prototype.otherCallRejected=function(S){b(this.promise,this.onRejected,S)};function b(S,D,J){a(function(){var H;try{H=D(J)}catch(L){return l.reject(S,L)}H===S?l.reject(S,new TypeError("Cannot resolve promise with itself")):l.resolve(S,H)})}l.resolve=function(S,D){var J=w(E,D);if(J.status==="error")return l.reject(S,J.value);var H=J.value;if(H)I(S,H);else{S.state=h,S.outcome=D;for(var L=-1,G=S.queue.length;++L<G;)S.queue[L].callFulfilled(D)}return S},l.reject=function(S,D){S.state=c,S.outcome=D;for(var J=-1,H=S.queue.length;++J<H;)S.queue[J].callRejected(D);return S};function E(S){var D=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof D=="function")return function(){D.apply(S,arguments)}}function I(S,D){var J=!1;function H(Y){J||(J=!0,l.reject(S,Y))}function L(Y){J||(J=!0,l.resolve(S,Y))}function G(){D(L,H)}var F=w(G);F.status==="error"&&H(F.value)}function w(S,D){var J={};try{J.value=S(D),J.status="success"}catch(H){J.status="error",J.value=H}return J}m.resolve=R;function R(S){return S instanceof this?S:l.resolve(new this(s),S)}m.reject=O;function O(S){var D=new this(s);return l.reject(D,S)}m.all=P;function P(S){var D=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=S.length,H=!1;if(!J)return this.resolve([]);for(var L=new Array(J),G=0,F=-1,Y=new this(s);++F<J;)X(S[F],F);return Y;function X(ye,Q){D.resolve(ye).then(Ne,function(ut){H||(H=!0,l.reject(Y,ut))});function Ne(ut){L[Q]=ut,++G===J&&!H&&(H=!0,l.resolve(Y,L))}}}m.race=B;function B(S){var D=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=S.length,H=!1;if(!J)return this.resolve([]);for(var L=-1,G=new this(s);++L<J;)F(S[L]);return G;function F(Y){D.resolve(Y).then(function(X){H||(H=!0,l.resolve(G,X))},function(X){H||(H=!0,l.reject(G,X))})}}},{1:1}],3:[function(n,i,o){(function(a){"use strict";typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u};function s(u,v){if(!(u instanceof v))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(u){return}}var c=l();function h(){try{if(!c||!c.open)return!1;var u=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),v=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!u||v)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(f){return!1}}function d(u,v){u=u||[],v=v||{};try{return new Blob(u,v)}catch(g){if(g.name!=="TypeError")throw g;for(var f=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,_=new f,y=0;y<u.length;y+=1)_.append(u[y]);return _.getBlob(v.type)}}typeof Promise=="undefined"&&n(3);var m=Promise;function p(u,v){v&&u.then(function(f){v(null,f)},function(f){v(f)})}function b(u,v,f){typeof v=="function"&&u.then(v),typeof f=="function"&&u.catch(f)}function E(u){return typeof u!="string"&&(console.warn(u+" used as a key, but it is not a string."),u=String(u)),u}function I(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var w="local-forage-detect-blob-support",R=void 0,O={},P=Object.prototype.toString,B="readonly",S="readwrite";function D(u){for(var v=u.length,f=new ArrayBuffer(v),_=new Uint8Array(f),y=0;y<v;y++)_[y]=u.charCodeAt(y);return f}function J(u){return new m(function(v){var f=u.transaction(w,S),_=d([""]);f.objectStore(w).put(_,"key"),f.onabort=function(y){y.preventDefault(),y.stopPropagation(),v(!1)},f.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),g=navigator.userAgent.match(/Edge\//);v(g||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function H(u){return typeof R=="boolean"?m.resolve(R):J(u).then(function(v){return R=v,R})}function L(u){var v=O[u.name],f={};f.promise=new m(function(_,y){f.resolve=_,f.reject=y}),v.deferredOperations.push(f),v.dbReady?v.dbReady=v.dbReady.then(function(){return f.promise}):v.dbReady=f.promise}function G(u){var v=O[u.name],f=v.deferredOperations.pop();if(f)return f.resolve(),f.promise}function F(u,v){var f=O[u.name],_=f.deferredOperations.pop();if(_)return _.reject(v),_.promise}function Y(u,v){return new m(function(f,_){if(O[u.name]=O[u.name]||Xs(),u.db)if(v)L(u),u.db.close();else return f(u.db);var y=[u.name];v&&y.push(u.version);var g=c.open.apply(c,y);v&&(g.onupgradeneeded=function(C){var T=g.result;try{T.createObjectStore(u.storeName),C.oldVersion<=1&&T.createObjectStore(w)}catch(k){if(k.name==="ConstraintError")console.warn('The database "'+u.name+'" has been upgraded from version '+C.oldVersion+" to version "+C.newVersion+', but the storage "'+u.storeName+'" already exists.');else throw k}}),g.onerror=function(C){C.preventDefault(),_(g.error)},g.onsuccess=function(){var C=g.result;C.onversionchange=function(T){T.target.close()},f(C),G(u)}})}function X(u){return Y(u,!1)}function ye(u){return Y(u,!0)}function Q(u,v){if(!u.db)return!0;var f=!u.db.objectStoreNames.contains(u.storeName),_=u.version<u.db.version,y=u.version>u.db.version;if(_&&(u.version!==v&&console.warn('The database "'+u.name+`" can't be downgraded from version `+u.db.version+" to version "+u.version+"."),u.version=u.db.version),y||f){if(f){var g=u.db.version+1;g>u.version&&(u.version=g)}return!0}return!1}function Ne(u){return new m(function(v,f){var _=new FileReader;_.onerror=f,_.onloadend=function(y){var g=btoa(y.target.result||"");v({__local_forage_encoded_blob:!0,data:g,type:u.type})},_.readAsBinaryString(u)})}function ut(u){var v=D(atob(u.data));return d([v],{type:u.type})}function Sr(u){return u&&u.__local_forage_encoded_blob}function gn(u){var v=this,f=v._initReady().then(function(){var _=O[v._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return b(f,u,u),f}function _n(u){L(u);for(var v=O[u.name],f=v.forages,_=0;_<f.length;_++){var y=f[_];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return u.db=null,X(u).then(function(g){return u.db=g,Q(u)?ye(u):g}).then(function(g){u.db=v.db=g;for(var C=0;C<f.length;C++)f[C]._dbInfo.db=g}).catch(function(g){throw F(u,g),g})}function ft(u,v,f,_){_===void 0&&(_=1);try{var y=u.db.transaction(u.storeName,v);f(null,y)}catch(g){if(_>0&&(!u.db||g.name==="InvalidStateError"||g.name==="NotFoundError"))return m.resolve().then(function(){if(!u.db||g.name==="NotFoundError"&&!u.db.objectStoreNames.contains(u.storeName)&&u.version<=u.db.version)return u.db&&(u.version=u.db.version+1),ye(u)}).then(function(){return _n(u).then(function(){ft(u,v,f,_-1)})}).catch(f);f(g)}}function Xs(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Sf(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=u[_];var y=O[f.name];y||(y=Xs(),O[f.name]=y),y.forages.push(v),v._initReady||(v._initReady=v.ready,v.ready=gn);var g=[];function C(){return m.resolve()}for(var T=0;T<y.forages.length;T++){var k=y.forages[T];k!==v&&g.push(k._initReady().catch(C))}var x=y.forages.slice(0);return m.all(g).then(function(){return f.db=y.db,X(f)}).then(function(N){return f.db=N,Q(f,v._defaultConfig.version)?ye(f):N}).then(function(N){f.db=y.db=N,v._dbInfo=f;for(var M=0;M<x.length;M++){var $=x[M];$!==v&&($._dbInfo.db=f.db,$._dbInfo.version=f.version)}})}function Cf(u,v){var f=this;u=E(u);var _=new m(function(y,g){f.ready().then(function(){ft(f._dbInfo,B,function(C,T){if(C)return g(C);try{var k=T.objectStore(f._dbInfo.storeName),x=k.get(u);x.onsuccess=function(){var N=x.result;N===void 0&&(N=null),Sr(N)&&(N=ut(N)),y(N)},x.onerror=function(){g(x.error)}}catch(N){g(N)}})}).catch(g)});return p(_,v),_}function Rf(u,v){var f=this,_=new m(function(y,g){f.ready().then(function(){ft(f._dbInfo,B,function(C,T){if(C)return g(C);try{var k=T.objectStore(f._dbInfo.storeName),x=k.openCursor(),N=1;x.onsuccess=function(){var M=x.result;if(M){var $=M.value;Sr($)&&($=ut($));var te=u($,M.key,N++);te!==void 0?y(te):M.continue()}else y()},x.onerror=function(){g(x.error)}}catch(M){g(M)}})}).catch(g)});return p(_,v),_}function Of(u,v,f){var _=this;u=E(u);var y=new m(function(g,C){var T;_.ready().then(function(){return T=_._dbInfo,P.call(v)==="[object Blob]"?H(T.db).then(function(k){return k?v:Ne(v)}):v}).then(function(k){ft(_._dbInfo,S,function(x,N){if(x)return C(x);try{var M=N.objectStore(_._dbInfo.storeName);k===null&&(k=void 0);var $=M.put(k,u);N.oncomplete=function(){k===void 0&&(k=null),g(k)},N.onabort=N.onerror=function(){var te=$.error?$.error:$.transaction.error;C(te)}}catch(te){C(te)}})}).catch(C)});return p(y,f),y}function Tf(u,v){var f=this;u=E(u);var _=new m(function(y,g){f.ready().then(function(){ft(f._dbInfo,S,function(C,T){if(C)return g(C);try{var k=T.objectStore(f._dbInfo.storeName),x=k.delete(u);T.oncomplete=function(){y()},T.onerror=function(){g(x.error)},T.onabort=function(){var N=x.error?x.error:x.transaction.error;g(N)}}catch(N){g(N)}})}).catch(g)});return p(_,v),_}function kf(u){var v=this,f=new m(function(_,y){v.ready().then(function(){ft(v._dbInfo,S,function(g,C){if(g)return y(g);try{var T=C.objectStore(v._dbInfo.storeName),k=T.clear();C.oncomplete=function(){_()},C.onabort=C.onerror=function(){var x=k.error?k.error:k.transaction.error;y(x)}}catch(x){y(x)}})}).catch(y)});return p(f,u),f}function xf(u){var v=this,f=new m(function(_,y){v.ready().then(function(){ft(v._dbInfo,B,function(g,C){if(g)return y(g);try{var T=C.objectStore(v._dbInfo.storeName),k=T.count();k.onsuccess=function(){_(k.result)},k.onerror=function(){y(k.error)}}catch(x){y(x)}})}).catch(y)});return p(f,u),f}function Df(u,v){var f=this,_=new m(function(y,g){if(u<0){y(null);return}f.ready().then(function(){ft(f._dbInfo,B,function(C,T){if(C)return g(C);try{var k=T.objectStore(f._dbInfo.storeName),x=!1,N=k.openKeyCursor();N.onsuccess=function(){var M=N.result;if(!M){y(null);return}u===0||x?y(M.key):(x=!0,M.advance(u))},N.onerror=function(){g(N.error)}}catch(M){g(M)}})}).catch(g)});return p(_,v),_}function Nf(u){var v=this,f=new m(function(_,y){v.ready().then(function(){ft(v._dbInfo,B,function(g,C){if(g)return y(g);try{var T=C.objectStore(v._dbInfo.storeName),k=T.openKeyCursor(),x=[];k.onsuccess=function(){var N=k.result;if(!N){_(x);return}x.push(N.key),N.continue()},k.onerror=function(){y(k.error)}}catch(N){y(N)}})}).catch(y)});return p(f,u),f}function Pf(u,v){v=I.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;if(!u.name)y=m.reject("Invalid arguments");else{var g=u.name===f.name&&_._dbInfo.db,C=g?m.resolve(_._dbInfo.db):X(u).then(function(T){var k=O[u.name],x=k.forages;k.db=T;for(var N=0;N<x.length;N++)x[N]._dbInfo.db=T;return T});u.storeName?y=C.then(function(T){if(T.objectStoreNames.contains(u.storeName)){var k=T.version+1;L(u);var x=O[u.name],N=x.forages;T.close();for(var M=0;M<N.length;M++){var $=N[M];$._dbInfo.db=null,$._dbInfo.version=k}var te=new m(function(re,me){var he=c.open(u.name,k);he.onerror=function(We){var Rr=he.result;Rr.close(),me(We)},he.onupgradeneeded=function(){var We=he.result;We.deleteObjectStore(u.storeName)},he.onsuccess=function(){var We=he.result;We.close(),re(We)}});return te.then(function(re){x.db=re;for(var me=0;me<N.length;me++){var he=N[me];he._dbInfo.db=re,G(he._dbInfo)}}).catch(function(re){throw(F(u,re)||m.resolve()).catch(function(){}),re})}}):y=C.then(function(T){L(u);var k=O[u.name],x=k.forages;T.close();for(var N=0;N<x.length;N++){var M=x[N];M._dbInfo.db=null}var $=new m(function(te,re){var me=c.deleteDatabase(u.name);me.onerror=function(){var he=me.result;he&&he.close(),re(me.error)},me.onblocked=function(){console.warn('dropInstance blocked for database "'+u.name+'" until all open connections are closed')},me.onsuccess=function(){var he=me.result;he&&he.close(),te(he)}});return $.then(function(te){k.db=te;for(var re=0;re<x.length;re++){var me=x[re];G(me._dbInfo)}}).catch(function(te){throw(F(u,te)||m.resolve()).catch(function(){}),te})})}return p(y,v),y}var Lf={_driver:"asyncStorage",_initStorage:Sf,_support:h(),iterate:Rf,getItem:Cf,setItem:Of,removeItem:Tf,clear:kf,length:xf,key:Df,keys:Nf,dropInstance:Pf};function Uf(){return typeof openDatabase=="function"}var Tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bf="~~local_forage_type~",Qs=/^~~local_forage_type~([^~]+)~/,yn="__lfsc__:",ao=yn.length,so="arbf",lo="blob",Zs="si08",el="ui08",tl="uic8",rl="si16",nl="si32",il="ur16",ol="ui32",al="fl32",sl="fl64",ll=ao+so.length,cl=Object.prototype.toString;function dl(u){var v=u.length*.75,f=u.length,_,y=0,g,C,T,k;u[u.length-1]==="="&&(v--,u[u.length-2]==="="&&v--);var x=new ArrayBuffer(v),N=new Uint8Array(x);for(_=0;_<f;_+=4)g=Tt.indexOf(u[_]),C=Tt.indexOf(u[_+1]),T=Tt.indexOf(u[_+2]),k=Tt.indexOf(u[_+3]),N[y++]=g<<2|C>>4,N[y++]=(C&15)<<4|T>>2,N[y++]=(T&3)<<6|k&63;return x}function co(u){var v=new Uint8Array(u),f="",_;for(_=0;_<v.length;_+=3)f+=Tt[v[_]>>2],f+=Tt[(v[_]&3)<<4|v[_+1]>>4],f+=Tt[(v[_+1]&15)<<2|v[_+2]>>6],f+=Tt[v[_+2]&63];return v.length%3===2?f=f.substring(0,f.length-1)+"=":v.length%3===1&&(f=f.substring(0,f.length-2)+"=="),f}function Mf(u,v){var f="";if(u&&(f=cl.call(u)),u&&(f==="[object ArrayBuffer]"||u.buffer&&cl.call(u.buffer)==="[object ArrayBuffer]")){var _,y=yn;u instanceof ArrayBuffer?(_=u,y+=so):(_=u.buffer,f==="[object Int8Array]"?y+=Zs:f==="[object Uint8Array]"?y+=el:f==="[object Uint8ClampedArray]"?y+=tl:f==="[object Int16Array]"?y+=rl:f==="[object Uint16Array]"?y+=il:f==="[object Int32Array]"?y+=nl:f==="[object Uint32Array]"?y+=ol:f==="[object Float32Array]"?y+=al:f==="[object Float64Array]"?y+=sl:v(new Error("Failed to get type for BinaryArray"))),v(y+co(_))}else if(f==="[object Blob]"){var g=new FileReader;g.onload=function(){var C=Bf+u.type+"~"+co(this.result);v(yn+lo+C)},g.readAsArrayBuffer(u)}else try{v(JSON.stringify(u))}catch(C){console.error("Couldn't convert value into a JSON string: ",u),v(null,C)}}function Gf(u){if(u.substring(0,ao)!==yn)return JSON.parse(u);var v=u.substring(ll),f=u.substring(ao,ll),_;if(f===lo&&Qs.test(v)){var y=v.match(Qs);_=y[1],v=v.substring(y[0].length)}var g=dl(v);switch(f){case so:return g;case lo:return d([g],{type:_});case Zs:return new Int8Array(g);case el:return new Uint8Array(g);case tl:return new Uint8ClampedArray(g);case rl:return new Int16Array(g);case il:return new Uint16Array(g);case nl:return new Int32Array(g);case ol:return new Uint32Array(g);case al:return new Float32Array(g);case sl:return new Float64Array(g);default:throw new Error("Unkown type: "+f)}}var uo={serialize:Mf,deserialize:Gf,stringToBuffer:dl,bufferToString:co};function ul(u,v,f,_){u.executeSql("CREATE TABLE IF NOT EXISTS "+v.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,_)}function Jf(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=typeof u[_]!="string"?u[_].toString():u[_];var y=new m(function(g,C){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch(T){return C(T)}f.db.transaction(function(T){ul(T,f,function(){v._dbInfo=f,g()},function(k,x){C(x)})},C)});return f.serializer=uo,y}function kt(u,v,f,_,y,g){u.executeSql(f,_,y,function(C,T){T.code===T.SYNTAX_ERR?C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[v.storeName],function(k,x){x.rows.length?g(k,T):ul(k,v,function(){k.executeSql(f,_,y,g)},g)},g):g(C,T)},g)}function Ff(u,v){var f=this;u=E(u);var _=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[u],function(k,x){var N=x.rows.length?x.rows.item(0).value:null;N&&(N=C.serializer.deserialize(N)),y(N)},function(k,x){g(x)})})}).catch(g)});return p(_,v),_}function jf(u,v){var f=this,_=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"SELECT * FROM "+C.storeName,[],function(k,x){for(var N=x.rows,M=N.length,$=0;$<M;$++){var te=N.item($),re=te.value;if(re&&(re=C.serializer.deserialize(re)),re=u(re,te.key,$+1),re!==void 0){y(re);return}}y()},function(k,x){g(x)})})}).catch(g)});return p(_,v),_}function fl(u,v,f,_){var y=this;u=E(u);var g=new m(function(C,T){y.ready().then(function(){v===void 0&&(v=null);var k=v,x=y._dbInfo;x.serializer.serialize(v,function(N,M){M?T(M):x.db.transaction(function($){kt($,x,"INSERT OR REPLACE INTO "+x.storeName+" (key, value) VALUES (?, ?)",[u,N],function(){C(k)},function(te,re){T(re)})},function($){if($.code===$.QUOTA_ERR){if(_>0){C(fl.apply(y,[u,k,f,_-1]));return}T($)}})})}).catch(T)});return p(g,f),g}function Hf(u,v,f){return fl.apply(this,[u,v,f,1])}function qf(u,v){var f=this;u=E(u);var _=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[u],function(){y()},function(k,x){g(x)})})}).catch(g)});return p(_,v),_}function Vf(u){var v=this,f=new m(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){kt(C,g,"DELETE FROM "+g.storeName,[],function(){_()},function(T,k){y(k)})})}).catch(y)});return p(f,u),f}function Kf(u){var v=this,f=new m(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){kt(C,g,"SELECT COUNT(key) as c FROM "+g.storeName,[],function(T,k){var x=k.rows.item(0).c;_(x)},function(T,k){y(k)})})}).catch(y)});return p(f,u),f}function $f(u,v){var f=this,_=new m(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[u+1],function(k,x){var N=x.rows.length?x.rows.item(0).key:null;y(N)},function(k,x){g(x)})})}).catch(g)});return p(_,v),_}function Wf(u){var v=this,f=new m(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){kt(C,g,"SELECT key FROM "+g.storeName,[],function(T,k){for(var x=[],N=0;N<k.rows.length;N++)x.push(k.rows.item(N).key);_(x)},function(T,k){y(k)})})}).catch(y)});return p(f,u),f}function zf(u){return new m(function(v,f){u.transaction(function(_){_.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,g){for(var C=[],T=0;T<g.rows.length;T++)C.push(g.rows.item(T).name);v({db:u,storeNames:C})},function(y,g){f(g)})},function(_){f(_)})})}function Yf(u,v){v=I.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;return u.name?y=new m(function(g){var C;u.name===f.name?C=_._dbInfo.db:C=openDatabase(u.name,"","",0),u.storeName?g({db:C,storeNames:[u.storeName]}):g(zf(C))}).then(function(g){return new m(function(C,T){g.db.transaction(function(k){function x(te){return new m(function(re,me){k.executeSql("DROP TABLE IF EXISTS "+te,[],function(){re()},function(he,We){me(We)})})}for(var N=[],M=0,$=g.storeNames.length;M<$;M++)N.push(x(g.storeNames[M]));m.all(N).then(function(){C()}).catch(function(te){T(te)})},function(k){T(k)})})}):y=m.reject("Invalid arguments"),p(y,v),y}var Xf={_driver:"webSQLStorage",_initStorage:Jf,_support:Uf(),iterate:jf,getItem:Ff,setItem:Hf,removeItem:qf,clear:Vf,length:Kf,key:$f,keys:Wf,dropInstance:Yf};function Qf(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(u){return!1}}function hl(u,v){var f=u.name+"/";return u.storeName!==v.storeName&&(f+=u.storeName+"/"),f}function Zf(){var u="_localforage_support_test";try{return localStorage.setItem(u,!0),localStorage.removeItem(u),!1}catch(v){return!0}}function eh(){return!Zf()||localStorage.length>0}function th(u){var v=this,f={};if(u)for(var _ in u)f[_]=u[_];return f.keyPrefix=hl(u,v._defaultConfig),eh()?(v._dbInfo=f,f.serializer=uo,m.resolve()):m.reject()}function rh(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var g=localStorage.key(y);g.indexOf(_)===0&&localStorage.removeItem(g)}});return p(f,u),f}function nh(u,v){var f=this;u=E(u);var _=f.ready().then(function(){var y=f._dbInfo,g=localStorage.getItem(y.keyPrefix+u);return g&&(g=y.serializer.deserialize(g)),g});return p(_,v),_}function ih(u,v){var f=this,_=f.ready().then(function(){for(var y=f._dbInfo,g=y.keyPrefix,C=g.length,T=localStorage.length,k=1,x=0;x<T;x++){var N=localStorage.key(x);if(N.indexOf(g)===0){var M=localStorage.getItem(N);if(M&&(M=y.serializer.deserialize(M)),M=u(M,N.substring(C),k++),M!==void 0)return M}}});return p(_,v),_}function oh(u,v){var f=this,_=f.ready().then(function(){var y=f._dbInfo,g;try{g=localStorage.key(u)}catch(C){g=null}return g&&(g=g.substring(y.keyPrefix.length)),g});return p(_,v),_}function ah(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo,y=localStorage.length,g=[],C=0;C<y;C++){var T=localStorage.key(C);T.indexOf(_.keyPrefix)===0&&g.push(T.substring(_.keyPrefix.length))}return g});return p(f,u),f}function sh(u){var v=this,f=v.keys().then(function(_){return _.length});return p(f,u),f}function lh(u,v){var f=this;u=E(u);var _=f.ready().then(function(){var y=f._dbInfo;localStorage.removeItem(y.keyPrefix+u)});return p(_,v),_}function ch(u,v,f){var _=this;u=E(u);var y=_.ready().then(function(){v===void 0&&(v=null);var g=v;return new m(function(C,T){var k=_._dbInfo;k.serializer.serialize(v,function(x,N){if(N)T(N);else try{localStorage.setItem(k.keyPrefix+u,x),C(g)}catch(M){(M.name==="QuotaExceededError"||M.name==="NS_ERROR_DOM_QUOTA_REACHED")&&T(M),T(M)}})})});return p(y,f),y}function dh(u,v){if(v=I.apply(this,arguments),u=typeof u!="function"&&u||{},!u.name){var f=this.config();u.name=u.name||f.name,u.storeName=u.storeName||f.storeName}var _=this,y;return u.name?y=new m(function(g){u.storeName?g(hl(u,_._defaultConfig)):g(u.name+"/")}).then(function(g){for(var C=localStorage.length-1;C>=0;C--){var T=localStorage.key(C);T.indexOf(g)===0&&localStorage.removeItem(T)}}):y=m.reject("Invalid arguments"),p(y,v),y}var uh={_driver:"localStorageWrapper",_initStorage:th,_support:Qf(),iterate:ih,getItem:nh,setItem:ch,removeItem:lh,clear:rh,length:sh,key:oh,keys:ah,dropInstance:dh},fh=function(v,f){return v===f||typeof v=="number"&&typeof f=="number"&&isNaN(v)&&isNaN(f)},hh=function(v,f){for(var _=v.length,y=0;y<_;){if(fh(v[y],f))return!0;y++}return!1},pl=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"},Cr={},ml={},Qt={INDEXEDDB:Lf,WEBSQL:Xf,LOCALSTORAGE:uh},ph=[Qt.INDEXEDDB._driver,Qt.WEBSQL._driver,Qt.LOCALSTORAGE._driver],bn=["dropInstance"],fo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(bn),mh={description:"",driver:ph.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function vh(u,v){u[v]=function(){var f=arguments;return u.ready().then(function(){return u[v].apply(u,f)})}}function ho(){for(var u=1;u<arguments.length;u++){var v=arguments[u];if(v)for(var f in v)v.hasOwnProperty(f)&&(pl(v[f])?arguments[0][f]=v[f].slice():arguments[0][f]=v[f])}return arguments[0]}var gh=function(){function u(v){s(this,u);for(var f in Qt)if(Qt.hasOwnProperty(f)){var _=Qt[f],y=_._driver;this[f]=y,Cr[y]||this.defineDriver(_)}this._defaultConfig=ho({},mh),this._config=ho({},this._defaultConfig,v),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return u.prototype.config=function(f){if((typeof f=="undefined"?"undefined":a(f))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var _ in f){if(_==="storeName"&&(f[_]=f[_].replace(/\W/g,"_")),_==="version"&&typeof f[_]!="number")return new Error("Database version must be a number.");this._config[_]=f[_]}return"driver"in f&&f.driver?this.setDriver(this._config.driver):!0}else return typeof f=="string"?this._config[f]:this._config},u.prototype.defineDriver=function(f,_,y){var g=new m(function(C,T){try{var k=f._driver,x=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){T(x);return}for(var N=fo.concat("_initStorage"),M=0,$=N.length;M<$;M++){var te=N[M],re=!hh(bn,te);if((re||f[te])&&typeof f[te]!="function"){T(x);return}}var me=function(){for(var Rr=function(bh){return function(){var wh=new Error("Method "+bh+" is not implemented by the current driver"),vl=m.reject(wh);return p(vl,arguments[arguments.length-1]),vl}},po=0,yh=bn.length;po<yh;po++){var mo=bn[po];f[mo]||(f[mo]=Rr(mo))}};me();var he=function(Rr){Cr[k]&&console.info("Redefining LocalForage driver: "+k),Cr[k]=f,ml[k]=Rr,C()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(he,T):he(!!f._support):he(!0)}catch(We){T(We)}});return b(g,_,y),g},u.prototype.driver=function(){return this._driver||null},u.prototype.getDriver=function(f,_,y){var g=Cr[f]?m.resolve(Cr[f]):m.reject(new Error("Driver not found."));return b(g,_,y),g},u.prototype.getSerializer=function(f){var _=m.resolve(uo);return b(_,f),_},u.prototype.ready=function(f){var _=this,y=_._driverSet.then(function(){return _._ready===null&&(_._ready=_._initDriver()),_._ready});return b(y,f,f),y},u.prototype.setDriver=function(f,_,y){var g=this;pl(f)||(f=[f]);var C=this._getSupportedDrivers(f);function T(){g._config.driver=g.driver()}function k(M){return g._extend(M),T(),g._ready=g._initStorage(g._config),g._ready}function x(M){return function(){var $=0;function te(){for(;$<M.length;){var re=M[$];return $++,g._dbInfo=null,g._ready=null,g.getDriver(re).then(k).catch(te)}T();var me=new Error("No available storage method found.");return g._driverSet=m.reject(me),g._driverSet}return te()}}var N=this._driverSet!==null?this._driverSet.catch(function(){return m.resolve()}):m.resolve();return this._driverSet=N.then(function(){var M=C[0];return g._dbInfo=null,g._ready=null,g.getDriver(M).then(function($){g._driver=$._driver,T(),g._wrapLibraryMethodsWithReady(),g._initDriver=x(C)})}).catch(function(){T();var M=new Error("No available storage method found.");return g._driverSet=m.reject(M),g._driverSet}),b(this._driverSet,_,y),this._driverSet},u.prototype.supports=function(f){return!!ml[f]},u.prototype._extend=function(f){ho(this,f)},u.prototype._getSupportedDrivers=function(f){for(var _=[],y=0,g=f.length;y<g;y++){var C=f[y];this.supports(C)&&_.push(C)}return _},u.prototype._wrapLibraryMethodsWithReady=function(){for(var f=0,_=fo.length;f<_;f++)vh(this,fo[f])},u.prototype.createInstance=function(f){return new u(f)},u}(),_h=new gh;i.exports=_h},{3:3}]},{},[4])(4)})});var Ic=_o(ir=>{"use strict";K();Nr();mt();var Lr=(e,t)=>{let r=window.parent;r&&r!==window&&typeof r.postMessage=="function"&&r.postMessage({type:e,data:t},"*")},Ur=Ce(),Fp=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=>A(ir,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e;Ue.info("onLevelFinished",r,n,i,o),Lr("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:r,rating:n,score:i,variation:o}),yield Promise.all([Qe.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}}),Qe.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})])})}),jp=Ze("gamePlayEnded",{paramsSchema:j.tuple(j.object({duration:j.number().optional(),rating:j.number().optional(),score:j.number(),variation:j.string().optional()})),implement:e=>A(ir,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e;Ue.info("onGamePlayEnded",t,r,n,i),Lr("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:r,score:n,variation:i}),yield Promise.all([Qe.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i}),Qe.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})])})}),Hp=Ze("levelUpgrade",{paramsSchema:j.tuple(j.object({levelId:j.or(j.string(),j.number()),name:j.string().optional()})),implement:r=>A(ir,[r],function*({levelId:e,name:t}){Ue.info("onLevelUpgrade",e,t),Lr("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:e,name:t}),yield Promise.all([Qe.tracker("LevelUpgrade",{name:t,levelId:e}),Qe.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})])})}),qp=Ze("levelStart",{paramsSchema:j.tuple(j.object({levelId:j.or(j.string(),j.number())})),implement:e=>A(ir,null,function*(){let{levelId:t}=e;Ue.info("onLevelStart",t),Lr("JOLIBOX_GAME_TASK_LEVEL_START",{levelId:t}),yield Qe.tracker("LevelStart",{levelId:t})})}),Vp=Ze("levelFailed",{paramsSchema:j.tuple(j.object({levelId:j.or(j.string(),j.number()),score:j.number().optional(),rating:j.number().optional(),duration:j.number().optional()})),implement:e=>A(ir,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;Ue.info("onLevelFailed",t,r,n,i),Lr("JOLIBOX_GAME_TASK_LEVEL_FAILED",{levelId:t,score:r,rating:n,duration:i}),yield Qe.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});Ur.registerCommand("TaskTrackerSDK.levelFinished",Fp);Ur.registerCommand("TaskTrackerSDK.gamePlayEnded",jp);Ur.registerCommand("TaskTrackerSDK.levelUpgrade",Hp);Ur.registerCommand("TaskTrackerSDK.levelStart",qp);Ur.registerCommand("TaskTrackerSDK.levelFailed",Vp);Ee("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"}}});Ee("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});Ee("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});Ee("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});Ee("TaskTrackerSDK.onLevelFailed",{version:"1.3.8",properties:{params:{levelId:"1.3.8",score:"1.3.8",rating:"1.3.8",duration:"1.3.8"}}})});var Ge,or,Sc,la,Kp,qt,Br=ne(()=>{"use strict";Ge=(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}));let r=window.parent;r&&r!==window&&typeof r.postMessage=="function"&&r.postMessage({type:e,data:{detail:t}},"*")},or=new Map,Sc=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let r=or.get(t.type);r&&r.forEach(n=>{try{n(t.data)}catch(i){console.warn("Callback execution failed:",i)}})}}catch(t){console.warn("Failed to parse message:",t)}},la=!1,Kp=()=>{la||(window.addEventListener("message",Sc),la=!0)},qt=(e,t)=>{Kp(),or.has(e)||or.set(e,new Set);let r=or.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&or.delete(e),or.size===0&&(window.removeEventListener("message",Sc),la=!1)}}});var ei,ti,ri,ni,ii,ca,oi,ai,si,li,ar,$p,ie,gt,_t,Je=ne(()=>{"use strict";K();ei="UNLOCK_OPTIONS_CHANGED",ti="INVOKE_PAYMENT",ri="ON_PAYMENT_RESULT",ni="ON_USE_MODAL_EVENT",ii="ON_USE_MODAL_RESULT",ca="ON_USE_MODAL_FREQUENCY",oi="ON_USE_UNLOGIN_MODAL_EVENT",ai="INVOKE_UNLOGIN_MODAL_EVENT",si="INVOKE_SUBSCRIPTION_EVENT",li="ON_USE_SUBSCRIPTION_RESULT",ar=new rt,$p=()=>({on:ar.on.bind(ar),off:ar.off.bind(ar),emit:ar.emit.bind(ar)}),ie=$p(),gt={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},_t={show:!0,minInterval:8*60*60*1e3}});var of=_o(eo=>{"use strict";ve();Je();Br();K();var nf={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};qt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",nf[e.result],e.result),ie.emit(ii,{useModalResult:nf[e.result]})});ie.on(ni,(e,t)=>{var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ge("JOLIBOX_JOLI_COIN_USE_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:Ye()})});qt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{ie.emit(ri,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});ie.on(ti,(e,t)=>A(eo,null,function*(){var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ge("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:Ye()})}));qt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,r,n,i,o;ie.emit(oi,{result:e.result=="ADS"?"FAILED":e.result,rewards:{claimedRewardValue:(i=(n=(r=(t=e.extra)==null?void 0:t.firstLogin)==null?void 0:r.reward)==null?void 0:n.rewardValue)!=null?i:0,isFirstLogin:(o=e.isFirstLogin)!=null?o:!1}}),e.result==="SUCCESS"&&U.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});ie.on(ai,e=>A(eo,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Ge("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:Ye(),type:e})}));qt("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),ie.emit(li,{result:e.result})});ie.on(si,e=>A(eo,null,function*(){console.log("----notify custom event-----",e),Ge("JOLIBOX_SUB_EVENT",{sequenceId:Ye()})}))});mt();ve();Nr();K();var yc=Ce(),Sp="env",Cp="getSystemInfoSync",Rp=()=>{var i,o,a,s;let e={system:U.deviceInfo.system,platform:U.deviceInfo.platform.toLowerCase(),brand:U.deviceInfo.brand,pixelRatio:U.deviceInfo.pixelRatio,language:U.deviceInfo.lang,version:U.sdkInfo.jssdkVersion,appName:(i=U.hostInfo)==null?void 0:i.appName,SDKVersion:U.sdkInfo.nativeSDKVersion},t=(o=U.hostInfo)==null?void 0:o.version;t&&(e=Pe(z({},e),{version:t}));let r=(a=U.hostInfo)==null?void 0:a.appName;r&&(e=Pe(z({},e),{appName:r}));let n=(s=U.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(e=Pe(z({},e),{SDKVersion:n})),e},Op=Ht(Cp,{implement:Rp}),Tp=Ht(Sp,{implement:()=>Pe(z({},U.hostInfo),{sdkInfo:U.sdkInfo,platform:U.platform,deviceInfo:U.deviceInfo})});yc.registerCommand("API.env",Tp);yc.registerCommand("API.getSystemInfoSync",Op);Ee("env",{version:"1.0.0"});Ee("getSystemInfoSync",{version:"1.0.0"});K();Nr();ht();mt();var kp="onJoliboxShow",xp="onJoliboxHide",Dp="onReady",ia=Ce(),oa=Ul(qe),na=!0,Pr=!0,Yn=0,Xn=Yo;function Np(){let e=Date.now();if(e-Yn<100)return;Yn=e;let t=document.visibilityState==="visible";t!==na&&(na=t,Xn.emit("visible",na))}function bc(e){let t=Date.now();t-Yn<100||(Yn=t,e==="focus"&&!Pr?Pr=!0:e==="blur"&&Pr&&(Pr=!1),Xn.emit("visible",Pr))}document.addEventListener("visibilitychange",Np);window.addEventListener("focus",()=>bc("focus"));window.addEventListener("blur",()=>bc("blur"));var Pp=Ht(kp,{paramsSchema:j.tuple(j.function()),implement(e){let t=oa(e);Xn.on("visible",r=>{r&&t()})}}),Lp=Ht(xp,{paramsSchema:j.tuple(j.function()),implement(e){let t=oa(e);Xn.on("visible",r=>{!r&&t()})}}),Up=Ht(Dp,{paramsSchema:j.tuple(j.function()),implement(e){let t=oa(e);xt.on("LifecycleEvent.onReady",r=>{t(r)})}});ia.registerCommand("LifecycleSDK.onReady",Up);ia.registerCommand("LifecycleSDK.onJoliboxShow",Pp);ia.registerCommand("LifecycleSDK.onJoliboxHide",Lp);Ee("lifeCycle.onReady",{version:"1.0.0"});Ee("lifeCycle.onJoliboxShow",{version:"1.0.0"});Ee("lifeCycle.onJoliboxHide",{version:"1.0.0"});Nr();K();rr();ve();var Ec=yo(Ac());var Qn=Ce(),sa=class{constructor(){this.httpClient=Xe.create({baseUrl:tr(U.testMode)});this.getGameId=()=>U.mpId;this.getItem=t=>A(this,null,function*(){let{code:r,data:n,message:i}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),o=n==null?void 0:n.value,a=i;return r!=="SUCCESS"&&(o=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",o),a+="fallback to localstorage"),{code:r,message:a,data:o&&o!=="undefined"?o:null}});this.setItem=(t,r)=>A(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:i,message:o}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:i,message:o}});this.removeItem=t=>A(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>A(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=Ec.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Zn=new sa,Bp=Ze("getLocalStorage",{paramsSchema:j.tuple(j.string()),implement(e){return A(this,null,function*(){return yield Zn.getItem(e)})}});Qn.registerCommand("StorageSDK.getItem",Bp);Ee("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Mp=Ze("setStorage",{paramsSchema:j.tuple(j.string(),j.or(j.string(),j.boolean(),j.number())),implement(e,t){return A(this,null,function*(){return yield Zn.setItem(e,t)})}});Qn.registerCommand("StorageSDK.setItem",Mp);Ee("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Gp=Ze("removeStorage",{paramsSchema:j.tuple(j.string()),implement(e){return A(this,null,function*(){return yield Zn.removeItem(e)})}});Qn.registerCommand("StorageSDK.removeItem",Gp);Ee("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Jp=Ze("clearStorage",{implement(){return A(this,null,function*(){return yield Zn.clear()})}});Qn.registerCommand("StorageSDK.clear",Jp);Ee("storage.clear",{version:"1.0.0"});var L0=yo(Ic());mt();K();rr();Br();ve();Je();var Cc=U.testMode;function Rc(){let e=new Map,t,r;return{registerRewardHandler(i,o){e.set(i,o)},handleReward(i,...o){return A(this,null,function*(){return yield i.reduce((s,l)=>A(this,null,function*(){let c=yield s;if(c===!0)return!0;Cc&&console.log(`handleReward ${l}`);let h=e.get(l),d=h?yield h(...o):c;return Cc&&console.log(`handleReward ${l} ${d}`),d}),Promise.resolve(!1))})},registerRewardsFetcher(i){return A(this,null,function*(){t=(...o)=>A(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return A(this,null,function*(){r=(...o)=>A(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),{joliCoinUseAndCharge:gt,loginGuide:_t}}})})},getRewardsTypes(...i){return A(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return A(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:gt,loginGuide:_t}})}}}K();var da=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"POST",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){var r,n,i;return{unlockOptions:((r=t.data)==null?void 0:r.unlockOptions)||[],joliCoin:((n=t.extra)==null?void 0:n.joliCoin)||{balance:0,enableAutoDeduct:!1},joliGem:((i=t.extra)==null?void 0:i.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(t,r){return{code:"SUCCESS",message:"success",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin||{balance:0,enableAutoDeduct:!1},joliGem:t.joliGem||{balance:0,enableAutoDeduct:!1}}}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}},ua=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return z({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},ci=class{constructor(t){this.unlockOptionsService=new Ft(new da(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((i,o)=>{var s,l;let a=n.unlockOptions[o];return i.type===a.type&&((s=i.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=a.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new Ft(new ua(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return A(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return A(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 A(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return A(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 A(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()}};Je();K();var Wp=()=>(e,t)=>{let r={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return r[t]-r[e]},zp=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],Yp=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(Wp())},fa=null;function ha(e){return fa||(fa=new ci(e)),fa}var pa=e=>{e.registerRewardsFetcher(t=>A(void 0,null,function*(){var i,o,a,s,l;let r=["ADS"],n=ha(t);try{let c=yield n.getUnlockOptions({});if(c.code!=="SUCCESS")return r;ie.emit(ei,{options:((i=c.data)==null?void 0:i.unlockOptions)||[],userJoliCoin:((o=c.extra)==null?void 0:o.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((a=c.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}});let h=((l=(s=c.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(d=>d.type))||Array.from(r);return Yp(h)}catch(c){return console.error("getRewardOptions error (cached):",c),r}}))},ma=e=>{e.registerRewardFrequencyConfigFetcher(t=>A(void 0,null,function*(){var n,i,o,a;let r=ha(t);try{let s=yield r.getGlobalConfig();return ie.emit(ca,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||gt,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||_t}),s.data&&xt.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((o=s.data)==null?void 0:o.joliCoinUseAndCharge)||gt,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||_t}}catch(s){return console.error("getGlobalConfig error (cached):",s),ie.emit(ca,{joliCoinUseAndCharge:gt,loginGuide:_t}),xt.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:gt,loginGuide:_t,supportedHostMethods:zp}}),{joliCoinUseAndCharge:gt,loginGuide:_t}}}))};var va=e=>A(void 0,null,function*(){yield ha(e).warmupCache(),console.log("Reward cache warmed up")});var Oc=e=>t=>A(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",t),yield e.adBreak(t)}catch(r){console.error("-----createAdsRewardHandler error-----",r)}return!0});Je();function nt(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r),updateData:a=>{if(i)return i=z(z({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}Je();var Re=nt(ie,ei),Mr=(e,t)=>{var n;let r=(n=e.options)==null?void 0:n.some(i=>i.type==="SUBSCRIPTION");return console.log("typeof extraCheck",typeof t,t==null?void 0:t()),r&&(!t||(t==null?void 0:t()))};ve();K();var ga={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"}};K();var ze=Ce();Je();Je();K();var ya=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},ba=class{constructor(t){this.balanceService=new Ft(new ya(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getBalance(t="JOLI_COIN"){return A(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 A(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 A(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()}},_a=null;function wa(e){return _a||(_a=new ba(e)),_a}var Aa=(e,t="JOLI_COIN")=>A(void 0,null,function*(){return yield wa(e).getBalance(t)}),Vt=(e,t="JOLI_COIN")=>A(void 0,null,function*(){let n=yield wa(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n}),di=(e,t="JOLI_COIN")=>A(void 0,null,function*(){yield wa(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});K();var Ia=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Sa=class{constructor(t){this.gemBalanceService=new Ft(new Ia(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getGemBalance(t="GEM"){return A(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 A(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 A(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()}},Ea=null;function Tc(e){return Ea||(Ea=new Sa(e)),Ea}var Ca=(e,t="GEM")=>A(void 0,null,function*(){return yield Tc(e).getGemBalance(t)}),sr=(e,t="GEM")=>A(void 0,null,function*(){let n=yield Tc(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n});var it={JOLI_COIN:{fetchBalance:Aa,getQuantity:e=>{var t,r,n;return(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(i=>i.type==="JOLI_COIN"))==null?void 0:r.joliCoinChoices[0].joliCoinQuantity)!=null?n: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 r,n;return(n=(r=e==null?void 0:e.options)==null?void 0:r.some(i=>i.type==="JOLI_COIN"&&i.joliCoinChoices.some(o=>{var a;return o.joliCoinQuantity<=((a=t==null?void 0:t.balance)!=null?a:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:Ca,getQuantity:e=>{var t,r,n,i;return(i=(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(o=>o.type==="JOLI_GEM"))==null?void 0:r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i: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 n,i,o;let r=e==null?void 0:e.options.find(a=>a.type==="JOLI_GEM");return r?((i=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0)<=((o=t==null?void 0:t.balance)!=null?o:0):!1}}};var ui=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;ze.registerCommand(`Rewards.${e}.useJolicoin`,()=>A(void 0,null,function*(){let i=yield Re.getData(),o=it[t],a=o.getCurrentUser(i),s=o.getQuantity(i),l=!!(a!=null&&a.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",i,l,s),(yield n({enableAutoDeduct:l,userCurrency:a,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},Kt=(e,t)=>r=>A(void 0,null,function*(){let n=nt(ie,ii);return ie.emit(ni,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult});Je();Je();var fi=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;ze.registerCommand(`Rewards.${e}.usePayment`,()=>A(void 0,null,function*(){var m;let o=yield Re.getData(),a=it[t],s=yield a.fetchBalance(n),l=a.getQuantity(o),c=a.getCurrentUser(o),h=a.createUpdatedUser((m=s==null?void 0:s.balance)!=null?m:0,c.enableAutoDeduct),d=a.getUpdateKey();if(Re.updateData({[d]:h}),console.log("-----unlockOptions payment-----",o,h,l,t),!a.isEnough(o,h)){let p=yield i({userCurrency:h,currencyQuantity:l,currency:t});return t==="JOLI_GEM"?sr(n):Vt(n),{result:p==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},$t=(e,t)=>r=>A(void 0,null,function*(){let n=nt(ie,ri);return ie.emit(ti,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult});ve();Je();Je();K();var Wt=(e,t)=>r=>A(void 0,null,function*(){let n=nt(ie,oi);return ie.emit(ai,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()});var Zp=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:o,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:c}})=>{fi(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:a}),ui(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let h=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return d=>A(void 0,null,function*(){var m,p,b,E;try{let I=yield o.getData();if(Mr(I,c)){let P=it.JOLI_COIN,B=yield P.fetchBalance(t),S=P.getCurrentUser(I),D=P.createUpdatedUser((m=B==null?void 0:B.balance)!=null?m:0,S.enableAutoDeduct);if(!P.isEnough(I,D))return i==null||i(d),!1}else{let P=!0;for(let B of h){let S=yield ze.executeCommand(B);if(P=P&&S.result!=="FAILED",S.result!=="CONTINUE")break}if(!P)return i==null||i(d),!1}let R=ga[r],O=yield t.post(R.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Ye()}-${U.mpType}-${Date.now()}`,gameInfo:{gameId:U.mpId}}});if(console.log("-----unlockWithCurrency request result-----",O),O.code=="SUCCESS"){try{(b=d.adBreakDone)==null||b.call(d,{breakType:d.type,breakName:"name"in d&&(p=d.name)!=null?p:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in d&&((E=d.adViewed)==null||E.call(d)),Vt(t)}catch(P){console.error("-----unlockWithJolicoin adBreakDone error-----",P)}return n==null||n({quantity:O.data.quantity,balance:O.data.balance}),!0}return i==null||i(d),!1}catch(I){if(console.info("JolicoinRewardHandler error:",I),I instanceof Error&&I.message=="CANCEL")throw I;return i==null||i(d),!1}finally{o.clearCache()}})},hi=(e,t,r)=>Zp(e,t,"JOLI_COIN",r);var kc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=Kt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=$t("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Wt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return hi("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Re,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};var xc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=c=>{var h;r==null||r(),(h=c.adBreakDone)==null||h.call(c,{breakType:c.type,breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=Kt("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=$t("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Wt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return hi("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Re,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};ve();K();Je();Je();var Dc=e=>{let{showSubscriptionModal:t}=e;ze.registerCommand("Rewards.subscription",()=>A(void 0,null,function*(){var s,l;let r=yield Re.getData(),n=(l=(s=r==null?void 0:r.options)==null?void 0:s.find(c=>c.type==="JOLI_GEM"))==null?void 0:l.type,i=it[n?"JOLI_GEM":"JOLI_COIN"],o=i.getCurrentUser(r);return i.isEnough(r,o)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},Nc=e=>()=>A(void 0,null,function*(){let t=nt(ie,li);return ie.emit(si,e),(yield t.getFreshData()).result});ve();var Pc=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:o,hasSubscription:a}})=>{Dc({showSubscriptionModal:o});let s=["Rewards.subscription"];return l=>A(void 0,null,function*(){var c,h,d,m,p,b;try{let E=yield i.getData();if(!Mr(E,a))return!1;let w=!0;for(let R of s){let O=yield ze.executeCommand(R);if(w=w&&O.result!=="FAILED",O.result!=="CONTINUE")break}if(Vt(t),sr(t),console.log("-----unlockWithSubscription result-----",w),w){try{(h=l.adBreakDone)==null||h.call(l,{breakType:l.type,breakName:"name"in l&&(c=l.name)!=null?c:"",breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in l&&((d=l.adViewed)==null||d.call(l)),(b=(p=U).onEnvConfigChanged)==null||b.call(p,{hostUserInfo:Pe(z({},(m=U.hostUserInfo)!=null?m:{isLogin:!1}),{isSubUser:!0})})}catch(R){console.error("-----unlockWithSubscription adBreakDone error-----",R)}return r==null||r(),!0}return n==null||n(l),!1}catch(E){if(console.info("SubscriptionRewardHandler error:",E),E instanceof Error&&E.message=="CANCEL")throw E;return n==null||n(l),!1}finally{}})};var Lc=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=Nc("SUBSCRIPTION");return Pc("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Re,showSubscriptionModal:o,hasSubscription:n}})};var ot=Rc();pa(ot);ma(ot);var gi,q,Jc,Ta,zt,Uc,Fc,jc,Hc,ka,Ra,Oa,tm,Gr={},qc=[],rm=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Jr=Array.isArray;function yt(e,t){for(var r in t)e[r]=t[r];return e}function xa(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fr(e,t,r){var n,i,o,a={};for(o in t)o=="key"?n=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?gi.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return mi(e,a,n,i,null)}function mi(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++Jc:i,__i:-1,__u:0};return i==null&&q.vnode!=null&&q.vnode(o),o}function jr(){return{current:null}}function Dt(e){return e.children}function Ve(e,t){this.props=e,this.context=t}function lr(e,t){if(t==null)return e.__?lr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?lr(e):null}function Vc(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Vc(e)}}function Bc(e){(!e.__d&&(e.__d=!0)&&zt.push(e)&&!vi.__r++||Uc!==q.debounceRendering)&&((Uc=q.debounceRendering)||Fc)(vi)}function vi(){for(var e,t,r,n,i,o,a,s=1;zt.length;)zt.length>s&&zt.sort(jc),e=zt.shift(),s=zt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,o=[],a=[],t.__P&&((r=yt({},n)).__v=n.__v+1,q.vnode&&q.vnode(r),Da(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,o,i==null?lr(n):i,!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,Wc(o,r,a),r.__e!=i&&Vc(r)));vi.__r=0}function Kc(e,t,r,n,i,o,a,s,l,c,h){var d,m,p,b,E,I,w=n&&n.__k||qc,R=t.length;for(l=nm(r,t,w,l,R),d=0;d<R;d++)(p=r.__k[d])!=null&&(m=p.__i===-1?Gr:w[p.__i]||Gr,p.__i=d,I=Da(e,p,m,i,o,a,s,l,c,h),b=p.__e,p.ref&&m.ref!=p.ref&&(m.ref&&Na(m.ref,null,p),h.push(p.ref,p.__c||b,p)),E==null&&b!=null&&(E=b),4&p.__u||m.__k===p.__k?l=$c(p,l,e):typeof p.type=="function"&&I!==void 0?l=I:b&&(l=b.nextSibling),p.__u&=-7);return r.__e=E,l}function nm(e,t,r,n,i){var o,a,s,l,c,h=r.length,d=h,m=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(l=o+m,(a=e.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?mi(null,a,null,null,null):Jr(a)?mi(Dt,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?mi(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,(c=a.__i=im(a,r,l,d))!==-1&&(d--,(s=r[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&(i>h?m--:i<h&&m++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?m--:c==l+1?m++:(c>l?m--:m++,a.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<h;o++)(s=r[o])!=null&&!(2&s.__u)&&(s.__e==n&&(n=lr(s)),Yc(s,s));return n}function $c(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=$c(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=lr(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Hr(e,t){return t=t||[],e==null||typeof e=="boolean"||(Jr(e)?e.some(function(r){Hr(r,t)}):t.push(e)),t}function im(e,t,r,n){var i,o,a=e.key,s=e.type,l=t[r];if(l===null&&e.key==null||l&&a==l.key&&s===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(i=r-1,o=r+1;i>=0||o<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&a==l.key&&s===l.type)return i;i--}if(o<t.length){if((l=t[o])&&!(2&l.__u)&&a==l.key&&s===l.type)return o;o++}}return-1}function Mc(e,t,r){t[0]=="-"?e.setProperty(t,r==null?"":r):e[t]=r==null?"":typeof r!="number"||rm.test(t)?r:r+"px"}function pi(e,t,r,n,i){var o;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Mc(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Mc(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Hc,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.t=n.t:(r.t=ka,e.addEventListener(t,o?Oa:Ra,o)):e.removeEventListener(t,o?Oa:Ra,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r==null?"":r;break e}catch(a){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Gc(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=ka++;else if(t.u<r.t)return;return r(q.event?q.event(t):t)}}}function Da(e,t,r,n,i,o,a,s,l,c){var h,d,m,p,b,E,I,w,R,O,P,B,S,D,J,H,L,G=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[s=t.__e=r.__e]),(h=q.__b)&&h(t);e:if(typeof G=="function")try{if(w=t.props,R="prototype"in G&&G.prototype.render,O=(h=G.contextType)&&n[h.__c],P=h?O?O.props.value:h.__:n,r.__c?I=(d=t.__c=r.__c).__=d.__E:(R?t.__c=d=new G(w,P):(t.__c=d=new Ve(w,P),d.constructor=G,d.render=am),O&&O.sub(d),d.props=w,d.state||(d.state={}),d.context=P,d.__n=n,m=d.__d=!0,d.__h=[],d._sb=[]),R&&d.__s==null&&(d.__s=d.state),R&&G.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=yt({},d.__s)),yt(d.__s,G.getDerivedStateFromProps(w,d.__s))),p=d.props,b=d.state,d.__v=t,m)R&&G.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),R&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(R&&G.getDerivedStateFromProps==null&&w!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,P),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,P)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(d.props=w,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(F){F&&(F.__=t)}),B=0;B<d._sb.length;B++)d.__h.push(d._sb[B]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(w,d.__s,P),R&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,b,E)})}if(d.context=P,d.props=w,d.__P=e,d.__e=!1,S=q.__r,D=0,R){for(d.state=d.__s,d.__d=!1,S&&S(t),h=d.render(d.props,d.state,d.context),J=0;J<d._sb.length;J++)d.__h.push(d._sb[J]);d._sb=[]}else do d.__d=!1,S&&S(t),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++D<25);d.state=d.__s,d.getChildContext!=null&&(n=yt(yt({},n),d.getChildContext())),R&&!m&&d.getSnapshotBeforeUpdate!=null&&(E=d.getSnapshotBeforeUpdate(p,b)),H=h,h!=null&&h.type===Dt&&h.key==null&&(H=zc(h.props.children)),s=Kc(e,Jr(H)?H:[H],t,r,n,i,o,a,s,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),I&&(d.__E=d.__=null)}catch(F){if(t.__v=null,l||o!=null)if(F.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else for(L=o.length;L--;)xa(o[L]);else t.__e=r.__e,t.__k=r.__k;q.__e(F,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):s=t.__e=om(r.__e,t,r,n,i,o,a,l,c);return(h=q.diffed)&&h(t),128&t.__u?void 0:s}function Wc(e,t,r){for(var n=0;n<r.length;n++)Na(r[n],r[++n],r[++n]);q.__c&&q.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){q.__e(o,i.__v)}})}function zc(e){return typeof e!="object"||e==null?e:Jr(e)?e.map(zc):yt({},e)}function om(e,t,r,n,i,o,a,s,l){var c,h,d,m,p,b,E,I=r.props,w=t.props,R=t.type;if(R=="svg"?i="http://www.w3.org/2000/svg":R=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((p=o[c])&&"setAttribute"in p==!!R&&(R?p.localName==R:p.nodeType==3)){e=p,o[c]=null;break}}if(e==null){if(R==null)return document.createTextNode(w);e=document.createElementNS(i,R,w.is&&w),s&&(q.__m&&q.__m(t,o),s=!1),o=null}if(R===null)I===w||s&&e.data===w||(e.data=w);else{if(o=o&&gi.call(e.childNodes),I=r.props||Gr,!s&&o!=null)for(I={},c=0;c<e.attributes.length;c++)I[(p=e.attributes[c]).name]=p.value;for(c in I)if(p=I[c],c!="children"){if(c=="dangerouslySetInnerHTML")d=p;else if(!(c in w)){if(c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w)continue;pi(e,c,null,p,i)}}for(c in w)p=w[c],c=="children"?m=p:c=="dangerouslySetInnerHTML"?h=p:c=="value"?b=p:c=="checked"?E=p:s&&typeof p!="function"||I[c]===p||pi(e,c,p,I[c],i);if(h)s||d&&(h.__html===d.__html||h.__html===e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(d&&(e.innerHTML=""),Kc(t.type==="template"?e.content:e,Jr(m)?m:[m],t,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:r.__k&&lr(r,0),s,l),o!=null)for(c=o.length;c--;)xa(o[c]);s||(c="value",R=="progress"&&b==null?e.removeAttribute("value"):b!==void 0&&(b!==e[c]||R=="progress"&&!b||R=="option"&&b!==I[c])&&pi(e,c,b,I[c],i),c="checked",E!==void 0&&E!==e[c]&&pi(e,c,E,I[c],i))}return e}function Na(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){q.__e(i,r)}}function Yc(e,t,r){var n,i;if(q.unmount&&q.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Na(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){q.__e(o,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Yc(n[i],t,r||typeof e.type!="function");r||xa(e.__e),e.__c=e.__=e.__e=void 0}function am(e,t,r){return this.constructor(e,r)}function Xc(e,t,r){var n,i,o,a;t==document&&(t=document.documentElement),q.__&&q.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,o=[],a=[],Da(t,e=(!n&&r||t).__k=Fr(Dt,null,[e]),i||Gr,Gr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?gi.call(t.childNodes):null,o,!n&&r?r:i?i.__e:t.firstChild,n,a),Wc(o,e,a)}gi=qc.slice,q={__e:function(e,t,r,n){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},Jc=0,Ta=function(e){return e!=null&&e.constructor==null},Ve.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=yt({},this.state),typeof e=="function"&&(e=e(yt({},r),this.props)),e&&yt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Bc(this))},Ve.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Bc(this))},Ve.prototype.render=Dt,zt=[],Fc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jc=function(e,t){return e.__v.__b-t.__v.__b},vi.__r=0,Hc=/(PointerCapture)$|Capture$/i,ka=0,Ra=Gc(!1),Oa=Gc(!0),tm=0;var cr,ue,Pa,Qc,qr=0,ad=[],pe=q,Zc=pe.__b,ed=pe.__r,td=pe.diffed,rd=pe.__c,nd=pe.unmount,id=pe.__;function yi(e,t){pe.__h&&pe.__h(ue,e,qr||t),qr=0;var r=ue.__H||(ue.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function bt(e){return qr=1,sd(ld,e)}function sd(e,t,r){var n=yi(cr++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):ld(void 0,t),function(s){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,s);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=ue,!ue.__f)){var i=function(s,l,c){if(!n.__c.__H)return!0;var h=n.__c.__H.__.filter(function(m){return!!m.__c});if(h.every(function(m){return!m.__N}))return!o||o.call(this,s,l,c);var d=n.__c.props!==s;return h.forEach(function(m){if(m.__N){var p=m.__[0];m.__=m.__N,m.__N=void 0,p!==m.__[0]&&(d=!0)}}),o&&o.call(this,s,l,c)||d};ue.__f=!0;var o=ue.shouldComponentUpdate,a=ue.componentWillUpdate;ue.componentWillUpdate=function(s,l,c){if(this.__e){var h=o;o=void 0,i(s,l,c),o=h}a&&a.call(this,s,l,c)},ue.shouldComponentUpdate=i}return n.__N||n.__}function Nt(e,t){var r=yi(cr++,3);!pe.__s&&Ba(r.__H,t)&&(r.__=e,r.u=t,ue.__H.__h.push(r))}function Ua(e,t){var r=yi(cr++,4);!pe.__s&&Ba(r.__H,t)&&(r.__=e,r.u=t,ue.__h.push(r))}function bi(e){return qr=5,Vr(function(){return{current:e}},[])}function Vr(e,t){var r=yi(cr++,7);return Ba(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Kr(e,t){return qr=8,Vr(function(){return e},t)}function sm(){for(var e;e=ad.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(_i),e.__H.__h.forEach(La),e.__H.__h=[]}catch(t){e.__H.__h=[],pe.__e(t,e.__v)}}pe.__b=function(e){ue=null,Zc&&Zc(e)},pe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),id&&id(e,t)},pe.__r=function(e){ed&&ed(e),cr=0;var t=(ue=e.__c).__H;t&&(Pa===ue?(t.__h=[],ue.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(_i),t.__h.forEach(La),t.__h=[],cr=0)),Pa=ue},pe.diffed=function(e){td&&td(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ad.push(t)!==1&&Qc===pe.requestAnimationFrame||((Qc=pe.requestAnimationFrame)||lm)(sm)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Pa=ue=null},pe.__c=function(e,t){t.some(function(r){try{r.__h.forEach(_i),r.__h=r.__h.filter(function(n){return!n.__||La(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],pe.__e(n,r.__v)}}),rd&&rd(e,t)},pe.unmount=function(e){nd&&nd(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{_i(n)}catch(i){t=i}}),r.__H=void 0,t&&pe.__e(t,r.__v))};var od=typeof requestAnimationFrame=="function";function lm(e){var t,r=function(){clearTimeout(n),od&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);od&&(t=requestAnimationFrame(r))}function _i(e){var t=ue,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),ue=t}function La(e){var t=ue;e.__c=e.__(),ue=t}function Ba(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function ld(e,t){return typeof t=="function"?t(e):t}function dm(e,t){for(var r in t)e[r]=t[r];return e}function cd(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function dd(e,t){this.props=e,this.context=t}(dd.prototype=new Ve).isPureReactComponent=!0,dd.prototype.shouldComponentUpdate=function(e,t){return cd(this.props,e)||cd(this.state,t)};var ud=q.__b;q.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ud&&ud(e)};var sC=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var um=q.__e;q.__e=function(e,t,r,n){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t)}um(e,t,r,n)};var fd=q.unmount;function _d(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=dm({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return _d(n,t,r)})),e}function yd(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return yd(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Ma(){this.__u=0,this.o=null,this.__b=null}function bd(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function wi(){this.i=null,this.l=null}q.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),fd&&fd(e)},(Ma.prototype=new Ve).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=bd(n.__v),o=!1,a=function(){o||(o=!0,r.__R=null,i?i(s):s())};r.__R=a;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=yd(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(a,a)},Ma.prototype.componentWillUnmount=function(){this.o=[]},Ma.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=_d(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&Fr(Dt,null,e.fallback);return i&&(i.__u&=-33),[Fr(Dt,null,t.__a?null:e.children),i]};var hd=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(wi.prototype=new Ve).__a=function(e){var t=this,r=bd(t.__v),n=t.l.get(e);return n[0]++,function(i){var o=function(){t.props.revealOrder?(n.push(i),hd(t,e,n)):i()};r?r(o):o()}},wi.prototype.render=function(e){this.i=null,this.l=new Map;var t=Hr(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},wi.prototype.componentDidUpdate=wi.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){hd(e,r,t)})};var fm=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,hm=/^(?: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]/,pm=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,mm=/[A-Z0-9]/g,vm=typeof document!="undefined",gm=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function at(e,t,r){return t.__k==null&&(t.textContent=""),Xc(e,t),typeof r=="function"&&r(),e?e.__c:null}Ve.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ve.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var pd=q.event;function _m(){}function ym(){return this.cancelBubble}function bm(){return this.defaultPrevented}q.event=function(e){return pd&&(e=pd(e)),e.persist=_m,e.isPropagationStopped=ym,e.isDefaultPrevented=bm,e.nativeEvent=e};var wd,wm={enumerable:!1,configurable:!0,get:function(){return this.class}},md=q.vnode;q.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={},o=n.indexOf("-")===-1;for(var a in r){var s=r[a];if(!(a==="value"&&"defaultValue"in r&&s==null||vm&&a==="children"&&n==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in r&&r.value==null?a="value":a==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||gm(r.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":pm.test(a)&&(a=l):l=a="oninput":o&&hm.test(a)?a=a.replace(mm,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&i[a=l]&&(a="oninputCapture"),i[a]=s}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=Hr(r.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=Hr(r.children).forEach(function(c){c.props.selected=i.multiple?i.defaultValue.indexOf(c.props.value)!=-1:i.defaultValue==c.props.value})),r.class&&!r.className?(i.class=r.class,Object.defineProperty(i,"className",wm)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=fm,md&&md(e)};var vd=q.__r;q.__r=function(e){vd&&vd(e),wd=e.__c};var gd=q.diffed;q.diffed=function(e){gd&&gd(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),wd=null};var Am=Object.defineProperty,Em=Object.defineProperties,Im=Object.getOwnPropertyDescriptors,Ii=Object.getOwnPropertySymbols,kd=Object.prototype.hasOwnProperty,xd=Object.prototype.propertyIsEnumerable,Ad=(e,t,r)=>t in e?Am(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wt=(e,t)=>{for(var r in t||(t={}))kd.call(t,r)&&Ad(e,r,t[r]);if(Ii)for(var r of Ii(t))xd.call(t,r)&&Ad(e,r,t[r]);return e},Sm=(e,t)=>Em(e,Im(t)),Cm=(e,t)=>{var r={};for(var n in e)kd.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ii)for(var n of Ii(e))t.indexOf(n)<0&&xd.call(e,n)&&(r[n]=e[n]);return r},Si=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function Rm(e){return!!(e!=null&&e.__nativeBuffers__)}var Om=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=t.charCodeAt(i);return n.buffer};function Va(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!Rm(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let i;n.value?i=n.value:n.base64&&(i=Om(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var Tm=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return btoa(t)};function km(e={},t=!1){let r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:Tm(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var Dd=Object.defineProperty,xm=Object.getOwnPropertyDescriptor,Dm=(e,t)=>{for(var r in t)Dd(e,r,{get:t[r],enumerable:!0})},Nd=(e,t,r,n)=>{for(var i=n>1?void 0:n?xm(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&Dd(t,r,i),i},Nm=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}function Pm(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var Lm=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};function Pd(e){return typeof e=="string"}function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Ed(e){return typeof e=="number"&&!isNaN(e)}function Um(e){return typeof e=="undefined"}function Bm(e){return Um(e)||e===null}function Ld(e){return typeof e=="function"}function Mm(e){return ur(e)&&Ld(e.then)}function Ud(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}var Gm=(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))(Gm||{}),Jm=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}},Ci=class extends Jm{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Fm=class extends Ci{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},jm=class extends Ci{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Hm=class extends Ci{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Ga=class extends Ci{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function $r(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var Ri={log:$r("log"),warn:$r("warn"),info:$r("info"),error:$r("error"),debug:$r("debug")};Object.assign(globalThis,{logger:Ri});var Id=Symbol.for("Jolibox.canIUseMap"),qm={};globalThis[Id]||(globalThis[Id]=qm);function Vm(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}var Ka=Symbol.for("Jolibox.canIUseMap.native"),Km={};globalThis[Ka]||(globalThis[Ka]=Km);var $a={get config(){return globalThis[Ka]}},$m=(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))($m||{}),Wm=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Wm||{}),zm=(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))(zm||{});function Ym(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}Ym();var dr=typeof window=="undefined",Xm=()=>!dr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),uC={isiOS:!dr&&(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:!dr&&navigator.userAgent.includes("Android"),isMac:!dr&&navigator.userAgent.includes("Mac"),isFacebook:!dr&&navigator.userAgent.includes("FB_IAB"),isPC:!dr&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Wa=class za{constructor(t){this.element=t,this.next=za.Undefined,this.prev=za.Undefined}};Wa.Undefined=new Wa(void 0);var ce=Wa,Qm=class{constructor(){this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ce.Undefined}clear(){let e=this._first;for(;e!==ce.Undefined;){let t=e.next;e.prev=ce.Undefined,e.next=ce.Undefined,e=t}this._first=ce.Undefined,this._last=ce.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ce(e);if(this._first===ce.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ce.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ce.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ce.Undefined&&e.next!==ce.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ce.Undefined&&e.next===ce.Undefined?(this._first=ce.Undefined,this._last=ce.Undefined):e.next===ce.Undefined?(this._last=this._last.prev,this._last.next=ce.Undefined):e.prev===ce.Undefined&&(this._first=this._first.next,this._first.prev=ce.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ce.Undefined;)yield e.element,e=e.next}},Zm=0,Wr=class{constructor(e){this.value=e,this.id=Zm++}},Yr=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Wr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Wr(t);return this._listeners?this._listeners instanceof Wr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var h,d,m,p;if(!this._disposed){if(this._listeners instanceof Wr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((p=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||p.call(m)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Wr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Ya=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new Yr,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new Qm,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},Xa={};Dm(Xa,{None:()=>ev,filter:()=>rv,once:()=>Bd,toPromise:()=>tv});var ev=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function tv(e){return new Promise(t=>Bd(e)(t))}function Bd(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function rv(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Yr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}var Ja=Symbol.for("Jolibox.hostEmitter"),nv=()=>{let e=new Ya;return globalThis[Ja]||(globalThis[Ja]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Ja]},fC=nv();function iv(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ov(e[n],t[n])}function ov(e,t){if(Pd(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Ld(t)){try{if(e instanceof t)return}catch(r){}if(!Bm(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 Qa=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Yr,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return iv(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};Qa=Nd([Ud],Qa);var Sd=class{constructor(){this._onWillExecuteCommand=new Yr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Yr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Qa,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Pm(3e4)),this._starActivation}executeCommand(e,...t){return Nm(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Xa.toPromise(Xa.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};Sd=Nd([Ud],Sd);var hC=Symbol.for("Jolibox.commands");Oe("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Oe("requestProductDetailsAsync",{version:102e4});Oe("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Oe("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Oe("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Oe("userTrackAsync",{version:1e6});Oe("openMiniapp",{version:1050100});Oe("requestCoinDetailsSync",{version:1070100});Oe("requestCoinDetailsAsync",{version:1070100});Oe("sendServerEventAsync",{version:1070100});Oe("requestGameLeaderboardSync",{version:108e4});Oe("requestGameLeaderboardAsync",{version:108e4});Oe("notifyTaskGameInfoAsync",{version:1080100});Oe("loadAdsAsync",{version:1070200});Oe("showAdAsync",{version:1070200});Oe("onJoliboxHideLoading",{version:1070300});function Oe(e,t){if($a.config[e]){Ri.warn(`[can i use] ${e} already registered`);return}$a.config[e]=wt({},t)}var Md=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=$a.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",h=l.version;if(l.platforms&&c in l.platforms){let m=l.platforms[c];if(m===!1)return!1;typeof m=="number"&&(h=m)}if(typeof h!="number")return!1;let d=e();return typeof d!="number"||d<h?!1:s.length===0?!0:n(l,s,d)||n(l.properties,s,d)}function n(i,o,a){if(!i)return!1;let s=Vm(i,o);if(!s)return!1;if(ur(s)){let l=s.version;return Ed(l)?typeof a=="number"&&a>=l:!0}return Ed(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};function Cd(e,t){return`[${e}]:${t}`}var av=()=>Xm(),zr="custom_event_",sv=[],lv=[],cv=["env","createRequestTask","login"],Gd="__batch_event__",dv="__native_batch_event__",uv=e=>e==="pv"?e:"default",Ei=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=uv(a)}report(e){this.type==="pv"?this.addPVPoint(e):this.addPoint(e),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(e){if(Object.keys(this.cache).length){if(e){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(e){let t=(r,n,i,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&ur(a))throw new Ga(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(ur(a))l.push(...Object.keys(a));else if(Pd(a)){if(i.length>0)throw new Ga(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Ga(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let h=ur(a)?a[c]:a;t(n[c],[...i],o,h)})}else n[o]?n[o]++:n[o]=1},r={point:e,metricName:this.metricName,tagNameOrder:this.tagNameOrder};t(this.cache,[...this.tagNameOrder],this.metricName,e)}processPoints(e){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:e}}clearPoints(){this.cache={}}},Rd=!1,Fa,ja,Ha;function fv(e,t){Rd||(Fa=new Ei({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),ja=new Ei({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ha=new Ei({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Fa.flush(),ja.flush(),Ha.flush()}),Rd=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:h,errMsg:d=`${s}:fail no errMsg`,errNo:m=0,__timing:p={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:b,invokeCallback:E}=p,I=(a=(o=d.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Fa.report({status:I,method:n(s,l),errNo:`${m}`,errMsg:d,isForeground:h,duration:Date.now()-c}),c&&b&&E&&(ja.report({status:I,method:s,isForeground:h,duration:Number((b-c).toFixed(3))}),Ha.report({status:I,method:s,isForeground:h,duration:Number((Date.now()-E).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}var qa=[],hv=!1,Za=Symbol.for("Jolibox.invokeResolverInstance"),pv=new Map;globalThis[Za]||(globalThis[Za]=pv);var mv={get resolveMap(){return globalThis[Za]}};function vv(e,t){let r=0,n=!0,i=mv.resolveMap,o=fv(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,qa.forEach(l=>Si(this,[l],function*({method:c,args:h,resolve:d}){let m=yield s(c,h);d(m)})),qa.length=0});let a=(l,c)=>{let h=i.get(Number(l));if(!h)return;let d=Va(c);h(d),i.delete(Number(l))},s=(l,c)=>{var h,d;let m=Date.now(),p=`${n}`;r+=1;let b=new Lm;if(i.set(r,b.resolve),!n&&lv.includes(l))return new Promise(P=>{qa.push({method:l,args:c,resolve:P})});let E=Sm(wt({},{method:l,startTime:m,args:c,isForeground:p}),{invokeType:"js-bridge"}),I=!hv&&sv.includes(l),w=km(c,I),R=I?w:JSON.stringify(w),O;if(l.endsWith("Sync")||cv.includes(l)?O=(h=e.call)==null?void 0:h.call(e,l,w,r):typeof R=="string"?O=e.invoke(l,R,r):O=(d=e.call)==null?void 0:d.call(e,l,R,r),O){try{typeof O=="string"&&(O=JSON.parse(O)),O=Va(O)}catch(P){Ri.error(P)}return i.delete(r),O.errorCode&&(O.errorCode=Cd(l,O.errorCode)),o(wt(wt({},E),O)),O}return l.endsWith("Sync")&&i.delete(r),b.promise.then(P=>(P.errorCode&&(P.errorCode=Cd(l,P.errorCode)),o(wt(wt({},E),P)),P))};return{invokeNative:s,applyNative:(l,c)=>{let h=s(l,c);return Mm(h)?h.then(d=>Od(l,d)):Od(l,h)},invokeHandler:a}}function Od(e,t){if(!ur(t)){Ri.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=Cm(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new jm(n,i,o,a);return s}var Ai=Symbol.for("Jolibox.subscribeInstance");function gv(e){if(globalThis[Ai])return globalThis[Ai];let t=new Ya,r=new Ya,n=new Ei({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[Ai]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=Va(o),l;if(s.__extra){l=s.params;let{type:c,startTime:h}=s.__extra;n.report({type:c,event:i,duration:Date.now()-h})}else l=s;if(i===Gd){l.forEach(c=>{let[h,d]=c;try{r.emit(h.slice(zr.length),d,a)}catch(m){}});return}if(i.startsWith(zr)){r.emit(i.slice(zr.length),l,a);return}t.emit(i,l,a)}},globalThis[Ai]}function _v(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let h=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${zr}${o}`,a,h);return}n||(n=Promise.resolve().then(()=>{t.forEach((h,d)=>{try{let m=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(Gd,h,m)}catch(m){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${zr}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let h=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,h),console.log("emitNative",o,a,h);return}i||(i=Promise.resolve().then(()=>{r.forEach((h,d)=>{try{let m=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(dv,h,m)}catch(m){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function yv(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=gv(e),{invokeNative:a,invokeHandler:s,applyNative:l}=vv(e,r),{publish:c,emitNative:h}=_v(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:h,publish:c,subscribe:i,unsubscribe:o}}function Jd(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var es,Pt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Pt.trigger=e},onDoExit(e){Pt.exit=e},onDoBackPress(e){Pt.backPress=e}},Fd=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Fm("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{Pt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Si(void 0,null,function*(){let o=yield Pt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});es={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=Jd(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:Fd,doExit:r};globalThis.joliboxJSCore=wt({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Pt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Si(void 0,null,function*(){let a=yield Pt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});es={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=Jd(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Si(this,null,function*(){let a=yield Pt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:Fd,doExit:n};globalThis.joliboxJSCore=wt({},i)}var jd=es;if(!jd&&av())throw new Hm("No joliboxJScore is found, native bridge not found.");var bv=wt({},jd),Hd=yv(bv),{invokeHandler:Td}=Hd,{applyNative:pC,invokeNative:Oi,onNative:qd,offNative:Vd,subscribeHandler:wv,publish:mC,emitNative:vC,subscribe:gC,unsubscribe:_C}=Hd;globalThis.joliboxJSBridge={callHandler:Td,invokeHandler:Td,subscribeHandler:wv};var Av=Object.defineProperty,Ev=Object.defineProperties,Iv=Object.getOwnPropertyDescriptors,Fi=Object.getOwnPropertySymbols,yu=Object.prototype.hasOwnProperty,bu=Object.prototype.propertyIsEnumerable,Kd=(e,t,r)=>t in e?Av(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wu=(e,t)=>{for(var r in t||(t={}))yu.call(t,r)&&Kd(e,r,t[r]);if(Fi)for(var r of Fi(t))bu.call(t,r)&&Kd(e,r,t[r]);return e},Sv=(e,t)=>Ev(e,Iv(t)),Cv=(e,t)=>{var r={};for(var n in e)yu.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Fi)for(var n of Fi(e))t.indexOf(n)<0&&bu.call(e,n)&&(r[n]=e[n]);return r},Au=Object.defineProperty,Rv=Object.defineProperties,Ov=Object.getOwnPropertyDescriptors,$d=Object.getOwnPropertySymbols,Tv=Object.prototype.hasOwnProperty,kv=Object.prototype.propertyIsEnumerable,Wd=(e,t,r)=>t in e?Au(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xv=(e,t)=>{for(var r in t||(t={}))Tv.call(t,r)&&Wd(e,r,t[r]);if($d)for(var r of $d(t))kv.call(t,r)&&Wd(e,r,t[r]);return e},Dv=(e,t)=>Rv(e,Ov(t)),Nv=(e,t)=>{for(var r in t)Au(e,r,{get:t[r],enumerable:!0})},Eu=(e,t,r,n)=>{for(var i=t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},Pv=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}function Lv(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Uv(e){return typeof e=="string"}function Bv(e){return typeof e=="undefined"}function Mv(e){return Bv(e)||e===null}function Gv(e){return typeof e=="function"}function Iu(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}var Jv=(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))(Jv||{});function Xr(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var Fv={log:Xr("log"),warn:Xr("warn"),info:Xr("info"),error:Xr("error"),debug:Xr("debug")};Object.assign(globalThis,{logger:Fv});var zd=Symbol.for("Jolibox.canIUseMap"),jv={};globalThis[zd]||(globalThis[zd]=jv);var Yd=Symbol.for("Jolibox.canIUseMap.native"),Hv={};globalThis[Yd]||(globalThis[Yd]=Hv);var Su=(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))(Su||{}),Cu=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Cu||{}),Ru=(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))(Ru||{}),Xd=["name","params"],qv=["name","type","location","target","extra","timestamp","userId"],Vv=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function Ni(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function Kv(e){let t=e.location?Ni(e.location,Xd):null,r=e.target?Ni(e.target,Xd):null;return Ni(Dv(xv({},e),{location:t,target:r}),qv)}function $v(e){let t=e.events.map(n=>Kv(n)),r=Ni(e.device,Vv);return[e.protocolVersion,t,r,e.project]}function Wv(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}Wv();var mr=typeof window=="undefined",ji=()=>!mr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!mr&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!mr&&navigator.userAgent.includes("Android"),!mr&&navigator.userAgent.includes("Mac"),!mr&&navigator.userAgent.includes("FB_IAB"),!mr&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var cs=class ds{constructor(t){this.element=t,this.next=ds.Undefined,this.prev=ds.Undefined}};cs.Undefined=new cs(void 0);var de=cs,zv=class{constructor(){this._first=de.Undefined,this._last=de.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===de.Undefined}clear(){let e=this._first;for(;e!==de.Undefined;){let t=e.next;e.prev=de.Undefined,e.next=de.Undefined,e=t}this._first=de.Undefined,this._last=de.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new de(e);if(this._first===de.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==de.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==de.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==de.Undefined&&e.next!==de.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===de.Undefined&&e.next===de.Undefined?(this._first=de.Undefined,this._last=de.Undefined):e.next===de.Undefined?(this._last=this._last.prev,this._last.next=de.Undefined):e.prev===de.Undefined&&(this._first=this._first.next,this._first.prev=de.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==de.Undefined;)yield e.element,e=e.next}},Yv=0,Qr=class{constructor(e){this.value=e,this.id=Yv++}},nn=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Qr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new Qr(e);return this._listeners?this._listeners instanceof Qr?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,h,d,m;if(!this._disposed){if(this._listeners instanceof Qr)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(h=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||h.call(c));else if(this._listeners){let p=this._listeners.indexOf(l);p>=0&&(this._listeners.splice(p,1),this._size--,this._size===0&&((m=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||m.call(d)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Qr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Xv=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var n;let i=(n=this.listeners.get(e))!=null?n:new nn,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new zv,this.cachedEventQueue.set(e,r)),r.push({args:i}),t&&t.fire({event:e,args:i})}once(e,t){var r=this;let n=function(){t(...arguments),r.off(e,n)};this.on(e,n,!1)}},us={};Nv(us,{None:()=>Qv,filter:()=>eg,once:()=>Ou,toPromise:()=>Zv});var Qv=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function Zv(e){return new Promise(t=>Ou(e)(t))}function Ou(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function eg(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new nn(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}var ts=Symbol.for("Jolibox.hostEmitter"),tg=()=>{let e=new Xv;return globalThis[ts]||(globalThis[ts]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[ts]};tg();function rg(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ng(e[n],t[n])}function ng(e,t){if(Uv(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gv(t)){try{if(e instanceof t)return}catch(r){}if(!Mv(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 fs=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new nn,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return rg(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};fs=Eu([Iu],fs);var Qd=class{constructor(){this._onWillExecuteCommand=new nn,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new nn,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new fs,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Lv(3e4)),this._starActivation}executeCommand(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Pv(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),us.toPromise(us.filter(this.registry.onDidRegisterCommand,i=>i===e))])]),this._tryExecuteCommand(e,r))})}executeCommandThowErr(e){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let t=this.registry.getCommand(e);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._onWillExecuteCommand.fire({commandId:e,args:n});let o=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),o}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e(...r)}finally{}}};Qd=Eu([Iu],Qd);function Fe(e,t,r){return(t=ig(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ig(e){var t=og(e,"string");return typeof t=="symbol"?t:t+""}function og(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fr=e=>e?function(){try{for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e==null||e(...r)}catch(i){console.error("Error calling function",i)}}:()=>{console.log("wrapUserFunction: fn is undefined")},hs=class{constructor(t){Fe(this,"context",void 0),Fe(this,"continueCallback",void 0),Fe(this,"adIsShowingCallback",void 0),Fe(this,"isBeforeAdCalled",!1),Fe(this,"isBeforeRewardCalled",!1),Fe(this,"isAdDismissedCalled",!1),Fe(this,"isAdViewedCalled",!1),Fe(this,"isAfterAdCalled",!1),Fe(this,"currentProvider",void 0),Fe(this,"currentClientParams",void 0),Fe(this,"adsHasResponse",!1),Fe(this,"videoChecker",window.document.createElement("video")),Fe(this,"contextInfo",void 0),Fe(this,"wrapShowAdFn",r=>()=>{var n,i,o;this.adsHasResponse=!0;let a=!1;this.videoChecker.play().catch(()=>{a=!1}),a=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:a},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",wu({userEvent:a},this.paramsToTrack)),ji()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"rewarded",module:"game",game_id:this.contextInfo.objectId}),(o=this.adIsShowingCallback)==null||o.call(this,!0);let s=fr(r);s==null||s()}),this.context=t,this.contextInfo=t.getContextInfo()}notifyIframeAdsEvent(t,r){let n=window.parent;n&&n!==window&&typeof n.postMessage=="function"&&n.postMessage({type:t,data:r},"*"),window.dispatchEvent(new CustomEvent(t,{detail:r}))}get paramsToTrack(){var t,r,n,i,o,a;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null,type:(n=this.currentClientParams)==null?void 0:n.type,name:((i=this.currentClientParams)==null?void 0:i.type)==="preroll"?null:(a=(o=this.currentClientParams)==null?void 0:o.name)!=null?a:""}}wrapBeforeAd(t){return()=>{var r,n,i,o;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 a=fr(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),ji()&&this.context.track("mmp_ad_impression",{ad_network:(o=(i=this.currentProvider)==null?void 0:i.name)!=null?o:"",ad_format:"interstitial",module:"game",game_id:this.contextInfo.objectId}))}}}wrapBeforeReward(t){return r=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(r)():(this.isBeforeRewardCalled=!0,t==null||t(this.wrapShowAdFn(r)))}}wrapAdDismissed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdDismissedCalled){this.isAdDismissedCalled=!0;let r=fr(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=fr(t);r==null||r()}}}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 r=fr(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l,c,h,d;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(o=r.breakName)!=null?o:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(a=this.currentProvider)==null?void 0:a.name)!=null?s:null,breakType:r.breakType,breakName:(l=r.breakName)!=null?l:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let m=fr(t);m==null||m(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(h=this.continueCallback)==null||h.call(this,[!1,r]);break}default:{(d=this.continueCallback)==null||d.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return A(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,h,d,m,p;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(h=(c=this.currentProvider)==null?void 0:c.name)!=null?h:null}),(m=this.continueCallback)==null||m.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(d=r.name)!=null?d:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(p=this.adIsShowingCallback)==null||p.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),t.adBreak(a,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};function Ti(e,t,r){return(t=ag(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ag(e){var t=sg(e,"string");return typeof t=="symbol"?t:t+""}function sg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ps=class{constructor(t){Ti(this,"context",void 0),Ti(this,"adBreakIsShowing",!1),Ti(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Ti(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=t,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};function ki(e,t,r){return(t=lg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lg(e){var t=cg(e,"string");return typeof t=="symbol"?t:t+""}function cg(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ms=class{constructor(t){ki(this,"configs",null),ki(this,"firstRun",!0),ki(this,"context",void 0),ki(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return A(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(t){}})}shouldBypassCallingInterstitial(){var t,r;let n;if(!this.configs)this.init(),n=!this.firstRun;else{let i=(t=this.contextInfo.channel)!=null?t:"",o=this.configs[i],a=(r=o==null?void 0:o.interstitialRate)!=null?r:1;n=Math.random()<a}return this.firstRun=!1,n}};function At(e,t,r){return(t=dg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dg(e){var t=ug(e,"string");return typeof t=="symbol"?t:t+""}function ug(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vs=class{constructor(t,r){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 n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),At(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=Cv(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),At(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),At(this,"adUnit",n=>A(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:h,fullWidthResponsive:d,style:m}=n,p;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?p=document.querySelector(l):p=l,!p)throw new Error("targeting element not found");let b=c;if(b||(b=this.initParams.unitId),!b)throw new Error("slot is required");let E=typeof h=="object"&&Array.isArray(h)?h.join(", "):h,I=document.createElement("ins");if(I.className="adsbygoogle",I.id="jolibox-ads",I.style.display="block",I.setAttribute("data-ad-client",this.initParams.clientId),I.setAttribute("data-ad-slot",b),E&&I.setAttribute("data-ad-format",E),d&&I.setAttribute("data-full-width-responsive",d),m&&I.setAttribute("style",m),(s=this.contextInfo.testAdsMode)!=null?s:!1){let w=document.createElement("div");w.style.position="absolute",w.style.top="0",w.style.left="0",w.style.width="100%",w.style.height="100%",w.style.display="flex",w.style.justifyContent="center",w.style.alignItems="center",w.style.backgroundColor="rgba(0, 0, 0, 0.5)",w.style.color="white",w.innerHTML="Test Ad",I.style.position="relative",p.appendChild(I),I.appendChild(w)}else p.appendChild(I),new MutationObserver(w=>{w.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let O=I.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:O!=null?O:"null"})}})}).observe(I,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,window.adsbygoogle=window.adsbygoogle||[]}init(){return A(this,null,function*(){var t;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let r="google-adsense",n=(t=this.contextInfo.testAdsMode)!=null?t:!1;if(!document.getElementById(r)&&this.initParams.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&i.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&i.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),this.initParams.admobRewardedSlot&&i.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&i.setAttribute("data-admob-ads-only","on"),document.head.appendChild(i),this.context.track("LoadAdsenseCompleted",null)}})}};function fg(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 hg(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 pg=function(){function e(r){var n=this;this._insertTag=function(i){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,o),n.tags.push(i)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(hg(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=fg(n);try{i.insertRule(r,i.cssRules.length)}catch(o){}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e}(),ke="-ms-",Hi="-moz-",Z="-webkit-",Tu="comm",Fs="rule",js="decl",mg="@import",ku="@keyframes",vg="@layer",gg=Math.abs,Yi=String.fromCharCode,_g=Object.assign;function yg(e,t){return Ie(e,0)^45?(((t<<2^Ie(e,0))<<2^Ie(e,1))<<2^Ie(e,2))<<2^Ie(e,3):0}function xu(e){return e.trim()}function bg(e,t){return(e=t.exec(e))?e[0]:e}function ee(e,t,r){return e.replace(t,r)}function gs(e,t){return e.indexOf(t)}function Ie(e,t){return e.charCodeAt(t)|0}function on(e,t,r){return e.slice(t,r)}function ct(e){return e.length}function Hs(e){return e.length}function xi(e,t){return t.push(e),e}function wg(e,t){return e.map(t).join("")}var Xi=1,_r=1,Du=0,He=0,_e=0,yr="";function Qi(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Xi,column:_r,length:a,return:""}}function Zr(e,t){return _g(Qi("",null,null,"",null,null,0),e,{length:-e.length},t)}function Ag(){return _e}function Eg(){return _e=He>0?Ie(yr,--He):0,_r--,_e===10&&(_r=1,Xi--),_e}function $e(){return _e=He<Du?Ie(yr,He++):0,_r++,_e===10&&(_r=1,Xi++),_e}function dt(){return Ie(yr,He)}function Pi(){return He}function cn(e,t){return on(yr,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 Nu(e){return Xi=_r=1,Du=ct(yr=e),He=0,[]}function Pu(e){return yr="",e}function Li(e){return xu(cn(He-1,_s(e===91?e+2:e===40?e+1:e)))}function Ig(e){for(;(_e=dt())&&_e<33;)$e();return an(e)>2||an(_e)>3?"":" "}function Sg(e,t){for(;--t&&$e()&&!(_e<48||_e>102||_e>57&&_e<65||_e>70&&_e<97););return cn(e,Pi()+(t<6&&dt()==32&&$e()==32))}function _s(e){for(;$e();)switch(_e){case e:return He;case 34:case 39:e!==34&&e!==39&&_s(_e);break;case 40:e===41&&_s(e);break;case 92:$e();break}return He}function Cg(e,t){for(;$e()&&e+_e!==57&&!(e+_e===84&&dt()===47););return"/*"+cn(t,He-1)+"*"+Yi(e===47?e:$e())}function Rg(e){for(;!an(dt());)$e();return cn(e,He)}function Og(e){return Pu(Ui("",null,null,null,[""],e=Nu(e),0,[0],e))}function Ui(e,t,r,n,i,o,a,s,l){for(var c=0,h=0,d=a,m=0,p=0,b=0,E=1,I=1,w=1,R=0,O="",P=i,B=o,S=n,D=O;I;)switch(b=R,R=$e()){case 40:if(b!=108&&Ie(D,d-1)==58){gs(D+=ee(Li(R),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:D+=Li(R);break;case 9:case 10:case 13:case 32:D+=Ig(b);break;case 92:D+=Sg(Pi()-1,7);continue;case 47:switch(dt()){case 42:case 47:xi(Tg(Cg($e(),Pi()),t,r),l);break;default:D+="/"}break;case 123*E:s[c++]=ct(D)*w;case 125*E:case 59:case 0:switch(R){case 0:case 125:I=0;case 59+h:w==-1&&(D=ee(D,/\f/g,"")),p>0&&ct(D)-d&&xi(p>32?eu(D+";",n,r,d-1):eu(ee(D," ","")+";",n,r,d-2),l);break;case 59:D+=";";default:if(xi(S=Zd(D,t,r,c,h,i,s,O,P=[],B=[],d),o),R===123)if(h===0)Ui(D,t,S,S,P,o,d,s,B);else switch(m===99&&Ie(D,3)===110?100:m){case 100:case 108:case 109:case 115:Ui(e,S,S,n&&xi(Zd(e,S,S,0,0,i,s,O,i,P=[],d),B),i,B,d,s,n?P:B);break;default:Ui(D,S,S,S,[""],B,0,s,B)}}c=h=p=0,E=w=1,O=D="",d=a;break;case 58:d=1+ct(D),p=b;default:if(E<1){if(R==123)--E;else if(R==125&&E++==0&&Eg()==125)continue}switch(D+=Yi(R),R*E){case 38:w=h>0?1:(D+="\f",-1);break;case 44:s[c++]=(ct(D)-1)*w,w=1;break;case 64:dt()===45&&(D+=Li($e())),m=dt(),h=d=ct(O=D+=Rg(Pi())),R++;break;case 45:b===45&&ct(D)==2&&(E=0)}}return o}function Zd(e,t,r,n,i,o,a,s,l,c,h){for(var d=i-1,m=i===0?o:[""],p=Hs(m),b=0,E=0,I=0;b<n;++b)for(var w=0,R=on(e,d+1,d=gg(E=a[b])),O=e;w<p;++w)(O=xu(E>0?m[w]+" "+R:ee(R,/&\f/g,m[w])))&&(l[I++]=O);return Qi(e,t,r,i===0?Fs:s,l,c,h)}function Tg(e,t,r){return Qi(e,t,r,Tu,Yi(Ag()),on(e,2,-2),0)}function eu(e,t,r,n){return Qi(e,t,r,js,on(e,0,n),on(e,n+1,-1),n)}function gr(e,t){for(var r="",n=Hs(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function kg(e,t,r,n){switch(e.type){case vg:if(e.children.length)break;case mg:case js:return e.return=e.return||e.value;case Tu:return"";case ku:return e.return=e.value+"{"+gr(e.children,n)+"}";case Fs:e.value=e.props.join(",")}return ct(r=gr(e.children,n))?e.return=e.value+"{"+r+"}":""}function xg(e){var t=Hs(e);return function(r,n,i,o){for(var a="",s=0;s<t;s++)a+=e[s](r,n,i,o)||"";return a}}function Dg(e){return function(t){t.root||(t=t.return)&&e(t)}}function Ng(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Pg=function(e,t,r){for(var n=0,i=0;n=i,i=dt(),n===38&&i===12&&(t[r]=1),!an(i);)$e();return cn(e,He)},Lg=function(e,t){var r=-1,n=44;do switch(an(n)){case 0:n===38&&dt()===12&&(t[r]=1),e[r]+=Pg(He-1,t,r);break;case 2:e[r]+=Li(n);break;case 4:if(n===44){e[++r]=dt()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Yi(n)}while(n=$e());return e},Ug=function(e,t){return Pu(Lg(Nu(e),t))},tu=new WeakMap,Bg=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!tu.get(r))&&!n){tu.set(e,!0);for(var i=[],o=Ug(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},Mg=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function Lu(e,t){switch(yg(e,t)){case 5103:return Z+"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 Z+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Z+e+Hi+e+ke+e+e;case 6828:case 4268:return Z+e+ke+e+e;case 6165:return Z+e+ke+"flex-"+e+e;case 5187:return Z+e+ee(e,/(\w+).+(:[^]+)/,Z+"box-$1$2"+ke+"flex-$1$2")+e;case 5443:return Z+e+ke+"flex-item-"+ee(e,/flex-|-self/,"")+e;case 4675:return Z+e+ke+"flex-line-pack"+ee(e,/align-content|flex-|-self/,"")+e;case 5548:return Z+e+ke+ee(e,"shrink","negative")+e;case 5292:return Z+e+ke+ee(e,"basis","preferred-size")+e;case 6060:return Z+"box-"+ee(e,"-grow","")+Z+e+ke+ee(e,"grow","positive")+e;case 4554:return Z+ee(e,/([^-])(transform)/g,"$1"+Z+"$2")+e;case 6187:return ee(ee(ee(e,/(zoom-|grab)/,Z+"$1"),/(image-set)/,Z+"$1"),e,"")+e;case 5495:case 3959:return ee(e,/(image-set\([^]*)/,Z+"$1$`$1");case 4968:return ee(ee(e,/(.+:)(flex-)?(.*)/,Z+"box-pack:$3"+ke+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Z+e+e;case 4095:case 3583:case 4068:case 2532:return ee(e,/(.+)-inline(.+)/,Z+"$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(ct(e)-1-t>6)switch(Ie(e,t+1)){case 109:if(Ie(e,t+4)!==45)break;case 102:return ee(e,/(.+:)(.+)-([^]+)/,"$1"+Z+"$2-$3$1"+Hi+(Ie(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~gs(e,"stretch")?Lu(ee(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ie(e,t+1)!==115)break;case 6444:switch(Ie(e,ct(e)-3-(~gs(e,"!important")&&10))){case 107:return ee(e,":",":"+Z)+e;case 101:return ee(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Z+(Ie(e,14)===45?"inline-":"")+"box$3$1"+Z+"$2$3$1"+ke+"$2box$3")+e}break;case 5936:switch(Ie(e,t+11)){case 114:return Z+e+ke+ee(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Z+e+ke+ee(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Z+e+ke+ee(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Z+e+ke+e+e}return e}var Gg=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case js:e.return=Lu(e.value,e.length);break;case ku:return gr([Zr(e,{value:ee(e.value,"@","@"+Z)})],n);case Fs:if(e.length)return wg(e.props,function(i){switch(bg(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return gr([Zr(e,{props:[ee(i,/:(read-\w+)/,":"+Hi+"$1")]})],n);case"::placeholder":return gr([Zr(e,{props:[ee(i,/:(plac\w+)/,":"+Z+"input-$1")]}),Zr(e,{props:[ee(i,/:(plac\w+)/,":"+Hi+"$1")]}),Zr(e,{props:[ee(i,/:(plac\w+)/,ke+"input-$1")]})],n)}return""})}},Jg=[Gg],Fg=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(b){var E=b.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var n=e.stylisPlugins||Jg,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(b){for(var E=b.getAttribute("data-emotion").split(" "),I=1;I<E.length;I++)i[E[I]]=!0;a.push(b)});var s,l=[Bg,Mg];{var c,h=[kg,Dg(function(b){c.insert(b)})],d=xg(l.concat(n,h)),m=function(b){return gr(Og(b),d)};s=function(b,E,I,w){c=I,m(b?b+"{"+E.styles+"}":E.styles),w&&(p.inserted[E.name]=!0)}}var p={key:t,sheet:new pg({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:s};return p.sheet.hydrate(a),p};function jg(e){for(var t=0,r,n=0,i=e.length;i>=4;++n,i-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&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 Hg={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},qg=/[A-Z]|^ms/g,Vg=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Uu=function(e){return e.charCodeAt(1)===45},ru=function(e){return e!=null&&typeof e!="boolean"},rs=Ng(function(e){return Uu(e)?e:e.replace(qg,"-$&").toLowerCase()}),nu=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(Vg,function(r,n,i){return Ut={name:n,styles:i,next:Ut},n})}return Hg[e]!==1&&!Uu(e)&&typeof t=="number"&&t!==0?t+"px":t};function qi(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return Ut={name:i.name,styles:i.styles,next:Ut},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)Ut={name:a.name,styles:a.styles,next:Ut},a=a.next;var s=o.styles+";";return s}return Kg(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function Kg(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=qi(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":ru(s)&&(n+=rs(o)+":"+nu(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)ru(a[l])&&(n+=rs(o)+":"+nu(o,a[l])+";");else{var c=qi(e,t,a);switch(o){case"animation":case"animationName":{n+=rs(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}var iu=/label:\s*([^\s;{]+)\s*(;|$)/g,Ut;function ns(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,i="";Ut=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=qi(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=qi(r,t,e[s]),n){var l=o;i+=l[s]}iu.lastIndex=0;for(var c="",h;(h=iu.exec(i))!==null;)c+="-"+h[1];var d=jg(i)+c;return{name:d,styles:i,next:Ut}}function Bu(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}var $g=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},Wg=function(e,t,r){$g(e,t);var n=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var i=t;do e.insert(t===i?"."+n:"",i,e.sheet,!0),i=i.next;while(i!==void 0)}};function ou(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function au(e,t,r){var n=[],i=Bu(e,n,r);return n.length<2?r:i+t(n)}var zg=function(e){var t=Fg(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=ns(s,t.registered,void 0);return Wg(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=ns(s,t.registered),h="animation-"+c.name;return ou(t,{name:c.name,styles:"@keyframes "+h+"{"+c.styles+"}"}),h},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=ns(s,t.registered);ou(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return au(t.registered,r,Yg(s))};return{css:r,cx:o,injectGlobal:i,keyframes:n,hydrate:function(a){a.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:Bu.bind(null,t.registered),merge:au.bind(null,t.registered,r)}},Yg=function e(t){for(var r="",n=0;n<t.length;n++){var i=t[n];if(i!=null){var o=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))o=e(i);else{o="";for(var a in i)i[a]&&a&&(o&&(o+=" "),o+=a)}break}default:o=i}o&&(r&&(r+=" "),r+=o)}}return r},Xg=zg({key:"css"}),De=Xg.css,ys,Ke,is,su,lu=0,Mu=[],be=q,cu=be.__b,du=be.__r,uu=be.diffed,fu=be.__c,hu=be.unmount,pu=be.__;function Qg(e,t){be.__h&&be.__h(Ke,e,lu||t),lu=0;var r=Ke.__H||(Ke.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Gu(e,t){var r=Qg(ys++,7);return t_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Zg(){for(var e;e=Mu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Bi),e.__H.__h.forEach(bs),e.__H.__h=[]}catch(t){e.__H.__h=[],be.__e(t,e.__v)}}be.__b=function(e){Ke=null,cu&&cu(e)},be.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),pu&&pu(e,t)},be.__r=function(e){du&&du(e),ys=0;var t=(Ke=e.__c).__H;t&&(is===Ke?(t.__h=[],Ke.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Bi),t.__h.forEach(bs),t.__h=[],ys=0)),is=Ke},be.diffed=function(e){uu&&uu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Mu.push(t)!==1&&su===be.requestAnimationFrame||((su=be.requestAnimationFrame)||e_)(Zg)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),is=Ke=null},be.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Bi),r.__h=r.__h.filter(function(n){return!n.__||bs(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],be.__e(n,r.__v)}}),fu&&fu(e,t)},be.unmount=function(e){hu&&hu(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Bi(n)}catch(i){t=i}}),r.__H=void 0,t&&be.__e(t,r.__v))};var mu=typeof requestAnimationFrame=="function";function e_(e){var t,r=function(){clearTimeout(n),mu&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);mu&&(t=requestAnimationFrame(r))}function Bi(e){var t=Ke,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Ke=t}function bs(e){var t=Ke;e.__c=e.__(),Ke=t}function t_(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var r_=Symbol.for("preact-signals");function Zi(){if(Bt>1)Bt--;else{for(var e,t=!1;tn!==void 0;){var r=tn;for(tn=void 0,ws++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Fu(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(ws=0,Bt--,t)throw e}}function fe(e){if(Bt>0)return e();Bt++;try{return e()}finally{Zi()}}var oe=void 0,tn=void 0,Bt=0,ws=0,Vi=0;function Ju(e){if(oe!==void 0){var t=e.n;if(t===void 0||t.t!==oe)return t={i:0,S:e,p:oe.s,n:void 0,t:oe,e:void 0,x:void 0,r:t},oe.s!==void 0&&(oe.s.n=t),oe.s=t,e.n=t,32&oe.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=oe.s,t.n=void 0,oe.s.n=t,oe.s=t),t}}function Se(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Se.prototype.brand=r_;Se.prototype.h=function(){return!0};Se.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)};Se.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Se.prototype.subscribe=function(e){var t=this;return un(function(){var r=t.value,n=oe;oe=void 0;try{e(r)}finally{oe=n}})};Se.prototype.valueOf=function(){return this.value};Se.prototype.toString=function(){return this.value+""};Se.prototype.toJSON=function(){return this.value};Se.prototype.peek=function(){var e=oe;oe=void 0;try{return this.value}finally{oe=e}};Object.defineProperty(Se.prototype,"value",{get:function(){var e=Ju(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ws>100)throw new Error("Cycle detected");this.v=e,this.i++,Vi++,Bt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Zi()}}}});function W(e){return new Se(e)}function Fu(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 ju(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Hu(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function br(e){Se.call(this,void 0),this.x=e,this.s=void 0,this.g=Vi-1,this.f=4}(br.prototype=new Se).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Vi))return!0;if(this.g=Vi,this.f|=1,this.i>0&&!Fu(this))return this.f&=-2,!0;var e=oe;try{ju(this),oe=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return oe=e,Hu(this),this.f&=-2,!0};br.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)}Se.prototype.S.call(this,e)};br.prototype.U=function(e){if(this.t!==void 0&&(Se.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)}};br.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(br.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ju(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function rn(e){return new br(e)}function qu(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Bt++;var r=oe;oe=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,qs(e),n}finally{oe=r,Zi()}}}function qs(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,qu(e)}function n_(e){if(oe!==this)throw new Error("Out-of-order effect");Hu(this),oe=e,this.f&=-2,8&this.f&&qs(this),Zi()}function dn(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}dn.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()}};dn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,qu(this),ju(this),Bt++;var e=oe;return oe=this,n_.bind(this,e)};dn.prototype.N=function(){2&this.f||(this.f|=2,this.o=tn,tn=this)};dn.prototype.d=function(){this.f|=8,1&this.f||qs(this)};function un(e){var t=new dn(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Vu,os,Ku=[];un(function(){Vu=this.N})();function wr(e,t){q[e]=t.bind(null,q[e]||function(){})}function Ki(e){os&&os(),os=e&&e.S()}function $u(e){var t=this,r=e.data,n=Wu(r);n.value=r;var i=Gu(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=rn(function(){var p=n.value.value;return p===0?0:p===!0?"":p||""}),h=rn(function(){return!Array.isArray(c.value)&&!Ta(c.value)}),d=un(function(){if(this.N=zu,h.value){var p=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=p)}}),m=t.__$u.d;return t.__$u.d=function(){d(),m.call(this)},[h,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}$u.displayName="_st";Object.defineProperties(Se.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:$u},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});wr("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Se&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});wr("__r",function(e,t){Ki();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return un(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Ki(r),e(t)});wr("__e",function(e,t,r,n){Ki(),e(t,r,n)});wr("diffed",function(e,t){Ki();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],h=n[l];c===void 0?(c=i_(r,l,h,i),o[l]=c):c.o(h,i)}}}e(t)});function i_(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=W(r);return{o:function(a,s){o.value=a,n=s},d:un(function(){this.N=zu;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}wr("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)});wr("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Ve.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(n||o||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var a in e)if(a!=="__source"&&e[a]!==this.props[a])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Wu(e){return Gu(function(){return W(e)},[])}var o_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function a_(){fe(function(){for(var e;e=Ku.shift();)Vu.call(e)})}function zu(){Ku.push(this)===1&&(q.requestAnimationFrame||o_)(a_)}var we=De`
12
12
  inset: 0;
13
13
  clear: none;
14
14
  float: none;
@@ -26,8 +26,8 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
26
26
  text-decoration: none;
27
27
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
28
28
  'Helvetica Neue', sans-serif;
29
- `;function s_(e,t){let r=gi(e);Pa(()=>{r.current=e},[e]),xt(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}var l_=0;function $(e,t,r,n,i,o){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--l_,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return H.vnode&&H.vnode(c),c}var c_=Te`
30
- ${ye}
29
+ `;function s_(e,t){let r=bi(e);Ua(()=>{r.current=e},[e]),Nt(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}var l_=0;function V(e,t,r,n,i,o){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--l_,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return q.vnode&&q.vnode(c),c}var c_=De`
30
+ ${we}
31
31
  position: fixed;
32
32
  top: 0;
33
33
  left: 0;
@@ -40,7 +40,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
40
40
  height: 100vh;
41
41
 
42
42
  .card-wrapper {
43
- ${ye}
43
+ ${we}
44
44
  position: relative;
45
45
  display: flex;
46
46
  flex-direction: column;
@@ -54,7 +54,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
54
54
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
55
55
 
56
56
  .body {
57
- ${ye}
57
+ ${we}
58
58
  display: flex;
59
59
  flex-direction: column;
60
60
  width: 100%;
@@ -63,7 +63,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
63
63
  box-sizing: border-box;
64
64
  justify-content: center;
65
65
  .title {
66
- ${ye}
66
+ ${we}
67
67
  text-align: center;
68
68
  font-size: 16px;
69
69
  font-weight: bold;
@@ -71,7 +71,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
71
71
  }
72
72
 
73
73
  .content {
74
- ${ye}
74
+ ${we}
75
75
  font-size: 14px;
76
76
  color: #888;
77
77
  margin-bottom: 16px;
@@ -79,13 +79,13 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
79
79
  }
80
80
 
81
81
  .footer {
82
- ${ye}
82
+ ${we}
83
83
  display: flex;
84
84
  align-items: center;
85
85
  width: 100%;
86
86
  height: 40px;
87
87
  button {
88
- ${ye}
88
+ ${we}
89
89
  border: none;
90
90
  outline: none;
91
91
  height: 100%;
@@ -101,8 +101,8 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
101
101
  }
102
102
  }
103
103
  }
104
- `,Ct=Y(null),ys=Y(""),bs=Y(""),Li=Y(!1),d_=()=>{var e;(e=Ct.value)==null||e.call(Ct,!1)},u_=()=>{var e;(e=Ct.value)==null||e.call(Ct,!0)},f_=e=>E(void 0,null,function*(){let{title:t,content:r}=e;return Ct.value&&(Ct.value(!1),ue(()=>{Ct.value=null,Li.value=!1})),ue(()=>{ys.value=t||"",bs.value=r||"",Li.value=!0}),new Promise(n=>{Ct.value=i=>{ue(()=>{Ct.value=null,Li.value=!1,ys.value="",bs.value=""}),n(i)}})}),h_=()=>Li.value?$("div",{className:c_,children:$("div",{className:"card-wrapper",children:[$("div",{className:"body",children:[$("div",{className:"title",children:ys.value}),$("div",{className:"content",children:bs.value})]}),$("div",{className:"footer",children:[$("button",{onClick:d_,className:"cancel-btn",children:"Cancel"}),$("button",{onClick:u_,className:"confirm-btm",children:"Confirm"})]})]})}):null,m_=Te`
105
- ${ye}
104
+ `,Ot=W(null),As=W(""),Es=W(""),Mi=W(!1),d_=()=>{var e;(e=Ot.value)==null||e.call(Ot,!1)},u_=()=>{var e;(e=Ot.value)==null||e.call(Ot,!0)},f_=e=>A(void 0,null,function*(){let{title:t,content:r}=e;return Ot.value&&(Ot.value(!1),fe(()=>{Ot.value=null,Mi.value=!1})),fe(()=>{As.value=t||"",Es.value=r||"",Mi.value=!0}),new Promise(n=>{Ot.value=i=>{fe(()=>{Ot.value=null,Mi.value=!1,As.value="",Es.value=""}),n(i)}})}),h_=()=>Mi.value?V("div",{className:c_,children:V("div",{className:"card-wrapper",children:[V("div",{className:"body",children:[V("div",{className:"title",children:As.value}),V("div",{className:"content",children:Es.value})]}),V("div",{className:"footer",children:[V("button",{onClick:d_,className:"cancel-btn",children:"Cancel"}),V("button",{onClick:u_,className:"confirm-btm",children:"Confirm"})]})]})}):null,p_=De`
105
+ ${we}
106
106
  position: relative;
107
107
  display: flex;
108
108
  align-items: center;
@@ -120,7 +120,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
120
120
  }
121
121
 
122
122
  button {
123
- ${ye}
123
+ ${we}
124
124
  padding: 0 20px;
125
125
  height: 30px;
126
126
  line-height: 30px;
@@ -134,8 +134,8 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
134
134
  cursor: not-allowed;
135
135
  }
136
136
  }
137
- `,p_=()=>{let e=Y(!1),t=Y(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{ue(()=>{t.value=Date.now(),e.value=!1})}}},v_=e=>{let{countdown:t=0,mode:r,onClose:n,state:i}=e,{startTimestamp:o,timerPaused:a}=i,s=$u(t);s_(()=>{s.value>0?s.value-=1:ue(()=>{a.value=!0,s.value=0})},a.value?null:1e3);let l=tn(()=>{if(r==="interstitial"||r==="rewarded_insterstitial"||!o.value)return!1;let h=Date.now()-o.value;return s.value>0&&t-s.value>=5&&h>=5e3}),c=tn(()=>{if(r==="interstitial")return!0;if(!o.value)return!1;let h=Date.now()-o.value;return s.value<=0&&h>=(t-1)*1e3&&t>5}),m=tn(()=>r==="interstitial"?!1:!l.value&&!c.value),d=()=>E(void 0,null,function*(){if(a.value=!0,!(yield f_({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){a.value=!1;return}n("dismiss"),ue(()=>{a.value=!0,s.value=0,o.value=null})}),p=()=>{n("viewed"),ue(()=>{a.value=!0,s.value=0,o.value=null})};return $("div",{className:m_,children:[s.value>0&&r!=="interstitial"&&$("div",{className:"timer",children:[s.value,"s"]}),$("button",{onClick:l.value?d:c.value?p:void 0,disabled:m.value,children:$("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$("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"})})})]})},Wu=()=>{let e=Y(),t=Y(),r=Y(),n=Y(),i=Y(),o=Y(!1),a=Y(15),s=Y(""),l=Y("reward");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,visible:o,countdown:a,src:s,mode:l}},g_=Te`
138
- ${ye}
137
+ `,m_=()=>{let e=W(!1),t=W(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{fe(()=>{t.value=Date.now(),e.value=!1})}}},v_=e=>{let{countdown:t=0,mode:r,onClose:n,state:i}=e,{startTimestamp:o,timerPaused:a}=i,s=Wu(t);s_(()=>{s.value>0?s.value-=1:fe(()=>{a.value=!0,s.value=0})},a.value?null:1e3);let l=rn(()=>{if(r==="interstitial"||r==="rewarded_insterstitial"||!o.value)return!1;let p=Date.now()-o.value;return s.value>0&&t-s.value>=5&&p>=5e3}),c=rn(()=>{if(r==="interstitial")return!0;if(!o.value)return!1;let p=Date.now()-o.value;return s.value<=0&&p>=(t-1)*1e3&&t>5}),h=rn(()=>r==="interstitial"?!1:!l.value&&!c.value),d=()=>A(void 0,null,function*(){if(a.value=!0,!(yield f_({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){a.value=!1;return}n("dismiss"),fe(()=>{a.value=!0,s.value=0,o.value=null})}),m=()=>{n("viewed"),fe(()=>{a.value=!0,s.value=0,o.value=null})};return V("div",{className:p_,children:[s.value>0&&r!=="interstitial"&&V("div",{className:"timer",children:[s.value,"s"]}),V("button",{onClick:l.value?d:c.value?m:void 0,disabled:h.value,children:V("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:V("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"})})})]})},Yu=()=>{let e=W(),t=W(),r=W(),n=W(),i=W(),o=W(!1),a=W(15),s=W(""),l=W("reward");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,visible:o,countdown:a,src:s,mode:l}},g_=De`
138
+ ${we}
139
139
  position: fixed;
140
140
  z-index: 2147483647;
141
141
  background: white;
@@ -145,7 +145,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
145
145
  flex-direction: column;
146
146
 
147
147
  iframe {
148
- ${ye}
148
+ ${we}
149
149
  flex: 1;
150
150
  position: relative;
151
151
  display: block;
@@ -153,22 +153,22 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
153
153
  width: 100%;
154
154
  height: 100%;
155
155
  }
156
- `,zu=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,visible:s,countdown:l,src:c,mode:m}=t,d=qr(()=>p_(),[]),[p,h]=_t(!1),b=A=>{var w,R,O,D;s.value=!1,A==="dismiss"?(w=n.value)==null||w.call(n):A==="viewed"&&((R=i.value)==null||R.call(i)),(O=r.value)==null||O.call(r),(D=o.value)==null||D.call(o),h(!1)},I=Vr(()=>{var A;p||(h(!0),(A=a.value)==null||A.call(a))},[p]);return xt(()=>{p&&(m.value==="reward"||m.value==="rewarded_insterstitial")&&setTimeout(()=>{d.startTimer()},100)},[p,m.value]),s.value?$("div",{className:g_,children:[$(v_,{mode:m.value,onClose:b,countdown:l.value,state:d}),s.value&&$("iframe",{src:c.value,onLoad:I,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"}),$(h_,{})]}):null};function wt(e,t,r){return(t=__(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function __(e){var t=y_(e,"string");return typeof t=="symbol"?t:t+""}function y_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ws=class{constructor(t,r){wt(this,"name","OKSPIN"),wt(this,"initialized",!1),wt(this,"initCompleter",null),wt(this,"context",void 0),wt(this,"initParams",void 0),wt(this,"adsOverlay",null),wt(this,"adsIsShowing",!1),wt(this,"lastUnDisplayedAdBreak",null),wt(this,"state",Wu()),this.context=t,this.initParams=r}init(){return E(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),it($(zu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){return E(this,null,function*(){var n,i,o,a,s,l,c,m;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.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":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let d=()=>{var h;this.adsIsShowing=!1,(h=t.afterAd)==null||h.call(t)},p=()=>{var h;this.adsIsShowing=!1,(h=t.adBreakDone)==null||h.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})};ue(()=>{this.adsIsShowing=!0,this.state.afterAd.value=d,this.state.adBreakDone.value=p,this.state.src.value=r.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),(c=t.beforeAd)==null||c.call(t);let d=()=>{var w;this.adsIsShowing=!1,(w=t.afterAd)==null||w.call(t)},p={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},h=()=>{var w;this.adsIsShowing=!1,p.breakStatus="dismissed",(w=t.adDismissed)==null||w.call(t)},b=()=>{var w;this.adsIsShowing=!1,p.breakStatus="viewed",(w=t.adViewed)==null||w.call(t)},I=()=>{var w;this.adsIsShowing=!1,(w=t.adBreakDone)==null||w.call(t,p)};ue(()=>{this.state.afterAd.value=d,this.state.adDismissed.value=h,this.state.adViewed.value=b,this.state.adBreakDone.value=I});let A=()=>{var w;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(w=t.adBreakDone)==null||w.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,ue(()=>{var R;this.state.countdown.value=(R=r.params.countdown)!=null?R:15,this.state.src.value=r.params.url,this.state.mode.value="reward",this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(m=t.beforeReward)==null||m.call(t,A);break}}})}},b_=()=>{let e=Y(null),t=Y(null),r=Y(null),n=Y(null),i=Y(null),o=Y(null),a=Y(!1),s=Y(null);return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adError:o,visible:a,payload:s}},w_=Te`
157
- ${ye}
156
+ `,Xu=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,visible:s,countdown:l,src:c,mode:h}=t,d=Vr(()=>m_(),[]),[m,p]=bt(!1),b=I=>{var w,R,O,P;s.value=!1,I==="dismiss"?(w=n.value)==null||w.call(n):I==="viewed"&&((R=i.value)==null||R.call(i)),(O=r.value)==null||O.call(r),(P=o.value)==null||P.call(o),p(!1)},E=Kr(()=>{var I;m||(p(!0),(I=a.value)==null||I.call(a))},[m]);return Nt(()=>{m&&(h.value==="reward"||h.value==="rewarded_insterstitial")&&setTimeout(()=>{d.startTimer()},100)},[m,h.value]),s.value?V("div",{className:g_,children:[V(v_,{mode:h.value,onClose:b,countdown:l.value,state:d}),s.value&&V("iframe",{src:c.value,onLoad:E,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"}),V(h_,{})]}):null};function Et(e,t,r){return(t=__(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function __(e){var t=y_(e,"string");return typeof t=="symbol"?t:t+""}function y_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Is=class{constructor(t,r){Et(this,"name","OKSPIN"),Et(this,"initialized",!1),Et(this,"initCompleter",null),Et(this,"context",void 0),Et(this,"initParams",void 0),Et(this,"adsOverlay",null),Et(this,"adsIsShowing",!1),Et(this,"lastUnDisplayedAdBreak",null),Et(this,"state",Yu()),this.context=t,this.initParams=r}init(){return A(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),at(V(Xu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){return A(this,null,function*(){var n,i,o,a,s,l,c,h;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.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":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let d=()=>{var p;this.adsIsShowing=!1,(p=t.afterAd)==null||p.call(t)},m=()=>{var p;this.adsIsShowing=!1,(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})};fe(()=>{this.adsIsShowing=!0,this.state.afterAd.value=d,this.state.adBreakDone.value=m,this.state.src.value=r.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),(c=t.beforeAd)==null||c.call(t);let d=()=>{var w;this.adsIsShowing=!1,(w=t.afterAd)==null||w.call(t)},m={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},p=()=>{var w;this.adsIsShowing=!1,m.breakStatus="dismissed",(w=t.adDismissed)==null||w.call(t)},b=()=>{var w;this.adsIsShowing=!1,m.breakStatus="viewed",(w=t.adViewed)==null||w.call(t)},E=()=>{var w;this.adsIsShowing=!1,(w=t.adBreakDone)==null||w.call(t,m)};fe(()=>{this.state.afterAd.value=d,this.state.adDismissed.value=p,this.state.adViewed.value=b,this.state.adBreakDone.value=E});let I=()=>{var w;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(w=t.adBreakDone)==null||w.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,fe(()=>{var R;this.state.countdown.value=(R=r.params.countdown)!=null?R:15,this.state.src.value=r.params.url,this.state.mode.value="reward",this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(h=t.beforeReward)==null||h.call(t,I);break}}})}},b_=()=>{let e=W(null),t=W(null),r=W(null),n=W(null),i=W(null),o=W(null),a=W(!1),s=W(null);return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adError:o,visible:a,payload:s}},w_=De`
157
+ ${we}
158
158
  position: fixed;
159
159
  inset: 0;
160
160
  z-index: 2147483647;
161
161
  display: flex;
162
162
  background: #000000;
163
- `,E_=Te`
164
- ${ye}
163
+ `,A_=De`
164
+ ${we}
165
165
  position: relative;
166
166
  width: 100%;
167
167
  height: 100%;
168
168
  display: flex;
169
169
  flex-direction: column;
170
170
  color: #f7f9fc;
171
- `,I_=Te`
171
+ `,E_=De`
172
172
  position: absolute;
173
173
  top: 24px;
174
174
  left: 24px;
@@ -179,23 +179,23 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
179
179
  border-radius: 999px;
180
180
  background: rgba(0, 0, 0, 0.65);
181
181
  border: 1px solid rgba(255, 255, 255, 0.08);
182
- `,A_=Te`
182
+ `,I_=De`
183
183
  font-size: 11px;
184
184
  letter-spacing: 0.08em;
185
185
  text-transform: uppercase;
186
186
  color: #c7d4ef;
187
- `,S_=Te`
187
+ `,S_=De`
188
188
  font-size: 14px;
189
189
  font-weight: 500;
190
- `,C_=Te`
191
- ${ye}
190
+ `,C_=De`
191
+ ${we}
192
192
  flex: 1;
193
193
  background: #050505;
194
194
  display: flex;
195
195
  align-items: center;
196
196
  justify-content: center;
197
197
  padding: 0;
198
- `,mu=Te`
198
+ `,vu=De`
199
199
  width: 100%;
200
200
  height: 100%;
201
201
  border: 2px dashed rgba(255, 255, 255, 0.08);
@@ -204,13 +204,13 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
204
204
  justify-content: center;
205
205
  color: #6e7da1;
206
206
  font-size: 14px;
207
- `,R_=Te`
207
+ `,R_=De`
208
208
  position: absolute;
209
209
  bottom: 32px;
210
210
  right: 32px;
211
211
  display: flex;
212
212
  gap: 12px;
213
- `,O_=Te`
213
+ `,O_=De`
214
214
  min-width: 160px;
215
215
  min-height: 48px;
216
216
  border-radius: 999px;
@@ -226,7 +226,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
226
226
  opacity: 0.4;
227
227
  cursor: not-allowed;
228
228
  }
229
- `,k_=Te`
229
+ `,T_=De`
230
230
  min-width: 120px;
231
231
  min-height: 44px;
232
232
  border-radius: 999px;
@@ -236,8 +236,8 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
236
236
  font-size: 14px;
237
237
  font-weight: 500;
238
238
  cursor: pointer;
239
- `,T_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adError:s,visible:l,payload:c}=t,[m,d]=_t(!1),[p,h]=_t(0),[b,I]=_t(!1),[A,w]=_t(!1),[R,O]=_t("Loading next content..."),D=gi(null),M=c.value,S=Vr(U=>{var G,j,V,K;d(!1),l.value=!1,U==="dismiss"?(G=n.value)==null||G.call(n):(j=i.value)==null||j.call(i),(V=r.value)==null||V.call(r),(K=o.value)==null||K.call(o)},[l,n,i,r,o]),N=Vr(()=>{var U;d(!1),l.value=!1,(U=s.value)==null||U.call(s)},[l,s]);if(xt(()=>{var U;if(!l.value||!M){h(0),I(!1),w(!1),O("Loading next content...");return}let G=M.mode==="reward"?15:0,j=Math.max(Math.floor((U=M.countdown)!=null?U:G),0);if(h(j),w(M.mode==="reward"?j===0:!0),I(M.mode==="interstitial"?j===0:!1),j===0)return;let V=j,K=window.setInterval(()=>{V-=1,h(Math.max(V,0)),V<=0&&(window.clearInterval(K),M.mode==="reward"?w(!0):I(!0))},1e3);return()=>{window.clearInterval(K)}},[l.value,M,S]),xt(()=>{var U;if(!l.value||!M)return;let G=D.current;if(!G)return;if(G.innerHTML="",O("Loading next content..."),d(!1),M.testMode){let K=document.createElement("div");K.className=mu,K.innerText="Preview slot placeholder",G.appendChild(K),d(!0),(U=a.value)==null||U.call(a);return}if(typeof window=="undefined"){N();return}let j=document.createElement("ins");j.className="adsbygoogle",j.style.display="block",j.style.width="100%",j.style.height="100%",j.setAttribute("data-ad-client",M.clientId),j.setAttribute("data-ad-slot",M.unitId),j.setAttribute("data-ad-format","auto"),j.setAttribute("data-full-width-responsive","true"),M.channelId&&j.setAttribute("data-ad-channel",M.channelId),G.appendChild(j);let V=new MutationObserver(()=>{var K;let Fe=j.getAttribute("data-ad-status");Fe==="filled"?(d(!0),O(""),(K=a.value)==null||K.call(a),V.disconnect()):Fe==="unfilled"&&(O("Slot currently unavailable."),d(!1),V.disconnect())});V.observe(j,{attributes:!0,attributeFilter:["data-ad-status"]});try{let K=window;K.adsbygoogle=K.adsbygoogle||[],K.adsbygoogle.push({})}catch(K){V.disconnect(),N()}return()=>{V.disconnect(),G.innerHTML=""}},[l.value,M,a,N]),!l.value||!M)return null;let J=M.mode==="reward"?"Next content unlocking":"Content paused",q=p>0?`Content resumes in ${p}s`:"Content ready";return $("div",{className:w_,children:$("div",{className:E_,children:[$("div",{className:I_,children:[$("div",{className:A_,children:J}),$("div",{className:S_,children:q})]}),$("div",{className:C_,ref:D,children:!m&&$("div",{className:mu,children:R})}),$("div",{className:R_,children:M.mode==="reward"?$("button",{className:O_,type:"button",onClick:()=>S("viewed"),disabled:!A,children:A?"Continue":`Continue in ${p}s`}):b&&$("button",{className:k_,type:"button",onClick:()=>S("viewed"),children:"Continue"})})]})})};function De(e,t,r){return(t=x_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x_(e){var t=N_(e,"string");return typeof t=="symbol"?t:t+""}function N_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Es=class{constructor(t,r){if(De(this,"name","ADSENSE_BANNER_AS_AFG"),De(this,"initialized",!1),De(this,"initCompleter",null),De(this,"context",void 0),De(this,"contextInfo",void 0),De(this,"initParams",void 0),De(this,"defaultCountdown",5),De(this,"adsOverlay",null),De(this,"adsIsShowing",!1),De(this,"lastUnDisplayedAdBreak",null),De(this,"requestCounter",0),De(this,"scriptPromise",null),De(this,"scriptReady",!1),De(this,"scriptFailed",!1),De(this,"state",b_()),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,typeof window!="undefined"){let n=window;n.adsbygoogle=n.adsbygoogle||[]}}init(){return E(this,null,function*(){var t;if(typeof document!="undefined"){this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-banner-as-afg"),it($(T_,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay);try{yield this.ensureAdSenseScript()}catch(r){this.scriptFailed=!0,console.warn("[BannerAsAFG] Failed to load Google AdSense script",r)}this.initialized=!0,(t=this.initCompleter)==null||t.call(this)}})}ensureAdSenseScript(){var t;if(typeof document=="undefined")return Promise.resolve();if(this.scriptPromise)return this.scriptPromise;if(document.getElementById("google-adsense"))return this.scriptReady=!0,Promise.resolve();if(!this.initParams.clientId)return this.scriptFailed=!0,Promise.reject(new Error("BannerAsAFG requires a Google AdSense clientId."));let r=(t=this.contextInfo.testAdsMode)!=null?t:!1;return this.scriptPromise=new Promise((n,i)=>{let o=document.createElement("script");o.id="google-adsense",o.async=!0,o.crossOrigin="anonymous",o.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,r&&o.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&o.setAttribute("data-ad-channel",this.initParams.channelId),o.onload=()=>{this.scriptReady=!0,n()},o.onerror=()=>{this.scriptFailed=!0,i(new Error("Failed to fetch Google AdSense script."))},document.head.appendChild(o)}),this.scriptPromise}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}resolveOverlayConfig(t){var r,n;let i=(n=(r=t==null?void 0:t.params)==null?void 0:r.countdown)!=null?n:this.defaultCountdown;return{rewardUnitId:this.initParams.rewardUnitId,interstitialUnitId:this.initParams.interstitialUnitId,channelId:this.initParams.channelId,countdown:Math.max(Math.floor(i),0)}}canDisplay(t){return!!t&&!!this.initParams.clientId&&!!this.adsOverlay&&this.initialized&&!this.scriptFailed&&this.scriptReady}showBannerOverlay(t,r){var n,i;let o=Math.max(Math.floor((n=r.countdown)!=null?n:t==="reward"?15:0),0),a={requestId:++this.requestCounter,clientId:this.initParams.clientId,unitId:t==="reward"?this.initParams.rewardUnitId:this.initParams.interstitialUnitId,channelId:r.channelId,countdown:o,mode:t,testMode:(i=this.contextInfo.testAdsMode)!=null?i:!1};this.state.payload.value=a,this.state.visible.value=!0}adBreak(t,r){var n,i,o,a,s,l,c,m,d;let p=t.type==="preroll"?"":t.name,h=t.type==="reward"?"reward":"interstitial";if(!this.initialized||!this.adsOverlay){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:p,breakFormat:h,breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:p,breakFormat:h,breakStatus:"frequencyCapped"});return}let b=this.resolveOverlayConfig(r);if(!this.canDisplay(b.rewardUnitId)){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:p,breakFormat:h,breakStatus:"notReady"});return}switch(t.type){case"preroll":{(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(s=t.beforeAd)==null||s.call(t);let I={breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"},A=()=>{var O;this.adsIsShowing=!1,(O=t.afterAd)==null||O.call(t)},w=()=>{var O;this.adsIsShowing=!1,(O=t.adBreakDone)==null||O.call(t,I)},R=()=>{var O,D;this.adsIsShowing=!1,I.breakStatus="noAdPreloaded",(O=t.afterAd)==null||O.call(t),(D=t.adBreakDone)==null||D.call(t,I)};ue(()=>{this.adsIsShowing=!0,this.state.afterAd.value=A,this.state.adBreakDone.value=w,this.state.adDismissed.value=null,this.state.adViewed.value=null,this.state.adError.value=R,this.showBannerOverlay("interstitial",b)});break}case"reward":{this.lastUnDisplayedAdBreak&&((c=(l=this.lastUnDisplayedAdBreak).adBreakDone)==null||c.call(l,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(m=t.beforeAd)==null||m.call(t);let I={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},A=()=>{var S;this.adsIsShowing=!1,(S=t.afterAd)==null||S.call(t)},w=()=>{var S;this.adsIsShowing=!1,I.breakStatus="dismissed",(S=t.adDismissed)==null||S.call(t)},R=()=>{var S;this.adsIsShowing=!1,I.breakStatus="viewed",(S=t.adViewed)==null||S.call(t)},O=()=>{var S;this.adsIsShowing=!1,(S=t.adBreakDone)==null||S.call(t,I)},D=()=>{var S,N;this.adsIsShowing=!1,I.breakStatus="noAdPreloaded",(S=t.afterAd)==null||S.call(t),(N=t.adBreakDone)==null||N.call(t,I)};ue(()=>{this.state.afterAd.value=A,this.state.adDismissed.value=w,this.state.adViewed.value=R,this.state.adBreakDone.value=O,this.state.adError.value=D});let M=()=>{var S,N;if(!this.canDisplay(b.rewardUnitId)){this.lastUnDisplayedAdBreak=null,(S=t.afterAd)==null||S.call(t),(N=t.adBreakDone)==null||N.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.lastUnDisplayedAdBreak=null,this.adsIsShowing=!0,ue(()=>{this.showBannerOverlay("reward",b)})};this.lastUnDisplayedAdBreak=t,(d=t.beforeReward)==null||d.call(t,M);break}}}},vr={};window.addEventListener("message",e=>{e.origin!=="https://ads.appsrockets.com"&&e.origin!=="https://stg-ads.appsrockets.com"||vr[e.data.type]&&vr[e.data.type].forEach(t=>{t(e.data.data)})});var hr=(e,t)=>{xt(()=>(vr[e]||(vr[e]=new Set),vr[e].add(t),()=>{vr[e].delete(t)}),[e,t])},Yu=()=>{let e=Y(),t=Y(),r=Y(),n=Y(),i=Y(),o=Y(),a=Y(),s=Y(!1),l=Y("");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adLinkClicked:o,adError:a,visible:s,src:l}},P_=Te`
240
- ${ye}
239
+ `,k_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adError:s,visible:l,payload:c}=t,[h,d]=bt(!1),[m,p]=bt(0),[b,E]=bt(!1),[I,w]=bt(!1),[R,O]=bt("Loading next content..."),P=bi(null),B=c.value,S=Kr(L=>{var G,F,Y,X;d(!1),l.value=!1,L==="dismiss"?(G=n.value)==null||G.call(n):(F=i.value)==null||F.call(i),(Y=r.value)==null||Y.call(r),(X=o.value)==null||X.call(o)},[l,n,i,r,o]),D=Kr(()=>{var L;d(!1),l.value=!1,(L=s.value)==null||L.call(s)},[l,s]);if(Nt(()=>{var L;if(!l.value||!B){p(0),E(!1),w(!1),O("Loading next content...");return}let G=B.mode==="reward"?15:0,F=Math.max(Math.floor((L=B.countdown)!=null?L:G),0);if(p(F),w(B.mode==="reward"?F===0:!0),E(B.mode==="interstitial"?F===0:!1),F===0)return;let Y=F,X=window.setInterval(()=>{Y-=1,p(Math.max(Y,0)),Y<=0&&(window.clearInterval(X),B.mode==="reward"?w(!0):E(!0))},1e3);return()=>{window.clearInterval(X)}},[l.value,B,S]),Nt(()=>{var L;if(!l.value||!B)return;let G=P.current;if(!G)return;if(G.innerHTML="",O("Loading next content..."),d(!1),B.testMode){let X=document.createElement("div");X.className=vu,X.innerText="Preview slot placeholder",G.appendChild(X),d(!0),(L=a.value)==null||L.call(a);return}if(typeof window=="undefined"){D();return}let F=document.createElement("ins");F.className="adsbygoogle",F.style.display="block",F.style.width="100%",F.style.height="100%",F.setAttribute("data-ad-client",B.clientId),F.setAttribute("data-ad-slot",B.unitId),F.setAttribute("data-ad-format","auto"),F.setAttribute("data-full-width-responsive","true"),B.channelId&&F.setAttribute("data-ad-channel",B.channelId),G.appendChild(F);let Y=new MutationObserver(()=>{var X;let ye=F.getAttribute("data-ad-status");ye==="filled"?(d(!0),O(""),(X=a.value)==null||X.call(a),Y.disconnect()):ye==="unfilled"&&(O("Slot currently unavailable."),d(!1),Y.disconnect())});Y.observe(F,{attributes:!0,attributeFilter:["data-ad-status"]});try{let X=window;X.adsbygoogle=X.adsbygoogle||[],X.adsbygoogle.push({})}catch(X){Y.disconnect(),D()}return()=>{Y.disconnect(),G.innerHTML=""}},[l.value,B,a,D]),!l.value||!B)return null;let J=B.mode==="reward"?"Next content unlocking":"Content paused",H=m>0?`Content resumes in ${m}s`:"Content ready";return V("div",{className:w_,children:V("div",{className:A_,children:[V("div",{className:E_,children:[V("div",{className:I_,children:J}),V("div",{className:S_,children:H})]}),V("div",{className:C_,ref:P,children:!h&&V("div",{className:vu,children:R})}),V("div",{className:R_,children:B.mode==="reward"?V("button",{className:O_,type:"button",onClick:()=>S("viewed"),disabled:!I,children:I?"Continue":`Continue in ${m}s`}):b&&V("button",{className:T_,type:"button",onClick:()=>S("viewed"),children:"Continue"})})]})})};function Be(e,t,r){return(t=x_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x_(e){var t=D_(e,"string");return typeof t=="symbol"?t:t+""}function D_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ss=class{constructor(t,r){if(Be(this,"name","ADSENSE_BANNER_AS_AFG"),Be(this,"initialized",!1),Be(this,"initCompleter",null),Be(this,"context",void 0),Be(this,"contextInfo",void 0),Be(this,"initParams",void 0),Be(this,"defaultCountdown",5),Be(this,"adsOverlay",null),Be(this,"adsIsShowing",!1),Be(this,"lastUnDisplayedAdBreak",null),Be(this,"requestCounter",0),Be(this,"scriptPromise",null),Be(this,"scriptReady",!1),Be(this,"scriptFailed",!1),Be(this,"state",b_()),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,typeof window!="undefined"){let n=window;n.adsbygoogle=n.adsbygoogle||[]}}init(){return A(this,null,function*(){var t;if(typeof document!="undefined"){this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-banner-as-afg"),at(V(k_,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay);try{yield this.ensureAdSenseScript()}catch(r){this.scriptFailed=!0,console.warn("[BannerAsAFG] Failed to load Google AdSense script",r)}this.initialized=!0,(t=this.initCompleter)==null||t.call(this)}})}ensureAdSenseScript(){var t;if(typeof document=="undefined")return Promise.resolve();if(this.scriptPromise)return this.scriptPromise;if(document.getElementById("google-adsense"))return this.scriptReady=!0,Promise.resolve();if(!this.initParams.clientId)return this.scriptFailed=!0,Promise.reject(new Error("BannerAsAFG requires a Google AdSense clientId."));let r=(t=this.contextInfo.testAdsMode)!=null?t:!1;return this.scriptPromise=new Promise((n,i)=>{let o=document.createElement("script");o.id="google-adsense",o.async=!0,o.crossOrigin="anonymous",o.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,r&&o.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&o.setAttribute("data-ad-channel",this.initParams.channelId),o.onload=()=>{this.scriptReady=!0,n()},o.onerror=()=>{this.scriptFailed=!0,i(new Error("Failed to fetch Google AdSense script."))},document.head.appendChild(o)}),this.scriptPromise}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}resolveOverlayConfig(t){var r,n;let i=(n=(r=t==null?void 0:t.params)==null?void 0:r.countdown)!=null?n:this.defaultCountdown;return{rewardUnitId:this.initParams.rewardUnitId,interstitialUnitId:this.initParams.interstitialUnitId,channelId:this.initParams.channelId,countdown:Math.max(Math.floor(i),0)}}canDisplay(t){return!!t&&!!this.initParams.clientId&&!!this.adsOverlay&&this.initialized&&!this.scriptFailed&&this.scriptReady}showBannerOverlay(t,r){var n,i;let o=Math.max(Math.floor((n=r.countdown)!=null?n:t==="reward"?15:0),0),a={requestId:++this.requestCounter,clientId:this.initParams.clientId,unitId:t==="reward"?this.initParams.rewardUnitId:this.initParams.interstitialUnitId,channelId:r.channelId,countdown:o,mode:t,testMode:(i=this.contextInfo.testAdsMode)!=null?i:!1};this.state.payload.value=a,this.state.visible.value=!0}adBreak(t,r){var n,i,o,a,s,l,c,h,d;let m=t.type==="preroll"?"":t.name,p=t.type==="reward"?"reward":"interstitial";if(!this.initialized||!this.adsOverlay){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:m,breakFormat:p,breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:m,breakFormat:p,breakStatus:"frequencyCapped"});return}let b=this.resolveOverlayConfig(r);if(!this.canDisplay(b.rewardUnitId)){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:m,breakFormat:p,breakStatus:"notReady"});return}switch(t.type){case"preroll":{(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(s=t.beforeAd)==null||s.call(t);let E={breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"},I=()=>{var O;this.adsIsShowing=!1,(O=t.afterAd)==null||O.call(t)},w=()=>{var O;this.adsIsShowing=!1,(O=t.adBreakDone)==null||O.call(t,E)},R=()=>{var O,P;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(O=t.afterAd)==null||O.call(t),(P=t.adBreakDone)==null||P.call(t,E)};fe(()=>{this.adsIsShowing=!0,this.state.afterAd.value=I,this.state.adBreakDone.value=w,this.state.adDismissed.value=null,this.state.adViewed.value=null,this.state.adError.value=R,this.showBannerOverlay("interstitial",b)});break}case"reward":{this.lastUnDisplayedAdBreak&&((c=(l=this.lastUnDisplayedAdBreak).adBreakDone)==null||c.call(l,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(h=t.beforeAd)==null||h.call(t);let E={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},I=()=>{var S;this.adsIsShowing=!1,(S=t.afterAd)==null||S.call(t)},w=()=>{var S;this.adsIsShowing=!1,E.breakStatus="dismissed",(S=t.adDismissed)==null||S.call(t)},R=()=>{var S;this.adsIsShowing=!1,E.breakStatus="viewed",(S=t.adViewed)==null||S.call(t)},O=()=>{var S;this.adsIsShowing=!1,(S=t.adBreakDone)==null||S.call(t,E)},P=()=>{var S,D;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(S=t.afterAd)==null||S.call(t),(D=t.adBreakDone)==null||D.call(t,E)};fe(()=>{this.state.afterAd.value=I,this.state.adDismissed.value=w,this.state.adViewed.value=R,this.state.adBreakDone.value=O,this.state.adError.value=P});let B=()=>{var S,D;if(!this.canDisplay(b.rewardUnitId)){this.lastUnDisplayedAdBreak=null,(S=t.afterAd)==null||S.call(t),(D=t.adBreakDone)==null||D.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.lastUnDisplayedAdBreak=null,this.adsIsShowing=!0,fe(()=>{this.showBannerOverlay("reward",b)})};this.lastUnDisplayedAdBreak=t,(d=t.beforeReward)==null||d.call(t,B);break}}}},vr={};window.addEventListener("message",e=>{e.origin!=="https://ads.appsrockets.com"&&e.origin!=="https://stg-ads.appsrockets.com"||vr[e.data.type]&&vr[e.data.type].forEach(t=>{t(e.data.data)})});var hr=(e,t)=>{Nt(()=>(vr[e]||(vr[e]=new Set),vr[e].add(t),()=>{vr[e].delete(t)}),[e,t])},Qu=()=>{let e=W(),t=W(),r=W(),n=W(),i=W(),o=W(),a=W(),s=W(!1),l=W("");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adLinkClicked:o,adError:a,visible:s,src:l}},N_=De`
240
+ ${we}
241
241
  position: fixed;
242
242
  z-index: 2147483647;
243
243
  background: white;
@@ -247,7 +247,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
247
247
  flex-direction: column;
248
248
 
249
249
  iframe {
250
- ${ye}
250
+ ${we}
251
251
  flex: 1;
252
252
  position: relative;
253
253
  display: block;
@@ -255,8 +255,8 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
255
255
  width: 100%;
256
256
  height: 100%;
257
257
  }
258
- `,Xu=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:l,src:c}=t,[m,d]=_t(!1),p=b=>{var I,A,w,R;d(!1),l.value=!1,b==="dismiss"?(I=n.value)==null||I.call(n):b==="viewed"&&((A=i.value)==null||A.call(i)),(w=r.value)==null||w.call(r),(R=o.value)==null||R.call(o)},h=()=>{var b;(b=a.value)==null||b.call(a)};return hr("appsrockets_ad_dismissed",()=>p("dismiss")),hr("appsrockets_ad_rewarded",()=>p("viewed")),hr("appsrockets_ad_completed",()=>p("viewed")),hr("appsrockets_ad_skipped",()=>p("viewed")),hr("appsrockets_ad_clicked",b=>{var I;return(I=s.value)==null?void 0:I.call(s,b)}),hr("appsrockets_ad_loaded",()=>d(!0)),l.value?$("div",{className:P_,style:{display:m?"flex":"none"},children:l.value&&$("iframe",{src:c.value,onLoad:h,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 Et(e,t,r){return(t=D_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D_(e){var t=L_(e,"string");return typeof t=="symbol"?t:t+""}function L_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Is=class{constructor(t,r){Et(this,"name","APPSROCKETS"),Et(this,"initialized",!1),Et(this,"initCompleter",null),Et(this,"context",void 0),Et(this,"adsOverlay",null),Et(this,"adsIsShowing",!1),Et(this,"lastUnDisplayedAdBreak",null),Et(this,"state",Yu()),Et(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",a.joliSource),l.get("osType")||l.set("osType",a.osType),l.get("runtimeType")||l.set("runtimeType",a.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",a.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return E(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),it($(Xu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){var n,i,o,a,s,l,c,m;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let d=h=>{var b,I;(I=(b=this.context).handleLinkClicked)==null||I.call(b,h)},p=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let h=()=>{var A;this.adsIsShowing=!1,(A=t.afterAd)==null||A.call(t)},b=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},I=()=>{var A;this.adsIsShowing=!1,(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};ue(()=>{this.adsIsShowing=!0,this.state.afterAd.value=h,this.state.adBreakDone.value=b,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=d,this.state.adError.value=I,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),(c=t.beforeAd)==null||c.call(t);let h=()=>{var D;this.adsIsShowing=!1,(D=t.afterAd)==null||D.call(t)},b={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},I=()=>{var D;this.adsIsShowing=!1,b.breakStatus="dismissed",(D=t.adDismissed)==null||D.call(t)},A=()=>{var D;this.adsIsShowing=!1,b.breakStatus="viewed",(D=t.adViewed)==null||D.call(t)},w=()=>{var D;this.adsIsShowing=!1,(D=t.adBreakDone)==null||D.call(t,b)},R=()=>{this.adsIsShowing=!1,b.breakStatus="noAdPreloaded"};ue(()=>{this.state.afterAd.value=h,this.state.adDismissed.value=I,this.state.adViewed.value=A,this.state.adBreakDone.value=w,this.state.adLinkClicked.value=d,this.state.adError.value=R});let O=()=>{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,ue(()=>{this.state.src.value=this.processUrl(r.params.url,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(m=t.beforeReward)==null||m.call(t,O);break}}}},Qu=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Re(e,t,r){return(t=U_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U_(e){var t=B_(e,"string");return typeof t=="symbol"?t:t+""}function B_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zu=class{constructor(e,t,r){Re(this,"adUnit",void 0),Re(this,"project",void 0),Re(this,"keyValue",void 0),Re(this,"adsContext",null),Re(this,"rewardedSlot",null),Re(this,"rewardedPayload",null),Re(this,"readyEvent",null),Re(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Re(this,"init",()=>{var n;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")||(n=this.rewardedSlot)==null||n.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Re(this,"destroy",n=>{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,n),n!=="ignored"&&(this.adsContext=null)}),Re(this,"reinit",n=>{this.destroy(n),this.init()}),Re(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),Re(this,"handleSlotClosed",n=>{var i,o;if(this.adsContext&&n.slot===this.rewardedSlot){let a=this.rewardedPayload?"viewed":"dismissed";a==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(i=this.adsContext).afterAd)==null||o.call(i),this.withCommand(()=>{this.reinit(a)})}}),Re(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),Re(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Re(this,"requestAds",n=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=n,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,o,a;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i),(a=this.readyEvent)==null||a.makeRewardedVisible()});else{let i=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=o,this.adsContext.beforeReward(()=>{var a,s,l;(s=(a=this.adsContext)==null?void 0:a.beforeAd)==null||s.call(a),(l=this.readyEvent)==null||l.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=t,this.keyValue=r,Qu(),this.withCommand(()=>{this.init()})}};function Ge(e,t,r){return(t=M_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M_(e){var t=G_(e,"string");return typeof t=="symbol"?t:t+""}function G_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var As=class{constructor(t,r,n){var i=this;Ge(this,"adUnit",void 0),Ge(this,"project",void 0),Ge(this,"keyValue",void 0),Ge(this,"adsContext",null),Ge(this,"gamingInterstitialSlot",null),Ge(this,"readyEvent",null),Ge(this,"isRetrying",!1),Ge(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Ge(this,"init",()=>{var o;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(a=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(o=this.gamingInterstitialSlot)==null||o.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),Ge(this,"destroy",function(o){var a,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(a=i.adsContext)==null?void 0:a.onEnd)==null||s.call(a,o),o!=="ignored"&&(i.adsContext=null)),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",i.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",i.handleSlotClosed),i.gamingInterstitialSlot&&(googletag.destroySlots([i.gamingInterstitialSlot]),i.gamingInterstitialSlot=null,i.readyEvent=null)}),Ge(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(o,a),i.init()}),Ge(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),Ge(this,"handleSlotClosed",o=>{var a,s;this.adsContext&&this.gamingInterstitialSlot===o.slot&&((s=(a=this.adsContext).afterAd)==null||s.call(a),this.withCommand(()=>{this.reinit("viewed")}))}),Ge(this,"requestAds",o=>{this.withCommand(()=>{var a,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=o,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((a=o.beforeAd)==null||a.call(o),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)))})}),Qu(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Wt(e,t,r){return(t=J_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J_(e){var t=F_(e,"string");return typeof t=="symbol"?t:t+""}function F_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ss=class{constructor(t,r){Wt(this,"name","GOOGLE_GPT"),Wt(this,"context",void 0),Wt(this,"contextInfo",void 0),Wt(this,"initParams",void 0),Wt(this,"rewardAdManager",void 0),Wt(this,"interstitialManager",void 0),Wt(this,"insertScript",()=>{let n="jolibox-google-gpt",i=document.getElementById(n);i||(i=window.document.createElement("script"),i.id=n,i.async=!0,i.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",i.crossOrigin="anonymous",document.head.appendChild(i))}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,this.insertScript()}init(){return E(this,null,function*(){let t=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,r=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,n=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;t&&(this.rewardAdManager=new Zu(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new As(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.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:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a})}});break}default:{if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:a})}});break}}}};function ns(e,t,r){return(t=j_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j_(e){var t=H_(e,"string");return typeof t=="symbol"?t:t+""}function H_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Cs=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";ns(this,"context",void 0),ns(this,"placement","GAME"),ns(this,"contextInfo",void 0),this.context=t,this.placement=r,this.contextInfo=this.context.getContextInfo()}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:r}}getDevice(){var t,r,n,i;return{platform:(t=this.contextInfo.platform)!=null?t:Su.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(r=this.contextInfo.hostAppId)!=null?r:"1",model:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",brand:(i=this.contextInfo.deviceBrand)!=null?i:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,r){var n;let i={protocolVersion:"1.0.0",events:[{name:t,type:Iu.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Au.WebSDK};return Kv(i)}};function Le(e,t,r){return(t=q_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q_(e){var t=V_(e,"string");return typeof t=="symbol"?t:t+""}function V_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var an=class{constructor(t){Le(this,"context",void 0),Le(this,"adsTrackSerializer",void 0),Le(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new Cs(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:o}=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:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",deviceBrand:(n=this.contextInfo.deviceBrand)!=null?n:"UnknownBrand",dimension:{width:i,height:o}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},qi=class{constructor(t,r){var n=this;Le(this,"context",void 0),Le(this,"contextInfo",void 0),Le(this,"requestContext",void 0),Le(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Le(this,"pendingAFVAdsInfo",Promise.resolve(null)),Le(this,"doFetchAdsInfo",i=>E(this,null,function*(){let o=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",a=[];switch(i){case"afv":{a=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{a=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{a=["INTERSTITIAL"];break}}let s=i==="afv"?void 0:"cached",{data:l,code:c}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(o),bizParams:this.requestContext.getRequestBizParams(),adsTypes:a,testAdsMode:this.contextInfo.testAdsMode,name:s}});return c==="SUCCESS"||c==="BYPASS_ADS"?{code:c,data:l}:null})),Le(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Le(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),Le(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Le(this,"cacheNextAFGAdsInfo",i=>E(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),Le(this,"getAFGAdsInfo",i=>E(this,null,function*(){let o=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),o})),Le(this,"getAFVAdsInfo",function(){return E(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let i=yield n.pendingAFVAdsInfo;return n.cacheAFVInfo(),i}else return n.cacheAFVInfo(),yield n.pendingAFVAdsInfo})}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.requestContext=new an(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function $_(e,t,r){return(t=K_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K_(e){var t=W_(e,"string");return typeof t=="symbol"?t:t+""}function W_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var z_=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e)try{e(...r)}catch(i){console.error("[JoliboxSDK] Callback error:",i)}},Vi=class{constructor(t){this.context=t,$_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=Ud(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return E(this,null,function*(){try{let{errNo:r,errMsg:n}=yield Si("loadAdsAsync",{params:{providers:t.providers}});return r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){return Gi()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return E(this,null,function*(){try{let r=yield Si("showAdAsync",{params:{providers:t.providers}});if(r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(t.callbacks){let i=t.timeout!==void 0?t.timeout:-1,o=null,a=()=>{Hd("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=l=>{var c;if(l.UUID!==n)return;let m=(c=t.callbacks)==null?void 0:c[l.event];m&&z_(m,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&a()};jd("onAdsStateChange",s),i>0&&(o=setTimeout(()=>{a(),console.warn(`[JoliboxSDK] Event listener for ad ${n} auto-cleaned after ${i}ms timeout`)},i))}return{code:"SUCCESS",message:"Ad shown successfully"}}catch(r){return{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(t){try{let{errNo:r,data:n}=Si("isAdsReadySync",{params:{providers:t.providers}});return r!==0||!n?(console.warn("[Jolibox SDK]isAdsReadySync returned an error or no data"),!1):!0}catch(r){return console.warn("[Jolibox SDK]isAdsReadySync invocation failed:",r),!1}}};function It(e,t,r){return(t=Y_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y_(e){var t=X_(e,"string");return typeof t=="symbol"?t:t+""}function X_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){It(this,"providers",void 0),It(this,"helper",void 0),It(this,"adsContext",null),It(this,"_isAdsReady",!1),It(this,"init",()=>E(this,null,function*(){this.helper.canIUse()?(yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1:this._isAdsReady=!1})),It(this,"destroy",n=>{var i,o;this._isAdsReady=!1,(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,n),n!=="ignored"&&(this.adsContext=null)}),It(this,"reinit",n=>E(this,null,function*(){this.destroy(n),yield this.init()})),It(this,"requestAds",(n,i)=>E(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=n,i&&i.length>0&&(this.providers=i);try{this.isAdsReady?this.showAd():yield this.reinit("frequencyCapped")}catch(o){this.destroy("notReady")}})),It(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>E(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=c=>{var m,d,p;i||(i=!0,c==="dismissed"&&((m=this.adsContext)==null||m.adDismissed()),(p=(d=this.adsContext)==null?void 0:d.afterAd)==null||p.call(d),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var c;n=!0,(c=this.adsContext)==null||c.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new Vi(t),this.init()}};function At(e,t,r){return(t=Q_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q_(e){var t=Z_(e,"string");return typeof t=="symbol"?t:t+""}function Z_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Os=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;At(this,"providers",void 0),At(this,"helper",void 0),At(this,"adsContext",null),At(this,"_isAdsReady",!1),At(this,"init",()=>E(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),At(this,"destroy",function(i){var o,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n._isAdsReady=!1,s&&((a=(o=n.adsContext)==null?void 0:o.onEnd)==null||a.call(o,i),i!=="ignored"&&(n.adsContext=null))}),At(this,"reinit",function(o){return E(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,a),yield n.init()})}),At(this,"requestAds",(i,o)=>E(this,null,function*(){if(this.adsContext){this.destroy("ignored");return}this.adsContext=i,o&&o.length>0&&(this.providers=o);try{this.isAdsReady?yield this.showAd():yield this.reinit("frequencyCapped")}catch(a){this.destroy("notReady")}})),At(this,"showAd",()=>E(this,null,function*(){var i,o;if(!this.adsContext){this.destroy("error");return}let a=!1;(o=(i=this.adsContext).beforeAd)==null||o.call(i);let s=c=>{var m,d;a||(a=!0,(d=(m=this.adsContext)==null?void 0:m.afterAd)==null||d.call(m),this.reinit(c))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:l})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new Vi(t),this.init()}};function Zr(e,t,r){return(t=ey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ey(e){var t=ty(e,"string");return typeof t=="symbol"?t:t+""}function ty(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ks=class{constructor(t,r){Zr(this,"name","INTERNAL_NATIVE"),Zr(this,"context",void 0),Zr(this,"rewardAdManager",void 0),Zr(this,"interstitialManager",void 0),Zr(this,"initProviders",void 0),this.context=t,this.initProviders=r.providers;let n=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],r.providers),i=this.getConfigsByTypes(["INTERSTITIAL"],r.providers);n.length>0&&(this.rewardAdManager=new Rs(this.context,n)),i.length>0&&(this.interstitialManager=new Os(this.context,i))}getConfigsByTypes(t,r,n){let i=[];return(n?n.map(o=>r.find(a=>a.provider===o.provider)).filter(o=>!!o):r).forEach(o=>{t.forEach(a=>{let s="";a==="REWARD"&&(s=o.params.adUnitId.reward),a==="REWARD_INTERSTITIAL"&&(s=o.params.adUnitId.rewardInterstitial),a==="INTERSTITIAL"&&(s=o.params.adUnitId.interstitial),a==="NATIVE"&&(s=o.params.adUnitId.nativeAds),s&&i.push({provider:o.provider,params:{placementId:s,adsType:a,extra:o.params.extra}})})}),i}init(){return E(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}let a=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],this.initProviders,r.params);this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:s=>{var l;(l=t.adBreakDone)==null||l.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:s})}},a);break}default:{let a=t;if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);this.interstitialManager.requestAds({beforeAd:a.beforeAd,afterAd:a.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}},is="jolibox-nb-proxy",ry=0;function ny(e,t){return t==="call"&&e.join(".")==="GameSDK.showRewardAd"?0:15e3}function pu(e,t,r,n){return new Promise((i,o)=>{if(!window.parent||window.parent===window){o(new Error("[ParentProxy] No parent window"));return}let a=`${is}-${++ry}`,s=m=>{let d=m.data;(d==null?void 0:d.type)===`${is}:response`&&d.id===a&&(window.removeEventListener("message",s),c&&clearTimeout(c),d.error?o(new Error(d.error)):i(d.result))},l=ny(e,t),c=l>0?window.setTimeout(()=>{window.removeEventListener("message",s),o(new Error(`[ParentProxy] Timeout after ${l}ms: ${e.join(".")}.${t}`))},l):null;window.addEventListener("message",s),window.parent.postMessage({type:`${is}:request`,id:a,path:e,action:t,args:r,value:n},"*")})}function ef(e){return console.log("[JoliboxSDK] NewsBreak createProxyForPath basePath:",e),new Proxy(()=>{},{get(t,r){if(console.log("[JoliboxSDK] NewsBreak createProxyForPath get:",r),!(r==="then"||r==="toJSON"||typeof r=="symbol"))return ef([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),pu([...e,r],"set",void 0,n).catch(i=>{console.warn(`[ParentProxy] set ${[...e,r].join(".")} failed:`,i)}),!0},apply(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath apply:",n),pu(e,"call",n)}})}function iy(e){return ef([e])}var Ui=()=>{try{if(window.parent&&window.parent!==window)return iy("GameSDK")}catch(e){}};function mr(e,t,r){return(t=oy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oy(e){var t=ay(e,"string");return typeof t=="symbol"?t:t+""}function ay(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ts=class{constructor(){mr(this,"adsContext",null),mr(this,"init",()=>E(this,null,function*(){console.log("[JoliboxSDK] NewsBreak init");let t=Ui();if(t)try{let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r)}catch(r){console.log("[JoliboxSDK] NewsBreak init createRewardAd error:",r)}})),mr(this,"destroy",t=>{var r,n;(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),mr(this,"reinit",t=>E(this,null,function*(){console.log("[JoliboxSDK] NewsBreak reinit breakStatus:",t),this.destroy(t),yield this.init()})),mr(this,"requestAds",t=>E(this,null,function*(){if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Ui();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}this.showAd()})),mr(this,"showAd",()=>{if(console.log("[JoliboxSDK] NewsBreak showAd"),!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>E(this,null,function*(){var t,r,n,i,o,a,s,l,c,m,d,p,h,b;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let I=Ui();if(!I){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let A=yield I.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",A),!A.success){(a=(o=this.adsContext)==null?void 0:o.afterAd)==null||a.call(o),this.reinit("error");return}A.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(c=(l=this.adsContext)==null?void 0:l.afterAd)==null||c.call(l),this.reinit("viewed")):((m=this.adsContext)==null||m.adDismissed(),(p=(d=this.adsContext)==null?void 0:d.afterAd)==null||p.call(d),this.reinit("dismissed"))}catch(A){console.error("[JoliboxSDK] NewsBreak showRewardAd failed:",A),(b=(h=this.adsContext)==null?void 0:h.afterAd)==null||b.call(h),this.reinit("error")}}))}),this.init()}};function vu(e,t,r){return(t=sy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sy(e){var t=ly(e,"string");return typeof t=="symbol"?t:t+""}function ly(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xs=class{constructor(){vu(this,"name","NEWSBREAK"),vu(this,"rewardAdManager",void 0)}init(){return E(this,null,function*(){let t=Ui();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new Ts})}adConfig(t,r){}adBreak(t,r){var n,i;if(t.type!=="reward"){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:o=>{var a;(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o})}})}};function Qe(e,t,r){return(t=cy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cy(e){var t=dy(e,"string");return typeof t=="symbol"?t:t+""}function dy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sn=class{constructor(t){if(Qe(this,"context",void 0),Qe(this,"contextInfo",void 0),Qe(this,"providers",{}),Qe(this,"channelPolicy",void 0),Qe(this,"adsActionDetection",void 0),Qe(this,"requestContext",void 0),Qe(this,"adsRequest",void 0),Qe(this,"initialized",!1),Qe(this,"adsIsShowing",!1),Qe(this,"lastAdBreak",void 0),Qe(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new fs(this.context),this.adsActionDetection=new us(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new qi(t),this.requestContext=new an(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return E(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:r}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((r==null?void 0:r.length)>0){let n=r.filter(s=>s.isNative),i=r.filter(s=>!s.isNative),o={provider:"INTERNAL_NATIVE",params:{providers:n}},a=i.concat([o]);for(let s of a)switch(s.provider){case"GOOGLE_GPT":{let l=new Ss(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new hs(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new ws(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new Is(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Es(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new ks(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",s);let l=new xs;yield l.init(),this.providers.NEWSBREAK=l;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 E(this,null,function*(){var r,n,i,o,a,s,l,c,m,d,p,h,b,I,A,w;let R=Date.now();if(R-this.initializedTimeStamp<3e3){console.log("[Jolibox SDK Ads] too soon"),(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:"noAdPreloaded"});return}if(this.lastAdBreak&&R-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads] You can't call adBreak too frequently"),(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:"frequencyCapped"});return}if(this.lastAdBreak=R,this.adsIsShowing){console.warn("[Jolibox SDK Ads] You can't call adBreak while ad is showing"),(i=t.adBreakDone)==null||i.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()){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}if(!this.context.checkNetwork()&&!this.providers.NEWSBREAK){console.log("[Jolibox SDK Ads] net not ready"),(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:"noAdPreloaded"});return}try{let O=yield this.adsRequest.getAFGAdsInfo(t.type),D=O==null?void 0:O.data,M=O==null?void 0:O.code;if(M==="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 S,N,J,q;(S=t.beforeAd)==null||S.call(t),(N=t.adViewed)==null||N.call(t),(J=t.afterAd)==null||J.call(t),(q=t.adBreakDone)==null||q.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(l=t.beforeAd)==null||l.call(t),(c=t.afterAd)==null||c.call(t),(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!D||M!=="SUCCESS"){console.log("[Jolibox SDK Ads] not SUCCESS"),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(D.length===0){console.log("[Jolibox SDK Ads] ads info empty"),(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 S=!0,N=null,J=new ds(this.context);this.adsActionDetection.adBreakIsShowing=!0;let q=D.filter(V=>V.isNative).sort((V,K)=>V.seq-K.seq),U=D.filter(V=>!V.isNative).sort((V,K)=>V.seq-K.seq),G={seq:(b=(h=q[0])==null?void 0:h.seq)!=null?b:0,provider:"INTERNAL_NATIVE",params:q},j;for(q.length>0?j=[G].concat(U):j=U,j=j.sort((V,K)=>V.seq-K.seq).map((V,K)=>Sv(yu({},V),{seq:K}));j.length>0;){let V=j.shift(),K=this.providers[V.provider];if(K){let[Fe,Yt]=yield J.callAdBreakAndContinue(K,t,V,Xt=>{var ct;this.adsIsShowing=Xt,(ct=this.context.eventEmitter)==null||ct.emit("isAdShowing",Xt)});S=Fe,N=Yt}else S=!0,N={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!S)break}S&&N&&((I=t.adBreakDone)==null||I.call(t,N))}}catch(O){console.log("[Jolibox SDK Ads] error:",O),(A=t.adBreakDone)==null||A.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(w=this.context.eventEmitter)==null||w.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.")}};function ki(e,t,r){return(t=uy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uy(e){var t=fy(e,"string");return typeof t=="symbol"?t:t+""}function fy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ns=class{constructor(t){ki(this,"context",void 0),ki(this,"currentProvider",void 0),ki(this,"continueCallback",void 0),ki(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo()}get paramsToTrack(){var t,r;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null}}wrapAdRequested(t){return()=>{this.context.track("CallAFVRequest",this.paramsToTrack),t==null||t()}}wrapAdLoaded(t){return r=>{this.context.track("CallAFVLoad",this.paramsToTrack),t==null||t(r)}}wrapAdPlaying(t){return r=>{var n,i;this.context.track("CallAFVPlaying",this.paramsToTrack),Gi()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"AFV",module:"drama",game_id:this.contextInfo.objectId}),t==null||t(r)}}wrapAdCompleted(t){return r=>{var n;this.context.track("CallAFVCompleted",this.paramsToTrack),t==null||t(r),(n=this.continueCallback)==null||n.call(this,[!1,null])}}wrapAdError(t){return r=>{var n;this.context.track("CallAFVError",this.paramsToTrack),(n=this.continueCallback)==null||n.call(this,[!0,r])}}callAdRequestAndContinue(t,r,n){return E(this,null,function*(){return this.currentProvider=t,new Promise(i=>{this.continueCallback=i;let o=Object.assign({},r);o.onAdRequested=this.wrapAdRequested(r.onAdRequested),o.onAdLoaded=this.wrapAdLoaded(r.onAdLoaded),o.onAdPlaying=this.wrapAdPlaying(r.onAdPlaying),o.onAdCompleted=this.wrapAdCompleted(r.onAdCompleted),o.onAdError=this.wrapAdError(r.onAdError),t.requestAd(o,n)})})}};function os(e,t,r){return(t=hy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hy(e){var t=my(e,"string");return typeof t=="symbol"?t:t+""}function my(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ke=class e extends Error{constructor(t,r){super(t.message),os(this,"name",void 0),os(this,"type",void 0),os(this,"raw",void 0),this.name="AFVRequestError",this.type=r,this.raw=t,this.stack=t.stack,this.message=t.message}static from(t,r){switch(r){case"GOOGLE_IMA_ERROR":return new e(t,r);case"JOLIBOX_IMA_ERROR":return new e(t,r)}}};function oe(e,t,r){return(t=py(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function py(e){var t=vy(e,"string");return typeof t=="symbol"?t:t+""}function vy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ps=class{constructor(t,r,n){oe(this,"adsLoader",void 0),oe(this,"adDisplayContainer",void 0),oe(this,"isAdPlaying",!1),oe(this,"isContentFinished",!1),oe(this,"videoContent",void 0),oe(this,"adContainer",void 0),oe(this,"adsManager",void 0),oe(this,"intervalTimer",void 0),oe(this,"completed",!1),oe(this,"adTagUrl",void 0),oe(this,"notifyRequestAd",void 0),oe(this,"notifyLoaded",void 0),oe(this,"notifyPlayingAd",void 0),oe(this,"notifyCompleted",void 0),oe(this,"notifyError",void 0),oe(this,"destroy",()=>{var i,o,a,s,l,c,m,d,p,h,b;this.intervalTimer&&clearInterval(this.intervalTimer),(i=this.adsManager)==null||i.stop(),(o=this.adDisplayContainer)==null||o.destroy(),(a=this.adsLoader)==null||a.removeEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded),(s=this.adsLoader)==null||s.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(l=this.adsManager)==null||l.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(c=this.adsManager)==null||c.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),(m=this.adsManager)==null||m.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),(d=this.adsManager)==null||d.removeEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),(p=this.adsManager)==null||p.removeEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),(h=this.adsManager)==null||h.removeEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),(b=this.adsManager)==null||b.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent)}),oe(this,"requestAds",(i,o)=>E(this,null,function*(){var a;this.createAdDisplayContainer(),this.notifyRequestAd=i.onAdRequested,this.notifyLoaded=i.onAdLoaded,this.notifyPlayingAd=i.onAdPlaying,this.notifyCompleted=i.onAdCompleted,this.notifyError=d=>{var p;return(p=i.onAdError)==null?void 0:p.call(i,ke.from(d,"GOOGLE_IMA_ERROR"))},this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded,!1),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError,!1);let s=()=>{var d;this.isAdPlaying||(this.isContentFinished=!0,(d=this.adsLoader)==null||d.contentComplete())};this.videoContent.onended=s;let l=new window.google.ima.AdsRequest;l.vastLoadTimeout=1e4;let c="";Object.keys(o.params).forEach(d=>{let p=window.encodeURIComponent(o.params[d]);c+=`&${d}=${p}`});let m=`${this.adTagUrl}${c}`;l.adTagUrl=m,l.linearAdSlotWidth=640,l.linearAdSlotHeight=400,l.nonLinearAdSlotWidth=640,l.nonLinearAdSlotHeight=150,this.adsLoader.requestAds(l),(a=this.notifyRequestAd)==null||a.call(this)})),oe(this,"createAdDisplayContainer",()=>{this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoContent)}),oe(this,"playAds",()=>{var i,o;this.videoContent.load(),this.adDisplayContainer.initialize(),this.completed=!1;try{(i=this.adsManager)==null||i.init(window.document.body.clientWidth,window.document.body.clientHeight,window.google.ima.ViewMode.NORMAL),(o=this.adsManager)==null||o.start()}catch(a){console.error("[JoliboxAFV] Google IMA Error: ",a),this.videoContent.play()}}),oe(this,"onAdsManagerLoaded",i=>{let o=new window.google.ima.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.loadVideoTimeout=1e4,this.adsManager=i.getAdsManager(this.videoContent,o),this.adsManager.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent),i.type==="adsManagerLoaded"&&this.playAds()}),oe(this,"onAdEvent",i=>{var o,a,s,l;let c=i.getAd();switch(i.type){case window.google.ima.AdEvent.Type.LOADED:c!=null&&c.isLinear()||this.videoContent.play(),(o=this.notifyLoaded)==null||o.call(this,i);break;case window.google.ima.AdEvent.Type.STARTED:c!=null&&c.isLinear()&&(this.intervalTimer=window.setInterval(function(){},300)),(a=this.notifyPlayingAd)==null||a.call(this,i);break;case window.google.ima.AdEvent.Type.COMPLETE:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(s=this.notifyCompleted)==null||s.call(this,i));break;case window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(l=this.notifyCompleted)==null||l.call(this,i));break}}),oe(this,"onAdError",i=>{var o,a;(o=this.notifyError)==null||o.call(this,i.getError()),(a=this.adsManager)==null||a.destroy()}),oe(this,"onContentPauseRequested",()=>{this.isAdPlaying=!0,this.videoContent.pause()}),oe(this,"onContentResumeRequested",()=>{this.isAdPlaying=!1}),this.adTagUrl=t,this.videoContent=r,this.adContainer=n}},Bi=(e=>(e[e.ADS_REQUEST_NETWORK_ERROR=1012]="ADS_REQUEST_NETWORK_ERROR",e[e.ASSET_FALLBACK_FAILED=1021]="ASSET_FALLBACK_FAILED",e[e.AUTOPLAY_DISALLOWED=1205]="AUTOPLAY_DISALLOWED",e[e.COMPANION_AD_LOADING_FAILED=603]="COMPANION_AD_LOADING_FAILED",e[e.COMPANION_REQUIRED_ERROR=602]="COMPANION_REQUIRED_ERROR",e[e.FAILED_TO_REQUEST_ADS=1005]="FAILED_TO_REQUEST_ADS",e[e.INVALID_AD_TAG=1013]="INVALID_AD_TAG",e[e.INVALID_ADX_EXTENSION=1105]="INVALID_ADX_EXTENSION",e[e.INVALID_ARGUMENTS=1101]="INVALID_ARGUMENTS",e[e.NONLINEAR_DIMENSIONS_ERROR=501]="NONLINEAR_DIMENSIONS_ERROR",e[e.OVERLAY_AD_LOADING_FAILED=502]="OVERLAY_AD_LOADING_FAILED",e[e.OVERLAY_AD_PLAYING_FAILED=500]="OVERLAY_AD_PLAYING_FAILED",e[e.STREAM_INITIALIZATION_FAILED=1020]="STREAM_INITIALIZATION_FAILED",e[e.UNKNOWN_AD_RESPONSE=1010]="UNKNOWN_AD_RESPONSE",e[e.UNKNOWN_ERROR=900]="UNKNOWN_ERROR",e[e.UNSUPPORTED_LOCALE=1011]="UNSUPPORTED_LOCALE",e[e.VAST_ASSET_NOT_FOUND=1007]="VAST_ASSET_NOT_FOUND",e[e.VAST_EMPTY_RESPONSE=1009]="VAST_EMPTY_RESPONSE",e[e.VAST_LINEAR_ASSET_MISMATCH=403]="VAST_LINEAR_ASSET_MISMATCH",e[e.VAST_LOAD_TIMEOUT=301]="VAST_LOAD_TIMEOUT",e[e.VAST_MALFORMED_RESPONSE=100]="VAST_MALFORMED_RESPONSE",e[e.VAST_MEDIA_LOAD_TIMEOUT=402]="VAST_MEDIA_LOAD_TIMEOUT",e[e.VAST_NO_ADS_AFTER_WRAPPER=303]="VAST_NO_ADS_AFTER_WRAPPER",e[e.VAST_NONLINEAR_ASSET_MISMATCH=503]="VAST_NONLINEAR_ASSET_MISMATCH",e[e.VAST_PROBLEM_DISPLAYING_MEDIA_FILE=405]="VAST_PROBLEM_DISPLAYING_MEDIA_FILE",e[e.VAST_SCHEMA_VALIDATION_ERROR=101]="VAST_SCHEMA_VALIDATION_ERROR",e[e.VAST_TOO_MANY_REDIRECTS=302]="VAST_TOO_MANY_REDIRECTS",e[e.VAST_TRAFFICKING_ERROR=200]="VAST_TRAFFICKING_ERROR",e[e.VAST_UNEXPECTED_DURATION_ERROR=202]="VAST_UNEXPECTED_DURATION_ERROR",e[e.VAST_UNEXPECTED_LINEARITY=201]="VAST_UNEXPECTED_LINEARITY",e[e.VAST_UNSUPPORTED_VERSION=102]="VAST_UNSUPPORTED_VERSION",e[e.VAST_WRAPPER_ERROR=300]="VAST_WRAPPER_ERROR",e[e.VIDEO_PLAY_ERROR=400]="VIDEO_PLAY_ERROR",e[e.VPAID_ERROR=901]="VPAID_ERROR",e))(Bi||{}),gy=()=>{let e=Y(!1),t=Y(!1),r=Y(null),n=Fr(),i=Fr();return{visible:e,canRetry:t,retry:r,videoRef:n,adContainerRef:i}},_y=Te`
259
- ${ye}
258
+ `,Zu=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:l,src:c}=t,[h,d]=bt(!1),m=b=>{var E,I,w,R;d(!1),l.value=!1,b==="dismiss"?(E=n.value)==null||E.call(n):b==="viewed"&&((I=i.value)==null||I.call(i)),(w=r.value)==null||w.call(r),(R=o.value)==null||R.call(o)},p=()=>{var b;(b=a.value)==null||b.call(a)};return hr("appsrockets_ad_dismissed",()=>m("dismiss")),hr("appsrockets_ad_rewarded",()=>m("viewed")),hr("appsrockets_ad_completed",()=>m("viewed")),hr("appsrockets_ad_skipped",()=>m("viewed")),hr("appsrockets_ad_clicked",b=>{var E;return(E=s.value)==null?void 0:E.call(s,b)}),hr("appsrockets_ad_loaded",()=>d(!0)),l.value?V("div",{className:N_,style:{display:h?"flex":"none"},children:l.value&&V("iframe",{src:c.value,onLoad:p,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 It(e,t,r){return(t=P_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P_(e){var t=L_(e,"string");return typeof t=="symbol"?t:t+""}function L_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Cs=class{constructor(t,r){It(this,"name","APPSROCKETS"),It(this,"initialized",!1),It(this,"initCompleter",null),It(this,"context",void 0),It(this,"adsOverlay",null),It(this,"adsIsShowing",!1),It(this,"lastUnDisplayedAdBreak",null),It(this,"state",Qu()),It(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",a.joliSource),l.get("osType")||l.set("osType",a.osType),l.get("runtimeType")||l.set("runtimeType",a.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",a.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return A(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),at(V(Zu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){var n,i,o,a,s,l,c,h;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let d=p=>{var b,E;(E=(b=this.context).handleLinkClicked)==null||E.call(b,p)},m=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let p=()=>{var I;this.adsIsShowing=!1,(I=t.afterAd)==null||I.call(t)},b=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},E=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};fe(()=>{this.adsIsShowing=!0,this.state.afterAd.value=p,this.state.adBreakDone.value=b,this.state.src.value=this.processUrl(r.params.url,m),this.state.adLinkClicked.value=d,this.state.adError.value=E,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),(c=t.beforeAd)==null||c.call(t);let p=()=>{var P;this.adsIsShowing=!1,(P=t.afterAd)==null||P.call(t)},b={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var P;this.adsIsShowing=!1,b.breakStatus="dismissed",(P=t.adDismissed)==null||P.call(t)},I=()=>{var P;this.adsIsShowing=!1,b.breakStatus="viewed",(P=t.adViewed)==null||P.call(t)},w=()=>{var P;this.adsIsShowing=!1,(P=t.adBreakDone)==null||P.call(t,b)},R=()=>{this.adsIsShowing=!1,b.breakStatus="noAdPreloaded"};fe(()=>{this.state.afterAd.value=p,this.state.adDismissed.value=E,this.state.adViewed.value=I,this.state.adBreakDone.value=w,this.state.adLinkClicked.value=d,this.state.adError.value=R});let O=()=>{var P;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(P=t.adBreakDone)==null||P.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,fe(()=>{this.state.src.value=this.processUrl(r.params.url,m),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(h=t.beforeReward)==null||h.call(t,O);break}}}},ef=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Te(e,t,r){return(t=U_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U_(e){var t=B_(e,"string");return typeof t=="symbol"?t:t+""}function B_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tf=class{constructor(e,t,r){Te(this,"adUnit",void 0),Te(this,"project",void 0),Te(this,"keyValue",void 0),Te(this,"adsContext",null),Te(this,"rewardedSlot",null),Te(this,"rewardedPayload",null),Te(this,"readyEvent",null),Te(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Te(this,"init",()=>{var n;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")||(n=this.rewardedSlot)==null||n.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Te(this,"destroy",n=>{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,n),n!=="ignored"&&(this.adsContext=null)}),Te(this,"reinit",n=>{this.destroy(n),this.init()}),Te(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),Te(this,"handleSlotClosed",n=>{var i,o;if(this.adsContext&&n.slot===this.rewardedSlot){let a=this.rewardedPayload?"viewed":"dismissed";a==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(i=this.adsContext).afterAd)==null||o.call(i),this.withCommand(()=>{this.reinit(a)})}}),Te(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),Te(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),Te(this,"requestAds",n=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=n,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,o,a;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i),(a=this.readyEvent)==null||a.makeRewardedVisible()});else{let i=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=o,this.adsContext.beforeReward(()=>{var a,s,l;(s=(a=this.adsContext)==null?void 0:a.beforeAd)==null||s.call(a),(l=this.readyEvent)==null||l.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=t,this.keyValue=r,ef(),this.withCommand(()=>{this.init()})}};function je(e,t,r){return(t=M_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M_(e){var t=G_(e,"string");return typeof t=="symbol"?t:t+""}function G_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rs=class{constructor(t,r,n){var i=this;je(this,"adUnit",void 0),je(this,"project",void 0),je(this,"keyValue",void 0),je(this,"adsContext",null),je(this,"gamingInterstitialSlot",null),je(this,"readyEvent",null),je(this,"isRetrying",!1),je(this,"withCommand",function(){googletag.cmd.push(...arguments)}),je(this,"init",()=>{var o;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(a=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(o=this.gamingInterstitialSlot)==null||o.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),je(this,"destroy",function(o){var a,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(a=i.adsContext)==null?void 0:a.onEnd)==null||s.call(a,o),o!=="ignored"&&(i.adsContext=null)),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",i.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",i.handleSlotClosed),i.gamingInterstitialSlot&&(googletag.destroySlots([i.gamingInterstitialSlot]),i.gamingInterstitialSlot=null,i.readyEvent=null)}),je(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(o,a),i.init()}),je(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),je(this,"handleSlotClosed",o=>{var a,s;this.adsContext&&this.gamingInterstitialSlot===o.slot&&((s=(a=this.adsContext).afterAd)==null||s.call(a),this.withCommand(()=>{this.reinit("viewed")}))}),je(this,"requestAds",o=>{this.withCommand(()=>{var a,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=o,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((a=o.beforeAd)==null||a.call(o),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)))})}),ef(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Yt(e,t,r){return(t=J_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J_(e){var t=F_(e,"string");return typeof t=="symbol"?t:t+""}function F_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Os=class{constructor(t,r){Yt(this,"name","GOOGLE_GPT"),Yt(this,"context",void 0),Yt(this,"contextInfo",void 0),Yt(this,"initParams",void 0),Yt(this,"rewardAdManager",void 0),Yt(this,"interstitialManager",void 0),Yt(this,"insertScript",()=>{let n="jolibox-google-gpt",i=document.getElementById(n);i||(i=window.document.createElement("script"),i.id=n,i.async=!0,i.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",i.crossOrigin="anonymous",document.head.appendChild(i))}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,this.insertScript()}init(){return A(this,null,function*(){let t=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,r=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,n=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;t&&(this.rewardAdManager=new tf(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Rs(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.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:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a})}});break}default:{if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:a})}});break}}}};function as(e,t,r){return(t=j_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j_(e){var t=H_(e,"string");return typeof t=="symbol"?t:t+""}function H_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ts=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";as(this,"context",void 0),as(this,"placement","GAME"),as(this,"contextInfo",void 0),this.context=t,this.placement=r,this.contextInfo=this.context.getContextInfo()}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:r}}getDevice(){var t,r,n,i;return{platform:(t=this.contextInfo.platform)!=null?t:Ru.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(r=this.contextInfo.hostAppId)!=null?r:"1",model:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",brand:(i=this.contextInfo.deviceBrand)!=null?i:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,r){var n;let i={protocolVersion:"1.0.0",events:[{name:t,type:Su.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Cu.WebSDK};return $v(i)}};function Me(e,t,r){return(t=q_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q_(e){var t=V_(e,"string");return typeof t=="symbol"?t:t+""}function V_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sn=class{constructor(t){Me(this,"context",void 0),Me(this,"adsTrackSerializer",void 0),Me(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new Ts(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:o}=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:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",deviceBrand:(n=this.contextInfo.deviceBrand)!=null?n:"UnknownBrand",dimension:{width:i,height:o}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},$i=class{constructor(t,r){var n=this;Me(this,"context",void 0),Me(this,"contextInfo",void 0),Me(this,"requestContext",void 0),Me(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),Me(this,"pendingAFVAdsInfo",Promise.resolve(null)),Me(this,"doFetchAdsInfo",i=>A(this,null,function*(){var o;let a=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",s=[];switch(i){case"afv":{s=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{s=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{s=["INTERSTITIAL"];break}}let l=i==="afv"?void 0:"cached";console.log("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo start",{type:i,eventName:a,adsTypes:s,name:l,contextData:this.requestContext.getRequestContextData(a),bizParams:this.requestContext.getRequestBizParams()});let{data:c,code:h}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(a),bizParams:this.requestContext.getRequestBizParams(),adsTypes:s,testAdsMode:this.contextInfo.testAdsMode,name:l}});return console.log("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo response",{type:i,code:h,length:(o=c==null?void 0:c.length)!=null?o:null,providers:c==null?void 0:c.map(d=>({provider:d.provider,isNative:d.isNative,seq:d.seq}))}),h==="SUCCESS"||h==="BYPASS_ADS"?{code:h,data:c}:null})),Me(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),Me(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),Me(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),Me(this,"cacheNextAFGAdsInfo",i=>A(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),Me(this,"getAFGAdsInfo",i=>A(this,null,function*(){var o,a;console.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo await cache",{type:i,cacheKey:i==="reward"?"REWARD":"INTERSTITIAL"});let s=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return console.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo resolved",{type:i,code:s==null?void 0:s.code,length:(a=(o=s==null?void 0:s.data)==null?void 0:o.length)!=null?a:null}),this.cacheNextAFGAdsInfo(i),console.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo cacheNext scheduled",{type:i}),s})),Me(this,"getAFVAdsInfo",function(){return A(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let i=yield n.pendingAFVAdsInfo;return n.cacheAFVInfo(),i}else return n.cacheAFVInfo(),yield n.pendingAFVAdsInfo})}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.requestContext=new sn(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function K_(e,t,r){return(t=$_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $_(e){var t=W_(e,"string");return typeof t=="symbol"?t:t+""}function W_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var z_=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e)try{e(...r)}catch(i){console.error("[JoliboxSDK] Callback error:",i)}},Wi=class{constructor(t){this.context=t,K_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=Md(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}getTraceContext(){let t=this.context.getContextInfo();return{platform:t.deviceInfo.platform,nativeSDKVersionCode:t.deviceInfo.nativeSDKVersionCode,objectId:t.objectId}}loadAdsAsync(t){return A(this,null,function*(){try{console.log("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync invoke",{context:this.getTraceContext(),providers:t.providers});let{errNo:r,errMsg:n}=yield Oi("loadAdsAsync",{params:{providers:t.providers}});return console.log("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync response",{context:this.getTraceContext(),providers:t.providers,errNo:r,errMsg:n}),r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return console.error("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync error",{context:this.getTraceContext(),providers:t.providers,error:r}),{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){let t=this.getTraceContext(),r=ji(),n=this.canIUseHelper("loadAdsAsync"),i=this.canIUseHelper("showAdAsync"),o=r&&n&&i;return console.log("[Jolibox SDK Ads][Trace][NativeHelper] canIUse",{context:t,nativeFlag:r,canLoad:n,canShow:i,result:o}),o}showAdAsync(t){return A(this,null,function*(){try{console.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync invoke",{context:this.getTraceContext(),providers:t.providers});let r=yield Oi("showAdAsync",{params:{providers:t.providers}});if(console.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync response",{context:this.getTraceContext(),providers:t.providers,result:r}),r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(console.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync success",{context:this.getTraceContext(),providers:t.providers,uuid:n}),t.callbacks){let i=t.timeout!==void 0?t.timeout:-1,o=null,a=()=>{console.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange cleanup",{context:this.getTraceContext(),uuid:n}),Vd("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=l=>{var c;if(console.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange received",{context:this.getTraceContext(),uuid:n,event:l}),l.UUID!==n)return;let h=(c=t.callbacks)==null?void 0:c[l.event];h&&z_(h,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&a()};qd("onAdsStateChange",s),console.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange registered",{context:this.getTraceContext(),uuid:n,timeoutMs:i}),i>0&&(o=setTimeout(()=>{a(),console.warn(`[JoliboxSDK] Event listener for ad ${n} auto-cleaned after ${i}ms timeout`)},i))}return{code:"SUCCESS",message:"Ad shown successfully"}}catch(r){return console.error("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync error",{context:this.getTraceContext(),providers:t.providers,error:r}),{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(t){try{let{errNo:r,data:n}=Oi("isAdsReadySync",{params:{providers:t.providers}});return r!==0||!n?(console.warn("[Jolibox SDK]isAdsReadySync returned an error or no data"),!1):!0}catch(r){return console.warn("[Jolibox SDK]isAdsReadySync invocation failed:",r),!1}}};function St(e,t,r){return(t=Y_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y_(e){var t=X_(e,"string");return typeof t=="symbol"?t:t+""}function X_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ks=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){St(this,"providers",void 0),St(this,"helper",void 0),St(this,"adsContext",null),St(this,"_isAdsReady",!1),St(this,"init",()=>A(this,null,function*(){let n=this.helper.canIUse();if(console.log("[Jolibox SDK Ads][Trace][Reward] init start",{canIUse:n,providers:this.providers}),n){let i=yield this.helper.loadAdsAsync({providers:this.providers});console.log("[Jolibox SDK Ads][Trace][Reward] init loadAdsAsync result",{providers:this.providers,result:i}),i.code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1}else this._isAdsReady=!1;console.log("[Jolibox SDK Ads][Trace][Reward] init end",{isAdsReady:this._isAdsReady,providers:this.providers})})),St(this,"destroy",n=>{var i,o;console.log("[Jolibox SDK Ads][Trace][Reward] destroy",{breakStatus:n,hasAdsContext:!!this.adsContext,isAdsReady:this._isAdsReady}),this._isAdsReady=!1,(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,n),n!=="ignored"&&(this.adsContext=null)}),St(this,"reinit",n=>A(this,null,function*(){console.log("[Jolibox SDK Ads][Trace][Reward] reinit start",{breakStatus:n,providers:this.providers}),this.destroy(n),yield this.init(),console.log("[Jolibox SDK Ads][Trace][Reward] reinit end",{breakStatus:n,isAdsReady:this._isAdsReady,providers:this.providers})})),St(this,"requestAds",(n,i)=>A(this,null,function*(){if(console.log("[Jolibox SDK Ads][Trace][Reward] requestAds start",{incomingProviders:i,currentProviders:this.providers,isAdsReady:this.isAdsReady,hasAdsContext:!!this.adsContext}),this.adsContext){console.log("[Jolibox SDK Ads][Trace][Reward] requestAds ignored because adsContext exists"),this.destroy("ignored");return}this.adsContext=n,i&&i.length>0&&(this.providers=i,console.log("[Jolibox SDK Ads][Trace][Reward] requestAds replace providers",{providers:this.providers}));try{this.isAdsReady?(console.log("[Jolibox SDK Ads][Trace][Reward] requestAds showAd directly",{providers:this.providers}),this.showAd()):(console.log("[Jolibox SDK Ads][Trace][Reward] requestAds not ready -> reinit only",{providers:this.providers}),yield this.reinit("frequencyCapped"))}catch(o){console.error("[Jolibox SDK Ads][Trace][Reward] requestAds error",{error:o,providers:this.providers}),this.destroy("notReady")}})),St(this,"showAd",()=>{if(console.log("[Jolibox SDK Ads][Trace][Reward] showAd start",{hasAdsContext:!!this.adsContext,providers:this.providers}),!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>A(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=h=>{var d,m,p;i||(i=!0,console.log("[Jolibox SDK Ads][Trace][Reward] showAd terminal",{status:h,rewarded:n,providers:this.providers}),h==="dismissed"&&((d=this.adsContext)==null||d.adDismissed()),(p=(m=this.adsContext)==null?void 0:m.afterAd)==null||p.call(m),this.reinit(h))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var h;n=!0,(h=this.adsContext)==null||h.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}},c=yield this.helper.showAdAsync({providers:this.providers,callbacks:l});console.log("[Jolibox SDK Ads][Trace][Reward] showAd showAdAsync result",{providers:this.providers,result:c}),c.code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new Wi(t),this.init()}};function Ct(e,t,r){return(t=Q_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q_(e){var t=Z_(e,"string");return typeof t=="symbol"?t:t+""}function Z_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xs=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;Ct(this,"providers",void 0),Ct(this,"helper",void 0),Ct(this,"adsContext",null),Ct(this,"_isAdsReady",!1),Ct(this,"init",()=>A(this,null,function*(){let i=this.helper.canIUse();if(console.log("[Jolibox SDK Ads][Trace][Interstitial] init start",{canIUse:i,providers:this.providers}),i){let o=yield this.helper.loadAdsAsync({providers:this.providers});console.log("[Jolibox SDK Ads][Trace][Interstitial] init loadAdsAsync result",{providers:this.providers,result:o}),o.code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1}else this._isAdsReady=!1;console.log("[Jolibox SDK Ads][Trace][Interstitial] init end",{isAdsReady:this._isAdsReady,providers:this.providers})})),Ct(this,"destroy",function(i){var o,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;console.log("[Jolibox SDK Ads][Trace][Interstitial] destroy",{endReason:i,clearContext:s,hasAdsContext:!!n.adsContext,isAdsReady:n._isAdsReady}),n._isAdsReady=!1,s&&((a=(o=n.adsContext)==null?void 0:o.onEnd)==null||a.call(o,i),i!=="ignored"&&(n.adsContext=null))}),Ct(this,"reinit",function(o){return A(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;console.log("[Jolibox SDK Ads][Trace][Interstitial] reinit start",{endReason:i,clearContext:a,providers:n.providers}),n.destroy(i,a),yield n.init(),console.log("[Jolibox SDK Ads][Trace][Interstitial] reinit end",{endReason:i,clearContext:a,isAdsReady:n._isAdsReady,providers:n.providers})})}),Ct(this,"requestAds",(i,o)=>A(this,null,function*(){if(console.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds start",{incomingProviders:o,currentProviders:this.providers,isAdsReady:this.isAdsReady,hasAdsContext:!!this.adsContext}),this.adsContext){console.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds ignored because adsContext exists"),this.destroy("ignored");return}this.adsContext=i,o&&o.length>0&&(this.providers=o,console.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds replace providers",{providers:this.providers}));try{this.isAdsReady?(console.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds showAd directly",{providers:this.providers}),yield this.showAd()):(console.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds not ready -> reinit only",{providers:this.providers}),yield this.reinit("frequencyCapped"))}catch(a){console.error("[Jolibox SDK Ads][Trace][Interstitial] requestAds error",{error:a,providers:this.providers}),this.destroy("notReady")}})),Ct(this,"showAd",()=>A(this,null,function*(){var i,o;if(console.log("[Jolibox SDK Ads][Trace][Interstitial] showAd start",{hasAdsContext:!!this.adsContext,providers:this.providers}),!this.adsContext){this.destroy("error");return}let a=!1;(o=(i=this.adsContext).beforeAd)==null||o.call(i);let s=h=>{var d,m;a||(a=!0,console.log("[Jolibox SDK Ads][Trace][Interstitial] showAd terminal",{status:h,providers:this.providers}),(m=(d=this.adsContext)==null?void 0:d.afterAd)==null||m.call(d),this.reinit(h))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}},c=yield this.helper.showAdAsync({providers:this.providers,callbacks:l});console.log("[Jolibox SDK Ads][Trace][Interstitial] showAd showAdAsync result",{providers:this.providers,result:c}),c.code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new Wi(t),this.init()}};function en(e,t,r){return(t=ey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ey(e){var t=ty(e,"string");return typeof t=="symbol"?t:t+""}function ty(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ds=class{constructor(t,r){en(this,"name","INTERNAL_NATIVE"),en(this,"context",void 0),en(this,"rewardAdManager",void 0),en(this,"interstitialManager",void 0),en(this,"initProviders",void 0),this.context=t,this.initProviders=r.providers;let n=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],r.providers),i=this.getConfigsByTypes(["INTERSTITIAL"],r.providers);console.log("[Jolibox SDK Ads][Trace][NativeProvider] constructor",{initProviders:r.providers.map(o=>({provider:o.provider,adUnitId:o.params.adUnitId,extra:o.params.extra})),rewardProviders:n,interstitialProviders:i}),n.length>0&&(this.rewardAdManager=new ks(this.context,n)),i.length>0&&(this.interstitialManager=new xs(this.context,i))}getConfigsByTypes(t,r,n){var i;let o=[],a=n?n.map(s=>r.find(l=>l.provider===s.provider)).filter(s=>!!s):r;return console.log("[Jolibox SDK Ads][Trace][NativeProvider] getConfigsByTypes",{adsTypes:t,adBreakServerProviders:(i=n==null?void 0:n.map(s=>s.provider))!=null?i:null,baseProviders:a.map(s=>({provider:s.provider,adUnitId:s.params.adUnitId}))}),a.forEach(s=>{t.forEach(l=>{let c="";l==="REWARD"&&(c=s.params.adUnitId.reward),l==="REWARD_INTERSTITIAL"&&(c=s.params.adUnitId.rewardInterstitial),l==="INTERSTITIAL"&&(c=s.params.adUnitId.interstitial),l==="NATIVE"&&(c=s.params.adUnitId.nativeAds),c&&o.push({provider:s.provider,params:{placementId:c,adsType:l,extra:s.params.extra}})})}),console.log("[Jolibox SDK Ads][Trace][NativeProvider] getConfigsByTypes result",{adsTypes:t,configs:o}),o}init(){return A(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(console.log("[Jolibox SDK Ads][Trace][NativeProvider] adBreak start",{type:t.type,name:"name"in t?t.name:void 0,serverProviders:r.params.map(a=>a.provider),hasRewardManager:!!this.rewardAdManager,hasInterstitialManager:!!this.interstitialManager}),t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}let a=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],this.initProviders,r.params);console.log("[Jolibox SDK Ads][Trace][NativeProvider] reward orderedConfigs",{type:t.type,orderedConfigs:a}),this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:s=>{var l;(l=t.adBreakDone)==null||l.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:s})}},a);break}default:{let a=t;if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);console.log("[Jolibox SDK Ads][Trace][NativeProvider] interstitial orderedConfigs",{type:t.type,orderedConfigs:s}),this.interstitialManager.requestAds({beforeAd:a.beforeAd,afterAd:a.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}},ss="jolibox-nb-proxy",ry=0;function ny(e,t){return t==="call"&&e.join(".")==="GameSDK.showRewardAd"?0:15e3}function gu(e,t,r,n){return new Promise((i,o)=>{if(!window.parent||window.parent===window){o(new Error("[ParentProxy] No parent window"));return}let a=`${ss}-${++ry}`,s=h=>{let d=h.data;(d==null?void 0:d.type)===`${ss}:response`&&d.id===a&&(window.removeEventListener("message",s),c&&clearTimeout(c),d.error?o(new Error(d.error)):i(d.result))},l=ny(e,t),c=l>0?window.setTimeout(()=>{window.removeEventListener("message",s),o(new Error(`[ParentProxy] Timeout after ${l}ms: ${e.join(".")}.${t}`))},l):null;window.addEventListener("message",s),window.parent.postMessage({type:`${ss}:request`,id:a,path:e,action:t,args:r,value:n},"*")})}function rf(e){return console.log("[JoliboxSDK] NewsBreak createProxyForPath basePath:",e),new Proxy(()=>{},{get(t,r){if(console.log("[JoliboxSDK] NewsBreak createProxyForPath get:",r),!(r==="then"||r==="toJSON"||typeof r=="symbol"))return rf([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),gu([...e,r],"set",void 0,n).catch(i=>{console.warn(`[ParentProxy] set ${[...e,r].join(".")} failed:`,i)}),!0},apply(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath apply:",n),gu(e,"call",n)}})}function iy(e){return rf([e])}var Gi=()=>{try{if(window.parent&&window.parent!==window)return iy("GameSDK")}catch(e){}};function pr(e,t,r){return(t=oy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oy(e){var t=ay(e,"string");return typeof t=="symbol"?t:t+""}function ay(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ns=class{constructor(){pr(this,"adsContext",null),pr(this,"init",()=>A(this,null,function*(){console.log("[JoliboxSDK] NewsBreak init");let t=Gi();if(t)try{let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r)}catch(r){console.log("[JoliboxSDK] NewsBreak init createRewardAd error:",r)}})),pr(this,"destroy",t=>{var r,n;(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),pr(this,"reinit",t=>A(this,null,function*(){console.log("[JoliboxSDK] NewsBreak reinit breakStatus:",t),this.destroy(t),yield this.init()})),pr(this,"requestAds",t=>A(this,null,function*(){if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Gi();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}this.showAd()})),pr(this,"showAd",()=>{if(console.log("[JoliboxSDK] NewsBreak showAd"),!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>A(this,null,function*(){var t,r,n,i,o,a,s,l,c,h,d,m,p,b;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let E=Gi();if(!E){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let I=yield E.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",I),!I.success){(a=(o=this.adsContext)==null?void 0:o.afterAd)==null||a.call(o),this.reinit("error");return}I.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(c=(l=this.adsContext)==null?void 0:l.afterAd)==null||c.call(l),this.reinit("viewed")):((h=this.adsContext)==null||h.adDismissed(),(m=(d=this.adsContext)==null?void 0:d.afterAd)==null||m.call(d),this.reinit("dismissed"))}catch(I){console.error("[JoliboxSDK] NewsBreak showRewardAd failed:",I),(b=(p=this.adsContext)==null?void 0:p.afterAd)==null||b.call(p),this.reinit("error")}}))}),this.init()}};function _u(e,t,r){return(t=sy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sy(e){var t=ly(e,"string");return typeof t=="symbol"?t:t+""}function ly(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ps=class{constructor(){_u(this,"name","NEWSBREAK"),_u(this,"rewardAdManager",void 0)}init(){return A(this,null,function*(){let t=Gi();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new Ns})}adConfig(t,r){}adBreak(t,r){var n,i;if(t.type!=="reward"){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:o=>{var a;(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o})}})}};function et(e,t,r){return(t=cy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cy(e){var t=dy(e,"string");return typeof t=="symbol"?t:t+""}function dy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ln=class{constructor(t){if(et(this,"context",void 0),et(this,"contextInfo",void 0),et(this,"providers",{}),et(this,"channelPolicy",void 0),et(this,"adsActionDetection",void 0),et(this,"requestContext",void 0),et(this,"adsRequest",void 0),et(this,"initialized",!1),et(this,"adsIsShowing",!1),et(this,"lastAdBreak",void 0),et(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new ms(this.context),this.adsActionDetection=new ps(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new $i(t),this.requestContext=new sn(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return A(this,null,function*(){window.adsbygoogle=window.adsbygoogle||[];let{data:r}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if((r==null?void 0:r.length)>0){let n=r.filter(s=>s.isNative),i=r.filter(s=>!s.isNative),o={provider:"INTERNAL_NATIVE",params:{providers:n}},a=i.concat([o]);for(let s of a)switch(s.provider){case"GOOGLE_GPT":{let l=new Os(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"ADSENSE":case"ADSENSE_ADMOB":{let l=new vs(this.context,s.params);yield l.init(),this.providers[s.provider]=l;break}case"OKSPIN":{let l=new Is(this.context,s.params);yield l.init(),this.providers.OKSPIN=l;break}case"APPSROCKETS":{let l=new Cs(this.context,s.params);yield l.init(),this.providers.APPSROCKETS=l;break}case"ADSENSE_BANNER_AS_AFG":{let l=new Ss(this.context,s.params);yield l.init(),this.providers.ADSENSE_BANNER_AS_AFG=l;break}case"INTERNAL_NATIVE":{let l=new Ds(this.context,s.params);yield l.init(),this.providers.INTERNAL_NATIVE=l;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",s);let l=new Ps;yield l.init(),this.providers.NEWSBREAK=l;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 A(this,null,function*(){var r,n,i,o,a,s,l,c,h,d,m,p,b,E,I,w,R,O;let P=Date.now(),B=P-this.initializedTimeStamp;if(console.log("[Jolibox SDK Ads][Trace] adBreak:start",{type:t.type,name:t.type==="preroll"?void 0:t.name,initialized:this.initialized,adsIsShowing:this.adsIsShowing,diffToInitialized:B,lastAdBreakDiff:this.lastAdBreak?P-this.lastAdBreak:null}),B<3e3){console.log("[Jolibox SDK Ads][Trace] adBreak:blocked too soon",{type:t.type,diffToInitialized:B}),(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:"noAdPreloaded"});return}if(this.lastAdBreak&&P-this.lastAdBreak<500){console.warn("[Jolibox SDK Ads][Trace] adBreak:blocked too frequently",{type:t.type,interval:P-this.lastAdBreak}),(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:"frequencyCapped"});return}if(this.lastAdBreak=P,this.adsIsShowing){console.warn("[Jolibox SDK Ads][Trace] adBreak:blocked ad is showing",{type:t.type}),(i=t.adBreakDone)==null||i.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||(console.log("[Jolibox SDK Ads][Trace] adBreak:init begin",{type:t.type}),yield this.init(),console.log("[Jolibox SDK Ads][Trace] adBreak:init end",{type:t.type,providerKeys:Object.keys(this.providers)})),t.type!=="reward"){let S=this.channelPolicy.shouldBypassCallingInterstitial();if(console.log("[Jolibox SDK Ads][Trace] adBreak:channelPolicy",{type:t.type,shouldBypassCallingInterstitial:S}),!S){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}}if(!this.context.checkNetwork()&&!this.providers.NEWSBREAK){console.log("[Jolibox SDK Ads][Trace] adBreak:blocked network not ready",{type:t.type,hasNewsBreak:!!this.providers.NEWSBREAK}),(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:"noAdPreloaded"});return}try{console.log("[Jolibox SDK Ads][Trace] adBreak:getAFGAdsInfo begin",{type:t.type});let S=yield this.adsRequest.getAFGAdsInfo(t.type),D=S==null?void 0:S.data,J=S==null?void 0:S.code;if(console.log("[Jolibox SDK Ads][Trace] adBreak:getAFGAdsInfo end",{type:t.type,code:J,length:(s=D==null?void 0:D.length)!=null?s:null,nativeCount:(l=D==null?void 0:D.filter(H=>H.isNative).length)!=null?l:null,providers:D==null?void 0:D.map(H=>({provider:H.provider,isNative:H.isNative,seq:H.seq}))}),J==="BYPASS_ADS"){switch(console.log("[Jolibox SDK Ads][Trace] adBreak:bypass",{type:t.type}),t.type){case"preroll":{(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{t.beforeReward(()=>{var H,L,G,F;(H=t.beforeAd)==null||H.call(t),(L=t.adViewed)==null||L.call(t),(G=t.afterAd)==null||G.call(t),(F=t.adBreakDone)==null||F.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(h=t.beforeAd)==null||h.call(t),(d=t.afterAd)==null||d.call(t),(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!D||J!=="SUCCESS"){console.log("[Jolibox SDK Ads][Trace] adBreak:ads info invalid",{type:t.type,code:J,hasData:!!D}),(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}else{if(D.length===0){console.log("[Jolibox SDK Ads][Trace] adBreak:ads info empty",{type:t.type}),(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let H=!0,L=null,G=new hs(this.context);this.adsActionDetection.adBreakIsShowing=!0;let F=D.filter(Q=>Q.isNative).sort((Q,Ne)=>Q.seq-Ne.seq),Y=D.filter(Q=>!Q.isNative).sort((Q,Ne)=>Q.seq-Ne.seq);console.log("[Jolibox SDK Ads][Trace] adBreak:provider options",{type:t.type,nativeOptions:F.map(Q=>({provider:Q.provider,seq:Q.seq})),webOptions:Y.map(Q=>({provider:Q.provider,seq:Q.seq}))});let X={seq:(I=(E=F[0])==null?void 0:E.seq)!=null?I:0,provider:"INTERNAL_NATIVE",params:F},ye;for(F.length>0?ye=[X].concat(Y):ye=Y,ye=ye.sort((Q,Ne)=>Q.seq-Ne.seq).map((Q,Ne)=>Sv(wu({},Q),{seq:Ne})),console.log("[Jolibox SDK Ads][Trace] adBreak:final options",{type:t.type,finalOptions:ye.map(Q=>({provider:Q.provider,seq:Q.seq}))});ye.length>0;){let Q=ye.shift(),Ne=this.providers[Q.provider];if(console.log("[Jolibox SDK Ads][Trace] adBreak:provider loop",{type:t.type,optionProvider:Q.provider,optionSeq:Q.seq,providerFound:!!Ne}),Ne){let[ut,Sr]=yield G.callAdBreakAndContinue(Ne,t,Q,gn=>{var _n;this.adsIsShowing=gn,(_n=this.context.eventEmitter)==null||_n.emit("isAdShowing",gn)});H=ut,L=Sr,console.log("[Jolibox SDK Ads][Trace] adBreak:provider result",{type:t.type,provider:Q.provider,shouldContinue:ut,placementInfo:Sr})}else H=!0,L={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!H)break}H&&L&&(console.log("[Jolibox SDK Ads][Trace] adBreak:trailing adBreakDone",{type:t.type,placementInfo:L}),(w=t.adBreakDone)==null||w.call(t,L))}}catch(S){console.log("[Jolibox SDK Ads][Trace] adBreak:error",{type:t.type,error:S}),(R=t.adBreakDone)==null||R.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{console.log("[Jolibox SDK Ads][Trace] adBreak:finally",{type:t.type,adsIsShowingBeforeReset:this.adsIsShowing}),this.adsIsShowing=!1,(O=this.context.eventEmitter)==null||O.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.")}};function Di(e,t,r){return(t=uy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uy(e){var t=fy(e,"string");return typeof t=="symbol"?t:t+""}function fy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ls=class{constructor(t){Di(this,"context",void 0),Di(this,"currentProvider",void 0),Di(this,"continueCallback",void 0),Di(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo()}get paramsToTrack(){var t,r;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null}}wrapAdRequested(t){return()=>{this.context.track("CallAFVRequest",this.paramsToTrack),t==null||t()}}wrapAdLoaded(t){return r=>{this.context.track("CallAFVLoad",this.paramsToTrack),t==null||t(r)}}wrapAdPlaying(t){return r=>{var n,i;this.context.track("CallAFVPlaying",this.paramsToTrack),ji()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"AFV",module:"drama",game_id:this.contextInfo.objectId}),t==null||t(r)}}wrapAdCompleted(t){return r=>{var n;this.context.track("CallAFVCompleted",this.paramsToTrack),t==null||t(r),(n=this.continueCallback)==null||n.call(this,[!1,null])}}wrapAdError(t){return r=>{var n;this.context.track("CallAFVError",this.paramsToTrack),(n=this.continueCallback)==null||n.call(this,[!0,r])}}callAdRequestAndContinue(t,r,n){return A(this,null,function*(){return this.currentProvider=t,new Promise(i=>{this.continueCallback=i;let o=Object.assign({},r);o.onAdRequested=this.wrapAdRequested(r.onAdRequested),o.onAdLoaded=this.wrapAdLoaded(r.onAdLoaded),o.onAdPlaying=this.wrapAdPlaying(r.onAdPlaying),o.onAdCompleted=this.wrapAdCompleted(r.onAdCompleted),o.onAdError=this.wrapAdError(r.onAdError),t.requestAd(o,n)})})}};function ls(e,t,r){return(t=hy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hy(e){var t=py(e,"string");return typeof t=="symbol"?t:t+""}function py(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xe=class e extends Error{constructor(t,r){super(t.message),ls(this,"name",void 0),ls(this,"type",void 0),ls(this,"raw",void 0),this.name="AFVRequestError",this.type=r,this.raw=t,this.stack=t.stack,this.message=t.message}static from(t,r){switch(r){case"GOOGLE_IMA_ERROR":return new e(t,r);case"JOLIBOX_IMA_ERROR":return new e(t,r)}}};function ae(e,t,r){return(t=my(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function my(e){var t=vy(e,"string");return typeof t=="symbol"?t:t+""}function vy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Us=class{constructor(t,r,n){ae(this,"adsLoader",void 0),ae(this,"adDisplayContainer",void 0),ae(this,"isAdPlaying",!1),ae(this,"isContentFinished",!1),ae(this,"videoContent",void 0),ae(this,"adContainer",void 0),ae(this,"adsManager",void 0),ae(this,"intervalTimer",void 0),ae(this,"completed",!1),ae(this,"adTagUrl",void 0),ae(this,"notifyRequestAd",void 0),ae(this,"notifyLoaded",void 0),ae(this,"notifyPlayingAd",void 0),ae(this,"notifyCompleted",void 0),ae(this,"notifyError",void 0),ae(this,"destroy",()=>{var i,o,a,s,l,c,h,d,m,p,b;this.intervalTimer&&clearInterval(this.intervalTimer),(i=this.adsManager)==null||i.stop(),(o=this.adDisplayContainer)==null||o.destroy(),(a=this.adsLoader)==null||a.removeEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded),(s=this.adsLoader)==null||s.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(l=this.adsManager)==null||l.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(c=this.adsManager)==null||c.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),(h=this.adsManager)==null||h.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),(d=this.adsManager)==null||d.removeEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),(m=this.adsManager)==null||m.removeEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),(p=this.adsManager)==null||p.removeEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),(b=this.adsManager)==null||b.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent)}),ae(this,"requestAds",(i,o)=>A(this,null,function*(){var a;this.createAdDisplayContainer(),this.notifyRequestAd=i.onAdRequested,this.notifyLoaded=i.onAdLoaded,this.notifyPlayingAd=i.onAdPlaying,this.notifyCompleted=i.onAdCompleted,this.notifyError=d=>{var m;return(m=i.onAdError)==null?void 0:m.call(i,xe.from(d,"GOOGLE_IMA_ERROR"))},this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded,!1),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError,!1);let s=()=>{var d;this.isAdPlaying||(this.isContentFinished=!0,(d=this.adsLoader)==null||d.contentComplete())};this.videoContent.onended=s;let l=new window.google.ima.AdsRequest;l.vastLoadTimeout=1e4;let c="";Object.keys(o.params).forEach(d=>{let m=window.encodeURIComponent(o.params[d]);c+=`&${d}=${m}`});let h=`${this.adTagUrl}${c}`;l.adTagUrl=h,l.linearAdSlotWidth=640,l.linearAdSlotHeight=400,l.nonLinearAdSlotWidth=640,l.nonLinearAdSlotHeight=150,this.adsLoader.requestAds(l),(a=this.notifyRequestAd)==null||a.call(this)})),ae(this,"createAdDisplayContainer",()=>{this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoContent)}),ae(this,"playAds",()=>{var i,o;this.videoContent.load(),this.adDisplayContainer.initialize(),this.completed=!1;try{(i=this.adsManager)==null||i.init(window.document.body.clientWidth,window.document.body.clientHeight,window.google.ima.ViewMode.NORMAL),(o=this.adsManager)==null||o.start()}catch(a){console.error("[JoliboxAFV] Google IMA Error: ",a),this.videoContent.play()}}),ae(this,"onAdsManagerLoaded",i=>{let o=new window.google.ima.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.loadVideoTimeout=1e4,this.adsManager=i.getAdsManager(this.videoContent,o),this.adsManager.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent),i.type==="adsManagerLoaded"&&this.playAds()}),ae(this,"onAdEvent",i=>{var o,a,s,l;let c=i.getAd();switch(i.type){case window.google.ima.AdEvent.Type.LOADED:c!=null&&c.isLinear()||this.videoContent.play(),(o=this.notifyLoaded)==null||o.call(this,i);break;case window.google.ima.AdEvent.Type.STARTED:c!=null&&c.isLinear()&&(this.intervalTimer=window.setInterval(function(){},300)),(a=this.notifyPlayingAd)==null||a.call(this,i);break;case window.google.ima.AdEvent.Type.COMPLETE:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(s=this.notifyCompleted)==null||s.call(this,i));break;case window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(l=this.notifyCompleted)==null||l.call(this,i));break}}),ae(this,"onAdError",i=>{var o,a;(o=this.notifyError)==null||o.call(this,i.getError()),(a=this.adsManager)==null||a.destroy()}),ae(this,"onContentPauseRequested",()=>{this.isAdPlaying=!0,this.videoContent.pause()}),ae(this,"onContentResumeRequested",()=>{this.isAdPlaying=!1}),this.adTagUrl=t,this.videoContent=r,this.adContainer=n}},Ji=(e=>(e[e.ADS_REQUEST_NETWORK_ERROR=1012]="ADS_REQUEST_NETWORK_ERROR",e[e.ASSET_FALLBACK_FAILED=1021]="ASSET_FALLBACK_FAILED",e[e.AUTOPLAY_DISALLOWED=1205]="AUTOPLAY_DISALLOWED",e[e.COMPANION_AD_LOADING_FAILED=603]="COMPANION_AD_LOADING_FAILED",e[e.COMPANION_REQUIRED_ERROR=602]="COMPANION_REQUIRED_ERROR",e[e.FAILED_TO_REQUEST_ADS=1005]="FAILED_TO_REQUEST_ADS",e[e.INVALID_AD_TAG=1013]="INVALID_AD_TAG",e[e.INVALID_ADX_EXTENSION=1105]="INVALID_ADX_EXTENSION",e[e.INVALID_ARGUMENTS=1101]="INVALID_ARGUMENTS",e[e.NONLINEAR_DIMENSIONS_ERROR=501]="NONLINEAR_DIMENSIONS_ERROR",e[e.OVERLAY_AD_LOADING_FAILED=502]="OVERLAY_AD_LOADING_FAILED",e[e.OVERLAY_AD_PLAYING_FAILED=500]="OVERLAY_AD_PLAYING_FAILED",e[e.STREAM_INITIALIZATION_FAILED=1020]="STREAM_INITIALIZATION_FAILED",e[e.UNKNOWN_AD_RESPONSE=1010]="UNKNOWN_AD_RESPONSE",e[e.UNKNOWN_ERROR=900]="UNKNOWN_ERROR",e[e.UNSUPPORTED_LOCALE=1011]="UNSUPPORTED_LOCALE",e[e.VAST_ASSET_NOT_FOUND=1007]="VAST_ASSET_NOT_FOUND",e[e.VAST_EMPTY_RESPONSE=1009]="VAST_EMPTY_RESPONSE",e[e.VAST_LINEAR_ASSET_MISMATCH=403]="VAST_LINEAR_ASSET_MISMATCH",e[e.VAST_LOAD_TIMEOUT=301]="VAST_LOAD_TIMEOUT",e[e.VAST_MALFORMED_RESPONSE=100]="VAST_MALFORMED_RESPONSE",e[e.VAST_MEDIA_LOAD_TIMEOUT=402]="VAST_MEDIA_LOAD_TIMEOUT",e[e.VAST_NO_ADS_AFTER_WRAPPER=303]="VAST_NO_ADS_AFTER_WRAPPER",e[e.VAST_NONLINEAR_ASSET_MISMATCH=503]="VAST_NONLINEAR_ASSET_MISMATCH",e[e.VAST_PROBLEM_DISPLAYING_MEDIA_FILE=405]="VAST_PROBLEM_DISPLAYING_MEDIA_FILE",e[e.VAST_SCHEMA_VALIDATION_ERROR=101]="VAST_SCHEMA_VALIDATION_ERROR",e[e.VAST_TOO_MANY_REDIRECTS=302]="VAST_TOO_MANY_REDIRECTS",e[e.VAST_TRAFFICKING_ERROR=200]="VAST_TRAFFICKING_ERROR",e[e.VAST_UNEXPECTED_DURATION_ERROR=202]="VAST_UNEXPECTED_DURATION_ERROR",e[e.VAST_UNEXPECTED_LINEARITY=201]="VAST_UNEXPECTED_LINEARITY",e[e.VAST_UNSUPPORTED_VERSION=102]="VAST_UNSUPPORTED_VERSION",e[e.VAST_WRAPPER_ERROR=300]="VAST_WRAPPER_ERROR",e[e.VIDEO_PLAY_ERROR=400]="VIDEO_PLAY_ERROR",e[e.VPAID_ERROR=901]="VPAID_ERROR",e))(Ji||{}),gy=()=>{let e=W(!1),t=W(!1),r=W(null),n=jr(),i=jr();return{visible:e,canRetry:t,retry:r,videoRef:n,adContainerRef:i}},_y=De`
259
+ ${we}
260
260
  position: fixed;
261
261
  left: 0;
262
262
  top: 0;
@@ -267,7 +267,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
267
267
  height: 100vh;
268
268
 
269
269
  .ads-wrapper {
270
- ${ye}
270
+ ${we}
271
271
  position: relative;
272
272
  width: 100%;
273
273
  height: 100%;
@@ -290,7 +290,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
290
290
  }
291
291
 
292
292
  .retry-button {
293
- ${ye}
293
+ ${we}
294
294
  position: absolute;
295
295
  width: 100%;
296
296
  height: 100%;
@@ -300,7 +300,7 @@ or `);this.errors.push(o)}return n}},Hn=class extends ve{constructor(...t){super
300
300
  cursor: pointer;
301
301
  }
302
302
  }
303
- `,yy=e=>{let{onReady:t,state:r}=e,{visible:n,retry:i,canRetry:o,videoRef:a,adContainerRef:s}=r,l=()=>{i.value&&(i.value(),ue(()=>{i.value=null,o.value=!1}))};return xt(()=>{t()},[t]),$("div",{className:_y,style:{display:n.value?"block":"none"},children:$("div",{className:"ads-wrapper",children:[$("video",{ref:a,width:"100%",height:"100%",playsInline:!0,"webkit-playsinline":"true",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAD0lEQVR4AQEEAPv/AAAAAAAEAAFlScNgAAAAAElFTkSuQmCC",style:{transition:"none !important",transform:"none !important",animation:"none !important",objectFit:"contain"}}),$("div",{id:"ad-container",ref:s}),o.value?$("div",{className:"retry-button",onClick:l,children:$("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[$("circle",{cx:"32",cy:"32",r:"32",fill:"#141416",fillOpacity:"0.3"}),$("path",{d:"M25.3334 23.3668V40.6334C25.3334 41.9501 26.7834 42.7501 27.9 42.0334L41.4667 33.4001C42.5 32.7501 42.5 31.2501 41.4667 30.5834L27.9 21.9668C26.7834 21.2501 25.3334 22.0501 25.3334 23.3668Z",fill:"white"})]})}):null]})})};function St(e,t,r){return(t=by(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function by(e){var t=wy(e,"string");return typeof t=="symbol"?t:t+""}function wy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ds=class{constructor(t){St(this,"name","GOOGLE_IMA"),St(this,"context",void 0),St(this,"adsOverlay",null),St(this,"initialized",!1),St(this,"ima",null),St(this,"state",gy()),St(this,"init",r=>E(this,null,function*(){if(this.initialized)return;let n="//imasdk.googleapis.com/js/sdkloader/ima3.js";yield new Promise((i,o)=>{if(document.querySelector("#google-ima-sdk")){i();return}else{let a=document.createElement("script");a.id="google-ima-sdk",a.src=n,a.onload=()=>{var s;(s=window.google)!=null&&s.ima?i():setTimeout(i,100)},a.onerror=o,document.head.appendChild(a)}}),this.adsOverlay=document.createElement("div"),this.adsOverlay.id="jolibox-ima-overlay",document.documentElement.appendChild(this.adsOverlay),yield new Promise((i,o)=>{it($(yy,{state:this.state,onReady:()=>{this.ima=new Ps(r.params.url,this.state.videoRef.current,this.state.adContainerRef.current),i()}}),this.adsOverlay)}),this.initialized=!0})),St(this,"destroy",()=>{this.adsOverlay&&(it(null,this.adsOverlay),this.adsOverlay.remove()),this.ima&&this.ima.destroy(),this.initialized=!1}),St(this,"requestAd",(r,n)=>{var i;if(!this.adsOverlay||!this.ima||!this.initialized){let m=ke.from(new Error("IMA not initialized"),"JOLIBOX_IMA_ERROR");(i=r.onAdError)==null||i.call(r,m);return}let o=m=>{var d;this.ima.destroy(),this.state.visible.value=!1,(d=r.onAdCompleted)==null||d.call(r,m)},a=m=>{var d;let p=!1;switch(m.raw.getErrorCode()){case Bi.AUTOPLAY_DISALLOWED:case Bi.VIDEO_PLAY_ERROR:case Bi.ADS_REQUEST_NETWORK_ERROR:{p=!0;break}default:{p=!1;break}}if(!p)this.ima.destroy(),ue(()=>{this.state.canRetry.value=!1,this.state.retry.value=null,this.state.visible.value=!1}),(d=r.onAdError)==null||d.call(r,m);else{let h=()=>{this.ima.destroy(),this.requestAd(r,n)};ue(()=>{this.state.canRetry.value=!0,this.state.retry.value=h})}},s=m=>{var d;this.state.visible.value=!0,(d=r.onAdLoaded)==null||d.call(r,m)},l=m=>{var d;(d=r.onAdPlaying)==null||d.call(r,m)},c=Object.assign({},r);c.onAdCompleted=o,c.onAdError=a,c.onAdLoaded=s,c.onAdPlaying=l,this.ima.requestAds(c,n)}),this.context=t}};function ot(e,t,r){return(t=Ey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ey(e){var t=Iy(e,"string");return typeof t=="symbol"?t:t+""}function Iy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ls=class{constructor(t){ot(this,"name","OKSPIN"),ot(this,"initialized",!1),ot(this,"initCompleter",null),ot(this,"context",void 0),ot(this,"adsOverlay",null),ot(this,"adsIsShowing",!1),ot(this,"state",Wu()),ot(this,"init",r=>E(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv"),it($(zu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),ot(this,"destroy",()=>{var r;this.adsOverlay&&(it(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),ot(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,ke.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,ke.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var m;this.adsIsShowing=!1,(m=r.onAdCompleted)==null||m.call(r,void 0)},c=()=>{var m;(m=r.onAdLoaded)==null||m.call(r,void 0)};this.adsIsShowing=!0,ue(()=>{var m;this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.countdown.value=(m=n.params.countdown)!=null?m:15,this.state.src.value=n.params.url,this.state.mode.value="rewarded_insterstitial",this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function Ze(e,t,r){return(t=Ay(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ay(e){var t=Sy(e,"string");return typeof t=="symbol"?t:t+""}function Sy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Us=class{constructor(t){Ze(this,"name","APPSROCKETS"),Ze(this,"initialized",!1),Ze(this,"initCompleter",null),Ze(this,"context",void 0),Ze(this,"adsOverlay",null),Ze(this,"adsIsShowing",!1),Ze(this,"state",Yu()),Ze(this,"processUrl",r=>{var n;let i=this.context.getContextInfo(),o=new URL(r),a=new URLSearchParams(o.search);return a.has("joliSource")||a.set("joliSource",i.joliSource),a.get("osType")||a.set("osType",i.osType),a.get("runtimeType")||a.set("runtimeType",i.runtimeType),a.get("mode")||a.set("mode","AFV"),a.get("deviceId")||a.set("deviceId",i.deviceId),a.get("statusBarHeight")||a.set("statusBarHeight",((n=this.context.getWindowInfo().statusBarHeight)!=null?n:0).toString()),a.get("adsType")||a.set("adsType","REWARD_INTERSTITIAL"),o.search=a.toString(),o.toString()}),Ze(this,"init",r=>E(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv-appsrockets"),it($(Xu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),Ze(this,"destroy",()=>{var r;this.adsOverlay&&(it(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),Ze(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,ke.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,ke.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var p;this.adsIsShowing=!1,(p=r.onAdCompleted)==null||p.call(r,void 0)},c=()=>{var p;(p=r.onAdLoaded)==null||p.call(r,void 0)},m=p=>{var h,b;(b=(h=this.context).handleLinkClicked)==null||b.call(h,p)},d=()=>{var p;(p=r.onAdError)==null||p.call(r,ke.from(new Error("Ads load error"),"JOLIBOX_IMA_ERROR"))};this.adsIsShowing=!0,ue(()=>{this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.adLinkClicked.value=m,this.state.adError.value=d,this.state.src.value=this.processUrl(n.params.url),this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function Pt(e,t,r){return(t=Cy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Cy(e){var t=Ry(e,"string");return typeof t=="symbol"?t:t+""}function Ry(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Bs=class{constructor(t){Pt(this,"name","GOOGLE_GPT"),Pt(this,"context",void 0),Pt(this,"contextInfo",void 0),Pt(this,"rewardAdManager",void 0),Pt(this,"init",r=>E(this,null,function*(){if(!this.rewardAdManager){let n=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":r.params.rewardedSlot,i=`minidrama-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;this.rewardAdManager=new Zu(n,i,r.params.keyValue)}})),Pt(this,"insertScript",()=>{let r="jolibox-google-gpt",n=document.getElementById(r);n||(n=window.document.createElement("script"),n.id=r,n.async=!0,n.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",n.crossOrigin="anonymous",document.head.appendChild(n))}),Pt(this,"destroy",()=>{var r;(r=this.rewardAdManager)==null||r.withCommand(()=>{var n;(n=this.rewardAdManager)==null||n.destroy("ignored")})}),Pt(this,"requestAd",(r,n)=>{var i;if(!this.rewardAdManager){(i=r.onAdError)==null||i.call(r,ke.from(new Error("rewardAdManager not initialized"),"JOLIBOX_IMA_ERROR"));return}this.rewardAdManager.requestAds({beforeAd:r.onAdRequested,beforeReward:o=>{var a,s;(a=r.onAdLoaded)==null||a.call(r,void 0),o(),(s=r.onAdPlaying)==null||s.call(r,void 0)},adDismissed:()=>{},adViewed:()=>{},adBreakDone:o=>{var a,s;switch(o){case"viewed":{(a=r.onAdCompleted)==null||a.call(r,void 0);break}case"ignored":break;default:{(s=r.onAdError)==null||s.call(r,ke.from(new Error(o),"JOLIBOX_IMA_ERROR"));break}}}})}),this.context=t,this.contextInfo=t.getContextInfo(),this.insertScript()}};function at(e,t,r){return(t=Oy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oy(e){var t=ky(e,"string");return typeof t=="symbol"?t:t+""}function ky(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $i=class e{constructor(t){if(at(this,"context",void 0),at(this,"contextInfo",void 0),at(this,"providers",{}),at(this,"requestContext",void 0),at(this,"adsRequest",void 0),at(this,"initialized",!1),at(this,"preloadedAd",null),at(this,"shouldCache",!1),t)this.context=t,this.requestContext=new an(t),this.adsRequest=new qi(t,{reward:!1,interstitial:!1,afv:!1}),this.contextInfo=this.context.getContextInfo();else throw new Error("JoliboxAdsForVideo requires a configuration object")}init(){return E(this,arguments,function*(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r,n=sessionStorage.getItem(e.STORAGE_KEY_INIT);if(n){sessionStorage.removeItem(e.STORAGE_KEY_INIT);try{r=JSON.parse(n)}catch(i){}}if(r!=null&&r.length||(r=(yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFVSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}})).data),t&&r!=null&&r.length)try{sessionStorage.setItem(e.STORAGE_KEY_INIT,JSON.stringify(r))}catch(i){}if((r==null?void 0:r.length)>0)for(let i of r)switch(i.provider){case"GOOGLE_GPT":{let o=new Bs(this.context);yield o.init(i),this.providers.GOOGLE_GPT=o;break}case"GOOGLE_IMA":{let o=new Ds(this.context);yield o.init(i),this.providers.GOOGLE_IMA=o;break}case"OKSPIN":{let o=new Ls(this.context);yield o.init(i),this.providers.OKSPIN=o;break}case"APPSROCKETS":{let o=new Us(this.context);yield o.init(i),this.providers.APPSROCKETS=o;break}}this.adsRequest.cacheAFVInfo(),this.initialized=!0,this.shouldCache=t,this.preload()})}preload(){let t=sessionStorage.getItem(e.STORAGE_KEY_INFO);if(t){sessionStorage.removeItem(e.STORAGE_KEY_INFO);try{this.preloadedAd=JSON.parse(t);return}catch(r){}}this.adsRequest.getAFVAdsInfo(!0).then(r=>{if(console.log("[JoliboxSDK] afv preload adsInfo:",r),this.preloadedAd=r,this.shouldCache&&r)try{sessionStorage.setItem(e.STORAGE_KEY_INFO,JSON.stringify(r))}catch(n){}}).catch(()=>{this.preloadedAd=null})}destroy(){let t=Object.values(this.providers);for(let r of t)r.destroy();this.initialized=!1,this.preloadedAd=null}requestAd(t){return E(this,null,function*(){var r,n,i,o,a,s,l,c,m,d,p,h;if((r=this.context.eventEmitter)==null||r.emit("isAdShowing",!0),this.initialized||(yield this.init()),!this.context.checkNetwork()){let b=ke.from(new Error("No network connection"),"JOLIBOX_IMA_ERROR");(n=t.onAdError)==null||n.call(t,b);return}try{console.log("[JoliboxSDK] requestAd this.preloadedAd:",this.preloadedAd);let b=(i=this.preloadedAd)!=null?i:yield this.adsRequest.getAFVAdsInfo(!0);this.preloadedAd=null;let I=b==null?void 0:b.code,A=b==null?void 0:b.data;if(I==="BYPASS_ADS"){(o=t.onAdRequested)==null||o.call(t),(a=t.onAdLoaded)==null||a.call(t,void 0),(s=t.onAdPlaying)==null||s.call(t,void 0),(l=t.onAdCompleted)==null||l.call(t,void 0);return}if(A){let w=A.sort((M,S)=>M.seq-S.seq);if(w.length===0){let M=ke.from(new Error("No ads available"),"JOLIBOX_IMA_ERROR");(m=t.onAdError)==null||m.call(t,M);return}let R=!0,O=null,D=new Ns(this.context);for(;w.length>0;){let M=w.shift(),S=this.providers[M.provider];if(S){let[N,J]=yield D.callAdRequestAndContinue(S,t,M);R=N,O=J}else R=!0,O=ke.from(new Error("No provider available"),"JOLIBOX_IMA_ERROR");if(!R)break}R&&O&&((d=t.onAdError)==null||d.call(t,O))}else{let w=ke.from(new Error("Unknown error"),"JOLIBOX_IMA_ERROR");(c=t.onAdError)==null||c.call(t,w);return}}catch(b){let I=ke.from(new Error("Failed to request ad"),"JOLIBOX_IMA_ERROR");(p=t.onAdError)==null||p.call(t,I)}finally{(h=this.context.eventEmitter)==null||h.emit("isAdShowing",!1),this.preload()}})}};at($i,"STORAGE_KEY_INIT","jolibox_afv_init_data");at($i,"STORAGE_KEY_INFO","jolibox_afv_info_data");pe();var w0=vo(rf());var un=class{constructor(t){this.ads=t}getAdsInstance(){return this.ads}init(){}adConfig(t){var r,n;(n=(r=this.ads)==null?void 0:r.adConfig)==null||n.call(r,t)}adBreak(t){this.ads.adBreak(t)}adUnit(){}};ht();var fn=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 r,n,i,o,a,s,l,c,m;if(console.log(`HuaweiQuickAdsHandler,event => ${t}`),t.origin==window.location.origin&&t.data&&t.data.type==null){let d=JSON.parse(t.data);switch(console.log(`HuaweiQuickAdsHandler type => ${d.type}`),d.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",d);break;case"huawei_quick_ads_on_message_ad_config":{let p=d.callbackId;if(p){let h=this.callbackMap.get(p);(r=h==null?void 0:h.onReady)==null||r.call(h)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",d)}break;case"huawei_quick_ads_on_message_ad_break":{let p=d.callbackId;if(p){let h=this.callbackMap.get(p),b="noAdPreloaded",I=!1;switch(d.adsRes){case"viewed":b="viewed",(n=h==null?void 0:h.adViewed)==null||n.call(h),I=!1;break;case"dismissed":b="dismissed",(i=h==null?void 0:h.adDismissed)==null||i.call(h),I=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":b=d.adsRes,I=!0;break;case"breakDone":b=d.params,I=!0;break;case"beforeReward":(o=h==null?void 0:h.beforeReward)==null||o.call(h,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),I=!1;break;case"beforeAd":be("HuaweiQuickAdsAdBreakBeforeAd",{type:"beforeAd",format:(h==null?void 0:h.breakType)==="reward"?"reward":"interstitial"}),(a=h==null?void 0:h.beforeAd)==null||a.call(h),I=!1;break;case"afterAd":(s=h==null?void 0:h.afterAd)==null||s.call(h),I=!1;break}I&&((m=h==null?void 0:h.adBreakDone)==null||m.call(h,{breakType:(l=h.breakType)!=null?l:"",breakName:h.breakName,breakFormat:(c=h.breakFormat)!=null?c:"interstitial",breakStatus:b}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",d)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",d);break;default:break}}})}getAdsInstance(){return e.getInstance()}init(t){try{this.sendPostMessage("huawei_quick_ads_init",void 0,t)}catch(r){console.error("init failed",r)}}adConfig(t){try{let r;t.onReady&&(r=++this.callbacksId,this.callbackMap.set(r,{onReady:t.onReady})),this.sendPostMessage("huawei_quick_ads_ad_config",r,t)}catch(r){console.error("adConfig failed",r)}}adBreak(t){var r;try{let n=++this.callbacksId,i={};i.breakType=t.type,t.type!=="preroll"&&t.name&&(i.breakName=t.name),i.breakFormat=t.type==="reward"?"reward":"interstitial",t.adBreakDone&&(i.adBreakDone=t.adBreakDone),t.type!=="preroll"&&t.beforeAd&&(i.beforeAd=t.beforeAd),t.type!=="preroll"&&t.afterAd&&(i.afterAd=t.afterAd),t.type==="reward"&&t.beforeReward&&(i.beforeReward=t.beforeReward),t.type==="reward"&&t.adDismissed&&(i.adDismissed=t.adDismissed),t.type==="reward"&&t.adViewed&&(i.adViewed=t.adViewed),this.callbackMap.set(n,i),be("HuaweiQuickAdsAdBreak",{type:t.type,format:t.type==="reward"?"reward":"interstitial"}),this.sendPostMessage("huawei_quick_ads_ad_break",n,t)}catch(n){(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:"noAdPreloaded"})}}adUnit(t){try{this.sendPostMessage("huawei_quick_ads_ad_unit",void 0,t)}catch(r){console.error("adUnit failed",r)}}sendPostMessage(t,r,n){var i;try{if(!((i=window.system)!=null&&i.postMessage))throw new Error("window.system.postMessage is not available");let o=X(X({type:t},r!==void 0&&{callbackId:r}),n!==void 0&&{data:n});window.system.postMessage(JSON.stringify(o))}catch(o){throw console.error("sendPostMessage failed",o),o}}};var hn=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 r;try{t.type==="reward"?window.gdsdk.preloadAd("rewarded").then(()=>{var n;(n=t.beforeReward)==null||n.call(t,()=>{t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("rewarded").then(i=>{var o,a,s,l,c;(o=i==null?void 0:i.args)!=null&&o.success?(a=t.adViewed)==null||a.call(t):(s=t.adDismissed)==null||s.call(t),t.afterAd&&t.afterAd(),(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:(l=i==null?void 0:i.args)!=null&&l.success?"viewed":"dismissed"})}).catch(i=>{var o;console.log("showReward error => ",i),(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})})})}).catch(n=>{var i;console.log("preloadAd error => ",n),(i=t.adBreakDone)==null||i.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 n;t.type!=="preroll"&&t.afterAd&&t.afterAd(),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:"interstitial",breakStatus:"viewed"})}))}catch(n){console.log("adBreak error => ",n),(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:"error"})}}adUnit(){}};pe();var zt=class{constructor(t,r){this.ads=t;this.httpClient=r}getAdsInstance(){return this.ads}init(t){this.ads.init(t)}adConfig(t){this.ads.adConfig(t)}adBreak(t){return E(this,null,function*(){var n,i;if((n=L.hostUserInfo)==null?void 0:n.isSubUser){this.wrapAdBreadDoneViewed(t);return}if(t.type==="reward")try{let o=yield nt.getRewardsTypes(this.httpClient);if(!(yield nt.handleReward(o,t)))throw new Error("handleReward failed: fallback to unlock failed")}catch(o){console.info("handleReward failed",o),(i=t.adBreakDone)==null||i.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 r,n,i;(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:"name"in t&&(r=t.name)!=null?r:"",breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in t&&((i=t.adViewed)==null||i.call(t))}};var mn=class e extends zt{constructor(t,r){super(t,r),this.startTimes=Date.now()}adBreak(t){return E(this,null,function*(){var r,n;if(t.type!=="reward"){if(t.type==="preroll"){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let i=Date.now();if(console.log("FunmaxAdsHandler time => ",i-this.startTimes),i-this.startTimes<4e4){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}}yl(e.prototype,this,"adBreak").call(this,t)})}};var js=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new un(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=fn.getInstance();break}case"gamedistribution":{this.cacheHandler=hn.getInstance();break}case"funmax":{let r=new sn(this.context);this.cacheHandler=new mn(r,Ut);break}default:{let r=new sn(this.context);this.cacheHandler=new zt(r,Ut);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},Qi=Ae(),nf=new et,Ut=ze.create(),Ty={httpClient:Ut,checkNetwork:()=>ze.getNetworkStatus(),track:be,eventEmitter:nf,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:0}),handleLinkClicked:e=>{window.open(e,"_blank")},getContextInfo:()=>{var e,t,r,n,i,o,a,s,l;return{hostAppId:(t=(e=L.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=L.deviceInfo.did)!=null?r:"",adId:(n=L.deviceInfo.adId)!=null?n:"",sessionId:(i=L.sessionId)!=null?i:"",userId:(a=(o=L.hostUserInfo)==null?void 0:o.uid)!=null?a:"",objectType:"GAME",objectId:L.mpId,testAdsMode:L.testAdsMode,channel:(s=L.joliSource)!=null?s:"",deviceBrand:L.deviceInfo.brand,deviceModel:L.deviceInfo.model,osType:Ne.isAndroid?"ANDROID":Ne.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=L.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},of=e=>{Ue("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e}),be("jolicoin_unlock_success",{quantity:e.quantity})},xy=()=>{be("subscription_unlock_success",{})},Ny=new js(Ty),pn=Ny.getAdsHandler(L.sdkEnvironment);nt.registerRewardHandler("ADS",Cc(pn.getAdsInstance()));nt.registerRewardHandler("JOLI_COIN",Oc(Ut,{onUnlockSuccess:of.bind(void 0),hasSubscription:()=>!0}));nt.registerRewardHandler("JOLI_COIN_ONLY",kc(Ut,{onUnlockSuccess:of.bind(void 0),hasSubscription:()=>!0}));nt.registerRewardHandler("SUBSCRIPTION",Pc(Ut,{onSubSuccess:xy.bind(void 0),hasSubscription:()=>!0}));ha(Ut);si(Ut);nf.on("isAdShowing",e=>{Ue("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Qi.registerCommand("AdsSDK.init",e=>{pn.init(e)});Qi.registerCommand("AdsSDK.adConfig",e=>{pn.adConfig(e)});Qi.registerCommand("AdsSDK.adBreak",e=>{pn.adBreak(e)});Qi.registerCommand("AdsSDK.adUnit",e=>{pn.adUnit(e)});W();ht();Ur();var Hs=Ae();Hs.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();Ue("CP_LOAD_FINISH",{duration:e}),be("loadFinished",{duration:e})});Hs.registerCommand("RuntimeSDK.loadProgressEvent",e=>{Ue("CP_LOAD_PROGRESS",{progress:e}),console.log("RuntimeSDK.loadProgressEvent",e)});Hs.registerCommand("RuntimeSDK.gameTTIEvent",()=>{Ue("CP_GAME_TTI",{duration:performance.now()}),be("gameTTI",{duration:performance.now()})});W();ht();var uf=-1,eo=function(e){addEventListener("pageshow",function(t){t.persisted&&(uf=t.timeStamp,e(t))},!0)},Vs=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},to=function(){var e=Vs();return e&&e.activationStart||0},Ir=function(e,t){var r=Vs(),n="navigate";return uf>=0?n="back-forward-cache":r&&(document.prerendering||to()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},ff=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Ar=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,r),e(t))}},hf=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},mf=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},pf=function(e){var t=!1;return function(){t||(e(),t=!0)}},Er=-1,af=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Zi=function(e){document.visibilityState==="hidden"&&Er>-1&&(Er=e.type==="visibilitychange"?e.timeStamp:0,Py())},sf=function(){addEventListener("visibilitychange",Zi,!0),addEventListener("prerenderingchange",Zi,!0)},Py=function(){removeEventListener("visibilitychange",Zi,!0),removeEventListener("prerenderingchange",Zi,!0)},vf=function(){return Er<0&&(Er=af(),sf(),eo(function(){setTimeout(function(){Er=af(),sf()},0)})),{get firstHiddenTime(){return Er}}},$s=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},lf=[1800,3e3],gf=function(e,t){t=t||{},$s(function(){var r,n=vf(),i=Ir("FCP"),o=ff("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-to(),0),i.entries.push(s),r(!0)))})});o&&(r=Ar(e,i,lf,t.reportAllChanges),eo(function(a){i=Ir("FCP"),r=Ar(e,i,lf,t.reportAllChanges),hf(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})};var Dy=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=pf(e),document.visibilityState==="hidden"?e():(r=t(e),mf(e)),r};var cf=[2500,4e3],qs={},_f=function(e,t){t=t||{},$s(function(){var r,n=vf(),i=Ir("LCP"),o=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-to(),0),i.entries=[c],r())})},a=ff("largest-contentful-paint",o);if(a){r=Ar(e,i,cf,t.reportAllChanges);var s=pf(function(){qs[i.id]||(o(a.takeRecords()),a.disconnect(),qs[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return Dy(s)},{once:!0,capture:!0})}),mf(s),eo(function(l){i=Ir("LCP"),r=Ar(e,i,cf,t.reportAllChanges),hf(function(){i.value=performance.now()-l.timeStamp,qs[i.id]=!0,r(!0)})})}})},df=[800,1800],Ly=function e(t){document.prerendering?$s(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},yf=function(e,t){t=t||{};var r=Ir("TTFB"),n=Ar(e,r,df,t.reportAllChanges);Ly(function(){var i=Vs();i&&(r.value=Math.max(i.responseStart-to(),0),r.entries=[i],n(!0),eo(function(){r=Ir("TTFB",0),(n=Ar(e,r,df,t.reportAllChanges))(!0)}))})};pe();rr();ut();W();Ur();W();var ro=new Map,bf=!1,Uy=()=>{bf||(jt("ON_JOLIBOX_GET_USER_SUB_STATUS",e=>{let t=ro.get(e.sequenceId);if(t){clearTimeout(t.timeoutId);let{isSubUser:r,userId:n}=e;t.resolve({isSubUser:r,userId:n}),ro.delete(e.sequenceId)}}),bf=!0)};function Ks(){return E(this,null,function*(){return Uy(),new Promise((e,t)=>{let r=We(),n=setTimeout(()=>{ro.delete(r),t(new Error("Timeout waiting for user sub status response"))},3e3);ro.set(r,{resolve:e,reject:t,timeoutId:n}),Ue("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function wf(){return E(this,null,function*(){let e=ze.create();try{let t=yield e.get("/api/users/info");return!(t.code!=="SUCCESS"||!t.data)}catch(t){return je(new wn(t)),!1}})}function By(){gf(e=>{be("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),_f(e=>{be("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),yf(e=>{be("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function My(){kt.on("onDocumentReady",e=>E(this,null,function*(){let t=yield wf(),{isSubUser:r,userId:n}=yield Ks().catch(()=>({isSubUser:!1,userId:void 0}));L.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:r,uid:n}}),kt.emit("LifecycleEvent.onReady",X({},L.hostUserInfo?L.hostUserInfo:{isLogin:!1})),L.mpType==="game"&&Ye.start(Date.now()-e)}))}function Ef(){My(),By()}Ef();
303
+ `,yy=e=>{let{onReady:t,state:r}=e,{visible:n,retry:i,canRetry:o,videoRef:a,adContainerRef:s}=r,l=()=>{i.value&&(i.value(),fe(()=>{i.value=null,o.value=!1}))};return Nt(()=>{t()},[t]),V("div",{className:_y,style:{display:n.value?"block":"none"},children:V("div",{className:"ads-wrapper",children:[V("video",{ref:a,width:"100%",height:"100%",playsInline:!0,"webkit-playsinline":"true",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAD0lEQVR4AQEEAPv/AAAAAAAEAAFlScNgAAAAAElFTkSuQmCC",style:{transition:"none !important",transform:"none !important",animation:"none !important",objectFit:"contain"}}),V("div",{id:"ad-container",ref:s}),o.value?V("div",{className:"retry-button",onClick:l,children:V("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[V("circle",{cx:"32",cy:"32",r:"32",fill:"#141416",fillOpacity:"0.3"}),V("path",{d:"M25.3334 23.3668V40.6334C25.3334 41.9501 26.7834 42.7501 27.9 42.0334L41.4667 33.4001C42.5 32.7501 42.5 31.2501 41.4667 30.5834L27.9 21.9668C26.7834 21.2501 25.3334 22.0501 25.3334 23.3668Z",fill:"white"})]})}):null]})})};function Rt(e,t,r){return(t=by(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function by(e){var t=wy(e,"string");return typeof t=="symbol"?t:t+""}function wy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Bs=class{constructor(t){Rt(this,"name","GOOGLE_IMA"),Rt(this,"context",void 0),Rt(this,"adsOverlay",null),Rt(this,"initialized",!1),Rt(this,"ima",null),Rt(this,"state",gy()),Rt(this,"init",r=>A(this,null,function*(){if(this.initialized)return;let n="//imasdk.googleapis.com/js/sdkloader/ima3.js";yield new Promise((i,o)=>{if(document.querySelector("#google-ima-sdk")){i();return}else{let a=document.createElement("script");a.id="google-ima-sdk",a.src=n,a.onload=()=>{var s;(s=window.google)!=null&&s.ima?i():setTimeout(i,100)},a.onerror=o,document.head.appendChild(a)}}),this.adsOverlay=document.createElement("div"),this.adsOverlay.id="jolibox-ima-overlay",document.documentElement.appendChild(this.adsOverlay),yield new Promise((i,o)=>{at(V(yy,{state:this.state,onReady:()=>{this.ima=new Us(r.params.url,this.state.videoRef.current,this.state.adContainerRef.current),i()}}),this.adsOverlay)}),this.initialized=!0})),Rt(this,"destroy",()=>{this.adsOverlay&&(at(null,this.adsOverlay),this.adsOverlay.remove()),this.ima&&this.ima.destroy(),this.initialized=!1}),Rt(this,"requestAd",(r,n)=>{var i;if(!this.adsOverlay||!this.ima||!this.initialized){let h=xe.from(new Error("IMA not initialized"),"JOLIBOX_IMA_ERROR");(i=r.onAdError)==null||i.call(r,h);return}let o=h=>{var d;this.ima.destroy(),this.state.visible.value=!1,(d=r.onAdCompleted)==null||d.call(r,h)},a=h=>{var d;let m=!1;switch(h.raw.getErrorCode()){case Ji.AUTOPLAY_DISALLOWED:case Ji.VIDEO_PLAY_ERROR:case Ji.ADS_REQUEST_NETWORK_ERROR:{m=!0;break}default:{m=!1;break}}if(!m)this.ima.destroy(),fe(()=>{this.state.canRetry.value=!1,this.state.retry.value=null,this.state.visible.value=!1}),(d=r.onAdError)==null||d.call(r,h);else{let p=()=>{this.ima.destroy(),this.requestAd(r,n)};fe(()=>{this.state.canRetry.value=!0,this.state.retry.value=p})}},s=h=>{var d;this.state.visible.value=!0,(d=r.onAdLoaded)==null||d.call(r,h)},l=h=>{var d;(d=r.onAdPlaying)==null||d.call(r,h)},c=Object.assign({},r);c.onAdCompleted=o,c.onAdError=a,c.onAdLoaded=s,c.onAdPlaying=l,this.ima.requestAds(c,n)}),this.context=t}};function st(e,t,r){return(t=Ay(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ay(e){var t=Ey(e,"string");return typeof t=="symbol"?t:t+""}function Ey(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ms=class{constructor(t){st(this,"name","OKSPIN"),st(this,"initialized",!1),st(this,"initCompleter",null),st(this,"context",void 0),st(this,"adsOverlay",null),st(this,"adsIsShowing",!1),st(this,"state",Yu()),st(this,"init",r=>A(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv"),at(V(Xu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),st(this,"destroy",()=>{var r;this.adsOverlay&&(at(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),st(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,xe.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,xe.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var h;this.adsIsShowing=!1,(h=r.onAdCompleted)==null||h.call(r,void 0)},c=()=>{var h;(h=r.onAdLoaded)==null||h.call(r,void 0)};this.adsIsShowing=!0,fe(()=>{var h;this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.countdown.value=(h=n.params.countdown)!=null?h:15,this.state.src.value=n.params.url,this.state.mode.value="rewarded_insterstitial",this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function tt(e,t,r){return(t=Iy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Iy(e){var t=Sy(e,"string");return typeof t=="symbol"?t:t+""}function Sy(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gs=class{constructor(t){tt(this,"name","APPSROCKETS"),tt(this,"initialized",!1),tt(this,"initCompleter",null),tt(this,"context",void 0),tt(this,"adsOverlay",null),tt(this,"adsIsShowing",!1),tt(this,"state",Qu()),tt(this,"processUrl",r=>{var n;let i=this.context.getContextInfo(),o=new URL(r),a=new URLSearchParams(o.search);return a.has("joliSource")||a.set("joliSource",i.joliSource),a.get("osType")||a.set("osType",i.osType),a.get("runtimeType")||a.set("runtimeType",i.runtimeType),a.get("mode")||a.set("mode","AFV"),a.get("deviceId")||a.set("deviceId",i.deviceId),a.get("statusBarHeight")||a.set("statusBarHeight",((n=this.context.getWindowInfo().statusBarHeight)!=null?n:0).toString()),a.get("adsType")||a.set("adsType","REWARD_INTERSTITIAL"),o.search=a.toString(),o.toString()}),tt(this,"init",r=>A(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv-appsrockets"),at(V(Zu,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),tt(this,"destroy",()=>{var r;this.adsOverlay&&(at(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),tt(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,xe.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,xe.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var m;this.adsIsShowing=!1,(m=r.onAdCompleted)==null||m.call(r,void 0)},c=()=>{var m;(m=r.onAdLoaded)==null||m.call(r,void 0)},h=m=>{var p,b;(b=(p=this.context).handleLinkClicked)==null||b.call(p,m)},d=()=>{var m;(m=r.onAdError)==null||m.call(r,xe.from(new Error("Ads load error"),"JOLIBOX_IMA_ERROR"))};this.adsIsShowing=!0,fe(()=>{this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.adLinkClicked.value=h,this.state.adError.value=d,this.state.src.value=this.processUrl(n.params.url),this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function Lt(e,t,r){return(t=Cy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Cy(e){var t=Ry(e,"string");return typeof t=="symbol"?t:t+""}function Ry(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Js=class{constructor(t){Lt(this,"name","GOOGLE_GPT"),Lt(this,"context",void 0),Lt(this,"contextInfo",void 0),Lt(this,"rewardAdManager",void 0),Lt(this,"init",r=>A(this,null,function*(){if(!this.rewardAdManager){let n=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":r.params.rewardedSlot,i=`minidrama-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;this.rewardAdManager=new tf(n,i,r.params.keyValue)}})),Lt(this,"insertScript",()=>{let r="jolibox-google-gpt",n=document.getElementById(r);n||(n=window.document.createElement("script"),n.id=r,n.async=!0,n.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",n.crossOrigin="anonymous",document.head.appendChild(n))}),Lt(this,"destroy",()=>{var r;(r=this.rewardAdManager)==null||r.withCommand(()=>{var n;(n=this.rewardAdManager)==null||n.destroy("ignored")})}),Lt(this,"requestAd",(r,n)=>{var i;if(!this.rewardAdManager){(i=r.onAdError)==null||i.call(r,xe.from(new Error("rewardAdManager not initialized"),"JOLIBOX_IMA_ERROR"));return}this.rewardAdManager.requestAds({beforeAd:r.onAdRequested,beforeReward:o=>{var a,s;(a=r.onAdLoaded)==null||a.call(r,void 0),o(),(s=r.onAdPlaying)==null||s.call(r,void 0)},adDismissed:()=>{},adViewed:()=>{},adBreakDone:o=>{var a,s;switch(o){case"viewed":{(a=r.onAdCompleted)==null||a.call(r,void 0);break}case"ignored":break;default:{(s=r.onAdError)==null||s.call(r,xe.from(new Error(o),"JOLIBOX_IMA_ERROR"));break}}}})}),this.context=t,this.contextInfo=t.getContextInfo(),this.insertScript()}};function lt(e,t,r){return(t=Oy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oy(e){var t=Ty(e,"string");return typeof t=="symbol"?t:t+""}function Ty(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var zi=class e{constructor(t){if(lt(this,"context",void 0),lt(this,"contextInfo",void 0),lt(this,"providers",{}),lt(this,"requestContext",void 0),lt(this,"adsRequest",void 0),lt(this,"initialized",!1),lt(this,"preloadedAd",null),lt(this,"shouldCache",!1),t)this.context=t,this.requestContext=new sn(t),this.adsRequest=new $i(t,{reward:!1,interstitial:!1,afv:!1}),this.contextInfo=this.context.getContextInfo();else throw new Error("JoliboxAdsForVideo requires a configuration object")}init(){return A(this,arguments,function*(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r,n=sessionStorage.getItem(e.STORAGE_KEY_INIT);if(n){sessionStorage.removeItem(e.STORAGE_KEY_INIT);try{r=JSON.parse(n)}catch(i){}}if(r!=null&&r.length||(r=(yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFVSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}})).data),t&&r!=null&&r.length)try{sessionStorage.setItem(e.STORAGE_KEY_INIT,JSON.stringify(r))}catch(i){}if((r==null?void 0:r.length)>0)for(let i of r)switch(i.provider){case"GOOGLE_GPT":{let o=new Js(this.context);yield o.init(i),this.providers.GOOGLE_GPT=o;break}case"GOOGLE_IMA":{let o=new Bs(this.context);yield o.init(i),this.providers.GOOGLE_IMA=o;break}case"OKSPIN":{let o=new Ms(this.context);yield o.init(i),this.providers.OKSPIN=o;break}case"APPSROCKETS":{let o=new Gs(this.context);yield o.init(i),this.providers.APPSROCKETS=o;break}}this.adsRequest.cacheAFVInfo(),this.initialized=!0,this.shouldCache=t,this.preload()})}preload(){let t=sessionStorage.getItem(e.STORAGE_KEY_INFO);if(t){sessionStorage.removeItem(e.STORAGE_KEY_INFO);try{this.preloadedAd=JSON.parse(t);return}catch(r){}}this.adsRequest.getAFVAdsInfo(!0).then(r=>{if(console.log("[JoliboxSDK] afv preload adsInfo:",r),this.preloadedAd=r,this.shouldCache&&r)try{sessionStorage.setItem(e.STORAGE_KEY_INFO,JSON.stringify(r))}catch(n){}}).catch(()=>{this.preloadedAd=null})}destroy(){let t=Object.values(this.providers);for(let r of t)r.destroy();this.initialized=!1,this.preloadedAd=null}requestAd(t){return A(this,null,function*(){var r,n,i,o,a,s,l,c,h,d,m,p;if((r=this.context.eventEmitter)==null||r.emit("isAdShowing",!0),this.initialized||(yield this.init()),!this.context.checkNetwork()){let b=xe.from(new Error("No network connection"),"JOLIBOX_IMA_ERROR");(n=t.onAdError)==null||n.call(t,b);return}try{console.log("[JoliboxSDK] requestAd this.preloadedAd:",this.preloadedAd);let b=(i=this.preloadedAd)!=null?i:yield this.adsRequest.getAFVAdsInfo(!0);this.preloadedAd=null;let E=b==null?void 0:b.code,I=b==null?void 0:b.data;if(E==="BYPASS_ADS"){(o=t.onAdRequested)==null||o.call(t),(a=t.onAdLoaded)==null||a.call(t,void 0),(s=t.onAdPlaying)==null||s.call(t,void 0),(l=t.onAdCompleted)==null||l.call(t,void 0);return}if(I){let w=I.sort((B,S)=>B.seq-S.seq);if(w.length===0){let B=xe.from(new Error("No ads available"),"JOLIBOX_IMA_ERROR");(h=t.onAdError)==null||h.call(t,B);return}let R=!0,O=null,P=new Ls(this.context);for(;w.length>0;){let B=w.shift(),S=this.providers[B.provider];if(S){let[D,J]=yield P.callAdRequestAndContinue(S,t,B);R=D,O=J}else R=!0,O=xe.from(new Error("No provider available"),"JOLIBOX_IMA_ERROR");if(!R)break}R&&O&&((d=t.onAdError)==null||d.call(t,O))}else{let w=xe.from(new Error("Unknown error"),"JOLIBOX_IMA_ERROR");(c=t.onAdError)==null||c.call(t,w);return}}catch(b){let E=xe.from(new Error("Failed to request ad"),"JOLIBOX_IMA_ERROR");(m=t.onAdError)==null||m.call(t,E)}finally{(p=this.context.eventEmitter)==null||p.emit("isAdShowing",!1),this.preload()}})}};lt(zi,"STORAGE_KEY_INIT","jolibox_afv_init_data");lt(zi,"STORAGE_KEY_INFO","jolibox_afv_info_data");ve();var w0=yo(of());var fn=class{constructor(t){this.ads=t}getAdsInstance(){return this.ads}init(){}adConfig(t){var r,n;(n=(r=this.ads)==null?void 0:r.adConfig)==null||n.call(r,t)}adBreak(t){this.ads.adBreak(t)}adUnit(){}};mt();var hn=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 r,n,i,o,a,s,l,c,h;if(console.log(`HuaweiQuickAdsHandler,event => ${t}`),t.origin==window.location.origin&&t.data&&t.data.type==null){let d=JSON.parse(t.data);switch(console.log(`HuaweiQuickAdsHandler type => ${d.type}`),d.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",d);break;case"huawei_quick_ads_on_message_ad_config":{let m=d.callbackId;if(m){let p=this.callbackMap.get(m);(r=p==null?void 0:p.onReady)==null||r.call(p)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",d)}break;case"huawei_quick_ads_on_message_ad_break":{let m=d.callbackId;if(m){let p=this.callbackMap.get(m),b="noAdPreloaded",E=!1;switch(d.adsRes){case"viewed":b="viewed",(n=p==null?void 0:p.adViewed)==null||n.call(p),E=!1;break;case"dismissed":b="dismissed",(i=p==null?void 0:p.adDismissed)==null||i.call(p),E=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":b=d.adsRes,E=!0;break;case"breakDone":b=d.params,E=!0;break;case"beforeReward":(o=p==null?void 0:p.beforeReward)==null||o.call(p,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),E=!1;break;case"beforeAd":Ae("HuaweiQuickAdsAdBreakBeforeAd",{type:"beforeAd",format:(p==null?void 0:p.breakType)==="reward"?"reward":"interstitial"}),(a=p==null?void 0:p.beforeAd)==null||a.call(p),E=!1;break;case"afterAd":(s=p==null?void 0:p.afterAd)==null||s.call(p),E=!1;break}E&&((h=p==null?void 0:p.adBreakDone)==null||h.call(p,{breakType:(l=p.breakType)!=null?l:"",breakName:p.breakName,breakFormat:(c=p.breakFormat)!=null?c:"interstitial",breakStatus:b}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",d)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",d);break;default:break}}})}getAdsInstance(){return e.getInstance()}init(t){try{this.sendPostMessage("huawei_quick_ads_init",void 0,t)}catch(r){console.error("init failed",r)}}adConfig(t){try{let r;t.onReady&&(r=++this.callbacksId,this.callbackMap.set(r,{onReady:t.onReady})),this.sendPostMessage("huawei_quick_ads_ad_config",r,t)}catch(r){console.error("adConfig failed",r)}}adBreak(t){var r;try{let n=++this.callbacksId,i={};i.breakType=t.type,t.type!=="preroll"&&t.name&&(i.breakName=t.name),i.breakFormat=t.type==="reward"?"reward":"interstitial",t.adBreakDone&&(i.adBreakDone=t.adBreakDone),t.type!=="preroll"&&t.beforeAd&&(i.beforeAd=t.beforeAd),t.type!=="preroll"&&t.afterAd&&(i.afterAd=t.afterAd),t.type==="reward"&&t.beforeReward&&(i.beforeReward=t.beforeReward),t.type==="reward"&&t.adDismissed&&(i.adDismissed=t.adDismissed),t.type==="reward"&&t.adViewed&&(i.adViewed=t.adViewed),this.callbackMap.set(n,i),Ae("HuaweiQuickAdsAdBreak",{type:t.type,format:t.type==="reward"?"reward":"interstitial"}),this.sendPostMessage("huawei_quick_ads_ad_break",n,t)}catch(n){(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:"noAdPreloaded"})}}adUnit(t){try{this.sendPostMessage("huawei_quick_ads_ad_unit",void 0,t)}catch(r){console.error("adUnit failed",r)}}sendPostMessage(t,r,n){var i;try{if(!((i=window.system)!=null&&i.postMessage))throw new Error("window.system.postMessage is not available");let o=z(z({type:t},r!==void 0&&{callbackId:r}),n!==void 0&&{data:n});window.system.postMessage(JSON.stringify(o))}catch(o){throw console.error("sendPostMessage failed",o),o}}};var pn=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 r;try{t.type==="reward"?window.gdsdk.preloadAd("rewarded").then(()=>{var n;(n=t.beforeReward)==null||n.call(t,()=>{t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("rewarded").then(i=>{var o,a,s,l,c;(o=i==null?void 0:i.args)!=null&&o.success?(a=t.adViewed)==null||a.call(t):(s=t.adDismissed)==null||s.call(t),t.afterAd&&t.afterAd(),(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:(l=i==null?void 0:i.args)!=null&&l.success?"viewed":"dismissed"})}).catch(i=>{var o;console.log("showReward error => ",i),(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})})})}).catch(n=>{var i;console.log("preloadAd error => ",n),(i=t.adBreakDone)==null||i.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 n;t.type!=="preroll"&&t.afterAd&&t.afterAd(),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:"interstitial",breakStatus:"viewed"})}))}catch(n){console.log("adBreak error => ",n),(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:"error"})}}adUnit(){}};ve();var Xt=class{constructor(t,r){this.ads=t;this.httpClient=r}getAdsInstance(){return this.ads}init(t){this.ads.init(t)}adConfig(t){this.ads.adConfig(t)}adBreak(t){return A(this,null,function*(){var n,i;if((n=U.hostUserInfo)==null?void 0:n.isSubUser){this.wrapAdBreadDoneViewed(t);return}if(t.type==="reward")try{let o=yield ot.getRewardsTypes(this.httpClient);if(!(yield ot.handleReward(o,t)))throw new Error("handleReward failed: fallback to unlock failed")}catch(o){console.info("handleReward failed",o),(i=t.adBreakDone)==null||i.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 r,n,i;(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:"name"in t&&(r=t.name)!=null?r:"",breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in t&&((i=t.adViewed)==null||i.call(t))}};var mn=class e extends Xt{constructor(t,r){super(t,r),this.startTimes=Date.now()}adBreak(t){return A(this,null,function*(){var r,n;if(t.type!=="reward"){if(t.type==="preroll"){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let i=Date.now();if(console.log("FunmaxAdsHandler time => ",i-this.startTimes),i-this.startTimes<4e4){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}}wl(e.prototype,this,"adBreak").call(this,t)})}};var Vs=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new fn(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=hn.getInstance();break}case"gamedistribution":{this.cacheHandler=pn.getInstance();break}case"funmax":{let r=new ln(this.context);this.cacheHandler=new mn(r,Mt);break}default:{let r=new ln(this.context);this.cacheHandler=new Xt(r,Mt);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},to=Ce(),af=new rt,Mt=Xe.create(),ky={httpClient:Mt,checkNetwork:()=>Xe.getNetworkStatus(),track:Ae,eventEmitter:af,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:0}),handleLinkClicked:e=>{window.open(e,"_blank")},getContextInfo:()=>{var e,t,r,n,i,o,a,s,l;return{hostAppId:(t=(e=U.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=U.deviceInfo.did)!=null?r:"",adId:(n=U.deviceInfo.adId)!=null?n:"",sessionId:(i=U.sessionId)!=null?i:"",userId:(a=(o=U.hostUserInfo)==null?void 0:o.uid)!=null?a:"",objectType:"GAME",objectId:U.mpId,testAdsMode:U.testAdsMode,channel:(s=U.joliSource)!=null?s:"",deviceBrand:U.deviceInfo.brand,deviceModel:U.deviceInfo.model,osType:Le.isAndroid?"ANDROID":Le.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=U.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},sf=e=>{Ge("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e}),Ae("jolicoin_unlock_success",{quantity:e.quantity})},xy=()=>{Ae("subscription_unlock_success",{})},Dy=new Vs(ky),vn=Dy.getAdsHandler(U.sdkEnvironment);ot.registerRewardHandler("ADS",Oc(vn.getAdsInstance()));ot.registerRewardHandler("JOLI_COIN",kc(Mt,{onUnlockSuccess:sf.bind(void 0),hasSubscription:()=>!0}));ot.registerRewardHandler("JOLI_COIN_ONLY",xc(Mt,{onUnlockSuccess:sf.bind(void 0),hasSubscription:()=>!0}));ot.registerRewardHandler("SUBSCRIPTION",Lc(Mt,{onSubSuccess:xy.bind(void 0),hasSubscription:()=>!0}));va(Mt);di(Mt);af.on("isAdShowing",e=>{Ge("JOLIBOX_ADS_EVENT",{isAdShowing:e})});to.registerCommand("AdsSDK.init",e=>{vn.init(e)});to.registerCommand("AdsSDK.adConfig",e=>{vn.adConfig(e)});to.registerCommand("AdsSDK.adBreak",e=>{vn.adBreak(e)});to.registerCommand("AdsSDK.adUnit",e=>{vn.adUnit(e)});K();mt();Br();var Ks=Ce();Ks.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();Ge("CP_LOAD_FINISH",{duration:e}),Ae("loadFinished",{duration:e})});Ks.registerCommand("RuntimeSDK.loadProgressEvent",e=>{Ge("CP_LOAD_PROGRESS",{progress:e}),console.log("RuntimeSDK.loadProgressEvent",e)});Ks.registerCommand("RuntimeSDK.gameTTIEvent",()=>{Ge("CP_GAME_TTI",{duration:performance.now()}),Ae("gameTTI",{duration:performance.now()})});K();mt();var hf=-1,no=function(e){addEventListener("pageshow",function(t){t.persisted&&(hf=t.timeStamp,e(t))},!0)},Ws=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},io=function(){var e=Ws();return e&&e.activationStart||0},Er=function(e,t){var r=Ws(),n="navigate";return hf>=0?n="back-forward-cache":r&&(document.prerendering||io()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},pf=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Ir=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,r),e(t))}},mf=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},vf=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},gf=function(e){var t=!1;return function(){t||(e(),t=!0)}},Ar=-1,lf=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},ro=function(e){document.visibilityState==="hidden"&&Ar>-1&&(Ar=e.type==="visibilitychange"?e.timeStamp:0,Ny())},cf=function(){addEventListener("visibilitychange",ro,!0),addEventListener("prerenderingchange",ro,!0)},Ny=function(){removeEventListener("visibilitychange",ro,!0),removeEventListener("prerenderingchange",ro,!0)},_f=function(){return Ar<0&&(Ar=lf(),cf(),no(function(){setTimeout(function(){Ar=lf(),cf()},0)})),{get firstHiddenTime(){return Ar}}},zs=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},df=[1800,3e3],yf=function(e,t){t=t||{},zs(function(){var r,n=_f(),i=Er("FCP"),o=pf("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-io(),0),i.entries.push(s),r(!0)))})});o&&(r=Ir(e,i,df,t.reportAllChanges),no(function(a){i=Er("FCP"),r=Ir(e,i,df,t.reportAllChanges),mf(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})};var Py=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=gf(e),document.visibilityState==="hidden"?e():(r=t(e),vf(e)),r};var uf=[2500,4e3],$s={},bf=function(e,t){t=t||{},zs(function(){var r,n=_f(),i=Er("LCP"),o=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-io(),0),i.entries=[c],r())})},a=pf("largest-contentful-paint",o);if(a){r=Ir(e,i,uf,t.reportAllChanges);var s=gf(function(){$s[i.id]||(o(a.takeRecords()),a.disconnect(),$s[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return Py(s)},{once:!0,capture:!0})}),vf(s),no(function(l){i=Er("LCP"),r=Ir(e,i,uf,t.reportAllChanges),mf(function(){i.value=performance.now()-l.timeStamp,$s[i.id]=!0,r(!0)})})}})},ff=[800,1800],Ly=function e(t){document.prerendering?zs(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},wf=function(e,t){t=t||{};var r=Er("TTFB"),n=Ir(e,r,ff,t.reportAllChanges);Ly(function(){var i=Ws();i&&(r.value=Math.max(i.responseStart-io(),0),r.entries=[i],n(!0),no(function(){r=Er("TTFB",0),(n=Ir(e,r,ff,t.reportAllChanges))(!0)}))})};ve();rr();ht();K();Br();K();var oo=new Map,Af=!1,Uy=()=>{Af||(qt("ON_JOLIBOX_GET_USER_SUB_STATUS",e=>{let t=oo.get(e.sequenceId);if(t){clearTimeout(t.timeoutId);let{isSubUser:r,userId:n}=e;t.resolve({isSubUser:r,userId:n}),oo.delete(e.sequenceId)}}),Af=!0)};function Ys(){return A(this,null,function*(){return Uy(),new Promise((e,t)=>{let r=Ye(),n=setTimeout(()=>{oo.delete(r),t(new Error("Timeout waiting for user sub status response"))},3e3);oo.set(r,{resolve:e,reject:t,timeoutId:n}),Ge("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function Ef(){return A(this,null,function*(){let e=Xe.create();try{let t=yield e.get("/api/users/info");return!(t.code!=="SUCCESS"||!t.data)}catch(t){return qe(new In(t)),!1}})}function By(){yf(e=>{Ae("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),bf(e=>{Ae("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),wf(e=>{Ae("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function My(){xt.on("onDocumentReady",e=>A(this,null,function*(){let t=yield Ef(),{isSubUser:r,userId:n}=yield Ys().catch(()=>({isSubUser:!1,userId:void 0}));U.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:r,uid:n}}),xt.emit("LifecycleEvent.onReady",z({},U.hostUserInfo?U.hostUserInfo:{isLogin:!1})),U.mpType==="game"&&Qe.start(Date.now()-e)}))}function If(){My(),By()}If();
304
304
  /*! Bundled license information:
305
305
 
306
306
  localforage/dist/localforage.js: