handler-playable-sdk 0.2.7 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-UVBNGLP3.mjs → chunk-U4PCKCX6.mjs} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/pixi/index.d.mts +23 -0
- package/dist/pixi/index.d.ts +23 -0
- package/dist/pixi/index.js +7 -7
- package/dist/pixi/index.mjs +5 -5
- package/dist/three/index.js +1 -1
- package/dist/three/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var u={};function I(e,t,n=!1){u[e]||(u[e]=[]),u[e].push({fn:t,once:n})}function V(e,t){if(u[e]){if(!t){delete u[e];return}u[e]=u[e].filter(n=>n.fn!==t)}}function P(e,...t){let n=u[e];if(n)for(let i of[...n])i.fn(...t),i.once&&V(e,i.fn)}function a(e,t){I(e,t,!0)}var R={name:"handler-playable-sdk",version:"0.2.7",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var s=0,Se=s++,Z=s++,ee=s++,te=s++,ne=s++,ie=s++,oe=s++,re=s++,ae=s++,se=s++,de=s++,le=s++,r=Se;function ce(){return r===Z}function ue(){return r===ee}function pe(){return r===te}function fe(){return r===ne}function g(){return r===ie}function y(){return r===oe}function me(){return r===re}function ge(){return r===ae}function ye(){return r===se}function H(){return r===de}function F(){return r===le}function we(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),r=Z;return}catch{}else if(e==="dapi")try{dapi.isReady(),r=ee;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(r=te)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(r=ne)}catch{}else if(t==="mintegral")window.gameReady&&(r=ie);else if(t==="tapjoy")window.TJ_API&&(r=oe);else if(t==="tiktok")window.openAppStore&&(r=re);else if(t==="smadex")try{window.smxTracking&&(r=ae)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(r=se)}catch{}else t==="vungle"?r=de:(e==="nucleo"||t==="nucleo")&&(r=le)}var Ee={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Ce=Math.random().toString(36).slice(2),w=null,A={...Ee},Ae="web_embed",De={},G=!1,E=!1,T=!1,ke=!1,B=1,W=0,z=!1,d=!1,N="",h=Math.floor(window.innerWidth),b=Math.floor(window.innerHeight),K=h>b,l=!1,k=!1,he=!1,be=!1,U=!1,j=null;function xe(){if(w)return w;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),w=e,e}function M(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Te(e,t){return{event_name:e,ts:Date.now(),session_id:Ce,deployment_id:A.deployment_id,variant_id:A.variant_id,export_profile_id:A.profile_id,instance_id:A.instance_id||"default",env:Ae==="mraid"?"mraid":"web",payload:t}}function o(e,t){let n=M(e),i=Te(n,t);P(n,i),n!==e&&P(e,i)}function O(){j&&(j(h,b),j=null)}function x(e){B=e,o("volume",e)}function _(e){e&&(ke=!0),!T&&(T=!0,o("pause"),x(0))}function S(e){!e&&ke||T&&(T=!1,o("resume"),x(B))}function f(e,t){h=Math.floor(e||window.innerWidth),b=Math.floor(t||window.innerHeight),K=h>b,o("resize",{width:h,height:b})}function Le(){if(ce())try{let e=mraid.getMaxSize();f(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?S():_()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();f(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();x(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&x(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),z=!0,mraid.isViewable()&&mraid.getState()!=="hidden")l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ie(){if(ue())try{let e=dapi.getScreenSize();f(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?S():_()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();f(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(x(t?1:0),dapi.addEventListener("audioVolumeChange",n=>x(n?1:0)),z=!0,dapi.isViewable())l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function _e(){let e=()=>{l||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(l=!0,o("boot"),o("view"),o("ready"),d=!0,O(),k&&(k=!1,p.start()))};window.addEventListener("resize",()=>f()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(S(),e()):_()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),z=!0}function Pe(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(he=!0),!(he&&t instanceof MouseEvent)&&(W+=1,o("interaction",W))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function Re(e){var i,c,v,C,J,D,q,L,$,X,Y,Q;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(y())(v=(c=window.TJ_API)==null?void 0:c.click)==null||v.call(c);else if(pe())(J=(C=window.FbPlayableAd)==null?void 0:C.onCTAClick)==null||J.call(C);else if(ye())(q=(D=window.ScPlayableAd)==null?void 0:D.onCTAClick)==null||q.call(D);else if(ge())try{($=(L=window.smxTracking)==null?void 0:L.redirect)==null||$.call(L)}catch(m){console.warn("Smadex redirect failed",m)}else if(fe()){let m=window.ExitApi;m&&typeof m.exit=="function"?m.exit(e||N||""):e&&window.open(e)}else g()?(X=window.install)==null||X.call(window):me()?(Y=window.openAppStore)==null||Y.call(window):H()?(Q=parent==null?void 0:parent.postMessage)==null||Q.call(parent,"download","*"):e&&window.open(e)}function je(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;a("view",()=>t(n.mraid_viewable)),a("start",()=>t(n.game_viewable)),a("engagement",()=>t(n.engagement));let i=()=>t(n.complete);a("complete",i),I("engagement",c=>{var v;((v=c==null?void 0:c.payload)==null?void 0:v.count)>3&&i()}),a("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;a("view",()=>t(n.Ad_Load_Start)),a("start",()=>t(n.Ad_Viewable)),a("engagement",()=>t(n.First_Engagement)),a("complete",()=>t(n.Gameplay_Complete)),a("cta_click",()=>t(n.DSP_Click)),a("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Me(){if(!y())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{p.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function ve(){var t,n,i;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(n=e==null?void 0:e.playableFinished)==null||n.call(e),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Ne(){g()&&(window.mintGameStart=()=>{S(!0),f()},window.mintGameClose=()=>{_(!0)})}function ze(){if(!F())return;let e=window.NUC;!e||!e.trigger||(p.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,N)}),p.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var p={init(e={},t){if(Ae=e.profile||"web_embed",De=e.consent||{},A={...Ee,...e.ids||{}},w=e.rootEl||w,N=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(j=t),o("init"),document.body.oncontextmenu=()=>!1,xe(),Ve(w),we(),Le(),Ie(),!z){if(document.readyState==="complete")_e();else if(!be){be=!0;let n=()=>{_e(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Pe(),je(),Me(),Ne(),ze(),console.log(`%c @handler/playable-sdk %c v${R.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),l&&!d&&(o("boot"),o("view"),o("ready"),k&&(k=!1,p.start()),d=!0),d=l},getRoot(){return xe()},get version(){return R.version||"0.0.0"},get maxWidth(){return h},get maxHeight(){return b},get isLandscape(){return K},get isReady(){return d},get isStarted(){return G},get isPaused(){return T},get isFinished(){return E},get volume(){return B},get interactions(){return W},on(e,t){I(M(e),t)},off(e,t){V(M(e),t)},start(){var e,t;if(!G){if(!l){k=!0;return}if(G=!0,o("start"),f(),g())_(),(e=window.gameReady)==null||e.call(window);else if(y()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:K?"landscape":"portrait",buildID:R.version||"dev"})}}},finish(){var e,t;E||(E=!0,o("complete"),g()?(e=window.gameEnd)==null||e.call(window):H()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):y()&&ve())},install(e){if(!E){E=!0,y()?(ve(),setTimeout(()=>p.install(e),300)):(o("complete"),setTimeout(()=>p.install(e),0));return}U||(U=!0,setTimeout(()=>U=!1,500),o("cta_click"),o("conversion"),Re(e||N))},emit(e,t){let n=M(e);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=Te(n,t);P(n,i)},retry(){var e,t,n;if(g())(e=window.gameRetry)==null||e.call(window);else if(F()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}o("engagement",{action:"retry"})},pause(){_(!0)},resume(){S(!0)},resize(e,t){f(e,t)}},Be=p;function Ve(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1
|
+
var u={};function I(e,t,n=!1){u[e]||(u[e]=[]),u[e].push({fn:t,once:n})}function V(e,t){if(u[e]){if(!t){delete u[e];return}u[e]=u[e].filter(n=>n.fn!==t)}}function P(e,...t){let n=u[e];if(n)for(let i of[...n])i.fn(...t),i.once&&V(e,i.fn)}function a(e,t){I(e,t,!0)}var R={name:"handler-playable-sdk",version:"0.3.1",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var s=0,Se=s++,Z=s++,ee=s++,te=s++,ne=s++,ie=s++,oe=s++,re=s++,ae=s++,se=s++,de=s++,le=s++,r=Se;function ce(){return r===Z}function ue(){return r===ee}function pe(){return r===te}function fe(){return r===ne}function g(){return r===ie}function y(){return r===oe}function me(){return r===re}function ge(){return r===ae}function ye(){return r===se}function H(){return r===de}function F(){return r===le}function we(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),r=Z;return}catch{}else if(e==="dapi")try{dapi.isReady(),r=ee;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(r=te)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(r=ne)}catch{}else if(t==="mintegral")window.gameReady&&(r=ie);else if(t==="tapjoy")window.TJ_API&&(r=oe);else if(t==="tiktok")window.openAppStore&&(r=re);else if(t==="smadex")try{window.smxTracking&&(r=ae)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(r=se)}catch{}else t==="vungle"?r=de:(e==="nucleo"||t==="nucleo")&&(r=le)}var Ee={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Ce=Math.random().toString(36).slice(2),w=null,A={...Ee},Ae="web_embed",De={},G=!1,E=!1,T=!1,ke=!1,B=1,W=0,z=!1,d=!1,N="",h=Math.floor(window.innerWidth),b=Math.floor(window.innerHeight),K=h>b,l=!1,k=!1,he=!1,be=!1,U=!1,j=null;function xe(){if(w)return w;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),w=e,e}function M(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Te(e,t){return{event_name:e,ts:Date.now(),session_id:Ce,deployment_id:A.deployment_id,variant_id:A.variant_id,export_profile_id:A.profile_id,instance_id:A.instance_id||"default",env:Ae==="mraid"?"mraid":"web",payload:t}}function o(e,t){let n=M(e),i=Te(n,t);P(n,i),n!==e&&P(e,i)}function O(){j&&(j(h,b),j=null)}function x(e){B=e,o("volume",e)}function _(e){e&&(ke=!0),!T&&(T=!0,o("pause"),x(0))}function S(e){!e&&ke||T&&(T=!1,o("resume"),x(B))}function f(e,t){h=Math.floor(e||window.innerWidth),b=Math.floor(t||window.innerHeight),K=h>b,o("resize",{width:h,height:b})}function Le(){if(ce())try{let e=mraid.getMaxSize();f(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?S():_()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();f(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();x(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&x(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),z=!0,mraid.isViewable()&&mraid.getState()!=="hidden")l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ie(){if(ue())try{let e=dapi.getScreenSize();f(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?S():_()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();f(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(x(t?1:0),dapi.addEventListener("audioVolumeChange",n=>x(n?1:0)),z=!0,dapi.isViewable())l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function _e(){let e=()=>{l||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(l=!0,o("boot"),o("view"),o("ready"),d=!0,O(),k&&(k=!1,p.start()))};window.addEventListener("resize",()=>f()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(S(),e()):_()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),z=!0}function Pe(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(he=!0),!(he&&t instanceof MouseEvent)&&(W+=1,o("interaction",W))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function Re(e){var i,c,v,C,J,D,q,L,$,X,Y,Q;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(y())(v=(c=window.TJ_API)==null?void 0:c.click)==null||v.call(c);else if(pe())(J=(C=window.FbPlayableAd)==null?void 0:C.onCTAClick)==null||J.call(C);else if(ye())(q=(D=window.ScPlayableAd)==null?void 0:D.onCTAClick)==null||q.call(D);else if(ge())try{($=(L=window.smxTracking)==null?void 0:L.redirect)==null||$.call(L)}catch(m){console.warn("Smadex redirect failed",m)}else if(fe()){let m=window.ExitApi;m&&typeof m.exit=="function"?m.exit(e||N||""):e&&window.open(e)}else g()?(X=window.install)==null||X.call(window):me()?(Y=window.openAppStore)==null||Y.call(window):H()?(Q=parent==null?void 0:parent.postMessage)==null||Q.call(parent,"download","*"):e&&window.open(e)}function je(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;a("view",()=>t(n.mraid_viewable)),a("start",()=>t(n.game_viewable)),a("engagement",()=>t(n.engagement));let i=()=>t(n.complete);a("complete",i),I("engagement",c=>{var v;((v=c==null?void 0:c.payload)==null?void 0:v.count)>3&&i()}),a("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;a("view",()=>t(n.Ad_Load_Start)),a("start",()=>t(n.Ad_Viewable)),a("engagement",()=>t(n.First_Engagement)),a("complete",()=>t(n.Gameplay_Complete)),a("cta_click",()=>t(n.DSP_Click)),a("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Me(){if(!y())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{p.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function ve(){var t,n,i;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(n=e==null?void 0:e.playableFinished)==null||n.call(e),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Ne(){g()&&(window.mintGameStart=()=>{S(!0),f()},window.mintGameClose=()=>{_(!0)})}function ze(){if(!F())return;let e=window.NUC;!e||!e.trigger||(p.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,N)}),p.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var p={init(e={},t){if(Ae=e.profile||"web_embed",De=e.consent||{},A={...Ee,...e.ids||{}},w=e.rootEl||w,N=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(j=t),o("init"),document.body.oncontextmenu=()=>!1,xe(),Ve(w),we(),Le(),Ie(),!z){if(document.readyState==="complete")_e();else if(!be){be=!0;let n=()=>{_e(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Pe(),je(),Me(),Ne(),ze(),console.log(`%c @handler/playable-sdk %c v${R.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),l&&!d&&(o("boot"),o("view"),o("ready"),k&&(k=!1,p.start()),d=!0),d=l},getRoot(){return xe()},get version(){return R.version||"0.0.0"},get maxWidth(){return h},get maxHeight(){return b},get isLandscape(){return K},get isReady(){return d},get isStarted(){return G},get isPaused(){return T},get isFinished(){return E},get volume(){return B},get interactions(){return W},on(e,t){I(M(e),t)},off(e,t){V(M(e),t)},start(){var e,t;if(!G){if(!l){k=!0;return}if(G=!0,o("start"),f(),g())_(),(e=window.gameReady)==null||e.call(window);else if(y()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:K?"landscape":"portrait",buildID:R.version||"dev"})}}},finish(){var e,t;E||(E=!0,o("complete"),g()?(e=window.gameEnd)==null||e.call(window):H()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):y()&&ve())},install(e){if(!E){E=!0,y()?(ve(),setTimeout(()=>p.install(e),300)):(o("complete"),setTimeout(()=>p.install(e),0));return}U||(U=!0,setTimeout(()=>U=!1,500),o("cta_click"),o("conversion"),Re(e||N))},emit(e,t){let n=M(e);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=Te(n,t);P(n,i)},retry(){var e,t,n;if(g())(e=window.gameRetry)==null||e.call(window);else if(F()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}o("engagement",{action:"retry"})},pause(){_(!0)},resume(){S(!0)},resize(e,t){f(e,t)}},Be=p;function Ve(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
2
2
|
(function(){
|
|
3
3
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
4
|
function unlock(){
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x5baf15=a0_0x3db0;(function(_0x5557eb,_0x1808ab){const _0x1312ac=a0_0x3db0,_0x54a91f=_0x5557eb();while(!![]){try{const _0x5d99fc=parseInt(_0x1312ac(0x1bc))/0x1+-parseInt(_0x1312ac(0x1e6))/0x2+-parseInt(_0x1312ac(0x1c6))/0x3*(parseInt(_0x1312ac(0x263))/0x4)+-parseInt(_0x1312ac(0x26e))/0x5+-parseInt(_0x1312ac(0x220))/0x6+-parseInt(_0x1312ac(0x25f))/0x7+parseInt(_0x1312ac(0x1fd))/0x8;if(_0x5d99fc===_0x1808ab)break;else _0x54a91f['push'](_0x54a91f['shift']());}catch(_0x467b94){_0x54a91f['push'](_0x54a91f['shift']());}}}(a0_0x358c,0x37dbf));const a0_0x51b87a=(function(){let _0x15ce14=!![];return function(_0x2dbd77,_0x1d57b5){const _0x79970=_0x15ce14?function(){const _0x1b5fd0=a0_0x3db0;if(_0x1d57b5){const _0x93d6c8=_0x1d57b5[_0x1b5fd0(0x1b5)](_0x2dbd77,arguments);return _0x1d57b5=null,_0x93d6c8;}}:function(){};return _0x15ce14=![],_0x79970;};}()),a0_0x3fa554=a0_0x51b87a(this,function(){const _0x555f08=a0_0x3db0;return a0_0x3fa554['toString']()['search'](_0x555f08(0x1e5))[_0x555f08(0x23f)]()[_0x555f08(0x1b7)](a0_0x3fa554)[_0x555f08(0x1fb)]('(((.+)+)+)+$');});a0_0x3fa554();'use strict';var V=Object[a0_0x5baf15(0x25e)],Se=Object[a0_0x5baf15(0x1eb)],Ce=Object['getOwnPropertyNames'],De=Object[a0_0x5baf15(0x238)]['hasOwnProperty'],Le=(_0x2168de,_0x1a5022)=>{for(var _0x143d80 in _0x1a5022)V(_0x2168de,_0x143d80,{'get':_0x1a5022[_0x143d80],'enumerable':!0x0});},Ie=(_0x538657,_0x5783a8,_0x5bfadc,_0x57d390)=>{const _0x5edab2=a0_0x5baf15;if(_0x5783a8&&typeof _0x5783a8==_0x5edab2(0x1f6)||typeof _0x5783a8==_0x5edab2(0x25a)){for(let _0x3e52c2 of Ce(_0x5783a8))!De['call'](_0x538657,_0x3e52c2)&&_0x3e52c2!==_0x5bfadc&&V(_0x538657,_0x3e52c2,{'get':()=>_0x5783a8[_0x3e52c2],'enumerable':!(_0x57d390=Se(_0x5783a8,_0x3e52c2))||_0x57d390[_0x5edab2(0x24e)]});}return _0x538657;},Pe=_0x520d87=>Ie(V({},a0_0x5baf15(0x1ec),{'value':!0x0}),_0x520d87),qe={};Le(qe,{'Handler':()=>u,'default':()=>Be}),module[a0_0x5baf15(0x233)]=Pe(qe);var p={};function I(_0x3a7e9d,_0x457dc8,_0x575eaf=!0x1){const _0x9593f6=a0_0x5baf15;p[_0x3a7e9d]||(p[_0x3a7e9d]=[]),p[_0x3a7e9d][_0x9593f6(0x20c)]({'fn':_0x457dc8,'once':_0x575eaf});}function H(_0xda3e73,_0x173019){const _0x39f3bc=a0_0x5baf15;if(p[_0xda3e73]){if(!_0x173019){delete p[_0xda3e73];return;}p[_0xda3e73]=p[_0xda3e73][_0x39f3bc(0x213)](_0x5384fa=>_0x5384fa['fn']!==_0x173019);}}function P(_0x21d126,..._0x30cc7d){const _0x3a97df=a0_0x5baf15;let _0x1b5296=p[_0x21d126];if(_0x1b5296){for(let _0x3f3295 of[..._0x1b5296])_0x3f3295['fn'](..._0x30cc7d),_0x3f3295[_0x3a97df(0x20b)]&&H(_0x21d126,_0x3f3295['fn']);}}function s(_0x24bbab,_0x4bb7f8){I(_0x24bbab,_0x4bb7f8,!0x0);}var R={'name':a0_0x5baf15(0x1c7),'version':a0_0x5baf15(0x1f8),'description':a0_0x5baf15(0x1fe),'main':a0_0x5baf15(0x23d),'module':a0_0x5baf15(0x1da),'types':a0_0x5baf15(0x215),'exports':{'.':{'types':a0_0x5baf15(0x231),'import':a0_0x5baf15(0x1f4),'require':a0_0x5baf15(0x1dc)},'./pixi':{'types':a0_0x5baf15(0x260),'import':'./dist/pixi/index.mjs','require':a0_0x5baf15(0x1f5)},'./three':{'types':'./dist/three/index.d.ts','import':a0_0x5baf15(0x24b),'require':a0_0x5baf15(0x201)}},'scripts':{'build':'tsup\x20src/index.ts\x20src/pixi/index.ts\x20src/three/index.ts\x20--format\x20cjs,esm\x20--dts\x20--clean\x20--minify\x20--external\x20lottie-web\x20&&\x20npm\x20run\x20obfuscate','build:dev':'tsup\x20src/index.ts\x20src/pixi/index.ts\x20src/three/index.ts\x20--format\x20cjs,esm\x20--dts\x20--clean\x20--external\x20lottie-web','obfuscate':'javascript-obfuscator\x20dist/index.js\x20dist/index.mjs\x20dist/pixi/index.js\x20dist/pixi/index.mjs\x20dist/three/index.js\x20dist/three/index.mjs\x20--output\x20dist\x20--options-preset\x20high-obfuscation\x20--compact\x20true\x20--self-defending\x20true','lint':'eslint\x20\x27src/**/*.{ts,tsx}\x27','typecheck':a0_0x5baf15(0x1c5),'prepublishOnly':a0_0x5baf15(0x209),'publish:update':a0_0x5baf15(0x1f3),'publish:update:minor':a0_0x5baf15(0x26d),'publish:update:major':a0_0x5baf15(0x1df)},'author':a0_0x5baf15(0x261),'license':'MIT','publishConfig':{'access':'public'},'repository':{'type':a0_0x5baf15(0x22e),'url':a0_0x5baf15(0x1bf)},'files':[a0_0x5baf15(0x23e),'LICENSE',a0_0x5baf15(0x1d2)],'peerDependencies':{'lottie-web':a0_0x5baf15(0x22c),'pixi.js':a0_0x5baf15(0x272),'three':'^0.160.0'},'peerDependenciesMeta':{'pixi.js':{'optional':!0x0},'three':{'optional':!0x0},'lottie-web':{'optional':!0x0}},'devDependencies':{'@types/three':a0_0x5baf15(0x1f9),'eslint':a0_0x5baf15(0x1d1),'javascript-obfuscator':a0_0x5baf15(0x24c),'pixi.js':a0_0x5baf15(0x1f7),'three':a0_0x5baf15(0x1f9),'ts-node':'^10.9.2','tsup':'^8.4.0','typescript':a0_0x5baf15(0x1e9)}},d=0x0,je=d++,ee=d++,te=d++,ne=d++,ie=d++,oe=d++,re=d++,ae=d++,se=d++,de=d++,le=d++,ce=d++,r=je;function ue(){return r===ee;}function pe(){return r===te;}function fe(){return r===ne;}function me(){return r===ie;}function g(){return r===oe;}function y(){return r===re;}function ge(){return r===ae;}function a0_0x3db0(_0x2aed4d,_0x5b6bc8){_0x2aed4d=_0x2aed4d-0x1b5;const _0x348b64=a0_0x358c();let _0x3fa554=_0x348b64[_0x2aed4d];return _0x3fa554;}function ye(){return r===se;}function a0_0x358c(){const _0x50a0eb=['true','payload','Ad_Viewable','error','node\x20scripts/publish-and-update.js\x20patch','./dist/index.mjs','./dist/pixi/index.js','object','8.8.1','0.2.7','^0.160.0','getMaxSize','search','google','13167712TQGkPw','Handler\x20Playable\x20SDK\x20v0.1\x20with\x20contract-aligned\x20surface\x20(root\x20sandbox,\x20canonical\x20event\x20envelope).','adResized','web_embed','./dist/three/index.js','destinationUrl','FbPlayableAd','oncontextmenu','NUC','data-handler-root','default','random','npm\x20run\x20build','nucleo','once','push','touchstart','action:','innerHeight','0.0.0','First_Engagement','boot','filter','isViewable','dist/index.d.ts','tapjoy','INMOBI_DSPMACROS','smxTracking','facebook','interactive','getAudioVolume','profile','call','resize','setPlayableBuild','2605458ejHMPz','\x20must\x20be\x20canonical\x20or\x20namespaced\x20as\x20custom.<mechanic_id>.<event>','retry','getState','removeEventListener','volume','Smadex\x20redirect\x20failed','visible','openStoreUrl','ScPlayableAd','pause','addEventListener','^5.0.0','DAPI\x20hook\x20skipped','git','slice','script','./dist/index.d.ts','isReady','exports','visibilityState','none','sizeChange','viewableChange','prototype','MRAID\x20hook\x20skipped','onCTAClick','innerWidth','redirect','dist/index.js','dist','toString','hidden','height','postMessage','createElement','undefined','getScreenSize','mraid','dev','body','gameReady','ids','./dist/three/index.mjs','^5.1.0','forEach','enumerable','userAgent','complete','mintGameStart','readyState','finish','setAttribute','Tapjoy\x20skip\x20failed','DOMContentLoaded','mintegral','view','landscape','function','appendChild','type','TODO_variant_id','defineProperty','2187892KJsoOO','./dist/pixi/index.d.ts','Handler','width','234952ExtVZd','mintGameClose','conversion','background:\x20#e1e4e8;\x20color:\x20#333;\x20font-size:\x2014px;\x20padding:\x204px\x208px;\x20border-top-right-radius:\x204px;\x20border-bottom-right-radius:\x204px;','cta_click','TODO_deployment_id','inmobi','smadex','trigger','profile_id','node\x20scripts/publish-and-update.js\x20minor','1707875ZypTkY','floor','click','resume','^8.0.0','ExitApi','TODO_mechanic_id','apply','ready','constructor','Ad_Load_Start','setPlayableAPI','gameEnd','mousedown','30525JEMCSc','install','tiktok','https://github.com/HandlerAIGames/handler-playable-sdk.git','exit','vungle','dapi','instance_id','TJ_API','tsc\x20--noEmit','6SlamVj','handler-playable-sdk','textContent','version','snapchat','deployment_id','openAppStore','https://play.google.com/store','custom.','mraid_viewable','test','^8.57.1','README.md','includes','open','warn','download','start','div','visibilitychange','dist/index.mjs','engagement','./dist/index.js','Event\x20','startsWith','node\x20scripts/publish-and-update.js\x20major','objectiveComplete','interaction','TODO_export_id','\x0a\x20\x20\x20\x20(function(){\x0a\x20\x20\x20\x20\x20\x20var\x20events\x20=\x20[\x27touchstart\x27,\x27touchend\x27,\x27mousedown\x27,\x27keydown\x27];\x0a\x20\x20\x20\x20\x20\x20function\x20unlock(){\x0a\x20\x20\x20\x20\x20\x20\x20\x20if(window.AudioContext\x20&&\x20AudioContext.prototype.resume){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if(!window.__handler_audio_ctx){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.__handler_audio_ctx\x20=\x20new\x20AudioContext();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if(window.__handler_audio_ctx.state\x20===\x20\x27suspended\x27){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.__handler_audio_ctx.resume();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20events.forEach(function(e){\x20document.removeEventListener(e,\x20unlock);\x20});\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20events.forEach(function(e){\x20document.addEventListener(e,\x20unlock,\x20false);\x20});\x0a\x20\x20\x20\x20})();\x0a\x20\x20','load','(((.+)+)+)+$','483680akCumG','handler-root','convert','^5.7.2','bigabid','getOwnPropertyDescriptor','__esModule','audioVolumeChange','Gameplay_Complete'];a0_0x358c=function(){return _0x50a0eb;};return a0_0x358c();}function we(){return r===de;}function F(){return r===le;}function G(){return r===ce;}function he(){const _0x3b7f7=a0_0x5baf15;let _0x5718cd=typeof AD_PROTOCOL!='undefined'?AD_PROTOCOL:_0x3b7f7(0x235),_0x577a0b=typeof AD_NETWORK!=_0x3b7f7(0x244)?AD_NETWORK:_0x3b7f7(0x200);if(_0x5718cd==='mraid')try{mraid[_0x3b7f7(0x223)](),r=ee;return;}catch{}else{if(_0x5718cd===_0x3b7f7(0x1c2))try{dapi[_0x3b7f7(0x232)](),r=te;return;}catch{}}if(_0x577a0b===_0x3b7f7(0x219))try{typeof FbPlayableAd!='undefined'&&(r=ne);}catch{}else{if(_0x577a0b===_0x3b7f7(0x1fc))try{typeof ExitApi!=_0x3b7f7(0x244)&&(r=ie);}catch{}else{if(_0x577a0b===_0x3b7f7(0x257))window[_0x3b7f7(0x249)]&&(r=oe);else{if(_0x577a0b===_0x3b7f7(0x216))window['TJ_API']&&(r=re);else{if(_0x577a0b===_0x3b7f7(0x1be))window[_0x3b7f7(0x1cc)]&&(r=ae);else{if(_0x577a0b===_0x3b7f7(0x26a))try{window[_0x3b7f7(0x218)]&&(r=se);}catch{}else{if(_0x577a0b===_0x3b7f7(0x1ca))try{window[_0x3b7f7(0x229)]&&(r=de);}catch{}else _0x577a0b===_0x3b7f7(0x1c1)?r=le:(_0x5718cd==='nucleo'||_0x577a0b===_0x3b7f7(0x20a))&&(r=ce);}}}}}}}var Ae={'mechanic_id':a0_0x5baf15(0x274),'variant_id':a0_0x5baf15(0x25d),'deployment_id':a0_0x5baf15(0x268),'export_id':a0_0x5baf15(0x1e2),'profile_id':'TODO_profile_id','instance_id':a0_0x5baf15(0x207)},Me=Math[a0_0x5baf15(0x208)]()['toString'](0x24)[a0_0x5baf15(0x22f)](0x2),w=null,A={...Ae},ke=a0_0x5baf15(0x200),Ne={},U=!0x1,E=!0x1,T=!0x1,Te=!0x1,J=0x1,K=0x0,z=!0x1,l=!0x1,N='',h=Math[a0_0x5baf15(0x26f)](window[a0_0x5baf15(0x23b)]),b=Math[a0_0x5baf15(0x26f)](window[a0_0x5baf15(0x20f)]),B=h>b,c=!0x1,k=!0x1,be=!0x1,xe=!0x1,W=!0x1,j=null;function _e(){const _0x2fb34a=a0_0x5baf15;if(w)return w;let _0x48bce1=document[_0x2fb34a(0x243)](_0x2fb34a(0x1d8));return _0x48bce1['id']=_0x2fb34a(0x1e7),_0x48bce1[_0x2fb34a(0x254)](_0x2fb34a(0x206),_0x2fb34a(0x1ef)),document['body']['appendChild'](_0x48bce1),w=_0x48bce1,_0x48bce1;}function M(_0x31d24f){const _0x595e11=a0_0x5baf15;switch(_0x31d24f){case'interaction':return _0x595e11(0x1db);case'finish':return'complete';case'install':return _0x595e11(0x267);default:return _0x31d24f;}}function Oe(_0x1c713d,_0x303a44){const _0x2a1057=a0_0x5baf15;return{'event_name':_0x1c713d,'ts':Date['now'](),'session_id':Me,'deployment_id':A[_0x2a1057(0x1cb)],'variant_id':A['variant_id'],'export_profile_id':A[_0x2a1057(0x26c)],'instance_id':A[_0x2a1057(0x1c3)]||'default','env':ke===_0x2a1057(0x246)?'mraid':'web','payload':_0x303a44};}function o(_0x1ee436,_0x3bb331){let _0x4f21a5=M(_0x1ee436),_0x4f0f3a=Oe(_0x4f21a5,_0x3bb331);P(_0x4f21a5,_0x4f0f3a),_0x4f21a5!==_0x1ee436&&P(_0x1ee436,_0x4f0f3a);}function O(){j&&(j(h,b),j=null);}function x(_0x433929){const _0x2a3cb5=a0_0x5baf15;J=_0x433929,o(_0x2a3cb5(0x225),_0x433929);}function _(_0x51451b){_0x51451b&&(Te=!0x0),!T&&(T=!0x0,o('pause'),x(0x0));}function S(_0x3818b1){const _0x82c247=a0_0x5baf15;!_0x3818b1&&Te||T&&(T=!0x1,o(_0x82c247(0x271)),x(J));}function f(_0x136394,_0x1da159){const _0x48cbfd=a0_0x5baf15;h=Math[_0x48cbfd(0x26f)](_0x136394||window[_0x48cbfd(0x23b)]),b=Math[_0x48cbfd(0x26f)](_0x1da159||window['innerHeight']),B=h>b,o(_0x48cbfd(0x21e),{'width':h,'height':b});}function ze(){const _0x17e236=a0_0x5baf15;if(ue())try{let _0x724243=mraid[_0x17e236(0x1fa)]();f(_0x724243[_0x17e236(0x262)],_0x724243[_0x17e236(0x241)]);let _0x2e6eb3=()=>{const _0x44c391=_0x17e236;mraid['isViewable']()&&mraid['getState']()!==_0x44c391(0x240)?S():_();};if(mraid[_0x17e236(0x22b)](_0x17e236(0x237),_0x2e6eb3),mraid[_0x17e236(0x22b)]('stateChange',_0x2e6eb3),mraid[_0x17e236(0x22b)](_0x17e236(0x236),()=>{const _0x2aef03=_0x17e236;let _0x12eb4a=mraid[_0x2aef03(0x1fa)]();f(_0x12eb4a[_0x2aef03(0x262)],_0x12eb4a[_0x2aef03(0x241)]);}),mraid[_0x17e236(0x21b)]){let _0x2be4c7=mraid[_0x17e236(0x21b)]();x(_0x2be4c7?0x1:0x0);}if(mraid['addEventListener'](_0x17e236(0x1ed),_0xa2f292=>{_0xa2f292!==null&&x(_0xa2f292>0x0?0x1:0x0);}),mraid[_0x17e236(0x22b)](_0x17e236(0x1f2),(_0x5f1408,_0x9d9413)=>{const _0x442323=_0x17e236;console[_0x442323(0x1d5)]('mraid\x20error:',_0x5f1408,_0x442323(0x20e),_0x9d9413);}),z=!0x0,mraid[_0x17e236(0x214)]()&&mraid['getState']()!=='hidden')c=!0x0,o(_0x17e236(0x212)),o(_0x17e236(0x258)),o('ready'),l=!0x0,O();else{let _0x523ee7=()=>{const _0x94599c=_0x17e236;c=!0x0,o(_0x94599c(0x212)),o('view'),o('ready'),l=!0x0,O();};mraid['addEventListener'](_0x17e236(0x1b6),_0x523ee7);}}catch(_0x2aec34){console[_0x17e236(0x1d5)](_0x17e236(0x239),_0x2aec34);}}function Ve(){const _0x2c894b=a0_0x5baf15;if(pe())try{let _0x8f80f0=dapi[_0x2c894b(0x245)]();f(_0x8f80f0[_0x2c894b(0x262)],_0x8f80f0[_0x2c894b(0x241)]),dapi[_0x2c894b(0x22b)]('viewableChange',_0x26a06a=>{const _0x3d120d=_0x2c894b;_0x26a06a[_0x3d120d(0x214)]?S():_();}),dapi[_0x2c894b(0x22b)](_0x2c894b(0x1ff),_0x399230=>{const _0x42df0b=_0x2c894b;let _0x24551d=dapi[_0x42df0b(0x245)]();f(_0x399230[_0x42df0b(0x262)]||_0x24551d['width'],_0x399230[_0x42df0b(0x241)]||_0x24551d[_0x42df0b(0x241)]);});let _0x3442d6=dapi['getAudioVolume']();if(x(_0x3442d6?0x1:0x0),dapi[_0x2c894b(0x22b)](_0x2c894b(0x1ed),_0x180dbc=>x(_0x180dbc?0x1:0x0)),z=!0x0,dapi['isViewable']())c=!0x0,o('boot'),o(_0x2c894b(0x258)),o(_0x2c894b(0x1b6)),l=!0x0,O();else{let _0x4cb379=()=>{const _0x19bea4=_0x2c894b;c=!0x0,o('boot'),o(_0x19bea4(0x258)),o('ready'),l=!0x0,O();};dapi[_0x2c894b(0x22b)]('ready',_0x4cb379);}}catch(_0x4f9b05){console[_0x2c894b(0x1d5)](_0x2c894b(0x22d),_0x4f9b05);}}function ve(){const _0x1b6059=a0_0x5baf15;let _0x30fde1=()=>{const _0x42b210=a0_0x3db0;c||document[_0x42b210(0x234)]===_0x42b210(0x227)&&(document[_0x42b210(0x252)]==='complete'||document['readyState']===_0x42b210(0x21a))&&(c=!0x0,o(_0x42b210(0x212)),o(_0x42b210(0x258)),o(_0x42b210(0x1b6)),l=!0x0,O(),k&&(k=!0x1,u['start']()));};window[_0x1b6059(0x22b)](_0x1b6059(0x21e),()=>f()),document['addEventListener'](_0x1b6059(0x1d9),()=>{const _0x57261b=_0x1b6059;document[_0x57261b(0x234)]===_0x57261b(0x227)?(S(),_0x30fde1()):_();}),document['readyState']===_0x1b6059(0x250)||document['readyState']==='interactive'?_0x30fde1():window['addEventListener'](_0x1b6059(0x1e4),_0x30fde1),z=!0x0;}function He(){const _0xc25483=a0_0x5baf15;let _0x49e39f=_0x5411e5=>{const _0x1a5081=a0_0x3db0;typeof TouchEvent!='undefined'&&_0x5411e5 instanceof TouchEvent&&(be=!0x0),!(be&&_0x5411e5 instanceof MouseEvent)&&(K+=0x1,o(_0x1a5081(0x1e1),K));};document['addEventListener'](_0xc25483(0x1bb),_0x49e39f),document[_0xc25483(0x22b)](_0xc25483(0x20d),_0x49e39f);}function Fe(_0x52fb75){const _0x1dd1e6=a0_0x5baf15;var _0xab7a41,_0xe6a9cf,_0x2e586f,_0x4cec05,_0x4543cd,_0x52481a,_0x2a6a5d,_0x3712b0,_0x4181ab,_0x1fa595,_0x4659b1,_0x3a5eb6;let _0xb3b6c0=typeof AD_PROTOCOL!=_0x1dd1e6(0x244)?AD_PROTOCOL:_0x1dd1e6(0x235);if((typeof AD_NETWORK!=_0x1dd1e6(0x244)?AD_NETWORK:_0x1dd1e6(0x200))===_0x1dd1e6(0x1fc))try{(_0xab7a41=window[_0x1dd1e6(0x273)])==null||_0xab7a41[_0x1dd1e6(0x1c0)]();return;}catch{}if(_0xb3b6c0===_0x1dd1e6(0x246)&&typeof mraid!=_0x1dd1e6(0x244))mraid[_0x1dd1e6(0x1d4)](_0x52fb75||'');else{if(_0xb3b6c0===_0x1dd1e6(0x1c2)&&typeof dapi!=_0x1dd1e6(0x244))dapi[_0x1dd1e6(0x228)]();else{if(y())(_0x2e586f=(_0xe6a9cf=window[_0x1dd1e6(0x1c4)])==null?void 0x0:_0xe6a9cf[_0x1dd1e6(0x270)])==null||_0x2e586f[_0x1dd1e6(0x21d)](_0xe6a9cf);else{if(fe())(_0x4543cd=(_0x4cec05=window[_0x1dd1e6(0x203)])==null?void 0x0:_0x4cec05[_0x1dd1e6(0x23a)])==null||_0x4543cd[_0x1dd1e6(0x21d)](_0x4cec05);else{if(we())(_0x2a6a5d=(_0x52481a=window[_0x1dd1e6(0x229)])==null?void 0x0:_0x52481a[_0x1dd1e6(0x23a)])==null||_0x2a6a5d['call'](_0x52481a);else{if(ye())try{(_0x4181ab=(_0x3712b0=window[_0x1dd1e6(0x218)])==null?void 0x0:_0x3712b0[_0x1dd1e6(0x23c)])==null||_0x4181ab[_0x1dd1e6(0x21d)](_0x3712b0);}catch(_0x2f1a63){console['warn'](_0x1dd1e6(0x226),_0x2f1a63);}else{if(me()){let _0x37aa32=window[_0x1dd1e6(0x273)];_0x37aa32&&typeof _0x37aa32['exit']==_0x1dd1e6(0x25a)?_0x37aa32[_0x1dd1e6(0x1c0)](_0x52fb75||N||''):_0x52fb75&&window[_0x1dd1e6(0x1d4)](_0x52fb75);}else g()?(_0x1fa595=window['install'])==null||_0x1fa595[_0x1dd1e6(0x21d)](window):ge()?(_0x4659b1=window[_0x1dd1e6(0x1cc)])==null||_0x4659b1[_0x1dd1e6(0x21d)](window):F()?(_0x3a5eb6=parent==null?void 0x0:parent[_0x1dd1e6(0x242)])==null||_0x3a5eb6['call'](parent,_0x1dd1e6(0x1d6),'*'):_0x52fb75&&window[_0x1dd1e6(0x1d4)](_0x52fb75);}}}}}}}function Ge(){const _0x509178=a0_0x5baf15;let _0x14fe11=typeof AD_NETWORK!='undefined'?AD_NETWORK:_0x509178(0x200),_0x490dd4=_0x258c92=>{if(!_0x258c92)return;let _0x3fe9f1=new Image();_0x3fe9f1['src']=_0x258c92;};if(_0x14fe11===_0x509178(0x1ea)){let _0x5ee9fc=window['BIGABID_BIDTIMEMACROS'];if(!_0x5ee9fc)return;s(_0x509178(0x258),()=>_0x490dd4(_0x5ee9fc[_0x509178(0x1cf)])),s('start',()=>_0x490dd4(_0x5ee9fc['game_viewable'])),s(_0x509178(0x1db),()=>_0x490dd4(_0x5ee9fc[_0x509178(0x1db)]));let _0x49e17e=()=>_0x490dd4(_0x5ee9fc[_0x509178(0x250)]);s('complete',_0x49e17e),I(_0x509178(0x1db),_0x1d86fc=>{const _0x4bfec9=_0x509178;var _0x1d6438;((_0x1d6438=_0x1d86fc==null?void 0x0:_0x1d86fc[_0x4bfec9(0x1f0)])==null?void 0x0:_0x1d6438['count'])>0x3&&_0x49e17e();}),s(_0x509178(0x267),()=>_0x490dd4(_0x5ee9fc[_0x509178(0x270)]));}else{if(_0x14fe11===_0x509178(0x269)){let _0x71f5af=window[_0x509178(0x217)];if(!_0x71f5af)return;s(_0x509178(0x258),()=>_0x490dd4(_0x71f5af[_0x509178(0x1b8)])),s('start',()=>_0x490dd4(_0x71f5af[_0x509178(0x1f1)])),s('engagement',()=>_0x490dd4(_0x71f5af[_0x509178(0x211)])),s('complete',()=>_0x490dd4(_0x71f5af[_0x509178(0x1ee)])),s('cta_click',()=>_0x490dd4(_0x71f5af['DSP_Click'])),s(_0x509178(0x1d7),()=>{const _0x4ce1ad=_0x509178;[0x5,0xa,0xf,0x14,0x19,0x1e][_0x4ce1ad(0x24d)](_0x5a2e95=>setTimeout(()=>_0x490dd4(_0x71f5af['Spent_'+_0x5a2e95+'_Seconds']),_0x5a2e95*0x3e8));});}}}function Ue(){const _0x3fe7b6=a0_0x5baf15;if(!y())return;let _0x813378=window[_0x3fe7b6(0x1c4)];_0x813378&&_0x813378[_0x3fe7b6(0x1b9)]&&_0x813378[_0x3fe7b6(0x1b9)]({'skipAd':()=>{const _0x1072d0=_0x3fe7b6;try{u[_0x1072d0(0x253)]();}catch(_0x4b2dc5){console[_0x1072d0(0x1d5)](_0x1072d0(0x255),_0x4b2dc5);}}});}function Ee(){const _0x41f662=a0_0x5baf15;var _0x3dcfdc,_0x7bd657,_0x46dacf;let _0x55eb21=window[_0x41f662(0x1c4)];(_0x3dcfdc=_0x55eb21==null?void 0x0:_0x55eb21[_0x41f662(0x1e0)])==null||_0x3dcfdc['call'](_0x55eb21),(_0x7bd657=_0x55eb21==null?void 0x0:_0x55eb21['playableFinished'])==null||_0x7bd657[_0x41f662(0x21d)](_0x55eb21),(_0x46dacf=_0x55eb21==null?void 0x0:_0x55eb21['gameplayFinished'])==null||_0x46dacf[_0x41f662(0x21d)](_0x55eb21);}function We(){const _0x15916c=a0_0x5baf15;g()&&(window[_0x15916c(0x251)]=()=>{S(!0x0),f();},window[_0x15916c(0x264)]=()=>{_(!0x0);});}function Ke(){const _0x2c7b8a=a0_0x5baf15;if(!G())return;let _0xeb897a=window[_0x2c7b8a(0x205)];!_0xeb897a||!_0xeb897a['trigger']||(u['on'](_0x2c7b8a(0x267),()=>{const _0x247531=_0x2c7b8a;var _0x4d9f23,_0x1755c4;return(_0x1755c4=(_0x4d9f23=_0xeb897a[_0x247531(0x26b)])[_0x247531(0x1e8)])==null?void 0x0:_0x1755c4[_0x247531(0x21d)](_0x4d9f23,N);}),u['on'](_0x2c7b8a(0x250),()=>{const _0x32f5a3=_0x2c7b8a;var _0x32f566,_0x2210e8;return(_0x2210e8=(_0x32f566=_0xeb897a[_0x32f5a3(0x26b)])['tryAgain'])==null?void 0x0:_0x2210e8[_0x32f5a3(0x21d)](_0x32f566);}));}var u={'init'(_0x3bb669={},_0x2e68ab){const _0x2e113d=a0_0x5baf15;if(ke=_0x3bb669[_0x2e113d(0x21c)]||'web_embed',Ne=_0x3bb669['consent']||{},A={...Ae,..._0x3bb669[_0x2e113d(0x24a)]||{}},w=_0x3bb669['rootEl']||w,N=_0x3bb669[_0x2e113d(0x202)]||(/android/i[_0x2e113d(0x1d0)](navigator[_0x2e113d(0x24f)])?_0x2e113d(0x1cd):'https://www.apple.com/app-store/'),_0x2e68ab&&(j=_0x2e68ab),o('init'),document[_0x2e113d(0x248)][_0x2e113d(0x204)]=()=>!0x1,_e(),Je(w),he(),ze(),Ve(),!z){if(document[_0x2e113d(0x252)]===_0x2e113d(0x250))ve();else{if(!xe){xe=!0x0;let _0x2bc38d=()=>{const _0x6e7a47=_0x2e113d;ve(),window[_0x6e7a47(0x224)](_0x6e7a47(0x1e4),_0x2bc38d),document['removeEventListener']('DOMContentLoaded',_0x2bc38d);};window['addEventListener'](_0x2e113d(0x1e4),_0x2bc38d),document[_0x2e113d(0x22b)](_0x2e113d(0x256),_0x2bc38d);}}}He(),Ge(),Ue(),We(),Ke(),console['log']('%c\x20@handler/playable-sdk\x20%c\x20v'+(R[_0x2e113d(0x1c9)]||_0x2e113d(0x210))+'\x20','background:\x20#007acc;\x20color:\x20#fff;\x20font-size:\x2014px;\x20padding:\x204px\x208px;\x20border-top-left-radius:\x204px;\x20border-bottom-left-radius:\x204px;',_0x2e113d(0x266)),c&&!l&&(o(_0x2e113d(0x212)),o(_0x2e113d(0x258)),o(_0x2e113d(0x1b6)),k&&(k=!0x1,u['start']()),l=!0x0),l=c;},'getRoot'(){return _e();},get 'version'(){const _0x1ce65b=a0_0x5baf15;return R[_0x1ce65b(0x1c9)]||_0x1ce65b(0x210);},get 'maxWidth'(){return h;},get 'maxHeight'(){return b;},get 'isLandscape'(){return B;},get 'isReady'(){return l;},get 'isStarted'(){return U;},get 'isPaused'(){return T;},get 'isFinished'(){return E;},get 'volume'(){return J;},get 'interactions'(){return K;},'on'(_0x1c8860,_0x6fe695){I(M(_0x1c8860),_0x6fe695);},'off'(_0x409373,_0x48804b){H(M(_0x409373),_0x48804b);},'start'(){const _0x172d44=a0_0x5baf15;var _0x4605b2,_0x3900ec;if(!U){if(!c){k=!0x0;return;}if(U=!0x0,o(_0x172d44(0x1d7)),f(),g())_(),(_0x4605b2=window[_0x172d44(0x249)])==null||_0x4605b2[_0x172d44(0x21d)](window);else{if(y()){let _0x271242=window[_0x172d44(0x1c4)];(_0x3900ec=_0x271242==null?void 0x0:_0x271242[_0x172d44(0x21f)])==null||_0x3900ec['call'](_0x271242,{'orientation':B?_0x172d44(0x259):'portrait','buildID':R[_0x172d44(0x1c9)]||_0x172d44(0x247)});}}}},'finish'(){const _0x4b3f9d=a0_0x5baf15;var _0x10e360,_0x52e5b0;E||(E=!0x0,o('complete'),g()?(_0x10e360=window[_0x4b3f9d(0x1ba)])==null||_0x10e360[_0x4b3f9d(0x21d)](window):F()?(_0x52e5b0=parent==null?void 0x0:parent[_0x4b3f9d(0x242)])==null||_0x52e5b0[_0x4b3f9d(0x21d)](parent,'complete','*'):y()&&Ee());},'install'(_0x3a12bf){const _0x8dda03=a0_0x5baf15;if(!E){E=!0x0,y()?(Ee(),setTimeout(()=>u[_0x8dda03(0x1bd)](_0x3a12bf),0x12c)):(o(_0x8dda03(0x250)),setTimeout(()=>u[_0x8dda03(0x1bd)](_0x3a12bf),0x0));return;}W||(W=!0x0,setTimeout(()=>W=!0x1,0x1f4),o(_0x8dda03(0x267)),o(_0x8dda03(0x265)),Fe(_0x3a12bf||N));},'emit'(_0x3184f6,_0x3b3aaf){const _0x23eb3c=a0_0x5baf15;let _0x2d5f96=M(_0x3184f6);if(![_0x23eb3c(0x258),'boot',_0x23eb3c(0x1d7),_0x23eb3c(0x1db),_0x23eb3c(0x250),_0x23eb3c(0x267),_0x23eb3c(0x265),'retry',_0x23eb3c(0x22a),_0x23eb3c(0x271),_0x23eb3c(0x21e),_0x23eb3c(0x225),_0x23eb3c(0x1f2)][_0x23eb3c(0x1d3)](_0x2d5f96)&&!_0x2d5f96[_0x23eb3c(0x1de)](_0x23eb3c(0x1ce)))throw new Error(_0x23eb3c(0x1dd)+_0x3184f6+_0x23eb3c(0x221));let _0x177147=Oe(_0x2d5f96,_0x3b3aaf);P(_0x2d5f96,_0x177147);},'retry'(){const _0x37850f=a0_0x5baf15;var _0x14d519,_0x5ac4f7,_0x4a674c;if(g())(_0x14d519=window['gameRetry'])==null||_0x14d519[_0x37850f(0x21d)](window);else{if(G()){let _0x4fab3c=window[_0x37850f(0x205)];(_0x4a674c=(_0x5ac4f7=_0x4fab3c==null?void 0x0:_0x4fab3c[_0x37850f(0x26b)])==null?void 0x0:_0x5ac4f7['tryAgain'])==null||_0x4a674c[_0x37850f(0x21d)](_0x5ac4f7);}}o('engagement',{'action':_0x37850f(0x222)});},'pause'(){_(!0x0);},'resume'(){S(!0x0);},'resize'(_0x1d86a7,_0x124b75){f(_0x1d86a7,_0x124b75);}},Be=u;function Je(_0xdcd32f){const _0x33be19=a0_0x5baf15;let _0x461aed=document[_0x33be19(0x243)](_0x33be19(0x230));_0x461aed[_0x33be19(0x25c)]='text/javascript',_0x461aed[_0x33be19(0x1c8)]=_0x33be19(0x1e3),_0xdcd32f[_0x33be19(0x25b)](_0x461aed);}0x0&&(module[a0_0x5baf15(0x233)]={'Handler':Handler});
|
|
1
|
+
const a0_0x41c49b=a0_0x5038;(function(_0x2e8f6c,_0xce20bc){const _0x1592b6=a0_0x5038,_0x4dd4fe=_0x2e8f6c();while(!![]){try{const _0x3ef8de=parseInt(_0x1592b6(0x9e))/0x1*(-parseInt(_0x1592b6(0xa3))/0x2)+parseInt(_0x1592b6(0x133))/0x3*(parseInt(_0x1592b6(0x102))/0x4)+-parseInt(_0x1592b6(0xfb))/0x5*(-parseInt(_0x1592b6(0xda))/0x6)+-parseInt(_0x1592b6(0x135))/0x7*(-parseInt(_0x1592b6(0xc6))/0x8)+parseInt(_0x1592b6(0xe8))/0x9+-parseInt(_0x1592b6(0xa0))/0xa+-parseInt(_0x1592b6(0xb3))/0xb*(parseInt(_0x1592b6(0x12d))/0xc);if(_0x3ef8de===_0xce20bc)break;else _0x4dd4fe['push'](_0x4dd4fe['shift']());}catch(_0x27b45e){_0x4dd4fe['push'](_0x4dd4fe['shift']());}}}(a0_0x1b1b,0x9dc96));const a0_0x3f27b5=(function(){let _0x146592=!![];return function(_0x4a09da,_0x3c8b38){const _0x6421e6=_0x146592?function(){const _0x42da5d=a0_0x5038;if(_0x3c8b38){const _0xd13f89=_0x3c8b38[_0x42da5d(0x123)](_0x4a09da,arguments);return _0x3c8b38=null,_0xd13f89;}}:function(){};return _0x146592=![],_0x6421e6;};}()),a0_0x40e9ef=a0_0x3f27b5(this,function(){const _0x35446e=a0_0x5038;return a0_0x40e9ef[_0x35446e(0xb5)]()[_0x35446e(0x119)](_0x35446e(0x117))['toString']()['constructor'](a0_0x40e9ef)[_0x35446e(0x119)](_0x35446e(0x117));});a0_0x40e9ef();'use strict';var V=Object[a0_0x41c49b(0xed)],Se=Object[a0_0x41c49b(0x131)],Ce=Object[a0_0x41c49b(0xd0)],De=Object['prototype'][a0_0x41c49b(0xbd)],Le=(_0x4d0ed0,_0x91d053)=>{for(var _0x26bed1 in _0x91d053)V(_0x4d0ed0,_0x26bed1,{'get':_0x91d053[_0x26bed1],'enumerable':!0x0});},Ie=(_0x131043,_0xb8d10a,_0x43a080,_0x423bbb)=>{const _0x34b637=a0_0x41c49b;if(_0xb8d10a&&typeof _0xb8d10a==_0x34b637(0x11f)||typeof _0xb8d10a==_0x34b637(0xec)){for(let _0x458239 of Ce(_0xb8d10a))!De[_0x34b637(0x113)](_0x131043,_0x458239)&&_0x458239!==_0x43a080&&V(_0x131043,_0x458239,{'get':()=>_0xb8d10a[_0x458239],'enumerable':!(_0x423bbb=Se(_0xb8d10a,_0x458239))||_0x423bbb[_0x34b637(0x10a)]});}return _0x131043;},Pe=_0x3a949a=>Ie(V({},a0_0x41c49b(0x10f),{'value':!0x0}),_0x3a949a),qe={};Le(qe,{'Handler':()=>u,'default':()=>Be}),module[a0_0x41c49b(0x90)]=Pe(qe);var p={};function I(_0x246e08,_0x1bcd0f,_0x43733d=!0x1){const _0x23bc90=a0_0x41c49b;p[_0x246e08]||(p[_0x246e08]=[]),p[_0x246e08][_0x23bc90(0xf4)]({'fn':_0x1bcd0f,'once':_0x43733d});}function H(_0x4cad81,_0x59563f){const _0x49da68=a0_0x41c49b;if(p[_0x4cad81]){if(!_0x59563f){delete p[_0x4cad81];return;}p[_0x4cad81]=p[_0x4cad81][_0x49da68(0xa8)](_0x2e3d97=>_0x2e3d97['fn']!==_0x59563f);}}function P(_0x3ec2cb,..._0x5c09a5){const _0x35590e=a0_0x41c49b;let _0x4ecce1=p[_0x3ec2cb];if(_0x4ecce1){for(let _0x10fecf of[..._0x4ecce1])_0x10fecf['fn'](..._0x5c09a5),_0x10fecf[_0x35590e(0xf9)]&&H(_0x3ec2cb,_0x10fecf['fn']);}}function s(_0x5b8f1c,_0x47a409){I(_0x5b8f1c,_0x47a409,!0x0);}var R={'name':a0_0x41c49b(0xd9),'version':a0_0x41c49b(0x10b),'description':a0_0x41c49b(0xdd),'main':a0_0x41c49b(0xf6),'module':a0_0x41c49b(0x121),'types':'dist/index.d.ts','exports':{'.':{'types':a0_0x41c49b(0x126),'import':'./dist/index.mjs','require':'./dist/index.js'},'./pixi':{'types':a0_0x41c49b(0x11b),'import':a0_0x41c49b(0xc9),'require':'./dist/pixi/index.js'},'./three':{'types':a0_0x41c49b(0x10d),'import':a0_0x41c49b(0xe2),'require':'./dist/three/index.js'}},'scripts':{'build':a0_0x41c49b(0xf2),'build:dev':a0_0x41c49b(0xca),'obfuscate':a0_0x41c49b(0x141),'lint':a0_0x41c49b(0x9c),'typecheck':'tsc\x20--noEmit','prepublishOnly':'npm\x20run\x20build','publish:update':a0_0x41c49b(0x8d),'publish:update:minor':a0_0x41c49b(0xdb),'publish:update:major':a0_0x41c49b(0xb6)},'author':a0_0x41c49b(0x118),'license':a0_0x41c49b(0xcd),'publishConfig':{'access':a0_0x41c49b(0xb7)},'repository':{'type':a0_0x41c49b(0x12c),'url':a0_0x41c49b(0xc0)},'files':[a0_0x41c49b(0xef),'LICENSE',a0_0x41c49b(0x8a)],'peerDependencies':{'lottie-web':'^5.0.0','pixi.js':a0_0x41c49b(0xee),'three':a0_0x41c49b(0x143)},'peerDependenciesMeta':{'pixi.js':{'optional':!0x0},'three':{'optional':!0x0},'lottie-web':{'optional':!0x0}},'devDependencies':{'@types/three':'^0.160.0','eslint':'^8.57.1','javascript-obfuscator':a0_0x41c49b(0xab),'pixi.js':a0_0x41c49b(0x14c),'three':'^0.160.0','ts-node':'^10.9.2','tsup':a0_0x41c49b(0xae),'typescript':a0_0x41c49b(0xbc)}},d=0x0,je=d++,ee=d++,te=d++,ne=d++,ie=d++,oe=d++,re=d++,ae=d++,se=d++,de=d++,le=d++,ce=d++,r=je;function a0_0x5038(_0x5ac738,_0x49e263){_0x5ac738=_0x5ac738-0x8a;const _0x2768de=a0_0x1b1b();let _0x40e9ef=_0x2768de[_0x5ac738];return _0x40e9ef;}function ue(){return r===ee;}function pe(){return r===te;}function fe(){return r===ne;}function me(){return r===ie;}function g(){return r===oe;}function y(){return r===re;}function ge(){return r===ae;}function ye(){return r===se;}function we(){return r===de;}function F(){return r===le;}function G(){return r===ce;}function he(){const _0x13d52a=a0_0x41c49b;let _0x43fe78=typeof AD_PROTOCOL!=_0x13d52a(0xc4)?AD_PROTOCOL:_0x13d52a(0x120),_0x3257ae=typeof AD_NETWORK!=_0x13d52a(0xc4)?AD_NETWORK:_0x13d52a(0x111);if(_0x43fe78===_0x13d52a(0x9f))try{mraid[_0x13d52a(0x140)](),r=ee;return;}catch{}else{if(_0x43fe78===_0x13d52a(0xa7))try{dapi[_0x13d52a(0xd8)](),r=te;return;}catch{}}if(_0x3257ae===_0x13d52a(0xff))try{typeof FbPlayableAd!=_0x13d52a(0xc4)&&(r=ne);}catch{}else{if(_0x3257ae===_0x13d52a(0x14b))try{typeof ExitApi!=_0x13d52a(0xc4)&&(r=ie);}catch{}else{if(_0x3257ae===_0x13d52a(0x13d))window['gameReady']&&(r=oe);else{if(_0x3257ae===_0x13d52a(0x139))window[_0x13d52a(0x149)]&&(r=re);else{if(_0x3257ae==='tiktok')window[_0x13d52a(0x122)]&&(r=ae);else{if(_0x3257ae===_0x13d52a(0xe7))try{window[_0x13d52a(0xdf)]&&(r=se);}catch{}else{if(_0x3257ae===_0x13d52a(0xd1))try{window[_0x13d52a(0x13b)]&&(r=de);}catch{}else _0x3257ae===_0x13d52a(0xac)?r=le:(_0x43fe78===_0x13d52a(0x12b)||_0x3257ae===_0x13d52a(0x12b))&&(r=ce);}}}}}}}var Ae={'mechanic_id':a0_0x41c49b(0x145),'variant_id':a0_0x41c49b(0x110),'deployment_id':'TODO_deployment_id','export_id':a0_0x41c49b(0x108),'profile_id':a0_0x41c49b(0xeb),'instance_id':'default'},Me=Math[a0_0x41c49b(0x144)]()[a0_0x41c49b(0xb5)](0x24)[a0_0x41c49b(0x94)](0x2),w=null,A={...Ae},ke=a0_0x41c49b(0x111),Ne={},U=!0x1,E=!0x1,T=!0x1,Te=!0x1,J=0x1,K=0x0,z=!0x1,l=!0x1,N='',h=Math['floor'](window[a0_0x41c49b(0x107)]),b=Math['floor'](window['innerHeight']),B=h>b,c=!0x1,k=!0x1,be=!0x1,xe=!0x1,W=!0x1,j=null;function _e(){const _0xde877d=a0_0x41c49b;if(w)return w;let _0x15312a=document[_0xde877d(0xb0)](_0xde877d(0x8f));return _0x15312a['id']='handler-root',_0x15312a[_0xde877d(0x14a)]('data-handler-root',_0xde877d(0x130)),document[_0xde877d(0x12a)][_0xde877d(0xc7)](_0x15312a),w=_0x15312a,_0x15312a;}function M(_0x3b45c4){const _0x9fdf6b=a0_0x41c49b;switch(_0x3b45c4){case _0x9fdf6b(0xad):return _0x9fdf6b(0x125);case _0x9fdf6b(0x9d):return _0x9fdf6b(0x129);case'install':return _0x9fdf6b(0xea);default:return _0x3b45c4;}}function Oe(_0xa1bf93,_0x19fba4){const _0x2d192f=a0_0x41c49b;return{'event_name':_0xa1bf93,'ts':Date[_0x2d192f(0xfa)](),'session_id':Me,'deployment_id':A[_0x2d192f(0x124)],'variant_id':A['variant_id'],'export_profile_id':A['profile_id'],'instance_id':A['instance_id']||_0x2d192f(0x13a),'env':ke===_0x2d192f(0x9f)?_0x2d192f(0x9f):_0x2d192f(0x8e),'payload':_0x19fba4};}function a0_0x1b1b(){const _0x3a462b=['^5.7.2','hasOwnProperty','conversion','consent','https://github.com/HandlerAIGames/handler-playable-sdk.git','count','rootEl','init','undefined','playableFinished','4421512wDFgUJ','appendChild','includes','./dist/pixi/index.mjs','tsup\x20src/index.ts\x20src/pixi/index.ts\x20src/three/index.ts\x20--format\x20cjs,esm\x20--dts\x20--clean\x20--external\x20lottie-web','objectiveComplete','0.0.0','MIT','Gameplay_Complete','interactive','getOwnPropertyNames','snapchat','test','action:','hidden','getMaxSize','start','https://play.google.com/store','isReady','handler-playable-sdk','18Dlkpzo','node\x20scripts/publish-and-update.js\x20minor','ready','Handler\x20Playable\x20SDK\x20v0.1\x20with\x20contract-aligned\x20surface\x20(root\x20sandbox,\x20canonical\x20event\x20envelope).','touchstart','smxTracking','setPlayableBuild','ids','./dist/three/index.mjs','getAudioVolume','mousedown','text/javascript','redirect','smadex','11388069uvkgXO','%c\x20@handler/playable-sdk\x20%c\x20v','cta_click','TODO_profile_id','function','defineProperty','^8.0.0','dist','setPlayableAPI','Event\x20','tsup\x20src/index.ts\x20src/pixi/index.ts\x20src/three/index.ts\x20--format\x20cjs,esm\x20--dts\x20--clean\x20--minify\x20--external\x20lottie-web\x20&&\x20npm\x20run\x20obfuscate','userAgent','push','addEventListener','dist/index.js','exit','_Seconds','once','now','24520iHoqeg','mintGameClose','retry','bigabid','facebook','resize','NUC','20QwgwmA','log','FbPlayableAd','INMOBI_DSPMACROS','visible','innerWidth','TODO_export_id','install','enumerable','0.3.1','\x0a\x20\x20\x20\x20(function(){\x0a\x20\x20\x20\x20\x20\x20var\x20events\x20=\x20[\x27touchstart\x27,\x27touchend\x27,\x27mousedown\x27,\x27keydown\x27];\x0a\x20\x20\x20\x20\x20\x20function\x20unlock(){\x0a\x20\x20\x20\x20\x20\x20\x20\x20if(window.AudioContext\x20&&\x20AudioContext.prototype.resume){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if(!window.__handler_audio_ctx){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.__handler_audio_ctx\x20=\x20new\x20AudioContext();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if(window.__handler_audio_ctx.state\x20===\x20\x27suspended\x27){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.__handler_audio_ctx.resume();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20events.forEach(function(e){\x20document.removeEventListener(e,\x20unlock);\x20});\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20events.forEach(function(e){\x20document.addEventListener(e,\x20unlock,\x20false);\x20});\x0a\x20\x20\x20\x20})();\x0a\x20\x20','./dist/three/index.d.ts','visibilityState','__esModule','TODO_variant_id','web_embed','Ad_Viewable','call','volume','MRAID\x20hook\x20skipped','viewableChange','(((.+)+)+)+$','Handler','search','removeEventListener','./dist/pixi/index.d.ts','visibilitychange','readyState','\x20must\x20be\x20canonical\x20or\x20namespaced\x20as\x20custom.<mechanic_id>.<event>','object','none','dist/index.mjs','openAppStore','apply','deployment_id','engagement','./dist/index.d.ts','adResized','game_viewable','complete','body','nucleo','git','125640CJaeVx','onCTAClick','background:\x20#007acc;\x20color:\x20#fff;\x20font-size:\x2014px;\x20padding:\x204px\x208px;\x20border-top-left-radius:\x204px;\x20border-bottom-left-radius:\x204px;','true','getOwnPropertyDescriptor','DOMContentLoaded','587550XRTtRt','startsWith','14YUOdLV','textContent','BIGABID_BIDTIMEMACROS','mraid_viewable','tapjoy','default','ScPlayableAd','Smadex\x20redirect\x20failed','mintegral','warn','width','getState','javascript-obfuscator\x20dist/index.js\x20dist/index.mjs\x20dist/pixi/index.js\x20dist/pixi/index.mjs\x20dist/three/index.js\x20dist/three/index.mjs\x20--output\x20dist\x20--options-preset\x20high-obfuscation\x20--compact\x20true\x20--self-defending\x20true','openStoreUrl','^0.160.0','random','TODO_mechanic_id','gameRetry','custom.','tryAgain','TJ_API','setAttribute','google','8.8.1','README.md','sizeChange','ExitApi','node\x20scripts/publish-and-update.js\x20patch','web','div','exports','postMessage','mraid\x20error:','resume','slice','forEach','DSP_Click','gameReady','height','Ad_Load_Start','mintGameStart','landscape','eslint\x20\x27src/**/*.{ts,tsx}\x27','finish','3832CnDrus','mraid','5593290gKpOPx','floor','trigger','258bKJYqC','Tapjoy\x20skip\x20failed','Spent_','gameplayFinished','dapi','filter','open','isViewable','^5.1.0','vungle','interaction','^8.4.0','boot','createElement','profile','view','1749yWomuv','load','toString','node\x20scripts/publish-and-update.js\x20major','public','error','https://www.apple.com/app-store/','version','innerHeight'];a0_0x1b1b=function(){return _0x3a462b;};return a0_0x1b1b();}function o(_0x1f5ab0,_0x466242){let _0xc0e8bb=M(_0x1f5ab0),_0x30834a=Oe(_0xc0e8bb,_0x466242);P(_0xc0e8bb,_0x30834a),_0xc0e8bb!==_0x1f5ab0&&P(_0x1f5ab0,_0x30834a);}function O(){j&&(j(h,b),j=null);}function x(_0x28a56d){const _0x3bbc55=a0_0x41c49b;J=_0x28a56d,o(_0x3bbc55(0x114),_0x28a56d);}function _(_0x523f23){_0x523f23&&(Te=!0x0),!T&&(T=!0x0,o('pause'),x(0x0));}function S(_0x4be844){!_0x4be844&&Te||T&&(T=!0x1,o('resume'),x(J));}function f(_0x35b478,_0x6dabf6){const _0x1fc32f=a0_0x41c49b;h=Math['floor'](_0x35b478||window[_0x1fc32f(0x107)]),b=Math[_0x1fc32f(0xa1)](_0x6dabf6||window[_0x1fc32f(0xbb)]),B=h>b,o(_0x1fc32f(0x100),{'width':h,'height':b});}function ze(){const _0x1760a8=a0_0x41c49b;if(ue())try{let _0xb6dfa1=mraid[_0x1760a8(0xd5)]();f(_0xb6dfa1[_0x1760a8(0x13f)],_0xb6dfa1['height']);let _0x526bb1=()=>{const _0x4753e4=_0x1760a8;mraid[_0x4753e4(0xaa)]()&&mraid[_0x4753e4(0x140)]()!==_0x4753e4(0xd4)?S():_();};if(mraid[_0x1760a8(0xf5)](_0x1760a8(0x116),_0x526bb1),mraid[_0x1760a8(0xf5)]('stateChange',_0x526bb1),mraid[_0x1760a8(0xf5)](_0x1760a8(0x8b),()=>{const _0x540641=_0x1760a8;let _0x620e6f=mraid['getMaxSize']();f(_0x620e6f['width'],_0x620e6f[_0x540641(0x98)]);}),mraid['getAudioVolume']){let _0x25dceb=mraid['getAudioVolume']();x(_0x25dceb?0x1:0x0);}if(mraid[_0x1760a8(0xf5)]('audioVolumeChange',_0x5e3ec9=>{_0x5e3ec9!==null&&x(_0x5e3ec9>0x0?0x1:0x0);}),mraid[_0x1760a8(0xf5)]('error',(_0x3aeec9,_0x417a5b)=>{const _0x3a183d=_0x1760a8;console[_0x3a183d(0x13e)](_0x3a183d(0x92),_0x3aeec9,_0x3a183d(0xd3),_0x417a5b);}),z=!0x0,mraid[_0x1760a8(0xaa)]()&&mraid[_0x1760a8(0x140)]()!=='hidden')c=!0x0,o(_0x1760a8(0xaf)),o(_0x1760a8(0xb2)),o('ready'),l=!0x0,O();else{let _0x31dc1d=()=>{const _0x70adc5=_0x1760a8;c=!0x0,o(_0x70adc5(0xaf)),o('view'),o(_0x70adc5(0xdc)),l=!0x0,O();};mraid[_0x1760a8(0xf5)](_0x1760a8(0xdc),_0x31dc1d);}}catch(_0x25ca0d){console['warn'](_0x1760a8(0x115),_0x25ca0d);}}function Ve(){const _0x24b5e4=a0_0x41c49b;if(pe())try{let _0x5134e1=dapi['getScreenSize']();f(_0x5134e1[_0x24b5e4(0x13f)],_0x5134e1[_0x24b5e4(0x98)]),dapi[_0x24b5e4(0xf5)]('viewableChange',_0x18e660=>{const _0x210e35=_0x24b5e4;_0x18e660[_0x210e35(0xaa)]?S():_();}),dapi['addEventListener'](_0x24b5e4(0x127),_0x281d67=>{const _0x5d1738=_0x24b5e4;let _0x599674=dapi['getScreenSize']();f(_0x281d67[_0x5d1738(0x13f)]||_0x599674['width'],_0x281d67[_0x5d1738(0x98)]||_0x599674[_0x5d1738(0x98)]);});let _0x1f0168=dapi[_0x24b5e4(0xe3)]();if(x(_0x1f0168?0x1:0x0),dapi['addEventListener']('audioVolumeChange',_0x332eab=>x(_0x332eab?0x1:0x0)),z=!0x0,dapi[_0x24b5e4(0xaa)]())c=!0x0,o(_0x24b5e4(0xaf)),o(_0x24b5e4(0xb2)),o(_0x24b5e4(0xdc)),l=!0x0,O();else{let _0x17ab8f=()=>{const _0x5a6587=_0x24b5e4;c=!0x0,o(_0x5a6587(0xaf)),o('view'),o(_0x5a6587(0xdc)),l=!0x0,O();};dapi['addEventListener'](_0x24b5e4(0xdc),_0x17ab8f);}}catch(_0x527889){console[_0x24b5e4(0x13e)]('DAPI\x20hook\x20skipped',_0x527889);}}function ve(){const _0x3e1032=a0_0x41c49b;let _0x699053=()=>{const _0x13b0c3=a0_0x5038;c||document['visibilityState']===_0x13b0c3(0x106)&&(document[_0x13b0c3(0x11d)]===_0x13b0c3(0x129)||document[_0x13b0c3(0x11d)]===_0x13b0c3(0xcf))&&(c=!0x0,o('boot'),o('view'),o(_0x13b0c3(0xdc)),l=!0x0,O(),k&&(k=!0x1,u[_0x13b0c3(0xd6)]()));};window[_0x3e1032(0xf5)](_0x3e1032(0x100),()=>f()),document['addEventListener'](_0x3e1032(0x11c),()=>{const _0x3924e9=_0x3e1032;document[_0x3924e9(0x10e)]===_0x3924e9(0x106)?(S(),_0x699053()):_();}),document[_0x3e1032(0x11d)]==='complete'||document[_0x3e1032(0x11d)]===_0x3e1032(0xcf)?_0x699053():window[_0x3e1032(0xf5)]('load',_0x699053),z=!0x0;}function He(){const _0x4cb0ca=a0_0x41c49b;let _0x2acfa8=_0x438dd0=>{const _0x499063=a0_0x5038;typeof TouchEvent!=_0x499063(0xc4)&&_0x438dd0 instanceof TouchEvent&&(be=!0x0),!(be&&_0x438dd0 instanceof MouseEvent)&&(K+=0x1,o('interaction',K));};document['addEventListener'](_0x4cb0ca(0xe4),_0x2acfa8),document[_0x4cb0ca(0xf5)](_0x4cb0ca(0xde),_0x2acfa8);}function Fe(_0x40472a){const _0x363074=a0_0x41c49b;var _0x294637,_0x440345,_0x42219e,_0x4d4d4c,_0x11697e,_0x29b3da,_0x177fde,_0x595784,_0x4ca5da,_0x195163,_0x3fcac9,_0x3c6266;let _0x68d1f9=typeof AD_PROTOCOL!='undefined'?AD_PROTOCOL:_0x363074(0x120);if((typeof AD_NETWORK!=_0x363074(0xc4)?AD_NETWORK:'web_embed')===_0x363074(0x14b))try{(_0x294637=window[_0x363074(0x8c)])==null||_0x294637[_0x363074(0xf7)]();return;}catch{}if(_0x68d1f9==='mraid'&&typeof mraid!='undefined')mraid[_0x363074(0xa9)](_0x40472a||'');else{if(_0x68d1f9==='dapi'&&typeof dapi!=_0x363074(0xc4))dapi[_0x363074(0x142)]();else{if(y())(_0x42219e=(_0x440345=window[_0x363074(0x149)])==null?void 0x0:_0x440345['click'])==null||_0x42219e[_0x363074(0x113)](_0x440345);else{if(fe())(_0x11697e=(_0x4d4d4c=window[_0x363074(0x104)])==null?void 0x0:_0x4d4d4c[_0x363074(0x12e)])==null||_0x11697e[_0x363074(0x113)](_0x4d4d4c);else{if(we())(_0x177fde=(_0x29b3da=window['ScPlayableAd'])==null?void 0x0:_0x29b3da[_0x363074(0x12e)])==null||_0x177fde['call'](_0x29b3da);else{if(ye())try{(_0x4ca5da=(_0x595784=window[_0x363074(0xdf)])==null?void 0x0:_0x595784[_0x363074(0xe6)])==null||_0x4ca5da['call'](_0x595784);}catch(_0x39f765){console[_0x363074(0x13e)](_0x363074(0x13c),_0x39f765);}else{if(me()){let _0x4f5170=window[_0x363074(0x8c)];_0x4f5170&&typeof _0x4f5170[_0x363074(0xf7)]==_0x363074(0xec)?_0x4f5170['exit'](_0x40472a||N||''):_0x40472a&&window['open'](_0x40472a);}else g()?(_0x195163=window[_0x363074(0x109)])==null||_0x195163['call'](window):ge()?(_0x3fcac9=window[_0x363074(0x122)])==null||_0x3fcac9[_0x363074(0x113)](window):F()?(_0x3c6266=parent==null?void 0x0:parent[_0x363074(0x91)])==null||_0x3c6266['call'](parent,'download','*'):_0x40472a&&window[_0x363074(0xa9)](_0x40472a);}}}}}}}function Ge(){const _0x10e832=a0_0x41c49b;let _0x35a3cd=typeof AD_NETWORK!=_0x10e832(0xc4)?AD_NETWORK:'web_embed',_0x549b2f=_0x3216a4=>{if(!_0x3216a4)return;let _0x20fd2c=new Image();_0x20fd2c['src']=_0x3216a4;};if(_0x35a3cd===_0x10e832(0xfe)){let _0x3ba2f0=window[_0x10e832(0x137)];if(!_0x3ba2f0)return;s(_0x10e832(0xb2),()=>_0x549b2f(_0x3ba2f0[_0x10e832(0x138)])),s(_0x10e832(0xd6),()=>_0x549b2f(_0x3ba2f0[_0x10e832(0x128)])),s('engagement',()=>_0x549b2f(_0x3ba2f0['engagement']));let _0x40823c=()=>_0x549b2f(_0x3ba2f0['complete']);s(_0x10e832(0x129),_0x40823c),I(_0x10e832(0x125),_0x2cf874=>{const _0x3d1c28=_0x10e832;var _0x1bd954;((_0x1bd954=_0x2cf874==null?void 0x0:_0x2cf874['payload'])==null?void 0x0:_0x1bd954[_0x3d1c28(0xc1)])>0x3&&_0x40823c();}),s('cta_click',()=>_0x549b2f(_0x3ba2f0['click']));}else{if(_0x35a3cd==='inmobi'){let _0x5ca1c3=window[_0x10e832(0x105)];if(!_0x5ca1c3)return;s(_0x10e832(0xb2),()=>_0x549b2f(_0x5ca1c3[_0x10e832(0x99)])),s('start',()=>_0x549b2f(_0x5ca1c3[_0x10e832(0x112)])),s(_0x10e832(0x125),()=>_0x549b2f(_0x5ca1c3['First_Engagement'])),s('complete',()=>_0x549b2f(_0x5ca1c3[_0x10e832(0xce)])),s(_0x10e832(0xea),()=>_0x549b2f(_0x5ca1c3[_0x10e832(0x96)])),s('start',()=>{const _0x4f0496=_0x10e832;[0x5,0xa,0xf,0x14,0x19,0x1e][_0x4f0496(0x95)](_0x4d148d=>setTimeout(()=>_0x549b2f(_0x5ca1c3[_0x4f0496(0xa5)+_0x4d148d+_0x4f0496(0xf8)]),_0x4d148d*0x3e8));});}}}function Ue(){const _0x497c2f=a0_0x41c49b;if(!y())return;let _0xed1593=window[_0x497c2f(0x149)];_0xed1593&&_0xed1593[_0x497c2f(0xf0)]&&_0xed1593[_0x497c2f(0xf0)]({'skipAd':()=>{const _0x1db61f=_0x497c2f;try{u['finish']();}catch(_0x29deb7){console[_0x1db61f(0x13e)](_0x1db61f(0xa4),_0x29deb7);}}});}function Ee(){const _0xa6b9ad=a0_0x41c49b;var _0x3c5197,_0x39a95b,_0x5c6e06;let _0xa33029=window[_0xa6b9ad(0x149)];(_0x3c5197=_0xa33029==null?void 0x0:_0xa33029[_0xa6b9ad(0xcb)])==null||_0x3c5197[_0xa6b9ad(0x113)](_0xa33029),(_0x39a95b=_0xa33029==null?void 0x0:_0xa33029[_0xa6b9ad(0xc5)])==null||_0x39a95b[_0xa6b9ad(0x113)](_0xa33029),(_0x5c6e06=_0xa33029==null?void 0x0:_0xa33029[_0xa6b9ad(0xa6)])==null||_0x5c6e06[_0xa6b9ad(0x113)](_0xa33029);}function We(){const _0x2a72ac=a0_0x41c49b;g()&&(window[_0x2a72ac(0x9a)]=()=>{S(!0x0),f();},window[_0x2a72ac(0xfc)]=()=>{_(!0x0);});}function Ke(){const _0x2b1057=a0_0x41c49b;if(!G())return;let _0x4a24ed=window[_0x2b1057(0x101)];!_0x4a24ed||!_0x4a24ed[_0x2b1057(0xa2)]||(u['on'](_0x2b1057(0xea),()=>{const _0x182aa4=_0x2b1057;var _0x536c6c,_0x2a1784;return(_0x2a1784=(_0x536c6c=_0x4a24ed[_0x182aa4(0xa2)])['convert'])==null?void 0x0:_0x2a1784[_0x182aa4(0x113)](_0x536c6c,N);}),u['on'](_0x2b1057(0x129),()=>{const _0xe8573e=_0x2b1057;var _0x46c810,_0x4c64fb;return(_0x4c64fb=(_0x46c810=_0x4a24ed[_0xe8573e(0xa2)])[_0xe8573e(0x148)])==null?void 0x0:_0x4c64fb['call'](_0x46c810);}));}var u={'init'(_0x3daa5c={},_0x1fedb8){const _0x45b8dc=a0_0x41c49b;if(ke=_0x3daa5c[_0x45b8dc(0xb1)]||_0x45b8dc(0x111),Ne=_0x3daa5c[_0x45b8dc(0xbf)]||{},A={...Ae,..._0x3daa5c[_0x45b8dc(0xe1)]||{}},w=_0x3daa5c[_0x45b8dc(0xc2)]||w,N=_0x3daa5c['destinationUrl']||(/android/i[_0x45b8dc(0xd2)](navigator[_0x45b8dc(0xf3)])?_0x45b8dc(0xd7):_0x45b8dc(0xb9)),_0x1fedb8&&(j=_0x1fedb8),o(_0x45b8dc(0xc3)),document[_0x45b8dc(0x12a)]['oncontextmenu']=()=>!0x1,_e(),Je(w),he(),ze(),Ve(),!z){if(document[_0x45b8dc(0x11d)]===_0x45b8dc(0x129))ve();else{if(!xe){xe=!0x0;let _0x48ba61=()=>{const _0x229fbb=_0x45b8dc;ve(),window[_0x229fbb(0x11a)](_0x229fbb(0xb4),_0x48ba61),document[_0x229fbb(0x11a)]('DOMContentLoaded',_0x48ba61);};window[_0x45b8dc(0xf5)]('load',_0x48ba61),document[_0x45b8dc(0xf5)](_0x45b8dc(0x132),_0x48ba61);}}}He(),Ge(),Ue(),We(),Ke(),console[_0x45b8dc(0x103)](_0x45b8dc(0xe9)+(R['version']||_0x45b8dc(0xcc))+'\x20',_0x45b8dc(0x12f),'background:\x20#e1e4e8;\x20color:\x20#333;\x20font-size:\x2014px;\x20padding:\x204px\x208px;\x20border-top-right-radius:\x204px;\x20border-bottom-right-radius:\x204px;'),c&&!l&&(o(_0x45b8dc(0xaf)),o(_0x45b8dc(0xb2)),o(_0x45b8dc(0xdc)),k&&(k=!0x1,u[_0x45b8dc(0xd6)]()),l=!0x0),l=c;},'getRoot'(){return _e();},get 'version'(){const _0x2ddd87=a0_0x41c49b;return R[_0x2ddd87(0xba)]||_0x2ddd87(0xcc);},get 'maxWidth'(){return h;},get 'maxHeight'(){return b;},get 'isLandscape'(){return B;},get 'isReady'(){return l;},get 'isStarted'(){return U;},get 'isPaused'(){return T;},get 'isFinished'(){return E;},get 'volume'(){return J;},get 'interactions'(){return K;},'on'(_0x2e7bd,_0x54455b){I(M(_0x2e7bd),_0x54455b);},'off'(_0x523a33,_0x281e23){H(M(_0x523a33),_0x281e23);},'start'(){const _0x1d1e2c=a0_0x41c49b;var _0x22ebdc,_0x3bc106;if(!U){if(!c){k=!0x0;return;}if(U=!0x0,o(_0x1d1e2c(0xd6)),f(),g())_(),(_0x22ebdc=window[_0x1d1e2c(0x97)])==null||_0x22ebdc['call'](window);else{if(y()){let _0x146f2f=window[_0x1d1e2c(0x149)];(_0x3bc106=_0x146f2f==null?void 0x0:_0x146f2f[_0x1d1e2c(0xe0)])==null||_0x3bc106[_0x1d1e2c(0x113)](_0x146f2f,{'orientation':B?_0x1d1e2c(0x9b):'portrait','buildID':R[_0x1d1e2c(0xba)]||'dev'});}}}},'finish'(){const _0x584c31=a0_0x41c49b;var _0x347e07,_0x405bbc;E||(E=!0x0,o(_0x584c31(0x129)),g()?(_0x347e07=window['gameEnd'])==null||_0x347e07[_0x584c31(0x113)](window):F()?(_0x405bbc=parent==null?void 0x0:parent[_0x584c31(0x91)])==null||_0x405bbc[_0x584c31(0x113)](parent,_0x584c31(0x129),'*'):y()&&Ee());},'install'(_0x5e8335){const _0x42cbc6=a0_0x41c49b;if(!E){E=!0x0,y()?(Ee(),setTimeout(()=>u[_0x42cbc6(0x109)](_0x5e8335),0x12c)):(o(_0x42cbc6(0x129)),setTimeout(()=>u[_0x42cbc6(0x109)](_0x5e8335),0x0));return;}W||(W=!0x0,setTimeout(()=>W=!0x1,0x1f4),o(_0x42cbc6(0xea)),o(_0x42cbc6(0xbe)),Fe(_0x5e8335||N));},'emit'(_0x2b1963,_0x5ad9f4){const _0x3d756d=a0_0x41c49b;let _0x476d26=M(_0x2b1963);if(!['view',_0x3d756d(0xaf),_0x3d756d(0xd6),'engagement',_0x3d756d(0x129),'cta_click',_0x3d756d(0xbe),_0x3d756d(0xfd),'pause',_0x3d756d(0x93),_0x3d756d(0x100),_0x3d756d(0x114),_0x3d756d(0xb8)][_0x3d756d(0xc8)](_0x476d26)&&!_0x476d26[_0x3d756d(0x134)](_0x3d756d(0x147)))throw new Error(_0x3d756d(0xf1)+_0x2b1963+_0x3d756d(0x11e));let _0x2fe3e8=Oe(_0x476d26,_0x5ad9f4);P(_0x476d26,_0x2fe3e8);},'retry'(){const _0x2cf9b4=a0_0x41c49b;var _0x30343b,_0x362819,_0x3a8c31;if(g())(_0x30343b=window[_0x2cf9b4(0x146)])==null||_0x30343b[_0x2cf9b4(0x113)](window);else{if(G()){let _0x497a56=window[_0x2cf9b4(0x101)];(_0x3a8c31=(_0x362819=_0x497a56==null?void 0x0:_0x497a56[_0x2cf9b4(0xa2)])==null?void 0x0:_0x362819[_0x2cf9b4(0x148)])==null||_0x3a8c31[_0x2cf9b4(0x113)](_0x362819);}}o(_0x2cf9b4(0x125),{'action':'retry'});},'pause'(){_(!0x0);},'resume'(){S(!0x0);},'resize'(_0x59c109,_0x50914b){f(_0x59c109,_0x50914b);}},Be=u;function Je(_0x5204a2){const _0x16f63d=a0_0x41c49b;let _0x34f9ef=document[_0x16f63d(0xb0)]('script');_0x34f9ef['type']=_0x16f63d(0xe5),_0x34f9ef[_0x16f63d(0x136)]=_0x16f63d(0x10c),_0x5204a2[_0x16f63d(0xc7)](_0x34f9ef);}0x0&&(module['exports']={'Handler':Handler});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-U4PCKCX6.mjs";export{a as Handler,b as default};
|
package/dist/pixi/index.d.mts
CHANGED
|
@@ -136,6 +136,14 @@ declare class GameObject {
|
|
|
136
136
|
* Update config and sync (for hot-reload)
|
|
137
137
|
*/
|
|
138
138
|
updateConfig(newConfig: any): void;
|
|
139
|
+
/**
|
|
140
|
+
* Apply anchor from render/transform config (sprites only)
|
|
141
|
+
*/
|
|
142
|
+
private applyAnchor;
|
|
143
|
+
/**
|
|
144
|
+
* Apply optional non-uniform scale from effects (if provided)
|
|
145
|
+
*/
|
|
146
|
+
private applyEffectsScale;
|
|
139
147
|
/**
|
|
140
148
|
* Get component value
|
|
141
149
|
*/
|
|
@@ -276,6 +284,10 @@ interface ObjectConfig {
|
|
|
276
284
|
background_color?: string;
|
|
277
285
|
background_alpha?: number;
|
|
278
286
|
border_color?: string;
|
|
287
|
+
anchor?: {
|
|
288
|
+
x: number;
|
|
289
|
+
y: number;
|
|
290
|
+
};
|
|
279
291
|
};
|
|
280
292
|
gameplay?: {
|
|
281
293
|
rules?: Record<string, unknown>;
|
|
@@ -460,6 +472,17 @@ declare function playLottieOverlay(objectId: string, root: HTMLElement, config:
|
|
|
460
472
|
*
|
|
461
473
|
* DO NOT EDIT - Handler SDK Core
|
|
462
474
|
*/
|
|
475
|
+
type BuildMode = 'dev' | 'brand' | 'publish';
|
|
476
|
+
type BuildSettings = {
|
|
477
|
+
buildMode?: BuildMode;
|
|
478
|
+
assetsInlined?: boolean;
|
|
479
|
+
};
|
|
480
|
+
declare global {
|
|
481
|
+
interface Window {
|
|
482
|
+
INLINE_ASSETS?: Record<string, string>;
|
|
483
|
+
__BUILD_SETTINGS__?: BuildSettings;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
463
486
|
type AssetDefinition = {
|
|
464
487
|
type: string;
|
|
465
488
|
path: string;
|
package/dist/pixi/index.d.ts
CHANGED
|
@@ -136,6 +136,14 @@ declare class GameObject {
|
|
|
136
136
|
* Update config and sync (for hot-reload)
|
|
137
137
|
*/
|
|
138
138
|
updateConfig(newConfig: any): void;
|
|
139
|
+
/**
|
|
140
|
+
* Apply anchor from render/transform config (sprites only)
|
|
141
|
+
*/
|
|
142
|
+
private applyAnchor;
|
|
143
|
+
/**
|
|
144
|
+
* Apply optional non-uniform scale from effects (if provided)
|
|
145
|
+
*/
|
|
146
|
+
private applyEffectsScale;
|
|
139
147
|
/**
|
|
140
148
|
* Get component value
|
|
141
149
|
*/
|
|
@@ -276,6 +284,10 @@ interface ObjectConfig {
|
|
|
276
284
|
background_color?: string;
|
|
277
285
|
background_alpha?: number;
|
|
278
286
|
border_color?: string;
|
|
287
|
+
anchor?: {
|
|
288
|
+
x: number;
|
|
289
|
+
y: number;
|
|
290
|
+
};
|
|
279
291
|
};
|
|
280
292
|
gameplay?: {
|
|
281
293
|
rules?: Record<string, unknown>;
|
|
@@ -460,6 +472,17 @@ declare function playLottieOverlay(objectId: string, root: HTMLElement, config:
|
|
|
460
472
|
*
|
|
461
473
|
* DO NOT EDIT - Handler SDK Core
|
|
462
474
|
*/
|
|
475
|
+
type BuildMode = 'dev' | 'brand' | 'publish';
|
|
476
|
+
type BuildSettings = {
|
|
477
|
+
buildMode?: BuildMode;
|
|
478
|
+
assetsInlined?: boolean;
|
|
479
|
+
};
|
|
480
|
+
declare global {
|
|
481
|
+
interface Window {
|
|
482
|
+
INLINE_ASSETS?: Record<string, string>;
|
|
483
|
+
__BUILD_SETTINGS__?: BuildSettings;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
463
486
|
type AssetDefinition = {
|
|
464
487
|
type: string;
|
|
465
488
|
path: string;
|
package/dist/pixi/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var nt=Object.defineProperty;var ai=Object.getOwnPropertyDescriptor;var ii=Object.getOwnPropertyNames;var si=Object.prototype.hasOwnProperty;var oi=(t,e)=>{for(var n in e)nt(t,n,{get:e[n],enumerable:!0})},ri=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ii(e))!si.call(t,s)&&s!==n&&nt(t,s,{get:()=>e[s],enumerable:!(a=ai(e,s))||a.enumerable});return t};var li=t=>ri(nt({},"__esModule",{value:!0}),t);var Pi={};oi(Pi,{AssetCache:()=>X,AssetLoader:()=>we,GameObject:()=>De,GameObjectManager:()=>Xe,ObjectFactory:()=>Qe,Renderer:()=>Me,Transform:()=>Le,animateHandClick:()=>fa,animatePanelEntrance:()=>pa,createEndGamePanel:()=>ua,createHandTutorial:()=>ha,createPixiBase:()=>la,createTutorialLabel:()=>ma,getRegisteredFontIds:()=>da,playLottieOverlay:()=>_a,registerFont:()=>ca,registerType:()=>je,resolveFont:()=>V,resolveFontWeight:()=>q,setLottieInstance:()=>ga,updateHandAnimation:()=>ya});module.exports=li(Pi);var ra=require("pixi.js");var ne={};function ze(t,e,n=!1){ne[t]||(ne[t]=[]),ne[t].push({fn:e,once:n})}function at(t,e){if(ne[t]){if(!e){delete ne[t];return}ne[t]=ne[t].filter(n=>n.fn!==e)}}function He(t,...e){let n=ne[t];if(n)for(let a of[...n])a.fn(...e),a.once&&at(t,a.fn)}function z(t,e){ze(t,e,!0)}var We={name:"handler-playable-sdk",version:"0.2.7",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var H=0,di=H++,kn=H++,Fn=H++,In=H++,Rn=H++,Nn=H++,Bn=H++,$n=H++,zn=H++,Hn=H++,Wn=H++,Yn=H++,_=di;function Gn(){return _===kn}function Jn(){return _===Fn}function Vn(){return _===In}function qn(){return _===Rn}function ue(){return _===Nn}function pe(){return _===Bn}function Xn(){return _===$n}function Un(){return _===zn}function Kn(){return _===Hn}function it(){return _===Wn}function st(){return _===Yn}function jn(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),_=kn;return}catch{}else if(t==="dapi")try{dapi.isReady(),_=Fn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(_=In)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(_=Rn)}catch{}else if(e==="mintegral")window.gameReady&&(_=Nn);else if(e==="tapjoy")window.TJ_API&&(_=Bn);else if(e==="tiktok")window.openAppStore&&(_=$n);else if(e==="smadex")try{window.smxTracking&&(_=zn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(_=Hn)}catch{}else e==="vungle"?_=Wn:(t==="nucleo"||e==="nucleo")&&(_=Yn)}var aa={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},ui=Math.random().toString(36).slice(2),fe=null,Se={...aa},ia="web_embed",pi={},ot=!1,xe=!1,Ae=!1,sa=!1,dt=1,lt=0,Ve=!1,Q=!1,Je="",he=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),ct=he>me,Z=!1,Te=!1,Qn=!1,Zn=!1,rt=!1,Ye=null;function ea(){if(fe)return fe;let t=document.createElement("div");return t.id="handler-root",t.setAttribute("data-handler-root","true"),document.body.appendChild(t),fe=t,t}function Ge(t){switch(t){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return t}}function oa(t,e){return{event_name:t,ts:Date.now(),session_id:ui,deployment_id:Se.deployment_id,variant_id:Se.variant_id,export_profile_id:Se.profile_id,instance_id:Se.instance_id||"default",env:ia==="mraid"?"mraid":"web",payload:e}}function y(t,e){let n=Ge(t),a=oa(n,e);He(n,a),n!==t&&He(t,a)}function ve(){Ye&&(Ye(he,me),Ye=null)}function ye(t){dt=t,y("volume",t)}function ge(t){t&&(sa=!0),!Ae&&(Ae=!0,y("pause"),ye(0))}function Ee(t){!t&&sa||Ae&&(Ae=!1,y("resume"),ye(dt))}function ie(t,e){he=Math.floor(t||window.innerWidth),me=Math.floor(e||window.innerHeight),ct=he>me,y("resize",{width:he,height:me})}function fi(){if(Gn())try{let t=mraid.getMaxSize();ie(t.width,t.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Ee():ge()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();ie(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ye(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ye(n>0?1:0)}),mraid.addEventListener("error",(n,a)=>{console.warn("mraid error:",n,"action:",a)}),Ve=!0,mraid.isViewable()&&mraid.getState()!=="hidden")Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve();else{let n=()=>{Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve()};mraid.addEventListener("ready",n)}}catch(t){console.warn("MRAID hook skipped",t)}}function hi(){if(Jn())try{let t=dapi.getScreenSize();ie(t.width,t.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Ee():ge()}),dapi.addEventListener("adResized",n=>{let a=dapi.getScreenSize();ie(n.width||a.width,n.height||a.height)});let e=dapi.getAudioVolume();if(ye(e?1:0),dapi.addEventListener("audioVolumeChange",n=>ye(n?1:0)),Ve=!0,dapi.isViewable())Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve();else{let n=()=>{Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve()};dapi.addEventListener("ready",n)}}catch(t){console.warn("DAPI hook skipped",t)}}function ta(){let t=()=>{Z||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve(),Te&&(Te=!1,ae.start()))};window.addEventListener("resize",()=>ie()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Ee(),t()):ge()}),document.readyState==="complete"||document.readyState==="interactive"?t():window.addEventListener("load",t),Ve=!0}function mi(){let t=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(Qn=!0),!(Qn&&e instanceof MouseEvent)&&(lt+=1,y("interaction",lt))};document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)}function yi(t){var a,s,i,o,r,c,l,p,f,u,d,m;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(a=window.ExitApi)==null||a.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(t||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(pe())(i=(s=window.TJ_API)==null?void 0:s.click)==null||i.call(s);else if(Vn())(r=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||r.call(o);else if(Kn())(l=(c=window.ScPlayableAd)==null?void 0:c.onCTAClick)==null||l.call(c);else if(Un())try{(f=(p=window.smxTracking)==null?void 0:p.redirect)==null||f.call(p)}catch(h){console.warn("Smadex redirect failed",h)}else if(qn()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(t||Je||""):t&&window.open(t)}else ue()?(u=window.install)==null||u.call(window):Xn()?(d=window.openAppStore)==null||d.call(window):it()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):t&&window.open(t)}function gi(){let t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=n=>{if(!n)return;let a=new Image;a.src=n};if(t==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;z("view",()=>e(n.mraid_viewable)),z("start",()=>e(n.game_viewable)),z("engagement",()=>e(n.engagement));let a=()=>e(n.complete);z("complete",a),ze("engagement",s=>{var i;((i=s==null?void 0:s.payload)==null?void 0:i.count)>3&&a()}),z("cta_click",()=>e(n.click))}else if(t==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;z("view",()=>e(n.Ad_Load_Start)),z("start",()=>e(n.Ad_Viewable)),z("engagement",()=>e(n.First_Engagement)),z("complete",()=>e(n.Gameplay_Complete)),z("cta_click",()=>e(n.DSP_Click)),z("start",()=>{[5,10,15,20,25,30].forEach(a=>setTimeout(()=>e(n[`Spent_${a}_Seconds`]),a*1e3))})}}function _i(){if(!pe())return;let t=window.TJ_API;t&&t.setPlayableAPI&&t.setPlayableAPI({skipAd:()=>{try{ae.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function na(){var e,n,a;let t=window.TJ_API;(e=t==null?void 0:t.objectiveComplete)==null||e.call(t),(n=t==null?void 0:t.playableFinished)==null||n.call(t),(a=t==null?void 0:t.gameplayFinished)==null||a.call(t)}function wi(){ue()&&(window.mintGameStart=()=>{Ee(!0),ie()},window.mintGameClose=()=>{ge(!0)})}function bi(){if(!st())return;let t=window.NUC;!t||!t.trigger||(ae.on("cta_click",()=>{var e,n;return(n=(e=t.trigger).convert)==null?void 0:n.call(e,Je)}),ae.on("complete",()=>{var e,n;return(n=(e=t.trigger).tryAgain)==null?void 0:n.call(e)}))}var ae={init(t={},e){if(ia=t.profile||"web_embed",pi=t.consent||{},Se={...aa,...t.ids||{}},fe=t.rootEl||fe,Je=t.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(Ye=e),y("init"),document.body.oncontextmenu=()=>!1,ea(),xi(fe),jn(),fi(),hi(),!Ve){if(document.readyState==="complete")ta();else if(!Zn){Zn=!0;let n=()=>{ta(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}mi(),gi(),_i(),wi(),bi(),console.log(`%c @handler/playable-sdk %c v${We.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),Z&&!Q&&(y("boot"),y("view"),y("ready"),Te&&(Te=!1,ae.start()),Q=!0),Q=Z},getRoot(){return ea()},get version(){return We.version||"0.0.0"},get maxWidth(){return he},get maxHeight(){return me},get isLandscape(){return ct},get isReady(){return Q},get isStarted(){return ot},get isPaused(){return Ae},get isFinished(){return xe},get volume(){return dt},get interactions(){return lt},on(t,e){ze(Ge(t),e)},off(t,e){at(Ge(t),e)},start(){var t,e;if(!ot){if(!Z){Te=!0;return}if(ot=!0,y("start"),ie(),ue())ge(),(t=window.gameReady)==null||t.call(window);else if(pe()){let n=window.TJ_API;(e=n==null?void 0:n.setPlayableBuild)==null||e.call(n,{orientation:ct?"landscape":"portrait",buildID:We.version||"dev"})}}},finish(){var t,e;xe||(xe=!0,y("complete"),ue()?(t=window.gameEnd)==null||t.call(window):it()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):pe()&&na())},install(t){if(!xe){xe=!0,pe()?(na(),setTimeout(()=>ae.install(t),300)):(y("complete"),setTimeout(()=>ae.install(t),0));return}rt||(rt=!0,setTimeout(()=>rt=!1,500),y("cta_click"),y("conversion"),yi(t||Je))},emit(t,e){let n=Ge(t);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${t} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let a=oa(n,e);He(n,a)},retry(){var t,e,n;if(ue())(t=window.gameRetry)==null||t.call(window);else if(st()){let a=window.NUC;(n=(e=a==null?void 0:a.trigger)==null?void 0:e.tryAgain)==null||n.call(e)}y("engagement",{action:"retry"})},pause(){ge(!0)},resume(){Ee(!0)},resize(t,e){ie(t,e)}},qe=ae;function xi(t){let e=document.createElement("script");e.type="text/javascript",e.textContent=`
|
|
1
|
+
"use strict";var lt=Object.defineProperty;var di=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var pi=Object.prototype.hasOwnProperty;var fi=(t,e)=>{for(var n in e)lt(t,n,{get:e[n],enumerable:!0})},hi=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ui(e))!pi.call(t,a)&&a!==n&<(t,a,{get:()=>e[a],enumerable:!(s=di(e,a))||s.enumerable});return t};var mi=t=>hi(lt({},"__esModule",{value:!0}),t);var Wi={};fi(Wi,{AssetCache:()=>Q,AssetLoader:()=>Te,GameObject:()=>Ne,GameObjectManager:()=>Ue,ObjectFactory:()=>st,Renderer:()=>De,Transform:()=>Pe,animateHandClick:()=>bs,animatePanelEntrance:()=>_s,createEndGamePanel:()=>gs,createHandTutorial:()=>ws,createPixiBase:()=>hs,createTutorialLabel:()=>xs,getRegisteredFontIds:()=>ys,playLottieOverlay:()=>Ts,registerFont:()=>ms,registerType:()=>nt,resolveFont:()=>X,resolveFontWeight:()=>K,setLottieInstance:()=>As,updateHandAnimation:()=>Ss});module.exports=mi(Wi);var fs=require("pixi.js");var re={};function Ge(t,e,n=!1){re[t]||(re[t]=[]),re[t].push({fn:e,once:n})}function ct(t,e){if(re[t]){if(!e){delete re[t];return}re[t]=re[t].filter(n=>n.fn!==e)}}function Je(t,...e){let n=re[t];if(n)for(let s of[...n])s.fn(...e),s.once&&ct(t,s.fn)}function q(t,e){Ge(t,e,!0)}var je={name:"handler-playable-sdk",version:"0.3.1",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var G=0,gi=G++,Bn=G++,zn=G++,Hn=G++,Wn=G++,Yn=G++,qn=G++,Gn=G++,Jn=G++,jn=G++,Vn=G++,Xn=G++,S=gi;function Kn(){return S===Bn}function Qn(){return S===zn}function Zn(){return S===Hn}function Un(){return S===Wn}function ge(){return S===Yn}function _e(){return S===qn}function es(){return S===Gn}function ts(){return S===Jn}function ns(){return S===jn}function dt(){return S===Vn}function ut(){return S===Xn}function ss(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),S=Bn;return}catch{}else if(t==="dapi")try{dapi.isReady(),S=zn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(S=Hn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(S=Wn)}catch{}else if(e==="mintegral")window.gameReady&&(S=Yn);else if(e==="tapjoy")window.TJ_API&&(S=qn);else if(e==="tiktok")window.openAppStore&&(S=Gn);else if(e==="smadex")try{window.smxTracking&&(S=Jn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(S=jn)}catch{}else e==="vungle"?S=Vn:(t==="nucleo"||e==="nucleo")&&(S=Xn)}var cs={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},_i=Math.random().toString(36).slice(2),be=null,Le={...cs},ds="web_embed",bi={},pt=!1,Ee=!1,Oe=!1,us=!1,yt=1,ht=0,Qe=!1,ne=!1,Ke="",we=Math.floor(window.innerWidth),xe=Math.floor(window.innerHeight),mt=we>xe,se=!1,Me=!1,is=!1,as=!1,ft=!1,Ve=null;function os(){if(be)return be;let t=document.createElement("div");return t.id="handler-root",t.setAttribute("data-handler-root","true"),document.body.appendChild(t),be=t,t}function Xe(t){switch(t){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return t}}function ps(t,e){return{event_name:t,ts:Date.now(),session_id:_i,deployment_id:Le.deployment_id,variant_id:Le.variant_id,export_profile_id:Le.profile_id,instance_id:Le.instance_id||"default",env:ds==="mraid"?"mraid":"web",payload:e}}function y(t,e){let n=Xe(t),s=ps(n,e);Je(n,s),n!==t&&Je(t,s)}function Ce(){Ve&&(Ve(we,xe),Ve=null)}function Se(t){yt=t,y("volume",t)}function Ae(t){t&&(us=!0),!Oe&&(Oe=!0,y("pause"),Se(0))}function ke(t){!t&&us||Oe&&(Oe=!1,y("resume"),Se(yt))}function ce(t,e){we=Math.floor(t||window.innerWidth),xe=Math.floor(e||window.innerHeight),mt=we>xe,y("resize",{width:we,height:xe})}function wi(){if(Kn())try{let t=mraid.getMaxSize();ce(t.width,t.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?ke():Ae()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();ce(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();Se(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&Se(n>0?1:0)}),mraid.addEventListener("error",(n,s)=>{console.warn("mraid error:",n,"action:",s)}),Qe=!0,mraid.isViewable()&&mraid.getState()!=="hidden")se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce();else{let n=()=>{se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce()};mraid.addEventListener("ready",n)}}catch(t){console.warn("MRAID hook skipped",t)}}function xi(){if(Qn())try{let t=dapi.getScreenSize();ce(t.width,t.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?ke():Ae()}),dapi.addEventListener("adResized",n=>{let s=dapi.getScreenSize();ce(n.width||s.width,n.height||s.height)});let e=dapi.getAudioVolume();if(Se(e?1:0),dapi.addEventListener("audioVolumeChange",n=>Se(n?1:0)),Qe=!0,dapi.isViewable())se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce();else{let n=()=>{se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce()};dapi.addEventListener("ready",n)}}catch(t){console.warn("DAPI hook skipped",t)}}function rs(){let t=()=>{se||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce(),Me&&(Me=!1,le.start()))};window.addEventListener("resize",()=>ce()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(ke(),t()):Ae()}),document.readyState==="complete"||document.readyState==="interactive"?t():window.addEventListener("load",t),Qe=!0}function Si(){let t=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(is=!0),!(is&&e instanceof MouseEvent)&&(ht+=1,y("interaction",ht))};document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)}function Ai(t){var s,a,i,o,r,c,l,u,h,p,d,m;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(s=window.ExitApi)==null||s.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(t||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(_e())(i=(a=window.TJ_API)==null?void 0:a.click)==null||i.call(a);else if(Zn())(r=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||r.call(o);else if(ns())(l=(c=window.ScPlayableAd)==null?void 0:c.onCTAClick)==null||l.call(c);else if(ts())try{(h=(u=window.smxTracking)==null?void 0:u.redirect)==null||h.call(u)}catch(f){console.warn("Smadex redirect failed",f)}else if(Un()){let f=window.ExitApi;f&&typeof f.exit=="function"?f.exit(t||Ke||""):t&&window.open(t)}else ge()?(p=window.install)==null||p.call(window):es()?(d=window.openAppStore)==null||d.call(window):dt()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):t&&window.open(t)}function Ti(){let t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=n=>{if(!n)return;let s=new Image;s.src=n};if(t==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;q("view",()=>e(n.mraid_viewable)),q("start",()=>e(n.game_viewable)),q("engagement",()=>e(n.engagement));let s=()=>e(n.complete);q("complete",s),Ge("engagement",a=>{var i;((i=a==null?void 0:a.payload)==null?void 0:i.count)>3&&s()}),q("cta_click",()=>e(n.click))}else if(t==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;q("view",()=>e(n.Ad_Load_Start)),q("start",()=>e(n.Ad_Viewable)),q("engagement",()=>e(n.First_Engagement)),q("complete",()=>e(n.Gameplay_Complete)),q("cta_click",()=>e(n.DSP_Click)),q("start",()=>{[5,10,15,20,25,30].forEach(s=>setTimeout(()=>e(n[`Spent_${s}_Seconds`]),s*1e3))})}}function vi(){if(!_e())return;let t=window.TJ_API;t&&t.setPlayableAPI&&t.setPlayableAPI({skipAd:()=>{try{le.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function ls(){var e,n,s;let t=window.TJ_API;(e=t==null?void 0:t.objectiveComplete)==null||e.call(t),(n=t==null?void 0:t.playableFinished)==null||n.call(t),(s=t==null?void 0:t.gameplayFinished)==null||s.call(t)}function Ei(){ge()&&(window.mintGameStart=()=>{ke(!0),ce()},window.mintGameClose=()=>{Ae(!0)})}function Li(){if(!ut())return;let t=window.NUC;!t||!t.trigger||(le.on("cta_click",()=>{var e,n;return(n=(e=t.trigger).convert)==null?void 0:n.call(e,Ke)}),le.on("complete",()=>{var e,n;return(n=(e=t.trigger).tryAgain)==null?void 0:n.call(e)}))}var le={init(t={},e){if(ds=t.profile||"web_embed",bi=t.consent||{},Le={...cs,...t.ids||{}},be=t.rootEl||be,Ke=t.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(Ve=e),y("init"),document.body.oncontextmenu=()=>!1,os(),Mi(be),ss(),wi(),xi(),!Qe){if(document.readyState==="complete")rs();else if(!as){as=!0;let n=()=>{rs(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Si(),Ti(),vi(),Ei(),Li(),console.log(`%c @handler/playable-sdk %c v${je.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),se&&!ne&&(y("boot"),y("view"),y("ready"),Me&&(Me=!1,le.start()),ne=!0),ne=se},getRoot(){return os()},get version(){return je.version||"0.0.0"},get maxWidth(){return we},get maxHeight(){return xe},get isLandscape(){return mt},get isReady(){return ne},get isStarted(){return pt},get isPaused(){return Oe},get isFinished(){return Ee},get volume(){return yt},get interactions(){return ht},on(t,e){Ge(Xe(t),e)},off(t,e){ct(Xe(t),e)},start(){var t,e;if(!pt){if(!se){Me=!0;return}if(pt=!0,y("start"),ce(),ge())Ae(),(t=window.gameReady)==null||t.call(window);else if(_e()){let n=window.TJ_API;(e=n==null?void 0:n.setPlayableBuild)==null||e.call(n,{orientation:mt?"landscape":"portrait",buildID:je.version||"dev"})}}},finish(){var t,e;Ee||(Ee=!0,y("complete"),ge()?(t=window.gameEnd)==null||t.call(window):dt()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):_e()&&ls())},install(t){if(!Ee){Ee=!0,_e()?(ls(),setTimeout(()=>le.install(t),300)):(y("complete"),setTimeout(()=>le.install(t),0));return}ft||(ft=!0,setTimeout(()=>ft=!1,500),y("cta_click"),y("conversion"),Ai(t||Ke))},emit(t,e){let n=Xe(t);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${t} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let s=ps(n,e);Je(n,s)},retry(){var t,e,n;if(ge())(t=window.gameRetry)==null||t.call(window);else if(ut()){let s=window.NUC;(n=(e=s==null?void 0:s.trigger)==null?void 0:e.tryAgain)==null||n.call(e)}y("engagement",{action:"retry"})},pause(){Ae(!0)},resume(){ke(!0)},resize(t,e){ce(t,e)}},Ze=le;function Mi(t){let e=document.createElement("script");e.type="text/javascript",e.textContent=`
|
|
2
2
|
(function(){
|
|
3
3
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
4
|
function unlock(){
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
}
|
|
15
15
|
events.forEach(function(e){ document.addEventListener(e, unlock, false); });
|
|
16
16
|
})();
|
|
17
|
-
`,t.appendChild(e)}async function la(t,e={}){let n=new ra.Application;await n.init({resizeTo:t,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let a=i=>{var c,l,p,f,u,d;let o=(p=(l=(c=i==null?void 0:i.width)!=null?c:t.clientWidth)!=null?l:window.innerWidth)!=null?p:320,r=(d=(u=(f=i==null?void 0:i.height)!=null?f:t.clientHeight)!=null?u:window.innerHeight)!=null?d:480;n.renderer.resize(o,r)};t.innerHTML="",t.style.position="relative",t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="stretch",t.style.width="100%",t.style.height="100dvh",t.style.minHeight="100vh",t.style.maxWidth="100%",t.style.maxHeight="100%",t.style.boxSizing="border-box",t.style.overflow="hidden",e.background&&(t.style.background=e.background),t.appendChild(n.canvas);let s=document.createElement("div");return s.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),t.appendChild(s),qe.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),qe.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),qe.on("resize",({payload:i})=>{a({width:i==null?void 0:i.width,height:i==null?void 0:i.height})}),window.addEventListener("resize",()=>a()),requestAnimationFrame(()=>a()),{app:n,stage:n.stage,overlay:s,applySize:a}}var Le=class{constructor(e){var n,a;this.position=(e==null?void 0:e.position)||{x:0,y:0},this.scale=(n=e==null?void 0:e.scale)!=null?n:1,this.rotation=(a=e==null?void 0:e.rotation)!=null?a:0}update(e){e.position!==void 0&&(this.position={...e.position}),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation)}syncToPixi(e){e.position.set(this.position.x,this.position.y),e.scale.set(this.scale),e.rotation=this.rotation}},Me=class{constructor(e){var n,a,s,i;this.z_index=(n=e==null?void 0:e.z_index)!=null?n:0,this.alpha=(a=e==null?void 0:e.alpha)!=null?a:1,this.visible=(s=e==null?void 0:e.visible)!=null?s:!0,this.tint=(i=e==null?void 0:e.tint)!=null?i:null}update(e){e.z_index!==void 0&&(this.z_index=e.z_index),e.alpha!==void 0&&(this.alpha=e.alpha),e.visible!==void 0&&(this.visible=e.visible),e.tint!==void 0&&(this.tint=e.tint)}syncToPixi(e){e.zIndex=this.z_index,e.alpha=this.alpha,e.visible=this.visible,this.tint!==null&&"tint"in e&&(e.tint=this.tint)}},De=class{constructor(e,n,a,s){this.instanceId=e,this.objectConfig=n,this.pixiObject=a,this._config=s,this.transform=new Le(s.transform),this.renderer=new Me(s.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}getComponent(e){return this._config[e]}getPosition(){return{...this.transform.position}}setPosition(e,n){this.transform.position={x:e,y:n},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(e){this.renderer.alpha=e,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(e){this.renderer.visible=e,this.renderer.syncToPixi(this.pixiObject)}},Xe=class{constructor(e){this.objects=new Map;this.config=e}create(e,n){let a=this.config.objects.get(e);if(!a)throw new Error(`Object config not found: ${e}`);let s=new De(e,a.object_config||e,n,a);return this.objects.set(e,s),s}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[n,a]of this.objects.entries()){let s=e.objects.get(n);s&&a.updateConfig(s)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var Ue={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function V(t){let e=Ue[t];return e?e.family:(console.warn(`Font ID "${t}" not found in registry, using fallback`),"Arial, sans-serif")}function q(t){var n;let e=Ue[t];return e&&(n=e.weight)!=null?n:"400"}function ca(t,e){Ue[t]=e}function da(){return Object.keys(Ue)}var x=require("pixi.js");function ua(t,e,n){var At,vt,Et,Lt,Mt,Dt,Ot,Ct,Pt,kt,Ft,It,Rt,Nt,Bt,$t,zt,Ht,Wt,Yt,Gt,Jt,Vt,qt,Xt,Ut,Kt,jt,Qt,Zt,en,tn,nn,an,sn,on,rn,ln,cn,dn,un,pn,fn,hn,mn,yn,gn,_n,wn,bn,xn,Sn,Tn,An,vn,En,Ln,Mn,Dn,On;let a=t.objects.get("ui_endgame_1"),s=t.objects.get("ui_endgame_logo_1"),i=t.objects.get("ui_endgame_title_1"),o=t.objects.get("ui_endgame_subtitle_1"),r=t.objects.get("ui_endgame_footer_1"),c=t.objects.get("ui_endgame_cta_1"),l=t.objects.get("ui_endgame_cta_hint_1"),p=t.objects.get("ui_endgame_hand_1"),f=t.engine.runtime||{},u=new x.Container;u.alpha=0,u.visible=!1;let d=((At=a==null?void 0:a.gameplay)==null?void 0:At.tuning)||{},m=(a==null?void 0:a.render)||{},h=(vt=d.panel_width)!=null?vt:320,g=(Et=d.panel_height)!=null?Et:400,b=(Lt=d.panel_padding)!=null?Lt:32,w=(Mt=d.panel_radius)!=null?Mt:24,S=m.background_color||d.panel_bg_color||"#1a0a0a",T=m.background_alpha!==void 0&&m.background_alpha!==null?m.background_alpha:(Dt=d.panel_bg_alpha)!=null?Dt:.98,E=m.border_color||d.panel_border_color||"#ffffff",L=(Ot=d.panel_border_width)!=null?Ot:2,A=(Ct=d.panel_border_alpha)!=null?Ct:.3,v=new x.Graphics;v.roundRect(-h/2,-g/2,h,g,w);let M=S.replace("#","");v.fill({color:parseInt(M,16),alpha:T});let k=E.replace("#","");v.stroke({color:parseInt(k,16),width:L,alpha:A});let D=new x.Graphics;D.roundRect(-h/2+2,-g/2+2,h-4,g-4,w-2),D.stroke({color:16777215,width:1,alpha:.1}),v.addChild(D),u.addChild(v);let F=((Pt=s==null?void 0:s.gameplay)==null?void 0:Pt.tuning)||{},W=(s==null?void 0:s.transform)||{},O=(kt=F.logo_size)!=null?kt:56,I=(Ft=W.scale)!=null?Ft:1,Y=(Rt=(It=W.offset)==null?void 0:It.y)!=null?Rt:-130,Pe=(Nt=F.logo_alpha)!=null?Nt:1,C=new x.Sprite(n||x.Texture.EMPTY);C.anchor.set(.5);let oe=0,re=0;if(n&&n!==x.Texture.EMPTY){let P=n.frame,j=n.baseTexture;P&&P.width&&P.height?(oe=P.width,re=P.height):j&&j.width&&j.height?(oe=j.width,re=j.height):n.width&&n.height&&(oe=n.width,re=n.height)}if(oe>0&&re>0){let P=oe/re,j,tt;P>1?(j=O,tt=O/P):(tt=O,j=O*P);let Cn=j/oe,Pn=tt/re;Cn*=I,Pn*=I,C.scale.set(Cn,Pn)}else{let P=O/100*I;C.scale.set(P)}C.position.set(0,Y),C.alpha=0,C.visible=!0,C.targetAlpha=Pe,C.baseScaleX=C.scale.x,C.baseScaleY=C.scale.y,u.addChild(C);let R=i==null?void 0:i.ui,G=((Bt=i==null?void 0:i.gameplay)==null?void 0:Bt.tuning)||{},ba=(R==null?void 0:R.text)||"MISSION ACCOMPLISHED",ft=(R==null?void 0:R.font)||"brand.heading",xa=(R==null?void 0:R.fontSize)||24,Sa=($t=R==null?void 0:R.letterSpacing)!=null?$t:1,ke=(zt=i==null?void 0:i.render)==null?void 0:zt.tint,Ta=typeof ke=="string"?ke:ke?`#${ke.toString(16).padStart(6,"0")}`:"#00FF88",ht=h-b*2-30,Aa=G.font_weight_override?G.font_weight_override:q(ft),te=new x.Text({text:ba,style:{fontFamily:V(ft),fontSize:xa,fontWeight:Aa,fill:Ta,align:"center",letterSpacing:Sa,wordWrap:!1,stroke:{color:G.stroke_color||"#000000",width:(Ht=G.stroke_width)!=null?Ht:2},dropShadow:{color:G.shadow_color||"#000000",alpha:(Wt=G.shadow_alpha)!=null?Wt:.9,angle:(Yt=G.shadow_angle)!=null?Yt:0,blur:(Gt=G.shadow_blur)!=null?Gt:8,distance:(Jt=G.shadow_distance)!=null?Jt:4}}});if(te.width>ht){let P=ht/te.width;te.scale.set(P)}te.anchor.set(.5);let mt=(Vt=d.title_offset_y)!=null?Vt:30,va=mt+((qt=G.animation_start_y_offset)!=null?qt:-20);te.position.set(0,va),te.alpha=0,u.addChild(te);let N=o==null?void 0:o.ui,yt=((Xt=o==null?void 0:o.gameplay)==null?void 0:Xt.tuning)||{},Ea=(N==null?void 0:N.text)||"RESCUE COMPLETE",gt=(N==null?void 0:N.font)||"brand.body",La=(N==null?void 0:N.fontSize)||11,Ma=(Ut=N==null?void 0:N.letterSpacing)!=null?Ut:.5,Fe=(Kt=o==null?void 0:o.render)==null?void 0:Kt.tint,Da=typeof Fe=="string"?Fe:Fe?`#${Fe.toString(16).padStart(6,"0")}`:"#B0B0B0",le=new x.Text({text:Ea,style:{fontFamily:V(gt),fontSize:La,fontWeight:q(gt),fill:Da,align:"center",letterSpacing:Ma}});le.anchor.set(.5);let Oa=mt+20+((jt=yt.animation_start_y_offset)!=null?jt:-10);le.position.set(0,Oa),le.alpha=0,le.animationStartYOffset=(Qt=yt.animation_start_y_offset)!=null?Qt:-10,u.addChild(le);let U=r==null?void 0:r.ui,_t=((Zt=r==null?void 0:r.gameplay)==null?void 0:Zt.tuning)||{},Ca=(U==null?void 0:U.text)||((en=f.ui)==null?void 0:en.cta_hint)||"Continue the adventure!",wt=(U==null?void 0:U.font)||"brand.body",Pa=(U==null?void 0:U.fontSize)||16,Ie=(tn=r==null?void 0:r.render)==null?void 0:tn.tint,ka=typeof Ie=="string"?Ie:Ie?`#${Ie.toString(16).padStart(6,"0")}`:"#FFFFFF",Fa=(nn=_t.max_width)!=null?nn:h-b*2,Ia=(an=_t.line_height)!=null?an:1.4,ce=new x.Text({text:Ca,style:{fontFamily:V(wt),fontSize:Pa,fontWeight:q(wt),fill:ka,align:"center",wordWrap:!0,wordWrapWidth:Fa,lineHeight:Ia}});ce.anchor.set(.5);let Ra=(sn=d.footer_offset_y)!=null?sn:120;ce.position.set(0,Ra);let Na=((on=r==null?void 0:r.render)==null?void 0:on.alpha)!==void 0&&((rn=r==null?void 0:r.render)==null?void 0:rn.alpha)!==null?r.render.alpha:1;ce.alpha=0,ce.targetAlpha=Na,u.addChild(ce);let K=((ln=c==null?void 0:c.gameplay)==null?void 0:ln.tuning)||{},B=c==null?void 0:c.ui,Re=(cn=K.button_width)!=null?cn:260,Ne=(dn=K.button_height)!=null?dn:56,bt=(un=K.button_radius)!=null?un:16,Ba=K.button_bg_color||((pn=f.theme)==null?void 0:pn.cta_background)||"#ffb43b",$a=(fn=K.button_bg_alpha)!=null?fn:1,za=K.button_border_color||"#ffffff",Ha=(hn=K.button_border_width)!=null?hn:2,Wa=(mn=K.button_border_alpha)!=null?mn:.2,Be=(yn=d.cta_offset_y)!=null?yn:160,J=new x.Graphics;J.roundRect(-Re/2,-Ne/2,Re,Ne,bt);let Ya=Ba.replace("#","");J.fill({color:parseInt(Ya,16),alpha:$a});let Ga=za.replace("#","");J.stroke({color:parseInt(Ga,16),width:Ha,alpha:Wa});let Ze=new x.Graphics;Ze.roundRect(-Re/2+2,-Ne/2+2,Re-4,Ne-4,bt-2),Ze.stroke({color:0,width:1,alpha:.15}),J.addChild(Ze),J.position.set(0,Be),J.alpha=0,J.eventMode="static",J.cursor="pointer",u.addChild(J);let Ja=(B==null?void 0:B.text)||((gn=f.ui)==null?void 0:gn.cta_label_end)||"DOWNLOAD",xt=(B==null?void 0:B.font)||"brand.heading",Va=(B==null?void 0:B.fontSize)||20,qa=K.button_text_color||((_n=f.theme)==null?void 0:_n.cta_text)||"#1a0a0a",be=new x.Text({text:Ja,style:{fontFamily:V(xt),fontSize:Va,fontWeight:q(xt),fill:qa,align:"center",letterSpacing:(wn=B==null?void 0:B.letterSpacing)!=null?wn:1}});be.anchor.set(.5),be.position.set(0,Be),be.alpha=0,u.addChild(be);let $=l==null?void 0:l.ui,St=((bn=l==null?void 0:l.gameplay)==null?void 0:bn.tuning)||{},Xa=($==null?void 0:$.text)||"Play the full game",Tt=($==null?void 0:$.font)||"brand.body",Ua=($==null?void 0:$.fontSize)||11,Ka=(xn=$==null?void 0:$.letterSpacing)!=null?xn:0,$e=(Sn=l==null?void 0:l.render)==null?void 0:Sn.tint,ja=typeof $e=="string"?$e:$e?`#${$e.toString(16).padStart(6,"0")}`:"#CCCCCC",de=new x.Text({text:Xa,style:{fontFamily:V(Tt),fontSize:Ua,fontWeight:q(Tt),fill:ja,align:"center",letterSpacing:Ka}});de.anchor.set(.5);let Qa=Be+35+((Tn=St.animation_start_y_offset)!=null?Tn:5);de.position.set(0,Qa),de.alpha=0,de.animationStartYOffset=(An=St.animation_start_y_offset)!=null?An:5,u.addChild(de);let et=((vn=p==null?void 0:p.gameplay)==null?void 0:vn.tuning)||{},Za=(En=et.hand_offset_x)!=null?En:50,ei=(Ln=et.hand_offset_y)!=null?Ln:50,ti=(Dn=(Mn=p==null?void 0:p.transform)==null?void 0:Mn.scale)!=null?Dn:.1875,ni=(On=et.hand_scale_multiplier)!=null?On:2.5,se=new x.Sprite(e||x.Texture.EMPTY);return se.anchor.set(.5),se.scale.set(ti*ni),se.position.set(Za,Be+ei),se.alpha=0,se.visible=!1,u.addChild(se),{panel:u,logo:C,title:te,subtitle:le,footer:ce,ctaButton:J,ctaText:be,ctaHint:de,hand:se}}function pa(t,e,n){var L,A,v,M,k,D,F,W;let a=e.objects.get("ui_endgame_1"),s=((L=a==null?void 0:a.gameplay)==null?void 0:L.tuning)||{},i=(A=s.animation_duration_ms)!=null?A:800,o=(v=s.fade_in_duration_ms)!=null?v:600,r=(M=s.scale_animation_intensity)!=null?M:.1,c=(k=s.logo_animation_delay_ms)!=null?k:100,l=(D=s.title_animation_delay_ms)!=null?D:200,p=(F=s.footer_animation_delay_ms)!=null?F:300,f=(W=s.cta_animation_delay_ms)!=null?W:400,{panel:u,logo:d,title:m,subtitle:h,footer:g,ctaButton:b,ctaText:w,ctaHint:S}=t;u.visible=!0;let T=Date.now(),E=()=>{let O=Date.now()-T,I=Math.min(O/o,1),Y=1-Math.pow(1-I,3);u.alpha=Y,u.scale.set(1+r*(1-Y)),I<1?requestAnimationFrame(E):(setTimeout(()=>Si(d,i,e),c),setTimeout(()=>{Ti(m,i),setTimeout(()=>Ai(h,i),50)},l),setTimeout(()=>vi(g,i),p),setTimeout(()=>{Ei(b,w,i),setTimeout(()=>Li(S,i),50),n&&n()},f))};E()}function Si(t,e,n){var u,d,m,h,g;let a=n==null?void 0:n.objects.get("ui_endgame_logo_1"),i=(d=(((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{}).animation_start_scale)!=null?d:1.2,o=Date.now(),r=t.alpha,c=(m=t.targetAlpha)!=null?m:1,l=(h=t.baseScaleX)!=null?h:t.scale.x,p=(g=t.baseScaleY)!=null?g:t.scale.y,f=()=>{let b=Date.now()-o,w=Math.min(b/e,1),S=1-Math.pow(1-w,2);t.alpha=r+(c-r)*S;let T=i+(1-i)*S;t.scale.set(l*T,p*T),w<1&&requestAnimationFrame(f)};f()}function Ti(t,e){let n=Date.now(),a=t.alpha,s=t.y,i=()=>{let o=Date.now()-n,r=Math.min(o/e,1),c=1-Math.pow(1-r,2);t.alpha=a+(1-a)*c,t.y=s-20*(1-c),r<1&&requestAnimationFrame(i)};i()}function Ai(t,e){var r;let n=Date.now(),a=t.alpha,s=t.position.y,i=s-((r=t.animationStartYOffset)!=null?r:-10),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),p=1-Math.pow(1-l,2);t.alpha=a+(1-a)*p,t.position.y=s+(i-s)*p,l<1&&requestAnimationFrame(o)};o()}function vi(t,e){var o;let n=Date.now(),a=t.alpha,s=(o=t.targetAlpha)!=null?o:1,i=()=>{let r=Date.now()-n,c=Math.min(r/e,1),l=1-Math.pow(1-c,2);t.alpha=a+(s-a)*l,c<1&&requestAnimationFrame(i)};i()}function Ei(t,e,n){let a=Date.now(),s=t.alpha,i=()=>{let o=Date.now()-a,r=Math.min(o/n,1),c=1-Math.pow(1-r,2);t.alpha=s+(1-s)*c,e.alpha=s+(1-s)*c,t.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(i)};i()}function Li(t,e){var r;let n=Date.now(),a=t.alpha,s=t.position.y,i=s-((r=t.animationStartYOffset)!=null?r:5),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),p=1-Math.pow(1-l,2);t.alpha=a+(1-a)*p,t.position.y=s+(i-s)*p,l<1&&requestAnimationFrame(o)};o()}function fa(t,e,n,a){var p,f,u,d;let s=n.objects.get("ui_endgame_hand_1"),i=((p=s==null?void 0:s.gameplay)==null?void 0:p.tuning)||{},o=(f=i.click_animation_duration_ms)!=null?f:600,r=(u=i.click_delay_ms)!=null?u:2e3,c=(d=i.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var L,A;t.visible=!0,t.alpha=1;let m=t.x,h=t.y,g=(L=i.hand_offset_x)!=null?L:50,b=(A=i.hand_offset_y)!=null?A:50,w=e.x+g,S=e.y+b,T=Date.now(),E=()=>{var O,I,Y;let v=Date.now()-T,M=Math.min(v/o,1),k=M<.5?2*M*M:1-Math.pow(-2*M+2,2)/2;t.x=m+(w-m)*k,t.y=h+(S-h)*k;let D=(I=(O=s==null?void 0:s.transform)==null?void 0:O.scale)!=null?I:.1875,F=(Y=i.hand_scale_multiplier)!=null?Y:2.5,W=D*F;t.scale.set(W+W*.2*Math.sin(M*Math.PI)),M<1?requestAnimationFrame(E):(e.scale.set(.95),setTimeout(()=>{e.scale.set(1),a()},100),setTimeout(()=>{t.alpha=0,setTimeout(()=>{t.x=m,t.y=h,l()},c)},500))};E()};setTimeout(l,r)}var Ke=require("pixi.js");function ha(t,e,n){var p,f,u,d;let a=e.objects.get("hand_tutorial_1"),s=((p=a==null?void 0:a.gameplay)==null?void 0:p.tuning)||{},i=(a==null?void 0:a.render)||{},o=(a==null?void 0:a.transform)||{},r=new Ke.Sprite(t);r.anchor.set(.5),r.alpha=0;let c=(f=s.hand_scale_multiplier)!=null?f:2.5,l=(u=o.scale)!=null?u:.1875;return r.scale.set(l*c),r.zIndex=(d=i.z_index)!=null?d:99999,r}function ma(t){var m,h,g,b,w,S,T,E,L,A;let e=t.objects.get("ui_tutorial_1"),n=e==null?void 0:e.ui,a=(e==null?void 0:e.render)||{},s=((m=t.engine.runtime)==null?void 0:m.ui_styles)||{},i=((h=t.engine.runtime)==null?void 0:h.ui)||{},o=(n==null?void 0:n.text)||i.tutorial_label||i.label_text||"CLEAN!",r=(n==null?void 0:n.font)||"brand.warning",c=(n==null?void 0:n.fontSize)||s.label_font_size||52,l=(b=n==null?void 0:n.letterSpacing)!=null?b:(g=s.label_letter_spacing)!=null?g:-1,p=(n==null?void 0:n.align)||"center",f=a.tint,u=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:s.label_fill||"#FFF1C1",d=new Ke.Text({text:o,style:{fontFamily:V(r),fontSize:c,fontWeight:q(r),fill:u,align:p,letterSpacing:l,stroke:{color:s.label_stroke||"#8B0000",width:2},dropShadow:{color:s.label_shadow_color||"#000000",alpha:(w=s.label_shadow_alpha)!=null?w:.8,angle:(S=s.label_shadow_angle)!=null?S:0,blur:(T=s.label_shadow_blur)!=null?T:4,distance:(E=s.label_shadow_distance)!=null?E:2}}});return d.anchor.set(.5,0),d.alpha=(L=a.alpha)!=null?L:0,d.visible=(A=a.visible)!=null?A:!0,d}function ya(t,e,n,a,s){var c,l,p,f,u,d,m;let i=s.objects.get("hand_tutorial_1"),o=((c=i==null?void 0:i.gameplay)==null?void 0:c.tuning)||{},r=(i==null?void 0:i.transform)||{};if(!a){let h=(l=o.animation_duration)!=null?l:1.5,g=n%h/h,b=g<.5?2*g*g:-1+(4-2*g)*g,w=(p=o.x_offset)!=null?p:0,S=(f=o.y_offset)!=null?f:0,T=(u=o.animation_range)!=null?u:40,E=T*.7,L=T,A=e.x+w+E,v=e.y+S+L,M=A+E,k=v+L;t.x=A+(M-A)*b,t.y=v+(k-v)*b;let D=(d=r.scale)!=null?d:.1875,F=(m=o.hand_scale_multiplier)!=null?m:2.5;t.scale.set(D*F)}}var Oe=null;function Mi(){return Oe||(typeof window!="undefined"&&window.lottie?Oe=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),Oe=null)),Oe}function ga(t){Oe=t}function _a(t,e,n,a){var E,L,A,v,M,k,D,F,W,O,I,Y,Pe;let s=n.objects.get(t);if(!s)return console.warn(`[LottieOverlay] Object config not found: ${t}`),null;let i=((E=s.effects)==null?void 0:E.lottie)||{},o=s.transform||{},r=s.render||{};if(i.enabled===!1||r.visible===!1)return null;let c=a[t];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${t}`),null;let l=Mi();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${t}`),null;let p=(L=i.width)!=null?L:300,f=(A=i.height)!=null?A:300,u=(v=o.scale)!=null?v:1,d=(k=(M=o.position)==null?void 0:M.x)!=null?k:0,m=(F=(D=o.position)==null?void 0:D.y)!=null?F:0,h=(W=o.rotation)!=null?W:0,g=(O=r.z_index)!=null?O:100,b=(I=r.alpha)!=null?I:1,w=document.createElement("div");w.style.cssText=`
|
|
17
|
+
`,t.appendChild(e)}async function hs(t,e={}){let n=new fs.Application;await n.init({resizeTo:t,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let s=i=>{var c,l,u,h,p,d;if(!n.renderer)return;let o=(u=(l=(c=i==null?void 0:i.width)!=null?c:t.clientWidth)!=null?l:window.innerWidth)!=null?u:320,r=(d=(p=(h=i==null?void 0:i.height)!=null?h:t.clientHeight)!=null?p:window.innerHeight)!=null?d:480;n.renderer.resize(o,r)};t.innerHTML="",t.style.position="relative",t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="stretch",t.style.width="100%",t.style.height="100dvh",t.style.minHeight="100vh",t.style.maxWidth="100%",t.style.maxHeight="100%",t.style.boxSizing="border-box",t.style.overflow="hidden",e.background&&(t.style.background=e.background),t.appendChild(n.canvas);let a=document.createElement("div");return a.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),t.appendChild(a),Ze.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),Ze.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),Ze.on("resize",({payload:i})=>{s({width:i==null?void 0:i.width,height:i==null?void 0:i.height})}),window.addEventListener("resize",()=>s()),requestAnimationFrame(()=>s()),{app:n,stage:n.stage,overlay:a,applySize:s}}var Pe=class{constructor(e){var n,s;this.position=(e==null?void 0:e.position)||{x:0,y:0},this.scale=(n=e==null?void 0:e.scale)!=null?n:1,this.rotation=(s=e==null?void 0:e.rotation)!=null?s:0}update(e){e.position!==void 0&&(this.position={...e.position}),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation)}syncToPixi(e){e.position.set(this.position.x,this.position.y),e.scale.set(this.scale),e.rotation=this.rotation}},De=class{constructor(e){var n,s,a,i;this.z_index=(n=e==null?void 0:e.z_index)!=null?n:0,this.alpha=(s=e==null?void 0:e.alpha)!=null?s:1,this.visible=(a=e==null?void 0:e.visible)!=null?a:!0,this.tint=(i=e==null?void 0:e.tint)!=null?i:null}update(e){e.z_index!==void 0&&(this.z_index=e.z_index),e.alpha!==void 0&&(this.alpha=e.alpha),e.visible!==void 0&&(this.visible=e.visible),e.tint!==void 0&&(this.tint=e.tint)}syncToPixi(e){e.zIndex=this.z_index,e.alpha=this.alpha,e.visible=this.visible,this.tint!==null&&"tint"in e&&(e.tint=this.tint)}},Ne=class{constructor(e,n,s,a){this.instanceId=e,this.objectConfig=n,this.pixiObject=s,this._config=a,this.transform=new Pe(a.transform),this.renderer=new De(a.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject),this.applyAnchor(),this.applyEffectsScale()}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}applyAnchor(){var a,i,o,r;if(!this.pixiObject||!("anchor"in this.pixiObject)||!this.pixiObject.anchor)return;let e=(i=(a=this._config)==null?void 0:a.render)==null?void 0:i.anchor,n=(r=(o=this._config)==null?void 0:o.transform)==null?void 0:r.anchor,s=e&&typeof e=="object"?e:n&&typeof n=="object"?n:null;s&&typeof s.x=="number"&&typeof s.y=="number"&&this.pixiObject.anchor.set(s.x,s.y)}applyEffectsScale(){var i,o,r;if(!((i=this.pixiObject)!=null&&i.scale))return;let e=(o=this._config)==null?void 0:o.effects,n=typeof(e==null?void 0:e.scale_x)=="number"?e.scale_x:1,s=typeof(e==null?void 0:e.scale_y)=="number"?e.scale_y:1;if(n===1&&s===1)return;let a=(r=this.transform.scale)!=null?r:1;typeof this.pixiObject.scale.set=="function"?this.pixiObject.scale.set(a*n,a*s):(this.pixiObject.scale.x=a*n,this.pixiObject.scale.y=a*s)}getComponent(e){return this._config[e]}getPosition(){return{...this.transform.position}}setPosition(e,n){this.transform.position={x:e,y:n},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(e){this.renderer.alpha=e,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(e){this.renderer.visible=e,this.renderer.syncToPixi(this.pixiObject)}},Ue=class{constructor(e){this.objects=new Map;this.config=e}create(e,n){let s=this.config.objects.get(e);if(!s)throw new Error(`Object config not found: ${e}`);let a=new Ne(e,s.object_config||e,n,s);return this.objects.set(e,a),a}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[n,s]of this.objects.entries()){let a=e.objects.get(n);a&&s.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var et={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function X(t){let e=et[t];return e?e.family:(console.warn(`Font ID "${t}" not found in registry, using fallback`),"Arial, sans-serif")}function K(t){var n;let e=et[t];return e&&(n=e.weight)!=null?n:"400"}function ms(t,e){et[t]=e}function ys(){return Object.keys(et)}var A=require("pixi.js");function gs(t,e,n){var Ct,kt,Pt,Dt,Nt,It,Ft,$t,Rt,Bt,zt,Ht,Wt,Yt,qt,Gt,Jt,jt,Vt,Xt,Kt,Qt,Zt,Ut,en,tn,nn,sn,an,on,rn,ln,cn,dn,un,pn,fn,hn,mn,yn,gn,_n,bn,wn,xn,Sn,An,Tn,vn,En,Ln,Mn,On,Cn,kn,Pn,Dn,Nn,In,Fn;let s=t.objects.get("ui_endgame_1"),a=t.objects.get("ui_endgame_logo_1"),i=t.objects.get("ui_endgame_title_1"),o=t.objects.get("ui_endgame_subtitle_1"),r=t.objects.get("ui_endgame_footer_1"),c=t.objects.get("ui_endgame_cta_1"),l=t.objects.get("ui_endgame_cta_hint_1"),u=t.objects.get("ui_endgame_hand_1"),h=t.engine.runtime||{},p=new A.Container;p.alpha=0,p.visible=!1;let d=((Ct=s==null?void 0:s.gameplay)==null?void 0:Ct.tuning)||{},m=(s==null?void 0:s.render)||{},f=(kt=d.panel_width)!=null?kt:320,g=(Pt=d.panel_height)!=null?Pt:400,L=(Dt=d.panel_padding)!=null?Dt:32,w=(Nt=d.panel_radius)!=null?Nt:24,T=m.background_color||d.panel_bg_color||"#1a0a0a",E=m.background_alpha!==void 0&&m.background_alpha!==null?m.background_alpha:(It=d.panel_bg_alpha)!=null?It:.98,M=m.border_color||d.panel_border_color||"#ffffff",O=(Ft=d.panel_border_width)!=null?Ft:2,C=($t=d.panel_border_alpha)!=null?$t:.3,v=new A.Graphics;v.roundRect(-f/2,-g/2,f,g,w);let _=T.replace("#","");v.fill({color:parseInt(_,16),alpha:E});let x=M.replace("#","");v.stroke({color:parseInt(x,16),width:O,alpha:C});let D=new A.Graphics;D.roundRect(-f/2+2,-g/2+2,f-4,g-4,w-2),D.stroke({color:16777215,width:1,alpha:.1}),v.addChild(D),p.addChild(v);let B=((Rt=a==null?void 0:a.gameplay)==null?void 0:Rt.tuning)||{},F=(a==null?void 0:a.transform)||{},P=(Bt=B.logo_size)!=null?Bt:56,N=(zt=F.scale)!=null?zt:1,$=(Wt=(Ht=F.offset)==null?void 0:Ht.y)!=null?Wt:-130,ue=(Yt=B.logo_alpha)!=null?Yt:1,k=new A.Sprite(n||A.Texture.EMPTY);k.anchor.set(.5);let J=0,j=0;if(n&&n!==A.Texture.EMPTY){let R=n.frame,te=n.baseTexture;R&&R.width&&R.height?(J=R.width,j=R.height):te&&te.width&&te.height?(J=te.width,j=te.height):n.width&&n.height&&(J=n.width,j=n.height)}if(J>0&&j>0){let R=J/j,te,rt;R>1?(te=P,rt=P/R):(rt=P,te=P*R);let $n=te/J,Rn=rt/j;$n*=N,Rn*=N,k.scale.set($n,Rn)}else{let R=P/100*N;k.scale.set(R)}k.position.set(0,$),k.alpha=0,k.visible=!0,k.targetAlpha=ue,k.baseScaleX=k.scale.x,k.baseScaleY=k.scale.y,p.addChild(k);let I=i==null?void 0:i.ui,z=((qt=i==null?void 0:i.gameplay)==null?void 0:qt.tuning)||{},it=(I==null?void 0:I.text)||"MISSION ACCOMPLISHED",$e=(I==null?void 0:I.font)||"brand.heading",Ms=(I==null?void 0:I.fontSize)||24,Os=(Gt=I==null?void 0:I.letterSpacing)!=null?Gt:1,Re=(Jt=i==null?void 0:i.render)==null?void 0:Jt.tint,Cs=typeof Re=="string"?Re:Re?`#${Re.toString(16).padStart(6,"0")}`:"#00FF88",wt=f-L*2-30,ks=z.font_weight_override?z.font_weight_override:K($e),oe=new A.Text({text:it,style:{fontFamily:X($e),fontSize:Ms,fontWeight:ks,fill:Cs,align:"center",letterSpacing:Os,wordWrap:!1,stroke:{color:z.stroke_color||"#000000",width:(jt=z.stroke_width)!=null?jt:2},dropShadow:{color:z.shadow_color||"#000000",alpha:(Vt=z.shadow_alpha)!=null?Vt:.9,angle:(Xt=z.shadow_angle)!=null?Xt:0,blur:(Kt=z.shadow_blur)!=null?Kt:8,distance:(Qt=z.shadow_distance)!=null?Qt:4}}});if(oe.width>wt){let R=wt/oe.width;oe.scale.set(R)}oe.anchor.set(.5);let xt=(Zt=d.title_offset_y)!=null?Zt:30,Ps=xt+((Ut=z.animation_start_y_offset)!=null?Ut:-20);oe.position.set(0,Ps),oe.alpha=0,p.addChild(oe);let H=o==null?void 0:o.ui,St=((en=o==null?void 0:o.gameplay)==null?void 0:en.tuning)||{},Ds=(H==null?void 0:H.text)||"RESCUE COMPLETE",At=(H==null?void 0:H.font)||"brand.body",Ns=(H==null?void 0:H.fontSize)||11,Is=(tn=H==null?void 0:H.letterSpacing)!=null?tn:.5,Be=(nn=o==null?void 0:o.render)==null?void 0:nn.tint,Fs=typeof Be=="string"?Be:Be?`#${Be.toString(16).padStart(6,"0")}`:"#B0B0B0",he=new A.Text({text:Ds,style:{fontFamily:X(At),fontSize:Ns,fontWeight:K(At),fill:Fs,align:"center",letterSpacing:Is}});he.anchor.set(.5);let $s=xt+20+((sn=St.animation_start_y_offset)!=null?sn:-10);he.position.set(0,$s),he.alpha=0,he.animationStartYOffset=(an=St.animation_start_y_offset)!=null?an:-10,p.addChild(he);let U=r==null?void 0:r.ui,Tt=((on=r==null?void 0:r.gameplay)==null?void 0:on.tuning)||{},Rs=(U==null?void 0:U.text)||((rn=h.ui)==null?void 0:rn.cta_hint)||"Continue the adventure!",vt=(U==null?void 0:U.font)||"brand.body",Bs=(U==null?void 0:U.fontSize)||16,ze=(ln=r==null?void 0:r.render)==null?void 0:ln.tint,zs=typeof ze=="string"?ze:ze?`#${ze.toString(16).padStart(6,"0")}`:"#FFFFFF",Hs=(cn=Tt.max_width)!=null?cn:f-L*2,Ws=(dn=Tt.line_height)!=null?dn:1.4,me=new A.Text({text:Rs,style:{fontFamily:X(vt),fontSize:Bs,fontWeight:K(vt),fill:zs,align:"center",wordWrap:!0,wordWrapWidth:Hs,lineHeight:Ws}});me.anchor.set(.5);let Ys=(un=d.footer_offset_y)!=null?un:120;me.position.set(0,Ys);let qs=((pn=r==null?void 0:r.render)==null?void 0:pn.alpha)!==void 0&&((fn=r==null?void 0:r.render)==null?void 0:fn.alpha)!==null?r.render.alpha:1;me.alpha=0,me.targetAlpha=qs,p.addChild(me);let ee=((hn=c==null?void 0:c.gameplay)==null?void 0:hn.tuning)||{},W=c==null?void 0:c.ui,He=(mn=ee.button_width)!=null?mn:260,We=(yn=ee.button_height)!=null?yn:56,Et=(gn=ee.button_radius)!=null?gn:16,Gs=ee.button_bg_color||((_n=h.theme)==null?void 0:_n.cta_background)||"#ffb43b",Js=(bn=ee.button_bg_alpha)!=null?bn:1,js=ee.button_border_color||"#ffffff",Vs=(wn=ee.button_border_width)!=null?wn:2,Xs=(xn=ee.button_border_alpha)!=null?xn:.2,Ye=(Sn=d.cta_offset_y)!=null?Sn:160,V=new A.Graphics;V.roundRect(-He/2,-We/2,He,We,Et);let Ks=Gs.replace("#","");V.fill({color:parseInt(Ks,16),alpha:Js});let Qs=js.replace("#","");V.stroke({color:parseInt(Qs,16),width:Vs,alpha:Xs});let at=new A.Graphics;at.roundRect(-He/2+2,-We/2+2,He-4,We-4,Et-2),at.stroke({color:0,width:1,alpha:.15}),V.addChild(at),V.position.set(0,Ye),V.alpha=0,V.eventMode="static",V.cursor="pointer",p.addChild(V);let Zs=(W==null?void 0:W.text)||((An=h.ui)==null?void 0:An.cta_label_end)||"DOWNLOAD",Lt=(W==null?void 0:W.font)||"brand.heading",Us=(W==null?void 0:W.fontSize)||20,ei=ee.button_text_color||((Tn=h.theme)==null?void 0:Tn.cta_text)||"#1a0a0a",ve=new A.Text({text:Zs,style:{fontFamily:X(Lt),fontSize:Us,fontWeight:K(Lt),fill:ei,align:"center",letterSpacing:(vn=W==null?void 0:W.letterSpacing)!=null?vn:1}});ve.anchor.set(.5),ve.position.set(0,Ye),ve.alpha=0,p.addChild(ve);let Y=l==null?void 0:l.ui,Mt=((En=l==null?void 0:l.gameplay)==null?void 0:En.tuning)||{},ti=(Y==null?void 0:Y.text)||"Play the full game",Ot=(Y==null?void 0:Y.font)||"brand.body",ni=(Y==null?void 0:Y.fontSize)||11,si=(Ln=Y==null?void 0:Y.letterSpacing)!=null?Ln:0,qe=(Mn=l==null?void 0:l.render)==null?void 0:Mn.tint,ii=typeof qe=="string"?qe:qe?`#${qe.toString(16).padStart(6,"0")}`:"#CCCCCC",ye=new A.Text({text:ti,style:{fontFamily:X(Ot),fontSize:ni,fontWeight:K(Ot),fill:ii,align:"center",letterSpacing:si}});ye.anchor.set(.5);let ai=Ye+35+((On=Mt.animation_start_y_offset)!=null?On:5);ye.position.set(0,ai),ye.alpha=0,ye.animationStartYOffset=(Cn=Mt.animation_start_y_offset)!=null?Cn:5,p.addChild(ye);let ot=((kn=u==null?void 0:u.gameplay)==null?void 0:kn.tuning)||{},oi=(Pn=ot.hand_offset_x)!=null?Pn:50,ri=(Dn=ot.hand_offset_y)!=null?Dn:50,li=(In=(Nn=u==null?void 0:u.transform)==null?void 0:Nn.scale)!=null?In:.1875,ci=(Fn=ot.hand_scale_multiplier)!=null?Fn:2.5,pe=new A.Sprite(e||A.Texture.EMPTY);return pe.anchor.set(.5),pe.scale.set(li*ci),pe.position.set(oi,Ye+ri),pe.alpha=0,pe.visible=!1,p.addChild(pe),{panel:p,logo:k,title:oe,subtitle:he,footer:me,ctaButton:V,ctaText:ve,ctaHint:ye,hand:pe}}function _s(t,e,n){var O,C,v,_,x,D,B,F;let s=e.objects.get("ui_endgame_1"),a=((O=s==null?void 0:s.gameplay)==null?void 0:O.tuning)||{},i=(C=a.animation_duration_ms)!=null?C:800,o=(v=a.fade_in_duration_ms)!=null?v:600,r=(_=a.scale_animation_intensity)!=null?_:.1,c=(x=a.logo_animation_delay_ms)!=null?x:100,l=(D=a.title_animation_delay_ms)!=null?D:200,u=(B=a.footer_animation_delay_ms)!=null?B:300,h=(F=a.cta_animation_delay_ms)!=null?F:400,{panel:p,logo:d,title:m,subtitle:f,footer:g,ctaButton:L,ctaText:w,ctaHint:T}=t;p.visible=!0;let E=Date.now(),M=()=>{let P=Date.now()-E,N=Math.min(P/o,1),$=1-Math.pow(1-N,3);p.alpha=$,p.scale.set(1+r*(1-$)),N<1?requestAnimationFrame(M):(setTimeout(()=>Oi(d,i,e),c),setTimeout(()=>{Ci(m,i),setTimeout(()=>ki(f,i),50)},l),setTimeout(()=>Pi(g,i),u),setTimeout(()=>{Di(L,w,i),setTimeout(()=>Ni(T,i),50),n&&n()},h))};M()}function Oi(t,e,n){var p,d,m,f,g;let s=n==null?void 0:n.objects.get("ui_endgame_logo_1"),i=(d=(((p=s==null?void 0:s.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?d:1.2,o=Date.now(),r=t.alpha,c=(m=t.targetAlpha)!=null?m:1,l=(f=t.baseScaleX)!=null?f:t.scale.x,u=(g=t.baseScaleY)!=null?g:t.scale.y,h=()=>{let L=Date.now()-o,w=Math.min(L/e,1),T=1-Math.pow(1-w,2);t.alpha=r+(c-r)*T;let E=i+(1-i)*T;t.scale.set(l*E,u*E),w<1&&requestAnimationFrame(h)};h()}function Ci(t,e){let n=Date.now(),s=t.alpha,a=t.y,i=()=>{let o=Date.now()-n,r=Math.min(o/e,1),c=1-Math.pow(1-r,2);t.alpha=s+(1-s)*c,t.y=a-20*(1-c),r<1&&requestAnimationFrame(i)};i()}function ki(t,e){var r;let n=Date.now(),s=t.alpha,a=t.position.y,i=a-((r=t.animationStartYOffset)!=null?r:-10),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);t.alpha=s+(1-s)*u,t.position.y=a+(i-a)*u,l<1&&requestAnimationFrame(o)};o()}function Pi(t,e){var o;let n=Date.now(),s=t.alpha,a=(o=t.targetAlpha)!=null?o:1,i=()=>{let r=Date.now()-n,c=Math.min(r/e,1),l=1-Math.pow(1-c,2);t.alpha=s+(a-s)*l,c<1&&requestAnimationFrame(i)};i()}function Di(t,e,n){let s=Date.now(),a=t.alpha,i=()=>{let o=Date.now()-s,r=Math.min(o/n,1),c=1-Math.pow(1-r,2);t.alpha=a+(1-a)*c,e.alpha=a+(1-a)*c,t.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(i)};i()}function Ni(t,e){var r;let n=Date.now(),s=t.alpha,a=t.position.y,i=a-((r=t.animationStartYOffset)!=null?r:5),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);t.alpha=s+(1-s)*u,t.position.y=a+(i-a)*u,l<1&&requestAnimationFrame(o)};o()}function bs(t,e,n,s){var u,h,p,d;let a=n.objects.get("ui_endgame_hand_1"),i=((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{},o=(h=i.click_animation_duration_ms)!=null?h:600,r=(p=i.click_delay_ms)!=null?p:2e3,c=(d=i.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var O,C;t.visible=!0,t.alpha=1;let m=t.x,f=t.y,g=(O=i.hand_offset_x)!=null?O:50,L=(C=i.hand_offset_y)!=null?C:50,w=e.x+g,T=e.y+L,E=Date.now(),M=()=>{var P,N,$;let v=Date.now()-E,_=Math.min(v/o,1),x=_<.5?2*_*_:1-Math.pow(-2*_+2,2)/2;t.x=m+(w-m)*x,t.y=f+(T-f)*x;let D=(N=(P=a==null?void 0:a.transform)==null?void 0:P.scale)!=null?N:.1875,B=($=i.hand_scale_multiplier)!=null?$:2.5,F=D*B;t.scale.set(F+F*.2*Math.sin(_*Math.PI)),_<1?requestAnimationFrame(M):(e.scale.set(.95),setTimeout(()=>{e.scale.set(1),s()},100),setTimeout(()=>{t.alpha=0,setTimeout(()=>{t.x=m,t.y=f,l()},c)},500))};M()};setTimeout(l,r)}var tt=require("pixi.js");function ws(t,e,n){var h,p,d,m;let s=e.objects.get("hand_tutorial_1")||e.objects.get("hand_1")||Array.from(e.objects.values()).find(f=>{var g;return((g=f==null?void 0:f.identity)==null?void 0:g.id)==="hand.tutorial"}),a=((h=s==null?void 0:s.gameplay)==null?void 0:h.tuning)||{},i=(s==null?void 0:s.render)||{},o=(s==null?void 0:s.transform)||{},r=new tt.Sprite(t),c=i==null?void 0:i.anchor;c&&typeof c.x=="number"&&typeof c.y=="number"?r.anchor.set(c.x,c.y):r.anchor.set(.5),r.alpha=0;let l=(p=a.hand_scale_multiplier)!=null?p:2.5,u=(d=o.scale)!=null?d:.1875;return r.scale.set(u*l),r.zIndex=(m=i.z_index)!=null?m:99999,r}function xs(t){var f,g,L,w,T,E,M,O,C,v;let e=t.objects.get("ui_tutorial_1")||t.objects.get("label_1")||Array.from(t.objects.values()).find(_=>{var x;return["ui.tutorial","label.warning"].includes((x=_==null?void 0:_.identity)==null?void 0:x.id)}),n=e==null?void 0:e.ui,s=(e==null?void 0:e.render)||{},a=((f=t.engine.runtime)==null?void 0:f.ui_styles)||{},i=((g=t.engine.runtime)==null?void 0:g.ui)||{},o=(n==null?void 0:n.text)||i.tutorial_label||i.label_text||"CLEAN!",r=(n==null?void 0:n.font)||"brand.warning",c=(n==null?void 0:n.fontSize)||a.label_font_size||52,l=(w=n==null?void 0:n.letterSpacing)!=null?w:(L=a.label_letter_spacing)!=null?L:-1,u=(n==null?void 0:n.align)||"center",h=s.tint,p=typeof h=="string"?h:h?`#${h.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",d=new tt.Text({text:o,style:{fontFamily:X(r),fontSize:c,fontWeight:K(r),fill:p,align:u,letterSpacing:l,stroke:{color:a.label_stroke||"#8B0000",width:2},dropShadow:{color:a.label_shadow_color||"#000000",alpha:(T=a.label_shadow_alpha)!=null?T:.8,angle:(E=a.label_shadow_angle)!=null?E:0,blur:(M=a.label_shadow_blur)!=null?M:4,distance:(O=a.label_shadow_distance)!=null?O:2}}}),m=s==null?void 0:s.anchor;return m&&typeof m.x=="number"&&typeof m.y=="number"?d.anchor.set(m.x,m.y):d.anchor.set(.5,.5),d.alpha=(C=s.alpha)!=null?C:0,d.visible=(v=s.visible)!=null?v:!0,d}function Ss(t,e,n,s,a){var c,l,u,h,p,d,m,f,g,L,w,T,E,M,O,C,v;let i=a.objects.get("hand_tutorial_1")||a.objects.get("hand_1")||Array.from(a.objects.values()).find(_=>{var x;return((x=_==null?void 0:_.identity)==null?void 0:x.id)==="hand.tutorial"}),o=((c=i==null?void 0:i.gameplay)==null?void 0:c.tuning)||{},r=(i==null?void 0:i.transform)||{};if(!s){let _=(l=o.animation_duration)!=null?l:1.5,x=n%_/_,D=x<.5?2*x*x:-1+(4-2*x)*x,B=(m=(d=(p=(u=r.position)==null?void 0:u.x)!=null?p:(h=r.offset)==null?void 0:h.x)!=null?d:o.start_x_offset)!=null?m:0,F=(T=(w=(L=(f=r.position)==null?void 0:f.y)!=null?L:(g=r.offset)==null?void 0:g.y)!=null?w:o.start_y_offset)!=null?T:0,P=(E=o.x_offset)!=null?E:0,N=(M=o.y_offset)!=null?M:0,$=(O=o.animation_range)!=null?O:40,ue=$*.7,k=$,J=e.x+B+P+ue,j=e.y+F+N+k,I=J+ue,z=j+k;t.x=J+(I-J)*D,t.y=j+(z-j)*D;let it=(C=r.scale)!=null?C:.1875,$e=(v=o.hand_scale_multiplier)!=null?v:2.5;t.scale.set(it*$e)}}var Ie=null;function Ii(){return Ie||(typeof window!="undefined"&&window.lottie?Ie=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),Ie=null)),Ie}function As(t){Ie=t}function Ts(t,e,n,s){var M,O,C,v,_,x,D,B,F,P,N,$,ue;let a=n.objects.get(t);if(!a)return console.warn(`[LottieOverlay] Object config not found: ${t}`),null;let i=((M=a.effects)==null?void 0:M.lottie)||{},o=a.transform||{},r=a.render||{};if(i.enabled===!1||r.visible===!1)return null;let c=s[t];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${t}`),null;let l=Ii();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${t}`),null;let u=(O=i.width)!=null?O:300,h=(C=i.height)!=null?C:300,p=(v=o.scale)!=null?v:1,d=(x=(_=o.position)==null?void 0:_.x)!=null?x:0,m=(B=(D=o.position)==null?void 0:D.y)!=null?B:0,f=(F=o.rotation)!=null?F:0,g=(P=r.z_index)!=null?P:100,L=(N=r.alpha)!=null?N:1,w=document.createElement("div");w.style.cssText=`
|
|
18
18
|
position: absolute;
|
|
19
19
|
top: calc(50% + ${m}px);
|
|
20
20
|
left: calc(50% + ${d}px);
|
|
21
|
-
transform: translate(-50%, -50%) scale(${
|
|
22
|
-
width: ${
|
|
23
|
-
height: ${
|
|
21
|
+
transform: translate(-50%, -50%) scale(${p}) rotate(${f}deg);
|
|
22
|
+
width: ${u}px;
|
|
23
|
+
height: ${h}px;
|
|
24
24
|
pointer-events: none;
|
|
25
25
|
z-index: ${g};
|
|
26
|
-
opacity: ${
|
|
27
|
-
`,e.appendChild(w);let S=l.loadAnimation({container:w,renderer:i.renderer||"svg",loop:(Y=i.loop)!=null?Y:!1,autoplay:(Pe=i.autoplay)!=null?Pe:!0,animationData:c});i.speed!==void 0&&S.setSpeed(i.speed);let T=()=>{S.destroy(),w.parentNode&&w.parentNode.removeChild(w)};return i.loop||S.addEventListener("complete",T),{animation:S,cleanup:T}}var ee=require("pixi.js");var X=class{static get(e){var n;return(n=this.store.get(e))==null?void 0:n.data}static set(e,n){this.store.set(e,{data:n})}static has(e){return this.store.has(e)}static clear(){this.store.clear()}};X.store=new Map;var Di=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] MODULE LOADED - __BUILD_MODE__: ${Di}`);var _e={},ut=null;async function Oi(){if(console.log(`[AssetLoader] getInlineAssets() called - __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`),Object.keys(_e).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(_e)),_e;if(!ut){let e=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",e),ut=(async()=>{try{try{let i=await import(e+"?t="+Date.now());if(i.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(i.INLINE_ASSETS)),i.INLINE_ASSETS}catch(i){console.warn("[AssetLoader] ES module import failed, trying text parse:",i)}let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);let a=await n.text();console.log("[AssetLoader] Received JS code, length:",a.length);let s=a.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(s)try{let i=s[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let o=new Function("return "+i)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(o)),o}catch(i){return console.warn("[AssetLoader] Failed to parse inline assets:",i),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",a.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}return _e=await ut,console.log("[AssetLoader] Final inline assets cache:",Object.keys(_e)),_e}var wa=new Map;function pt(t){return t===null||typeof t!="object"||(Object.freeze(t),Object.values(t).forEach(e=>pt(e))),t}function Ci(t=64,e=64,n=16711680){let a=document.createElement("canvas");a.width=t,a.height=e;let s=a.getContext("2d");return s.fillStyle=`#${n.toString(16).padStart(6,"0")}`,s.fillRect(0,0,t,e),s.strokeStyle="#000",s.strokeRect(0,0,t,e),s.fillStyle="#fff",s.font="10px sans-serif",s.textAlign="center",s.fillText("MISSING",t/2,e/2),ee.Texture.from(a)}function je(t,e){wa.set(t,e)}var we=class{static async load(e,n,a){let s=X.get(e);if(s!==void 0)return s;let i=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] Loading asset: ${e}, type: ${n.type}, __BUILD_MODE__: ${i}`);let r=(await Oi())[e];if(console.log("[AssetLoader] Inline data for",e,":",r?"FOUND":"NOT FOUND"),i==="publish"&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!r))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${e}, path: ${n.path}`);let c=wa.get(n.type);if(c)try{let l=await c(n.path,r,e,a);return X.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}try{let l;switch(n.type){case"image":l=await this.loadImage(n.path,r);break;case"json":l=await this.loadJSON(n.path,r),l=pt(l);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return X.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}}static async loadImage(e,n){let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=a==="publish";if(console.log(`[AssetLoader] loadImage - __BUILD_MODE__: ${a}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${e}`);if(!n.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${n.substring(0,50)}...`);try{return await ee.Assets.load(n)}catch(i){throw console.error("[AssetLoader] Failed to load texture from data URI:",i),i}}if(n&&n.startsWith("data:"))try{return await ee.Assets.load(n)}catch(i){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",i),await ee.Assets.load(e)}return await ee.Assets.load(e)}static async loadJSON(e,n){let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=a==="publish";if(console.log(`[AssetLoader] loadJSON - __BUILD_MODE__: ${a}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}if(n){if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}let i=await fetch(e);if(!i.ok)throw new Error(`JSON fetch failed: ${e}`);return i.json()}static handleFailure(e,n,a){if(typeof __BUILD_MODE__!="undefined"&&__BUILD_MODE__==="dev"){let i=n==="image"?Ci():pt({__placeholder:!0,type:n});return X.set(e,i),i}throw a}};je("image",async(t,e)=>{let n=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",a=n==="publish";if(console.log(`[AssetLoader] registerType('image') - __BUILD_MODE__: ${n}, isPublishMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);return ee.Assets.load(e)}return ee.Assets.load(e||t)});je("json",async(t,e)=>{let n=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",a=n==="publish";if(console.log(`[AssetLoader] registerType('json') - __BUILD_MODE__: ${n}, isPublishMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}if(e)return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let s=await fetch(t);if(!s.ok)throw new Error(`JSON fetch failed: ${t}`);return s.json()});var Ce=require("pixi.js");var Qe=class{static async create(e,n,a){var c,l,p,f,u,d;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`);let i=(c=n==null?void 0:n.render)==null?void 0:c.asset;if(!i){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let m=new Ce.Container;return this.applyTransform(m,n==null?void 0:n.transform),m}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, type: ${i.type}, path: ${i.path}`);let o=await we.load(e,i,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(l=o==null?void 0:o.constructor)==null?void 0:l.name}`);let r;if(i.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),r=new Ce.Sprite(o),console.log("[ObjectFactory] Created object:",r,"type:",(p=r==null?void 0:r.constructor)==null?void 0:p.name),this.applyTransform(r,n==null?void 0:n.transform);else if(i.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name,o),o&&(((u=o.constructor)==null?void 0:u.name)==="Container"||o instanceof Ce.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let m=[i.path,`/assets/${i.path}`,`assets/${i.path}`,`../assets/${i.path}`],h=!1;for(let g of m)try{let b=await fetch(g);if(b.ok){r=await b.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",g,"type:",(d=r==null?void 0:r.constructor)==null?void 0:d.name),h=!0;break}}catch{continue}h||(console.error("[ObjectFactory] Failed to reload JSON from any path"),r=o)}else r=o;else r=o,r&&typeof r=="object"&&("x"in r||"position"in r)&&this.applyTransform(r,n==null?void 0:n.transform);return r}static applyTransform(e,n){var a,s,i,o;!n||!e||(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((i=n.position.x)!=null?i:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1])))}};0&&(module.exports={AssetCache,AssetLoader,GameObject,GameObjectManager,ObjectFactory,Renderer,Transform,animateHandClick,animatePanelEntrance,createEndGamePanel,createHandTutorial,createPixiBase,createTutorialLabel,getRegisteredFontIds,playLottieOverlay,registerFont,registerType,resolveFont,resolveFontWeight,setLottieInstance,updateHandAnimation});
|
|
26
|
+
opacity: ${L};
|
|
27
|
+
`,e.appendChild(w);let T=l.loadAnimation({container:w,renderer:i.renderer||"svg",loop:($=i.loop)!=null?$:!1,autoplay:(ue=i.autoplay)!=null?ue:!0,animationData:c});i.speed!==void 0&&T.setSpeed(i.speed);let E=()=>{T.destroy(),w.parentNode&&w.parentNode.removeChild(w)};return i.loop||T.addEventListener("complete",E),{animation:T,cleanup:E}}var ae=require("pixi.js");var Q=class{static get(e){var n;return(n=this.store.get(e))==null?void 0:n.data}static set(e,n){this.store.set(e,{data:n})}static has(e){return this.store.has(e)}static clear(){this.store.clear()}};Q.store=new Map;function Fi(){var t,e;try{let n=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((e=(t=document.querySelector("script"))==null?void 0:t.textContent)==null?void 0:e.includes("inline-assets.js"))||window.INLINE_ASSETS),s=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(n&&!s)}catch{return!1}}async function $i(){try{if(typeof window!="undefined"){let t=await fetch("./build-settings.json");if(t.ok){let e=await t.json();return console.log("[AssetLoader] Loaded build settings:",e),e}}}catch{}return null}function Ri(){try{if(typeof window!="undefined"){let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",e),e}}}catch{}return null}var vs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Es=Fi(),fe=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,b=Es?"publish":vs,Z=fe==null?void 0:fe.assetsInlined;fe!=null&&fe.buildMode&&(b=fe.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${b}`));var de=Ri();de!=null&&de.buildMode&&(b=de.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${b}`));(de==null?void 0:de.assetsInlined)!==void 0&&(Z=de.assetsInlined);$i().then(t=>{t!=null&&t.buildMode&&t.buildMode!==b&&(b=t.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${b}`)),(t==null?void 0:t.assetsInlined)!==void 0&&(Z=t.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${vs}, Runtime: ${Es?"publish":"dev"}, Effective: ${b}`);var ie={},gt=null;async function Bi(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${b}`),Object.keys(ie).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(ie)),ie;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),ie={...window.INLINE_ASSETS},ie;if(!(b==="publish"&&Z!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),ie;if(!gt){let e=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",e),gt=(async()=>{try{try{let i=await import(e+"?t="+Date.now());if(i.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(i.INLINE_ASSETS)),i.INLINE_ASSETS}catch(i){console.warn("[AssetLoader] ES module import failed, trying text parse:",i)}let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);let s=await n.text();console.log("[AssetLoader] Received JS code, length:",s.length);let a=s.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(a)try{let i=a[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let o=new Function("return "+i)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(o)),o}catch(i){return console.warn("[AssetLoader] Failed to parse inline assets:",i),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",s.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}return ie=await gt,console.log("[AssetLoader] Final inline assets cache:",Object.keys(ie)),ie}var Ls=new Map;function _t(t){return t===null||typeof t!="object"||(Object.freeze(t),Object.values(t).forEach(e=>_t(e))),t}function zi(t=64,e=64,n=16711680){let s=document.createElement("canvas");s.width=t,s.height=e;let a=s.getContext("2d");return a.fillStyle=`#${n.toString(16).padStart(6,"0")}`,a.fillRect(0,0,t,e),a.strokeStyle="#000",a.strokeRect(0,0,t,e),a.fillStyle="#fff",a.font="10px sans-serif",a.textAlign="center",a.fillText("MISSING",t/2,e/2),ae.Texture.from(s)}function nt(t,e){Ls.set(t,e)}var Te=class{static async load(e,n,s){let a=Q.get(e);if(a!==void 0)return a;console.log(`[AssetLoader] Loading asset: ${e}, type: ${n.type}, Effective mode: ${b}`),console.log(`[AssetLoader] Window defined: ${typeof window!="undefined"}, INLINE_ASSETS exists: ${!!(typeof window!="undefined"&&window.INLINE_ASSETS)}, keys: ${typeof window!="undefined"&&window.INLINE_ASSETS?Object.keys(window.INLINE_ASSETS).length:"N/A"}`);let i=await Bi(),o=i[e];if(!o&&n.path){let l=n.path.split("/");if(l.length>=2){let u=l[l.length-1].split(".")[0],h=l[0],p=[`${u}.layer`,`${u}.player`,`${u}.tutorial`,`effects.${u}`,`ui.endgame.${u}`,u];for(let d of p)if(i[d]){o=i[d],console.log(`[AssetLoader] Found inline data for ${e} using derived key: ${d}`);break}}}if(console.log("[AssetLoader] Inline data for",e,":",o?"FOUND":"NOT FOUND"),b==="publish"&&Z!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!o))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${e}, path: ${n.path}`);let c=Ls.get(n.type);if(c)try{let l=await c(n.path,o,e,s);return Q.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}try{let l;switch(n.type){case"image":l=await this.loadImage(n.path,o);break;case"json":l=await this.loadJSON(n.path,o),l=_t(l);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return Q.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}}static async loadImage(e,n){let s=b==="publish",a=s&&Z!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${b}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${e}`);if(!n.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${n.substring(0,50)}...`);try{return await ae.Assets.load(n)}catch(i){throw console.error("[AssetLoader] Failed to load texture from data URI:",i),i}}if(n&&n.startsWith("data:"))try{return await ae.Assets.load(n)}catch(i){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",i),await ae.Assets.load(e)}return await ae.Assets.load(e)}static async loadJSON(e,n){let s=b==="publish",a=s&&Z!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${b}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}if(n){if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}let i=await fetch(e);if(!i.ok)throw new Error(`JSON fetch failed: ${e}`);return i.json()}static handleFailure(e,n,s){if(b==="dev"){let i=n==="image"?zi():_t({__placeholder:!0,type:n});return Q.set(e,i),i}throw s}};nt("image",async(t,e)=>{let n=b==="publish",s=n&&Z!==!1,a=b==="brand",i=n&&Z===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${b}, isPublishMode: ${n}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);return ae.Assets.load(e)}let o=t;return(a||i)&&t&&!t.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(o=t,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${t}" as-is`)):(o=`assets/${t}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${t}" -> "${o}"`))),ae.Assets.load(e||o)});nt("json",async(t,e)=>{let n=b==="publish",s=n&&Z!==!1,a=b==="brand",i=n&&Z===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${b}, isPublishMode: ${n}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}let o=t;if((a||i)&&t&&!t.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(o=t,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${t}" as-is`)):(o=`assets/${t}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${t}" -> "${o}"`))),e)return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let r=await fetch(o);if(!r.ok)throw new Error(`JSON fetch failed: ${t}`);return r.json()});var Fe=require("pixi.js");var Hi=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",bt=Hi;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(bt=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${bt}`))}}catch{}var st=class{static async create(e,n,s){var r,c,l,u,h,p;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${bt}`);let a=(r=n==null?void 0:n.render)==null?void 0:r.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let d=new Fe.Container;return this.applyTransform(d,n==null?void 0:n.transform),d}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, type: ${a.type}, path: ${a.path}`);let i=await Te.load(e,a,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(c=i==null?void 0:i.constructor)==null?void 0:c.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",i,"for object:",e),o=new Fe.Sprite(i),console.log("[ObjectFactory] Created object:",o,"type:",(l=o==null?void 0:o.constructor)==null?void 0:l.name),this.applyTransform(o,n==null?void 0:n.transform);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=i==null?void 0:i.constructor)==null?void 0:u.name,i),i&&(((h=i.constructor)==null?void 0:h.name)==="Container"||i instanceof Fe.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let d=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],m=!1;for(let f of d)try{let g=await fetch(f);if(g.ok){o=await g.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",f,"type:",(p=o==null?void 0:o.constructor)==null?void 0:p.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=i)}else o=i;else o=i,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform);return o}static applyTransform(e,n){var s,a,i,o;!n||!e||(n.position&&("x"in e&&"y"in e?(e.x=(s=n.position.x)!=null?s:0,e.y=(a=n.position.y)!=null?a:0):"position"in e&&e.position&&e.position.set((i=n.position.x)!=null?i:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1])))}};0&&(module.exports={AssetCache,AssetLoader,GameObject,GameObjectManager,ObjectFactory,Renderer,Transform,animateHandClick,animatePanelEntrance,createEndGamePanel,createHandTutorial,createPixiBase,createTutorialLabel,getRegisteredFontIds,playLottieOverlay,registerFont,registerType,resolveFont,resolveFontWeight,setLottieInstance,updateHandAnimation});
|
package/dist/pixi/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{b as ft}from"../chunk-UVBNGLP3.mjs";import{Application as Bn}from"pixi.js";async function Nn(n,t={}){let e=new Bn;await e.init({resizeTo:n,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let o=a=>{var c,l,u,h,p,d;let r=(u=(l=(c=a==null?void 0:a.width)!=null?c:n.clientWidth)!=null?l:window.innerWidth)!=null?u:320,i=(d=(p=(h=a==null?void 0:a.height)!=null?h:n.clientHeight)!=null?p:window.innerHeight)!=null?d:480;e.renderer.resize(r,i)};n.innerHTML="",n.style.position="relative",n.style.display="flex",n.style.flexDirection="column",n.style.alignItems="stretch",n.style.width="100%",n.style.height="100dvh",n.style.minHeight="100vh",n.style.maxWidth="100%",n.style.maxHeight="100%",n.style.boxSizing="border-box",n.style.overflow="hidden",t.background&&(n.style.background=t.background),n.appendChild(e.canvas);let s=document.createElement("div");return s.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),n.appendChild(s),ft.on("pause",()=>{e.ticker.stop(),document.querySelectorAll("audio").forEach(r=>r.pause())}),ft.on("resume",()=>{e.ticker.start(),document.querySelectorAll("audio").forEach(r=>{r.currentTime>0&&!r.ended&&r.play().catch(()=>{})})}),ft.on("resize",({payload:a})=>{o({width:a==null?void 0:a.width,height:a==null?void 0:a.height})}),window.addEventListener("resize",()=>o()),requestAnimationFrame(()=>o()),{app:e,stage:e.stage,overlay:s,applySize:o}}var yt=class{constructor(t){var e,o;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(e=t==null?void 0:t.scale)!=null?e:1,this.rotation=(o=t==null?void 0:t.rotation)!=null?o:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToPixi(t){t.position.set(this.position.x,this.position.y),t.scale.set(this.scale),t.rotation=this.rotation}},mt=class{constructor(t){var e,o,s,a;this.z_index=(e=t==null?void 0:t.z_index)!=null?e:0,this.alpha=(o=t==null?void 0:t.alpha)!=null?o:1,this.visible=(s=t==null?void 0:t.visible)!=null?s:!0,this.tint=(a=t==null?void 0:t.tint)!=null?a:null}update(t){t.z_index!==void 0&&(this.z_index=t.z_index),t.alpha!==void 0&&(this.alpha=t.alpha),t.visible!==void 0&&(this.visible=t.visible),t.tint!==void 0&&(this.tint=t.tint)}syncToPixi(t){t.zIndex=this.z_index,t.alpha=this.alpha,t.visible=this.visible,this.tint!==null&&"tint"in t&&(t.tint=this.tint)}},_t=class{constructor(t,e,o,s){this.instanceId=t,this.objectConfig=e,this.pixiObject=o,this._config=s,this.transform=new yt(s.transform),this.renderer=new mt(s.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(t){this._config=t,t.transform&&this.transform.update(t.transform),t.render&&this.renderer.update(t.render),this.sync()}getComponent(t){return this._config[t]}getPosition(){return{...this.transform.position}}setPosition(t,e){this.transform.position={x:t,y:e},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToPixi(this.pixiObject)}},Tt=class{constructor(t){this.objects=new Map;this.config=t}create(t,e){let o=this.config.objects.get(t);if(!o)throw new Error(`Object config not found: ${t}`);let s=new _t(t,o.object_config||t,e,o);return this.objects.set(t,s),s}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[e,o]of this.objects.entries()){let s=t.objects.get(e);s&&o.updateConfig(s)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var gt={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function J(n){let t=gt[n];return t?t.family:(console.warn(`Font ID "${n}" not found in registry, using fallback`),"Arial, sans-serif")}function G(n){var e;let t=gt[n];return t&&(e=t.weight)!=null?e:"400"}function kn(n,t){gt[n]=t}function Rn(){return Object.keys(gt)}import{Container as In,Graphics as xt,Text as at,Sprite as Ve,Texture as At}from"pixi.js";function Yn(n,t,e){var Yt,zt,Ht,Wt,Jt,Gt,Xt,qt,Vt,Ut,Kt,Qt,Zt,jt,te,ee,ne,ae,se,oe,ie,re,le,ce,de,pe,ue,he,fe,ye,me,_e,ge,xe,be,we,Se,Te,Ae,Le,Ee,Me,ve,De,Ce,Oe,Fe,Pe,$e,Be,Ne,ke,Re,Ie,Ye,ze,He,We,Je,Ge;let o=n.objects.get("ui_endgame_1"),s=n.objects.get("ui_endgame_logo_1"),a=n.objects.get("ui_endgame_title_1"),r=n.objects.get("ui_endgame_subtitle_1"),i=n.objects.get("ui_endgame_footer_1"),c=n.objects.get("ui_endgame_cta_1"),l=n.objects.get("ui_endgame_cta_hint_1"),u=n.objects.get("ui_endgame_hand_1"),h=n.engine.runtime||{},p=new In;p.alpha=0,p.visible=!1;let d=((Yt=o==null?void 0:o.gameplay)==null?void 0:Yt.tuning)||{},f=(o==null?void 0:o.render)||{},y=(zt=d.panel_width)!=null?zt:320,m=(Ht=d.panel_height)!=null?Ht:400,g=(Wt=d.panel_padding)!=null?Wt:32,_=(Jt=d.panel_radius)!=null?Jt:24,x=f.background_color||d.panel_bg_color||"#1a0a0a",b=f.background_alpha!==void 0&&f.background_alpha!==null?f.background_alpha:(Gt=d.panel_bg_alpha)!=null?Gt:.98,T=f.border_color||d.panel_border_color||"#ffffff",A=(Xt=d.panel_border_width)!=null?Xt:2,w=(qt=d.panel_border_alpha)!=null?qt:.3,S=new xt;S.roundRect(-y/2,-m/2,y,m,_);let L=x.replace("#","");S.fill({color:parseInt(L,16),alpha:b});let C=T.replace("#","");S.stroke({color:parseInt(C,16),width:A,alpha:w});let E=new xt;E.roundRect(-y/2+2,-m/2+2,y-4,m-4,_-2),E.stroke({color:16777215,width:1,alpha:.1}),S.addChild(E),p.addChild(S);let O=((Vt=s==null?void 0:s.gameplay)==null?void 0:Vt.tuning)||{},k=(s==null?void 0:s.transform)||{},M=(Ut=O.logo_size)!=null?Ut:56,F=(Kt=k.scale)!=null?Kt:1,R=(Zt=(Qt=k.offset)==null?void 0:Qt.y)!=null?Zt:-130,it=(jt=O.logo_alpha)!=null?jt:1,v=new Ve(e||At.EMPTY);v.anchor.set(.5);let U=0,K=0;if(e&&e!==At.EMPTY){let D=e.frame,W=e.baseTexture;D&&D.width&&D.height?(U=D.width,K=D.height):W&&W.width&&W.height?(U=W.width,K=W.height):e.width&&e.height&&(U=e.width,K=e.height)}if(U>0&&K>0){let D=U/K,W,St;D>1?(W=M,St=M/D):(St=M,W=M*D);let Xe=W/U,qe=St/K;Xe*=F,qe*=F,v.scale.set(Xe,qe)}else{let D=M/100*F;v.scale.set(D)}v.position.set(0,R),v.alpha=0,v.visible=!0,v.targetAlpha=it,v.baseScaleX=v.scale.x,v.baseScaleY=v.scale.y,p.addChild(v);let P=a==null?void 0:a.ui,I=((te=a==null?void 0:a.gameplay)==null?void 0:te.tuning)||{},Qe=(P==null?void 0:P.text)||"MISSION ACCOMPLISHED",Dt=(P==null?void 0:P.font)||"brand.heading",Ze=(P==null?void 0:P.fontSize)||24,je=(ee=P==null?void 0:P.letterSpacing)!=null?ee:1,rt=(ne=a==null?void 0:a.render)==null?void 0:ne.tint,tn=typeof rt=="string"?rt:rt?`#${rt.toString(16).padStart(6,"0")}`:"#00FF88",Ct=y-g*2-30,en=I.font_weight_override?I.font_weight_override:G(Dt),q=new at({text:Qe,style:{fontFamily:J(Dt),fontSize:Ze,fontWeight:en,fill:tn,align:"center",letterSpacing:je,wordWrap:!1,stroke:{color:I.stroke_color||"#000000",width:(ae=I.stroke_width)!=null?ae:2},dropShadow:{color:I.shadow_color||"#000000",alpha:(se=I.shadow_alpha)!=null?se:.9,angle:(oe=I.shadow_angle)!=null?oe:0,blur:(ie=I.shadow_blur)!=null?ie:8,distance:(re=I.shadow_distance)!=null?re:4}}});if(q.width>Ct){let D=Ct/q.width;q.scale.set(D)}q.anchor.set(.5);let Ot=(le=d.title_offset_y)!=null?le:30,nn=Ot+((ce=I.animation_start_y_offset)!=null?ce:-20);q.position.set(0,nn),q.alpha=0,p.addChild(q);let $=r==null?void 0:r.ui,Ft=((de=r==null?void 0:r.gameplay)==null?void 0:de.tuning)||{},an=($==null?void 0:$.text)||"RESCUE COMPLETE",Pt=($==null?void 0:$.font)||"brand.body",sn=($==null?void 0:$.fontSize)||11,on=(pe=$==null?void 0:$.letterSpacing)!=null?pe:.5,lt=(ue=r==null?void 0:r.render)==null?void 0:ue.tint,rn=typeof lt=="string"?lt:lt?`#${lt.toString(16).padStart(6,"0")}`:"#B0B0B0",Q=new at({text:an,style:{fontFamily:J(Pt),fontSize:sn,fontWeight:G(Pt),fill:rn,align:"center",letterSpacing:on}});Q.anchor.set(.5);let ln=Ot+20+((he=Ft.animation_start_y_offset)!=null?he:-10);Q.position.set(0,ln),Q.alpha=0,Q.animationStartYOffset=(fe=Ft.animation_start_y_offset)!=null?fe:-10,p.addChild(Q);let z=i==null?void 0:i.ui,$t=((ye=i==null?void 0:i.gameplay)==null?void 0:ye.tuning)||{},cn=(z==null?void 0:z.text)||((me=h.ui)==null?void 0:me.cta_hint)||"Continue the adventure!",Bt=(z==null?void 0:z.font)||"brand.body",dn=(z==null?void 0:z.fontSize)||16,ct=(_e=i==null?void 0:i.render)==null?void 0:_e.tint,pn=typeof ct=="string"?ct:ct?`#${ct.toString(16).padStart(6,"0")}`:"#FFFFFF",un=(ge=$t.max_width)!=null?ge:y-g*2,hn=(xe=$t.line_height)!=null?xe:1.4,Z=new at({text:cn,style:{fontFamily:J(Bt),fontSize:dn,fontWeight:G(Bt),fill:pn,align:"center",wordWrap:!0,wordWrapWidth:un,lineHeight:hn}});Z.anchor.set(.5);let fn=(be=d.footer_offset_y)!=null?be:120;Z.position.set(0,fn);let yn=((we=i==null?void 0:i.render)==null?void 0:we.alpha)!==void 0&&((Se=i==null?void 0:i.render)==null?void 0:Se.alpha)!==null?i.render.alpha:1;Z.alpha=0,Z.targetAlpha=yn,p.addChild(Z);let H=((Te=c==null?void 0:c.gameplay)==null?void 0:Te.tuning)||{},B=c==null?void 0:c.ui,dt=(Ae=H.button_width)!=null?Ae:260,pt=(Le=H.button_height)!=null?Le:56,Nt=(Ee=H.button_radius)!=null?Ee:16,mn=H.button_bg_color||((Me=h.theme)==null?void 0:Me.cta_background)||"#ffb43b",_n=(ve=H.button_bg_alpha)!=null?ve:1,gn=H.button_border_color||"#ffffff",xn=(De=H.button_border_width)!=null?De:2,bn=(Ce=H.button_border_alpha)!=null?Ce:.2,ut=(Oe=d.cta_offset_y)!=null?Oe:160,Y=new xt;Y.roundRect(-dt/2,-pt/2,dt,pt,Nt);let wn=mn.replace("#","");Y.fill({color:parseInt(wn,16),alpha:_n});let Sn=gn.replace("#","");Y.stroke({color:parseInt(Sn,16),width:xn,alpha:bn});let bt=new xt;bt.roundRect(-dt/2+2,-pt/2+2,dt-4,pt-4,Nt-2),bt.stroke({color:0,width:1,alpha:.15}),Y.addChild(bt),Y.position.set(0,ut),Y.alpha=0,Y.eventMode="static",Y.cursor="pointer",p.addChild(Y);let Tn=(B==null?void 0:B.text)||((Fe=h.ui)==null?void 0:Fe.cta_label_end)||"DOWNLOAD",kt=(B==null?void 0:B.font)||"brand.heading",An=(B==null?void 0:B.fontSize)||20,Ln=H.button_text_color||((Pe=h.theme)==null?void 0:Pe.cta_text)||"#1a0a0a",nt=new at({text:Tn,style:{fontFamily:J(kt),fontSize:An,fontWeight:G(kt),fill:Ln,align:"center",letterSpacing:($e=B==null?void 0:B.letterSpacing)!=null?$e:1}});nt.anchor.set(.5),nt.position.set(0,ut),nt.alpha=0,p.addChild(nt);let N=l==null?void 0:l.ui,Rt=((Be=l==null?void 0:l.gameplay)==null?void 0:Be.tuning)||{},En=(N==null?void 0:N.text)||"Play the full game",It=(N==null?void 0:N.font)||"brand.body",Mn=(N==null?void 0:N.fontSize)||11,vn=(Ne=N==null?void 0:N.letterSpacing)!=null?Ne:0,ht=(ke=l==null?void 0:l.render)==null?void 0:ke.tint,Dn=typeof ht=="string"?ht:ht?`#${ht.toString(16).padStart(6,"0")}`:"#CCCCCC",j=new at({text:En,style:{fontFamily:J(It),fontSize:Mn,fontWeight:G(It),fill:Dn,align:"center",letterSpacing:vn}});j.anchor.set(.5);let Cn=ut+35+((Re=Rt.animation_start_y_offset)!=null?Re:5);j.position.set(0,Cn),j.alpha=0,j.animationStartYOffset=(Ie=Rt.animation_start_y_offset)!=null?Ie:5,p.addChild(j);let wt=((Ye=u==null?void 0:u.gameplay)==null?void 0:Ye.tuning)||{},On=(ze=wt.hand_offset_x)!=null?ze:50,Fn=(He=wt.hand_offset_y)!=null?He:50,Pn=(Je=(We=u==null?void 0:u.transform)==null?void 0:We.scale)!=null?Je:.1875,$n=(Ge=wt.hand_scale_multiplier)!=null?Ge:2.5,V=new Ve(t||At.EMPTY);return V.anchor.set(.5),V.scale.set(Pn*$n),V.position.set(On,ut+Fn),V.alpha=0,V.visible=!1,p.addChild(V),{panel:p,logo:v,title:q,subtitle:Q,footer:Z,ctaButton:Y,ctaText:nt,ctaHint:j,hand:V}}function zn(n,t,e){var A,w,S,L,C,E,O,k;let o=t.objects.get("ui_endgame_1"),s=((A=o==null?void 0:o.gameplay)==null?void 0:A.tuning)||{},a=(w=s.animation_duration_ms)!=null?w:800,r=(S=s.fade_in_duration_ms)!=null?S:600,i=(L=s.scale_animation_intensity)!=null?L:.1,c=(C=s.logo_animation_delay_ms)!=null?C:100,l=(E=s.title_animation_delay_ms)!=null?E:200,u=(O=s.footer_animation_delay_ms)!=null?O:300,h=(k=s.cta_animation_delay_ms)!=null?k:400,{panel:p,logo:d,title:f,subtitle:y,footer:m,ctaButton:g,ctaText:_,ctaHint:x}=n;p.visible=!0;let b=Date.now(),T=()=>{let M=Date.now()-b,F=Math.min(M/r,1),R=1-Math.pow(1-F,3);p.alpha=R,p.scale.set(1+i*(1-R)),F<1?requestAnimationFrame(T):(setTimeout(()=>Hn(d,a,t),c),setTimeout(()=>{Wn(f,a),setTimeout(()=>Jn(y,a),50)},l),setTimeout(()=>Gn(m,a),u),setTimeout(()=>{Xn(g,_,a),setTimeout(()=>qn(x,a),50),e&&e()},h))};T()}function Hn(n,t,e){var p,d,f,y,m;let o=e==null?void 0:e.objects.get("ui_endgame_logo_1"),a=(d=(((p=o==null?void 0:o.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?d:1.2,r=Date.now(),i=n.alpha,c=(f=n.targetAlpha)!=null?f:1,l=(y=n.baseScaleX)!=null?y:n.scale.x,u=(m=n.baseScaleY)!=null?m:n.scale.y,h=()=>{let g=Date.now()-r,_=Math.min(g/t,1),x=1-Math.pow(1-_,2);n.alpha=i+(c-i)*x;let b=a+(1-a)*x;n.scale.set(l*b,u*b),_<1&&requestAnimationFrame(h)};h()}function Wn(n,t){let e=Date.now(),o=n.alpha,s=n.y,a=()=>{let r=Date.now()-e,i=Math.min(r/t,1),c=1-Math.pow(1-i,2);n.alpha=o+(1-o)*c,n.y=s-20*(1-c),i<1&&requestAnimationFrame(a)};a()}function Jn(n,t){var i;let e=Date.now(),o=n.alpha,s=n.position.y,a=s-((i=n.animationStartYOffset)!=null?i:-10),r=()=>{let c=Date.now()-e,l=Math.min(c/t,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=s+(a-s)*u,l<1&&requestAnimationFrame(r)};r()}function Gn(n,t){var r;let e=Date.now(),o=n.alpha,s=(r=n.targetAlpha)!=null?r:1,a=()=>{let i=Date.now()-e,c=Math.min(i/t,1),l=1-Math.pow(1-c,2);n.alpha=o+(s-o)*l,c<1&&requestAnimationFrame(a)};a()}function Xn(n,t,e){let o=Date.now(),s=n.alpha,a=()=>{let r=Date.now()-o,i=Math.min(r/e,1),c=1-Math.pow(1-i,2);n.alpha=s+(1-s)*c,t.alpha=s+(1-s)*c,n.scale.set(1+.1*(1-c)),i<1&&requestAnimationFrame(a)};a()}function qn(n,t){var i;let e=Date.now(),o=n.alpha,s=n.position.y,a=s-((i=n.animationStartYOffset)!=null?i:5),r=()=>{let c=Date.now()-e,l=Math.min(c/t,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=s+(a-s)*u,l<1&&requestAnimationFrame(r)};r()}function Vn(n,t,e,o){var u,h,p,d;let s=e.objects.get("ui_endgame_hand_1"),a=((u=s==null?void 0:s.gameplay)==null?void 0:u.tuning)||{},r=(h=a.click_animation_duration_ms)!=null?h:600,i=(p=a.click_delay_ms)!=null?p:2e3,c=(d=a.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var A,w;n.visible=!0,n.alpha=1;let f=n.x,y=n.y,m=(A=a.hand_offset_x)!=null?A:50,g=(w=a.hand_offset_y)!=null?w:50,_=t.x+m,x=t.y+g,b=Date.now(),T=()=>{var M,F,R;let S=Date.now()-b,L=Math.min(S/r,1),C=L<.5?2*L*L:1-Math.pow(-2*L+2,2)/2;n.x=f+(_-f)*C,n.y=y+(x-y)*C;let E=(F=(M=s==null?void 0:s.transform)==null?void 0:M.scale)!=null?F:.1875,O=(R=a.hand_scale_multiplier)!=null?R:2.5,k=E*O;n.scale.set(k+k*.2*Math.sin(L*Math.PI)),L<1?requestAnimationFrame(T):(t.scale.set(.95),setTimeout(()=>{t.scale.set(1),o()},100),setTimeout(()=>{n.alpha=0,setTimeout(()=>{n.x=f,n.y=y,l()},c)},500))};T()};setTimeout(l,i)}import{Sprite as Un,Text as Kn}from"pixi.js";function Qn(n,t,e){var u,h,p,d;let o=t.objects.get("hand_tutorial_1"),s=((u=o==null?void 0:o.gameplay)==null?void 0:u.tuning)||{},a=(o==null?void 0:o.render)||{},r=(o==null?void 0:o.transform)||{},i=new Un(n);i.anchor.set(.5),i.alpha=0;let c=(h=s.hand_scale_multiplier)!=null?h:2.5,l=(p=r.scale)!=null?p:.1875;return i.scale.set(l*c),i.zIndex=(d=a.z_index)!=null?d:99999,i}function Zn(n){var f,y,m,g,_,x,b,T,A,w;let t=n.objects.get("ui_tutorial_1"),e=t==null?void 0:t.ui,o=(t==null?void 0:t.render)||{},s=((f=n.engine.runtime)==null?void 0:f.ui_styles)||{},a=((y=n.engine.runtime)==null?void 0:y.ui)||{},r=(e==null?void 0:e.text)||a.tutorial_label||a.label_text||"CLEAN!",i=(e==null?void 0:e.font)||"brand.warning",c=(e==null?void 0:e.fontSize)||s.label_font_size||52,l=(g=e==null?void 0:e.letterSpacing)!=null?g:(m=s.label_letter_spacing)!=null?m:-1,u=(e==null?void 0:e.align)||"center",h=o.tint,p=typeof h=="string"?h:h?`#${h.toString(16).padStart(6,"0")}`:s.label_fill||"#FFF1C1",d=new Kn({text:r,style:{fontFamily:J(i),fontSize:c,fontWeight:G(i),fill:p,align:u,letterSpacing:l,stroke:{color:s.label_stroke||"#8B0000",width:2},dropShadow:{color:s.label_shadow_color||"#000000",alpha:(_=s.label_shadow_alpha)!=null?_:.8,angle:(x=s.label_shadow_angle)!=null?x:0,blur:(b=s.label_shadow_blur)!=null?b:4,distance:(T=s.label_shadow_distance)!=null?T:2}}});return d.anchor.set(.5,0),d.alpha=(A=o.alpha)!=null?A:0,d.visible=(w=o.visible)!=null?w:!0,d}function jn(n,t,e,o,s){var c,l,u,h,p,d,f;let a=s.objects.get("hand_tutorial_1"),r=((c=a==null?void 0:a.gameplay)==null?void 0:c.tuning)||{},i=(a==null?void 0:a.transform)||{};if(!o){let y=(l=r.animation_duration)!=null?l:1.5,m=e%y/y,g=m<.5?2*m*m:-1+(4-2*m)*m,_=(u=r.x_offset)!=null?u:0,x=(h=r.y_offset)!=null?h:0,b=(p=r.animation_range)!=null?p:40,T=b*.7,A=b,w=t.x+_+T,S=t.y+x+A,L=w+T,C=S+A;n.x=w+(L-w)*g,n.y=S+(C-S)*g;let E=(d=i.scale)!=null?d:.1875,O=(f=r.hand_scale_multiplier)!=null?f:2.5;n.scale.set(E*O)}}var st=null;function ta(){return st||(typeof window!="undefined"&&window.lottie?st=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),st=null)),st}function ea(n){st=n}function na(n,t,e,o){var T,A,w,S,L,C,E,O,k,M,F,R,it;let s=e.objects.get(n);if(!s)return console.warn(`[LottieOverlay] Object config not found: ${n}`),null;let a=((T=s.effects)==null?void 0:T.lottie)||{},r=s.transform||{},i=s.render||{};if(a.enabled===!1||i.visible===!1)return null;let c=o[n];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${n}`),null;let l=ta();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${n}`),null;let u=(A=a.width)!=null?A:300,h=(w=a.height)!=null?w:300,p=(S=r.scale)!=null?S:1,d=(C=(L=r.position)==null?void 0:L.x)!=null?C:0,f=(O=(E=r.position)==null?void 0:E.y)!=null?O:0,y=(k=r.rotation)!=null?k:0,m=(M=i.z_index)!=null?M:100,g=(F=i.alpha)!=null?F:1,_=document.createElement("div");_.style.cssText=`
|
|
1
|
+
import{b as be}from"../chunk-U4PCKCX6.mjs";import{Application as Wn}from"pixi.js";async function Hn(n,e={}){let t=new Wn;await t.init({resizeTo:n,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let o=s=>{var c,l,u,f,p,d;if(!t.renderer)return;let i=(u=(l=(c=s==null?void 0:s.width)!=null?c:n.clientWidth)!=null?l:window.innerWidth)!=null?u:320,r=(d=(p=(f=s==null?void 0:s.height)!=null?f:n.clientHeight)!=null?p:window.innerHeight)!=null?d:480;t.renderer.resize(i,r)};n.innerHTML="",n.style.position="relative",n.style.display="flex",n.style.flexDirection="column",n.style.alignItems="stretch",n.style.width="100%",n.style.height="100dvh",n.style.minHeight="100vh",n.style.maxWidth="100%",n.style.maxHeight="100%",n.style.boxSizing="border-box",n.style.overflow="hidden",e.background&&(n.style.background=e.background),n.appendChild(t.canvas);let a=document.createElement("div");return a.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),n.appendChild(a),be.on("pause",()=>{t.ticker.stop(),document.querySelectorAll("audio").forEach(i=>i.pause())}),be.on("resume",()=>{t.ticker.start(),document.querySelectorAll("audio").forEach(i=>{i.currentTime>0&&!i.ended&&i.play().catch(()=>{})})}),be.on("resize",({payload:s})=>{o({width:s==null?void 0:s.width,height:s==null?void 0:s.height})}),window.addEventListener("resize",()=>o()),requestAnimationFrame(()=>o()),{app:t,stage:t.stage,overlay:a,applySize:o}}var xe=class{constructor(e){var t,o;this.position=(e==null?void 0:e.position)||{x:0,y:0},this.scale=(t=e==null?void 0:e.scale)!=null?t:1,this.rotation=(o=e==null?void 0:e.rotation)!=null?o:0}update(e){e.position!==void 0&&(this.position={...e.position}),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation)}syncToPixi(e){e.position.set(this.position.x,this.position.y),e.scale.set(this.scale),e.rotation=this.rotation}},we=class{constructor(e){var t,o,a,s;this.z_index=(t=e==null?void 0:e.z_index)!=null?t:0,this.alpha=(o=e==null?void 0:e.alpha)!=null?o:1,this.visible=(a=e==null?void 0:e.visible)!=null?a:!0,this.tint=(s=e==null?void 0:e.tint)!=null?s:null}update(e){e.z_index!==void 0&&(this.z_index=e.z_index),e.alpha!==void 0&&(this.alpha=e.alpha),e.visible!==void 0&&(this.visible=e.visible),e.tint!==void 0&&(this.tint=e.tint)}syncToPixi(e){e.zIndex=this.z_index,e.alpha=this.alpha,e.visible=this.visible,this.tint!==null&&"tint"in e&&(e.tint=this.tint)}},Se=class{constructor(e,t,o,a){this.instanceId=e,this.objectConfig=t,this.pixiObject=o,this._config=a,this.transform=new xe(a.transform),this.renderer=new we(a.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject),this.applyAnchor(),this.applyEffectsScale()}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}applyAnchor(){var a,s,i,r;if(!this.pixiObject||!("anchor"in this.pixiObject)||!this.pixiObject.anchor)return;let e=(s=(a=this._config)==null?void 0:a.render)==null?void 0:s.anchor,t=(r=(i=this._config)==null?void 0:i.transform)==null?void 0:r.anchor,o=e&&typeof e=="object"?e:t&&typeof t=="object"?t:null;o&&typeof o.x=="number"&&typeof o.y=="number"&&this.pixiObject.anchor.set(o.x,o.y)}applyEffectsScale(){var s,i,r;if(!((s=this.pixiObject)!=null&&s.scale))return;let e=(i=this._config)==null?void 0:i.effects,t=typeof(e==null?void 0:e.scale_x)=="number"?e.scale_x:1,o=typeof(e==null?void 0:e.scale_y)=="number"?e.scale_y:1;if(t===1&&o===1)return;let a=(r=this.transform.scale)!=null?r:1;typeof this.pixiObject.scale.set=="function"?this.pixiObject.scale.set(a*t,a*o):(this.pixiObject.scale.x=a*t,this.pixiObject.scale.y=a*o)}getComponent(e){return this._config[e]}getPosition(){return{...this.transform.position}}setPosition(e,t){this.transform.position={x:e,y:t},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(e){this.renderer.alpha=e,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(e){this.renderer.visible=e,this.renderer.syncToPixi(this.pixiObject)}},$e=class{constructor(e){this.objects=new Map;this.config=e}create(e,t){let o=this.config.objects.get(e);if(!o)throw new Error(`Object config not found: ${e}`);let a=new Se(e,o.object_config||e,t,o);return this.objects.set(e,a),a}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[t,o]of this.objects.entries()){let a=e.objects.get(t);a&&o.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var Ae={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function V(n){let e=Ae[n];return e?e.family:(console.warn(`Font ID "${n}" not found in registry, using fallback`),"Arial, sans-serif")}function K(n){var t;let e=Ae[n];return e&&(t=e.weight)!=null?t:"400"}function qn(n,e){Ae[n]=e}function Gn(){return Object.keys(Ae)}import{Container as Jn,Graphics as Te,Text as le,Sprite as en,Texture as Fe}from"pixi.js";function Xn(n,e,t){var Je,Xe,Ve,Ke,Qe,Ze,je,Ue,et,tt,nt,st,at,ot,it,rt,lt,ct,dt,ut,pt,ft,ht,yt,mt,gt,_t,bt,xt,wt,St,At,Tt,Et,Lt,vt,Mt,$t,Ft,Nt,Ct,Ot,Pt,Bt,kt,Dt,It,Rt,Yt,zt,Wt,Ht,qt,Gt,Jt,Xt,Vt,Kt,Qt,Zt;let o=n.objects.get("ui_endgame_1"),a=n.objects.get("ui_endgame_logo_1"),s=n.objects.get("ui_endgame_title_1"),i=n.objects.get("ui_endgame_subtitle_1"),r=n.objects.get("ui_endgame_footer_1"),c=n.objects.get("ui_endgame_cta_1"),l=n.objects.get("ui_endgame_cta_hint_1"),u=n.objects.get("ui_endgame_hand_1"),f=n.engine.runtime||{},p=new Jn;p.alpha=0,p.visible=!1;let d=((Je=o==null?void 0:o.gameplay)==null?void 0:Je.tuning)||{},h=(o==null?void 0:o.render)||{},y=(Xe=d.panel_width)!=null?Xe:320,m=(Ve=d.panel_height)!=null?Ve:400,T=(Ke=d.panel_padding)!=null?Ke:32,b=(Qe=d.panel_radius)!=null?Qe:24,w=h.background_color||d.panel_bg_color||"#1a0a0a",A=h.background_alpha!==void 0&&h.background_alpha!==null?h.background_alpha:(Ze=d.panel_bg_alpha)!=null?Ze:.98,E=h.border_color||d.panel_border_color||"#ffffff",L=(je=d.panel_border_width)!=null?je:2,v=(Ue=d.panel_border_alpha)!=null?Ue:.3,S=new Te;S.roundRect(-y/2,-m/2,y,m,b);let g=w.replace("#","");S.fill({color:parseInt(g,16),alpha:A});let x=E.replace("#","");S.stroke({color:parseInt(x,16),width:L,alpha:v});let F=new Te;F.roundRect(-y/2+2,-m/2+2,y-4,m-4,b-2),F.stroke({color:16777215,width:1,alpha:.1}),S.addChild(F),p.addChild(S);let k=((et=a==null?void 0:a.gameplay)==null?void 0:et.tuning)||{},O=(a==null?void 0:a.transform)||{},$=(tt=k.logo_size)!=null?tt:56,N=(nt=O.scale)!=null?nt:1,P=(at=(st=O.offset)==null?void 0:st.y)!=null?at:-130,ee=(ot=k.logo_alpha)!=null?ot:1,M=new en(t||Fe.EMPTY);M.anchor.set(.5);let z=0,W=0;if(t&&t!==Fe.EMPTY){let B=t.frame,X=t.baseTexture;B&&B.width&&B.height?(z=B.width,W=B.height):X&&X.width&&X.height?(z=X.width,W=X.height):t.width&&t.height&&(z=t.width,W=t.height)}if(z>0&&W>0){let B=z/W,X,Me;B>1?(X=$,Me=$/B):(Me=$,X=$*B);let jt=X/z,Ut=Me/W;jt*=N,Ut*=N,M.scale.set(jt,Ut)}else{let B=$/100*N;M.scale.set(B)}M.position.set(0,P),M.alpha=0,M.visible=!0,M.targetAlpha=ee,M.baseScaleX=M.scale.x,M.baseScaleY=M.scale.y,p.addChild(M);let C=s==null?void 0:s.ui,D=((it=s==null?void 0:s.gameplay)==null?void 0:it.tuning)||{},Ee=(C==null?void 0:C.text)||"MISSION ACCOMPLISHED",ue=(C==null?void 0:C.font)||"brand.heading",on=(C==null?void 0:C.fontSize)||24,rn=(rt=C==null?void 0:C.letterSpacing)!=null?rt:1,pe=(lt=s==null?void 0:s.render)==null?void 0:lt.tint,ln=typeof pe=="string"?pe:pe?`#${pe.toString(16).padStart(6,"0")}`:"#00FF88",ke=y-T*2-30,cn=D.font_weight_override?D.font_weight_override:K(ue),j=new le({text:Ee,style:{fontFamily:V(ue),fontSize:on,fontWeight:cn,fill:ln,align:"center",letterSpacing:rn,wordWrap:!1,stroke:{color:D.stroke_color||"#000000",width:(ct=D.stroke_width)!=null?ct:2},dropShadow:{color:D.shadow_color||"#000000",alpha:(dt=D.shadow_alpha)!=null?dt:.9,angle:(ut=D.shadow_angle)!=null?ut:0,blur:(pt=D.shadow_blur)!=null?pt:8,distance:(ft=D.shadow_distance)!=null?ft:4}}});if(j.width>ke){let B=ke/j.width;j.scale.set(B)}j.anchor.set(.5);let De=(ht=d.title_offset_y)!=null?ht:30,dn=De+((yt=D.animation_start_y_offset)!=null?yt:-20);j.position.set(0,dn),j.alpha=0,p.addChild(j);let I=i==null?void 0:i.ui,Ie=((mt=i==null?void 0:i.gameplay)==null?void 0:mt.tuning)||{},un=(I==null?void 0:I.text)||"RESCUE COMPLETE",Re=(I==null?void 0:I.font)||"brand.body",pn=(I==null?void 0:I.fontSize)||11,fn=(gt=I==null?void 0:I.letterSpacing)!=null?gt:.5,fe=(_t=i==null?void 0:i.render)==null?void 0:_t.tint,hn=typeof fe=="string"?fe:fe?`#${fe.toString(16).padStart(6,"0")}`:"#B0B0B0",se=new le({text:un,style:{fontFamily:V(Re),fontSize:pn,fontWeight:K(Re),fill:hn,align:"center",letterSpacing:fn}});se.anchor.set(.5);let yn=De+20+((bt=Ie.animation_start_y_offset)!=null?bt:-10);se.position.set(0,yn),se.alpha=0,se.animationStartYOffset=(xt=Ie.animation_start_y_offset)!=null?xt:-10,p.addChild(se);let G=r==null?void 0:r.ui,Ye=((wt=r==null?void 0:r.gameplay)==null?void 0:wt.tuning)||{},mn=(G==null?void 0:G.text)||((St=f.ui)==null?void 0:St.cta_hint)||"Continue the adventure!",ze=(G==null?void 0:G.font)||"brand.body",gn=(G==null?void 0:G.fontSize)||16,he=(At=r==null?void 0:r.render)==null?void 0:At.tint,_n=typeof he=="string"?he:he?`#${he.toString(16).padStart(6,"0")}`:"#FFFFFF",bn=(Tt=Ye.max_width)!=null?Tt:y-T*2,xn=(Et=Ye.line_height)!=null?Et:1.4,ae=new le({text:mn,style:{fontFamily:V(ze),fontSize:gn,fontWeight:K(ze),fill:_n,align:"center",wordWrap:!0,wordWrapWidth:bn,lineHeight:xn}});ae.anchor.set(.5);let wn=(Lt=d.footer_offset_y)!=null?Lt:120;ae.position.set(0,wn);let Sn=((vt=r==null?void 0:r.render)==null?void 0:vt.alpha)!==void 0&&((Mt=r==null?void 0:r.render)==null?void 0:Mt.alpha)!==null?r.render.alpha:1;ae.alpha=0,ae.targetAlpha=Sn,p.addChild(ae);let J=(($t=c==null?void 0:c.gameplay)==null?void 0:$t.tuning)||{},R=c==null?void 0:c.ui,ye=(Ft=J.button_width)!=null?Ft:260,me=(Nt=J.button_height)!=null?Nt:56,We=(Ct=J.button_radius)!=null?Ct:16,An=J.button_bg_color||((Ot=f.theme)==null?void 0:Ot.cta_background)||"#ffb43b",Tn=(Pt=J.button_bg_alpha)!=null?Pt:1,En=J.button_border_color||"#ffffff",Ln=(Bt=J.button_border_width)!=null?Bt:2,vn=(kt=J.button_border_alpha)!=null?kt:.2,ge=(Dt=d.cta_offset_y)!=null?Dt:160,H=new Te;H.roundRect(-ye/2,-me/2,ye,me,We);let Mn=An.replace("#","");H.fill({color:parseInt(Mn,16),alpha:Tn});let $n=En.replace("#","");H.stroke({color:parseInt($n,16),width:Ln,alpha:vn});let Le=new Te;Le.roundRect(-ye/2+2,-me/2+2,ye-4,me-4,We-2),Le.stroke({color:0,width:1,alpha:.15}),H.addChild(Le),H.position.set(0,ge),H.alpha=0,H.eventMode="static",H.cursor="pointer",p.addChild(H);let Fn=(R==null?void 0:R.text)||((It=f.ui)==null?void 0:It.cta_label_end)||"DOWNLOAD",He=(R==null?void 0:R.font)||"brand.heading",Nn=(R==null?void 0:R.fontSize)||20,Cn=J.button_text_color||((Rt=f.theme)==null?void 0:Rt.cta_text)||"#1a0a0a",re=new le({text:Fn,style:{fontFamily:V(He),fontSize:Nn,fontWeight:K(He),fill:Cn,align:"center",letterSpacing:(Yt=R==null?void 0:R.letterSpacing)!=null?Yt:1}});re.anchor.set(.5),re.position.set(0,ge),re.alpha=0,p.addChild(re);let Y=l==null?void 0:l.ui,qe=((zt=l==null?void 0:l.gameplay)==null?void 0:zt.tuning)||{},On=(Y==null?void 0:Y.text)||"Play the full game",Ge=(Y==null?void 0:Y.font)||"brand.body",Pn=(Y==null?void 0:Y.fontSize)||11,Bn=(Wt=Y==null?void 0:Y.letterSpacing)!=null?Wt:0,_e=(Ht=l==null?void 0:l.render)==null?void 0:Ht.tint,kn=typeof _e=="string"?_e:_e?`#${_e.toString(16).padStart(6,"0")}`:"#CCCCCC",oe=new le({text:On,style:{fontFamily:V(Ge),fontSize:Pn,fontWeight:K(Ge),fill:kn,align:"center",letterSpacing:Bn}});oe.anchor.set(.5);let Dn=ge+35+((qt=qe.animation_start_y_offset)!=null?qt:5);oe.position.set(0,Dn),oe.alpha=0,oe.animationStartYOffset=(Gt=qe.animation_start_y_offset)!=null?Gt:5,p.addChild(oe);let ve=((Jt=u==null?void 0:u.gameplay)==null?void 0:Jt.tuning)||{},In=(Xt=ve.hand_offset_x)!=null?Xt:50,Rn=(Vt=ve.hand_offset_y)!=null?Vt:50,Yn=(Qt=(Kt=u==null?void 0:u.transform)==null?void 0:Kt.scale)!=null?Qt:.1875,zn=(Zt=ve.hand_scale_multiplier)!=null?Zt:2.5,te=new en(e||Fe.EMPTY);return te.anchor.set(.5),te.scale.set(Yn*zn),te.position.set(In,ge+Rn),te.alpha=0,te.visible=!1,p.addChild(te),{panel:p,logo:M,title:j,subtitle:se,footer:ae,ctaButton:H,ctaText:re,ctaHint:oe,hand:te}}function Vn(n,e,t){var L,v,S,g,x,F,k,O;let o=e.objects.get("ui_endgame_1"),a=((L=o==null?void 0:o.gameplay)==null?void 0:L.tuning)||{},s=(v=a.animation_duration_ms)!=null?v:800,i=(S=a.fade_in_duration_ms)!=null?S:600,r=(g=a.scale_animation_intensity)!=null?g:.1,c=(x=a.logo_animation_delay_ms)!=null?x:100,l=(F=a.title_animation_delay_ms)!=null?F:200,u=(k=a.footer_animation_delay_ms)!=null?k:300,f=(O=a.cta_animation_delay_ms)!=null?O:400,{panel:p,logo:d,title:h,subtitle:y,footer:m,ctaButton:T,ctaText:b,ctaHint:w}=n;p.visible=!0;let A=Date.now(),E=()=>{let $=Date.now()-A,N=Math.min($/i,1),P=1-Math.pow(1-N,3);p.alpha=P,p.scale.set(1+r*(1-P)),N<1?requestAnimationFrame(E):(setTimeout(()=>Kn(d,s,e),c),setTimeout(()=>{Qn(h,s),setTimeout(()=>Zn(y,s),50)},l),setTimeout(()=>jn(m,s),u),setTimeout(()=>{Un(T,b,s),setTimeout(()=>es(w,s),50),t&&t()},f))};E()}function Kn(n,e,t){var p,d,h,y,m;let o=t==null?void 0:t.objects.get("ui_endgame_logo_1"),s=(d=(((p=o==null?void 0:o.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?d:1.2,i=Date.now(),r=n.alpha,c=(h=n.targetAlpha)!=null?h:1,l=(y=n.baseScaleX)!=null?y:n.scale.x,u=(m=n.baseScaleY)!=null?m:n.scale.y,f=()=>{let T=Date.now()-i,b=Math.min(T/e,1),w=1-Math.pow(1-b,2);n.alpha=r+(c-r)*w;let A=s+(1-s)*w;n.scale.set(l*A,u*A),b<1&&requestAnimationFrame(f)};f()}function Qn(n,e){let t=Date.now(),o=n.alpha,a=n.y,s=()=>{let i=Date.now()-t,r=Math.min(i/e,1),c=1-Math.pow(1-r,2);n.alpha=o+(1-o)*c,n.y=a-20*(1-c),r<1&&requestAnimationFrame(s)};s()}function Zn(n,e){var r;let t=Date.now(),o=n.alpha,a=n.position.y,s=a-((r=n.animationStartYOffset)!=null?r:-10),i=()=>{let c=Date.now()-t,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=a+(s-a)*u,l<1&&requestAnimationFrame(i)};i()}function jn(n,e){var i;let t=Date.now(),o=n.alpha,a=(i=n.targetAlpha)!=null?i:1,s=()=>{let r=Date.now()-t,c=Math.min(r/e,1),l=1-Math.pow(1-c,2);n.alpha=o+(a-o)*l,c<1&&requestAnimationFrame(s)};s()}function Un(n,e,t){let o=Date.now(),a=n.alpha,s=()=>{let i=Date.now()-o,r=Math.min(i/t,1),c=1-Math.pow(1-r,2);n.alpha=a+(1-a)*c,e.alpha=a+(1-a)*c,n.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(s)};s()}function es(n,e){var r;let t=Date.now(),o=n.alpha,a=n.position.y,s=a-((r=n.animationStartYOffset)!=null?r:5),i=()=>{let c=Date.now()-t,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=a+(s-a)*u,l<1&&requestAnimationFrame(i)};i()}function ts(n,e,t,o){var u,f,p,d;let a=t.objects.get("ui_endgame_hand_1"),s=((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{},i=(f=s.click_animation_duration_ms)!=null?f:600,r=(p=s.click_delay_ms)!=null?p:2e3,c=(d=s.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var L,v;n.visible=!0,n.alpha=1;let h=n.x,y=n.y,m=(L=s.hand_offset_x)!=null?L:50,T=(v=s.hand_offset_y)!=null?v:50,b=e.x+m,w=e.y+T,A=Date.now(),E=()=>{var $,N,P;let S=Date.now()-A,g=Math.min(S/i,1),x=g<.5?2*g*g:1-Math.pow(-2*g+2,2)/2;n.x=h+(b-h)*x,n.y=y+(w-y)*x;let F=(N=($=a==null?void 0:a.transform)==null?void 0:$.scale)!=null?N:.1875,k=(P=s.hand_scale_multiplier)!=null?P:2.5,O=F*k;n.scale.set(O+O*.2*Math.sin(g*Math.PI)),g<1?requestAnimationFrame(E):(e.scale.set(.95),setTimeout(()=>{e.scale.set(1),o()},100),setTimeout(()=>{n.alpha=0,setTimeout(()=>{n.x=h,n.y=y,l()},c)},500))};E()};setTimeout(l,r)}import{Sprite as ns,Text as ss}from"pixi.js";function as(n,e,t){var f,p,d,h;let o=e.objects.get("hand_tutorial_1")||e.objects.get("hand_1")||Array.from(e.objects.values()).find(y=>{var m;return((m=y==null?void 0:y.identity)==null?void 0:m.id)==="hand.tutorial"}),a=((f=o==null?void 0:o.gameplay)==null?void 0:f.tuning)||{},s=(o==null?void 0:o.render)||{},i=(o==null?void 0:o.transform)||{},r=new ns(n),c=s==null?void 0:s.anchor;c&&typeof c.x=="number"&&typeof c.y=="number"?r.anchor.set(c.x,c.y):r.anchor.set(.5),r.alpha=0;let l=(p=a.hand_scale_multiplier)!=null?p:2.5,u=(d=i.scale)!=null?d:.1875;return r.scale.set(u*l),r.zIndex=(h=s.z_index)!=null?h:99999,r}function os(n){var y,m,T,b,w,A,E,L,v,S;let e=n.objects.get("ui_tutorial_1")||n.objects.get("label_1")||Array.from(n.objects.values()).find(g=>{var x;return["ui.tutorial","label.warning"].includes((x=g==null?void 0:g.identity)==null?void 0:x.id)}),t=e==null?void 0:e.ui,o=(e==null?void 0:e.render)||{},a=((y=n.engine.runtime)==null?void 0:y.ui_styles)||{},s=((m=n.engine.runtime)==null?void 0:m.ui)||{},i=(t==null?void 0:t.text)||s.tutorial_label||s.label_text||"CLEAN!",r=(t==null?void 0:t.font)||"brand.warning",c=(t==null?void 0:t.fontSize)||a.label_font_size||52,l=(b=t==null?void 0:t.letterSpacing)!=null?b:(T=a.label_letter_spacing)!=null?T:-1,u=(t==null?void 0:t.align)||"center",f=o.tint,p=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",d=new ss({text:i,style:{fontFamily:V(r),fontSize:c,fontWeight:K(r),fill:p,align:u,letterSpacing:l,stroke:{color:a.label_stroke||"#8B0000",width:2},dropShadow:{color:a.label_shadow_color||"#000000",alpha:(w=a.label_shadow_alpha)!=null?w:.8,angle:(A=a.label_shadow_angle)!=null?A:0,blur:(E=a.label_shadow_blur)!=null?E:4,distance:(L=a.label_shadow_distance)!=null?L:2}}}),h=o==null?void 0:o.anchor;return h&&typeof h.x=="number"&&typeof h.y=="number"?d.anchor.set(h.x,h.y):d.anchor.set(.5,.5),d.alpha=(v=o.alpha)!=null?v:0,d.visible=(S=o.visible)!=null?S:!0,d}function is(n,e,t,o,a){var c,l,u,f,p,d,h,y,m,T,b,w,A,E,L,v,S;let s=a.objects.get("hand_tutorial_1")||a.objects.get("hand_1")||Array.from(a.objects.values()).find(g=>{var x;return((x=g==null?void 0:g.identity)==null?void 0:x.id)==="hand.tutorial"}),i=((c=s==null?void 0:s.gameplay)==null?void 0:c.tuning)||{},r=(s==null?void 0:s.transform)||{};if(!o){let g=(l=i.animation_duration)!=null?l:1.5,x=t%g/g,F=x<.5?2*x*x:-1+(4-2*x)*x,k=(h=(d=(p=(u=r.position)==null?void 0:u.x)!=null?p:(f=r.offset)==null?void 0:f.x)!=null?d:i.start_x_offset)!=null?h:0,O=(w=(b=(T=(y=r.position)==null?void 0:y.y)!=null?T:(m=r.offset)==null?void 0:m.y)!=null?b:i.start_y_offset)!=null?w:0,$=(A=i.x_offset)!=null?A:0,N=(E=i.y_offset)!=null?E:0,P=(L=i.animation_range)!=null?L:40,ee=P*.7,M=P,z=e.x+k+$+ee,W=e.y+O+N+M,C=z+ee,D=W+M;n.x=z+(C-z)*F,n.y=W+(D-W)*F;let Ee=(v=r.scale)!=null?v:.1875,ue=(S=i.hand_scale_multiplier)!=null?S:2.5;n.scale.set(Ee*ue)}}var ce=null;function rs(){return ce||(typeof window!="undefined"&&window.lottie?ce=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),ce=null)),ce}function ls(n){ce=n}function cs(n,e,t,o){var E,L,v,S,g,x,F,k,O,$,N,P,ee;let a=t.objects.get(n);if(!a)return console.warn(`[LottieOverlay] Object config not found: ${n}`),null;let s=((E=a.effects)==null?void 0:E.lottie)||{},i=a.transform||{},r=a.render||{};if(s.enabled===!1||r.visible===!1)return null;let c=o[n];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${n}`),null;let l=rs();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${n}`),null;let u=(L=s.width)!=null?L:300,f=(v=s.height)!=null?v:300,p=(S=i.scale)!=null?S:1,d=(x=(g=i.position)==null?void 0:g.x)!=null?x:0,h=(k=(F=i.position)==null?void 0:F.y)!=null?k:0,y=(O=i.rotation)!=null?O:0,m=($=r.z_index)!=null?$:100,T=(N=r.alpha)!=null?N:1,b=document.createElement("div");b.style.cssText=`
|
|
2
2
|
position: absolute;
|
|
3
|
-
top: calc(50% + ${
|
|
3
|
+
top: calc(50% + ${h}px);
|
|
4
4
|
left: calc(50% + ${d}px);
|
|
5
5
|
transform: translate(-50%, -50%) scale(${p}) rotate(${y}deg);
|
|
6
6
|
width: ${u}px;
|
|
7
|
-
height: ${
|
|
7
|
+
height: ${f}px;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
z-index: ${m};
|
|
10
|
-
opacity: ${
|
|
11
|
-
`,t.appendChild(_);let x=l.loadAnimation({container:_,renderer:a.renderer||"svg",loop:(R=a.loop)!=null?R:!1,autoplay:(it=a.autoplay)!=null?it:!0,animationData:c});a.speed!==void 0&&x.setSpeed(a.speed);let b=()=>{x.destroy(),_.parentNode&&_.parentNode.removeChild(_)};return a.loop||x.addEventListener("complete",b),{animation:x,cleanup:b}}import{Assets as et,Texture as aa}from"pixi.js";var X=class{static get(t){var e;return(e=this.store.get(t))==null?void 0:e.data}static set(t,e){this.store.set(t,{data:e})}static has(t){return this.store.has(t)}static clear(){this.store.clear()}};X.store=new Map;var sa=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] MODULE LOADED - __BUILD_MODE__: ${sa}`);var tt={},Lt=null;async function oa(){if(console.log(`[AssetLoader] getInlineAssets() called - __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`),Object.keys(tt).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(tt)),tt;if(!Lt){let t=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",t),Lt=(async()=>{try{try{let a=await import(t+"?t="+Date.now());if(a.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(a.INLINE_ASSETS)),a.INLINE_ASSETS}catch(a){console.warn("[AssetLoader] ES module import failed, trying text parse:",a)}let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);let o=await e.text();console.log("[AssetLoader] Received JS code, length:",o.length);let s=o.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(s)try{let a=s[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let r=new Function("return "+a)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(r)),r}catch(a){return console.warn("[AssetLoader] Failed to parse inline assets:",a),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",o.substring(0,500)),{}}catch(e){return console.warn("[AssetLoader] Failed to load inline assets:",e),{}}})()}return tt=await Lt,console.log("[AssetLoader] Final inline assets cache:",Object.keys(tt)),tt}var Ue=new Map;function Et(n){return n===null||typeof n!="object"||(Object.freeze(n),Object.values(n).forEach(t=>Et(t))),n}function ia(n=64,t=64,e=16711680){let o=document.createElement("canvas");o.width=n,o.height=t;let s=o.getContext("2d");return s.fillStyle=`#${e.toString(16).padStart(6,"0")}`,s.fillRect(0,0,n,t),s.strokeStyle="#000",s.strokeRect(0,0,n,t),s.fillStyle="#fff",s.font="10px sans-serif",s.textAlign="center",s.fillText("MISSING",n/2,t/2),aa.from(o)}function Mt(n,t){Ue.set(n,t)}var ot=class{static async load(t,e,o){let s=X.get(t);if(s!==void 0)return s;let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] Loading asset: ${t}, type: ${e.type}, __BUILD_MODE__: ${a}`);let i=(await oa())[t];if(console.log("[AssetLoader] Inline data for",t,":",i?"FOUND":"NOT FOUND"),a==="publish"&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!i))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${t}, path: ${e.path}`);let c=Ue.get(e.type);if(c)try{let l=await c(e.path,i,t,o);return X.set(t,l),l}catch(l){return this.handleFailure(t,e.type,l)}try{let l;switch(e.type){case"image":l=await this.loadImage(e.path,i);break;case"json":l=await this.loadJSON(e.path,i),l=Et(l);break;default:throw new Error(`Unknown asset type: ${e.type}`)}return X.set(t,l),l}catch(l){return this.handleFailure(t,e.type,l)}}static async loadImage(t,e){let o=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=o==="publish";if(console.log(`[AssetLoader] loadImage - __BUILD_MODE__: ${o}, isPublishMode: ${s}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${t}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);try{return await et.load(e)}catch(a){throw console.error("[AssetLoader] Failed to load texture from data URI:",a),a}}if(e&&e.startsWith("data:"))try{return await et.load(e)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await et.load(t)}return await et.load(t)}static async loadJSON(t,e){let o=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=o==="publish";if(console.log(`[AssetLoader] loadJSON - __BUILD_MODE__: ${o}, isPublishMode: ${s}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(e.startsWith("data:")){let r=atob(e.split(",")[1]);return JSON.parse(r)}return JSON.parse(e)}if(e){if(e.startsWith("data:")){let r=atob(e.split(",")[1]);return JSON.parse(r)}return JSON.parse(e)}let a=await fetch(t);if(!a.ok)throw new Error(`JSON fetch failed: ${t}`);return a.json()}static handleFailure(t,e,o){if(typeof __BUILD_MODE__!="undefined"&&__BUILD_MODE__==="dev"){let a=e==="image"?ia():Et({__placeholder:!0,type:e});return X.set(t,a),a}throw o}};Mt("image",async(n,t)=>{let e=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",o=e==="publish";if(console.log(`[AssetLoader] registerType('image') - __BUILD_MODE__: ${e}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);if(!t.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${t.substring(0,50)}...`);return et.load(t)}return et.load(t||n)});Mt("json",async(n,t)=>{let e=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",o=e==="publish";if(console.log(`[AssetLoader] registerType('json') - __BUILD_MODE__: ${e}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t)}if(t)return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t);let s=await fetch(n);if(!s.ok)throw new Error(`JSON fetch failed: ${n}`);return s.json()});import{Sprite as ra,Container as Ke}from"pixi.js";var vt=class{static async create(t,e,o){var c,l,u,h,p,d;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`);let a=(c=e==null?void 0:e.render)==null?void 0:c.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let f=new Ke;return this.applyTransform(f,e==null?void 0:e.transform),f}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, type: ${a.type}, path: ${a.path}`);let r=await ot.load(t,a,o);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(l=r==null?void 0:r.constructor)==null?void 0:l.name}`);let i;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",t),i=new ra(r),console.log("[ObjectFactory] Created object:",i,"type:",(u=i==null?void 0:i.constructor)==null?void 0:u.name),this.applyTransform(i,e==null?void 0:e.transform);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(h=r==null?void 0:r.constructor)==null?void 0:h.name,r),r&&(((p=r.constructor)==null?void 0:p.name)==="Container"||r instanceof Ke)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],y=!1;for(let m of f)try{let g=await fetch(m);if(g.ok){i=await g.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",m,"type:",(d=i==null?void 0:i.constructor)==null?void 0:d.name),y=!0;break}}catch{continue}y||(console.error("[ObjectFactory] Failed to reload JSON from any path"),i=r)}else i=r;else i=r,i&&typeof i=="object"&&("x"in i||"position"in i)&&this.applyTransform(i,e==null?void 0:e.transform);return i}static applyTransform(t,e){var o,s,a,r;!e||!t||(e.position&&("x"in t&&"y"in t?(t.x=(o=e.position.x)!=null?o:0,t.y=(s=e.position.y)!=null?s:0):"position"in t&&t.position&&t.position.set((a=e.position.x)!=null?a:0,(r=e.position.y)!=null?r:0)),e.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(e.scale):t.scale=e.scale),e.rotation!==void 0&&"rotation"in t&&(t.rotation=e.rotation),e.anchor&&"anchor"in t&&t.anchor&&Array.isArray(e.anchor)&&("set"in t.anchor?t.anchor.set(e.anchor[0],e.anchor[1]):(t.anchor.x=e.anchor[0],t.anchor.y=e.anchor[1])))}};export{X as AssetCache,ot as AssetLoader,_t as GameObject,Tt as GameObjectManager,vt as ObjectFactory,mt as Renderer,yt as Transform,Vn as animateHandClick,zn as animatePanelEntrance,Yn as createEndGamePanel,Qn as createHandTutorial,Nn as createPixiBase,Zn as createTutorialLabel,Rn as getRegisteredFontIds,na as playLottieOverlay,kn as registerFont,Mt as registerType,J as resolveFont,G as resolveFontWeight,ea as setLottieInstance,jn as updateHandAnimation};
|
|
10
|
+
opacity: ${T};
|
|
11
|
+
`,e.appendChild(b);let w=l.loadAnimation({container:b,renderer:s.renderer||"svg",loop:(P=s.loop)!=null?P:!1,autoplay:(ee=s.autoplay)!=null?ee:!0,animationData:c});s.speed!==void 0&&w.setSpeed(s.speed);let A=()=>{w.destroy(),b.parentNode&&b.parentNode.removeChild(b)};return s.loop||w.addEventListener("complete",A),{animation:w,cleanup:A}}import{Assets as ie,Texture as ds}from"pixi.js";var Q=class{static get(e){var t;return(t=this.store.get(e))==null?void 0:t.data}static set(e,t){this.store.set(e,{data:t})}static has(e){return this.store.has(e)}static clear(){this.store.clear()}};Q.store=new Map;function us(){var n,e;try{let t=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((e=(n=document.querySelector("script"))==null?void 0:n.textContent)==null?void 0:e.includes("inline-assets.js"))||window.INLINE_ASSETS),o=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(t&&!o)}catch{return!1}}async function ps(){try{if(typeof window!="undefined"){let n=await fetch("./build-settings.json");if(n.ok){let e=await n.json();return console.log("[AssetLoader] Loaded build settings:",e),e}}}catch{}return null}function fs(){try{if(typeof window!="undefined"){let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",e),e}}}catch{}return null}var tn=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",nn=us(),ne=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,_=nn?"publish":tn,q=ne==null?void 0:ne.assetsInlined;ne!=null&&ne.buildMode&&(_=ne.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${_}`));var U=fs();U!=null&&U.buildMode&&(_=U.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${_}`));(U==null?void 0:U.assetsInlined)!==void 0&&(q=U.assetsInlined);ps().then(n=>{n!=null&&n.buildMode&&n.buildMode!==_&&(_=n.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${_}`)),(n==null?void 0:n.assetsInlined)!==void 0&&(q=n.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${tn}, Runtime: ${nn?"publish":"dev"}, Effective: ${_}`);var Z={},Ne=null;async function hs(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${_}`),Object.keys(Z).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Z)),Z;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Z={...window.INLINE_ASSETS},Z;if(!(_==="publish"&&q!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Z;if(!Ne){let e=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",e),Ne=(async()=>{try{try{let s=await import(e+"?t="+Date.now());if(s.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(s.INLINE_ASSETS)),s.INLINE_ASSETS}catch(s){console.warn("[AssetLoader] ES module import failed, trying text parse:",s)}let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);let o=await t.text();console.log("[AssetLoader] Received JS code, length:",o.length);let a=o.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(a)try{let s=a[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let i=new Function("return "+s)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(i)),i}catch(s){return console.warn("[AssetLoader] Failed to parse inline assets:",s),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",o.substring(0,500)),{}}catch(t){return console.warn("[AssetLoader] Failed to load inline assets:",t),{}}})()}return Z=await Ne,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Z)),Z}var sn=new Map;function Ce(n){return n===null||typeof n!="object"||(Object.freeze(n),Object.values(n).forEach(e=>Ce(e))),n}function ys(n=64,e=64,t=16711680){let o=document.createElement("canvas");o.width=n,o.height=e;let a=o.getContext("2d");return a.fillStyle=`#${t.toString(16).padStart(6,"0")}`,a.fillRect(0,0,n,e),a.strokeStyle="#000",a.strokeRect(0,0,n,e),a.fillStyle="#fff",a.font="10px sans-serif",a.textAlign="center",a.fillText("MISSING",n/2,e/2),ds.from(o)}function Oe(n,e){sn.set(n,e)}var de=class{static async load(e,t,o){let a=Q.get(e);if(a!==void 0)return a;console.log(`[AssetLoader] Loading asset: ${e}, type: ${t.type}, Effective mode: ${_}`),console.log(`[AssetLoader] Window defined: ${typeof window!="undefined"}, INLINE_ASSETS exists: ${!!(typeof window!="undefined"&&window.INLINE_ASSETS)}, keys: ${typeof window!="undefined"&&window.INLINE_ASSETS?Object.keys(window.INLINE_ASSETS).length:"N/A"}`);let s=await hs(),i=s[e];if(!i&&t.path){let l=t.path.split("/");if(l.length>=2){let u=l[l.length-1].split(".")[0],f=l[0],p=[`${u}.layer`,`${u}.player`,`${u}.tutorial`,`effects.${u}`,`ui.endgame.${u}`,u];for(let d of p)if(s[d]){i=s[d],console.log(`[AssetLoader] Found inline data for ${e} using derived key: ${d}`);break}}}if(console.log("[AssetLoader] Inline data for",e,":",i?"FOUND":"NOT FOUND"),_==="publish"&&q!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!i))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${e}, path: ${t.path}`);let c=sn.get(t.type);if(c)try{let l=await c(t.path,i,e,o);return Q.set(e,l),l}catch(l){return this.handleFailure(e,t.type,l)}try{let l;switch(t.type){case"image":l=await this.loadImage(t.path,i);break;case"json":l=await this.loadJSON(t.path,i),l=Ce(l);break;default:throw new Error(`Unknown asset type: ${t.type}`)}return Q.set(e,l),l}catch(l){return this.handleFailure(e,t.type,l)}}static async loadImage(e,t){let o=_==="publish",a=o&&q!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${_}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${e}`);if(!t.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${t.substring(0,50)}...`);try{return await ie.load(t)}catch(s){throw console.error("[AssetLoader] Failed to load texture from data URI:",s),s}}if(t&&t.startsWith("data:"))try{return await ie.load(t)}catch(s){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",s),await ie.load(e)}return await ie.load(e)}static async loadJSON(e,t){let o=_==="publish",a=o&&q!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${_}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(t.startsWith("data:")){let i=atob(t.split(",")[1]);return JSON.parse(i)}return JSON.parse(t)}if(t){if(t.startsWith("data:")){let i=atob(t.split(",")[1]);return JSON.parse(i)}return JSON.parse(t)}let s=await fetch(e);if(!s.ok)throw new Error(`JSON fetch failed: ${e}`);return s.json()}static handleFailure(e,t,o){if(_==="dev"){let s=t==="image"?ys():Ce({__placeholder:!0,type:t});return Q.set(e,s),s}throw o}};Oe("image",async(n,e)=>{let t=_==="publish",o=t&&q!==!1,a=_==="brand",s=t&&q===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${_}, isPublishMode: ${t}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);return ie.load(e)}let i=n;return(a||s)&&n&&!n.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(i=n,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${n}" as-is`)):(i=`assets/${n}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${n}" -> "${i}"`))),ie.load(e||i)});Oe("json",async(n,e)=>{let t=_==="publish",o=t&&q!==!1,a=_==="brand",s=t&&q===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${_}, isPublishMode: ${t}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}let i=n;if((a||s)&&n&&!n.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(i=n,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${n}" as-is`)):(i=`assets/${n}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${n}" -> "${i}"`))),e)return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let r=await fetch(i);if(!r.ok)throw new Error(`JSON fetch failed: ${n}`);return r.json()});import{Sprite as ms,Container as an}from"pixi.js";var gs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Pe=gs;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(Pe=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Pe}`))}}catch{}var Be=class{static async create(e,t,o){var r,c,l,u,f,p;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${Pe}`);let a=(r=t==null?void 0:t.render)==null?void 0:r.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let d=new an;return this.applyTransform(d,t==null?void 0:t.transform),d}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, type: ${a.type}, path: ${a.path}`);let s=await de.load(e,a,o);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let i;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",e),i=new ms(s),console.log("[ObjectFactory] Created object:",i,"type:",(l=i==null?void 0:i.constructor)==null?void 0:l.name),this.applyTransform(i,t==null?void 0:t.transform);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=s==null?void 0:s.constructor)==null?void 0:u.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof an)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let d=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],h=!1;for(let y of d)try{let m=await fetch(y);if(m.ok){i=await m.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",y,"type:",(p=i==null?void 0:i.constructor)==null?void 0:p.name),h=!0;break}}catch{continue}h||(console.error("[ObjectFactory] Failed to reload JSON from any path"),i=s)}else i=s;else i=s,i&&typeof i=="object"&&("x"in i||"position"in i)&&this.applyTransform(i,t==null?void 0:t.transform);return i}static applyTransform(e,t){var o,a,s,i;!t||!e||(t.position&&("x"in e&&"y"in e?(e.x=(o=t.position.x)!=null?o:0,e.y=(a=t.position.y)!=null?a:0):"position"in e&&e.position&&e.position.set((s=t.position.x)!=null?s:0,(i=t.position.y)!=null?i:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor&&Array.isArray(t.anchor)&&("set"in e.anchor?e.anchor.set(t.anchor[0],t.anchor[1]):(e.anchor.x=t.anchor[0],e.anchor.y=t.anchor[1])))}};export{Q as AssetCache,de as AssetLoader,Se as GameObject,$e as GameObjectManager,Be as ObjectFactory,we as Renderer,xe as Transform,ts as animateHandClick,Vn as animatePanelEntrance,Xn as createEndGamePanel,as as createHandTutorial,Hn as createPixiBase,os as createTutorialLabel,Gn as getRegisteredFontIds,cs as playLottieOverlay,qn as registerFont,Oe as registerType,V as resolveFont,K as resolveFontWeight,ls as setLottieInstance,is as updateHandAnimation};
|
package/dist/three/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ga=Object.create;var Pe=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var wa=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var _a=(e,t)=>{for(var n in t)Pe(e,n,{get:t[n],enumerable:!0})},jn=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wa(t))!xa.call(e,a)&&a!==n&&Pe(e,a,{get:()=>t[a],enumerable:!(i=ba(t,a))||i.enumerable});return e};var we=(e,t,n)=>(n=e!=null?ga(Ea(e)):{},jn(t||!e||!e.__esModule?Pe(n,"default",{value:e,enumerable:!0}):n,e)),Ta=e=>jn(Pe({},"__esModule",{value:!0}),e);var Ia={};_a(Ia,{AspectClass:()=>ut,GameObject:()=>Ce,GameObjectManager:()=>Ve,Renderer:()=>Ae,ResponsiveUISystem:()=>fe,Transform:()=>Re,animateHandClick:()=>_i,animatePanelEntrance:()=>xi,createBrushTexture:()=>Hi,createEndGamePanel:()=>Ei,createHandTutorial:()=>Ti,createThreeBase:()=>gi,createTutorialLabel:()=>vi,getAspectClass:()=>Ge,getRegisteredFontIds:()=>wi,loadAsset:()=>yt,loadCharacterFrames:()=>Ci,registerFont:()=>bi,resolveFont:()=>Y,resolveFontWeight:()=>G,updateHandAnimation:()=>Si});module.exports=Ta(Ia);var O=we(require("three"));var Z={};function We(e,t,n=!1){Z[e]||(Z[e]=[]),Z[e].push({fn:t,once:n})}function st(e,t){if(Z[e]){if(!t){delete Z[e];return}Z[e]=Z[e].filter(n=>n.fn!==t)}}function ze(e,...t){let n=Z[e];if(n)for(let i of[...n])i.fn(...t),i.once&&st(e,i.fn)}function z(e,t){We(e,t,!0)}var Be={name:"handler-playable-sdk",version:"0.2.7",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var B=0,Sa=B++,In=B++,Yn=B++,Gn=B++,Vn=B++,qn=B++,Xn=B++,Kn=B++,Jn=B++,Zn=B++,Qn=B++,Un=B++,v=Sa;function ei(){return v===In}function ti(){return v===Yn}function ni(){return v===Gn}function ii(){return v===Vn}function le(){return v===qn}function ce(){return v===Xn}function ai(){return v===Kn}function si(){return v===Jn}function oi(){return v===Zn}function ot(){return v===Qn}function rt(){return v===Un}function ri(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),v=In;return}catch{}else if(e==="dapi")try{dapi.isReady(),v=Yn;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(v=Gn)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(v=Vn)}catch{}else if(t==="mintegral")window.gameReady&&(v=qn);else if(t==="tapjoy")window.TJ_API&&(v=Xn);else if(t==="tiktok")window.openAppStore&&(v=Kn);else if(t==="smadex")try{window.smxTracking&&(v=Jn)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(v=Zn)}catch{}else t==="vungle"?v=Qn:(e==="nucleo"||t==="nucleo")&&(v=Un)}var ui={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Ra=Math.random().toString(36).slice(2),de=null,xe={...ui},hi="web_embed",Aa={},lt=!1,Ee=!1,Te=!1,fi=!1,mt=1,dt=0,Ie=!1,K=!1,je="",pe=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),pt=pe>me,J=!1,_e=!1,li=!1,ci=!1,ct=!1,Ne=null;function di(){if(de)return de;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),de=e,e}function Oe(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function yi(e,t){return{event_name:e,ts:Date.now(),session_id:Ra,deployment_id:xe.deployment_id,variant_id:xe.variant_id,export_profile_id:xe.profile_id,instance_id:xe.instance_id||"default",env:hi==="mraid"?"mraid":"web",payload:t}}function w(e,t){let n=Oe(e),i=yi(n,t);ze(n,i),n!==e&&ze(e,i)}function ve(){Ne&&(Ne(pe,me),Ne=null)}function ue(e){mt=e,w("volume",e)}function he(e){e&&(fi=!0),!Te&&(Te=!0,w("pause"),ue(0))}function Se(e){!e&&fi||Te&&(Te=!1,w("resume"),ue(mt))}function U(e,t){pe=Math.floor(e||window.innerWidth),me=Math.floor(t||window.innerHeight),pt=pe>me,w("resize",{width:pe,height:me})}function Ca(){if(ei())try{let e=mraid.getMaxSize();U(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Se():he()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();U(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ue(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ue(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),Ie=!0,mraid.isViewable()&&mraid.getState()!=="hidden")J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ha(){if(ti())try{let e=dapi.getScreenSize();U(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Se():he()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();U(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(ue(t?1:0),dapi.addEventListener("audioVolumeChange",n=>ue(n?1:0)),Ie=!0,dapi.isViewable())J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function pi(){let e=()=>{J||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(J=!0,w("boot"),w("view"),w("ready"),K=!0,ve(),_e&&(_e=!1,Q.start()))};window.addEventListener("resize",()=>U()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Se(),e()):he()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),Ie=!0}function Ma(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(li=!0),!(li&&t instanceof MouseEvent)&&(dt+=1,w("interaction",dt))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function La(e){var i,a,s,r,u,l,m,p,y,f,h,g;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(ce())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(ni())(u=(r=window.FbPlayableAd)==null?void 0:r.onCTAClick)==null||u.call(r);else if(oi())(m=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||m.call(l);else if(si())try{(y=(p=window.smxTracking)==null?void 0:p.redirect)==null||y.call(p)}catch(o){console.warn("Smadex redirect failed",o)}else if(ii()){let o=window.ExitApi;o&&typeof o.exit=="function"?o.exit(e||je||""):e&&window.open(e)}else le()?(f=window.install)==null||f.call(window):ai()?(h=window.openAppStore)==null||h.call(window):ot()?(g=parent==null?void 0:parent.postMessage)==null||g.call(parent,"download","*"):e&&window.open(e)}function ka(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;z("view",()=>t(n.mraid_viewable)),z("start",()=>t(n.game_viewable)),z("engagement",()=>t(n.engagement));let i=()=>t(n.complete);z("complete",i),We("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),z("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;z("view",()=>t(n.Ad_Load_Start)),z("start",()=>t(n.Ad_Viewable)),z("engagement",()=>t(n.First_Engagement)),z("complete",()=>t(n.Gameplay_Complete)),z("cta_click",()=>t(n.DSP_Click)),z("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Fa(){if(!ce())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Q.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function mi(){var t,n,i;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(n=e==null?void 0:e.playableFinished)==null||n.call(e),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Da(){le()&&(window.mintGameStart=()=>{Se(!0),U()},window.mintGameClose=()=>{he(!0)})}function $a(){if(!rt())return;let e=window.NUC;!e||!e.trigger||(Q.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,je)}),Q.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var Q={init(e={},t){if(hi=e.profile||"web_embed",Aa=e.consent||{},xe={...ui,...e.ids||{}},de=e.rootEl||de,je=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(Ne=t),w("init"),document.body.oncontextmenu=()=>!1,di(),Pa(de),ri(),Ca(),Ha(),!Ie){if(document.readyState==="complete")pi();else if(!ci){ci=!0;let n=()=>{pi(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Ma(),ka(),Fa(),Da(),$a(),console.log(`%c @handler/playable-sdk %c v${Be.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),J&&!K&&(w("boot"),w("view"),w("ready"),_e&&(_e=!1,Q.start()),K=!0),K=J},getRoot(){return di()},get version(){return Be.version||"0.0.0"},get maxWidth(){return pe},get maxHeight(){return me},get isLandscape(){return pt},get isReady(){return K},get isStarted(){return lt},get isPaused(){return Te},get isFinished(){return Ee},get volume(){return mt},get interactions(){return dt},on(e,t){We(Oe(e),t)},off(e,t){st(Oe(e),t)},start(){var e,t;if(!lt){if(!J){_e=!0;return}if(lt=!0,w("start"),U(),le())he(),(e=window.gameReady)==null||e.call(window);else if(ce()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:pt?"landscape":"portrait",buildID:Be.version||"dev"})}}},finish(){var e,t;Ee||(Ee=!0,w("complete"),le()?(e=window.gameEnd)==null||e.call(window):ot()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):ce()&&mi())},install(e){if(!Ee){Ee=!0,ce()?(mi(),setTimeout(()=>Q.install(e),300)):(w("complete"),setTimeout(()=>Q.install(e),0));return}ct||(ct=!0,setTimeout(()=>ct=!1,500),w("cta_click"),w("conversion"),La(e||je))},emit(e,t){let n=Oe(e);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=yi(n,t);ze(n,i)},retry(){var e,t,n;if(le())(e=window.gameRetry)==null||e.call(window);else if(rt()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}w("engagement",{action:"retry"})},pause(){he(!0)},resume(){Se(!0)},resize(e,t){U(e,t)}},Ye=Q;function Pa(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1
|
+
"use strict";var ga=Object.create;var Pe=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var wa=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var _a=(e,t)=>{for(var n in t)Pe(e,n,{get:t[n],enumerable:!0})},jn=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wa(t))!xa.call(e,a)&&a!==n&&Pe(e,a,{get:()=>t[a],enumerable:!(i=ba(t,a))||i.enumerable});return e};var we=(e,t,n)=>(n=e!=null?ga(Ea(e)):{},jn(t||!e||!e.__esModule?Pe(n,"default",{value:e,enumerable:!0}):n,e)),Ta=e=>jn(Pe({},"__esModule",{value:!0}),e);var Ia={};_a(Ia,{AspectClass:()=>ut,GameObject:()=>Ce,GameObjectManager:()=>Ve,Renderer:()=>Ae,ResponsiveUISystem:()=>fe,Transform:()=>Re,animateHandClick:()=>_i,animatePanelEntrance:()=>xi,createBrushTexture:()=>Hi,createEndGamePanel:()=>Ei,createHandTutorial:()=>Ti,createThreeBase:()=>gi,createTutorialLabel:()=>vi,getAspectClass:()=>Ge,getRegisteredFontIds:()=>wi,loadAsset:()=>yt,loadCharacterFrames:()=>Ci,registerFont:()=>bi,resolveFont:()=>Y,resolveFontWeight:()=>G,updateHandAnimation:()=>Si});module.exports=Ta(Ia);var O=we(require("three"));var Z={};function We(e,t,n=!1){Z[e]||(Z[e]=[]),Z[e].push({fn:t,once:n})}function st(e,t){if(Z[e]){if(!t){delete Z[e];return}Z[e]=Z[e].filter(n=>n.fn!==t)}}function ze(e,...t){let n=Z[e];if(n)for(let i of[...n])i.fn(...t),i.once&&st(e,i.fn)}function z(e,t){We(e,t,!0)}var Be={name:"handler-playable-sdk",version:"0.3.1",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var B=0,Sa=B++,In=B++,Yn=B++,Gn=B++,Vn=B++,qn=B++,Xn=B++,Kn=B++,Jn=B++,Zn=B++,Qn=B++,Un=B++,v=Sa;function ei(){return v===In}function ti(){return v===Yn}function ni(){return v===Gn}function ii(){return v===Vn}function le(){return v===qn}function ce(){return v===Xn}function ai(){return v===Kn}function si(){return v===Jn}function oi(){return v===Zn}function ot(){return v===Qn}function rt(){return v===Un}function ri(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),v=In;return}catch{}else if(e==="dapi")try{dapi.isReady(),v=Yn;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(v=Gn)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(v=Vn)}catch{}else if(t==="mintegral")window.gameReady&&(v=qn);else if(t==="tapjoy")window.TJ_API&&(v=Xn);else if(t==="tiktok")window.openAppStore&&(v=Kn);else if(t==="smadex")try{window.smxTracking&&(v=Jn)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(v=Zn)}catch{}else t==="vungle"?v=Qn:(e==="nucleo"||t==="nucleo")&&(v=Un)}var ui={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Ra=Math.random().toString(36).slice(2),de=null,xe={...ui},hi="web_embed",Aa={},lt=!1,Ee=!1,Te=!1,fi=!1,mt=1,dt=0,Ie=!1,K=!1,je="",pe=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),pt=pe>me,J=!1,_e=!1,li=!1,ci=!1,ct=!1,Ne=null;function di(){if(de)return de;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),de=e,e}function Oe(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function yi(e,t){return{event_name:e,ts:Date.now(),session_id:Ra,deployment_id:xe.deployment_id,variant_id:xe.variant_id,export_profile_id:xe.profile_id,instance_id:xe.instance_id||"default",env:hi==="mraid"?"mraid":"web",payload:t}}function w(e,t){let n=Oe(e),i=yi(n,t);ze(n,i),n!==e&&ze(e,i)}function ve(){Ne&&(Ne(pe,me),Ne=null)}function ue(e){mt=e,w("volume",e)}function he(e){e&&(fi=!0),!Te&&(Te=!0,w("pause"),ue(0))}function Se(e){!e&&fi||Te&&(Te=!1,w("resume"),ue(mt))}function U(e,t){pe=Math.floor(e||window.innerWidth),me=Math.floor(t||window.innerHeight),pt=pe>me,w("resize",{width:pe,height:me})}function Ca(){if(ei())try{let e=mraid.getMaxSize();U(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Se():he()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();U(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ue(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ue(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),Ie=!0,mraid.isViewable()&&mraid.getState()!=="hidden")J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ha(){if(ti())try{let e=dapi.getScreenSize();U(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Se():he()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();U(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(ue(t?1:0),dapi.addEventListener("audioVolumeChange",n=>ue(n?1:0)),Ie=!0,dapi.isViewable())J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function pi(){let e=()=>{J||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(J=!0,w("boot"),w("view"),w("ready"),K=!0,ve(),_e&&(_e=!1,Q.start()))};window.addEventListener("resize",()=>U()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Se(),e()):he()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),Ie=!0}function Ma(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(li=!0),!(li&&t instanceof MouseEvent)&&(dt+=1,w("interaction",dt))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function La(e){var i,a,s,r,u,l,m,p,y,f,h,g;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(ce())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(ni())(u=(r=window.FbPlayableAd)==null?void 0:r.onCTAClick)==null||u.call(r);else if(oi())(m=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||m.call(l);else if(si())try{(y=(p=window.smxTracking)==null?void 0:p.redirect)==null||y.call(p)}catch(o){console.warn("Smadex redirect failed",o)}else if(ii()){let o=window.ExitApi;o&&typeof o.exit=="function"?o.exit(e||je||""):e&&window.open(e)}else le()?(f=window.install)==null||f.call(window):ai()?(h=window.openAppStore)==null||h.call(window):ot()?(g=parent==null?void 0:parent.postMessage)==null||g.call(parent,"download","*"):e&&window.open(e)}function ka(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;z("view",()=>t(n.mraid_viewable)),z("start",()=>t(n.game_viewable)),z("engagement",()=>t(n.engagement));let i=()=>t(n.complete);z("complete",i),We("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),z("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;z("view",()=>t(n.Ad_Load_Start)),z("start",()=>t(n.Ad_Viewable)),z("engagement",()=>t(n.First_Engagement)),z("complete",()=>t(n.Gameplay_Complete)),z("cta_click",()=>t(n.DSP_Click)),z("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Fa(){if(!ce())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Q.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function mi(){var t,n,i;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(n=e==null?void 0:e.playableFinished)==null||n.call(e),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Da(){le()&&(window.mintGameStart=()=>{Se(!0),U()},window.mintGameClose=()=>{he(!0)})}function $a(){if(!rt())return;let e=window.NUC;!e||!e.trigger||(Q.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,je)}),Q.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var Q={init(e={},t){if(hi=e.profile||"web_embed",Aa=e.consent||{},xe={...ui,...e.ids||{}},de=e.rootEl||de,je=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(Ne=t),w("init"),document.body.oncontextmenu=()=>!1,di(),Pa(de),ri(),Ca(),Ha(),!Ie){if(document.readyState==="complete")pi();else if(!ci){ci=!0;let n=()=>{pi(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Ma(),ka(),Fa(),Da(),$a(),console.log(`%c @handler/playable-sdk %c v${Be.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),J&&!K&&(w("boot"),w("view"),w("ready"),_e&&(_e=!1,Q.start()),K=!0),K=J},getRoot(){return di()},get version(){return Be.version||"0.0.0"},get maxWidth(){return pe},get maxHeight(){return me},get isLandscape(){return pt},get isReady(){return K},get isStarted(){return lt},get isPaused(){return Te},get isFinished(){return Ee},get volume(){return mt},get interactions(){return dt},on(e,t){We(Oe(e),t)},off(e,t){st(Oe(e),t)},start(){var e,t;if(!lt){if(!J){_e=!0;return}if(lt=!0,w("start"),U(),le())he(),(e=window.gameReady)==null||e.call(window);else if(ce()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:pt?"landscape":"portrait",buildID:Be.version||"dev"})}}},finish(){var e,t;Ee||(Ee=!0,w("complete"),le()?(e=window.gameEnd)==null||e.call(window):ot()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):ce()&&mi())},install(e){if(!Ee){Ee=!0,ce()?(mi(),setTimeout(()=>Q.install(e),300)):(w("complete"),setTimeout(()=>Q.install(e),0));return}ct||(ct=!0,setTimeout(()=>ct=!1,500),w("cta_click"),w("conversion"),La(e||je))},emit(e,t){let n=Oe(e);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=yi(n,t);ze(n,i)},retry(){var e,t,n;if(le())(e=window.gameRetry)==null||e.call(window);else if(rt()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}w("engagement",{action:"retry"})},pause(){he(!0)},resume(){Se(!0)},resize(e,t){U(e,t)}},Ye=Q;function Pa(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
2
2
|
(function(){
|
|
3
3
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
4
|
function unlock(){
|
package/dist/three/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as dt}from"../chunk-
|
|
1
|
+
import{b as dt}from"../chunk-U4PCKCX6.mjs";import*as D from"three";var tn=(a=>(a[a.PHONE_TALL=0]="PHONE_TALL",a[a.TABLET=1]="TABLET",a[a.LANDSCAPE=2]="LANDSCAPE",a))(tn||{});function Rt(e,t){let n=e/t;return n<=.62?0:n<=.85?1:2}var nt=class{constructor(t,n){this.root=t,this.stage=n,this.uiFrame=document.createElement("div"),this.uiFrame.style.position="absolute",this.uiFrame.style.top="0",this.uiFrame.style.bottom="0",this.uiFrame.style.left="50%",this.uiFrame.style.transform="translateX(-50%)",this.uiFrame.style.width="100%",this.uiFrame.style.maxWidth="420px",this.uiFrame.style.pointerEvents="none",this.stage.appendChild(this.uiFrame),this.uiContainer=document.createElement("div"),this.uiContainer.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","justify-content:flex-start","gap:12px","pointer-events:none","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),this.uiFrame.appendChild(this.uiContainer),this.updateLayout()}getUIFrame(){return this.uiFrame}getUIContainer(){return this.uiContainer}updateLayout(){let t=this.stage.getBoundingClientRect(),n=Rt(t.width,t.height);n===0?this.uiFrame.style.maxWidth="420px":n===1?this.uiFrame.style.maxWidth="520px":this.uiFrame.style.maxWidth="640px"}getAspectClass(){let t=this.stage.getBoundingClientRect();return Rt(t.width,t.height)}};async function Vn(e,t={}){let n=()=>{let d=e.getBoundingClientRect(),r=Math.floor(d.width),E=Math.floor(d.height);return(r<=0||!isFinite(r)||r!==r)&&(r=e.clientWidth||window.innerWidth||320),(E<=0||!isFinite(E)||E!==E)&&(E=e.clientHeight||window.innerHeight||480),(r<=0||!isFinite(r)||r!==r)&&(r=320),(E<=0||!isFinite(E)||E!==E)&&(E=480),console.log("[THREE-BASE] getSize result:",{width:r,height:E,boundingRect:{width:d.width,height:d.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleWidth:e.style.width,styleHeight:e.style.height,note:"Using boundingRect as primary source (actual rendered size)"}),{width:r,height:E}},a=e.style.width&&!e.style.width.includes("%"),i=e.style.height&&!e.style.height.includes("%");e.style.position||(e.style.position="relative"),e.style.display||(e.style.display="block"),e.style.width=e.style.width||"100%",e.style.height=e.style.height||"100%",e.style.minWidth="100%",e.style.minHeight="100%",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.boxSizing="border-box",e.style.overflow="hidden",e.style.margin="0",e.style.padding="0",e.style.border="none";let s=t.background||"linear-gradient(160deg, #0d1020, #0f1c2f)";e.style.setProperty("background",s,"important"),e.style.setProperty("background-size","cover","important"),e.style.setProperty("background-position","center","important"),e.style.setProperty("background-repeat","no-repeat","important");let l=document.createElement("div");l.style.cssText=`
|
|
2
2
|
position: absolute !important;
|
|
3
3
|
inset: 0 !important;
|
|
4
4
|
width: 100% !important;
|
package/package.json
CHANGED