@jolibox/implement 1.4.10 → 1.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +1 -1
- package/dist/index.js +10 -10
- package/dist/index.native.js +2 -2
- package/implement.build.log +2 -2
- package/package.json +6 -6
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var AO=Object.create;var Na=Object.defineProperty,CO=Object.defineProperties,kO=Object.getOwnPropertyDescriptor,xO=Object.getOwnPropertyDescriptors,TO=Object.getOwnPropertyNames,Ra=Object.getOwnPropertySymbols,PO=Object.getPrototypeOf,zl=Object.prototype.hasOwnProperty,jh=Object.prototype.propertyIsEnumerable;var Fh=(e,t,r)=>t in e?Na(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))zl.call(t,r)&&Fh(e,r,t[r]);if(Ra)for(var r of Ra(t))jh.call(t,r)&&Fh(e,r,t[r]);return e},B=(e,t)=>CO(e,xO(t));var Qe=(e,t)=>{var r={};for(var n in e)zl.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ra)for(var n of Ra(e))t.indexOf(n)<0&&jh.call(e,n)&&(r[n]=e[n]);return r};var T=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bh=(e,t)=>{for(var r in t)Na(e,r,{get:t[r],enumerable:!0})},OO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of TO(t))!zl.call(e,i)&&i!==r&&Na(e,i,{get:()=>t[i],enumerable:!(n=kO(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?AO(PO(e)):{},OO(t||!e||!e.__esModule?Na(r,"default",{value:e,enumerable:!0}):r,e));var g=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});function UO(e){return!!(e!=null&&e.__nativeBuffers__)}function tu(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!UO(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=MO(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function jO(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:FO(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function HO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function eg(e){return typeof e=="string"}function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Jh(e){return typeof e=="number"&&!isNaN(e)}function $O(e){return typeof e=="undefined"}function WO(e){return $O(e)||e===null}function tg(e){return typeof e=="function"}function zO(e){return Yn(e)&&tg(e.then)}function rg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Yi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function tR(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}function aR(){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 dR(e){return new Promise(t=>ng(e)(t))}function ng(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function pR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Zi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function mR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hR(e[n],t[n])}function hR(e,t){if(eg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(tg(t)){try{if(e instanceof t)return}catch(r){}if(!WO(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 Ze(e,t){if(nu.config[e]){Fa.warn(`[can i use] ${e} already registered`);return}nu.config[e]=gr({},t)}function $h(e,t){return`[${e}]:${t}`}function SR(e,t){Wh||(Xl=new La({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ql=new La({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Zl=new La({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Xl.flush(),Ql.flush(),Zl.flush()}),Wh=!0);function r(i){var o,a;let{method:s,args:c,startTime:l,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:m,invokeCallback:v}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Xl.report({status:b,method:n(s,c),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-l}),l&&m&&v&&(Ql.report({status:b,method:s,isForeground:d,duration:Number((m-l).toFixed(3))}),Zl.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-v).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function CR(e,t){let r=0,n=!0,i=AR.resolveMap,o=SR(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,eu.forEach(c=>Ua(this,[c],function*({method:l,args:d,resolve:u}){let p=yield s(l,d);u(p)})),eu.length=0});let a=(c,l)=>{let d=i.get(Number(c));if(!d)return;let u=tu(l);d(u),i.delete(Number(c))},s=(c,l)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new VO;if(i.set(r,m.resolve),!n&&yR.includes(c))return new Promise(C=>{eu.push({method:c,args:l,resolve:C})});let v=LO(gr({},{method:c,startTime:p,args:l,isForeground:f}),{invokeType:"js-bridge"}),b=!IR&&vR.includes(c),y=jO(l,b),_=b?y:JSON.stringify(y),E;if(c.endsWith("Sync")||bR.includes(c)?E=(d=e.call)==null?void 0:d.call(e,c,y,r):typeof _=="string"?E=e.invoke(c,_,r):E=(u=e.call)==null?void 0:u.call(e,c,_,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=tu(E)}catch(C){Fa.error(C)}return i.delete(r),E.errorCode&&(E.errorCode=$h(c,E.errorCode)),o(gr(gr({},v),E)),E}return c.endsWith("Sync")&&i.delete(r),m.promise.then(C=>(C.errorCode&&(C.errorCode=$h(c,C.errorCode)),o(gr(gr({},v),C)),C))};return{invokeNative:s,applyNative:(c,l)=>{let d=s(c,l);return zO(d)?d.then(u=>zh(c,u)):zh(c,d)},invokeHandler:a}}function zh(e,t){if(!Yn(t)){Fa.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=qO(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new QO(n,i,o,a);return s}function kR(e){if(globalThis[Da])return globalThis[Da];let t=new au,r=new au,n=new La({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[Da]={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=tu(o),c;if(s.__extra){c=s.params;let{type:l,startTime:d}=s.__extra;n.report({type:l,event:i,duration:Date.now()-d})}else c=s;if(i===ig){c.forEach(l=>{let[d,u]=l;try{r.emit(d.slice(Qi.length),u,a)}catch(p){}});return}if(i.startsWith(Qi)){r.emit(i.slice(Qi.length),c,a);return}t.emit(i,c,a)}},globalThis[Da]}function xR(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,c)=>{if(c){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Qi}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(ig,d,p)}catch(p){}}),n=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Qi}${o}`,a])},emitNative:(o,a,s,c)=>{if(c){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(_R,d,p)}catch(p){}}),i=void 0,r.clear()}));let l=r.get(s);l||(l=[],r.set(s,l)),l.push([o,a])}}}function TR(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=kR(e),{invokeNative:a,invokeHandler:s,applyNative:c}=CR(e,r),{publish:l,emitNative:d}=xR(e);return{invokeHandler:s,subscribeHandler:t,applyNative:c,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:l,subscribe:i,unsubscribe:o}}function og(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var RO,NO,DO,qa,Yh,Xh,Gh,gr,LO,qO,Ua,MO,FO,Qh,BO,GO,Zh,JO,VO,KO,YO,Ma,XO,QO,ZO,Kl,Fa,Hh,eR,ru,rR,nu,nR,iR,oR,Kn,sR,_z,iu,he,cR,lR,Xi,Zi,au,su,uR,Yl,fR,wz,cu,Vh,Sz,ja,gR,Qi,vR,yR,bR,ig,_R,wR,La,Wh,Xl,Ql,Zl,eu,IR,lu,ER,AR,Da,uu,Rt,ag,sg,PR,cg,Kh,de,L,we,lg,OR,ug,gn,Iz,Ez,ce=T(()=>{"use strict";RO=Object.defineProperty,NO=Object.defineProperties,DO=Object.getOwnPropertyDescriptors,qa=Object.getOwnPropertySymbols,Yh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Gh=(e,t,r)=>t in e?RO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gr=(e,t)=>{for(var r in t||(t={}))Yh.call(t,r)&&Gh(e,r,t[r]);if(qa)for(var r of qa(t))Xh.call(t,r)&&Gh(e,r,t[r]);return e},LO=(e,t)=>NO(e,DO(t)),qO=(e,t)=>{var r={};for(var n in e)Yh.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&qa)for(var n of qa(e))t.indexOf(n)<0&&Xh.call(e,n)&&(r[n]=e[n]);return r},Ua=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});MO=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};FO=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)};Qh=Object.defineProperty,BO=Object.getOwnPropertyDescriptor,GO=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},Zh=(e,t,r,n)=>{for(var i=n>1?void 0:n?BO(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&&Qh(t,r,i),i},JO=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}VO=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))}})}};KO=(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))(KO||{}),YO=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}},Ma=class extends YO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},XO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},QO=class extends Ma{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},ZO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Kl=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Fa={log:Yi("log"),warn:Yi("warn"),info:Yi("info"),error:Yi("error"),debug:Yi("debug")};Object.assign(globalThis,{logger:Fa});Hh=Symbol.for("Jolibox.canIUseMap"),eR={};globalThis[Hh]||(globalThis[Hh]=eR);ru=Symbol.for("Jolibox.canIUseMap.native"),rR={};globalThis[ru]||(globalThis[ru]=rR);nu={get config(){return globalThis[ru]}},nR=(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))(nR||{}),iR=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(iR||{}),oR=(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))(oR||{});aR();Kn=typeof window=="undefined",sR=()=>!Kn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),_z={isiOS:!Kn&&(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:!Kn&&navigator.userAgent.includes("Android"),isMac:!Kn&&navigator.userAgent.includes("Mac"),isFacebook:!Kn&&navigator.userAgent.includes("FB_IAB"),isPC:!Kn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},iu=class ou{constructor(t){this.element=t,this.next=ou.Undefined,this.prev=ou.Undefined}};iu.Undefined=new iu(void 0);he=iu,cR=class{constructor(){this._first=he.Undefined,this._last=he.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===he.Undefined}clear(){let e=this._first;for(;e!==he.Undefined;){let t=e.next;e.prev=he.Undefined,e.next=he.Undefined,e=t}this._first=he.Undefined,this._last=he.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new he(e);if(this._first===he.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!==he.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==he.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==he.Undefined&&e.next!==he.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===he.Undefined&&e.next===he.Undefined?(this._first=he.Undefined,this._last=he.Undefined):e.next===he.Undefined?(this._last=this._last.prev,this._last.next=he.Undefined):e.prev===he.Undefined&&(this._first=this._first.next,this._first.prev=he.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==he.Undefined;)yield e.element,e=e.next}},lR=0,Xi=class{constructor(e){this.value=e,this.id=lR++}},Zi=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 Xi&&(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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new Xi(t);return this._listeners?this._listeners instanceof Xi?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Xi)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var 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 Xi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},au=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 Zi,o=c=>t(...c.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 c of s)t(...c.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 cR,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)}},su={};GO(su,{None:()=>uR,filter:()=>pR,once:()=>ng,toPromise:()=>dR});uR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Yl=Symbol.for("Jolibox.hostEmitter"),fR=()=>{let e=new au;return globalThis[Yl]||(globalThis[Yl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Yl]},wz=fR();cu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Zi,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 mR(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}};cu=Zh([rg],cu);Vh=class{constructor(){this._onWillExecuteCommand=new Zi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Zi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new cu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=HO(3e4)),this._starActivation}executeCommand(e,...t){return JO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),su.toPromise(su.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}}};Vh=Zh([rg],Vh);Sz=Symbol.for("Jolibox.commands");Ze("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ze("requestProductDetailsAsync",{version:102e4});Ze("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ze("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ze("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ze("userTrackAsync",{version:1e6});Ze("openMiniapp",{version:1050100});Ze("requestCoinDetailsSync",{version:1070100});Ze("requestCoinDetailsAsync",{version:1070100});Ze("sendServerEventAsync",{version:1070100});Ze("requestGameLeaderboardSync",{version:108e4});Ze("requestGameLeaderboardAsync",{version:108e4});Ze("notifyTaskGameInfoAsync",{version:1080100});Ze("loadAdsAsync",{version:1070200});Ze("showAdAsync",{version:1070200});Ze("onJoliboxHideLoading",{version:1070300});ja=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let c=nu.config[a];if(!c)return!1;let l=(o=t==null?void 0:t())!=null?o:"",d=c.version;if(c.platforms&&l in c.platforms){let p=c.platforms[l];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(c,s,u)||n(c.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=tR(i,o);if(!s)return!1;if(Yn(s)){let c=s.version;return Jh(c)?typeof a=="number"&&a>=c:!0}return Jh(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};gR=()=>sR(),Qi="custom_event_",vR=[],yR=[],bR=["env","createRequestTask","login"],ig="__batch_event__",_R="__native_batch_event__",wR=e=>e==="pv"?e:"default",La=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=wR(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&&Yn(a))throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let c=[];if(Yn(a))c.push(...Object.keys(a));else if(eg(a)){if(i.length>0)throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);c.push(a)}else throw new Kl(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);c.forEach(l=>{n[l]||(n[l]={});let d=Yn(a)?a[l]:a;t(n[l],[...i],o,d)})}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={}}},Wh=!1;eu=[],IR=!1,lu=Symbol.for("Jolibox.invokeResolverInstance"),ER=new Map;globalThis[lu]||(globalThis[lu]=ER);AR={get resolveMap(){return globalThis[lu]}};Da=Symbol.for("Jolibox.subscribeInstance");Rt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Rt.trigger=e},onDoExit(e){Rt.exit=e},onDoBackPress(e){Rt.backPress=e}},ag=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new XO("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="")=>{Rt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ua(void 0,null,function*(){let o=yield Rt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});uu={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=og(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:ag,doExit:r};globalThis.joliboxJSCore=gr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Rt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ua(void 0,null,function*(){let a=yield Rt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});uu={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let c=og(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(c),webviewIds:s}))},call(o,a,s){let c=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(c)return JSON.parse(c)},doBackPress(o){return Ua(this,null,function*(){let a=yield Rt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:ag,doExit:n};globalThis.joliboxJSCore=gr({},i)}sg=uu;if(!sg&&gR())throw new ZO("No joliboxJScore is found, native bridge not found.");PR=gr({},sg),cg=TR(PR),{invokeHandler:Kh}=cg,{applyNative:de,invokeNative:L,onNative:we,offNative:lg,subscribeHandler:OR,publish:ug,emitNative:gn,subscribe:Iz,unsubscribe:Ez}=cg;globalThis.joliboxJSBridge={callHandler:Kh,invokeHandler:Kh,subscribeHandler:OR}});function qR(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Ga(e){return new Promise(t=>setTimeout(t,e))}function io(e){return typeof e=="string"}function yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function vg(e){return typeof e=="object"&&Array.isArray(e)}function Ja(e){return typeof e=="number"&&!isNaN(e)}function Jr(e){return e===!0||e===!1}function yg(e){return typeof e=="undefined"}function oo(e){return yg(e)||e===null}function UR(e){return typeof e=="function"}function bg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function _g(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],c=o[a],l=r(s,c,a,i,o);l!==void 0?i[a]=l:fg(c)&&fg(s)?i[a]=n(hg({},s),c):Array.isArray(c)&&Array.isArray(s)?i[a]=[...s,...c]:i[a]=c}return i}return n(e,t)}function fg(e){return e&&typeof e=="object"&&e.constructor===Object}function wg(e,t){if(Array.isArray(e))return e.concat(t)}function ao(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:c=!0}=r,l=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),d=function(...u){i=u,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&l()},t),p)return l()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,l()},d}function FR(e,t){return(...r)=>t(e,...r)}function Xn(e){return t=>FR(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new zt(`${i}`))}})}function eo(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Cg(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let c=parseInt(i[s],10)||0,l=parseInt(o[s],10)||0;if(c>l){n=1;break}else if(c<l){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function Iu(){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 VR(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 Eu(e){return VR("app","stg-app",e)}function Zn(e){return`https://${Eu(e)}`}function KR(e){return new Promise(t=>Pg(e)(t))}function Pg(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function YR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new no(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function QR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ZR(e[n],t[n])}function ZR(e,t){if(io(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(UR(t)){try{if(e instanceof t)return}catch(r){}if(!oo(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 e1(){return typeof globalThis!="undefined"?globalThis[Og]:void 0}function t1(e){typeof globalThis!="undefined"&&(globalThis[Og]=e)}function Y(e=!1){let t=e1();if(!e&&t)return t;let r=new Ba,n=new gu,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 t1(i),i}var vu,RR,dg,NR,DR,pg,hg,LR,gg,vn,pt,MR,yu,so,bu,Sg,zt,Ha,Ig,Va,Eg,Ag,co,_u,Kt,pu,jR,wu,mg,BR,K,Su,GR,Qn,to,lo,JR,HR,kg,xg,Tg,Ft,fu,ge,$R,WR,ro,no,Yt,hu,zR,du,XR,Se,Ba,gu,Og,R=T(()=>{"use strict";vu=Object.defineProperty,RR=Object.getOwnPropertyDescriptor,dg=Object.getOwnPropertySymbols,NR=Object.prototype.hasOwnProperty,DR=Object.prototype.propertyIsEnumerable,pg=(e,t,r)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hg=(e,t)=>{for(var r in t||(t={}))NR.call(t,r)&&pg(e,r,t[r]);if(dg)for(var r of dg(t))DR.call(t,r)&&pg(e,r,t[r]);return e},LR=(e,t)=>{for(var r in t)vu(e,r,{get:t[r],enumerable:!0})},gg=(e,t,r,n)=>{for(var i=n>1?void 0:n?RR(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&&vu(t,r,i),i},vn=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}pt=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))}})}};MR=(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))(MR||{}),yu=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}},so=class extends yu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},bu=class extends yu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Sg=class extends bu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},zt=class extends bu{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))}},Ha=class extends bu{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_PAYMENT_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Ig=class extends so{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Va=class extends so{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="INTERNAL_PAYMENT_ERROR",this.priority="P0",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Eg=class extends so{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},Ag=class extends so{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},co=class extends yu{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}}},_u=class extends so{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Kt={log:eo("log"),warn:eo("warn"),info:eo("info"),error:eo("error"),debug:eo("debug")};Object.assign(globalThis,{logger:Kt});pu=Symbol.for("Jolibox.canIUseMap"),jR={};globalThis[pu]||(globalThis[pu]=jR);wu={get config(){return globalThis[pu]}},mg=Symbol.for("Jolibox.canIUseMap.native"),BR={};globalThis[mg]||(globalThis[mg]=BR);K=(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))(K||{}),Su=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Su||{}),GR=(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))(GR||{}),Qn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Iu();to=typeof window=="undefined",lo={isiOS:!to&&(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:!to&&navigator.userAgent.includes("Android"),isMac:!to&&navigator.userAgent.includes("Mac"),isFacebook:!to&&navigator.userAgent.includes("FB_IAB"),isPC:!to&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},JR="device_id",HR="advertising_id",kg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Qn()),window.__joliboxLocalStorage__.getItem(e)),xg=()=>new URLSearchParams(window.location.search).get("deviceId")||kg(JR),Tg=()=>new URLSearchParams(window.location.search).get("advertisingId")||kg(HR);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=hg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return vn(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=>vn(this,null,function*(){if(s.message.includes("timeout")){let c=this.getValidCachedData(r);if(c)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}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 vn(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,c=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",c),c){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(u),f=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return f&&!this.config.consistencyChecker(c,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(c,p)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let l=yield this.requestAdapter.execute(e,t),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,l);return d&&this.setCachedDataWithSequence(a,d,s),l})}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 vn(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return vn(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 vn(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)}},fu=class mu{constructor(t){this.element=t,this.next=mu.Undefined,this.prev=mu.Undefined}};fu.Undefined=new fu(void 0);ge=fu,$R=class{constructor(){this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ge.Undefined}clear(){let e=this._first;for(;e!==ge.Undefined;){let t=e.next;e.prev=ge.Undefined,e.next=ge.Undefined,e=t}this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ge(e);if(this._first===ge.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!==ge.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ge.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ge.Undefined&&e.next!==ge.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ge.Undefined&&e.next===ge.Undefined?(this._first=ge.Undefined,this._last=ge.Undefined):e.next===ge.Undefined?(this._last=this._last.prev,this._last.next=ge.Undefined):e.prev===ge.Undefined&&(this._first=this._first.next,this._first.prev=ge.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ge.Undefined;)yield e.element,e=e.next}},WR=0,ro=class{constructor(e){this.value=e,this.id=WR++}},no=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 ro&&(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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new ro(t);return this._listeners?this._listeners instanceof ro?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof ro)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var 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 ro?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Yt=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 no,o=c=>t(...c.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 c of s)t(...c.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 $R,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)}},hu={};LR(hu,{None:()=>zR,filter:()=>YR,once:()=>Pg,toPromise:()=>KR});zR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});du=Symbol.for("Jolibox.hostEmitter"),XR=()=>{let e=new Yt;return globalThis[du]||(globalThis[du]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[du]},Se=XR();Ba=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new no,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 QR(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}};Ba=gg([bg],Ba);gu=class{constructor(){this._onWillExecuteCommand=new no,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new no,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ba,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=qR(3e4)),this._starActivation}executeCommand(e,...t){return vn(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),hu.toPromise(hu.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}}};gu=gg([bg],gu);Og=Symbol.for("Jolibox.commands")});function ke(e,t={}){Au.emit("ERROR_REPORT",{error:e,options:t})}var Au,bn,_t=T(()=>{"use strict";R();R();Au=new Yt,bn=new Yt;ke.debounce=ao(ke,50,{leading:!0})});var Cu,r1,Rg,Ng,Dg=T(()=>{"use strict";R();_t();Cu=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{}}},r1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rg=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:Cu(o),payloadJson:Cu(a),signature:Cu(s)}}else throw"joli_source is missing"}catch(r){return ke(new Ig(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Ng=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=r1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var n1,ku,Lg=T(()=>{"use strict";R();n1="1.4.10",ku=()=>n1});function Tu(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var i1,qg,xu,Ug,ve,o1,I,$=T(()=>{"use strict";R();Dg();Lg();R();i1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:xg(),adId:Tg(),pixelRatio:window.devicePixelRatio||1,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ku()},schema:window.location.href,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5"},xu=(qg=globalThis.joliboxJSCore)==null?void 0:qg.env,ve=Object.assign({},(Ug=xu==null?void 0:xu())!=null?Ug:i1);o1=()=>{var v,b,y,_,E,C,x,k,A,H,ue;let{payloadJson:e,headerJson:t,signature:r}=ve.schema.length?Rg(ve.schema):{},n=`${ve.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ve.schema.length?ve.schema:window.location.href).searchParams,a=(y=(b=(v=o.get("mpId"))!=null?v:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(C=(E=(_=ve.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?E:o.get("sessionId"))!=null?C:n,c=!!((k=(x=e==null?void 0:e.testAdsMode)!=null?x:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),l=(ue=(H=(A=e==null?void 0:e.joliboxEnv)!=null?A:e==null?void 0:e.__joliboxEnv)!=null?H:o.get("joliboxEnv"))!=null?ue:"production",d=l==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,m=e==null?void 0:e.__shouldInterupt;return{get startTime(){var N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return c},get joliboxEnv(){return l},get joliSource(){var N,O;return(O=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?O:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:ku()},get mpType(){var N,O;return(O=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?O:"game"},get platform(){var N;return((N=ve.platform)!=null?N:ve.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ve.deviceInfo},get sdkInfo(){return ve.sdkInfo},get hostInfo(){return ve.hostInfo},get hostUserInfo(){return ve.hostUserInfo},get sessionId(){var N,O;return(O=(N=ve.clientSessionId)!=null?N:s)!=null?O:n},get channel(){return u},get webviewId(){var N;return(N=ve.webviewId)!=null?N:-1},get shouldInterupt(){return m},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Eu(d)},get adId(){var N;return(N=ve.deviceInfo.adId)!=null?N:ve.deviceInfo.did},get language(){return ve.deviceInfo.lang},get sdkEnvironment(){return Tu("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Tu("gamedistribution","jolibox")?"gamedistribution":Tu("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,V,Mt;let N=(J=ve.deviceInfo.pixelRatio)!=null?J:1,O=(V=ve.deviceInfo.statusBarHeight)!=null?V:e==null?void 0:e.__androidStatusBarHeight,F=(Mt=ve.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:O!==void 0?O/N:20,navigationBarHeight:F!==void 0?F/N:10}},get abTests(){var N,O;return(O=(N=ve.abValues)==null?void 0:N.split(","))!=null?O:[]},get mpInfo(){var N;return(N=ve.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{_g(ve,N,wg)},encodeJoliSourceQuery:N=>{var O,F;return t&&r?Ng(P(P({},e),N),(O=o.get("joliSource"))!=null?O:""):(F=o.get("joliSource"))!=null?F:""},setDoExitDirectly:()=>{m=!1}}},I=o1()});var Pu,Fg,a1,s1,Mg,c1,jg=T(()=>{"use strict";R();_t();$();R();Pu=!1,Fg=(e,t)=>e==null?!1:t in e,a1=e=>Fg(e,"kind"),s1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Mg=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=I.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=I.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:s1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?bn.emit("GLOBAL_USER_ERROR",e,i):bn.emit("GLOBAL_ERROR",e,i)},c1=e=>Fg(e,"kind")&&e.kind==="USER_ERROR";Au.on("ERROR_REPORT",({error:e,options:t})=>{if(Pu)return;Pu=!0;let r=a1(e)&&e.raw?e.raw:e;try{let n=c1(e);Mg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new _u(`${i}, origin error: ${r.message}`);Kt.error(o),Mg(new _u(o.message),{environment:t.environment},!1)}finally{Pu=!1}})});var xe,Ou,Hr=T(()=>{"use strict";_t();R();_t();xe=(e,t)=>{var r,n;return new co((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Ou=e=>new Sg(e)});var Bg=T(()=>{"use strict";jg();Hr();R();ce();bn.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};L("trackAsync",{event:"reportJsError",data:r})});bn.on("GLOBAL_USER_ERROR",(e,t)=>{Kt.log("UserError",e,t)})});var Ru=T(()=>{"use strict"});function Gg(e,t){let r=(n,i,o)=>{let l=i!=null?i:{},{eventType:a}=l,s=Qe(l,["eventType"]),c=B(P({tag:n,eventType:o!=null?o:a!=null?a:K.Other},t),{extra:P({},s)});n=="globalJsError"?ke(new Ag(JSON.stringify(c))):e("systemLog",c,I.webviewId)};return r.debounce=ao(r,500,{leading:!0}),r}function Jg(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=ao(t,500,{leading:!0}),t}var Hg=T(()=>{"use strict";R();R();_t();$()});function Vg(e,t){let r=Gg(e,t),n=Jg(r);return{track:r,trackPerformance:n}}var $g=T(()=>{"use strict";Hg()});var Wg=T(()=>{"use strict";$();R();R()});var zg=T(()=>{"use strict";$g();Ru();Wg()});var $a,Kg=T(()=>{"use strict";$a=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 f=Date.now(),m=f-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},c=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},l=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",f=>{o&&(console.log("visible",f),f?l():c())});let p=this.visible;return{start(){o||(o=!0,p?l():c())},stop(){o=!1,d(),u()}}}}});function Wa(e,t,r){var c,l,d;let n=new Map,i=(c=r==null?void 0:r.baseUrl)!=null?c:Zn(I.testMode),o=(l=r==null?void 0:r.type)!=null?l:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return we("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:v,state:b}=f,y=Qe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(v)}else if(u.state==="fail"){let m=u,{requestTaskId:v,state:b}=m,y=Qe(m,["requestTaskId","state"]);p.reject(y),n.delete(v)}else Kt.warn("onRequestTaskStateChange unknown event",u)}),Se.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>g(this,[f,...m],function*(u,p={}){let v=Date.now(),b=l1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:E="json",timeout:C,enableCache:x=!1,appendHostCookie:k=!0}=p,A=Object.assign({"content-type":"application/json"},a,p.header),H={url:b,method:y,header:A,enableCache:x,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=d1(p.data,A["content-type"]);H.data=J}C&&Object.assign(H,{timeout:C});let{data:{requestTaskId:ue}}=L(e,H);if(typeof ue!="string")throw xe({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:O,promise:F}=new pt;n.set(ue,{resolve:N,reject:O});try{let J=yield F,{data:V}=J;return E==="json"&&typeof V=="string"&&(V=u1(V)),{url:b,timeout:C,method:y,response:B(P({},J),{data:V})}}catch(J){let V=J;if(yn(V)){let{errMsg:Mt,prefetchDetail:Mh,isPrefetch:Wl,errNo:Oa}=V;io(Mt)&&ke(xe({code:-1,msg:Mt},{errNo:Oa,errMsg:Mt}))}throw J}})}function u1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function d1(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var l1,Nu=T(()=>{"use strict";R();ce();_t();Hr();$();l1=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,i=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${i?`?${i}`:""}`:`${e}${i?`?${i}`:""}`}});var Du,Yg,X,ft=T(()=>{"use strict";Nu();$();R();Du={};(Yg=I.hostUserInfo)!=null&&Yg.token&&(Du["x-joli-token"]=I.hostUserInfo.token);I.joliSource&&(Du["x-joli-source"]=I.joliSource);X=Wa("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Zn(I.testMode),defaultHeaders:Du})});function Xg(e){let t=wu.config[e];return t||(t={},wu.config[e]=t),(r,n)=>{if(t[r]){Kt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var Qg=T(()=>{"use strict";R()});function Lu(e){Zg=e}function za(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>za(t)):Object.keys(e).reduce((t,r)=>(t[r]=za(e[r]),t),{})}function vr(e){return typeof e=="number"}function qu(e){let t=Uu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Uu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Zg,Oe,Ka,Ya,Xa,Qa,ei,Za,es,ts,rs,ns,is,os,as,ss,cs,ls,us,Mu=T(()=>{"use strict";Zg=!1;Oe=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Zg)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 ${qu(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return za(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:za(this._default)}optional(){return this._optional=!0,this}};Ka=class extends Oe{validate(t){return this._optional&&t===void 0?!0:vr(t)?vr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):vr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):vr(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}},Ya=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Xa=class extends Oe{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(vr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(vr(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}},Qa=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ei=class extends Oe{validate(t){return!0}},Za=class extends Oe{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},es=class extends Oe{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ts=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},rs=class extends Oe{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 ${qu(t)}`)}return!0}},ns=class extends Oe{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(vr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(vr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(vr(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}},is=class extends Oe{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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 c=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}"]`,!(c===void 0&&o._optional)){if(c===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(c)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},os=class extends Oe{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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}},as=class extends Oe{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:qu(this.value),actual:r}):!0}},ss=class extends Oe{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(`
|
|
1
|
+
var AO=Object.create;var Na=Object.defineProperty,CO=Object.defineProperties,kO=Object.getOwnPropertyDescriptor,xO=Object.getOwnPropertyDescriptors,TO=Object.getOwnPropertyNames,Ra=Object.getOwnPropertySymbols,PO=Object.getPrototypeOf,zl=Object.prototype.hasOwnProperty,jh=Object.prototype.propertyIsEnumerable;var Fh=(e,t,r)=>t in e?Na(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))zl.call(t,r)&&Fh(e,r,t[r]);if(Ra)for(var r of Ra(t))jh.call(t,r)&&Fh(e,r,t[r]);return e},B=(e,t)=>CO(e,xO(t));var Qe=(e,t)=>{var r={};for(var n in e)zl.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ra)for(var n of Ra(e))t.indexOf(n)<0&&jh.call(e,n)&&(r[n]=e[n]);return r};var T=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bh=(e,t)=>{for(var r in t)Na(e,r,{get:t[r],enumerable:!0})},OO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of TO(t))!zl.call(e,i)&&i!==r&&Na(e,i,{get:()=>t[i],enumerable:!(n=kO(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?AO(PO(e)):{},OO(t||!e||!e.__esModule?Na(r,"default",{value:e,enumerable:!0}):r,e));var g=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});function UO(e){return!!(e!=null&&e.__nativeBuffers__)}function tu(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!UO(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=MO(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function jO(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:FO(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function HO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function eg(e){return typeof e=="string"}function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Jh(e){return typeof e=="number"&&!isNaN(e)}function $O(e){return typeof e=="undefined"}function WO(e){return $O(e)||e===null}function tg(e){return typeof e=="function"}function zO(e){return Yn(e)&&tg(e.then)}function rg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Yi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function tR(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}function aR(){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 dR(e){return new Promise(t=>ng(e)(t))}function ng(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function pR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Zi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function mR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hR(e[n],t[n])}function hR(e,t){if(eg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(tg(t)){try{if(e instanceof t)return}catch(r){}if(!WO(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 Ze(e,t){if(nu.config[e]){Fa.warn(`[can i use] ${e} already registered`);return}nu.config[e]=gr({},t)}function $h(e,t){return`[${e}]:${t}`}function SR(e,t){Wh||(Xl=new La({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ql=new La({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Zl=new La({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Xl.flush(),Ql.flush(),Zl.flush()}),Wh=!0);function r(i){var o,a;let{method:s,args:c,startTime:l,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:m,invokeCallback:v}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Xl.report({status:b,method:n(s,c),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-l}),l&&m&&v&&(Ql.report({status:b,method:s,isForeground:d,duration:Number((m-l).toFixed(3))}),Zl.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-v).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function CR(e,t){let r=0,n=!0,i=AR.resolveMap,o=SR(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,eu.forEach(c=>Ua(this,[c],function*({method:l,args:d,resolve:u}){let p=yield s(l,d);u(p)})),eu.length=0});let a=(c,l)=>{let d=i.get(Number(c));if(!d)return;let u=tu(l);d(u),i.delete(Number(c))},s=(c,l)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new VO;if(i.set(r,m.resolve),!n&&yR.includes(c))return new Promise(C=>{eu.push({method:c,args:l,resolve:C})});let v=LO(gr({},{method:c,startTime:p,args:l,isForeground:f}),{invokeType:"js-bridge"}),b=!IR&&vR.includes(c),y=jO(l,b),_=b?y:JSON.stringify(y),E;if(c.endsWith("Sync")||bR.includes(c)?E=(d=e.call)==null?void 0:d.call(e,c,y,r):typeof _=="string"?E=e.invoke(c,_,r):E=(u=e.call)==null?void 0:u.call(e,c,_,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=tu(E)}catch(C){Fa.error(C)}return i.delete(r),E.errorCode&&(E.errorCode=$h(c,E.errorCode)),o(gr(gr({},v),E)),E}return c.endsWith("Sync")&&i.delete(r),m.promise.then(C=>(C.errorCode&&(C.errorCode=$h(c,C.errorCode)),o(gr(gr({},v),C)),C))};return{invokeNative:s,applyNative:(c,l)=>{let d=s(c,l);return zO(d)?d.then(u=>zh(c,u)):zh(c,d)},invokeHandler:a}}function zh(e,t){if(!Yn(t)){Fa.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=qO(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new QO(n,i,o,a);return s}function kR(e){if(globalThis[Da])return globalThis[Da];let t=new au,r=new au,n=new La({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[Da]={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=tu(o),c;if(s.__extra){c=s.params;let{type:l,startTime:d}=s.__extra;n.report({type:l,event:i,duration:Date.now()-d})}else c=s;if(i===ig){c.forEach(l=>{let[d,u]=l;try{r.emit(d.slice(Qi.length),u,a)}catch(p){}});return}if(i.startsWith(Qi)){r.emit(i.slice(Qi.length),c,a);return}t.emit(i,c,a)}},globalThis[Da]}function xR(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,c)=>{if(c){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Qi}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(ig,d,p)}catch(p){}}),n=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Qi}${o}`,a])},emitNative:(o,a,s,c)=>{if(c){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(_R,d,p)}catch(p){}}),i=void 0,r.clear()}));let l=r.get(s);l||(l=[],r.set(s,l)),l.push([o,a])}}}function TR(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=kR(e),{invokeNative:a,invokeHandler:s,applyNative:c}=CR(e,r),{publish:l,emitNative:d}=xR(e);return{invokeHandler:s,subscribeHandler:t,applyNative:c,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:l,subscribe:i,unsubscribe:o}}function og(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var RO,NO,DO,qa,Yh,Xh,Gh,gr,LO,qO,Ua,MO,FO,Qh,BO,GO,Zh,JO,VO,KO,YO,Ma,XO,QO,ZO,Kl,Fa,Hh,eR,ru,rR,nu,nR,iR,oR,Kn,sR,_z,iu,he,cR,lR,Xi,Zi,au,su,uR,Yl,fR,wz,cu,Vh,Sz,ja,gR,Qi,vR,yR,bR,ig,_R,wR,La,Wh,Xl,Ql,Zl,eu,IR,lu,ER,AR,Da,uu,Rt,ag,sg,PR,cg,Kh,de,L,we,lg,OR,ug,gn,Iz,Ez,ce=T(()=>{"use strict";RO=Object.defineProperty,NO=Object.defineProperties,DO=Object.getOwnPropertyDescriptors,qa=Object.getOwnPropertySymbols,Yh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Gh=(e,t,r)=>t in e?RO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gr=(e,t)=>{for(var r in t||(t={}))Yh.call(t,r)&&Gh(e,r,t[r]);if(qa)for(var r of qa(t))Xh.call(t,r)&&Gh(e,r,t[r]);return e},LO=(e,t)=>NO(e,DO(t)),qO=(e,t)=>{var r={};for(var n in e)Yh.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&qa)for(var n of qa(e))t.indexOf(n)<0&&Xh.call(e,n)&&(r[n]=e[n]);return r},Ua=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});MO=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};FO=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)};Qh=Object.defineProperty,BO=Object.getOwnPropertyDescriptor,GO=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},Zh=(e,t,r,n)=>{for(var i=n>1?void 0:n?BO(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&&Qh(t,r,i),i},JO=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}VO=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))}})}};KO=(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))(KO||{}),YO=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}},Ma=class extends YO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},XO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},QO=class extends Ma{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},ZO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Kl=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Fa={log:Yi("log"),warn:Yi("warn"),info:Yi("info"),error:Yi("error"),debug:Yi("debug")};Object.assign(globalThis,{logger:Fa});Hh=Symbol.for("Jolibox.canIUseMap"),eR={};globalThis[Hh]||(globalThis[Hh]=eR);ru=Symbol.for("Jolibox.canIUseMap.native"),rR={};globalThis[ru]||(globalThis[ru]=rR);nu={get config(){return globalThis[ru]}},nR=(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))(nR||{}),iR=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(iR||{}),oR=(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))(oR||{});aR();Kn=typeof window=="undefined",sR=()=>!Kn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),_z={isiOS:!Kn&&(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:!Kn&&navigator.userAgent.includes("Android"),isMac:!Kn&&navigator.userAgent.includes("Mac"),isFacebook:!Kn&&navigator.userAgent.includes("FB_IAB"),isPC:!Kn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},iu=class ou{constructor(t){this.element=t,this.next=ou.Undefined,this.prev=ou.Undefined}};iu.Undefined=new iu(void 0);he=iu,cR=class{constructor(){this._first=he.Undefined,this._last=he.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===he.Undefined}clear(){let e=this._first;for(;e!==he.Undefined;){let t=e.next;e.prev=he.Undefined,e.next=he.Undefined,e=t}this._first=he.Undefined,this._last=he.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new he(e);if(this._first===he.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!==he.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==he.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==he.Undefined&&e.next!==he.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===he.Undefined&&e.next===he.Undefined?(this._first=he.Undefined,this._last=he.Undefined):e.next===he.Undefined?(this._last=this._last.prev,this._last.next=he.Undefined):e.prev===he.Undefined&&(this._first=this._first.next,this._first.prev=he.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==he.Undefined;)yield e.element,e=e.next}},lR=0,Xi=class{constructor(e){this.value=e,this.id=lR++}},Zi=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 Xi&&(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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new Xi(t);return this._listeners?this._listeners instanceof Xi?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Xi)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var 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 Xi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},au=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 Zi,o=c=>t(...c.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 c of s)t(...c.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 cR,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)}},su={};GO(su,{None:()=>uR,filter:()=>pR,once:()=>ng,toPromise:()=>dR});uR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Yl=Symbol.for("Jolibox.hostEmitter"),fR=()=>{let e=new au;return globalThis[Yl]||(globalThis[Yl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Yl]},wz=fR();cu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Zi,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 mR(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}};cu=Zh([rg],cu);Vh=class{constructor(){this._onWillExecuteCommand=new Zi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Zi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new cu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=HO(3e4)),this._starActivation}executeCommand(e,...t){return JO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),su.toPromise(su.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}}};Vh=Zh([rg],Vh);Sz=Symbol.for("Jolibox.commands");Ze("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ze("requestProductDetailsAsync",{version:102e4});Ze("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ze("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ze("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ze("userTrackAsync",{version:1e6});Ze("openMiniapp",{version:1050100});Ze("requestCoinDetailsSync",{version:1070100});Ze("requestCoinDetailsAsync",{version:1070100});Ze("sendServerEventAsync",{version:1070100});Ze("requestGameLeaderboardSync",{version:108e4});Ze("requestGameLeaderboardAsync",{version:108e4});Ze("notifyTaskGameInfoAsync",{version:1080100});Ze("loadAdsAsync",{version:1070200});Ze("showAdAsync",{version:1070200});Ze("onJoliboxHideLoading",{version:1070300});ja=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let c=nu.config[a];if(!c)return!1;let l=(o=t==null?void 0:t())!=null?o:"",d=c.version;if(c.platforms&&l in c.platforms){let p=c.platforms[l];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(c,s,u)||n(c.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=tR(i,o);if(!s)return!1;if(Yn(s)){let c=s.version;return Jh(c)?typeof a=="number"&&a>=c:!0}return Jh(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};gR=()=>sR(),Qi="custom_event_",vR=[],yR=[],bR=["env","createRequestTask","login"],ig="__batch_event__",_R="__native_batch_event__",wR=e=>e==="pv"?e:"default",La=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=wR(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&&Yn(a))throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let c=[];if(Yn(a))c.push(...Object.keys(a));else if(eg(a)){if(i.length>0)throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);c.push(a)}else throw new Kl(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);c.forEach(l=>{n[l]||(n[l]={});let d=Yn(a)?a[l]:a;t(n[l],[...i],o,d)})}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={}}},Wh=!1;eu=[],IR=!1,lu=Symbol.for("Jolibox.invokeResolverInstance"),ER=new Map;globalThis[lu]||(globalThis[lu]=ER);AR={get resolveMap(){return globalThis[lu]}};Da=Symbol.for("Jolibox.subscribeInstance");Rt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Rt.trigger=e},onDoExit(e){Rt.exit=e},onDoBackPress(e){Rt.backPress=e}},ag=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new XO("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="")=>{Rt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ua(void 0,null,function*(){let o=yield Rt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});uu={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=og(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:ag,doExit:r};globalThis.joliboxJSCore=gr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Rt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ua(void 0,null,function*(){let a=yield Rt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});uu={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let c=og(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(c),webviewIds:s}))},call(o,a,s){let c=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(c)return JSON.parse(c)},doBackPress(o){return Ua(this,null,function*(){let a=yield Rt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:ag,doExit:n};globalThis.joliboxJSCore=gr({},i)}sg=uu;if(!sg&&gR())throw new ZO("No joliboxJScore is found, native bridge not found.");PR=gr({},sg),cg=TR(PR),{invokeHandler:Kh}=cg,{applyNative:de,invokeNative:L,onNative:we,offNative:lg,subscribeHandler:OR,publish:ug,emitNative:gn,subscribe:Iz,unsubscribe:Ez}=cg;globalThis.joliboxJSBridge={callHandler:Kh,invokeHandler:Kh,subscribeHandler:OR}});function qR(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Ga(e){return new Promise(t=>setTimeout(t,e))}function io(e){return typeof e=="string"}function yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function vg(e){return typeof e=="object"&&Array.isArray(e)}function Ja(e){return typeof e=="number"&&!isNaN(e)}function Jr(e){return e===!0||e===!1}function yg(e){return typeof e=="undefined"}function oo(e){return yg(e)||e===null}function UR(e){return typeof e=="function"}function bg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function _g(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],c=o[a],l=r(s,c,a,i,o);l!==void 0?i[a]=l:fg(c)&&fg(s)?i[a]=n(hg({},s),c):Array.isArray(c)&&Array.isArray(s)?i[a]=[...s,...c]:i[a]=c}return i}return n(e,t)}function fg(e){return e&&typeof e=="object"&&e.constructor===Object}function wg(e,t){if(Array.isArray(e))return e.concat(t)}function ao(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:c=!0}=r,l=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),d=function(...u){i=u,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&l()},t),p)return l()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,l()},d}function FR(e,t){return(...r)=>t(e,...r)}function Xn(e){return t=>FR(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new zt(`${i}`))}})}function eo(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Cg(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let c=parseInt(i[s],10)||0,l=parseInt(o[s],10)||0;if(c>l){n=1;break}else if(c<l){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function Iu(){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 VR(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 Eu(e){return VR("app","stg-app",e)}function Zn(e){return`https://${Eu(e)}`}function KR(e){return new Promise(t=>Pg(e)(t))}function Pg(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function YR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new no(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function QR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ZR(e[n],t[n])}function ZR(e,t){if(io(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(UR(t)){try{if(e instanceof t)return}catch(r){}if(!oo(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 e1(){return typeof globalThis!="undefined"?globalThis[Og]:void 0}function t1(e){typeof globalThis!="undefined"&&(globalThis[Og]=e)}function Y(e=!1){let t=e1();if(!e&&t)return t;let r=new Ba,n=new gu,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 t1(i),i}var vu,RR,dg,NR,DR,pg,hg,LR,gg,vn,pt,MR,yu,so,bu,Sg,zt,Ha,Ig,Va,Eg,Ag,co,_u,Kt,pu,jR,wu,mg,BR,K,Su,GR,Qn,to,lo,JR,HR,kg,xg,Tg,Ft,fu,ge,$R,WR,ro,no,Yt,hu,zR,du,XR,Se,Ba,gu,Og,R=T(()=>{"use strict";vu=Object.defineProperty,RR=Object.getOwnPropertyDescriptor,dg=Object.getOwnPropertySymbols,NR=Object.prototype.hasOwnProperty,DR=Object.prototype.propertyIsEnumerable,pg=(e,t,r)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hg=(e,t)=>{for(var r in t||(t={}))NR.call(t,r)&&pg(e,r,t[r]);if(dg)for(var r of dg(t))DR.call(t,r)&&pg(e,r,t[r]);return e},LR=(e,t)=>{for(var r in t)vu(e,r,{get:t[r],enumerable:!0})},gg=(e,t,r,n)=>{for(var i=n>1?void 0:n?RR(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&&vu(t,r,i),i},vn=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}pt=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))}})}};MR=(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))(MR||{}),yu=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}},so=class extends yu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},bu=class extends yu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Sg=class extends bu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},zt=class extends bu{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))}},Ha=class extends bu{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_PAYMENT_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Ig=class extends so{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Va=class extends so{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="INTERNAL_PAYMENT_ERROR",this.priority="P0",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Eg=class extends so{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},Ag=class extends so{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},co=class extends yu{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}}},_u=class extends so{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Kt={log:eo("log"),warn:eo("warn"),info:eo("info"),error:eo("error"),debug:eo("debug")};Object.assign(globalThis,{logger:Kt});pu=Symbol.for("Jolibox.canIUseMap"),jR={};globalThis[pu]||(globalThis[pu]=jR);wu={get config(){return globalThis[pu]}},mg=Symbol.for("Jolibox.canIUseMap.native"),BR={};globalThis[mg]||(globalThis[mg]=BR);K=(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))(K||{}),Su=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Su||{}),GR=(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))(GR||{}),Qn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Iu();to=typeof window=="undefined",lo={isiOS:!to&&(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:!to&&navigator.userAgent.includes("Android"),isMac:!to&&navigator.userAgent.includes("Mac"),isFacebook:!to&&navigator.userAgent.includes("FB_IAB"),isPC:!to&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},JR="device_id",HR="advertising_id",kg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Qn()),window.__joliboxLocalStorage__.getItem(e)),xg=()=>new URLSearchParams(window.location.search).get("deviceId")||kg(JR),Tg=()=>new URLSearchParams(window.location.search).get("advertisingId")||kg(HR);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=hg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return vn(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=>vn(this,null,function*(){if(s.message.includes("timeout")){let c=this.getValidCachedData(r);if(c)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}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 vn(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,c=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",c),c){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(u),f=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return f&&!this.config.consistencyChecker(c,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(c,p)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let l=yield this.requestAdapter.execute(e,t),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,l);return d&&this.setCachedDataWithSequence(a,d,s),l})}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 vn(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return vn(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 vn(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)}},fu=class mu{constructor(t){this.element=t,this.next=mu.Undefined,this.prev=mu.Undefined}};fu.Undefined=new fu(void 0);ge=fu,$R=class{constructor(){this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ge.Undefined}clear(){let e=this._first;for(;e!==ge.Undefined;){let t=e.next;e.prev=ge.Undefined,e.next=ge.Undefined,e=t}this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ge(e);if(this._first===ge.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!==ge.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ge.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ge.Undefined&&e.next!==ge.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ge.Undefined&&e.next===ge.Undefined?(this._first=ge.Undefined,this._last=ge.Undefined):e.next===ge.Undefined?(this._last=this._last.prev,this._last.next=ge.Undefined):e.prev===ge.Undefined&&(this._first=this._first.next,this._first.prev=ge.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ge.Undefined;)yield e.element,e=e.next}},WR=0,ro=class{constructor(e){this.value=e,this.id=WR++}},no=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 ro&&(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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new ro(t);return this._listeners?this._listeners instanceof ro?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof ro)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var 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 ro?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Yt=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 no,o=c=>t(...c.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 c of s)t(...c.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 $R,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)}},hu={};LR(hu,{None:()=>zR,filter:()=>YR,once:()=>Pg,toPromise:()=>KR});zR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});du=Symbol.for("Jolibox.hostEmitter"),XR=()=>{let e=new Yt;return globalThis[du]||(globalThis[du]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[du]},Se=XR();Ba=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new no,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 QR(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}};Ba=gg([bg],Ba);gu=class{constructor(){this._onWillExecuteCommand=new no,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new no,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ba,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=qR(3e4)),this._starActivation}executeCommand(e,...t){return vn(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),hu.toPromise(hu.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}}};gu=gg([bg],gu);Og=Symbol.for("Jolibox.commands")});function ke(e,t={}){Au.emit("ERROR_REPORT",{error:e,options:t})}var Au,bn,_t=T(()=>{"use strict";R();R();Au=new Yt,bn=new Yt;ke.debounce=ao(ke,50,{leading:!0})});var Cu,r1,Rg,Ng,Dg=T(()=>{"use strict";R();_t();Cu=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{}}},r1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rg=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:Cu(o),payloadJson:Cu(a),signature:Cu(s)}}else throw"joli_source is missing"}catch(r){return ke(new Ig(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Ng=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=r1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var n1,ku,Lg=T(()=>{"use strict";R();n1="1.4.12",ku=()=>n1});function Tu(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var i1,qg,xu,Ug,ve,o1,I,$=T(()=>{"use strict";R();Dg();Lg();R();i1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:xg(),adId:Tg(),pixelRatio:window.devicePixelRatio||1,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ku()},schema:window.location.href,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5"},xu=(qg=globalThis.joliboxJSCore)==null?void 0:qg.env,ve=Object.assign({},(Ug=xu==null?void 0:xu())!=null?Ug:i1);o1=()=>{var v,b,y,_,E,C,x,k,A,H,ue;let{payloadJson:e,headerJson:t,signature:r}=ve.schema.length?Rg(ve.schema):{},n=`${ve.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ve.schema.length?ve.schema:window.location.href).searchParams,a=(y=(b=(v=o.get("mpId"))!=null?v:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(C=(E=(_=ve.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?E:o.get("sessionId"))!=null?C:n,c=!!((k=(x=e==null?void 0:e.testAdsMode)!=null?x:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),l=(ue=(H=(A=e==null?void 0:e.joliboxEnv)!=null?A:e==null?void 0:e.__joliboxEnv)!=null?H:o.get("joliboxEnv"))!=null?ue:"production",d=l==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,m=e==null?void 0:e.__shouldInterupt;return{get startTime(){var N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return c},get joliboxEnv(){return l},get joliSource(){var N,O;return(O=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?O:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:ku()},get mpType(){var N,O;return(O=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?O:"game"},get platform(){var N;return((N=ve.platform)!=null?N:ve.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ve.deviceInfo},get sdkInfo(){return ve.sdkInfo},get hostInfo(){return ve.hostInfo},get hostUserInfo(){return ve.hostUserInfo},get sessionId(){var N,O;return(O=(N=ve.clientSessionId)!=null?N:s)!=null?O:n},get channel(){return u},get webviewId(){var N;return(N=ve.webviewId)!=null?N:-1},get shouldInterupt(){return m},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Eu(d)},get adId(){var N;return(N=ve.deviceInfo.adId)!=null?N:ve.deviceInfo.did},get language(){return ve.deviceInfo.lang},get sdkEnvironment(){return Tu("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Tu("gamedistribution","jolibox")?"gamedistribution":Tu("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,V,Mt;let N=(J=ve.deviceInfo.pixelRatio)!=null?J:1,O=(V=ve.deviceInfo.statusBarHeight)!=null?V:e==null?void 0:e.__androidStatusBarHeight,F=(Mt=ve.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:O!==void 0?O/N:20,navigationBarHeight:F!==void 0?F/N:10}},get abTests(){var N,O;return(O=(N=ve.abValues)==null?void 0:N.split(","))!=null?O:[]},get mpInfo(){var N;return(N=ve.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{_g(ve,N,wg)},encodeJoliSourceQuery:N=>{var O,F;return t&&r?Ng(P(P({},e),N),(O=o.get("joliSource"))!=null?O:""):(F=o.get("joliSource"))!=null?F:""},setDoExitDirectly:()=>{m=!1}}},I=o1()});var Pu,Fg,a1,s1,Mg,c1,jg=T(()=>{"use strict";R();_t();$();R();Pu=!1,Fg=(e,t)=>e==null?!1:t in e,a1=e=>Fg(e,"kind"),s1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Mg=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=I.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=I.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:s1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?bn.emit("GLOBAL_USER_ERROR",e,i):bn.emit("GLOBAL_ERROR",e,i)},c1=e=>Fg(e,"kind")&&e.kind==="USER_ERROR";Au.on("ERROR_REPORT",({error:e,options:t})=>{if(Pu)return;Pu=!0;let r=a1(e)&&e.raw?e.raw:e;try{let n=c1(e);Mg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new _u(`${i}, origin error: ${r.message}`);Kt.error(o),Mg(new _u(o.message),{environment:t.environment},!1)}finally{Pu=!1}})});var xe,Ou,Hr=T(()=>{"use strict";_t();R();_t();xe=(e,t)=>{var r,n;return new co((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Ou=e=>new Sg(e)});var Bg=T(()=>{"use strict";jg();Hr();R();ce();bn.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};L("trackAsync",{event:"reportJsError",data:r})});bn.on("GLOBAL_USER_ERROR",(e,t)=>{Kt.log("UserError",e,t)})});var Ru=T(()=>{"use strict"});function Gg(e,t){let r=(n,i,o)=>{let l=i!=null?i:{},{eventType:a}=l,s=Qe(l,["eventType"]),c=B(P({tag:n,eventType:o!=null?o:a!=null?a:K.Other},t),{extra:P({},s)});n=="globalJsError"?ke(new Ag(JSON.stringify(c))):e("systemLog",c,I.webviewId)};return r.debounce=ao(r,500,{leading:!0}),r}function Jg(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=ao(t,500,{leading:!0}),t}var Hg=T(()=>{"use strict";R();R();_t();$()});function Vg(e,t){let r=Gg(e,t),n=Jg(r);return{track:r,trackPerformance:n}}var $g=T(()=>{"use strict";Hg()});var Wg=T(()=>{"use strict";$();R();R()});var zg=T(()=>{"use strict";$g();Ru();Wg()});var $a,Kg=T(()=>{"use strict";$a=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 f=Date.now(),m=f-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},c=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},l=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",f=>{o&&(console.log("visible",f),f?l():c())});let p=this.visible;return{start(){o||(o=!0,p?l():c())},stop(){o=!1,d(),u()}}}}});function Wa(e,t,r){var c,l,d;let n=new Map,i=(c=r==null?void 0:r.baseUrl)!=null?c:Zn(I.testMode),o=(l=r==null?void 0:r.type)!=null?l:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return we("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:v,state:b}=f,y=Qe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(v)}else if(u.state==="fail"){let m=u,{requestTaskId:v,state:b}=m,y=Qe(m,["requestTaskId","state"]);p.reject(y),n.delete(v)}else Kt.warn("onRequestTaskStateChange unknown event",u)}),Se.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>g(this,[f,...m],function*(u,p={}){let v=Date.now(),b=l1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:E="json",timeout:C,enableCache:x=!1,appendHostCookie:k=!0}=p,A=Object.assign({"content-type":"application/json"},a,p.header),H={url:b,method:y,header:A,enableCache:x,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=d1(p.data,A["content-type"]);H.data=J}C&&Object.assign(H,{timeout:C});let{data:{requestTaskId:ue}}=L(e,H);if(typeof ue!="string")throw xe({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:O,promise:F}=new pt;n.set(ue,{resolve:N,reject:O});try{let J=yield F,{data:V}=J;return E==="json"&&typeof V=="string"&&(V=u1(V)),{url:b,timeout:C,method:y,response:B(P({},J),{data:V})}}catch(J){let V=J;if(yn(V)){let{errMsg:Mt,prefetchDetail:Mh,isPrefetch:Wl,errNo:Oa}=V;io(Mt)&&ke(xe({code:-1,msg:Mt},{errNo:Oa,errMsg:Mt}))}throw J}})}function u1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function d1(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var l1,Nu=T(()=>{"use strict";R();ce();_t();Hr();$();l1=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,i=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${i?`?${i}`:""}`:`${e}${i?`?${i}`:""}`}});var Du,Yg,X,ft=T(()=>{"use strict";Nu();$();R();Du={};(Yg=I.hostUserInfo)!=null&&Yg.token&&(Du["x-joli-token"]=I.hostUserInfo.token);I.joliSource&&(Du["x-joli-source"]=I.joliSource);X=Wa("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Zn(I.testMode),defaultHeaders:Du})});function Xg(e){let t=wu.config[e];return t||(t={},wu.config[e]=t),(r,n)=>{if(t[r]){Kt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var Qg=T(()=>{"use strict";R()});function Lu(e){Zg=e}function za(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>za(t)):Object.keys(e).reduce((t,r)=>(t[r]=za(e[r]),t),{})}function vr(e){return typeof e=="number"}function qu(e){let t=Uu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Uu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Zg,Oe,Ka,Ya,Xa,Qa,ei,Za,es,ts,rs,ns,is,os,as,ss,cs,ls,us,Mu=T(()=>{"use strict";Zg=!1;Oe=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Zg)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 ${qu(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return za(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:za(this._default)}optional(){return this._optional=!0,this}};Ka=class extends Oe{validate(t){return this._optional&&t===void 0?!0:vr(t)?vr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):vr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):vr(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}},Ya=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Xa=class extends Oe{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(vr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(vr(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}},Qa=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ei=class extends Oe{validate(t){return!0}},Za=class extends Oe{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},es=class extends Oe{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ts=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},rs=class extends Oe{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 ${qu(t)}`)}return!0}},ns=class extends Oe{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(vr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(vr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(vr(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}},is=class extends Oe{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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 c=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}"]`,!(c===void 0&&o._optional)){if(c===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(c)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},os=class extends Oe{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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}},as=class extends Oe{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:qu(this.value),actual:r}):!0}},ss=class extends Oe{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(`
|
|
2
2
|
or `);this.errors.push(o)}return n}},cs=class extends Oe{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}},ls=class extends Oe{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},us=class extends Oe{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 Fu(e,t,r="param"){if(e.errors=[],e.path=r,Lu(!0),!e.validate(t)){let n=e.errors.join(`
|
|
3
3
|
`);throw e.errors.length=0,Lu(!1),new TypeError(n)}}var S,ju=T(()=>{"use strict";Mu();Mu();S={object(e){return new os(e)},array(e){return new ns(e)},tuple(...e){return new cs(...e)},literal(e){return new as(e)},or(...e){return new ss(...e)},symbol(){return new Qa},record(e){return new is(e)},function(){return new ts},boolean(){return new Ya},string(){return new Xa},number(){return new Ka},undefined(){return new Za},null(){return new es},unknown(){return new ei},any(){return new ei},as(){return new ei},arraybuffer(){return new ls},enum(...e){return new rs(...e)},typedarray(e){return new us(e)}}});var ds,ev,tv=T(()=>{"use strict";R();_t();ju();Hr();ds=1,ev=e=>{function t(n,i){return(...o)=>{var u,p,f,m;let a=Date.now(),s={method:n,trace_id:ds};ds+=1;let c="SUCCESS",l=`${n}:ok`,d=0;try{if(i.paramsSchema)try{Fu(i.paramsSchema,o,"params")}catch(_){throw Ou(`${n}:fail ${_.message}`)}let v=i.implement(...o),b=v,y=`${n}:ok`;if(v&&"code"in v){let{code:_,data:E,message:C}=v;c=_,b=E,y=C}return{code:c,message:y,data:b}}catch(v){let b=v;d=(p=(u=b.code)!=null?u:b.errNo)!=null?p:2e3,c="FAILURE";let y=(m=(f=b.message)!=null?f:b.errMsg)!=null?m:`${v}`;return l=`${n}:${c} ${y.replace(/^\S+:(fail|cancel)\s?/,"")}`,ke(new co(l,d)),{code:c,message:l}}finally{let v=Date.now()-a}}}function r(n,i){return(...o)=>g(this,null,function*(){var p,f,m,v;let a=vg(o)?o:[o],s=Date.now(),c={method:n,trace_id:ds};ds+=1;let l=`${n}:ok`,d="SUCCESS",u={code:d,message:l};try{if(i.paramsSchema)try{Fu(i.paramsSchema,a,"params")}catch(_){throw Ou(_.message)}let y=yield i.implement(...a);if(y&&"code"in y){let{code:_,data:E,message:C}=y;d=_,l=C,y=E}return Object.assign(u,{code:d,message:l,data:y}),u}catch(b){let y=b,_=(f=(p=y.code)!=null?p:y.errNo)!=null?f:2e3;d="FAILURE";let E=(v=(m=y.message)!=null?m:y.errMsg)!=null?v:`${b}`,C=`${n}:${d} ${E.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:d,message:C}),ke(new co(C,_)),u}finally{let b=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var ye,ps=T(()=>{"use strict";$();ce();({canIUseNative:ye}=ja(()=>I.sdkInfo.nativeSDKVersionCode,()=>I.platform))});function Bu(e){if(typeof e!="number"||e<=0)return"0.0.0";let t=e.toString(),r=0,n=0,i=0;return t.length>=1&&(r=parseInt(t.substring(0,1),10)),t.length>=3&&(n=parseInt(t.substring(1,3),10)),t.length>=5&&(i=parseInt(t.substring(3,5),10)),`${r}.${n}.${i}`}var rv=T(()=>{"use strict"});var z,Q,D,Ve=T(()=>{"use strict";Qg();wt();tv();ju();ps();rv();({createAPI:z,createSyncAPI:Q}=ev(j)),D=Xg("native")});function nv(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return t==="array"&&(t="object"),v1.includes(t)?t:""}function iv(e,t){try{switch(t){case"string":return e;case"object":return JSON.parse(e);case"number":return parseFloat(e);case"boolean":return e==="true";default:return""}}catch(r){return""}}function ov(e,t){try{switch(t){case"string":case"number":case"boolean":return`${e}`;case"object":return JSON.stringify(e);default:return""}}catch(r){return""}}var fs,f1,m1,h1,g1,Q6,Z6,v1,Vr,St,uo=T(()=>{"use strict";Ve();ce();R();ft();$();fs=Y(),f1=z("getLocalStorage",{paramsSchema:S.tuple(S.string()),implement(e){return g(this,null,function*(){let{response:t}=yield X(`/api/games/user-storage/${I.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:i}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:i==null?void 0:i.value};try{let{data:{data:o,dataType:a}}=yield de("getLocalStorageAsync",{key:e}),s=iv(o,a);return{code:r,message:`${n}. fallback to native`,data:s}}catch(o){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});fs.registerCommand("StorageSDK.getItem",f1);D("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});m1=z("setStorage",{paramsSchema:S.tuple(S.string(),S.or(S.string(),S.boolean(),S.number())),implement(e,t){return g(this,null,function*(){let r=I.mpId,n=typeof t=="string"?t:String(t),{response:i}=yield X(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:o,message:a}}=i,s=nv(t),c=ov(t,s);return yield de("setLocalStorageAsync",{key:e,data:c,dataType:s}),o=="SUCCESS"?{code:o,message:a}:{code:o,message:`${a}. fallback to native`}})}});fs.registerCommand("StorageSDK.setItem",m1);D("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});h1=z("removeStorage",{paramsSchema:S.tuple(S.string()),implement(e){return g(this,null,function*(){let t=I.mpId,{response:r}=yield X(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:i}}=r;return yield de("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:i}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});fs.registerCommand("StorageSDK.removeItem",h1);D("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});g1=z("clearStorage",{implement(){return g(this,null,function*(){let e=I.mpId,{response:t}=yield X(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});de("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});fs.registerCommand("StorageSDK.clear",g1);D("storage.clear",{version:"1.0.0"});Q6=z("getStorageInfo",{implement(){return g(this,null,function*(){let{data:e}=yield de("getStorageInfoAsync");return e})}});D("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});Z6=Q("getStorageInfoSync",{implement(){return L("getStorageInfoSync")}}),v1=["string","number","boolean","object",""];Vr=z("getGlobalStorage",{paramsSchema:S.tuple(S.string()),implement(e){return g(this,null,function*(){try{let{data:{data:t,dataType:r}}=yield de("getGlobalStorageAsync",{key:e});return{code:"SUCCESS",message:"success",data:iv(t,r)}}catch(t){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get global storage failed",data:null}}})}}),St=z("setGlobalStorage",{paramsSchema:S.tuple(S.string(),S.or(S.string(),S.boolean(),S.number(),S.array())),implement(e,t){return g(this,null,function*(){try{let r=nv(t),n=ov(t,r);return yield de("setGlobalStorageAsync",{key:e,data:n,dataType:r}),{code:"SUCCESS",message:"success"}}catch(r){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] set global storage failed"}}})}})});var av,ms,sv=T(()=>{"use strict";$();Kg();R();ft();ce();uo();ps();av="REPORT_FIRST_OPEN_GAME",ms=class extends $a{constructor(r,n,i){super(n,i);this.started=!1;this.gameId=I.mpId,this.sessionId=I.sessionId,this.track=r,this.taskUrl=Zn(I.testMode)+"/api/base/app-event"}reporter(r){return g(this,null,function*(){let{event:n,params:i,extraParams:o}=r,a={eventType:n,gameInfo:P({gameId:this.gameId,sessionId:this.sessionId},i)};o&&Object.assign(a,o),yield this.createTask(a)})}reportToNative(r){return g(this,null,function*(){let{event:n,params:i}=r;yield de("userTrackAsync",{event:n,params:P({},i),gameId:this.gameId})})}tracker(r,n=null){this.track(r,n)}start(r){if(this.started){console.info("[JoliboxSDK] taskTrakcer has started");return}super.start(r),this.tryReportOpenGamePlus(),this.started=!0}tryReportOpenGamePlus(){Vr(av).then(r=>{Jr(r.data)&&r.data&&this.tracker("OpenGame_2Plus"),St(av,!0)})}createTask(r){return ye("sendServerEventAsync")?de("sendServerEventAsync",{payload:r}):I.platform==="android"?X("/api/base/app-event",{method:"POST",data:r}):de("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(r)})}}});var pv={};Bh(pv,{nativeTaskEmitter:()=>po,taskTracker:()=>It,track:()=>j,trackPerformance:()=>uv});var y1,cv,lv,j,uv,dv,po,It,wt=T(()=>{"use strict";Bg();R();Ru();zg();$();sv();ce();y1=(e,t,r)=>{var l,d,u,p,f,m,v;let n=t,i=yn(n.extra)?n.extra:io(n.extra)?JSON.parse(n.extra):{},{mpName:o,mpVersion:a}=(l=I.mpInfo)!=null?l:{},s=P(P(B(P({},i),{mp_id:(d=n.mp_id)!=null?d:"",mp_version:(u=n.mp_version)!=null?u:"",session_id:I.sessionId,user_id:(f=(p=I.hostUserInfo)==null?void 0:p.uid)!=null?f:""}),o?{mp_name:o}:{}),a?{mp_info_version:a}:{}),c=(m=n.eventType)!=null?m:K.Other;L("trackAsync",{event:(v=t.tag)!=null?v:e,data:s,webviewId:r,eventType:c})},{track:j,trackPerformance:uv}=Vg(y1,{type:Su.AppSDK,platform:"native",jssdk_version:(lv=(cv=I.sdkInfo)==null?void 0:cv.jssdkVersion)!=null?lv:"1.0.0",mp_id:I.mpId,mp_version:I.mpVersion}),dv=Y();dv.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{uv(e,t,r)});dv.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{j(e,t)});po=new Yt,It=new ms(j,po)});function fv(){let e=null,t=null,r=window.fetch,n=()=>{t=document.createElement("meta"),t.setAttribute("name","viewport"),t.setAttribute("content","viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"),t.setAttribute("data-jolibox-sdk","viewport-meta"),e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let s=`
|
|
4
4
|
html[data-jolibox-root] {
|
|
@@ -866,7 +866,7 @@ If multiple caches share the same key they might "fight" for each other's style
|
|
|
866
866
|
width: 100%;
|
|
867
867
|
height: 100%;
|
|
868
868
|
}
|
|
869
|
-
`,RP=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:c,src:l}=t,[d,u]=Sr(!1),p=m=>{var v,b,y,_;u(!1),c.value=!1,m==="dismiss"?(v=n.value)==null||v.call(n):m==="viewed"&&((b=i.value)==null||b.call(i)),(y=r.value)==null||y.call(r),(_=o.value)==null||_.call(o)},f=()=>{var m;(m=a.value)==null||m.call(a)};return Mi("appsrockets_ad_dismissed",()=>p("dismiss")),Mi("appsrockets_ad_rewarded",()=>p("viewed")),Mi("appsrockets_ad_completed",()=>p("viewed")),Mi("appsrockets_ad_skipped",()=>p("viewed")),Mi("appsrockets_ad_clicked",m=>{var v;return(v=s.value)==null?void 0:v.call(s,m)}),Mi("appsrockets_ad_loaded",()=>u(!0)),c.value?G("div",{className:D9,style:{display:d?"flex":"none"},children:c.value&&G("iframe",{src:l.value,onLoad:f,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};Jm=class{constructor(t,r){Lr(this,"name","APPSROCKETS"),Lr(this,"initialized",!1),Lr(this,"initCompleter",null),Lr(this,"context",void 0),Lr(this,"adsOverlay",null),Lr(this,"adsIsShowing",!1),Lr(this,"lastUnDisplayedAdBreak",null),Lr(this,"state",OP()),Lr(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),c=new URLSearchParams(s.search);return c.has("joliSource")||c.set("joliSource",a.joliSource),c.get("osType")||c.set("osType",a.osType),c.get("runtimeType")||c.set("runtimeType",a.runtimeType),c.get("mode")||c.set("mode","AFG"),c.get("deviceId")||c.set("deviceId",a.deviceId),c.get("statusBarHeight")||c.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),c.get("adsType")||c.set("adsType",i),s.search=c.toString(),s.toString()}),this.context=t}init(){return g(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),Qt(G(RP,{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,c,l,d;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 u=f=>{var m,v;(v=(m=this.context).handleLinkClicked)==null||v.call(m,f)},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 f=()=>{var b;this.adsIsShowing=!1,(b=t.afterAd)==null||b.call(t)},m=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},v=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};Ce(()=>{this.adsIsShowing=!0,this.state.afterAd.value=f,this.state.adBreakDone.value=m,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=u,this.state.adError.value=v,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((c=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||c.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),(l=t.beforeAd)==null||l.call(t);let f=()=>{var C;this.adsIsShowing=!1,(C=t.afterAd)==null||C.call(t)},m={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},v=()=>{var C;this.adsIsShowing=!1,m.breakStatus="dismissed",(C=t.adDismissed)==null||C.call(t)},b=()=>{var C;this.adsIsShowing=!1,m.breakStatus="viewed",(C=t.adViewed)==null||C.call(t)},y=()=>{var C;this.adsIsShowing=!1,(C=t.adBreakDone)==null||C.call(t,m)},_=()=>{this.adsIsShowing=!1,m.breakStatus="noAdPreloaded"};Ce(()=>{this.state.afterAd.value=f,this.state.adDismissed.value=v,this.state.adViewed.value=b,this.state.adBreakDone.value=y,this.state.adLinkClicked.value=u,this.state.adError.value=_});let E=()=>{var C;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(C=t.adBreakDone)==null||C.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,Ce(()=>{this.state.src.value=this.processUrl(r.params.url,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(d=t.beforeReward)==null||d.call(t,E);break}}}},NP=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};DP=class{constructor(e,t,r){it(this,"adUnit",void 0),it(this,"project",void 0),it(this,"keyValue",void 0),it(this,"adsContext",null),it(this,"rewardedSlot",null),it(this,"rewardedPayload",null),it(this,"readyEvent",null),it(this,"withCommand",function(){googletag.cmd.push(...arguments)}),it(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))}),it(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)}),it(this,"reinit",n=>{this.destroy(n),this.init()}),it(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),it(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)})}}),it(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),it(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),it(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,c;(s=(a=this.adsContext)==null?void 0:a.beforeAd)==null||s.call(a),(c=this.readyEvent)==null||c.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,NP(),this.withCommand(()=>{this.init()})}};Hm=class{constructor(t,r,n){var i=this;vt(this,"adUnit",void 0),vt(this,"project",void 0),vt(this,"keyValue",void 0),vt(this,"adsContext",null),vt(this,"gamingInterstitialSlot",null),vt(this,"readyEvent",null),vt(this,"isRetrying",!1),vt(this,"withCommand",function(){googletag.cmd.push(...arguments)}),vt(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))}),vt(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)}),vt(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(o,a),i.init()}),vt(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),vt(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")}))}),vt(this,"requestAds",o=>{this.withCommand(()=>{var a,s,c;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()):((c=(s=this.adsContext).onEnd)==null||c.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)))})}),NP(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};Vm=class{constructor(t,r){Jn(this,"name","GOOGLE_GPT"),Jn(this,"context",void 0),Jn(this,"contextInfo",void 0),Jn(this,"initParams",void 0),Jn(this,"rewardAdManager",void 0),Jn(this,"interstitialManager",void 0),Jn(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 g(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 DP(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Hm(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}}}};$m=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";Im(this,"context",void 0),Im(this,"placement","GAME"),Im(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:aP.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:iP.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:oP.WebSDK};return zV(i)}};Ia=class{constructor(t){dt(this,"context",void 0),dt(this,"adsTrackSerializer",void 0),dt(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new $m(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}}},Nl=class{constructor(t,r){var n=this;dt(this,"context",void 0),dt(this,"contextInfo",void 0),dt(this,"requestContext",void 0),dt(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),dt(this,"pendingAFVAdsInfo",Promise.resolve(null)),dt(this,"doFetchAdsInfo",i=>g(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:c,code:l}=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 l==="SUCCESS"||l==="BYPASS_ADS"?{code:l,data:c}:null})),dt(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),dt(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),dt(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),dt(this,"cacheNextAFGAdsInfo",i=>g(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),dt(this,"getAFGAdsInfo",i=>g(this,null,function*(){let o=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),o})),dt(this,"getAFVAdsInfo",function(){return g(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 Ia(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};Y9=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)}},Dl=class{constructor(t){this.context=t,W9(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=ja(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return g(this,null,function*(){try{let{errNo:r,errMsg:n}=yield L("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 xl()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return g(this,null,function*(){try{let r=yield L("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=()=>{lg("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=c=>{var l;if(c.UUID!==n)return;let d=(l=t.callbacks)==null?void 0:l[c.event];d&&Y9(d,c.data),["onAdClosed","onAdError","onAdDismissed"].includes(c.event)&&a()};we("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}=L("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}}};Wm=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){qr(this,"providers",void 0),qr(this,"helper",void 0),qr(this,"adsContext",null),qr(this,"_isAdsReady",!1),qr(this,"init",()=>g(this,null,function*(){this.helper.canIUse()?(yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1:this._isAdsReady=!1})),qr(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)}),qr(this,"reinit",n=>g(this,null,function*(){this.destroy(n),yield this.init()})),qr(this,"requestAds",(n,i)=>g(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")}})),qr(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>g(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=l=>{var d,u,p;i||(i=!0,l==="dismissed"&&((d=this.adsContext)==null||d.adDismissed()),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.call(u),this.reinit(l))},c={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var l;n=!0,(l=this.adsContext)==null||l.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:c})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new Dl(t),this.init()}};zm=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;Ur(this,"providers",void 0),Ur(this,"helper",void 0),Ur(this,"adsContext",null),Ur(this,"_isAdsReady",!1),Ur(this,"init",()=>g(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),Ur(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))}),Ur(this,"reinit",function(o){return g(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,a),yield n.init()})}),Ur(this,"requestAds",(i,o)=>g(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")}})),Ur(this,"showAd",()=>g(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=l=>{var d,u;a||(a=!0,(u=(d=this.adsContext)==null?void 0:d.afterAd)==null||u.call(d),this.reinit(l))},c={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:c})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new Dl(t),this.init()}};Km=class{constructor(t,r){va(this,"name","INTERNAL_NATIVE"),va(this,"context",void 0),va(this,"rewardAdManager",void 0),va(this,"interstitialManager",void 0),va(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 Wm(this.context,n)),i.length>0&&(this.interstitialManager=new zm(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 g(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 c;(c=t.adBreakDone)==null||c.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:c=>{var l;(l=t.adBreakDone)==null||l.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:c})}},s);break}}}},Em="jolibox-nb-proxy",nW=0;Al=()=>{try{if(window.parent&&window.parent!==window)return oW("GameSDK")}catch(e){}};Ym=class{constructor(){ln(this,"adsContext",null),ln(this,"_isReady",!1),ln(this,"_isAvailable",!1),ln(this,"init",()=>g(this,null,function*(){this._isReady=!1;let t=Al();if(t)try{if(this._isAvailable=yield t.isAvailable("rewarded"),console.log("[JoliboxSDK] NewsBreak init isAvailable",this._isAvailable),!this._isAvailable)return;let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r),this._isReady=r.success&&r.ready}catch(r){this._isReady=!1}})),ln(this,"destroy",t=>{var r,n;this._isReady=!1,(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),ln(this,"reinit",t=>g(this,null,function*(){this.destroy(t),yield this.init()})),ln(this,"requestAds",t=>g(this,null,function*(){if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Al();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}if(this._isReady){console.log("[JoliboxSDK] NewsBreak requestAds isReady from cache"),this.showAd();return}let n=yield r.isRewardReady();if(console.log("[JoliboxSDK] NewsBreak requestAds sdk.isRewardReady",n),n)this._isReady=!0,this.showAd();else{let i=window.setTimeout(()=>{this._isReady||this.reinit("timeout")},5e3);r.createRewardAd({platform:"jolibox"}).then(o=>{clearTimeout(i),o.success&&o.ready?(this._isReady=!0,this.showAd()):this.reinit("noAdPreloaded")}).catch(()=>{clearTimeout(i),this.reinit("noAdPreloaded")})}})),ln(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>g(this,null,function*(){var t,r,n,i,o,a,s,c,l,d,u,p,f,m;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let v=Al();if(!v){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let b=yield v.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",b),!b.success){(a=(o=this.adsContext)==null?void 0:o.afterAd)==null||a.call(o),this.reinit("error");return}b.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(l=(c=this.adsContext)==null?void 0:c.afterAd)==null||l.call(c),this.reinit("viewed")):((d=this.adsContext)==null||d.adDismissed(),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.call(u),this.reinit("dismissed"))}catch(b){console.error("[JoliboxSDK] NewsBreak showRewardAd failed:",b),(m=(f=this.adsContext)==null?void 0:f.afterAd)==null||m.call(f),this.reinit("error")}}))}),this.init()}};Xm=class{constructor(){XT(this,"name","NEWSBREAK"),XT(this,"rewardAdManager",void 0)}init(){return g(this,null,function*(){let t=Al();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new Ym})}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})}})}};Ji=class{constructor(t){if($t(this,"context",void 0),$t(this,"contextInfo",void 0),$t(this,"providers",{}),$t(this,"channelPolicy",void 0),$t(this,"adsActionDetection",void 0),$t(this,"requestContext",void 0),$t(this,"adsRequest",void 0),$t(this,"initialized",!1),$t(this,"adsIsShowing",!1),$t(this,"lastAdBreak",void 0),$t(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Rm(this.context),this.adsActionDetection=new Om(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new Nl(t),this.requestContext=new Ia(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return g(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 c=new Vm(this.context,s.params);yield c.init(),this.providers[s.provider]=c;break}case"ADSENSE":case"ADSENSE_ADMOB":{let c=new Nm(this.context,s.params);yield c.init(),this.providers[s.provider]=c;break}case"OKSPIN":{let c=new Bm(this.context,s.params);yield c.init(),this.providers.OKSPIN=c;break}case"APPSROCKETS":{let c=new Jm(this.context,s.params);yield c.init(),this.providers.APPSROCKETS=c;break}case"ADSENSE_BANNER_AS_AFG":{let c=new Gm(this.context,s.params);yield c.init(),this.providers.ADSENSE_BANNER_AS_AFG=c;break}case"INTERNAL_NATIVE":{let c=new Km(this.context,s.params);yield c.init(),this.providers.INTERNAL_NATIVE=c;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",s);let c=new Xm;yield c.init(),this.providers.NEWSBREAK=c;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 g(this,null,function*(){var r,n,i,o,a,s,c,l,d,u,p,f,m,v,b,y;let _=Date.now();if(_-this.initializedTimeStamp<3e3){(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&&_-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=_,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()){(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 E=yield this.adsRequest.getAFGAdsInfo(t.type),C=E==null?void 0:E.data,x=E==null?void 0:E.code;if(x==="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 k,A,H,ue;(k=t.beforeAd)==null||k.call(t),(A=t.adViewed)==null||A.call(t),(H=t.afterAd)==null||H.call(t),(ue=t.adBreakDone)==null||ue.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(c=t.beforeAd)==null||c.call(t),(l=t.afterAd)==null||l.call(t),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!C||x!=="SUCCESS"){(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(C.length===0){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let k=!0,A=null,H=new Pm(this.context);this.adsActionDetection.adBreakIsShowing=!0;let ue=C.filter(J=>J.isNative).sort((J,V)=>J.seq-V.seq),N=C.filter(J=>!J.isNative).sort((J,V)=>J.seq-V.seq),O={seq:(m=(f=ue[0])==null?void 0:f.seq)!=null?m:0,provider:"INTERNAL_NATIVE",params:ue},F;for(ue.length>0?F=[O].concat(N):F=N,F=F.sort((J,V)=>J.seq-V.seq).map((J,V)=>CV(eP({},J),{seq:V}));F.length>0;){let J=F.shift(),V=this.providers[J.provider];if(V){let[Mt,Mh]=yield H.callAdBreakAndContinue(V,t,J,Wl=>{var Oa;this.adsIsShowing=Wl,(Oa=this.context.eventEmitter)==null||Oa.emit("isAdShowing",Wl)});k=Mt,A=Mh}else k=!0,A={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!k)break}k&&A&&((v=t.adBreakDone)==null||v.call(t,A))}}catch(E){(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(y=this.context.eventEmitter)==null||y.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.")}};Qm=class{constructor(t){yl(this,"context",void 0),yl(this,"currentProvider",void 0),yl(this,"continueCallback",void 0),yl(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),xl()&&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 g(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)})})}};at=class e extends Error{constructor(t,r){super(t.message),Am(this,"name",void 0),Am(this,"type",void 0),Am(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)}}};Zm=class{constructor(t,r,n){me(this,"adsLoader",void 0),me(this,"adDisplayContainer",void 0),me(this,"isAdPlaying",!1),me(this,"isContentFinished",!1),me(this,"videoContent",void 0),me(this,"adContainer",void 0),me(this,"adsManager",void 0),me(this,"intervalTimer",void 0),me(this,"completed",!1),me(this,"adTagUrl",void 0),me(this,"notifyRequestAd",void 0),me(this,"notifyLoaded",void 0),me(this,"notifyPlayingAd",void 0),me(this,"notifyCompleted",void 0),me(this,"notifyError",void 0),me(this,"destroy",()=>{var i,o,a,s,c,l,d,u,p,f,m;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),(c=this.adsManager)==null||c.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(l=this.adsManager)==null||l.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),(d=this.adsManager)==null||d.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),(u=this.adsManager)==null||u.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),(f=this.adsManager)==null||f.removeEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),(m=this.adsManager)==null||m.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent)}),me(this,"requestAds",(i,o)=>g(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=u=>{var p;return(p=i.onAdError)==null?void 0:p.call(i,at.from(u,"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 u;this.isAdPlaying||(this.isContentFinished=!0,(u=this.adsLoader)==null||u.contentComplete())};this.videoContent.onended=s;let c=new window.google.ima.AdsRequest;c.vastLoadTimeout=1e4;let l="";Object.keys(o.params).forEach(u=>{let p=window.encodeURIComponent(o.params[u]);l+=`&${u}=${p}`});let d=`${this.adTagUrl}${l}`;c.adTagUrl=d,c.linearAdSlotWidth=640,c.linearAdSlotHeight=400,c.nonLinearAdSlotWidth=640,c.nonLinearAdSlotHeight=150,this.adsLoader.requestAds(c),(a=this.notifyRequestAd)==null||a.call(this)})),me(this,"createAdDisplayContainer",()=>{this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoContent)}),me(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()}}),me(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()}),me(this,"onAdEvent",i=>{var o,a,s,c;let l=i.getAd();switch(i.type){case window.google.ima.AdEvent.Type.LOADED:l!=null&&l.isLinear()||this.videoContent.play(),(o=this.notifyLoaded)==null||o.call(this,i);break;case window.google.ima.AdEvent.Type.STARTED:l!=null&&l.isLinear()&&(this.intervalTimer=window.setInterval(function(){},300)),(a=this.notifyPlayingAd)==null||a.call(this,i);break;case window.google.ima.AdEvent.Type.COMPLETE:l!=null&&l.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:l!=null&&l.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(c=this.notifyCompleted)==null||c.call(this,i));break}}),me(this,"onAdError",i=>{var o,a;(o=this.notifyError)==null||o.call(this,i.getError()),(a=this.adsManager)==null||a.destroy()}),me(this,"onContentPauseRequested",()=>{this.isAdPlaying=!0,this.videoContent.pause()}),me(this,"onContentResumeRequested",()=>{this.isAdPlaying=!1}),this.adTagUrl=t,this.videoContent=r,this.adContainer=n}},Cl=(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))(Cl||{}),yW=()=>{let e=W(!1),t=W(!1),r=W(null),n=ho(),i=ho();return{visible:e,canRetry:t,retry:r,videoRef:n,adContainerRef:i}},bW=st`
|
|
869
|
+
`,RP=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:c,src:l}=t,[d,u]=Sr(!1),p=m=>{var v,b,y,_;u(!1),c.value=!1,m==="dismiss"?(v=n.value)==null||v.call(n):m==="viewed"&&((b=i.value)==null||b.call(i)),(y=r.value)==null||y.call(r),(_=o.value)==null||_.call(o)},f=()=>{var m;(m=a.value)==null||m.call(a)};return Mi("appsrockets_ad_dismissed",()=>p("dismiss")),Mi("appsrockets_ad_rewarded",()=>p("viewed")),Mi("appsrockets_ad_completed",()=>p("viewed")),Mi("appsrockets_ad_skipped",()=>p("viewed")),Mi("appsrockets_ad_clicked",m=>{var v;return(v=s.value)==null?void 0:v.call(s,m)}),Mi("appsrockets_ad_loaded",()=>u(!0)),c.value?G("div",{className:D9,style:{display:d?"flex":"none"},children:c.value&&G("iframe",{src:l.value,onLoad:f,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};Jm=class{constructor(t,r){Lr(this,"name","APPSROCKETS"),Lr(this,"initialized",!1),Lr(this,"initCompleter",null),Lr(this,"context",void 0),Lr(this,"adsOverlay",null),Lr(this,"adsIsShowing",!1),Lr(this,"lastUnDisplayedAdBreak",null),Lr(this,"state",OP()),Lr(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),c=new URLSearchParams(s.search);return c.has("joliSource")||c.set("joliSource",a.joliSource),c.get("osType")||c.set("osType",a.osType),c.get("runtimeType")||c.set("runtimeType",a.runtimeType),c.get("mode")||c.set("mode","AFG"),c.get("deviceId")||c.set("deviceId",a.deviceId),c.get("statusBarHeight")||c.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),c.get("adsType")||c.set("adsType",i),s.search=c.toString(),s.toString()}),this.context=t}init(){return g(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),Qt(G(RP,{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,c,l,d;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 u=f=>{var m,v;(v=(m=this.context).handleLinkClicked)==null||v.call(m,f)},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 f=()=>{var b;this.adsIsShowing=!1,(b=t.afterAd)==null||b.call(t)},m=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},v=()=>{var b;this.adsIsShowing=!1,(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};Ce(()=>{this.adsIsShowing=!0,this.state.afterAd.value=f,this.state.adBreakDone.value=m,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=u,this.state.adError.value=v,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((c=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||c.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),(l=t.beforeAd)==null||l.call(t);let f=()=>{var C;this.adsIsShowing=!1,(C=t.afterAd)==null||C.call(t)},m={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},v=()=>{var C;this.adsIsShowing=!1,m.breakStatus="dismissed",(C=t.adDismissed)==null||C.call(t)},b=()=>{var C;this.adsIsShowing=!1,m.breakStatus="viewed",(C=t.adViewed)==null||C.call(t)},y=()=>{var C;this.adsIsShowing=!1,(C=t.adBreakDone)==null||C.call(t,m)},_=()=>{this.adsIsShowing=!1,m.breakStatus="noAdPreloaded"};Ce(()=>{this.state.afterAd.value=f,this.state.adDismissed.value=v,this.state.adViewed.value=b,this.state.adBreakDone.value=y,this.state.adLinkClicked.value=u,this.state.adError.value=_});let E=()=>{var C;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(C=t.adBreakDone)==null||C.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,Ce(()=>{this.state.src.value=this.processUrl(r.params.url,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(d=t.beforeReward)==null||d.call(t,E);break}}}},NP=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};DP=class{constructor(e,t,r){it(this,"adUnit",void 0),it(this,"project",void 0),it(this,"keyValue",void 0),it(this,"adsContext",null),it(this,"rewardedSlot",null),it(this,"rewardedPayload",null),it(this,"readyEvent",null),it(this,"withCommand",function(){googletag.cmd.push(...arguments)}),it(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))}),it(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)}),it(this,"reinit",n=>{this.destroy(n),this.init()}),it(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),it(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)})}}),it(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),it(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),it(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,c;(s=(a=this.adsContext)==null?void 0:a.beforeAd)==null||s.call(a),(c=this.readyEvent)==null||c.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,NP(),this.withCommand(()=>{this.init()})}};Hm=class{constructor(t,r,n){var i=this;vt(this,"adUnit",void 0),vt(this,"project",void 0),vt(this,"keyValue",void 0),vt(this,"adsContext",null),vt(this,"gamingInterstitialSlot",null),vt(this,"readyEvent",null),vt(this,"isRetrying",!1),vt(this,"withCommand",function(){googletag.cmd.push(...arguments)}),vt(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))}),vt(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)}),vt(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(o,a),i.init()}),vt(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),vt(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")}))}),vt(this,"requestAds",o=>{this.withCommand(()=>{var a,s,c;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()):((c=(s=this.adsContext).onEnd)==null||c.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)))})}),NP(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};Vm=class{constructor(t,r){Jn(this,"name","GOOGLE_GPT"),Jn(this,"context",void 0),Jn(this,"contextInfo",void 0),Jn(this,"initParams",void 0),Jn(this,"rewardAdManager",void 0),Jn(this,"interstitialManager",void 0),Jn(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 g(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 DP(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Hm(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}}}};$m=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";Im(this,"context",void 0),Im(this,"placement","GAME"),Im(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:aP.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:iP.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:oP.WebSDK};return zV(i)}};Ia=class{constructor(t){dt(this,"context",void 0),dt(this,"adsTrackSerializer",void 0),dt(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new $m(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}}},Nl=class{constructor(t,r){var n=this;dt(this,"context",void 0),dt(this,"contextInfo",void 0),dt(this,"requestContext",void 0),dt(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),dt(this,"pendingAFVAdsInfo",Promise.resolve(null)),dt(this,"doFetchAdsInfo",i=>g(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:c,code:l}=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 l==="SUCCESS"||l==="BYPASS_ADS"?{code:l,data:c}:null})),dt(this,"cacheRewardInfo",()=>{this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),dt(this,"cacheInterstitialInfo",i=>{this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),dt(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),dt(this,"cacheNextAFGAdsInfo",i=>g(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),dt(this,"getAFGAdsInfo",i=>g(this,null,function*(){let o=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return this.cacheNextAFGAdsInfo(i),o})),dt(this,"getAFVAdsInfo",function(){return g(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 Ia(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};Y9=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)}},Dl=class{constructor(t){this.context=t,W9(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=ja(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}loadAdsAsync(t){return g(this,null,function*(){try{let{errNo:r,errMsg:n}=yield L("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 xl()&&this.canIUseHelper("loadAdsAsync")&&this.canIUseHelper("showAdAsync")}showAdAsync(t){return g(this,null,function*(){try{let r=yield L("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=()=>{lg("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=c=>{var l;if(c.UUID!==n)return;let d=(l=t.callbacks)==null?void 0:l[c.event];d&&Y9(d,c.data),["onAdClosed","onAdError","onAdDismissed"].includes(c.event)&&a()};we("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}=L("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}}};Wm=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){qr(this,"providers",void 0),qr(this,"helper",void 0),qr(this,"adsContext",null),qr(this,"_isAdsReady",!1),qr(this,"init",()=>g(this,null,function*(){this.helper.canIUse()?(yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1:this._isAdsReady=!1})),qr(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)}),qr(this,"reinit",n=>g(this,null,function*(){this.destroy(n),yield this.init()})),qr(this,"requestAds",(n,i)=>g(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")}})),qr(this,"showAd",()=>{if(!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>g(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=l=>{var d,u,p;i||(i=!0,l==="dismissed"&&((d=this.adsContext)==null||d.adDismissed()),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.call(u),this.reinit(l))},c={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var l;n=!0,(l=this.adsContext)==null||l.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:c})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new Dl(t),this.init()}};zm=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;Ur(this,"providers",void 0),Ur(this,"helper",void 0),Ur(this,"adsContext",null),Ur(this,"_isAdsReady",!1),Ur(this,"init",()=>g(this,null,function*(){this.helper.canIUse()&&((yield this.helper.loadAdsAsync({providers:this.providers})).code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1)})),Ur(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))}),Ur(this,"reinit",function(o){return g(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n.destroy(i,a),yield n.init()})}),Ur(this,"requestAds",(i,o)=>g(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")}})),Ur(this,"showAd",()=>g(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=l=>{var d,u;a||(a=!0,(u=(d=this.adsContext)==null?void 0:d.afterAd)==null||u.call(d),this.reinit(l))},c={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}};(yield this.helper.showAdAsync({providers:this.providers,callbacks:c})).code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new Dl(t),this.init()}};Km=class{constructor(t,r){va(this,"name","INTERNAL_NATIVE"),va(this,"context",void 0),va(this,"rewardAdManager",void 0),va(this,"interstitialManager",void 0),va(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 Wm(this.context,n)),i.length>0&&(this.interstitialManager=new zm(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 g(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 c;(c=t.adBreakDone)==null||c.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:c=>{var l;(l=t.adBreakDone)==null||l.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:c})}},s);break}}}},Em="jolibox-nb-proxy",nW=0;Al=()=>{try{if(window.parent&&window.parent!==window)return oW("GameSDK")}catch(e){}};Ym=class{constructor(){ln(this,"adsContext",null),ln(this,"_isReady",!1),ln(this,"_isAvailable",!1),ln(this,"init",()=>g(this,null,function*(){this._isReady=!1;let t=Al();if(t)try{if(this._isAvailable=yield t.isAvailable("rewarded"),console.log("[JoliboxSDK] NewsBreak init isAvailable",this._isAvailable),!this._isAvailable)return;let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r),this._isReady=r.success&&r.ready}catch(r){this._isReady=!1}})),ln(this,"destroy",t=>{var r,n;this._isReady=!1,(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),ln(this,"reinit",t=>g(this,null,function*(){console.log("[JoliboxSDK] NewsBreak reinit breakStatus:",t),this.destroy(t),yield this.init()})),ln(this,"requestAds",t=>g(this,null,function*(){if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Al();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}if(this._isReady){console.log("[JoliboxSDK] NewsBreak requestAds isReady from cache"),this.showAd();return}let n=yield r.isRewardReady();console.log("[JoliboxSDK] NewsBreak requestAds sdk.isRewardReady",n),n?(this._isReady=!0,this.showAd()):(yield r.createRewardAd({platform:"jolibox"}),this.showAd())})),ln(this,"showAd",()=>{if(console.log("[JoliboxSDK] NewsBreak showAd"),!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>g(this,null,function*(){var t,r,n,i,o,a,s,c,l,d,u,p,f,m;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let v=Al();if(!v){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let b=yield v.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",b),!b.success){(a=(o=this.adsContext)==null?void 0:o.afterAd)==null||a.call(o),this.reinit("error");return}b.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(l=(c=this.adsContext)==null?void 0:c.afterAd)==null||l.call(c),this.reinit("viewed")):((d=this.adsContext)==null||d.adDismissed(),(p=(u=this.adsContext)==null?void 0:u.afterAd)==null||p.call(u),this.reinit("dismissed"))}catch(b){console.error("[JoliboxSDK] NewsBreak showRewardAd failed:",b),(m=(f=this.adsContext)==null?void 0:f.afterAd)==null||m.call(f),this.reinit("error")}}))}),this.init()}};Xm=class{constructor(){XT(this,"name","NEWSBREAK"),XT(this,"rewardAdManager",void 0)}init(){return g(this,null,function*(){let t=Al();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new Ym})}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})}})}};Ji=class{constructor(t){if($t(this,"context",void 0),$t(this,"contextInfo",void 0),$t(this,"providers",{}),$t(this,"channelPolicy",void 0),$t(this,"adsActionDetection",void 0),$t(this,"requestContext",void 0),$t(this,"adsRequest",void 0),$t(this,"initialized",!1),$t(this,"adsIsShowing",!1),$t(this,"lastAdBreak",void 0),$t(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new Rm(this.context),this.adsActionDetection=new Om(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new Nl(t),this.requestContext=new Ia(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return g(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 c=new Vm(this.context,s.params);yield c.init(),this.providers[s.provider]=c;break}case"ADSENSE":case"ADSENSE_ADMOB":{let c=new Nm(this.context,s.params);yield c.init(),this.providers[s.provider]=c;break}case"OKSPIN":{let c=new Bm(this.context,s.params);yield c.init(),this.providers.OKSPIN=c;break}case"APPSROCKETS":{let c=new Jm(this.context,s.params);yield c.init(),this.providers.APPSROCKETS=c;break}case"ADSENSE_BANNER_AS_AFG":{let c=new Gm(this.context,s.params);yield c.init(),this.providers.ADSENSE_BANNER_AS_AFG=c;break}case"INTERNAL_NATIVE":{let c=new Km(this.context,s.params);yield c.init(),this.providers.INTERNAL_NATIVE=c;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",s);let c=new Xm;yield c.init(),this.providers.NEWSBREAK=c;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 g(this,null,function*(){var r,n,i,o,a,s,c,l,d,u,p,f,m,v,b,y;let _=Date.now();if(_-this.initializedTimeStamp<3e3){(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&&_-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=_,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){(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 E=yield this.adsRequest.getAFGAdsInfo(t.type),C=E==null?void 0:E.data,x=E==null?void 0:E.code;if(x==="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 k,A,H,ue;(k=t.beforeAd)==null||k.call(t),(A=t.adViewed)==null||A.call(t),(H=t.afterAd)==null||H.call(t),(ue=t.adBreakDone)==null||ue.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(c=t.beforeAd)==null||c.call(t),(l=t.afterAd)==null||l.call(t),(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!C||x!=="SUCCESS"){(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(C.length===0){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let k=!0,A=null,H=new Pm(this.context);this.adsActionDetection.adBreakIsShowing=!0;let ue=C.filter(J=>J.isNative).sort((J,V)=>J.seq-V.seq),N=C.filter(J=>!J.isNative).sort((J,V)=>J.seq-V.seq),O={seq:(m=(f=ue[0])==null?void 0:f.seq)!=null?m:0,provider:"INTERNAL_NATIVE",params:ue},F;for(ue.length>0?F=[O].concat(N):F=N,F=F.sort((J,V)=>J.seq-V.seq).map((J,V)=>CV(eP({},J),{seq:V}));F.length>0;){let J=F.shift(),V=this.providers[J.provider];if(V){let[Mt,Mh]=yield H.callAdBreakAndContinue(V,t,J,Wl=>{var Oa;this.adsIsShowing=Wl,(Oa=this.context.eventEmitter)==null||Oa.emit("isAdShowing",Wl)});k=Mt,A=Mh}else k=!0,A={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!k)break}k&&A&&((v=t.adBreakDone)==null||v.call(t,A))}}catch(E){(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{this.adsIsShowing=!1,(y=this.context.eventEmitter)==null||y.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.")}};Qm=class{constructor(t){yl(this,"context",void 0),yl(this,"currentProvider",void 0),yl(this,"continueCallback",void 0),yl(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),xl()&&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 g(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)})})}};at=class e extends Error{constructor(t,r){super(t.message),Am(this,"name",void 0),Am(this,"type",void 0),Am(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)}}};Zm=class{constructor(t,r,n){me(this,"adsLoader",void 0),me(this,"adDisplayContainer",void 0),me(this,"isAdPlaying",!1),me(this,"isContentFinished",!1),me(this,"videoContent",void 0),me(this,"adContainer",void 0),me(this,"adsManager",void 0),me(this,"intervalTimer",void 0),me(this,"completed",!1),me(this,"adTagUrl",void 0),me(this,"notifyRequestAd",void 0),me(this,"notifyLoaded",void 0),me(this,"notifyPlayingAd",void 0),me(this,"notifyCompleted",void 0),me(this,"notifyError",void 0),me(this,"destroy",()=>{var i,o,a,s,c,l,d,u,p,f,m;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),(c=this.adsManager)==null||c.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(l=this.adsManager)==null||l.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),(d=this.adsManager)==null||d.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),(u=this.adsManager)==null||u.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),(f=this.adsManager)==null||f.removeEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),(m=this.adsManager)==null||m.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent)}),me(this,"requestAds",(i,o)=>g(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=u=>{var p;return(p=i.onAdError)==null?void 0:p.call(i,at.from(u,"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 u;this.isAdPlaying||(this.isContentFinished=!0,(u=this.adsLoader)==null||u.contentComplete())};this.videoContent.onended=s;let c=new window.google.ima.AdsRequest;c.vastLoadTimeout=1e4;let l="";Object.keys(o.params).forEach(u=>{let p=window.encodeURIComponent(o.params[u]);l+=`&${u}=${p}`});let d=`${this.adTagUrl}${l}`;c.adTagUrl=d,c.linearAdSlotWidth=640,c.linearAdSlotHeight=400,c.nonLinearAdSlotWidth=640,c.nonLinearAdSlotHeight=150,this.adsLoader.requestAds(c),(a=this.notifyRequestAd)==null||a.call(this)})),me(this,"createAdDisplayContainer",()=>{this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoContent)}),me(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()}}),me(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()}),me(this,"onAdEvent",i=>{var o,a,s,c;let l=i.getAd();switch(i.type){case window.google.ima.AdEvent.Type.LOADED:l!=null&&l.isLinear()||this.videoContent.play(),(o=this.notifyLoaded)==null||o.call(this,i);break;case window.google.ima.AdEvent.Type.STARTED:l!=null&&l.isLinear()&&(this.intervalTimer=window.setInterval(function(){},300)),(a=this.notifyPlayingAd)==null||a.call(this,i);break;case window.google.ima.AdEvent.Type.COMPLETE:l!=null&&l.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:l!=null&&l.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(c=this.notifyCompleted)==null||c.call(this,i));break}}),me(this,"onAdError",i=>{var o,a;(o=this.notifyError)==null||o.call(this,i.getError()),(a=this.adsManager)==null||a.destroy()}),me(this,"onContentPauseRequested",()=>{this.isAdPlaying=!0,this.videoContent.pause()}),me(this,"onContentResumeRequested",()=>{this.isAdPlaying=!1}),this.adTagUrl=t,this.videoContent=r,this.adContainer=n}},Cl=(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))(Cl||{}),yW=()=>{let e=W(!1),t=W(!1),r=W(null),n=ho(),i=ho();return{visible:e,canRetry:t,retry:r,videoRef:n,adContainerRef:i}},bW=st`
|
|
870
870
|
${Ge}
|
|
871
871
|
position: fixed;
|
|
872
872
|
left: 0;
|