handler-playable-sdk 0.2.7 → 0.3.2

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.
@@ -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 ws=Object.create;var st=Object.defineProperty;var Es=Object.getOwnPropertyDescriptor;var Ss=Object.getOwnPropertyNames;var _s=Object.getPrototypeOf,Ts=Object.prototype.hasOwnProperty;var je=(e,t)=>()=>(e&&(t=e(e=0)),t);var Cs=(e,t)=>{for(var n in t)st(e,n,{get:t[n],enumerable:!0})},Ii=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ss(t))!Ts.call(e,a)&&a!==n&&st(e,a,{get:()=>t[a],enumerable:!(i=Es(t,a))||i.enumerable});return e};var re=(e,t,n)=>(n=e!=null?ws(_s(e)):{},Ii(t||!e||!e.__esModule?st(n,"default",{value:e,enumerable:!0}):n,e)),Ls=e=>Ii(st({},"__esModule",{value:!0}),e);var ft=je(()=>{"use strict"});var ra,ve,fl,Vt=je(()=>{"use strict";ft();ra=null,ve="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)ra=e,ve=e.buildMode,console.log("[CONFIG] Loaded inline build settings:",e,"buildMode:",ve);else try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let n=JSON.parse(t.responseText);ra=n,ve=n.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",n,"buildMode:",ve)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",ve)}catch(t){console.log("[CONFIG] Failed to load build-settings.json:",t instanceof Error?t.message:String(t))}}console.log("[CONFIG] Final buildMode:",ve);fl=ve==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});var Xt=je(()=>{"use strict"});var ca=je(()=>{"use strict";Xt();Vt()});var Kt=je(()=>{"use strict";Vt();Xt();ca()});var Bo={};Cs(Bo,{AspectClass:()=>an,GameObject:()=>Je,GameObjectManager:()=>Et,Renderer:()=>Ke,ResponsiveUISystem:()=>Ie,Transform:()=>Xe,animateHandClick:()=>Ca,animatePanelEntrance:()=>Ta,createBrushTexture:()=>Oa,createEndGamePanel:()=>_a,createHandTutorial:()=>La,createThreeBase:()=>wa,createTutorialLabel:()=>Aa,getAspectClass:()=>wt,getRegisteredFontIds:()=>Sa,loadAsset:()=>rn,loadCharacterFrames:()=>Ia,registerFont:()=>Ea,resolveFont:()=>V,resolveFontWeight:()=>X,updateHandAnimation:()=>Ma});module.exports=Ls(Bo);var q=re(require("three"));var le={};function ot(e,t,n=!1){le[e]||(le[e]=[]),le[e].push({fn:t,once:n})}function Pt(e,t){if(le[e]){if(!t){delete le[e];return}le[e]=le[e].filter(n=>n.fn!==t)}}function rt(e,...t){let n=le[e];if(n)for(let i of[...n])i.fn(...t),i.once&&Pt(e,i.fn)}function F(e,t){ot(e,t,!0)}var $=0,As=$++,Oi=$++,Hi=$++,Pi=$++,ji=$++,Bi=$++,Di=$++,zi=$++,Fi=$++,$i=$++,Ni=$++,Gi=$++,C=As;function qi(){return C===Oi}function Wi(){return C===Hi}function Yi(){return C===Pi}function Ui(){return C===ji}function Se(){return C===Bi}function _e(){return C===Di}function Vi(){return C===zi}function Xi(){return C===Fi}function Ki(){return C===$i}function jt(){return C===Ni}function Bt(){return C===Gi}function Ji(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),C=Oi;return}catch{}else if(e==="dapi")try{dapi.isReady(),C=Hi;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(C=Pi)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(C=ji)}catch{}else if(t==="mintegral")window.gameReady&&(C=Bi);else if(t==="tapjoy")window.TJ_API&&(C=Di);else if(t==="tiktok")window.openAppStore&&(C=zi);else if(t==="smadex")try{window.smxTracking&&(C=Fi)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(C=$i)}catch{}else t==="vungle"?C=Ni:(e==="nucleo"||t==="nucleo")&&(C=Gi)}var lt=re(require("lottie-web")),Qi=lt.default;typeof window!="undefined"&&(window.lottie=lt.default,window.__baseLottie=lt.default);var Ms=require("pixi.js");var Be=require("pixi.js");var ct=require("pixi.js");var Zi=require("pixi.js");var ks=null;function Ft(e){ks=e}var te=require("pixi.js");var Z=class{static get(t){var n;return(n=this.store.get(t))==null?void 0:n.data}static set(t,n){this.store.set(t,{data:n})}static has(t){return this.store.has(t)}static clear(){this.store.clear()}};Z.store=new Map;function Rs(){var e,t;try{let n=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((t=(e=document.querySelector("script"))==null?void 0:e.textContent)==null?void 0:t.includes("inline-assets.js"))||window.INLINE_ASSETS),i=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(n&&!i)}catch{return!1}}async function Is(){try{if(typeof window!="undefined"){let e=await fetch("./build-settings.json");if(e.ok){let t=await e.json();return console.log("[AssetLoader] Loaded build settings:",t),t}}}catch{}return null}function Os(){try{if(typeof window!="undefined"){let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",t),t}}}catch{}return null}var ea=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",ta=Rs(),be=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,T=ta?"publish":ea,U=be==null?void 0:be.assetsInlined;be!=null&&be.buildMode&&(T=be.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${T}`));var ce=Os();ce!=null&&ce.buildMode&&(T=ce.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${T}`));(ce==null?void 0:ce.assetsInlined)!==void 0&&(U=ce.assetsInlined);Is().then(e=>{e!=null&&e.buildMode&&e.buildMode!==T&&(T=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${T}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(U=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${ea}, Runtime: ${ta?"publish":"dev"}, Effective: ${T}`);var ee={},$t=null;async function Hs(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${T}`),Object.keys(ee).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(ee)),ee;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),ee={...window.INLINE_ASSETS},ee;if(!(T==="publish"&&U!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),ee;if(!$t){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),$t=(async()=>{try{try{let s=await import(t+"?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 n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);let i=await n.text();console.log("[AssetLoader] Received JS code, length:",i.length);let a=i.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 o=new Function("return "+s)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(o)),o}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:",i.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}return ee=await $t,console.log("[AssetLoader] Final inline assets cache:",Object.keys(ee)),ee}var na=new Map;function Nt(e){return e===null||typeof e!="object"||(Object.freeze(e),Object.values(e).forEach(t=>Nt(t))),e}function Ps(e=64,t=64,n=16711680){let i=document.createElement("canvas");i.width=e,i.height=t;let a=i.getContext("2d");return a.fillStyle=`#${n.toString(16).padStart(6,"0")}`,a.fillRect(0,0,e,t),a.strokeStyle="#000",a.strokeRect(0,0,e,t),a.fillStyle="#fff",a.font="10px sans-serif",a.textAlign="center",a.fillText("MISSING",e/2,t/2),te.Texture.from(i)}function Gt(e,t){na.set(e,t)}var De=class{static async load(t,n,i){let a=Z.get(t);if(a!==void 0)return a;console.log(`[AssetLoader] Loading asset: ${t}, type: ${n.type}, Effective mode: ${T}`),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(),o=s[t];if(!o&&n.path){let l=n.path.split("/");if(l.length>=2){let d=l[l.length-1].split(".")[0],m=l[0],f=[`${d}.layer`,`${d}.player`,`${d}.tutorial`,`effects.${d}`,`ui.endgame.${d}`,d];for(let g of f)if(s[g]){o=s[g],console.log(`[AssetLoader] Found inline data for ${t} using derived key: ${g}`);break}}}if(console.log("[AssetLoader] Inline data for",t,":",o?"FOUND":"NOT FOUND"),T==="publish"&&U!==!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: ${t}, path: ${n.path}`);let r=na.get(n.type);if(r)try{let l=await r(n.path,o,t,i);return Z.set(t,l),l}catch(l){return this.handleFailure(t,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=Nt(l);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return Z.set(t,l),l}catch(l){return this.handleFailure(t,n.type,l)}}static async loadImage(t,n){let i=T==="publish",a=i&&U!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${T}, isPublishMode: ${i}, 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: ${t}`);if(!n.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${n.substring(0,50)}...`);try{return await te.Assets.load(n)}catch(s){throw console.error("[AssetLoader] Failed to load texture from data URI:",s),s}}if(n&&n.startsWith("data:"))try{return await te.Assets.load(n)}catch(s){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",s),await te.Assets.load(t)}return await te.Assets.load(t)}static async loadJSON(t,n){let i=T==="publish",a=i&&U!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${T}, isPublishMode: ${i}, 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: ${t}`);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 s=await fetch(t);if(!s.ok)throw new Error(`JSON fetch failed: ${t}`);return s.json()}static handleFailure(t,n,i){if(T==="dev"){let s=n==="image"?Ps():Nt({__placeholder:!0,type:n});return Z.set(t,s),s}throw i}};Gt("image",async(e,t)=>{let n=T==="publish",i=n&&U!==!1,a=T==="brand",s=n&&U===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${T}, isPublishMode: ${n}, isBrandMode: ${a}, inlineData: ${t?"EXISTS":"MISSING"}`),i){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:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${t.substring(0,50)}...`);return te.Assets.load(t)}let o=e;return(a||s)&&e&&!e.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(o=e,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${e}" as-is`)):(o=`assets/${e}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${e}" -> "${o}"`))),te.Assets.load(t||o)});Gt("json",async(e,t)=>{let n=T==="publish",i=n&&U!==!1,a=T==="brand",s=n&&U===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${T}, isPublishMode: ${n}, isBrandMode: ${a}, inlineData: ${t?"EXISTS":"MISSING"}`),i){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}`);return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t)}let o=e;if((a||s)&&e&&!e.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(o=e,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${e}" as-is`)):(o=`assets/${e}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${e}" -> "${o}"`))),t)return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t);let u=await fetch(o);if(!u.ok)throw new Error(`JSON fetch failed: ${e}`);return u.json()});var ze=require("pixi.js");var js=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",qt=js;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(qt=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${qt}`))}}catch{}var Ce=class{static async create(t,n,i){var u,r,l,d,m,f;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${qt}`);let a=(u=n==null?void 0:n.render)==null?void 0:u.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let g=new ze.Container;return this.applyTransform(g,n==null?void 0:n.transform),g}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, type: ${a.type}, path: ${a.path}`);let s=await De.load(t,a,i);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(r=s==null?void 0:s.constructor)==null?void 0:r.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new ze.Sprite(s),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",t,"rawAsset type:",(d=s==null?void 0:s.constructor)==null?void 0:d.name,s),s&&(((m=s.constructor)==null?void 0:m.name)==="Container"||s instanceof ze.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let g=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],b=!1;for(let c of g)try{let v=await fetch(c);if(v.ok){o=await v.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",c,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name),b=!0;break}}catch{continue}b||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=s)}else o=s;else o=s,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform);return o}static applyTransform(t,n){var i,a,s,o;!n||!t||(n.position&&("x"in t&&"y"in t?(t.x=(i=n.position.x)!=null?i:0,t.y=(a=n.position.y)!=null?a:0):"position"in t&&t.position&&t.position.set((s=n.position.x)!=null?s:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(n.scale):t.scale=n.scale),n.rotation!==void 0&&"rotation"in t&&(t.rotation=n.rotation),n.anchor&&"anchor"in t&&t.anchor&&Array.isArray(n.anchor)&&("set"in t.anchor?t.anchor.set(n.anchor[0],n.anchor[1]):(t.anchor.x=n.anchor[0],t.anchor.y=n.anchor[1])))}};var Fe=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var zs=re(require("pixi.js"));typeof window!="undefined"&&(window.__basePixi=zs);var Wt=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Fe}init(t,n){this.registry.init(t),this.app=n}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var u;let o=this.registry.get(s);if(!o){console.warn("[Assets] No config found for object:",s);return}try{let r=await Ce.create(s,o,this.app);this.instanceCache.set(s,r),console.log("[Assets] Loaded object:",s,(u=r==null?void 0:r.constructor)==null?void 0:u.name)}catch(r){console.error("[Assets] Failed to load object:",s,r)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let n=this.registry.get(t);if(n){let i=await Ce.create(t,n,this.app);this.instanceCache.set(t,i)}}get(t){return this.instanceCache.get(t)}},Fs=new Wt,ia=new Proxy(Fs,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});var aa=require("pixi.js");var sa=require("pixi.js"),ne={width:400,height:600,designWidth:400,scaleFactor:1},dt={scale:1,position:1},Ut=[];function qs(e,t,n,i,a,s,o){Ut.push({element:e,originalScale:s,positionHelper:t,heightPercent:a}),t(e,n,i,a,s,o,!1)}function Ws(){Ut.forEach(({element:e,originalScale:t,positionHelper:n,heightPercent:i})=>{let a=t*ne.scaleFactor;n(e,ne.width,ne.height,i,a,!0,!1)})}function Yt(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),ne.width=e,ne.height=t,ne.scaleFactor=Math.min(e/ne.designWidth,1.15),dt.scale=ne.scaleFactor,dt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${dt.scale.toFixed(3)}`),Ws()}var Ne={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03},physics:{rope_length:420,gravity:9.8,friction:.1}};function Ys(e,t,n){let i=Ne[e];i&&i[t]!==void 0&&(i[t]=n,console.log(`Updated ${e}.${t} = ${n}`))}function Us(){return Ne}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==e||a!==t)&&(e=i,t=a,Yt(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),Yt(window.innerWidth,window.innerHeight),window.updateDebugConfig=Ys,window.getDebugConfig=Us,window.copyConfig=ao,window.applyConfig=$e,window.applyConfigForRatio=so,window.positionAtBottom=oa,window.positionAtTop=Ks,window.positionAtCenter=Js,window.positionAtLeft=Qs,window.positionAtRight=Zs,window.positionAtBottomLeft=eo,window.positionAtBottomRight=to,window.positionAtTopLeft=no,window.positionAtTopRight=io,window.applyPositionContract=Xs,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function ut(e,t,n=0){return e*t+n}function pt(e,t,n=0){return e*(1-t)+n}function ht(e,t,n=0){return e*t+n}function gt(e,t,n=0){return e*(1-t)+n}function N(e,t=0){return e/2+t}function Vs(e,t){return e*t}function Xs(e,t,n,i){var o,u,r,l,d,m,f,g,b,c,v,S,x,h,p,y,E,_,M,R;let a=0,s=0;switch(i.type){case"top":a=N(t,(u=(o=i.offset)==null?void 0:o.x)!=null?u:0),s=ut(n,i.percent,(l=(r=i.offset)==null?void 0:r.y)!=null?l:0);break;case"bottom":a=N(t,(m=(d=i.offset)==null?void 0:d.x)!=null?m:0),s=pt(n,i.percent,(g=(f=i.offset)==null?void 0:f.y)!=null?g:0);break;case"left":a=ht(t,i.percent,(c=(b=i.offset)==null?void 0:b.x)!=null?c:0),s=N(n,(S=(v=i.offset)==null?void 0:v.y)!=null?S:0);break;case"right":a=gt(t,i.percent,(h=(x=i.offset)==null?void 0:x.x)!=null?h:0),s=N(n,(y=(p=i.offset)==null?void 0:p.y)!=null?y:0);break;case"center":a=N(t,(_=(E=i.offset)==null?void 0:E.x)!=null?_:0),s=N(n,(R=(M=i.offset)==null?void 0:M.y)!=null?R:0);break}e.position?e.position.set(a,s):(e.x=a,e.y=s),i.scale!==void 0&&i.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(i.scale,i.scale):(e.scale.x=i.scale,e.scale.y=i.scale))}function oa(e,t,n,i=.2,a=1,s=!0,o=!1){let u=Vs(n,i),r=pt(n,i/2);ie(e,N(t),r);let l=s?a*ne.scaleFactor:a;ae(e,l),o&&!Ut.find(d=>d.element===e)&&qs(e,oa,t,n,i,a,s)}function Ks(e,t,n,i=.1,a=1){ie(e,N(t),ut(n,i)),ae(e,a)}function Js(e,t,n,i=0,a=0,s=1){ie(e,N(t,i),N(n,a)),ae(e,s)}function Qs(e,t,n,i=.1,a=1){ie(e,ht(t,i),N(n)),ae(e,a)}function Zs(e,t,n,i=.1,a=1){ie(e,gt(t,i),N(n)),ae(e,a)}function eo(e,t,n,i=.05,a=.05,s=1){ie(e,ht(t,a),pt(n,i)),ae(e,s)}function to(e,t,n,i=.05,a=.05,s=1){ie(e,gt(t,a),pt(n,i)),ae(e,s)}function no(e,t,n,i=.05,a=.05,s=1){ie(e,ht(t,a),ut(n,i)),ae(e,s)}function io(e,t,n,i=.05,a=.05,s=1){ie(e,gt(t,a),ut(n,i)),ae(e,s)}function ie(e,t,n){e&&e.position?typeof e.position.set=="function"?e.position.set(t,n):(e.position.x=t,e.position.y=n):e&&(e.x=t,e.y=n)}function ae(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var ye={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03},physics:{rope_length:420,gravity:9.8,friction:.1}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03},physics:{rope_length:420,gravity:9.8,friction:.1}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03},physics:{rope_length:380,gravity:9.8,friction:.1}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03},physics:{rope_length:450,gravity:9.8,friction:.1}}};function ao(e){return e&&ye[e]?JSON.parse(JSON.stringify(ye[e])):JSON.parse(JSON.stringify(Ne))}function $e(e){Object.keys(e).forEach(t=>{let n=t;Ne[n]&&e[n]&&Object.assign(Ne[n],e[n])}),console.log("Config applied:",e)}function so(e,t){let n=e/t;n>1.6?($e(ye.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?($e(ye.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?($e(ye.square),console.log("Applied SQUARE config for ratio:",n)):($e(ye.default),console.log("Applied DEFAULT config for ratio:",n))}typeof window!="undefined"&&(window.configPresets=ye);Kt();function k(e,t){let n=(a,s)=>s===0?a:n(s,a%s),i=n(e,t);return`${e/i}:${t/i}`}var Pl=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:k(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:k(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:k(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:k(360,780)}],jl=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:k(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:k(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:k(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:k(412,915)}],Bl=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:k(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:k(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:k(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:k(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:k(800,1280)}],da=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:k(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:k(768,1024),mraidScale:.7}];var Dl=[...da];var ho=da[0];var mt=require("pixi.js");ft();var ua=re(require("lottie-web"));Ft(Qi);typeof window!="undefined"&&!window.lottie&&(window.lottie=ua.default);Kt();ft();var Jt="0.3.1",ba={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"},xo=Math.random().toString(36).slice(2),Le=null,qe={...ba},ya="web_embed",wo={},Qt=!1,Ge=!1,Ye=!1,va=!1,nn=1,en=0,xt=!1,se=!1,vt="",Ae=Math.floor(window.innerWidth),Me=Math.floor(window.innerHeight),tn=Ae>Me,oe=!1,We=!1,pa=!1,ha=!1,Zt=!1,bt=null;function ga(){if(Le)return Le;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),Le=e,e}function yt(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function xa(e,t){return{event_name:e,ts:Date.now(),session_id:xo,deployment_id:qe.deployment_id,variant_id:qe.variant_id,export_profile_id:qe.profile_id,instance_id:qe.instance_id||"default",env:ya==="mraid"?"mraid":"web",payload:t}}function w(e,t){let n=yt(e),i=xa(n,t);rt(n,i),n!==e&&rt(e,i)}function Ue(){bt&&(bt(Ae,Me),bt=null)}function ke(e){nn=e,w("volume",e)}function Re(e){e&&(va=!0),!Ye&&(Ye=!0,w("pause"),ke(0))}function Ve(e){!e&&va||Ye&&(Ye=!1,w("resume"),ke(nn))}function ue(e,t){Ae=Math.floor(e||window.innerWidth),Me=Math.floor(t||window.innerHeight),tn=Ae>Me,w("resize",{width:Ae,height:Me})}function Eo(){if(qi())try{let e=mraid.getMaxSize();ue(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Ve():Re()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();ue(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ke(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ke(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),xt=!0,mraid.isViewable()&&mraid.getState()!=="hidden")oe=!0,w("boot"),w("view"),w("ready"),se=!0,Ue();else{let n=()=>{oe=!0,w("boot"),w("view"),w("ready"),se=!0,Ue()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function So(){if(Wi())try{let e=dapi.getScreenSize();ue(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Ve():Re()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();ue(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(ke(t?1:0),dapi.addEventListener("audioVolumeChange",n=>ke(n?1:0)),xt=!0,dapi.isViewable())oe=!0,w("boot"),w("view"),w("ready"),se=!0,Ue();else{let n=()=>{oe=!0,w("boot"),w("view"),w("ready"),se=!0,Ue()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function fa(){let e=()=>{oe||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(oe=!0,w("boot"),w("view"),w("ready"),se=!0,Ue(),We&&(We=!1,de.start()))};window.addEventListener("resize",()=>ue()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Ve(),e()):Re()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),xt=!0}function _o(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(pa=!0),!(pa&&t instanceof MouseEvent)&&(en+=1,w("interaction",en))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function To(e){var i,a,s,o,u,r,l,d,m,f,g,b;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(_e())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(Yi())(u=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||u.call(o);else if(Ki())(l=(r=window.ScPlayableAd)==null?void 0:r.onCTAClick)==null||l.call(r);else if(Xi())try{(m=(d=window.smxTracking)==null?void 0:d.redirect)==null||m.call(d)}catch(c){console.warn("Smadex redirect failed",c)}else if(Ui()){let c=window.ExitApi;c&&typeof c.exit=="function"?c.exit(e||vt||""):e&&window.open(e)}else Se()?(f=window.install)==null||f.call(window):Vi()?(g=window.openAppStore)==null||g.call(window):jt()?(b=parent==null?void 0:parent.postMessage)==null||b.call(parent,"download","*"):e&&window.open(e)}function Co(){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;F("view",()=>t(n.mraid_viewable)),F("start",()=>t(n.game_viewable)),F("engagement",()=>t(n.engagement));let i=()=>t(n.complete);F("complete",i),ot("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),F("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;F("view",()=>t(n.Ad_Load_Start)),F("start",()=>t(n.Ad_Viewable)),F("engagement",()=>t(n.First_Engagement)),F("complete",()=>t(n.Gameplay_Complete)),F("cta_click",()=>t(n.DSP_Click)),F("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Lo(){if(!_e())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{de.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function ma(){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 Ao(){Se()&&(window.mintGameStart=()=>{Ve(!0),ue()},window.mintGameClose=()=>{Re(!0)})}function Mo(){if(!Bt())return;let e=window.NUC;!e||!e.trigger||(de.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,vt)}),de.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var de={init(e={},t){if(ya=e.profile||"web_embed",wo=e.consent||{},qe={...ba,...e.ids||{}},Le=e.rootEl||Le,vt=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(bt=t),w("init"),document.body.oncontextmenu=()=>!1,ga(),ko(Le),Ji(),Eo(),So(),!xt){if(document.readyState==="complete")fa();else if(!ha){ha=!0;let n=()=>{fa(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}_o(),Co(),Lo(),Ao(),Mo(),console.log(`%c @handler/playable-sdk %c v${Jt} `,"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;"),oe&&!se&&(w("boot"),w("view"),w("ready"),We&&(We=!1,de.start()),se=!0),se=oe},getRoot(){return ga()},get version(){return Jt},get maxWidth(){return Ae},get maxHeight(){return Me},get isLandscape(){return tn},get isReady(){return se},get isStarted(){return Qt},get isPaused(){return Ye},get isFinished(){return Ge},get volume(){return nn},get interactions(){return en},on(e,t){ot(yt(e),t)},off(e,t){Pt(yt(e),t)},start(){var e,t;if(!Qt){if(!oe){We=!0;return}if(Qt=!0,w("start"),ue(),Se())Re(),(e=window.gameReady)==null||e.call(window);else if(_e()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:tn?"landscape":"portrait",buildID:Jt})}}},finish(){var e,t;Ge||(Ge=!0,w("complete"),Se()?(e=window.gameEnd)==null||e.call(window):jt()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):_e()&&ma())},install(e){if(!Ge){Ge=!0,_e()?(ma(),setTimeout(()=>de.install(e),300)):(w("complete"),setTimeout(()=>de.install(e),0));return}Zt||(Zt=!0,setTimeout(()=>Zt=!1,500),w("cta_click"),w("conversion"),To(e||vt))},emit(e,t){let n=yt(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=xa(n,t);rt(n,i)},retry(){var e,t,n;if(Se())(e=window.gameRetry)==null||e.call(window);else if(Bt()){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(){Re(!0)},resume(){Ve(!0)},resize(e,t){ue(e,t)}},Te=de;function ko(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(){
@@ -14,7 +14,7 @@
14
14
  }
15
15
  events.forEach(function(e){ document.addEventListener(e, unlock, false); });
16
16
  })();
17
- `,e.appendChild(t)}var ut=(i=>(i[i.PHONE_TALL=0]="PHONE_TALL",i[i.TABLET=1]="TABLET",i[i.LANDSCAPE=2]="LANDSCAPE",i))(ut||{});function Ge(e,t){let n=e/t;return n<=.62?0:n<=.85?1:2}var fe=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=Ge(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 Ge(t.width,t.height)}};async function gi(e,t={}){let n=()=>{let d=e.getBoundingClientRect(),c=Math.floor(d.width),b=Math.floor(d.height);return(c<=0||!isFinite(c)||c!==c)&&(c=e.clientWidth||window.innerWidth||320),(b<=0||!isFinite(b)||b!==b)&&(b=e.clientHeight||window.innerHeight||480),(c<=0||!isFinite(c)||c!==c)&&(c=320),(b<=0||!isFinite(b)||b!==b)&&(b=480),console.log("[THREE-BASE] getSize result:",{width:c,height:b,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:c,height:b}},i=e.style.width&&!e.style.width.includes("%"),a=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 r=document.createElement("div");r.style.cssText=`
17
+ `,e.appendChild(t)}var an=(i=>(i[i.PHONE_TALL=0]="PHONE_TALL",i[i.TABLET=1]="TABLET",i[i.LANDSCAPE=2]="LANDSCAPE",i))(an||{});function wt(e,t){let n=e/t;return n<=.62?0:n<=.85?1:2}var Ie=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=wt(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 wt(t.width,t.height)}};async function wa(e,t={}){let n=()=>{let h=e.getBoundingClientRect(),p=Math.floor(h.width),y=Math.floor(h.height);return(p<=0||!isFinite(p)||p!==p)&&(p=e.clientWidth||window.innerWidth||320),(y<=0||!isFinite(y)||y!==y)&&(y=e.clientHeight||window.innerHeight||480),(p<=0||!isFinite(p)||p!==p)&&(p=320),(y<=0||!isFinite(y)||y!==y)&&(y=480),console.log("[THREE-BASE] getSize result:",{width:p,height:y,boundingRect:{width:h.width,height:h.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:p,height:y}},i=e.style.width&&!e.style.width.includes("%"),a=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 o=document.createElement("div");o.style.cssText=`
18
18
  position: absolute !important;
19
19
  inset: 0 !important;
20
20
  width: 100% !important;
@@ -35,17 +35,17 @@
35
35
  padding: 0 !important;
36
36
  border: none !important;
37
37
  overflow: hidden !important;
38
- `,e.appendChild(r);let u=document.createElement("div");u.setAttribute("style",["position:absolute","inset:0","width:100%","height:100%","min-width:100%","min-height:100%","max-width:100%","max-height:100%","pointer-events:auto","box-sizing:border-box","margin:0","padding:0","overflow:hidden"].join(";")),r.appendChild(u);let l=new O.Scene,{width:m,height:p}=n(),y=new O.AmbientLight(16777215,.6);l.add(y);let f=new O.DirectionalLight(16777215,.8);f.position.set(5,5,5),f.castShadow=!1,l.add(f);let h=new O.DirectionalLight(16777215,.3);h.position.set(-5,0,5),l.add(h);let g=new O.PerspectiveCamera(55,m/p,.1,100);g.position.set(0,0,3.2),g.lookAt(0,0,0),g.updateMatrixWorld();let o=new O.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});o.setPixelRatio(window.devicePixelRatio||1),o.setSize(m,p),o.setClearColor(0,0),o.domElement.style.position="absolute",o.domElement.style.top="0",o.domElement.style.left="0",o.domElement.style.right="0",o.domElement.style.bottom="0",o.domElement.style.width="100%",o.domElement.style.height="100%",o.domElement.style.minWidth="100%",o.domElement.style.minHeight="100%",o.domElement.style.maxWidth="100%",o.domElement.style.maxHeight="100%",o.domElement.style.display="block",o.domElement.style.pointerEvents="auto",o.domElement.style.margin="0",o.domElement.style.padding="0",o.domElement.style.boxSizing="border-box",u.appendChild(o.domElement);let E=d=>{var A;let c=e.getBoundingClientRect(),b=window.getComputedStyle(e);console.log("[THREE-BASE] applySize called:",{providedSize:d,rootRect:{width:c.width,height:c.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleSize:{width:e.style.width,height:e.style.height},computedStyle:{width:b.width,height:b.height,transform:b.transform,scale:b.scale},rendererCurrentSize:{width:o.domElement.width,height:o.domElement.height},rendererStyleSize:{width:o.domElement.style.width,height:o.domElement.style.height},stackTrace:(A=new Error().stack)==null?void 0:A.split(`
38
+ `,e.appendChild(o);let u=document.createElement("div");u.setAttribute("style",["position:absolute","inset:0","width:100%","height:100%","min-width:100%","min-height:100%","max-width:100%","max-height:100%","pointer-events:auto","box-sizing:border-box","margin:0","padding:0","overflow:hidden"].join(";")),o.appendChild(u);let r=new q.Scene,{width:l,height:d}=n(),m=new q.AmbientLight(16777215,.6);r.add(m);let f=new q.DirectionalLight(16777215,.8);f.position.set(5,5,5),f.castShadow=!1,r.add(f);let g=new q.DirectionalLight(16777215,.3);g.position.set(-5,0,5),r.add(g);let b=new q.PerspectiveCamera(55,l/d,.1,100);b.position.set(0,0,3.2),b.lookAt(0,0,0),b.updateMatrixWorld();let c=new q.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});c.setPixelRatio(window.devicePixelRatio||1),c.setSize(l,d),c.setClearColor(0,0),c.domElement.style.position="absolute",c.domElement.style.top="0",c.domElement.style.left="0",c.domElement.style.right="0",c.domElement.style.bottom="0",c.domElement.style.width="100%",c.domElement.style.height="100%",c.domElement.style.minWidth="100%",c.domElement.style.minHeight="100%",c.domElement.style.maxWidth="100%",c.domElement.style.maxHeight="100%",c.domElement.style.display="block",c.domElement.style.pointerEvents="auto",c.domElement.style.margin="0",c.domElement.style.padding="0",c.domElement.style.boxSizing="border-box",u.appendChild(c.domElement);let v=h=>{var A;let p=e.getBoundingClientRect(),y=window.getComputedStyle(e);console.log("[THREE-BASE] applySize called:",{providedSize:h,rootRect:{width:p.width,height:p.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleSize:{width:e.style.width,height:e.style.height},computedStyle:{width:y.width,height:y.height,transform:y.transform,scale:y.scale},rendererCurrentSize:{width:c.domElement.width,height:c.domElement.height},rendererStyleSize:{width:c.domElement.style.width,height:c.domElement.style.height},stackTrace:(A=new Error().stack)==null?void 0:A.split(`
39
39
  `).slice(1,4).join(`
40
- `)});let _=c.width,S=c.height;if((_<=0||!isFinite(_))&&(console.warn("[THREE-BASE] Invalid boundingRect.width, using clientWidth fallback",{boundingRectWidth:c.width,clientWidth:e.clientWidth}),_=e.clientWidth||window.innerWidth||320),(S<=0||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid boundingRect.height, using clientHeight fallback",{boundingRectHeight:c.height,clientHeight:e.clientHeight}),S=e.clientHeight||window.innerHeight||480),typeof(d==null?void 0:d.width)=="number"&&d.width>0){let L=Math.abs(d.width-c.width),H=c.width*.1;L>H?console.warn("[THREE-BASE] Provided width ignored (too different from container):",{provided:d.width,container:c.width,difference:L,tolerance:H,willUse:"container size (boundingRect)"}):(_=d.width,console.log("[THREE-BASE] Using provided width (within tolerance):",{provided:d.width,container:c.width}))}if(typeof(d==null?void 0:d.height)=="number"&&d.height>0){let L=Math.abs(d.height-c.height),H=c.height*.1;L>H?console.warn("[THREE-BASE] Provided height ignored (too different from container):",{provided:d.height,container:c.height,difference:L,tolerance:H,willUse:"container size (boundingRect)"}):(S=d.height,console.log("[THREE-BASE] Using provided height (within tolerance):",{provided:d.height,container:c.height}))}(_<=0||S<=0||!isFinite(_)||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid size in applySize, using fallback",{newWidth:_,newHeight:S,size:d,rootRect:c}),_=c.width||e.clientWidth||320,S=c.height||e.clientHeight||480);let C=Math.floor(_),F=Math.floor(S);console.log("[THREE-BASE] applySize setting renderer size:",{finalWidth:C,finalHeight:F,aspectRatio:C/F,beforeRendererSize:{width:o.domElement.width,height:o.domElement.height},beforeRendererStyle:{width:o.domElement.style.width,height:o.domElement.style.height}}),o.setSize(C,F),o.setPixelRatio(window.devicePixelRatio||1),g.aspect=C/F,g.updateProjectionMatrix();let R=e.getBoundingClientRect();console.log("[THREE-BASE] applySize after setting:",{rendererSize:{width:o.domElement.width,height:o.domElement.height},rendererStyle:{width:o.domElement.style.width,height:o.domElement.style.height},containerRect:{width:R.width,height:R.height},cameraAspect:g.aspect,matches:{width:Math.abs(o.domElement.width-R.width)<1,height:Math.abs(o.domElement.height-R.height)<1},sizeDifference:{width:o.domElement.width-R.width,height:o.domElement.height-R.height}})};requestAnimationFrame(()=>{requestAnimationFrame(()=>{E()})});let T=!1;Ye.on("pause",()=>{T=!0,document.querySelectorAll("audio").forEach(c=>c.pause())}),Ye.on("resume",()=>{T=!1,document.querySelectorAll("audio").forEach(c=>{c.currentTime>0&&!c.ended&&c.play().catch(()=>{})})});let x=new fe(e,r);return Ye.on("resize",({payload:d})=>{console.log("[THREE-BASE] Handler resize event received:",{payload:d,timestamp:Date.now(),rootRect:e.getBoundingClientRect()}),E({width:d==null?void 0:d.width,height:d==null?void 0:d.height}),x.updateLayout()}),window.addEventListener("resize",()=>{console.log("[THREE-BASE] Window resize event received:",{timestamp:Date.now(),windowSize:{width:window.innerWidth,height:window.innerHeight},rootRect:e.getBoundingClientRect()}),E(),x.updateLayout()}),{scene:l,camera:g,renderer:o,uiSystem:x,applySize:E}}var k=we(require("three")),Re=class{constructor(t){var n,i;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(n=t==null?void 0:t.scale)!=null?n:1,this.rotation=(i=t==null?void 0:t.rotation)!=null?i: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)}syncToThree(t){let n=t.position.z,i=n===0||!isFinite(n)?.5:n;t.position.set(this.position.x,this.position.y,i),t.scale.set(this.scale,this.scale,this.scale),t.rotation.z=this.rotation}},Ae=class{constructor(t){var n,i,a,s;this.z_index=(n=t==null?void 0:t.z_index)!=null?n:0,this.alpha=(i=t==null?void 0:t.alpha)!=null?i:1,this.visible=(a=t==null?void 0:t.visible)!=null?a:!0,this.tint=(s=t==null?void 0:t.tint)!=null?s: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)}syncToThree(t){if(t.renderOrder=this.z_index,t.visible=this.visible,t instanceof k.Mesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n instanceof k.Material&&(n.opacity=this.alpha,n.transparent=this.alpha<1)}):t.material instanceof k.Material&&(t.material.opacity=this.alpha,t.material.transparent=this.alpha<1)),this.tint!==null&&t instanceof k.Mesh&&t.material){let n=typeof this.tint=="string"?new k.Color(this.tint):new k.Color(this.tint);Array.isArray(t.material)?t.material.forEach(i=>{(i instanceof k.MeshBasicMaterial||i instanceof k.MeshStandardMaterial)&&i.color.copy(n)}):(t.material instanceof k.MeshBasicMaterial||t.material instanceof k.MeshStandardMaterial)&&t.material.color.copy(n)}}},Ce=class{constructor(t,n,i,a){this.instanceId=t,this.objectConfig=n,this.threeObject=i,this._config=a,this.transform=new Re(a.transform),this.renderer=new Ae(a.render),this.sync()}sync(){this.transform.syncToThree(this.threeObject),this.renderer.syncToThree(this.threeObject)}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,n){this.transform.position={x:t,y:n},this.transform.syncToThree(this.threeObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToThree(this.threeObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToThree(this.threeObject)}},Ve=class{constructor(t){this.objects=new Map;this.config=t}create(t,n){let i=this.config.objects.get(t);if(!i)throw new Error(`Object config not found: ${t}`);let a=new Ce(t,i.object_config||t,n,i);return this.objects.set(t,a),a}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[n,i]of this.objects.entries()){let a=t.objects.get(n);a&&i.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var qe={"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 Y(e){let t=qe[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function G(e){var n;let t=qe[e];return t&&(n=t.weight)!=null?n:"400"}function bi(e,t){qe[e]=t}function wi(){return Object.keys(qe)}var ye=we(require("three"));function se(e){return{element:e,get alpha(){return parseFloat(e.style.opacity||"1")},set alpha(t){e.style.opacity=t.toString()},get visible(){return e.style.display!=="none"},set visible(t){e.style.display=t?"":"none"},position:{set(t,n){e.style.left=`${t}px`,e.style.top=`${n}px`},get x(){return parseFloat(e.style.left||"0")},get y(){return parseFloat(e.style.top||"0")}},scale:{set(t,n){e.style.transform=`scale(${t})`},get x(){let t=e.style.transform.match(/scale\(([^)]+)\)/);return t?parseFloat(t[1]):1}}}}function Ei(e,t,n,i){var kt,Ft,Dt,$t,Pt,Wt,zt,Bt,Nt,Ot,jt,It,Yt,Gt,Vt,qt,Xt,Kt,Jt,Zt,Qt,Ut,en,tn,nn,an,sn,on,rn,ln,cn,dn,pn,mn,un,hn,fn,yn,gn,bn,wn,En,xn,_n,Tn,vn,Sn,Rn,An,Cn,Hn,Mn,Ln,kn,Fn,Dn,$n,Pn,Wn,zn,Bn,Nn,On;let a=e.objects.get("ui_endgame_1"),s=e.objects.get("ui_endgame_logo_1"),r=e.objects.get("ui_endgame_title_1"),u=e.objects.get("ui_endgame_subtitle_1"),l=e.objects.get("ui_endgame_footer_1"),m=e.objects.get("ui_endgame_cta_1"),p=e.objects.get("ui_endgame_cta_hint_1"),y=e.objects.get("ui_endgame_hand_1"),f=e.engine.runtime||{},h=((kt=a==null?void 0:a.gameplay)==null?void 0:kt.tuning)||{},g=(a==null?void 0:a.render)||{},o=i.getBoundingClientRect(),E=o.width>0?o.width*.9:320,T=o.height>0?o.height*.85:400,x=Math.min((Ft=h.panel_width)!=null?Ft:320,E),d=Math.min((Dt=h.panel_height)!=null?Dt:400,T),c=($t=h.panel_padding)!=null?$t:32,b=(Pt=h.panel_radius)!=null?Pt:24,_=g.background_color||h.panel_bg_color||"#1a0a0a",S=g.background_alpha!==void 0&&g.background_alpha!==null?g.background_alpha:(Wt=h.panel_bg_alpha)!=null?Wt:.98,C=g.border_color||h.panel_border_color||"#ffffff",F=(zt=h.panel_border_width)!=null?zt:2,R=(Bt=h.panel_border_alpha)!=null?Bt:.3,A=document.createElement("div");A.style.cssText=`
40
+ `)});let E=p.width,_=p.height;if((E<=0||!isFinite(E))&&(console.warn("[THREE-BASE] Invalid boundingRect.width, using clientWidth fallback",{boundingRectWidth:p.width,clientWidth:e.clientWidth}),E=e.clientWidth||window.innerWidth||320),(_<=0||!isFinite(_))&&(console.warn("[THREE-BASE] Invalid boundingRect.height, using clientHeight fallback",{boundingRectHeight:p.height,clientHeight:e.clientHeight}),_=e.clientHeight||window.innerHeight||480),typeof(h==null?void 0:h.width)=="number"&&h.width>0){let H=Math.abs(h.width-p.width),I=p.width*.1;H>I?console.warn("[THREE-BASE] Provided width ignored (too different from container):",{provided:h.width,container:p.width,difference:H,tolerance:I,willUse:"container size (boundingRect)"}):(E=h.width,console.log("[THREE-BASE] Using provided width (within tolerance):",{provided:h.width,container:p.width}))}if(typeof(h==null?void 0:h.height)=="number"&&h.height>0){let H=Math.abs(h.height-p.height),I=p.height*.1;H>I?console.warn("[THREE-BASE] Provided height ignored (too different from container):",{provided:h.height,container:p.height,difference:H,tolerance:I,willUse:"container size (boundingRect)"}):(_=h.height,console.log("[THREE-BASE] Using provided height (within tolerance):",{provided:h.height,container:p.height}))}(E<=0||_<=0||!isFinite(E)||!isFinite(_))&&(console.warn("[THREE-BASE] Invalid size in applySize, using fallback",{newWidth:E,newHeight:_,size:h,rootRect:p}),E=p.width||e.clientWidth||320,_=p.height||e.clientHeight||480);let M=Math.floor(E),R=Math.floor(_);console.log("[THREE-BASE] applySize setting renderer size:",{finalWidth:M,finalHeight:R,aspectRatio:M/R,beforeRendererSize:{width:c.domElement.width,height:c.domElement.height},beforeRendererStyle:{width:c.domElement.style.width,height:c.domElement.style.height}}),c.setSize(M,R),c.setPixelRatio(window.devicePixelRatio||1),b.aspect=M/R,b.updateProjectionMatrix();let L=e.getBoundingClientRect();console.log("[THREE-BASE] applySize after setting:",{rendererSize:{width:c.domElement.width,height:c.domElement.height},rendererStyle:{width:c.domElement.style.width,height:c.domElement.style.height},containerRect:{width:L.width,height:L.height},cameraAspect:b.aspect,matches:{width:Math.abs(c.domElement.width-L.width)<1,height:Math.abs(c.domElement.height-L.height)<1},sizeDifference:{width:c.domElement.width-L.width,height:c.domElement.height-L.height}})};requestAnimationFrame(()=>{requestAnimationFrame(()=>{v()})});let S=!1;Te.on("pause",()=>{S=!0,document.querySelectorAll("audio").forEach(p=>p.pause())}),Te.on("resume",()=>{S=!1,document.querySelectorAll("audio").forEach(p=>{p.currentTime>0&&!p.ended&&p.play().catch(()=>{})})});let x=new Ie(e,o);return Te.on("resize",({payload:h})=>{console.log("[THREE-BASE] Handler resize event received:",{payload:h,timestamp:Date.now(),rootRect:e.getBoundingClientRect()}),v({width:h==null?void 0:h.width,height:h==null?void 0:h.height}),x.updateLayout()}),window.addEventListener("resize",()=>{console.log("[THREE-BASE] Window resize event received:",{timestamp:Date.now(),windowSize:{width:window.innerWidth,height:window.innerHeight},rootRect:e.getBoundingClientRect()}),v(),x.updateLayout()}),{scene:r,camera:b,renderer:c,uiSystem:x,applySize:v}}var P=re(require("three")),Xe=class{constructor(t){var n,i;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(n=t==null?void 0:t.scale)!=null?n:1,this.rotation=(i=t==null?void 0:t.rotation)!=null?i: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)}syncToThree(t){let n=t.position.z,i=n===0||!isFinite(n)?.5:n;t.position.set(this.position.x,this.position.y,i),t.scale.set(this.scale,this.scale,this.scale),t.rotation.z=this.rotation}},Ke=class{constructor(t){var n,i,a,s;this.z_index=(n=t==null?void 0:t.z_index)!=null?n:0,this.alpha=(i=t==null?void 0:t.alpha)!=null?i:1,this.visible=(a=t==null?void 0:t.visible)!=null?a:!0,this.tint=(s=t==null?void 0:t.tint)!=null?s: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)}syncToThree(t){if(t.renderOrder=this.z_index,t.visible=this.visible,t instanceof P.Mesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n instanceof P.Material&&(n.opacity=this.alpha,n.transparent=this.alpha<1)}):t.material instanceof P.Material&&(t.material.opacity=this.alpha,t.material.transparent=this.alpha<1)),this.tint!==null&&t instanceof P.Mesh&&t.material){let n=typeof this.tint=="string"?new P.Color(this.tint):new P.Color(this.tint);Array.isArray(t.material)?t.material.forEach(i=>{(i instanceof P.MeshBasicMaterial||i instanceof P.MeshStandardMaterial)&&i.color.copy(n)}):(t.material instanceof P.MeshBasicMaterial||t.material instanceof P.MeshStandardMaterial)&&t.material.color.copy(n)}}},Je=class{constructor(t,n,i,a){this.instanceId=t,this.objectConfig=n,this.threeObject=i,this._config=a,this.transform=new Xe(a.transform),this.renderer=new Ke(a.render),this.sync()}sync(){this.transform.syncToThree(this.threeObject),this.renderer.syncToThree(this.threeObject)}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,n){this.transform.position={x:t,y:n},this.transform.syncToThree(this.threeObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToThree(this.threeObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToThree(this.threeObject)}},Et=class{constructor(t){this.objects=new Map;this.config=t}create(t,n){let i=this.config.objects.get(t);if(!i)throw new Error(`Object config not found: ${t}`);let a=new Je(t,i.object_config||t,n,i);return this.objects.set(t,a),a}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[n,i]of this.objects.entries()){let a=t.objects.get(n);a&&i.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var St={"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(e){let t=St[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function X(e){var n;let t=St[e];return t&&(n=t.weight)!=null?n:"400"}function Ea(e,t){St[e]=t}function Sa(){return Object.keys(St)}var Oe=re(require("three"));function xe(e){return{element:e,get alpha(){return parseFloat(e.style.opacity||"1")},set alpha(t){e.style.opacity=t.toString()},get visible(){return e.style.display!=="none"},set visible(t){e.style.display=t?"":"none"},position:{set(t,n){e.style.left=`${t}px`,e.style.top=`${n}px`},get x(){return parseFloat(e.style.left||"0")},get y(){return parseFloat(e.style.top||"0")}},scale:{set(t,n){e.style.transform=`scale(${t})`},get x(){let t=e.style.transform.match(/scale\(([^)]+)\)/);return t?parseFloat(t[1]):1}}}}function _a(e,t,n,i){var Sn,_n,Tn,Cn,Ln,An,Mn,kn,Rn,In,On,Hn,Pn,jn,Bn,Dn,zn,Fn,$n,Nn,Gn,qn,Wn,Yn,Un,Vn,Xn,Kn,Jn,Qn,Zn,ei,ti,ni,ii,ai,si,oi,ri,li,ci,di,ui,pi,hi,gi,fi,mi,bi,yi,vi,xi,wi,Ei,Si,_i,Ti,Ci,Li,Ai,Mi,ki,Ri;let a=e.objects.get("ui_endgame_1"),s=e.objects.get("ui_endgame_logo_1"),o=e.objects.get("ui_endgame_title_1"),u=e.objects.get("ui_endgame_subtitle_1"),r=e.objects.get("ui_endgame_footer_1"),l=e.objects.get("ui_endgame_cta_1"),d=e.objects.get("ui_endgame_cta_hint_1"),m=e.objects.get("ui_endgame_hand_1"),f=e.engine.runtime||{},g=((Sn=a==null?void 0:a.gameplay)==null?void 0:Sn.tuning)||{},b=(a==null?void 0:a.render)||{},c=i.getBoundingClientRect(),v=c.width>0?c.width*.9:320,S=c.height>0?c.height*.85:400,x=Math.min((_n=g.panel_width)!=null?_n:320,v),h=Math.min((Tn=g.panel_height)!=null?Tn:400,S),p=(Cn=g.panel_padding)!=null?Cn:32,y=(Ln=g.panel_radius)!=null?Ln:24,E=b.background_color||g.panel_bg_color||"#1a0a0a",_=b.background_alpha!==void 0&&b.background_alpha!==null?b.background_alpha:(An=g.panel_bg_alpha)!=null?An:.98,M=b.border_color||g.panel_border_color||"#ffffff",R=(Mn=g.panel_border_width)!=null?Mn:2,L=(kn=g.panel_border_alpha)!=null?kn:.3,A=document.createElement("div");A.style.cssText=`
41
41
  position: absolute;
42
42
  width: ${x}px;
43
- height: ${d}px;
44
- background: ${_};
45
- opacity: ${S};
46
- border: ${F}px solid ${C};
47
- border-opacity: ${R};
48
- border-radius: ${b}px;
43
+ height: ${h}px;
44
+ background: ${E};
45
+ opacity: ${_};
46
+ border: ${R}px solid ${M};
47
+ border-opacity: ${L};
48
+ border-radius: ${y}px;
49
49
  display: block;
50
50
  transform: translate(-50%, -50%);
51
51
  opacity: 0;
@@ -55,80 +55,80 @@
55
55
  top: 50%;
56
56
  z-index: 1000;
57
57
  box-sizing: border-box;
58
- padding: ${c}px;
59
- `,i.appendChild(A);let L=se(A);L.element=A;let H=((Nt=s==null?void 0:s.gameplay)==null?void 0:Nt.tuning)||{},ee=(s==null?void 0:s.transform)||{},N=(Ot=H.logo_size)!=null?Ot:56,j=(jt=ee.scale)!=null?jt:1,oe=(Yt=(It=ee.offset)==null?void 0:It.y)!=null?Yt:-130,He=(Gt=H.logo_alpha)!=null?Gt:1,Mi=new ye.SpriteMaterial({map:n||void 0,transparent:!0,alphaTest:.1}),I=new ye.Sprite(Mi);I.position.set(0,oe,0),I.material.opacity=0;let Me=0,Le=0;if(n&&(Me=((Vt=n.image)==null?void 0:Vt.width)||100,Le=((qt=n.image)==null?void 0:qt.height)||100),Me>0&&Le>0){let re=Me/Le,it,at;re>1?(it=N,at=N/re):(at=N,it=N*re);let fa=it/Me*j,ya=at/Le*j;I.scale.set(fa,ya,1)}else{let re=N/100*j;I.scale.set(re,re,1)}I.targetAlpha=He,I.baseScaleX=I.scale.x,I.baseScaleY=I.scale.y;let D=r==null?void 0:r.ui,V=((Xt=r==null?void 0:r.gameplay)==null?void 0:Xt.tuning)||{},Li=(D==null?void 0:D.text)||"MISSION ACCOMPLISHED",gt=(D==null?void 0:D.font)||"brand.heading",Ke=(D==null?void 0:D.fontSize)||24,ki=(Kt=D==null?void 0:D.letterSpacing)!=null?Kt:1,ke=(Jt=r==null?void 0:r.render)==null?void 0:Jt.tint,Fi=typeof ke=="string"?ke:ke?`#${ke.toString(16).padStart(6,"0")}`:"#00FF88",Di=x-c*2-30,$i=V.font_weight_override?V.font_weight_override:G(gt),te=document.createElement("div");te.textContent=Li,te.style.cssText=`
60
- font-family: ${Y(gt)};
61
- font-size: ${Ke}px;
62
- font-weight: ${$i};
63
- color: ${Fi};
58
+ padding: ${p}px;
59
+ `,i.appendChild(A);let H=xe(A);H.element=A;let I=((Rn=s==null?void 0:s.gameplay)==null?void 0:Rn.tuning)||{},pe=(s==null?void 0:s.transform)||{},G=(In=I.logo_size)!=null?In:56,W=(On=pe.scale)!=null?On:1,we=(Pn=(Hn=pe.offset)==null?void 0:Hn.y)!=null?Pn:-130,Qe=(jn=I.logo_alpha)!=null?jn:1,Ha=new Oe.SpriteMaterial({map:n||void 0,transparent:!0,alphaTest:.1}),Y=new Oe.Sprite(Ha);Y.position.set(0,we,0),Y.material.opacity=0;let Ze=0,et=0;if(n&&(Ze=((Bn=n.image)==null?void 0:Bn.width)||100,et=((Dn=n.image)==null?void 0:Dn.height)||100),Ze>0&&et>0){let Ee=Ze/et,Ot,Ht;Ee>1?(Ot=G,Ht=G/Ee):(Ht=G,Ot=G*Ee);let vs=Ot/Ze*W,xs=Ht/et*W;Y.scale.set(vs,xs,1)}else{let Ee=G/100*W;Y.scale.set(Ee,Ee,1)}Y.targetAlpha=Qe,Y.baseScaleX=Y.scale.x,Y.baseScaleY=Y.scale.y;let j=o==null?void 0:o.ui,K=((zn=o==null?void 0:o.gameplay)==null?void 0:zn.tuning)||{},Pa=(j==null?void 0:j.text)||"MISSION ACCOMPLISHED",ln=(j==null?void 0:j.font)||"brand.heading",Tt=(j==null?void 0:j.fontSize)||24,ja=(Fn=j==null?void 0:j.letterSpacing)!=null?Fn:1,tt=($n=o==null?void 0:o.render)==null?void 0:$n.tint,Ba=typeof tt=="string"?tt:tt?`#${tt.toString(16).padStart(6,"0")}`:"#00FF88",Da=x-p*2-30,za=K.font_weight_override?K.font_weight_override:X(ln),he=document.createElement("div");he.textContent=Pa,he.style.cssText=`
60
+ font-family: ${V(ln)};
61
+ font-size: ${Tt}px;
62
+ font-weight: ${za};
63
+ color: ${Ba};
64
64
  text-align: center;
65
- letter-spacing: ${ki}px;
66
- -webkit-text-stroke: ${(Zt=V.stroke_width)!=null?Zt:2}px ${V.stroke_color||"#000000"};
67
- text-shadow: ${(Qt=V.shadow_distance)!=null?Qt:4}px ${(Ut=V.shadow_distance)!=null?Ut:4}px ${(en=V.shadow_blur)!=null?en:8}px rgba(0,0,0,${(tn=V.shadow_alpha)!=null?tn:.9});
65
+ letter-spacing: ${ja}px;
66
+ -webkit-text-stroke: ${(Nn=K.stroke_width)!=null?Nn:2}px ${K.stroke_color||"#000000"};
67
+ text-shadow: ${(Gn=K.shadow_distance)!=null?Gn:4}px ${(qn=K.shadow_distance)!=null?qn:4}px ${(Wn=K.shadow_blur)!=null?Wn:8}px rgba(0,0,0,${(Yn=K.shadow_alpha)!=null?Yn:.9});
68
68
  opacity: 0;
69
69
  position: absolute;
70
70
  transform: translate(-50%, -50%);
71
71
  white-space: nowrap;
72
- max-width: ${Di}px;
73
- `;let bt=c+30,Pi=((nn=h.title_offset_y)!=null?nn:bt+Ke/2)+((an=V.animation_start_y_offset)!=null?an:-20);te.style.top=`${Pi}px`,te.style.left="50%";let wt=se(te);wt.element=te,A.appendChild(te);let $=u==null?void 0:u.ui,Et=((sn=u==null?void 0:u.gameplay)==null?void 0:sn.tuning)||{},Wi=($==null?void 0:$.text)||"RESCUE COMPLETE",xt=($==null?void 0:$.font)||"brand.body",Je=($==null?void 0:$.fontSize)||11,zi=(on=$==null?void 0:$.letterSpacing)!=null?on:.5,Fe=(rn=u==null?void 0:u.render)==null?void 0:rn.tint,Bi=typeof Fe=="string"?Fe:Fe?`#${Fe.toString(16).padStart(6,"0")}`:"#B0B0B0",ne=document.createElement("div");ne.textContent=Wi,ne.style.cssText=`
74
- font-family: ${Y(xt)};
75
- font-size: ${Je}px;
76
- font-weight: ${G(xt)};
77
- color: ${Bi};
72
+ max-width: ${Da}px;
73
+ `;let cn=p+30,Fa=((Un=g.title_offset_y)!=null?Un:cn+Tt/2)+((Vn=K.animation_start_y_offset)!=null?Vn:-20);he.style.top=`${Fa}px`,he.style.left="50%";let dn=xe(he);dn.element=he,A.appendChild(he);let B=u==null?void 0:u.ui,un=((Xn=u==null?void 0:u.gameplay)==null?void 0:Xn.tuning)||{},$a=(B==null?void 0:B.text)||"RESCUE COMPLETE",pn=(B==null?void 0:B.font)||"brand.body",Ct=(B==null?void 0:B.fontSize)||11,Na=(Kn=B==null?void 0:B.letterSpacing)!=null?Kn:.5,nt=(Jn=u==null?void 0:u.render)==null?void 0:Jn.tint,Ga=typeof nt=="string"?nt:nt?`#${nt.toString(16).padStart(6,"0")}`:"#B0B0B0",ge=document.createElement("div");ge.textContent=$a,ge.style.cssText=`
74
+ font-family: ${V(pn)};
75
+ font-size: ${Ct}px;
76
+ font-weight: ${X(pn)};
77
+ color: ${Ga};
78
78
  text-align: center;
79
- letter-spacing: ${zi}px;
79
+ letter-spacing: ${Na}px;
80
80
  opacity: 0;
81
81
  position: absolute;
82
82
  transform: translate(-50%, -50%);
83
83
  white-space: nowrap;
84
- `;let _t=bt+Ke+15,Ni=((ln=h.subtitle_offset_y)!=null?ln:_t+Je/2)+((cn=Et.animation_start_y_offset)!=null?cn:-10);ne.style.top=`${Ni}px`,ne.style.left="50%";let Ze=se(ne);Ze.element=ne,Ze.animationStartYOffset=(dn=Et.animation_start_y_offset)!=null?dn:-10,A.appendChild(ne);let q=l==null?void 0:l.ui,Tt=((pn=l==null?void 0:l.gameplay)==null?void 0:pn.tuning)||{},Oi=(q==null?void 0:q.text)||((mn=f.ui)==null?void 0:mn.cta_hint)||"Continue the adventure!",vt=(q==null?void 0:q.font)||"brand.body",St=(q==null?void 0:q.fontSize)||16,De=(un=l==null?void 0:l.render)==null?void 0:un.tint,ji=typeof De=="string"?De:De?`#${De.toString(16).padStart(6,"0")}`:"#FFFFFF",Ii=(hn=Tt.max_width)!=null?hn:x-c*2,Yi=(fn=Tt.line_height)!=null?fn:1.4,ie=document.createElement("div");ie.textContent=Oi,ie.style.cssText=`
85
- font-family: ${Y(vt)};
86
- font-size: ${St}px;
87
- font-weight: ${G(vt)};
88
- color: ${ji};
84
+ `;let hn=cn+Tt+15,qa=((Qn=g.subtitle_offset_y)!=null?Qn:hn+Ct/2)+((Zn=un.animation_start_y_offset)!=null?Zn:-10);ge.style.top=`${qa}px`,ge.style.left="50%";let Lt=xe(ge);Lt.element=ge,Lt.animationStartYOffset=(ei=un.animation_start_y_offset)!=null?ei:-10,A.appendChild(ge);let J=r==null?void 0:r.ui,gn=((ti=r==null?void 0:r.gameplay)==null?void 0:ti.tuning)||{},Wa=(J==null?void 0:J.text)||((ni=f.ui)==null?void 0:ni.cta_hint)||"Continue the adventure!",fn=(J==null?void 0:J.font)||"brand.body",mn=(J==null?void 0:J.fontSize)||16,it=(ii=r==null?void 0:r.render)==null?void 0:ii.tint,Ya=typeof it=="string"?it:it?`#${it.toString(16).padStart(6,"0")}`:"#FFFFFF",Ua=(ai=gn.max_width)!=null?ai:x-p*2,Va=(si=gn.line_height)!=null?si:1.4,fe=document.createElement("div");fe.textContent=Wa,fe.style.cssText=`
85
+ font-family: ${V(fn)};
86
+ font-size: ${mn}px;
87
+ font-weight: ${X(fn)};
88
+ color: ${Ya};
89
89
  text-align: center;
90
90
  opacity: 0;
91
91
  position: absolute;
92
92
  transform: translate(-50%, -50%);
93
- max-width: ${Ii}px;
94
- line-height: ${Yi};
93
+ max-width: ${Ua}px;
94
+ line-height: ${Va};
95
95
  word-wrap: break-word;
96
- `;let Gi=_t+Je+30,Vi=(yn=h.footer_offset_y)!=null?yn:Gi+St/2;ie.style.top=`${Vi}px`,ie.style.left="50%";let Qe=se(ie);Qe.element=ie;let qi=((gn=l==null?void 0:l.render)==null?void 0:gn.alpha)!==void 0&&((bn=l==null?void 0:l.render)==null?void 0:bn.alpha)!==null?l.render.alpha:1;Qe.targetAlpha=qi,A.appendChild(ie);let X=((wn=m==null?void 0:m.gameplay)==null?void 0:wn.tuning)||{},P=m==null?void 0:m.ui,Xi=(En=X.button_width)!=null?En:260,Rt=(xn=X.button_height)!=null?xn:56,Ki=(_n=X.button_radius)!=null?_n:16,Ji=X.button_bg_color||((Tn=f.theme)==null?void 0:Tn.cta_background)||"#ffb43b",Zi=(vn=X.button_bg_alpha)!=null?vn:1,Qi=X.button_border_color||"#ffffff",Ui=(Sn=X.button_border_width)!=null?Sn:2,Va=(Rn=X.button_border_alpha)!=null?Rn:.2,Ue=(An=h.cta_offset_y)!=null?An:d*.7,M=document.createElement("button");M.style.cssText=`
97
- width: ${Xi}px;
98
- height: ${Rt}px;
99
- background: ${Ji};
100
- opacity: ${Zi};
101
- border: ${Ui}px solid ${Qi};
102
- border-radius: ${Ki}px;
96
+ `;let Xa=hn+Ct+30,Ka=(oi=g.footer_offset_y)!=null?oi:Xa+mn/2;fe.style.top=`${Ka}px`,fe.style.left="50%";let At=xe(fe);At.element=fe;let Ja=((ri=r==null?void 0:r.render)==null?void 0:ri.alpha)!==void 0&&((li=r==null?void 0:r.render)==null?void 0:li.alpha)!==null?r.render.alpha:1;At.targetAlpha=Ja,A.appendChild(fe);let Q=((ci=l==null?void 0:l.gameplay)==null?void 0:ci.tuning)||{},D=l==null?void 0:l.ui,Qa=(di=Q.button_width)!=null?di:260,bn=(ui=Q.button_height)!=null?ui:56,Za=(pi=Q.button_radius)!=null?pi:16,es=Q.button_bg_color||((hi=f.theme)==null?void 0:hi.cta_background)||"#ffb43b",ts=(gi=Q.button_bg_alpha)!=null?gi:1,ns=Q.button_border_color||"#ffffff",is=(fi=Q.button_border_width)!=null?fi:2,Fo=(mi=Q.button_border_alpha)!=null?mi:.2,Mt=(bi=g.cta_offset_y)!=null?bi:h*.7,O=document.createElement("button");O.style.cssText=`
97
+ width: ${Qa}px;
98
+ height: ${bn}px;
99
+ background: ${es};
100
+ opacity: ${ts};
101
+ border: ${is}px solid ${ns};
102
+ border-radius: ${Za}px;
103
103
  cursor: pointer;
104
104
  opacity: 0;
105
105
  position: absolute;
106
106
  transform: translate(-50%, -50%);
107
107
  box-shadow: inset 0 0 1px rgba(0,0,0,0.15);
108
- `,M.style.top=`${Ue}px`,M.style.left="50%";let et=se(M);et.element=M,et.addEventListener=M.addEventListener.bind(M),A.appendChild(M);let ea=(P==null?void 0:P.text)||((Cn=f.ui)==null?void 0:Cn.cta_label_end)||"DOWNLOAD",At=(P==null?void 0:P.font)||"brand.heading",ta=(P==null?void 0:P.fontSize)||20,na=X.button_text_color||((Hn=f.theme)==null?void 0:Hn.cta_text)||"#1a0a0a";M.textContent=ea,M.style.fontFamily=Y(At),M.style.fontSize=`${ta}px`,M.style.fontWeight=String(G(At)),M.style.color=na,M.style.letterSpacing=`${(Mn=P==null?void 0:P.letterSpacing)!=null?Mn:1}px`;let Ct=se(M);Ct.element=M;let W=p==null?void 0:p.ui,Ht=((Ln=p==null?void 0:p.gameplay)==null?void 0:Ln.tuning)||{},ia=(W==null?void 0:W.text)||"Play the full game",Mt=(W==null?void 0:W.font)||"brand.body",aa=(W==null?void 0:W.fontSize)||11,sa=(kn=W==null?void 0:W.letterSpacing)!=null?kn:0,$e=(Fn=p==null?void 0:p.render)==null?void 0:Fn.tint,oa=typeof $e=="string"?$e:$e?`#${$e.toString(16).padStart(6,"0")}`:"#CCCCCC",ae=document.createElement("div");ae.textContent=ia,ae.style.cssText=`
109
- font-family: ${Y(Mt)};
110
- font-size: ${aa}px;
111
- font-weight: ${G(Mt)};
112
- color: ${oa};
108
+ `,O.style.top=`${Mt}px`,O.style.left="50%";let kt=xe(O);kt.element=O,kt.addEventListener=O.addEventListener.bind(O),A.appendChild(O);let as=(D==null?void 0:D.text)||((yi=f.ui)==null?void 0:yi.cta_label_end)||"DOWNLOAD",yn=(D==null?void 0:D.font)||"brand.heading",ss=(D==null?void 0:D.fontSize)||20,os=Q.button_text_color||((vi=f.theme)==null?void 0:vi.cta_text)||"#1a0a0a";O.textContent=as,O.style.fontFamily=V(yn),O.style.fontSize=`${ss}px`,O.style.fontWeight=String(X(yn)),O.style.color=os,O.style.letterSpacing=`${(xi=D==null?void 0:D.letterSpacing)!=null?xi:1}px`;let vn=xe(O);vn.element=O;let z=d==null?void 0:d.ui,xn=((wi=d==null?void 0:d.gameplay)==null?void 0:wi.tuning)||{},rs=(z==null?void 0:z.text)||"Play the full game",wn=(z==null?void 0:z.font)||"brand.body",ls=(z==null?void 0:z.fontSize)||11,cs=(Ei=z==null?void 0:z.letterSpacing)!=null?Ei:0,at=(Si=d==null?void 0:d.render)==null?void 0:Si.tint,ds=typeof at=="string"?at:at?`#${at.toString(16).padStart(6,"0")}`:"#CCCCCC",me=document.createElement("div");me.textContent=rs,me.style.cssText=`
109
+ font-family: ${V(wn)};
110
+ font-size: ${ls}px;
111
+ font-weight: ${X(wn)};
112
+ color: ${ds};
113
113
  text-align: center;
114
- letter-spacing: ${sa}px;
114
+ letter-spacing: ${cs}px;
115
115
  opacity: 0;
116
116
  position: absolute;
117
117
  transform: translate(-50%, -50%);
118
118
  white-space: nowrap;
119
- `;let ra=Ue+Rt/2+20,la=d-c-10,ca=Math.min(ra+((Dn=Ht.animation_start_y_offset)!=null?Dn:5),la);ae.style.top=`${ca}px`,ae.style.left="50%";let tt=se(ae);tt.element=ae,tt.animationStartYOffset=($n=Ht.animation_start_y_offset)!=null?$n:5,A.appendChild(ae);let nt=((Pn=y==null?void 0:y.gameplay)==null?void 0:Pn.tuning)||{},da=(Wn=nt.hand_offset_x)!=null?Wn:50,pa=(zn=nt.hand_offset_y)!=null?zn:50,ma=(Nn=(Bn=y==null?void 0:y.transform)==null?void 0:Bn.scale)!=null?Nn:.1875,ua=(On=nt.hand_scale_multiplier)!=null?On:2.5,ha=new ye.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),be=new ye.Sprite(ha),Lt=ma*ua*100;return be.scale.set(Lt,Lt,1),be.position.set(da,Ue+pa,0),be.material.opacity=0,be.visible=!1,{panel:L,logo:I,title:wt,subtitle:Ze,footer:Qe,ctaButton:et,ctaText:Ct,ctaHint:tt,hand:be}}function xi(e,t,n){var _,S,C,F,R,A,L,H;let i=t.objects.get("ui_endgame_1"),a=((_=i==null?void 0:i.gameplay)==null?void 0:_.tuning)||{},s=(S=a.animation_duration_ms)!=null?S:800,r=(C=a.fade_in_duration_ms)!=null?C:600,u=(F=a.scale_animation_intensity)!=null?F:.1,l=(R=a.logo_animation_delay_ms)!=null?R:100,m=(A=a.title_animation_delay_ms)!=null?A:200,p=(L=a.footer_animation_delay_ms)!=null?L:300,y=(H=a.cta_animation_delay_ms)!=null?H:400,{panel:f,logo:h,title:g,subtitle:o,footer:E,ctaButton:T,ctaText:x,ctaHint:d}=e;f.visible=!0,f.element.style.visibility="visible";let c=Date.now(),b=()=>{let ee=Date.now()-c,N=Math.min(ee/r,1),j=1-Math.pow(1-N,3);f.alpha=j,f.element.style.opacity=j.toString();let oe=1+u*(1-j);f.element.style.transform=`translate(-50%, -50%) scale(${oe})`,N<1?requestAnimationFrame(b):(setTimeout(()=>Wa(h,s,t),l),setTimeout(()=>{za(g,s),setTimeout(()=>Ba(o,s),50)},m),setTimeout(()=>Na(E,s),p),setTimeout(()=>{Oa(T,x,s),setTimeout(()=>ja(d,s),50),n&&n()},y))};b()}function Wa(e,t,n){var f,h,g,o,E;let i=n==null?void 0:n.objects.get("ui_endgame_logo_1"),s=(h=(((f=i==null?void 0:i.gameplay)==null?void 0:f.tuning)||{}).animation_start_scale)!=null?h:1.2,r=Date.now(),u=e.material.opacity,l=(g=e.targetAlpha)!=null?g:1,m=(o=e.baseScaleX)!=null?o:e.scale.x,p=(E=e.baseScaleY)!=null?E:e.scale.y,y=()=>{let T=Date.now()-r,x=Math.min(T/t,1),d=1-Math.pow(1-x,2);e.material.opacity=u+(l-u)*d;let c=s+(1-s)*d;e.scale.set(m*c,p*c,1),x<1&&requestAnimationFrame(y)};y()}function za(e,t){let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=()=>{let r=Date.now()-n,u=Math.min(r/t,1),l=1-Math.pow(1-u,2);e.element.style.opacity=(i+(1-i)*l).toString(),e.element.style.top=`${a-20*(1-l)}px`,u<1&&requestAnimationFrame(s)};s()}function Ba(e,t){var u;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((u=e.animationStartYOffset)!=null?u:-10),r=()=>{let l=Date.now()-n,m=Math.min(l/t,1),p=1-Math.pow(1-m,2);e.element.style.opacity=(i+(1-i)*p).toString(),e.element.style.top=`${a+(s-a)*p}px`,m<1&&requestAnimationFrame(r)};r()}function Na(e,t){var r;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=(r=e.targetAlpha)!=null?r:1,s=()=>{let u=Date.now()-n,l=Math.min(u/t,1),m=1-Math.pow(1-l,2);e.element.style.opacity=(i+(a-i)*m).toString(),l<1&&requestAnimationFrame(s)};s()}function Oa(e,t,n){let i=Date.now(),a=parseFloat(e.element.style.opacity||"0"),s=()=>{let r=Date.now()-i,u=Math.min(r/n,1),l=1-Math.pow(1-u,2);e.element.style.opacity=(a+(1-a)*l).toString(),t.element.style.opacity=(a+(1-a)*l).toString(),e.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-l)})`,u<1&&requestAnimationFrame(s)};s()}function ja(e,t){var u;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((u=e.animationStartYOffset)!=null?u:5),r=()=>{let l=Date.now()-n,m=Math.min(l/t,1),p=1-Math.pow(1-m,2);e.element.style.opacity=(i+(1-i)*p).toString(),e.element.style.top=`${a+(s-a)*p}px`,m<1&&requestAnimationFrame(r)};r()}function _i(e,t,n,i){var p,y,f,h;let a=n.objects.get("ui_endgame_hand_1"),s=((p=a==null?void 0:a.gameplay)==null?void 0:p.tuning)||{},r=(y=s.click_animation_duration_ms)!=null?y:600,u=(f=s.click_delay_ms)!=null?f:2e3,l=(h=s.click_repeat_delay_ms)!=null?h:3e3,m=()=>{var S,C;e.visible=!0,e.material.opacity=1;let g=e.position.x,o=e.position.y,E=(S=s.hand_offset_x)!=null?S:50,T=(C=s.hand_offset_y)!=null?C:50,x=t.element.getBoundingClientRect(),d=E,c=T,b=Date.now(),_=()=>{var j,oe,He;let F=Date.now()-b,R=Math.min(F/r,1),A=R<.5?2*R*R:1-Math.pow(-2*R+2,2)/2;e.position.set(g+(d-g)*A,o+(c-o)*A,0);let L=(oe=(j=a==null?void 0:a.transform)==null?void 0:j.scale)!=null?oe:.1875,H=(He=s.hand_scale_multiplier)!=null?He:2.5,ee=L*H*100,N=ee+ee*.2*Math.sin(R*Math.PI);e.scale.set(N,N,1),R<1?requestAnimationFrame(_):(t.element.style.transform="translate(-50%, -50%) scale(0.95)",setTimeout(()=>{t.element.style.transform="translate(-50%, -50%) scale(1)",i()},100),setTimeout(()=>{e.material.opacity=0,setTimeout(()=>{e.position.set(g,o,0),m()},l)},500))};_()};setTimeout(m,u)}var Xe=we(require("three"));function Ti(e,t,n){var h,g,o,E,T,x,d;let i=t.objects.get("hand_tutorial_1"),a=((h=i==null?void 0:i.gameplay)==null?void 0:h.tuning)||{},s=(i==null?void 0:i.render)||{},r=(i==null?void 0:i.transform)||{},u=new Xe.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),l=new Xe.Sprite(u),m=r.position||{},p=(g=m==null?void 0:m.z)!=null?g:0;l.position.set(n.x+((o=m==null?void 0:m.x)!=null?o:0),n.y+((E=m==null?void 0:m.y)!=null?E:0),p),l.material.opacity=s.alpha!==void 0&&s.alpha!==null?s.alpha:0,l.visible=s.visible!==void 0&&s.visible!==null?s.visible:!1;let y=(T=a.hand_scale_multiplier)!=null?T:2.5,f=(x=r.scale)!=null?x:.1875;return l.scale.set(f*y*100,f*y*100,1),l.renderOrder=(d=s.z_index)!=null?d:99999,l}function vi(e){var g,o,E,T,x,d,c,b,_;let t=e.objects.get("ui_tutorial_1"),n=t==null?void 0:t.ui,i=(t==null?void 0:t.render)||{},a=((g=e.engine.runtime)==null?void 0:g.ui_styles)||{},s=((o=e.engine.runtime)==null?void 0:o.ui)||{},r=(n==null?void 0:n.text)||s.tutorial_label||s.label_text||"CLEAN!",u=(n==null?void 0:n.font)||"brand.warning",l=(n==null?void 0:n.fontSize)||a.label_font_size||52,m=(T=n==null?void 0:n.letterSpacing)!=null?T:(E=a.label_letter_spacing)!=null?E:-1,p=(n==null?void 0:n.align)||"center",y=i.tint,f=typeof y=="string"?y:y?`#${y.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",h=document.createElement("div");return h.textContent=r,h.style.cssText=`
120
- font-family: ${Y(u)};
121
- font-size: ${l}px;
122
- font-weight: ${G(u)};
119
+ `;let us=Mt+bn/2+20,ps=h-p-10,hs=Math.min(us+((_i=xn.animation_start_y_offset)!=null?_i:5),ps);me.style.top=`${hs}px`,me.style.left="50%";let Rt=xe(me);Rt.element=me,Rt.animationStartYOffset=(Ti=xn.animation_start_y_offset)!=null?Ti:5,A.appendChild(me);let It=((Ci=m==null?void 0:m.gameplay)==null?void 0:Ci.tuning)||{},gs=(Li=It.hand_offset_x)!=null?Li:50,fs=(Ai=It.hand_offset_y)!=null?Ai:50,ms=(ki=(Mi=m==null?void 0:m.transform)==null?void 0:Mi.scale)!=null?ki:.1875,bs=(Ri=It.hand_scale_multiplier)!=null?Ri:2.5,ys=new Oe.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),Pe=new Oe.Sprite(ys),En=ms*bs*100;return Pe.scale.set(En,En,1),Pe.position.set(gs,Mt+fs,0),Pe.material.opacity=0,Pe.visible=!1,{panel:H,logo:Y,title:dn,subtitle:Lt,footer:At,ctaButton:kt,ctaText:vn,ctaHint:Rt,hand:Pe}}function Ta(e,t,n){var E,_,M,R,L,A,H,I;let i=t.objects.get("ui_endgame_1"),a=((E=i==null?void 0:i.gameplay)==null?void 0:E.tuning)||{},s=(_=a.animation_duration_ms)!=null?_:800,o=(M=a.fade_in_duration_ms)!=null?M:600,u=(R=a.scale_animation_intensity)!=null?R:.1,r=(L=a.logo_animation_delay_ms)!=null?L:100,l=(A=a.title_animation_delay_ms)!=null?A:200,d=(H=a.footer_animation_delay_ms)!=null?H:300,m=(I=a.cta_animation_delay_ms)!=null?I:400,{panel:f,logo:g,title:b,subtitle:c,footer:v,ctaButton:S,ctaText:x,ctaHint:h}=e;f.visible=!0,f.element.style.visibility="visible";let p=Date.now(),y=()=>{let pe=Date.now()-p,G=Math.min(pe/o,1),W=1-Math.pow(1-G,3);f.alpha=W,f.element.style.opacity=W.toString();let we=1+u*(1-W);f.element.style.transform=`translate(-50%, -50%) scale(${we})`,G<1?requestAnimationFrame(y):(setTimeout(()=>Ro(g,s,t),r),setTimeout(()=>{Io(b,s),setTimeout(()=>Oo(c,s),50)},l),setTimeout(()=>Ho(v,s),d),setTimeout(()=>{Po(S,x,s),setTimeout(()=>jo(h,s),50),n&&n()},m))};y()}function Ro(e,t,n){var f,g,b,c,v;let i=n==null?void 0:n.objects.get("ui_endgame_logo_1"),s=(g=(((f=i==null?void 0:i.gameplay)==null?void 0:f.tuning)||{}).animation_start_scale)!=null?g:1.2,o=Date.now(),u=e.material.opacity,r=(b=e.targetAlpha)!=null?b:1,l=(c=e.baseScaleX)!=null?c:e.scale.x,d=(v=e.baseScaleY)!=null?v:e.scale.y,m=()=>{let S=Date.now()-o,x=Math.min(S/t,1),h=1-Math.pow(1-x,2);e.material.opacity=u+(r-u)*h;let p=s+(1-s)*h;e.scale.set(l*p,d*p,1),x<1&&requestAnimationFrame(m)};m()}function Io(e,t){let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=()=>{let o=Date.now()-n,u=Math.min(o/t,1),r=1-Math.pow(1-u,2);e.element.style.opacity=(i+(1-i)*r).toString(),e.element.style.top=`${a-20*(1-r)}px`,u<1&&requestAnimationFrame(s)};s()}function Oo(e,t){var u;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((u=e.animationStartYOffset)!=null?u:-10),o=()=>{let r=Date.now()-n,l=Math.min(r/t,1),d=1-Math.pow(1-l,2);e.element.style.opacity=(i+(1-i)*d).toString(),e.element.style.top=`${a+(s-a)*d}px`,l<1&&requestAnimationFrame(o)};o()}function Ho(e,t){var o;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=(o=e.targetAlpha)!=null?o:1,s=()=>{let u=Date.now()-n,r=Math.min(u/t,1),l=1-Math.pow(1-r,2);e.element.style.opacity=(i+(a-i)*l).toString(),r<1&&requestAnimationFrame(s)};s()}function Po(e,t,n){let i=Date.now(),a=parseFloat(e.element.style.opacity||"0"),s=()=>{let o=Date.now()-i,u=Math.min(o/n,1),r=1-Math.pow(1-u,2);e.element.style.opacity=(a+(1-a)*r).toString(),t.element.style.opacity=(a+(1-a)*r).toString(),e.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-r)})`,u<1&&requestAnimationFrame(s)};s()}function jo(e,t){var u;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((u=e.animationStartYOffset)!=null?u:5),o=()=>{let r=Date.now()-n,l=Math.min(r/t,1),d=1-Math.pow(1-l,2);e.element.style.opacity=(i+(1-i)*d).toString(),e.element.style.top=`${a+(s-a)*d}px`,l<1&&requestAnimationFrame(o)};o()}function Ca(e,t,n,i){var d,m,f,g;let a=n.objects.get("ui_endgame_hand_1"),s=((d=a==null?void 0:a.gameplay)==null?void 0:d.tuning)||{},o=(m=s.click_animation_duration_ms)!=null?m:600,u=(f=s.click_delay_ms)!=null?f:2e3,r=(g=s.click_repeat_delay_ms)!=null?g:3e3,l=()=>{var _,M;e.visible=!0,e.material.opacity=1;let b=e.position.x,c=e.position.y,v=(_=s.hand_offset_x)!=null?_:50,S=(M=s.hand_offset_y)!=null?M:50,x=t.element.getBoundingClientRect(),h=v,p=S,y=Date.now(),E=()=>{var W,we,Qe;let R=Date.now()-y,L=Math.min(R/o,1),A=L<.5?2*L*L:1-Math.pow(-2*L+2,2)/2;e.position.set(b+(h-b)*A,c+(p-c)*A,0);let H=(we=(W=a==null?void 0:a.transform)==null?void 0:W.scale)!=null?we:.1875,I=(Qe=s.hand_scale_multiplier)!=null?Qe:2.5,pe=H*I*100,G=pe+pe*.2*Math.sin(L*Math.PI);e.scale.set(G,G,1),L<1?requestAnimationFrame(E):(t.element.style.transform="translate(-50%, -50%) scale(0.95)",setTimeout(()=>{t.element.style.transform="translate(-50%, -50%) scale(1)",i()},100),setTimeout(()=>{e.material.opacity=0,setTimeout(()=>{e.position.set(b,c,0),l()},r)},500))};E()};setTimeout(l,u)}var _t=re(require("three"));function La(e,t,n){var g,b,c,v,S,x,h;let i=t.objects.get("hand_tutorial_1"),a=((g=i==null?void 0:i.gameplay)==null?void 0:g.tuning)||{},s=(i==null?void 0:i.render)||{},o=(i==null?void 0:i.transform)||{},u=new _t.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),r=new _t.Sprite(u),l=o.position||{},d=(b=l==null?void 0:l.z)!=null?b:0;r.position.set(n.x+((c=l==null?void 0:l.x)!=null?c:0),n.y+((v=l==null?void 0:l.y)!=null?v:0),d),r.material.opacity=s.alpha!==void 0&&s.alpha!==null?s.alpha:0,r.visible=s.visible!==void 0&&s.visible!==null?s.visible:!1;let m=(S=a.hand_scale_multiplier)!=null?S:2.5,f=(x=o.scale)!=null?x:.1875;return r.scale.set(f*m*100,f*m*100,1),r.renderOrder=(h=s.z_index)!=null?h:99999,r}function Aa(e){var b,c,v,S,x,h,p,y,E;let t=e.objects.get("ui_tutorial_1"),n=t==null?void 0:t.ui,i=(t==null?void 0:t.render)||{},a=((b=e.engine.runtime)==null?void 0:b.ui_styles)||{},s=((c=e.engine.runtime)==null?void 0:c.ui)||{},o=(n==null?void 0:n.text)||s.tutorial_label||s.label_text||"CLEAN!",u=(n==null?void 0:n.font)||"brand.warning",r=(n==null?void 0:n.fontSize)||a.label_font_size||52,l=(S=n==null?void 0:n.letterSpacing)!=null?S:(v=a.label_letter_spacing)!=null?v:-1,d=(n==null?void 0:n.align)||"center",m=i.tint,f=typeof m=="string"?m:m?`#${m.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",g=document.createElement("div");return g.textContent=o,g.style.cssText=`
120
+ font-family: ${V(u)};
121
+ font-size: ${r}px;
122
+ font-weight: ${X(u)};
123
123
  color: ${f};
124
- text-align: ${p};
125
- letter-spacing: ${m}px;
126
- text-shadow: ${(x=a.label_shadow_distance)!=null?x:2}px ${(d=a.label_shadow_distance)!=null?d:2}px ${(c=a.label_shadow_blur)!=null?c:4}px rgba(0,0,0,${(b=a.label_shadow_alpha)!=null?b:.8});
124
+ text-align: ${d};
125
+ letter-spacing: ${l}px;
126
+ text-shadow: ${(x=a.label_shadow_distance)!=null?x:2}px ${(h=a.label_shadow_distance)!=null?h:2}px ${(p=a.label_shadow_blur)!=null?p:4}px rgba(0,0,0,${(y=a.label_shadow_alpha)!=null?y:.8});
127
127
  -webkit-text-stroke: ${a.label_stroke||"#8B0000"} 2px;
128
- opacity: ${(_=i.alpha)!=null?_:0};
128
+ opacity: ${(E=i.alpha)!=null?E:0};
129
129
  visibility: ${i.visible!==!1?"visible":"hidden"};
130
130
  pointer-events: none;
131
131
  position: absolute;
132
132
  transform: translate(-50%, -50%);
133
133
  white-space: nowrap;
134
- `,h}function Si(e,t,n,i,a){var l,m,p,y,f,h,g;let s=a.objects.get("hand_tutorial_1"),r=((l=s==null?void 0:s.gameplay)==null?void 0:l.tuning)||{},u=(s==null?void 0:s.transform)||{};if(!i){let o=(m=r.animation_duration)!=null?m:1.5,E=n%o/o,T=E<.5?2*E*E:-1+(4-2*E)*E,x=(p=r.x_offset)!=null?p:0,d=(y=r.y_offset)!=null?y:0,c=(f=r.animation_range)!=null?f:40,b=c*.7,_=c,S=t.x+x+b,C=t.y+d+_,F=S+b,R=C+_;e.position.set(S+(F-S)*T,C+(R-C)*T,0);let A=(h=u.scale)!=null?h:.1875,L=(g=r.hand_scale_multiplier)!=null?g:2.5,H=A*L*100;e.scale.set(H,H,1)}}var ge=we(require("three")),Ri=new ge.TextureLoader,ht=null,ft=null;async function Ai(){if(ht)return ht;if(!ft){let n=(()=>{if(typeof window!="undefined")try{return new URL("inline-assets.js",window.location.href).href}catch{return"./inline-assets.js"}return"./inline-assets.js"})();ft=new Function("path","return import(path)")(n).then(i=>i?i.INLINE_ASSETS?i.INLINE_ASSETS:(console.warn("[assets] Module does not have INLINE_ASSETS export. Module keys:",Object.keys(i)),{}):(console.warn("[assets] Module import returned undefined"),{})).catch(i=>(console.warn("[assets] Failed to load inline-assets.js:",i),{}))}let e=await ft;return ht=e||{},e||{}}async function yt(e,t,n=16777215,i=!1){try{let s=(await Ai())[e];return await Ri.loadAsync(s||e)}catch{console.warn(`Asset missing: ${e}. Using placeholder.`);let s=document.createElement("canvas");s.width=64,s.height=64;let r=s.getContext("2d");return r&&(r.fillStyle=`#${n.toString(16).padStart(6,"0")}`,i?r.fillRect(0,0,30,60):(r.beginPath(),r.arc(32,32,30,0,Math.PI*2),r.fill(),r.fillRect(27,32,10,40))),new ge.CanvasTexture(s)}}async function Ci(e,t,n){var g,o,E,T;let a=(await Ai())[e]||e,s;try{s=await Ri.loadAsync(a),console.log("[character] loaded sheet",{path:e,sourceUsed:a})}catch(x){let b=((n.gameplay.character_sheet||{}).fallback_color||"#ff00ff").replace("#","");s=await yt(e,t,parseInt(b,16),!0),console.warn("[character] fallback loadAsset used",{path:e,err:x})}if(!s)return[];let r=n.gameplay.character_sheet||{},u=(g=r.cols)!=null?g:3,l=(o=r.rows)!=null?o:2,m=((E=s.image)==null?void 0:E.width)||0,p=((T=s.image)==null?void 0:T.height)||0,y=m/u,f=p/l;if(!Number.isFinite(y)||!Number.isFinite(f)||y<=0||f<=0)return[s];let h=[];for(let x=0;x<l;x++)for(let d=0;d<u;d++){let c=document.createElement("canvas");c.width=y,c.height=f;let b=c.getContext("2d");b&&s.image&&b.drawImage(s.image,d*y,x*f,y,f,0,0,y,f),h.push(new ge.CanvasTexture(c))}return h.length>2&&h.push(...h.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:h.length}),h}function Hi(e,t){var y,f,h,g;let n=t.gameplay.brush||{},i=t.theme.brush_color||"#ffffff",a=(y=n.radius)!=null?y:20,s=(f=n.inner_radius)!=null?f:15,r=(h=n.alpha)!=null?h:.8,u=(g=n.inner_alpha)!=null?g:.3,l=n.inner_color||"#ffffff",m=document.createElement("canvas");m.width=a*2,m.height=a*2;let p=m.getContext("2d");return p&&(p.clearRect(0,0,m.width,m.height),p.beginPath(),p.arc(a,a,a,0,Math.PI*2),p.fillStyle=i,p.globalAlpha=r,p.fill(),p.beginPath(),p.arc(a,a,s,0,Math.PI*2),p.fillStyle=l,p.globalAlpha=u,p.fill()),new ge.CanvasTexture(m)}0&&(module.exports={AspectClass,GameObject,GameObjectManager,Renderer,ResponsiveUISystem,Transform,animateHandClick,animatePanelEntrance,createBrushTexture,createEndGamePanel,createHandTutorial,createThreeBase,createTutorialLabel,getAspectClass,getRegisteredFontIds,loadAsset,loadCharacterFrames,registerFont,resolveFont,resolveFontWeight,updateHandAnimation});
134
+ `,g}function Ma(e,t,n,i,a){var r,l,d,m,f,g,b;let s=a.objects.get("hand_tutorial_1"),o=((r=s==null?void 0:s.gameplay)==null?void 0:r.tuning)||{},u=(s==null?void 0:s.transform)||{};if(!i){let c=(l=o.animation_duration)!=null?l:1.5,v=n%c/c,S=v<.5?2*v*v:-1+(4-2*v)*v,x=(d=o.x_offset)!=null?d:0,h=(m=o.y_offset)!=null?m:0,p=(f=o.animation_range)!=null?f:40,y=p*.7,E=p,_=t.x+x+y,M=t.y+h+E,R=_+y,L=M+E;e.position.set(_+(R-_)*S,M+(L-M)*S,0);let A=(g=u.scale)!=null?g:.1875,H=(b=o.hand_scale_multiplier)!=null?b:2.5,I=A*H*100;e.scale.set(I,I,1)}}var He=re(require("three")),ka=new He.TextureLoader,sn=null,on=null;async function Ra(){if(sn)return sn;if(!on){let n=(()=>{if(typeof window!="undefined")try{return new URL("inline-assets.js",window.location.href).href}catch{return"./inline-assets.js"}return"./inline-assets.js"})();on=new Function("path","return import(path)")(n).then(i=>i?i.INLINE_ASSETS?i.INLINE_ASSETS:(console.warn("[assets] Module does not have INLINE_ASSETS export. Module keys:",Object.keys(i)),{}):(console.warn("[assets] Module import returned undefined"),{})).catch(i=>(console.warn("[assets] Failed to load inline-assets.js:",i),{}))}let e=await on;return sn=e||{},e||{}}async function rn(e,t,n=16777215,i=!1){try{let s=(await Ra())[e];return await ka.loadAsync(s||e)}catch{console.warn(`Asset missing: ${e}. Using placeholder.`);let s=document.createElement("canvas");s.width=64,s.height=64;let o=s.getContext("2d");return o&&(o.fillStyle=`#${n.toString(16).padStart(6,"0")}`,i?o.fillRect(0,0,30,60):(o.beginPath(),o.arc(32,32,30,0,Math.PI*2),o.fill(),o.fillRect(27,32,10,40))),new He.CanvasTexture(s)}}async function Ia(e,t,n){var b,c,v,S;let a=(await Ra())[e]||e,s;try{s=await ka.loadAsync(a),console.log("[character] loaded sheet",{path:e,sourceUsed:a})}catch(x){let y=((n.gameplay.character_sheet||{}).fallback_color||"#ff00ff").replace("#","");s=await rn(e,t,parseInt(y,16),!0),console.warn("[character] fallback loadAsset used",{path:e,err:x})}if(!s)return[];let o=n.gameplay.character_sheet||{},u=(b=o.cols)!=null?b:3,r=(c=o.rows)!=null?c:2,l=((v=s.image)==null?void 0:v.width)||0,d=((S=s.image)==null?void 0:S.height)||0,m=l/u,f=d/r;if(!Number.isFinite(m)||!Number.isFinite(f)||m<=0||f<=0)return[s];let g=[];for(let x=0;x<r;x++)for(let h=0;h<u;h++){let p=document.createElement("canvas");p.width=m,p.height=f;let y=p.getContext("2d");y&&s.image&&y.drawImage(s.image,h*m,x*f,m,f,0,0,m,f),g.push(new He.CanvasTexture(p))}return g.length>2&&g.push(...g.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:g.length}),g}function Oa(e,t){var m,f,g,b;let n=t.gameplay.brush||{},i=t.theme.brush_color||"#ffffff",a=(m=n.radius)!=null?m:20,s=(f=n.inner_radius)!=null?f:15,o=(g=n.alpha)!=null?g:.8,u=(b=n.inner_alpha)!=null?b:.3,r=n.inner_color||"#ffffff",l=document.createElement("canvas");l.width=a*2,l.height=a*2;let d=l.getContext("2d");return d&&(d.clearRect(0,0,l.width,l.height),d.beginPath(),d.arc(a,a,a,0,Math.PI*2),d.fillStyle=i,d.globalAlpha=o,d.fill(),d.beginPath(),d.arc(a,a,s,0,Math.PI*2),d.fillStyle=r,d.globalAlpha=u,d.fill()),new He.CanvasTexture(l)}0&&(module.exports={AspectClass,GameObject,GameObjectManager,Renderer,ResponsiveUISystem,Transform,animateHandClick,animatePanelEntrance,createBrushTexture,createEndGamePanel,createHandTutorial,createThreeBase,createTutorialLabel,getAspectClass,getRegisteredFontIds,loadAsset,loadCharacterFrames,registerFont,resolveFont,resolveFontWeight,updateHandAnimation});
@@ -1,4 +1,4 @@
1
- import{b as dt}from"../chunk-UVBNGLP3.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=`
1
+ import{Z as dt}from"../chunk-GYW3GFXA.mjs";import"../chunk-BDZGKN5O.mjs";import"../chunk-HN7I4BLB.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handler-playable-sdk",
3
- "version": "0.2.7",
3
+ "version": "0.3.2",
4
4
  "description": "Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "scripts": {
26
26
  "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",
27
27
  "build:dev": "tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",
28
- "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",
28
+ "obfuscate": "javascript-obfuscator 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",
29
29
  "lint": "eslint 'src/**/*.{ts,tsx}'",
30
30
  "typecheck": "tsc --noEmit",
31
31
  "prepublishOnly": "npm run build",
@@ -1,17 +0,0 @@
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=`
2
- (function(){
3
- var events = ['touchstart','touchend','mousedown','keydown'];
4
- function unlock(){
5
- if(window.AudioContext && AudioContext.prototype.resume){
6
- if(!window.__handler_audio_ctx){
7
- window.__handler_audio_ctx = new AudioContext();
8
- }
9
- if(window.__handler_audio_ctx.state === 'suspended'){
10
- window.__handler_audio_ctx.resume();
11
- }
12
- }
13
- events.forEach(function(e){ document.removeEventListener(e, unlock); });
14
- }
15
- events.forEach(function(e){ document.addEventListener(e, unlock, false); });
16
- })();
17
- `,e.appendChild(t)}export{p as a,Be as b};