handler-playable-sdk 0.3.53 → 0.3.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -43,7 +43,7 @@
43
43
  <button class="debug-btn primary" data-modal-apply>Apply</button>
44
44
  </div>
45
45
  </div>
46
- `,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};gt(pl,{COLORS:()=>le,ConfigWatcher:()=>$e,DebugPanel:()=>kt,DefaultReloadStrategy:()=>Ct,Handler:()=>ne,PlayableLoadingScreen:()=>Un,PreviewShell:()=>Hn,STROKE_WIDTH:()=>hs,THEME:()=>ms,applyConfigOverride:()=>Ae,applyConfigOverrides:()=>Se,applyConfigsToDisk:()=>Et,applyDefaults:()=>De,baseLottie:()=>ai,bootstrap:()=>el,clearConfigOverrides:()=>Ce,clearConfigOverridesForObject:()=>mr,configOverrideManager:()=>br,createPreviewShell:()=>oa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>pn,deviceGroups:()=>Mi,devicePresets:()=>Pi,diffConfigs:()=>Ai,exportConfigsAsJSON:()=>wt,getConfigOverrides:()=>Y,getConfigStateSummary:()=>an,getOverrideMode:()=>xt,getPresetById:()=>ze,getPresetsByCategory:()=>Oo,loadAllObjectConfigs:()=>on,loadComponentSchemas:()=>sn,loadEngineConfig:()=>ln,loadGamePromptConfig:()=>xi,loadObjectCentricConfig:()=>me,loadObjectConfig:()=>Le,loadSceneConfig:()=>cn,rehydrateObject:()=>Si,removeConfigOverride:()=>nn,resetToApplied:()=>At,resetToOriginal:()=>rn,setBootstrapDependencies:()=>Zo,setOverrideMode:()=>bi,setupHotReload:()=>Ti,setupLiveEditBridge:()=>Bn,toLegacyFormat:()=>wi,validateObjectConfig:()=>Je});module.exports=$s(pl);var xe={};function Ft(i,e,t=!1){xe[i]||(xe[i]=[]),xe[i].push({fn:e,once:t})}function ei(i,e){if(xe[i]){if(!e){delete xe[i];return}xe[i]=xe[i].filter(t=>t.fn!==e)}}function Ut(i,...e){let t=xe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&ei(i,n.fn)}function X(i,e){Ft(i,e,!0)}var F=null,ee=[],Ve=null;function La(i){F=i,ee=[],Ve!==null&&(clearTimeout(Ve),Ve=null)}function Ta(){var i,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(i=F==null?void 0:F.batchSize)!=null?i:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function Sa(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function ti(i,e){let t=Ta();if(e&&t.endpoint){if(ee.push(i),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){Ca();return}Ve===null&&(Ve=window.setTimeout(()=>{Ve=null,Ca()},t.flushIntervalMs))}}async function Ca(){let i=Ta();if(!i.endpoint||ee.length===0)return;let e=ee.splice(0,i.batchSize);await Sa(i.endpoint,{events:e},i.transport,i.debug),ee.length>0&&await Sa(i.endpoint,{events:ee.splice(0,i.batchSize)},i.transport,i.debug)}function _a(i){return Math.max(0,Math.min(1,i))}function zs(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ft(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ns(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Pa(i,e,t){try{i[e]=t}catch{}}function Hs(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function Ma(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function ka(i,e){let t=Hs(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function Oa(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=p=>{var u;i.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),n()},r=p=>{i.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},s=p=>{p.killed||(p.killed=!0,r(p))},o=()=>{var d,u;let p=ft();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let h=p-g.startMs-g.delayMs;if(h<0)continue;let f=g.durationMs>0?h/g.durationMs:1,m=_a(f),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let w=f-y;m=_a(w)}let v=g.ease(m);g.yoyo&&y%2===1&&(v=1-v);for(let w of g.props)Pa(g.target,w.key,w.from+(w.to-w.from)*v);g.scaleFrom&&g.scaleTo&&Ma(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(f>=b){s(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var w;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),h=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((w=u==null?void 0:u.delayMsOverride)!=null?w:0)),f=zs(d.ease),m=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(d)){if(y.has(E))continue;let T=d[E];typeof T=="number"&&v.push({key:E,from:Ns(p,E),to:T})}let x=ka(p,d);return{target:p,startMs:ft(),delayMs:h,durationMs:g,ease:f,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:m,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ft())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:ft(),h=ft()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let h=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&Pa(p,g,h)}let u=ka(p,d);u.to&&Ma(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))s(u)},timeline(p={}){let d=[],u=0,g=!1,h=[],f=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},m=y=>{d.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return m({kind:"to",target:y,vars:v,atMs:f(x)}),b},fromTo(y,v,x,w){return m({kind:"fromTo",target:y,vars:x,from:v,atMs:f(w)}),b},play(){var y,v;if(g)return b;g=!0,h=[];for(let x of d)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),h.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return p.paused||b.play(),b}};return c}function Ia(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Oa()}catch{}}var ja={name:"handler-playable-sdk",version:"0.3.53",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Fs=J++,Ra=J++,Da=J++,$a=J++,za=J++,Na=J++,Ha=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,H=Fs;function Va(){return H===Ra}function Wa(){return H===Da}function Ya(){return H===$a}function Ka(){return H===za}function We(){return H===Na}function Ye(){return H===Ha}function Xa(){return H===Ba}function Ja(){return H===Fa}function Za(){return H===Ua}function ni(){return H===Ga}function ii(){return H===qa}function Qa(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),H=Ra;return}catch{}else if(i==="dapi")try{dapi.isReady(),H=Da;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=$a)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=za)}catch{}else if(e==="mintegral")window.gameReady&&(H=Na);else if(e==="tapjoy")window.TJ_API&&(H=Ha);else if(e==="tiktok")window.openAppStore&&(H=Ba);else if(e==="smadex")try{window.smxTracking&&(H=Fa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Ua)}catch{}else e==="vungle"?H=Ga:(i==="nucleo"||e==="nucleo")&&(H=qa)}var Gt=qe(require("lottie-web"),1),ai=Gt.default;typeof window!="undefined"&&(window.lottie=Gt.default,window.__baseLottie=Gt.default);var Us=require("pixi.js");var ri=require("pixi.js");var Gs=null;function si(i){Gs=i}qt();oi();var ht=require("pixi.js");qt();var Xs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",pi=Xs;if(typeof window!="undefined")try{let i=new XMLHttpRequest;if(i.open("GET","./build-settings.json",!1),i.send(),i.status===200&&i.responseText){let e=JSON.parse(i.responseText);e!=null&&e.buildMode&&(pi=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${pi}`))}}catch{}function Js(i){var t,n,a,r,s;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(i);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(i))return{x:(t=i[0])!=null?t:.5,y:(n=i[1])!=null?n:.5};if(i&&typeof i=="object"&&"x"in i&&"y"in i)return{x:(a=i.x)!=null?a:.5,y:(r=i.y)!=null?r:.5};if(typeof i=="string"){let o=i.trim().toLowerCase();return(s=e[o])!=null?s:{x:.5,y:.5}}return null}var Ee=class{static async create(e,t,n){var l,c,p,d,u,g,h;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${pi}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let f=new ht.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let s=await je.load(e,a,n,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=s==null?void 0:s.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",e),o=new ht.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(d=o==null?void 0:o.constructor)==null?void 0:d.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=s==null?void 0:s.constructor)==null?void 0:u.name,s),s&&(((g=s.constructor)==null?void 0:g.name)==="Container"||s instanceof ht.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],m=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(h=o==null?void 0:o.constructor)==null?void 0:h.name),m=!0;break}}catch{continue}m||(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,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,n){var a,r,s,o;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((s=t.position.x)!=null?s:0,(o=t.position.y)!=null?o:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Js(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var mt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var eo=qe(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=eo);Ke();var Vt=require("pixi.js");Ke();var fi=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new mt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let n=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var o;let s=this.registry.get(r);if(!s){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ee.create(r,s,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await n(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await n(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let n=await Ee.create(e,t,this.app);this.instanceCache.set(e,n)}}get(e){return this.instanceCache.get(e)}},to=new fi,no=new Proxy(to,{get(i,e){if(e in i&&typeof i[e]=="function")return i[e].bind(i);if(i.get(e))return i.get(e)}});Ke();var rr=require("pixi.js"),ge={width:400,height:600,designWidth:400,scaleFactor:1},Yt={scale:1,position:1},mi=[];function ao(i,e,t,n,a,r,s){mi.push({element:i,originalScale:r,positionHelper:e,heightPercent:a}),e(i,t,n,a,r,s,!1)}function ro(){mi.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*ge.scaleFactor;t(i,ge.width,ge.height,n,a,!0,!1)})}function hi(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),ge.width=i,ge.height=e,ge.scaleFactor=Math.min(i/ge.designWidth,1.15),Yt.scale=ge.scaleFactor,Yt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Yt.scale.toFixed(3)}`),ro()}var yt={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}};function so(i,e,t){let n=yt[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function oo(){return yt}var lo={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Wt(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Kt(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Wt(i[0],e.x),y:Wt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Wt(n.x,e.x),y:Wt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=lo[n])!=null?t:e}return e}function sr(i,e,t,n={}){var g,h,f,m,b,y;let a=Kt(t),r=(g=n.inset)!=null?g:{},s=(h=n.padding)!=null?h:{x:0,y:0},o=((f=r.left)!=null?f:0)+s.x,l=((m=r.right)!=null?m:0)+s.x,c=((b=r.top)!=null?b:0)+s.y,p=((y=r.bottom)!=null?y:0)+s.y,d=Math.max(0,i-o-l),u=Math.max(0,e-c-p);return{x:o+d*a.x,y:c+u*a.y}}function or(i,e,t,n={}){var f,m,b,y,v,x;let a=(f=n.inset)!=null?f:{},r=(m=n.padding)!=null?m:{x:0,y:0},s=((b=a.left)!=null?b:0)+r.x,o=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,p=Math.max(0,i-s-o),d=Math.max(0,e-l-c),u=Kt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:s+p*g,y:l+d*h}}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,hi(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),hi(window.innerWidth,window.innerHeight),window.updateDebugConfig=so,window.getDebugConfig=oo,window.copyConfig=xo,window.applyConfig=bt,window.applyConfigForRatio=wo,window.positionAtBottom=lr,window.positionAtTop=uo,window.positionAtCenter=go,window.positionAtLeft=fo,window.positionAtRight=ho,window.positionAtBottomLeft=mo,window.positionAtBottomRight=bo,window.positionAtTopLeft=yo,window.positionAtTopRight=vo,window.applyPositionContract=po,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 Xt(i,e,t=0){return i*e+t}function Jt(i,e,t=0){return i*(1-e)+t}function Zt(i,e,t=0){return i*e+t}function Qt(i,e,t=0){return i*(1-e)+t}function Z(i,e=0){return i/2+e}function co(i,e){return i*e}function po(i,e,t,n){var s,o,l,c,p,d,u,g,h,f,m,b,y,v,x,w,E,T,S,O;let a=0,r=0;switch(n.type){case"top":a=Z(e,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),r=Xt(t,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(d=(p=n.offset)==null?void 0:p.x)!=null?d:0),r=Jt(t,n.percent,(g=(u=n.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Zt(e,n.percent,(f=(h=n.offset)==null?void 0:h.x)!=null?f:0),r=Z(t,(b=(m=n.offset)==null?void 0:m.y)!=null?b:0);break;case"right":a=Qt(e,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":a=Z(e,(T=(E=n.offset)==null?void 0:E.x)!=null?T:0),r=Z(t,(O=(S=n.offset)==null?void 0:S.y)!=null?O:0);break}i.position?i.position.set(a,r):(i.x=a,i.y=r),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function lr(i,e,t,n=.2,a=1,r=!0,s=!1){let o=co(t,n),l=Jt(t,n/2);fe(i,Z(e),l);let c=r?a*ge.scaleFactor:a;he(i,c),s&&!mi.find(p=>p.element===i)&&ao(i,lr,e,t,n,a,r)}function uo(i,e,t,n=.1,a=1){fe(i,Z(e),Xt(t,n)),he(i,a)}function go(i,e,t,n=0,a=0,r=1){fe(i,Z(e,n),Z(t,a)),he(i,r)}function fo(i,e,t,n=.1,a=1){fe(i,Zt(e,n),Z(t)),he(i,a)}function ho(i,e,t,n=.1,a=1){fe(i,Qt(e,n),Z(t)),he(i,a)}function mo(i,e,t,n=.05,a=.05,r=1){fe(i,Zt(e,a),Jt(t,n)),he(i,r)}function bo(i,e,t,n=.05,a=.05,r=1){fe(i,Qt(e,a),Jt(t,n)),he(i,r)}function yo(i,e,t,n=.05,a=.05,r=1){fe(i,Zt(e,a),Xt(t,n)),he(i,r)}function vo(i,e,t,n=.05,a=.05,r=1){fe(i,Qt(e,a),Xt(t,n)),he(i,r)}function fe(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function he(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.scale.y=e))}var Re={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}},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}},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}},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}}};function xo(i){return i&&Re[i]?JSON.parse(JSON.stringify(Re[i])):JSON.parse(JSON.stringify(yt))}function bt(i){Object.keys(i).forEach(e=>{let t=e;yt[t]&&i[t]&&Object.assign(yt[t],i[t])}),console.log("Config applied:",i)}function wo(i,e){let t=i/e;t>1.6?(bt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(bt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(bt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(bt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let i=window;i.configPresets=Re,i.resolveAnchorVec2=i.resolveAnchorVec2||Kt,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||sr,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||or}dn();function U(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var Nc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Hc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_i=[{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:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Pi=[..._i],Mi=[{category:"playable",label:"Playable Ad",devices:_i}],pn=_i[0];function ze(i){return Pi.find(e=>e.id===i)||pn}function Oo(i){return Pi.filter(e=>e.category===i)}var un=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
46
+ `,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};gt(pl,{COLORS:()=>le,ConfigWatcher:()=>$e,DebugPanel:()=>kt,DefaultReloadStrategy:()=>Ct,Handler:()=>ne,PlayableLoadingScreen:()=>Un,PreviewShell:()=>Hn,STROKE_WIDTH:()=>hs,THEME:()=>ms,applyConfigOverride:()=>Ae,applyConfigOverrides:()=>Se,applyConfigsToDisk:()=>Et,applyDefaults:()=>De,baseLottie:()=>ai,bootstrap:()=>el,clearConfigOverrides:()=>Ce,clearConfigOverridesForObject:()=>mr,configOverrideManager:()=>br,createPreviewShell:()=>oa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>pn,deviceGroups:()=>Mi,devicePresets:()=>Pi,diffConfigs:()=>Ai,exportConfigsAsJSON:()=>wt,getConfigOverrides:()=>Y,getConfigStateSummary:()=>an,getOverrideMode:()=>xt,getPresetById:()=>ze,getPresetsByCategory:()=>Oo,loadAllObjectConfigs:()=>on,loadComponentSchemas:()=>sn,loadEngineConfig:()=>ln,loadGamePromptConfig:()=>xi,loadObjectCentricConfig:()=>me,loadObjectConfig:()=>Le,loadSceneConfig:()=>cn,rehydrateObject:()=>Si,removeConfigOverride:()=>nn,resetToApplied:()=>At,resetToOriginal:()=>rn,setBootstrapDependencies:()=>Zo,setOverrideMode:()=>bi,setupHotReload:()=>Ti,setupLiveEditBridge:()=>Bn,toLegacyFormat:()=>wi,validateObjectConfig:()=>Je});module.exports=$s(pl);var xe={};function Ft(i,e,t=!1){xe[i]||(xe[i]=[]),xe[i].push({fn:e,once:t})}function ei(i,e){if(xe[i]){if(!e){delete xe[i];return}xe[i]=xe[i].filter(t=>t.fn!==e)}}function Ut(i,...e){let t=xe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&ei(i,n.fn)}function X(i,e){Ft(i,e,!0)}var F=null,ee=[],Ve=null;function La(i){F=i,ee=[],Ve!==null&&(clearTimeout(Ve),Ve=null)}function Ta(){var i,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(i=F==null?void 0:F.batchSize)!=null?i:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function Sa(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function ti(i,e){let t=Ta();if(e&&t.endpoint){if(ee.push(i),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){Ca();return}Ve===null&&(Ve=window.setTimeout(()=>{Ve=null,Ca()},t.flushIntervalMs))}}async function Ca(){let i=Ta();if(!i.endpoint||ee.length===0)return;let e=ee.splice(0,i.batchSize);await Sa(i.endpoint,{events:e},i.transport,i.debug),ee.length>0&&await Sa(i.endpoint,{events:ee.splice(0,i.batchSize)},i.transport,i.debug)}function _a(i){return Math.max(0,Math.min(1,i))}function zs(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ft(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ns(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Pa(i,e,t){try{i[e]=t}catch{}}function Hs(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function Ma(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function ka(i,e){let t=Hs(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function Oa(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=p=>{var u;i.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),n()},r=p=>{i.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},s=p=>{p.killed||(p.killed=!0,r(p))},o=()=>{var d,u;let p=ft();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let h=p-g.startMs-g.delayMs;if(h<0)continue;let f=g.durationMs>0?h/g.durationMs:1,m=_a(f),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let w=f-y;m=_a(w)}let v=g.ease(m);g.yoyo&&y%2===1&&(v=1-v);for(let w of g.props)Pa(g.target,w.key,w.from+(w.to-w.from)*v);g.scaleFrom&&g.scaleTo&&Ma(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(f>=b){s(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var w;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),h=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((w=u==null?void 0:u.delayMsOverride)!=null?w:0)),f=zs(d.ease),m=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(d)){if(y.has(E))continue;let T=d[E];typeof T=="number"&&v.push({key:E,from:Ns(p,E),to:T})}let x=ka(p,d);return{target:p,startMs:ft(),delayMs:h,durationMs:g,ease:f,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:m,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ft())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:ft(),h=ft()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let h=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&Pa(p,g,h)}let u=ka(p,d);u.to&&Ma(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))s(u)},timeline(p={}){let d=[],u=0,g=!1,h=[],f=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},m=y=>{d.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return m({kind:"to",target:y,vars:v,atMs:f(x)}),b},fromTo(y,v,x,w){return m({kind:"fromTo",target:y,vars:x,from:v,atMs:f(w)}),b},play(){var y,v;if(g)return b;g=!0,h=[];for(let x of d)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),h.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return p.paused||b.play(),b}};return c}function Ia(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Oa()}catch{}}var ja={name:"handler-playable-sdk",version:"0.3.55",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Fs=J++,Ra=J++,Da=J++,$a=J++,za=J++,Na=J++,Ha=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,H=Fs;function Va(){return H===Ra}function Wa(){return H===Da}function Ya(){return H===$a}function Ka(){return H===za}function We(){return H===Na}function Ye(){return H===Ha}function Xa(){return H===Ba}function Ja(){return H===Fa}function Za(){return H===Ua}function ni(){return H===Ga}function ii(){return H===qa}function Qa(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),H=Ra;return}catch{}else if(i==="dapi")try{dapi.isReady(),H=Da;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=$a)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=za)}catch{}else if(e==="mintegral")window.gameReady&&(H=Na);else if(e==="tapjoy")window.TJ_API&&(H=Ha);else if(e==="tiktok")window.openAppStore&&(H=Ba);else if(e==="smadex")try{window.smxTracking&&(H=Fa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Ua)}catch{}else e==="vungle"?H=Ga:(i==="nucleo"||e==="nucleo")&&(H=qa)}var Gt=qe(require("lottie-web"),1),ai=Gt.default;typeof window!="undefined"&&(window.lottie=Gt.default,window.__baseLottie=Gt.default);var Us=require("pixi.js");var ri=require("pixi.js");var Gs=null;function si(i){Gs=i}qt();oi();var ht=require("pixi.js");qt();var Xs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",pi=Xs;if(typeof window!="undefined")try{let i=new XMLHttpRequest;if(i.open("GET","./build-settings.json",!1),i.send(),i.status===200&&i.responseText){let e=JSON.parse(i.responseText);e!=null&&e.buildMode&&(pi=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${pi}`))}}catch{}function Js(i){var t,n,a,r,s;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(i);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(i))return{x:(t=i[0])!=null?t:.5,y:(n=i[1])!=null?n:.5};if(i&&typeof i=="object"&&"x"in i&&"y"in i)return{x:(a=i.x)!=null?a:.5,y:(r=i.y)!=null?r:.5};if(typeof i=="string"){let o=i.trim().toLowerCase();return(s=e[o])!=null?s:{x:.5,y:.5}}return null}var Ee=class{static async create(e,t,n){var l,c,p,d,u,g,h;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${pi}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let f=new ht.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let s=await je.load(e,a,n,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=s==null?void 0:s.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",e),o=new ht.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(d=o==null?void 0:o.constructor)==null?void 0:d.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=s==null?void 0:s.constructor)==null?void 0:u.name,s),s&&(((g=s.constructor)==null?void 0:g.name)==="Container"||s instanceof ht.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],m=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(h=o==null?void 0:o.constructor)==null?void 0:h.name),m=!0;break}}catch{continue}m||(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,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,n){var a,r,s,o;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((s=t.position.x)!=null?s:0,(o=t.position.y)!=null?o:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Js(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var mt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var eo=qe(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=eo);Ke();var Vt=require("pixi.js");Ke();var fi=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new mt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let n=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var o;let s=this.registry.get(r);if(!s){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ee.create(r,s,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await n(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await n(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let n=await Ee.create(e,t,this.app);this.instanceCache.set(e,n)}}get(e){return this.instanceCache.get(e)}},to=new fi,no=new Proxy(to,{get(i,e){if(e in i&&typeof i[e]=="function")return i[e].bind(i);if(i.get(e))return i.get(e)}});Ke();var rr=require("pixi.js"),ge={width:400,height:600,designWidth:400,scaleFactor:1},Yt={scale:1,position:1},mi=[];function ao(i,e,t,n,a,r,s){mi.push({element:i,originalScale:r,positionHelper:e,heightPercent:a}),e(i,t,n,a,r,s,!1)}function ro(){mi.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*ge.scaleFactor;t(i,ge.width,ge.height,n,a,!0,!1)})}function hi(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),ge.width=i,ge.height=e,ge.scaleFactor=Math.min(i/ge.designWidth,1.15),Yt.scale=ge.scaleFactor,Yt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Yt.scale.toFixed(3)}`),ro()}var yt={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}};function so(i,e,t){let n=yt[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function oo(){return yt}var lo={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Wt(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Kt(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Wt(i[0],e.x),y:Wt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Wt(n.x,e.x),y:Wt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=lo[n])!=null?t:e}return e}function sr(i,e,t,n={}){var g,h,f,m,b,y;let a=Kt(t),r=(g=n.inset)!=null?g:{},s=(h=n.padding)!=null?h:{x:0,y:0},o=((f=r.left)!=null?f:0)+s.x,l=((m=r.right)!=null?m:0)+s.x,c=((b=r.top)!=null?b:0)+s.y,p=((y=r.bottom)!=null?y:0)+s.y,d=Math.max(0,i-o-l),u=Math.max(0,e-c-p);return{x:o+d*a.x,y:c+u*a.y}}function or(i,e,t,n={}){var f,m,b,y,v,x;let a=(f=n.inset)!=null?f:{},r=(m=n.padding)!=null?m:{x:0,y:0},s=((b=a.left)!=null?b:0)+r.x,o=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,p=Math.max(0,i-s-o),d=Math.max(0,e-l-c),u=Kt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:s+p*g,y:l+d*h}}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,hi(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),hi(window.innerWidth,window.innerHeight),window.updateDebugConfig=so,window.getDebugConfig=oo,window.copyConfig=xo,window.applyConfig=bt,window.applyConfigForRatio=wo,window.positionAtBottom=lr,window.positionAtTop=uo,window.positionAtCenter=go,window.positionAtLeft=fo,window.positionAtRight=ho,window.positionAtBottomLeft=mo,window.positionAtBottomRight=bo,window.positionAtTopLeft=yo,window.positionAtTopRight=vo,window.applyPositionContract=po,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 Xt(i,e,t=0){return i*e+t}function Jt(i,e,t=0){return i*(1-e)+t}function Zt(i,e,t=0){return i*e+t}function Qt(i,e,t=0){return i*(1-e)+t}function Z(i,e=0){return i/2+e}function co(i,e){return i*e}function po(i,e,t,n){var s,o,l,c,p,d,u,g,h,f,m,b,y,v,x,w,E,T,S,O;let a=0,r=0;switch(n.type){case"top":a=Z(e,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),r=Xt(t,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(d=(p=n.offset)==null?void 0:p.x)!=null?d:0),r=Jt(t,n.percent,(g=(u=n.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Zt(e,n.percent,(f=(h=n.offset)==null?void 0:h.x)!=null?f:0),r=Z(t,(b=(m=n.offset)==null?void 0:m.y)!=null?b:0);break;case"right":a=Qt(e,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":a=Z(e,(T=(E=n.offset)==null?void 0:E.x)!=null?T:0),r=Z(t,(O=(S=n.offset)==null?void 0:S.y)!=null?O:0);break}i.position?i.position.set(a,r):(i.x=a,i.y=r),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function lr(i,e,t,n=.2,a=1,r=!0,s=!1){let o=co(t,n),l=Jt(t,n/2);fe(i,Z(e),l);let c=r?a*ge.scaleFactor:a;he(i,c),s&&!mi.find(p=>p.element===i)&&ao(i,lr,e,t,n,a,r)}function uo(i,e,t,n=.1,a=1){fe(i,Z(e),Xt(t,n)),he(i,a)}function go(i,e,t,n=0,a=0,r=1){fe(i,Z(e,n),Z(t,a)),he(i,r)}function fo(i,e,t,n=.1,a=1){fe(i,Zt(e,n),Z(t)),he(i,a)}function ho(i,e,t,n=.1,a=1){fe(i,Qt(e,n),Z(t)),he(i,a)}function mo(i,e,t,n=.05,a=.05,r=1){fe(i,Zt(e,a),Jt(t,n)),he(i,r)}function bo(i,e,t,n=.05,a=.05,r=1){fe(i,Qt(e,a),Jt(t,n)),he(i,r)}function yo(i,e,t,n=.05,a=.05,r=1){fe(i,Zt(e,a),Xt(t,n)),he(i,r)}function vo(i,e,t,n=.05,a=.05,r=1){fe(i,Qt(e,a),Xt(t,n)),he(i,r)}function fe(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function he(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.scale.y=e))}var Re={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}},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}},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}},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}}};function xo(i){return i&&Re[i]?JSON.parse(JSON.stringify(Re[i])):JSON.parse(JSON.stringify(yt))}function bt(i){Object.keys(i).forEach(e=>{let t=e;yt[t]&&i[t]&&Object.assign(yt[t],i[t])}),console.log("Config applied:",i)}function wo(i,e){let t=i/e;t>1.6?(bt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(bt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(bt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(bt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let i=window;i.configPresets=Re,i.resolveAnchorVec2=i.resolveAnchorVec2||Kt,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||sr,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||or}dn();function U(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var Nc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Hc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_i=[{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:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Pi=[..._i],Mi=[{category:"playable",label:"Playable Ad",devices:_i}],pn=_i[0];function ze(i){return Pi.find(e=>e.id===i)||pn}function Oo(i){return Pi.filter(e=>e.category===i)}var un=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
47
47
  <div class="scene-panel scene-objects panel-accent-teal" data-panel="scene-objects" style="left:16px; top:72px;">
48
48
  <div class="scene-panel-header" data-panel-handle>
49
49
  <div class="panel-title">
@@ -1489,7 +1489,7 @@ Style guidelines: ${n.summary}`;this.promptInput.value=a,this.currentPrompt=a}}c
1489
1489
  <div class="console-messages" id="console-messages"></div>
1490
1490
  </div>
1491
1491
  </div>
1492
- `,this.setupEventListeners(e),e}setupEventListeners(e){var a,r,s,o,l,c,p,d,u,g;let t=e.querySelector("#device-select");t==null||t.addEventListener("change",h=>{if(this.viewMode==="compare")return;let f=h.target.value;this.setDevice(f)}),Array.from(e.querySelectorAll("[data-view-toggle]")).forEach(h=>{h.addEventListener("click",()=>{let f=h.dataset.viewToggle;f&&this.setViewMode(f)})}),(a=e.querySelector("#rotate-btn"))==null||a.addEventListener("click",()=>this.toggleRotation()),(r=e.querySelector("#zoom-in-btn"))==null||r.addEventListener("click",()=>this.adjustUserZoom(.1)),(s=e.querySelector("#zoom-out-btn"))==null||s.addEventListener("click",()=>this.adjustUserZoom(-.1)),(o=e.querySelector("#refresh-btn"))==null||o.addEventListener("click",()=>this.refresh()),(l=e.querySelector("#console-toggle"))==null||l.addEventListener("click",()=>this.toggleConsole()),(c=e.querySelector("#console-close"))==null||c.addEventListener("click",()=>this.toggleConsole(!1)),(p=e.querySelector("#console-clear"))==null||p.addEventListener("click",()=>this.clearConsole()),(d=e.querySelector("#corner-zoom-in-btn"))==null||d.addEventListener("click",()=>this.adjustUserZoom(.1)),(u=e.querySelector("#corner-zoom-out-btn"))==null||u.addEventListener("click",()=>this.adjustUserZoom(-.1)),(g=e.querySelector("#corner-grab-btn"))==null||g.addEventListener("click",()=>{this.frameDragger.style.cursor="grab",setTimeout(()=>{this.isSpaceKeyPressed||(this.frameDragger.style.cursor="")},1e3)})}applyDeviceFrameStyles(){Object.assign(this.frameDragger.style,{display:"flex",justifyContent:"center",alignItems:"center",transform:"translate(0px, 0px)",touchAction:"none"}),Object.assign(this.frameWrapper.style,{display:"flex",justifyContent:"center",alignItems:"center",transformOrigin:"center center",transition:"transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)",boxShadow:"0 20px 50px rgba(0,0,0,0.5)",borderRadius:"0px",willChange:"transform"}),Object.assign(this.deviceFrame.style,{overflow:"hidden",position:"relative",borderRadius:"0px"}),Object.assign(this.gameContainer.style,{position:"relative",overflow:"hidden",minWidth:"0px",minHeight:"0px"})}setupObserversAndListeners(){this.resizeObserver=new ResizeObserver(()=>{this.resizeListenersDisabled||!this.gameReady||this.scheduleFit()}),this.resizeObserver.observe(this.previewContainer),window.addEventListener("resize",this.onWindowResize,{passive:!0})}scheduleFit(){this.rafFitHandle&&cancelAnimationFrame(this.rafFitHandle),this.rafFitHandle=requestAnimationFrame(()=>{this.rafFitHandle=null,this.fitToScreen()})}applyPresetDimensions(){let e=this.getEffectivePreset(),t=`${e.width}px`,n=`${e.height}px`;this.deviceFrame.style.width=t,this.deviceFrame.style.height=n,this.gameContainer.style.width=t,this.gameContainer.style.height=n,this.gameContainer.style.maxWidth=t,this.gameContainer.style.maxHeight=n,this.gameContainer.style.minWidth=t,this.gameContainer.style.minHeight=n,this.gameContainer.dataset.screenWidth=String(e.width),this.gameContainer.dataset.screenHeight=String(e.height),this.container.style.setProperty("--preview-screen-width",String(e.width)),this.container.style.setProperty("--preview-screen-height",String(e.height))}fitToScreen(e){if(!this.previewContainer)return;let t=this.getEffectivePreset(),n=this.getFitBounds(),a=Math.max(0,n.width),r=Math.max(0,n.height);if(a<=0||r<=0)return;this.applyPresetDimensions(),this.viewMode==="compare"&&this.applyCompareDimensions();let s=a/t.width,o=r/t.height;if(this.autoScale=Math.max(.01,Math.min(s,o)),!this.hasInitialFit){this.hasInitialFit=!0;let l=.6;this.userScaleMultiplier=l/this.autoScale}e!=null&&e.keepVisibleScale&&e.keepVisibleScale>0&&(this.userScaleMultiplier=e.keepVisibleScale/this.autoScale),this.applyTransform(),this.viewMode==="compare"&&this.fitCompareGhosts(),requestAnimationFrame(()=>this.updatePanelPositions()),this.emitScreenChange()}applyTransform(){let e=this.autoScale*this.userScaleMultiplier;this.frameWrapper.style.transform=`scale(${e})`;let t=this.container.querySelector("#zoom-label");t&&(t.textContent=`${Math.round(e*100)}%`),requestAnimationFrame(()=>this.updatePanelPositions())}applyFrameDrag(){this.frameDragger.style.transform=`translate(${this.frameDragOffsetX}px, ${this.frameDragOffsetY}px)`,requestAnimationFrame(()=>this.updatePanelPositions())}updatePanelPositions(){var r;if(!this.gameReady||this.viewMode==="compare")return;let e=this.frameWrapper.getBoundingClientRect(),t=(r=this.container.querySelector(".preview-main"))==null?void 0:r.getBoundingClientRect();if(!t)return;let n=this.container.querySelector("#scene-tools-container");if(n&&n.children.length>0){let o=e.left-t.left+e.width/2,l=e.top-t.top-80;n.style.position="absolute",n.style.left=`${o}px`,n.style.top=`${l}px`,n.style.transform="translate(-50%, -100%)",n.style.zIndex="100"}let a=this.container.querySelector("#nudge-panel-container");if(a&&a.children.length>0){let o=e.left-t.left-80,l=e.top-t.top+e.height/2;a.style.position="absolute",a.style.left=`${o}px`,a.style.top=`${l}px`,a.style.transform="translate(-100%, -50%)",a.style.zIndex="100"}}setupFrameDragging(){this.frameDragger.addEventListener("pointerdown",e=>{let t=!this.gameContainer.contains(e.target);!this.isSpaceKeyPressed&&!t||e.button===0&&(e.preventDefault(),this.frameDragActive=!0,this.frameDragStartX=e.clientX,this.frameDragStartY=e.clientY,this.frameDragOriginX=this.frameDragOffsetX,this.frameDragOriginY=this.frameDragOffsetY,window.addEventListener("pointermove",this.onFrameDragMove),window.addEventListener("pointerup",this.onFrameDragEnd))})}setupSpaceKeyListener(){window.addEventListener("keydown",e=>{e.code==="Space"&&!this.isInputFocused()&&(this.isSpaceKeyPressed||(this.isSpaceKeyPressed=!0,this.updateDragCursor(),e.preventDefault()))}),window.addEventListener("keyup",e=>{e.code==="Space"&&(this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd())}),window.addEventListener("blur",()=>{this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd()})}isInputFocused(){let e=document.activeElement;if(!e)return!1;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"||e.isContentEditable}updateDragCursor(){this.isSpaceKeyPressed?(this.frameDragger.style.cursor="grab",this.frameDragActive&&(this.frameDragger.style.cursor="grabbing")):this.frameDragger.style.cursor=""}adjustUserZoom(e){this.userScaleMultiplier=Math.max(.1,Math.min(6,this.userScaleMultiplier+e)),this.applyTransform(),this.emitScreenChange()}toggleRotation(){var t,n;if(this.viewMode==="compare")return;let e=this.autoScale*this.userScaleMultiplier;this.isLandscape=!this.isLandscape,this.applyPresetDimensions(),this.fitToScreen({keepVisibleScale:e}),(n=(t=this.options).onDeviceChange)==null||n.call(t,this.getEffectivePreset()),this.emitScreenChange()}emitScreenChange(){if(!this.gameReady)return;let e=this.getEffectivePreset(),t={width:e.width,height:e.height,dpr:Math.max(1,Math.floor(window.devicePixelRatio||1)),presetId:e.id,isLandscape:this.isLandscape};if(window.dispatchEvent(new CustomEvent("handler-preview:screen",{detail:t})),this.viewMode==="compare"&&this.refreshCompareSnapshots(),this.isInitialized&&this.isMounted&&this.gameReady){let n=window.gameApp;if(!(n!=null&&n.renderer))return;this.ignoreNextWindowResize=!0,window.dispatchEvent(new Event("resize"))}}safeStringify(e){var n;let t=new WeakSet;try{return JSON.stringify(e,(a,r)=>{if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return r},2)}catch{try{if(e&&((n=e.constructor)!=null&&n.name))return`[object ${e.constructor.name}]`}catch{}return String(e)}}setupConsoleInterceptor(){let e=console.log.bind(console),t=console.warn.bind(console),n=console.error.bind(console),a=console.info.bind(console),r=(s,...o)=>{let l=o.map(p=>typeof p=="object"?this.safeStringify(p):String(p)).join(" ");this.consoleMessages.push({type:s,message:l,timestamp:new Date}),this.appendConsoleMessage(this.consoleMessages[this.consoleMessages.length-1]);let c=this.container.querySelector("#console-badge");if(c){let p=this.consoleMessages.filter(d=>d.type==="error").length;c.textContent=p>0?`${p}!`:"0",c.classList.toggle("has-errors",p>0)}};console.log=(...s)=>{e(...s),r("log",...s)},console.warn=(...s)=>{t(...s),r("warn",...s)},console.error=(...s)=>{n(...s),r("error",...s)},console.info=(...s)=>{a(...s),r("info",...s)}}appendConsoleMessage(e){let t=this.container.querySelector("#console-messages");if(!t)return;let n=document.createElement("div");n.className=`console-msg type-${e.type}`;let a=e.timestamp.toLocaleTimeString();n.innerHTML=`<span class="time">${this.escapeHtml(a)}</span> <pre>${this.escapeHtml(e.message)}</pre>`,t.appendChild(n),t.scrollTop=t.scrollHeight}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}toggleConsole(e){var t;this.isConsoleOpen=e!=null?e:!this.isConsoleOpen,(t=this.consolePanel)==null||t.classList.toggle("closed",!this.isConsoleOpen)}clearConsole(){this.consoleMessages=[];let e=this.container.querySelector("#console-messages");e&&(e.innerHTML="");let t=this.container.querySelector("#console-badge");t&&(t.textContent="0")}setupCompareViewports(){Array.from(this.container.querySelectorAll("[data-viewport]")).forEach(t=>{let n=t.dataset.viewport;if(!n)return;let a=this.comparePresets.find(d=>d.id===n);if(!a)return;let r=t.querySelector("[data-compare-slot]"),s=t.querySelector("[data-compare-ghost]"),o=t.querySelector("[data-compare-wrapper]"),l=t.querySelector("[data-compare-frame]"),c=t.querySelector("[data-compare-snapshot]"),p=t.querySelector("[data-compare-focus]");!r||!s||!o||!l||(t.addEventListener("click",d=>{let u=d.target;if(u!=null&&u.closest("[data-compare-focus]")){d.preventDefault(),this.activateCompareViewport(n);return}t.classList.contains("is-active")||this.activateCompareViewport(n)}),this.compareViewports.set(n,{preset:a,root:t,slot:r,ghost:s,wrapper:o,frame:l,canvas:c,focus:p}))})}setViewMode(e){if(this.viewMode===e)return;this.viewMode=e,this.container.classList.toggle("compare-mode",e==="compare"),this.singleStage.classList.toggle("hidden",e!=="single"),this.compareStage.classList.toggle("hidden",e!=="compare");let t=this.container.querySelector("#device-select");t&&(t.disabled=e==="compare");let n=this.container.querySelector("#rotate-btn");if(n&&(n.disabled=e==="compare"),this.updateViewToggleUI(),e==="compare"){this.lastSinglePresetId=this.currentPreset.id,this.activateCompareViewport(this.activeCompareId),this.refreshCompareSnapshots(),this.startCompareSnapshots();return}this.stopCompareSnapshots(),this.singleStage.appendChild(this.frameDragger),this.setDevice(this.lastSinglePresetId,{suppressCallback:!0}),this.fitToScreen()}updateViewToggleUI(){Array.from(this.container.querySelectorAll("[data-view-toggle]")).forEach(t=>{t.classList.toggle("active",t.dataset.viewToggle===this.viewMode)})}activateCompareViewport(e){var r,s;let t=this.compareViewports.get(e);if(!t)return;let n=this.autoScale*this.userScaleMultiplier,a=this.activeCompareId;a&&a!==e&&this.captureCompareSnapshot(a),this.activeCompareId=e,this.currentPreset=t.preset,this.isLandscape=!1,t.slot.appendChild(this.frameDragger),this.frameDragOffsetX=0,this.frameDragOffsetY=0,this.applyFrameDrag(),this.compareViewports.forEach((o,l)=>{o.root.classList.toggle("is-active",l===e),o.ghost.classList.toggle("hidden",l===e),o.focus&&(o.focus.textContent=l===e?"Live":"Focus")}),this.applyPresetDimensions(),this.applyCompareDimensions(),this.fitToScreen({keepVisibleScale:n}),(s=(r=this.options).onDeviceChange)==null||s.call(r,this.getEffectivePreset())}applyCompareDimensions(){this.compareViewports.forEach(e=>{let t=e.preset,n=`${t.width}px`,a=`${t.height}px`;e.frame.style.width=n,e.frame.style.height=a,e.canvas&&(e.canvas.width=t.width,e.canvas.height=t.height)})}fitCompareGhosts(){this.compareViewports.forEach(e=>{let t=e.root.querySelector(".compare-body");if(!t)return;let n=Math.max(0,t.clientWidth-24),a=Math.max(0,t.clientHeight-24);if(n<=0||a<=0)return;let r=n/e.preset.width,s=a/e.preset.height,o=Math.max(.01,Math.min(r,s));e.wrapper.style.transform=`scale(${o})`})}captureCompareSnapshot(e){let t=this.compareViewports.get(e);if(!(t!=null&&t.canvas))return;let n=this.gameContainer.querySelector("canvas");if(!n)return;let a=t.canvas.getContext("2d");if(!a)return;let r=t.canvas.width,s=t.canvas.height,o=Math.min(r/n.width,s/n.height),l=n.width*o,c=n.height*o,p=(r-l)/2,d=(s-c)/2;a.clearRect(0,0,r,s),a.drawImage(n,p,d,l,c)}refreshCompareSnapshots(){this.compareViewports.forEach((e,t)=>{t!==this.activeCompareId&&this.captureCompareSnapshot(t)})}startCompareSnapshots(){this.compareSnapshotTimer||(this.compareSnapshotTimer=window.setInterval(()=>{this.viewMode==="compare"&&this.refreshCompareSnapshots()},500))}stopCompareSnapshots(){this.compareSnapshotTimer&&(window.clearInterval(this.compareSnapshotTimer),this.compareSnapshotTimer=null)}getFitBounds(){if(this.viewMode!=="compare")return{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40};let e=this.compareViewports.get(this.activeCompareId),t=e==null?void 0:e.root.querySelector(".compare-body");return t?{width:t.clientWidth-24,height:t.clientHeight-24}:{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40}}mustQuery(e){let t=this.container.querySelector(e);if(!t)throw new Error(`PreviewShell missing element: ${e}`);return t}};function oa(i={}){let e=new Hn(i);return typeof window!="undefined"&&(window.__previewShell=e),e.mount(),e}K();function la(i){try{if(i&&typeof i.keys=="function")return Array.from(i.keys())}catch{}return[]}function ls(i){var e;return i?((e=i.getDisplayObject)==null?void 0:e.call(i))||i.pixiObject||i:null}function Ko(i,e){if(!i||!(e!=null&&e.interaction))return;let t=e.interaction,n=t.enabled!==!1&&(t.draggable===!0||t.clickable===!0);i.eventMode=n?"static":"none",i.interactive=n,n&&(i.cursor=t.draggable?"move":"pointer")}function cs(i,e){var l,c,p;if(!i||!e)return;let t=e.transform||{};Ko(i,e);let n=t.position||{},a=t.offset||{},r=(typeof n.x=="number"?n.x:0)+(typeof a.x=="number"?a.x:0),s=(typeof n.y=="number"?n.y:0)+(typeof a.y=="number"?a.y:0);(l=i.position)!=null&&l.set?i.position.set(r,s):(typeof i.x=="number"&&(i.x=r),typeof i.y=="number"&&(i.y=s)),typeof t.scale=="number"&&((c=i.scale)!=null&&c.set?i.scale.set(t.scale):i.scale&&(i.scale.x=t.scale,i.scale.y=t.scale));let o=t.anchor;if(o&&((p=i.anchor)!=null&&p.set)){let d=null;typeof window!="undefined"&&window.resolveAnchorVec2?d=window.resolveAnchorVec2(o):typeof o=="object"&&o.x!==void 0&&o.y!==void 0?d=o:Array.isArray(o)&&o.length===2&&(d={x:o[0],y:o[1]}),d&&typeof d.x=="number"&&typeof d.y=="number"&&i.anchor.set(d.x,d.y)}}function ds(i){if(typeof window=="undefined")return;let e=i==null?void 0:i.objects,t=la(e),n=r=>{try{let s=window.__HANDLER_ACTIVE_SCREEN;if(!s||s==="all")return r;let o=window.__HANDLER_SCREEN_INDEX,l=o==null?void 0:o.instanceToScreen;return l?r.filter(c=>l[c]===s):r}catch{return r}};window.__editableObjectConfigs=e;let a=new Map;t.forEach(r=>a.set(r,[r])),window.__editableObjectInstances=a,window.refreshEditableConfigIndex=()=>ds(window.__editableConfig),window.getEditableObjectList=()=>{var r;return n(la((r=window.__editableConfig)==null?void 0:r.objects))},window.getEditableObjectListAll=()=>{var r;return la((r=window.__editableConfig)==null?void 0:r.objects)},window.getEditableObjectConfig=r=>{var p,d,u,g,h;let s=(g=(u=(d=(p=window.__editableConfig)==null?void 0:p.objects)==null?void 0:d.get)==null?void 0:u.call(d,r))!=null?g:null,o=window.__HANDLER_ACTIVE_SCREEN;if(!o||o==="all")return s;let l=window.__HANDLER_SCREEN_INDEX,c=(h=l==null?void 0:l.instanceToScreen)==null?void 0:h[r];return c&&c===o?s:null},window.getEditableEngineConfig=()=>{let r=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!r),!r)return null;if(r.engine&&r.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let s={...r.engine,objects:r.objects,scene:r.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(s.assets||{})),s}return r}}function Xo(){if(typeof window=="undefined")return;let i=t=>{let n=String(t||"").trim();return n?/^(data:|blob:|https?:)/.test(n)||n.startsWith("/")?n:`/${n.replace(/^\.\//,"")}`:""},e=async(t,n)=>{var r,s,o;let a=i(n);if(a)try{let[{Assets:l},{AssetTextures:c}]=await Promise.all([import("pixi.js"),Promise.resolve().then(()=>(Ke(),ar))]),p=Date.now(),d=/^(data:|blob:)/.test(a)?a:a+(a.includes("?")?`&t=${p}`:`?t=${p}`),u=await l.load(d);if(!u)return;c[t]=u;let g=window.CustomAssets;(r=g==null?void 0:g[t])!=null&&r.texture&&(g[t].texture=u);let h=window.gameObjectManager,f=(s=h==null?void 0:h.get)==null?void 0:s.call(h,t);if(f){let m=((o=f.getDisplayObject)==null?void 0:o.call(f))||f.pixiObject||f.pixi||f;if(m!=null&&m.texture)m.texture=u;else if(m!=null&&m.children){let b=m.children.find(y=>y==null?void 0:y.texture);b!=null&&b.texture&&(b.texture=u)}}}catch(l){console.warn("[LIVE-EDIT] Failed to reload Pixi texture for",t,l)}};window.applyLiveEditOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEditableEngineConfig=t=>{let n=window.__editableConfig;if(!(n!=null&&n.engine))return;let a=[];if(t.runtime)for(let[r,s]of Object.entries(t.runtime))a.push({path:`runtime.${r}`,value:s});if(t.assets)for(let[r,s]of Object.entries(t.assets))a.push({path:`assets.${r}`,value:s}),typeof s=="string"&&e(r,s);if(t.splash)for(let[r,s]of Object.entries(t.splash))a.push({path:`splash.${r}`,value:s});if(t.loading)for(let[r,s]of Object.entries(t.loading))a.push({path:`loading.${r}`,value:s});if(t.start)for(let[r,s]of Object.entries(t.start))a.push({path:`start.${r}`,value:s});a.length&&Se(a,{silent:!0,persist:!0,emitEvent:!0})}}function Bn(i){let{getConfig:e,gameObjectManager:t,onObjectConfigApplied:n}=i;t&&(t.onObjectRebuildRequired=async(r,s)=>{console.log(`[LIVE-EDIT] \u{1F3D7}\uFE0F Rebuilding object ${r} due to type change...`);let o=t.get(r),l=o==null?void 0:o.pixiObject,c=l==null?void 0:l.parent,p=c==null?void 0:c.children.indexOf(l);o?t.remove(r):l&&l.destroy();let d=window.gameApp,u=await Ee.create(r,s,d);c&&(p!==void 0&&p!==-1?c.addChildAt(u,p):c.addChild(u));let g=t.create(r,u);return console.log(`[LIVE-EDIT] \u2705 Rebuild complete for ${r}`),g}),typeof window!="undefined"&&(Xo(),window.applyEditableObjectConfig=(r,s)=>{var o,l,c;console.log("[LIVE-EDIT] \u{1F504} applyEditableObjectConfig called for:",r);try{let p=window.__editableConfig;(o=p==null?void 0:p.objects)!=null&&o.set&&(p.objects.set(r,s),console.log("[LIVE-EDIT] \u2705 Updated config in __editableConfig"));let d=(l=t==null?void 0:t.get)==null?void 0:l.call(t,r);if(console.log("[LIVE-EDIT] gameObject found?",!!d),d&&(console.log("[LIVE-EDIT] gameObject type:",(c=d.constructor)==null?void 0:c.name),console.log("[LIVE-EDIT] has updateConfig?",typeof d.updateConfig=="function"),console.log("[LIVE-EDIT] has onConfigUpdate?",typeof d.onConfigUpdate=="function")),d&&typeof d.updateConfig=="function")console.log("[LIVE-EDIT] \u2705 Calling updateConfig()"),d.updateConfig(s);else if(d&&typeof d.onConfigUpdate=="function")console.log("[LIVE-EDIT] \u2705 Calling onConfigUpdate()"),d.onConfigUpdate();else{console.log("[LIVE-EDIT] \u26A0\uFE0F No updateConfig or onConfigUpdate, applying transform directly");let u=ls(d);cs(u,s)}}catch(p){console.error("[LIVE-EDIT] \u274C Error in applyEditableObjectConfig:",p)}});let a={async applyObjectConfig(r,s){var p,d;console.log("[BRIDGE] \u{1F504} applyObjectConfig called for:",r);let o=e();(p=o==null?void 0:o.objects)!=null&&p.set&&(o.objects.set(r,s),console.log("[BRIDGE] \u2705 Updated config"));let l=(d=t==null?void 0:t.get)==null?void 0:d.call(t,r);if(console.log("[BRIDGE] gameObject found?",!!l),l&&(console.log("[BRIDGE] has updateConfig?",typeof l.updateConfig=="function"),console.log("[BRIDGE] has onConfigUpdate?",typeof l.onConfigUpdate=="function")),l&&typeof l.updateConfig=="function")console.log("[BRIDGE] \u2705 Calling updateConfig()"),l.updateConfig(s);else if(l&&typeof l.onConfigUpdate=="function")console.log("[BRIDGE] \u2705 Calling onConfigUpdate()"),l.onConfigUpdate();else{console.log("[BRIDGE] \u26A0\uFE0F Applying transform directly");let u=ls(l);cs(u,s)}let c=[r];n==null||n(r,s,c)},rebuildIndexes(){let r=e();typeof window!="undefined"&&(window.__editableConfig=r,ds(r))}};return a.rebuildIndexes(),a}K();var gs=qe(require("lottie-web"),1);si(ai);typeof window!="undefined"&&!window.lottie&&(window.lottie=gs.default);var nt=null,Jo=async()=>{if(!nt){let i=typeof window!="undefined"?window.INLINE_ASSETS:null,e=(i==null?void 0:i["handler.config"])||(i==null?void 0:i["handler.config.json"]);if(e)try{if(e.startsWith("data:")){let n=atob(e.split(",")[1]);nt=JSON.parse(n)}else nt=JSON.parse(e);return nt}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}nt=await(await fetch("./handler.config.json")).json()}return nt},ua,It,fs,it,da,pa;function Zo(i){ua=i.initGame,It=i.CustomAssets,fs=i.updateScreenState,it=i.globalResponsiveMultipliers,da=i.layout,pa=i.clearResponsiveElements}var Fn="web_embed",Ot="https://example.com",ps={profile_id:Fn},Pe=null,oe=null,ca={width:0,height:0},Qo=!0,el=async()=>{var c,p,d,u;document.title="Handler Pixi Game";let i=await Jo();ps={...i.ids||{},profile_id:Fn},Ot=i.destination_url||((p=(c=i.export_profiles)==null?void 0:c[Fn])==null?void 0:p.destination_url)||Ot,Oe.init({ids:ps,profile:Fn,destinationUrl:Ot});let e=Oe.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),oe=oa({onDeviceChange:h=>{console.log(`[PREVIEW] Device switched to ${h.width}x${h.height}, restarting game...`),us()},onRefresh:us});let g=oe.getGameContainer();g&&(e=g),window.addEventListener("handler-preview:screen",h=>{var v,x,w,E,T,S,O,B,M,C,I;let f=window.gameApp,m=window.gameObjectManager,{width:b,height:y}=h.detail;if(ca.width=b,ca.height=y,fs(b,y),!(!f||!f.renderer)){m&&o(f,m);try{f.renderer.resize(b,y);let k=f.view;k&&(k.style.width="100%",k.style.height="100%",k.style.display="block")}catch(k){console.warn("[SCREEN] Error resizing renderer:",k);return}if(t&&m&&da)try{let k=(v=window.__mainContainer)!=null?v:f.stage,D=(O=(S=(E=window.__tutorialLabel)!=null?E:(w=(x=m.get("label_1"))==null?void 0:x.getDisplayObject)==null?void 0:w.call(x))!=null?S:(T=m.get("label_1"))==null?void 0:T.pixiObject)!=null?O:m.get("label_1"),j=m.get("background_1"),$=(I=(C=(M=window.__background)!=null?M:(B=j==null?void 0:j.getDisplayObject)==null?void 0:B.call(j))!=null?C:j==null?void 0:j.pixiObject)!=null?I:j;if(k){let A=k===f.stage;da({mainContainer:k,label:D,background:$,backgroundTexture:($==null?void 0:$.texture)||null,app:f},t,0,ca,m,{skipMainContainerTransform:A})}}catch(k){console.warn("[SCREEN] Error in layout:",k)}}})}let t=await me("scene.main");window.__editableConfig=t,s(),window.__editableConfigBaseline||(window.__editableConfigBaseline=G(t),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(u=(d=t.engine.runtime)==null?void 0:d.layout)!=null&&u.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(g=>setTimeout(g,100)),t=await me("scene.main"));let n=await ua(e,t,Ot,oe);Pe=n.app;let a=n.gameObjectManager;window.gameApp=Pe,window.gameObjectManager=a;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:a,assets:It})}catch(g){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",g)}oe&&oe.notifyGameLoaded();let r=window.__debugScale;r&&typeof r=="number"&&(it.scale=r,console.log(`[DEBUG] Applied persisted debug scale: ${r}`)),o(Pe,a);async function s(){try{let g=async y=>{let v=y.startsWith("/")?y:`/${y}`,x=await fetch(v,{cache:"no-cache"});if(!x.ok)return null;let w=await x.text();try{return JSON.parse(w)}catch{return null}},h=await g("configs/flow/app.flow.json");if(!h||typeof h!="object")return;let f=h.screens;if(!f||typeof f!="object")return;let m={},b={};for(let[y,v]of Object.entries(f)){let x=v==null?void 0:v.source;if(typeof x!="string")continue;let w=await g(x),E=w==null?void 0:w.elements;if(!Array.isArray(E))continue;let T=E.map(S=>S==null?void 0:S.instance_id).filter(S=>typeof S=="string");m[y]=T;for(let S of T)b[S]||(b[S]=y)}window.__HANDLER_APP_FLOW=h,window.__HANDLER_SCREEN_INDEX={screenToInstances:m,instanceToScreen:b},window.dispatchEvent(new CustomEvent("handler:screen-index-loaded"))}catch{}}function o(g,h){if(Qo){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${it.scale.toFixed(3)}`),g.stage){let m=function(b,y=0){if(!b||!b.children)return;let v=" ".repeat(y);b.children.forEach((x,w)=>{if(x&&x.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(x&&x.scale){let E=x.scale.x||1,T=x.scale.y||1;x.__originalScale||(x.__originalScale={x:E,y:T},console.log(`${v}[RESPONSIVE] Stored original scale for child[${w}]: ${E.toFixed(3)}, ${T.toFixed(3)}`));let S=x.__originalScale.x*it.scale,O=x.__originalScale.y*it.scale;typeof x.scale.set=="function"?x.scale.set(S,O):(x.scale.x=S,x.scale.y=O),console.log(`${v}[RESPONSIVE] Child[${w}] scale: ${E.toFixed(3)}\u2192${x.scale.x.toFixed(3)} (type: ${x.constructor.name})`),m(x,y+1)}else x&&console.log(`${v}[RESPONSIVE] Child[${w}] has no scale (type: ${x.constructor.name})`)})};var f=m;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),m(g.stage)}else console.warn("[RESPONSIVE] No app.stage found!");console.log("[REDDEBUG] Debug border left unscaled (fixed boundaries)"),console.log("[RESPONSIVE] ===== GLOBAL RESPONSIVE SCALING COMPLETE =====")}function l(g){if(g!==void 0){it.scale=g,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${g.toFixed(3)}`);let h=window.gameApp,f=window.gameObjectManager;h&&f?(o(h,f),h.renderer&&(h.renderer.render(h.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!h}) or gameObjectManager (${!!f}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=l,Oe.start()},us=async()=>{var e,t,n,a;console.log("[PREVIEW] Restarting game in 1 seconds...");let i=(e=window.gameObjectManager)==null?void 0:e.get("character_1");if(i){let r=((t=i.getDisplayObject)==null?void 0:t.call(i))||i;r&&r.scale&&console.log(`[CHARACTER] Before restart - Current scale - x: ${((n=r.scale.x)!=null?n:1).toFixed(3)}, y: ${((a=r.scale.y)!=null?a:1).toFixed(3)}`)}if(oe){oe.notifyGameDestroyed();try{pa&&pa()}catch(r){console.warn("Failed to clear responsive elements",r)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let r=oe.getGameContainer(),s=window.gameObjectManager;if(s&&typeof s.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),s.clear()),Pe){try{Pe.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}Pe=null}window.gameApp=null,window.gameObjectManager=null,r&&(r.innerHTML="");try{typeof It.resetScene=="function"&&It.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{me("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=G(o)),ua(r,o,Ot).then(l=>{Pe=l.app,window.gameApp=Pe,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:It})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}oe&&oe.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{Oe.start()}catch{}})})},100)},1e3)}};dn();K();var le={background:"#F6F3EF",ink:"#1E1E1E",secondaryText:"#8E8A84",primaryAccent:"#E38A5A",secondaryAccent:"#C9A28C",statusGreen:"#5F8F6B"},hs=1.25,ms={fontFamily:"Inter, system-ui, sans-serif"};var Un=class{constructor(e={}){this.currentProgress=0;var t;this.currentProgress=(t=e.progress)!=null?t:0,this.container=this.createContainer()}createContainer(){let e=document.createElement("div");e.className="handler-loading-screen",e.style.cssText=`
1492
+ `,this.setupEventListeners(e),e}setupEventListeners(e){var a,r,s,o,l,c,p,d,u,g;let t=e.querySelector("#device-select");t==null||t.addEventListener("change",h=>{if(this.viewMode==="compare")return;let f=h.target.value;this.setDevice(f)}),Array.from(e.querySelectorAll("[data-view-toggle]")).forEach(h=>{h.addEventListener("click",()=>{let f=h.dataset.viewToggle;f&&this.setViewMode(f)})}),(a=e.querySelector("#rotate-btn"))==null||a.addEventListener("click",()=>this.toggleRotation()),(r=e.querySelector("#zoom-in-btn"))==null||r.addEventListener("click",()=>this.adjustUserZoom(.1)),(s=e.querySelector("#zoom-out-btn"))==null||s.addEventListener("click",()=>this.adjustUserZoom(-.1)),(o=e.querySelector("#refresh-btn"))==null||o.addEventListener("click",()=>this.refresh()),(l=e.querySelector("#console-toggle"))==null||l.addEventListener("click",()=>this.toggleConsole()),(c=e.querySelector("#console-close"))==null||c.addEventListener("click",()=>this.toggleConsole(!1)),(p=e.querySelector("#console-clear"))==null||p.addEventListener("click",()=>this.clearConsole()),(d=e.querySelector("#corner-zoom-in-btn"))==null||d.addEventListener("click",()=>this.adjustUserZoom(.1)),(u=e.querySelector("#corner-zoom-out-btn"))==null||u.addEventListener("click",()=>this.adjustUserZoom(-.1)),(g=e.querySelector("#corner-grab-btn"))==null||g.addEventListener("click",()=>{this.frameDragger.style.cursor="grab",setTimeout(()=>{this.isSpaceKeyPressed||(this.frameDragger.style.cursor="")},1e3)})}applyDeviceFrameStyles(){Object.assign(this.frameDragger.style,{display:"flex",justifyContent:"center",alignItems:"center",transform:"translate(0px, 0px)",touchAction:"none"}),Object.assign(this.frameWrapper.style,{display:"flex",justifyContent:"center",alignItems:"center",transformOrigin:"center center",transition:"transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)",boxShadow:"0 20px 50px rgba(0,0,0,0.5)",borderRadius:"0px",willChange:"transform"}),Object.assign(this.deviceFrame.style,{overflow:"hidden",position:"relative",borderRadius:"0px"}),Object.assign(this.gameContainer.style,{position:"relative",overflow:"hidden",minWidth:"0px",minHeight:"0px"})}setupObserversAndListeners(){this.resizeObserver=new ResizeObserver(()=>{this.resizeListenersDisabled||!this.gameReady||this.scheduleFit()}),this.resizeObserver.observe(this.previewContainer),window.addEventListener("resize",this.onWindowResize,{passive:!0})}scheduleFit(){this.rafFitHandle&&cancelAnimationFrame(this.rafFitHandle),this.rafFitHandle=requestAnimationFrame(()=>{this.rafFitHandle=null,this.fitToScreen()})}applyPresetDimensions(){let e=this.getEffectivePreset(),t=`${e.width}px`,n=`${e.height}px`;this.deviceFrame.style.width=t,this.deviceFrame.style.height=n,this.gameContainer.style.width=t,this.gameContainer.style.height=n,this.gameContainer.style.maxWidth=t,this.gameContainer.style.maxHeight=n,this.gameContainer.style.minWidth=t,this.gameContainer.style.minHeight=n,this.gameContainer.dataset.screenWidth=String(e.width),this.gameContainer.dataset.screenHeight=String(e.height),this.container.style.setProperty("--preview-screen-width",String(e.width)),this.container.style.setProperty("--preview-screen-height",String(e.height))}fitToScreen(e){if(!this.previewContainer)return;let t=this.getEffectivePreset(),n=this.getFitBounds(),a=Math.max(0,n.width),r=Math.max(0,n.height);if(a<=0||r<=0)return;this.applyPresetDimensions(),this.viewMode==="compare"&&this.applyCompareDimensions();let s=a/t.width,o=r/t.height;if(this.autoScale=Math.max(.01,Math.min(s,o)),!this.hasInitialFit){this.hasInitialFit=!0;let l=.6;this.userScaleMultiplier=l/this.autoScale}e!=null&&e.keepVisibleScale&&e.keepVisibleScale>0&&(this.userScaleMultiplier=e.keepVisibleScale/this.autoScale),this.applyTransform(),this.viewMode==="compare"&&this.fitCompareGhosts(),requestAnimationFrame(()=>this.updatePanelPositions()),this.emitScreenChange()}applyTransform(){let e=this.autoScale*this.userScaleMultiplier;this.frameWrapper.style.transform=`scale(${e})`;let t=this.container.querySelector("#zoom-label");t&&(t.textContent=`${Math.round(e*100)}%`),requestAnimationFrame(()=>this.updatePanelPositions())}applyFrameDrag(){this.frameDragger.style.transform=`translate(${this.frameDragOffsetX}px, ${this.frameDragOffsetY}px)`,requestAnimationFrame(()=>this.updatePanelPositions())}updatePanelPositions(){var r;if(!this.gameReady||this.viewMode==="compare")return;let e=this.frameWrapper.getBoundingClientRect(),t=(r=this.container.querySelector(".preview-main"))==null?void 0:r.getBoundingClientRect();if(!t)return;let n=this.container.querySelector("#scene-tools-container");if(n&&n.children.length>0){let o=e.left-t.left+e.width/2,l=e.top-t.top-80;n.style.position="absolute",n.style.left=`${o}px`,n.style.top=`${l}px`,n.style.transform="translate(-50%, -100%)",n.style.zIndex="100"}let a=this.container.querySelector("#nudge-panel-container");if(a&&a.children.length>0){let o=e.left-t.left-16,l=e.bottom-t.top+16;a.style.position="absolute",a.style.left=`${o}px`,a.style.top=`${l}px`,a.style.transform="translate(-100%, 0)",a.style.zIndex="100"}}setupFrameDragging(){this.frameDragger.addEventListener("pointerdown",e=>{let t=!this.gameContainer.contains(e.target);!this.isSpaceKeyPressed&&!t||e.button===0&&(e.preventDefault(),this.frameDragActive=!0,this.frameDragStartX=e.clientX,this.frameDragStartY=e.clientY,this.frameDragOriginX=this.frameDragOffsetX,this.frameDragOriginY=this.frameDragOffsetY,window.addEventListener("pointermove",this.onFrameDragMove),window.addEventListener("pointerup",this.onFrameDragEnd))})}setupSpaceKeyListener(){window.addEventListener("keydown",e=>{e.code==="Space"&&!this.isInputFocused()&&(this.isSpaceKeyPressed||(this.isSpaceKeyPressed=!0,this.updateDragCursor(),e.preventDefault()))}),window.addEventListener("keyup",e=>{e.code==="Space"&&(this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd())}),window.addEventListener("blur",()=>{this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd()})}isInputFocused(){let e=document.activeElement;if(!e)return!1;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"||e.isContentEditable}updateDragCursor(){this.isSpaceKeyPressed?(this.frameDragger.style.cursor="grab",this.frameDragActive&&(this.frameDragger.style.cursor="grabbing")):this.frameDragger.style.cursor=""}adjustUserZoom(e){this.userScaleMultiplier=Math.max(.1,Math.min(6,this.userScaleMultiplier+e)),this.applyTransform(),this.emitScreenChange()}toggleRotation(){var t,n;if(this.viewMode==="compare")return;let e=this.autoScale*this.userScaleMultiplier;this.isLandscape=!this.isLandscape,this.applyPresetDimensions(),this.fitToScreen({keepVisibleScale:e}),(n=(t=this.options).onDeviceChange)==null||n.call(t,this.getEffectivePreset()),this.emitScreenChange()}emitScreenChange(){if(!this.gameReady)return;let e=this.getEffectivePreset(),t={width:e.width,height:e.height,dpr:Math.max(1,Math.floor(window.devicePixelRatio||1)),presetId:e.id,isLandscape:this.isLandscape};if(window.dispatchEvent(new CustomEvent("handler-preview:screen",{detail:t})),this.viewMode==="compare"&&this.refreshCompareSnapshots(),this.isInitialized&&this.isMounted&&this.gameReady){let n=window.gameApp;if(!(n!=null&&n.renderer))return;this.ignoreNextWindowResize=!0,window.dispatchEvent(new Event("resize"))}}safeStringify(e){var n;let t=new WeakSet;try{return JSON.stringify(e,(a,r)=>{if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return r},2)}catch{try{if(e&&((n=e.constructor)!=null&&n.name))return`[object ${e.constructor.name}]`}catch{}return String(e)}}setupConsoleInterceptor(){let e=console.log.bind(console),t=console.warn.bind(console),n=console.error.bind(console),a=console.info.bind(console),r=(s,...o)=>{let l=o.map(p=>typeof p=="object"?this.safeStringify(p):String(p)).join(" ");this.consoleMessages.push({type:s,message:l,timestamp:new Date}),this.appendConsoleMessage(this.consoleMessages[this.consoleMessages.length-1]);let c=this.container.querySelector("#console-badge");if(c){let p=this.consoleMessages.filter(d=>d.type==="error").length;c.textContent=p>0?`${p}!`:"0",c.classList.toggle("has-errors",p>0)}};console.log=(...s)=>{e(...s),r("log",...s)},console.warn=(...s)=>{t(...s),r("warn",...s)},console.error=(...s)=>{n(...s),r("error",...s)},console.info=(...s)=>{a(...s),r("info",...s)}}appendConsoleMessage(e){let t=this.container.querySelector("#console-messages");if(!t)return;let n=document.createElement("div");n.className=`console-msg type-${e.type}`;let a=e.timestamp.toLocaleTimeString();n.innerHTML=`<span class="time">${this.escapeHtml(a)}</span> <pre>${this.escapeHtml(e.message)}</pre>`,t.appendChild(n),t.scrollTop=t.scrollHeight}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}toggleConsole(e){var t;this.isConsoleOpen=e!=null?e:!this.isConsoleOpen,(t=this.consolePanel)==null||t.classList.toggle("closed",!this.isConsoleOpen)}clearConsole(){this.consoleMessages=[];let e=this.container.querySelector("#console-messages");e&&(e.innerHTML="");let t=this.container.querySelector("#console-badge");t&&(t.textContent="0")}setupCompareViewports(){Array.from(this.container.querySelectorAll("[data-viewport]")).forEach(t=>{let n=t.dataset.viewport;if(!n)return;let a=this.comparePresets.find(d=>d.id===n);if(!a)return;let r=t.querySelector("[data-compare-slot]"),s=t.querySelector("[data-compare-ghost]"),o=t.querySelector("[data-compare-wrapper]"),l=t.querySelector("[data-compare-frame]"),c=t.querySelector("[data-compare-snapshot]"),p=t.querySelector("[data-compare-focus]");!r||!s||!o||!l||(t.addEventListener("click",d=>{let u=d.target;if(u!=null&&u.closest("[data-compare-focus]")){d.preventDefault(),this.activateCompareViewport(n);return}t.classList.contains("is-active")||this.activateCompareViewport(n)}),this.compareViewports.set(n,{preset:a,root:t,slot:r,ghost:s,wrapper:o,frame:l,canvas:c,focus:p}))})}setViewMode(e){if(this.viewMode===e)return;this.viewMode=e,this.container.classList.toggle("compare-mode",e==="compare"),this.singleStage.classList.toggle("hidden",e!=="single"),this.compareStage.classList.toggle("hidden",e!=="compare");let t=this.container.querySelector("#device-select");t&&(t.disabled=e==="compare");let n=this.container.querySelector("#rotate-btn");if(n&&(n.disabled=e==="compare"),this.updateViewToggleUI(),e==="compare"){this.lastSinglePresetId=this.currentPreset.id,this.activateCompareViewport(this.activeCompareId),this.refreshCompareSnapshots(),this.startCompareSnapshots();return}this.stopCompareSnapshots(),this.singleStage.appendChild(this.frameDragger),this.setDevice(this.lastSinglePresetId,{suppressCallback:!0}),this.fitToScreen()}updateViewToggleUI(){Array.from(this.container.querySelectorAll("[data-view-toggle]")).forEach(t=>{t.classList.toggle("active",t.dataset.viewToggle===this.viewMode)})}activateCompareViewport(e){var r,s;let t=this.compareViewports.get(e);if(!t)return;let n=this.autoScale*this.userScaleMultiplier,a=this.activeCompareId;a&&a!==e&&this.captureCompareSnapshot(a),this.activeCompareId=e,this.currentPreset=t.preset,this.isLandscape=!1,t.slot.appendChild(this.frameDragger),this.frameDragOffsetX=0,this.frameDragOffsetY=0,this.applyFrameDrag(),this.compareViewports.forEach((o,l)=>{o.root.classList.toggle("is-active",l===e),o.ghost.classList.toggle("hidden",l===e),o.focus&&(o.focus.textContent=l===e?"Live":"Focus")}),this.applyPresetDimensions(),this.applyCompareDimensions(),this.fitToScreen({keepVisibleScale:n}),(s=(r=this.options).onDeviceChange)==null||s.call(r,this.getEffectivePreset())}applyCompareDimensions(){this.compareViewports.forEach(e=>{let t=e.preset,n=`${t.width}px`,a=`${t.height}px`;e.frame.style.width=n,e.frame.style.height=a,e.canvas&&(e.canvas.width=t.width,e.canvas.height=t.height)})}fitCompareGhosts(){this.compareViewports.forEach(e=>{let t=e.root.querySelector(".compare-body");if(!t)return;let n=Math.max(0,t.clientWidth-24),a=Math.max(0,t.clientHeight-24);if(n<=0||a<=0)return;let r=n/e.preset.width,s=a/e.preset.height,o=Math.max(.01,Math.min(r,s));e.wrapper.style.transform=`scale(${o})`})}captureCompareSnapshot(e){let t=this.compareViewports.get(e);if(!(t!=null&&t.canvas))return;let n=this.gameContainer.querySelector("canvas");if(!n)return;let a=t.canvas.getContext("2d");if(!a)return;let r=t.canvas.width,s=t.canvas.height,o=Math.min(r/n.width,s/n.height),l=n.width*o,c=n.height*o,p=(r-l)/2,d=(s-c)/2;a.clearRect(0,0,r,s),a.drawImage(n,p,d,l,c)}refreshCompareSnapshots(){this.compareViewports.forEach((e,t)=>{t!==this.activeCompareId&&this.captureCompareSnapshot(t)})}startCompareSnapshots(){this.compareSnapshotTimer||(this.compareSnapshotTimer=window.setInterval(()=>{this.viewMode==="compare"&&this.refreshCompareSnapshots()},500))}stopCompareSnapshots(){this.compareSnapshotTimer&&(window.clearInterval(this.compareSnapshotTimer),this.compareSnapshotTimer=null)}getFitBounds(){if(this.viewMode!=="compare")return{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40};let e=this.compareViewports.get(this.activeCompareId),t=e==null?void 0:e.root.querySelector(".compare-body");return t?{width:t.clientWidth-24,height:t.clientHeight-24}:{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40}}mustQuery(e){let t=this.container.querySelector(e);if(!t)throw new Error(`PreviewShell missing element: ${e}`);return t}};function oa(i={}){let e=new Hn(i);return typeof window!="undefined"&&(window.__previewShell=e),e.mount(),e}K();function la(i){try{if(i&&typeof i.keys=="function")return Array.from(i.keys())}catch{}return[]}function ls(i){var e;return i?((e=i.getDisplayObject)==null?void 0:e.call(i))||i.pixiObject||i:null}function Ko(i,e){if(!i||!(e!=null&&e.interaction))return;let t=e.interaction,n=t.enabled!==!1&&(t.draggable===!0||t.clickable===!0);i.eventMode=n?"static":"none",i.interactive=n,n&&(i.cursor=t.draggable?"move":"pointer")}function cs(i,e){var l,c,p;if(!i||!e)return;let t=e.transform||{};Ko(i,e);let n=t.position||{},a=t.offset||{},r=(typeof n.x=="number"?n.x:0)+(typeof a.x=="number"?a.x:0),s=(typeof n.y=="number"?n.y:0)+(typeof a.y=="number"?a.y:0);(l=i.position)!=null&&l.set?i.position.set(r,s):(typeof i.x=="number"&&(i.x=r),typeof i.y=="number"&&(i.y=s)),typeof t.scale=="number"&&((c=i.scale)!=null&&c.set?i.scale.set(t.scale):i.scale&&(i.scale.x=t.scale,i.scale.y=t.scale));let o=t.anchor;if(o&&((p=i.anchor)!=null&&p.set)){let d=null;typeof window!="undefined"&&window.resolveAnchorVec2?d=window.resolveAnchorVec2(o):typeof o=="object"&&o.x!==void 0&&o.y!==void 0?d=o:Array.isArray(o)&&o.length===2&&(d={x:o[0],y:o[1]}),d&&typeof d.x=="number"&&typeof d.y=="number"&&i.anchor.set(d.x,d.y)}}function ds(i){if(typeof window=="undefined")return;let e=i==null?void 0:i.objects,t=la(e),n=r=>{try{let s=window.__HANDLER_ACTIVE_SCREEN;if(!s||s==="all")return r;let o=window.__HANDLER_SCREEN_INDEX,l=o==null?void 0:o.instanceToScreen;return l?r.filter(c=>l[c]===s):r}catch{return r}};window.__editableObjectConfigs=e;let a=new Map;t.forEach(r=>a.set(r,[r])),window.__editableObjectInstances=a,window.refreshEditableConfigIndex=()=>ds(window.__editableConfig),window.getEditableObjectList=()=>{var r;return n(la((r=window.__editableConfig)==null?void 0:r.objects))},window.getEditableObjectListAll=()=>{var r;return la((r=window.__editableConfig)==null?void 0:r.objects)},window.getEditableObjectConfig=r=>{var p,d,u,g,h;let s=(g=(u=(d=(p=window.__editableConfig)==null?void 0:p.objects)==null?void 0:d.get)==null?void 0:u.call(d,r))!=null?g:null,o=window.__HANDLER_ACTIVE_SCREEN;if(!o||o==="all")return s;let l=window.__HANDLER_SCREEN_INDEX,c=(h=l==null?void 0:l.instanceToScreen)==null?void 0:h[r];return c&&c===o?s:null},window.getEditableEngineConfig=()=>{let r=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!r),!r)return null;if(r.engine&&r.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let s={...r.engine,objects:r.objects,scene:r.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(s.assets||{})),s}return r}}function Xo(){if(typeof window=="undefined")return;let i=t=>{let n=String(t||"").trim();return n?/^(data:|blob:|https?:)/.test(n)||n.startsWith("/")?n:`/${n.replace(/^\.\//,"")}`:""},e=async(t,n)=>{var r,s,o;let a=i(n);if(a)try{let[{Assets:l},{AssetTextures:c}]=await Promise.all([import("pixi.js"),Promise.resolve().then(()=>(Ke(),ar))]),p=Date.now(),d=/^(data:|blob:)/.test(a)?a:a+(a.includes("?")?`&t=${p}`:`?t=${p}`),u=await l.load(d);if(!u)return;c[t]=u;let g=window.CustomAssets;(r=g==null?void 0:g[t])!=null&&r.texture&&(g[t].texture=u);let h=window.gameObjectManager,f=(s=h==null?void 0:h.get)==null?void 0:s.call(h,t);if(f){let m=((o=f.getDisplayObject)==null?void 0:o.call(f))||f.pixiObject||f.pixi||f;if(m!=null&&m.texture)m.texture=u;else if(m!=null&&m.children){let b=m.children.find(y=>y==null?void 0:y.texture);b!=null&&b.texture&&(b.texture=u)}}}catch(l){console.warn("[LIVE-EDIT] Failed to reload Pixi texture for",t,l)}};window.applyLiveEditOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEditableEngineConfig=t=>{let n=window.__editableConfig;if(!(n!=null&&n.engine))return;let a=[];if(t.runtime)for(let[r,s]of Object.entries(t.runtime))a.push({path:`runtime.${r}`,value:s});if(t.assets)for(let[r,s]of Object.entries(t.assets))a.push({path:`assets.${r}`,value:s}),typeof s=="string"&&e(r,s);if(t.splash)for(let[r,s]of Object.entries(t.splash))a.push({path:`splash.${r}`,value:s});if(t.loading)for(let[r,s]of Object.entries(t.loading))a.push({path:`loading.${r}`,value:s});if(t.start)for(let[r,s]of Object.entries(t.start))a.push({path:`start.${r}`,value:s});a.length&&Se(a,{silent:!0,persist:!0,emitEvent:!0})}}function Bn(i){let{getConfig:e,gameObjectManager:t,onObjectConfigApplied:n}=i;t&&(t.onObjectRebuildRequired=async(r,s)=>{console.log(`[LIVE-EDIT] \u{1F3D7}\uFE0F Rebuilding object ${r} due to type change...`);let o=t.get(r),l=o==null?void 0:o.pixiObject,c=l==null?void 0:l.parent,p=c==null?void 0:c.children.indexOf(l);o?t.remove(r):l&&l.destroy();let d=window.gameApp,u=await Ee.create(r,s,d);c&&(p!==void 0&&p!==-1?c.addChildAt(u,p):c.addChild(u));let g=t.create(r,u);return console.log(`[LIVE-EDIT] \u2705 Rebuild complete for ${r}`),g}),typeof window!="undefined"&&(Xo(),window.applyEditableObjectConfig=(r,s)=>{var o,l,c;console.log("[LIVE-EDIT] \u{1F504} applyEditableObjectConfig called for:",r);try{let p=window.__editableConfig;(o=p==null?void 0:p.objects)!=null&&o.set&&(p.objects.set(r,s),console.log("[LIVE-EDIT] \u2705 Updated config in __editableConfig"));let d=(l=t==null?void 0:t.get)==null?void 0:l.call(t,r);if(console.log("[LIVE-EDIT] gameObject found?",!!d),d&&(console.log("[LIVE-EDIT] gameObject type:",(c=d.constructor)==null?void 0:c.name),console.log("[LIVE-EDIT] has updateConfig?",typeof d.updateConfig=="function"),console.log("[LIVE-EDIT] has onConfigUpdate?",typeof d.onConfigUpdate=="function")),d&&typeof d.updateConfig=="function")console.log("[LIVE-EDIT] \u2705 Calling updateConfig()"),d.updateConfig(s);else if(d&&typeof d.onConfigUpdate=="function")console.log("[LIVE-EDIT] \u2705 Calling onConfigUpdate()"),d.onConfigUpdate();else{console.log("[LIVE-EDIT] \u26A0\uFE0F No updateConfig or onConfigUpdate, applying transform directly");let u=ls(d);cs(u,s)}}catch(p){console.error("[LIVE-EDIT] \u274C Error in applyEditableObjectConfig:",p)}});let a={async applyObjectConfig(r,s){var p,d;console.log("[BRIDGE] \u{1F504} applyObjectConfig called for:",r);let o=e();(p=o==null?void 0:o.objects)!=null&&p.set&&(o.objects.set(r,s),console.log("[BRIDGE] \u2705 Updated config"));let l=(d=t==null?void 0:t.get)==null?void 0:d.call(t,r);if(console.log("[BRIDGE] gameObject found?",!!l),l&&(console.log("[BRIDGE] has updateConfig?",typeof l.updateConfig=="function"),console.log("[BRIDGE] has onConfigUpdate?",typeof l.onConfigUpdate=="function")),l&&typeof l.updateConfig=="function")console.log("[BRIDGE] \u2705 Calling updateConfig()"),l.updateConfig(s);else if(l&&typeof l.onConfigUpdate=="function")console.log("[BRIDGE] \u2705 Calling onConfigUpdate()"),l.onConfigUpdate();else{console.log("[BRIDGE] \u26A0\uFE0F Applying transform directly");let u=ls(l);cs(u,s)}let c=[r];n==null||n(r,s,c)},rebuildIndexes(){let r=e();typeof window!="undefined"&&(window.__editableConfig=r,ds(r))}};return a.rebuildIndexes(),a}K();var gs=qe(require("lottie-web"),1);si(ai);typeof window!="undefined"&&!window.lottie&&(window.lottie=gs.default);var nt=null,Jo=async()=>{if(!nt){let i=typeof window!="undefined"?window.INLINE_ASSETS:null,e=(i==null?void 0:i["handler.config"])||(i==null?void 0:i["handler.config.json"]);if(e)try{if(e.startsWith("data:")){let n=atob(e.split(",")[1]);nt=JSON.parse(n)}else nt=JSON.parse(e);return nt}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}nt=await(await fetch("./handler.config.json")).json()}return nt},ua,It,fs,it,da,pa;function Zo(i){ua=i.initGame,It=i.CustomAssets,fs=i.updateScreenState,it=i.globalResponsiveMultipliers,da=i.layout,pa=i.clearResponsiveElements}var Fn="web_embed",Ot="https://example.com",ps={profile_id:Fn},Pe=null,oe=null,ca={width:0,height:0},Qo=!0,el=async()=>{var c,p,d,u;document.title="Handler Pixi Game";let i=await Jo();ps={...i.ids||{},profile_id:Fn},Ot=i.destination_url||((p=(c=i.export_profiles)==null?void 0:c[Fn])==null?void 0:p.destination_url)||Ot,Oe.init({ids:ps,profile:Fn,destinationUrl:Ot});let e=Oe.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),oe=oa({onDeviceChange:h=>{console.log(`[PREVIEW] Device switched to ${h.width}x${h.height}, restarting game...`),us()},onRefresh:us});let g=oe.getGameContainer();g&&(e=g),window.addEventListener("handler-preview:screen",h=>{var v,x,w,E,T,S,O,B,M,C,I;let f=window.gameApp,m=window.gameObjectManager,{width:b,height:y}=h.detail;if(ca.width=b,ca.height=y,fs(b,y),!(!f||!f.renderer)){m&&o(f,m);try{f.renderer.resize(b,y);let k=f.view;k&&(k.style.width="100%",k.style.height="100%",k.style.display="block")}catch(k){console.warn("[SCREEN] Error resizing renderer:",k);return}if(t&&m&&da)try{let k=(v=window.__mainContainer)!=null?v:f.stage,D=(O=(S=(E=window.__tutorialLabel)!=null?E:(w=(x=m.get("label_1"))==null?void 0:x.getDisplayObject)==null?void 0:w.call(x))!=null?S:(T=m.get("label_1"))==null?void 0:T.pixiObject)!=null?O:m.get("label_1"),j=m.get("background_1"),$=(I=(C=(M=window.__background)!=null?M:(B=j==null?void 0:j.getDisplayObject)==null?void 0:B.call(j))!=null?C:j==null?void 0:j.pixiObject)!=null?I:j;if(k){let A=k===f.stage;da({mainContainer:k,label:D,background:$,backgroundTexture:($==null?void 0:$.texture)||null,app:f},t,0,ca,m,{skipMainContainerTransform:A})}}catch(k){console.warn("[SCREEN] Error in layout:",k)}}})}let t=await me("scene.main");window.__editableConfig=t,s(),window.__editableConfigBaseline||(window.__editableConfigBaseline=G(t),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(u=(d=t.engine.runtime)==null?void 0:d.layout)!=null&&u.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(g=>setTimeout(g,100)),t=await me("scene.main"));let n=await ua(e,t,Ot,oe);Pe=n.app;let a=n.gameObjectManager;window.gameApp=Pe,window.gameObjectManager=a;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:a,assets:It})}catch(g){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",g)}oe&&oe.notifyGameLoaded();let r=window.__debugScale;r&&typeof r=="number"&&(it.scale=r,console.log(`[DEBUG] Applied persisted debug scale: ${r}`)),o(Pe,a);async function s(){try{let g=async y=>{let v=y.startsWith("/")?y:`/${y}`,x=await fetch(v,{cache:"no-cache"});if(!x.ok)return null;let w=await x.text();try{return JSON.parse(w)}catch{return null}},h=await g("configs/flow/app.flow.json");if(!h||typeof h!="object")return;let f=h.screens;if(!f||typeof f!="object")return;let m={},b={};for(let[y,v]of Object.entries(f)){let x=v==null?void 0:v.source;if(typeof x!="string")continue;let w=await g(x),E=w==null?void 0:w.elements;if(!Array.isArray(E))continue;let T=E.map(S=>S==null?void 0:S.instance_id).filter(S=>typeof S=="string");m[y]=T;for(let S of T)b[S]||(b[S]=y)}window.__HANDLER_APP_FLOW=h,window.__HANDLER_SCREEN_INDEX={screenToInstances:m,instanceToScreen:b},window.dispatchEvent(new CustomEvent("handler:screen-index-loaded"))}catch{}}function o(g,h){if(Qo){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${it.scale.toFixed(3)}`),g.stage){let m=function(b,y=0){if(!b||!b.children)return;let v=" ".repeat(y);b.children.forEach((x,w)=>{if(x&&x.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(x&&x.scale){let E=x.scale.x||1,T=x.scale.y||1;x.__originalScale||(x.__originalScale={x:E,y:T},console.log(`${v}[RESPONSIVE] Stored original scale for child[${w}]: ${E.toFixed(3)}, ${T.toFixed(3)}`));let S=x.__originalScale.x*it.scale,O=x.__originalScale.y*it.scale;typeof x.scale.set=="function"?x.scale.set(S,O):(x.scale.x=S,x.scale.y=O),console.log(`${v}[RESPONSIVE] Child[${w}] scale: ${E.toFixed(3)}\u2192${x.scale.x.toFixed(3)} (type: ${x.constructor.name})`),m(x,y+1)}else x&&console.log(`${v}[RESPONSIVE] Child[${w}] has no scale (type: ${x.constructor.name})`)})};var f=m;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),m(g.stage)}else console.warn("[RESPONSIVE] No app.stage found!");console.log("[REDDEBUG] Debug border left unscaled (fixed boundaries)"),console.log("[RESPONSIVE] ===== GLOBAL RESPONSIVE SCALING COMPLETE =====")}function l(g){if(g!==void 0){it.scale=g,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${g.toFixed(3)}`);let h=window.gameApp,f=window.gameObjectManager;h&&f?(o(h,f),h.renderer&&(h.renderer.render(h.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!h}) or gameObjectManager (${!!f}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=l,Oe.start()},us=async()=>{var e,t,n,a;console.log("[PREVIEW] Restarting game in 1 seconds...");let i=(e=window.gameObjectManager)==null?void 0:e.get("character_1");if(i){let r=((t=i.getDisplayObject)==null?void 0:t.call(i))||i;r&&r.scale&&console.log(`[CHARACTER] Before restart - Current scale - x: ${((n=r.scale.x)!=null?n:1).toFixed(3)}, y: ${((a=r.scale.y)!=null?a:1).toFixed(3)}`)}if(oe){oe.notifyGameDestroyed();try{pa&&pa()}catch(r){console.warn("Failed to clear responsive elements",r)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let r=oe.getGameContainer(),s=window.gameObjectManager;if(s&&typeof s.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),s.clear()),Pe){try{Pe.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}Pe=null}window.gameApp=null,window.gameObjectManager=null,r&&(r.innerHTML="");try{typeof It.resetScene=="function"&&It.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{me("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=G(o)),ua(r,o,Ot).then(l=>{Pe=l.app,window.gameApp=Pe,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:It})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}oe&&oe.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{Oe.start()}catch{}})})},100)},1e3)}};dn();K();var le={background:"#F6F3EF",ink:"#1E1E1E",secondaryText:"#8E8A84",primaryAccent:"#E38A5A",secondaryAccent:"#C9A28C",statusGreen:"#5F8F6B"},hs=1.25,ms={fontFamily:"Inter, system-ui, sans-serif"};var Un=class{constructor(e={}){this.currentProgress=0;var t;this.currentProgress=(t=e.progress)!=null?t:0,this.container=this.createContainer()}createContainer(){let e=document.createElement("div");e.className="handler-loading-screen",e.style.cssText=`
1493
1493
  position: fixed;
1494
1494
  inset: 0;
1495
1495
  display: flex;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-CLA6RPPP.js";import"./chunk-I5OOVR5U.js";import{a as q,b as r,c as s,d as t,e as u,f as v,g as w,h as x,i as y,j as z,k as A,l as B,m as C,n as D,o as E}from"./chunk-LV4HGC5G.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk-ZLL42OOV.js";import"./chunk-E6WJCS24.js";import"./chunk-JXBG6UFL.js";export{Q as COLORS,B as ConfigWatcher,K as DebugPanel,A as DefaultReloadStrategy,U as Handler,T as PlayableLoadingScreen,L as PreviewShell,R as STROKE_WIDTH,S as THEME,d as applyConfigOverride,e as applyConfigOverrides,n as applyConfigsToDisk,x as applyDefaults,a as baseLottie,P as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,M as createPreviewShell,k as deepClone,V as default,H as defaultPreset,G as deviceGroups,F as devicePresets,C as diffConfigs,l as exportConfigsAsJSON,i as getConfigOverrides,m as getConfigStateSummary,b as getOverrideMode,I as getPresetById,J as getPresetsByCategory,s as loadAllObjectConfigs,q as loadComponentSchemas,t as loadEngineConfig,u as loadGamePromptConfig,y as loadObjectCentricConfig,r as loadObjectConfig,v as loadSceneConfig,D as rehydrateObject,h as removeConfigOverride,o as resetToApplied,p as resetToOriginal,O as setBootstrapDependencies,c as setOverrideMode,E as setupHotReload,N as setupLiveEditBridge,z as toLegacyFormat,w as validateObjectConfig};
1
+ import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-6OSSL2F7.js";import"./chunk-I5OOVR5U.js";import{a as q,b as r,c as s,d as t,e as u,f as v,g as w,h as x,i as y,j as z,k as A,l as B,m as C,n as D,o as E}from"./chunk-LV4HGC5G.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk-ZLL42OOV.js";import"./chunk-E6WJCS24.js";import"./chunk-JXBG6UFL.js";export{Q as COLORS,B as ConfigWatcher,K as DebugPanel,A as DefaultReloadStrategy,U as Handler,T as PlayableLoadingScreen,L as PreviewShell,R as STROKE_WIDTH,S as THEME,d as applyConfigOverride,e as applyConfigOverrides,n as applyConfigsToDisk,x as applyDefaults,a as baseLottie,P as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,M as createPreviewShell,k as deepClone,V as default,H as defaultPreset,G as deviceGroups,F as devicePresets,C as diffConfigs,l as exportConfigsAsJSON,i as getConfigOverrides,m as getConfigStateSummary,b as getOverrideMode,I as getPresetById,J as getPresetsByCategory,s as loadAllObjectConfigs,q as loadComponentSchemas,t as loadEngineConfig,u as loadGamePromptConfig,y as loadObjectCentricConfig,r as loadObjectConfig,v as loadSceneConfig,D as rehydrateObject,h as removeConfigOverride,o as resetToApplied,p as resetToOriginal,O as setBootstrapDependencies,c as setOverrideMode,E as setupHotReload,N as setupLiveEditBridge,z as toLegacyFormat,w as validateObjectConfig};
@@ -43,7 +43,7 @@
43
43
  <button class="debug-btn primary" data-modal-apply>Apply</button>
44
44
  </div>
45
45
  </div>
46
- `,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Nr={};Wn(Nr,{AssetCache:()=>Q,AssetLoader:()=>fe,AssetSystem:()=>It,AssetTextures:()=>he,Assets:()=>pa,BaseSystem:()=>Ne,GameEngine:()=>Ot,GameObject:()=>ot,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>st,RuntimeObjectRegistry:()=>He,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>oa,clearResponsiveElements:()=>ga,createPixiBase:()=>Mt,getRegisteredFontIds:()=>ia,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>ha,playLottieOverlay:()=>ra,registerFont:()=>na,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Nr);var Qi=require("pixi.js");var pe={};function mt(n,e,t=!1){pe[n]||(pe[n]=[]),pe[n].push({fn:e,once:t})}function Gt(n,e){if(pe[n]){if(!e){delete pe[n];return}pe[n]=pe[n].filter(t=>t.fn!==e)}}function bt(n,...e){let t=pe[n];if(t)for(let i of[...t])i.fn(...e),i.once&&Gt(n,i.fn)}function q(n,e){mt(n,e,!0)}var D=null,Y=[],Le=null;function Jn(n){D=n,Y=[],Le!==null&&(clearTimeout(Le),Le=null)}function Zn(){var n,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(n=D==null?void 0:D.batchSize)!=null?n:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Kn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(n,e){let t=Zn();if(e&&t.endpoint){if(Y.push(n),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Xn();return}Le===null&&(Le=window.setTimeout(()=>{Le=null,Xn()},t.flushIntervalMs))}}async function Xn(){let n=Zn();if(!n.endpoint||Y.length===0)return;let e=Y.splice(0,n.batchSize);await Kn(n.endpoint,{events:e},n.transport,n.debug),Y.length>0&&await Kn(n.endpoint,{events:Y.splice(0,n.batchSize)},n.transport,n.debug)}function Qn(n){return Math.max(0,Math.min(1,n))}function Aa(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ei(n,e,t){try{n[e]=t}catch{}}function Ca(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ti(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function ni(n,e){let t=Ca(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ii(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),i()},r=u=>{n.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},s=u=>{u.killed||(u.killed=!0,r(u))},o=()=>{var l,p;let u=Ke();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=Qn(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=Qn(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)ei(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&ti(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){s(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(f.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=ni(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ei(u,g,m)}let p=ni(u,l);p.to&&ti(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))s(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function ai(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ii()}catch{}}var ri={name:"handler-playable-sdk",version:"0.3.53",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,Ta=V++,si=V++,oi=V++,li=V++,ci=V++,di=V++,pi=V++,ui=V++,gi=V++,fi=V++,hi=V++,mi=V++,k=Ta;function bi(){return k===si}function yi(){return k===oi}function vi(){return k===li}function xi(){return k===ci}function Te(){return k===di}function _e(){return k===pi}function wi(){return k===ui}function Ei(){return k===gi}function Ai(){return k===fi}function Vt(){return k===hi}function Wt(){return k===mi}function Si(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),k=si;return}catch{}else if(n==="dapi")try{dapi.isReady(),k=oi;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(k=li)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(k=ci)}catch{}else if(e==="mintegral")window.gameReady&&(k=di);else if(e==="tapjoy")window.TJ_API&&(k=pi);else if(e==="tiktok")window.openAppStore&&(k=ui);else if(e==="smadex")try{window.smxTracking&&(k=gi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(k=fi)}catch{}else e==="vungle"?k=hi:(n==="nucleo"||e==="nucleo")&&(k=mi)}var yt=ht(require("lottie-web"),1),Ci=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var ys=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],vs=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],xs=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],Pi=[{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:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var ws=[...Pi];var Ra=Pi[0];ue();var Ba=ht(require("jszip"),1);function za(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Na(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ha(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function Jt(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),s=await Ha(r),o=Na(r);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:r,width:(e=s==null?void 0:s.width)!=null?e:0,height:(t=s==null?void 0:s.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function vt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let r=a.getImageData(0,0,i.width,i.height),s=r.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(l=>({r:s[l.offset],g:s[l.offset+1],b:s[l.offset+2]})),c=0;for(let l=0;l<s.length;l+=4){let p=s[l],g=s[l+1],m=s[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(s[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Mi=require("@google/genai");async function Zt(n,e,t=[],i={}){var a,r,s,o,d,c,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Mi.GoogleGenAI({apiKey:n}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(s=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:s.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(o=l.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var ki=require("@google/genai");async function xt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ki.GoogleGenAI({apiKey:n}),r=[{text:e}];t.length>0&&t.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,c=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $i=require("pixi.js");var Ya=require("pixi.js");ue();function tr(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function nr(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ir(n){return`
46
+ `,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Nr={};Wn(Nr,{AssetCache:()=>Q,AssetLoader:()=>fe,AssetSystem:()=>It,AssetTextures:()=>he,Assets:()=>pa,BaseSystem:()=>Ne,GameEngine:()=>Ot,GameObject:()=>ot,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>st,RuntimeObjectRegistry:()=>He,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>oa,clearResponsiveElements:()=>ga,createPixiBase:()=>Mt,getRegisteredFontIds:()=>ia,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>ha,playLottieOverlay:()=>ra,registerFont:()=>na,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Nr);var Qi=require("pixi.js");var pe={};function mt(n,e,t=!1){pe[n]||(pe[n]=[]),pe[n].push({fn:e,once:t})}function Gt(n,e){if(pe[n]){if(!e){delete pe[n];return}pe[n]=pe[n].filter(t=>t.fn!==e)}}function bt(n,...e){let t=pe[n];if(t)for(let i of[...t])i.fn(...e),i.once&&Gt(n,i.fn)}function q(n,e){mt(n,e,!0)}var D=null,Y=[],Le=null;function Jn(n){D=n,Y=[],Le!==null&&(clearTimeout(Le),Le=null)}function Zn(){var n,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(n=D==null?void 0:D.batchSize)!=null?n:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Kn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(n,e){let t=Zn();if(e&&t.endpoint){if(Y.push(n),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Xn();return}Le===null&&(Le=window.setTimeout(()=>{Le=null,Xn()},t.flushIntervalMs))}}async function Xn(){let n=Zn();if(!n.endpoint||Y.length===0)return;let e=Y.splice(0,n.batchSize);await Kn(n.endpoint,{events:e},n.transport,n.debug),Y.length>0&&await Kn(n.endpoint,{events:Y.splice(0,n.batchSize)},n.transport,n.debug)}function Qn(n){return Math.max(0,Math.min(1,n))}function Aa(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ei(n,e,t){try{n[e]=t}catch{}}function Ca(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ti(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function ni(n,e){let t=Ca(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ii(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),i()},r=u=>{n.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},s=u=>{u.killed||(u.killed=!0,r(u))},o=()=>{var l,p;let u=Ke();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=Qn(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=Qn(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)ei(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&ti(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){s(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(f.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=ni(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ei(u,g,m)}let p=ni(u,l);p.to&&ti(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))s(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function ai(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ii()}catch{}}var ri={name:"handler-playable-sdk",version:"0.3.55",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,Ta=V++,si=V++,oi=V++,li=V++,ci=V++,di=V++,pi=V++,ui=V++,gi=V++,fi=V++,hi=V++,mi=V++,k=Ta;function bi(){return k===si}function yi(){return k===oi}function vi(){return k===li}function xi(){return k===ci}function Te(){return k===di}function _e(){return k===pi}function wi(){return k===ui}function Ei(){return k===gi}function Ai(){return k===fi}function Vt(){return k===hi}function Wt(){return k===mi}function Si(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),k=si;return}catch{}else if(n==="dapi")try{dapi.isReady(),k=oi;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(k=li)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(k=ci)}catch{}else if(e==="mintegral")window.gameReady&&(k=di);else if(e==="tapjoy")window.TJ_API&&(k=pi);else if(e==="tiktok")window.openAppStore&&(k=ui);else if(e==="smadex")try{window.smxTracking&&(k=gi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(k=fi)}catch{}else e==="vungle"?k=hi:(n==="nucleo"||e==="nucleo")&&(k=mi)}var yt=ht(require("lottie-web"),1),Ci=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var ys=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],vs=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],xs=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],Pi=[{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:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var ws=[...Pi];var Ra=Pi[0];ue();var Ba=ht(require("jszip"),1);function za(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Na(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ha(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function Jt(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),s=await Ha(r),o=Na(r);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:r,width:(e=s==null?void 0:s.width)!=null?e:0,height:(t=s==null?void 0:s.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function vt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let r=a.getImageData(0,0,i.width,i.height),s=r.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(l=>({r:s[l.offset],g:s[l.offset+1],b:s[l.offset+2]})),c=0;for(let l=0;l<s.length;l+=4){let p=s[l],g=s[l+1],m=s[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(s[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Mi=require("@google/genai");async function Zt(n,e,t=[],i={}){var a,r,s,o,d,c,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Mi.GoogleGenAI({apiKey:n}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(s=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:s.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(o=l.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var ki=require("@google/genai");async function xt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ki.GoogleGenAI({apiKey:n}),r=[{text:e}];t.length>0&&t.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,c=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $i=require("pixi.js");var Ya=require("pixi.js");ue();function tr(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function nr(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ir(n){return`
47
47
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
48
48
 
49
49
  Provide a concise summary (2-3 sentences) covering:
@@ -1 +1 @@
1
- (function(_0xc4a064,_0x3ef899){var a0_0x2900b2={_0x114afc:0x229,_0x5d98a0:0x237,_0x45bfca:0x236,_0x100f60:'0I^K',_0x55258a:0x22a,_0xaf7e63:0x229,_0xc62b6c:0x227,_0x3ce428:'[Ur)',_0x1b7c35:0x22b,_0xe0b78b:0x238,_0x53b764:0x231,_0x4b6f3e:0x23b,_0x80fc43:0x231,_0x419937:0x233,_0x3b1e7a:'C$8b',_0x4d4af9:0x227,_0x583ecb:0x230,_0x190cba:0x23b,_0x1ce1ac:0x22e,_0x5df96e:0x22a,_0x142e45:'N3IY',_0x4303cd:'3q$j',_0x50a2f3:0x256,_0x5df629:0x25b,_0x2c7241:0x1d9,_0x22b6c2:'7E^Q',_0x3f7fb7:0x1e7,_0xb51946:'DaL*',_0x1dfa0b:0x248,_0x5e7f62:0x248,_0x51abfe:0x24a,_0x27a902:0x234,_0x7223be:0x233,_0x312866:0x237,_0x162025:0x240,_0x5c2440:'#iO['},a0_0x484824={_0x3a985d:0x1c0},a0_0x5454de={_0x41af51:0x253},_0x24ae75=_0xc4a064();function _0x476ecd(_0xd73733,_0x26d814,_0x24d4fc,_0x45790c,_0xcd1e5b){return a0_0x224e(_0xd73733- -a0_0x5454de._0x41af51,_0x24d4fc);}function _0x4c96a3(_0x1c0200,_0x20d8ac,_0x59dc0e,_0x3fd310,_0xb00616){return a0_0x224e(_0x59dc0e-0x1d6,_0x20d8ac);}function _0x345b12(_0x597611,_0x297ccc,_0x20087f,_0x58c530,_0x8de877){return a0_0x224e(_0x20087f-a0_0x484824._0x3a985d,_0x8de877);}while(!![]){try{var _0x4b5bad=-parseInt(_0x345b12(a0_0x2900b2._0x114afc,a0_0x2900b2._0x5d98a0,a0_0x2900b2._0x45bfca,0x239,a0_0x2900b2._0x100f60))/(-0x1*0x1e2b+0x364*-0x8+0x2*0x1ca6)+parseInt(_0x345b12(0x227,a0_0x2900b2._0x55258a,a0_0x2900b2._0xaf7e63,a0_0x2900b2._0xc62b6c,a0_0x2900b2._0x3ce428))/(-0x9*-0x106+0x4b9+-0x73*0x1f)+-parseInt(_0x345b12(0x244,a0_0x2900b2._0x1b7c35,a0_0x2900b2._0xe0b78b,0x22f,'cty6'))/(-0x1*-0x20b+-0x2651+0x2449)*(parseInt(_0x345b12(a0_0x2900b2._0x53b764,a0_0x2900b2._0x4b6f3e,a0_0x2900b2._0x80fc43,a0_0x2900b2._0x419937,a0_0x2900b2._0x3b1e7a))/(0x5ea+-0x6f4*-0x5+0xa*-0x411))+parseInt(_0x345b12(a0_0x2900b2._0x4d4af9,a0_0x2900b2._0x4b6f3e,a0_0x2900b2._0x583ecb,0x23d,']Xr*'))/(-0xedb*-0x1+0x22f2+-0x31c8)*(parseInt(_0x345b12(0x228,a0_0x2900b2._0x190cba,a0_0x2900b2._0x1ce1ac,a0_0x2900b2._0x5df96e,a0_0x2900b2._0x142e45))/(0x3d2+0x14*-0x10c+0x1124))+-parseInt(_0x4c96a3(0x25a,a0_0x2900b2._0x4303cd,a0_0x2900b2._0x50a2f3,a0_0x2900b2._0x5df629,0x25f))/(-0x263d+0x1bc2+0x5*0x21a)+parseInt(_0x476ecd(-0x1da,-a0_0x2900b2._0x2c7241,a0_0x2900b2._0x22b6c2,-0x1d2,-a0_0x2900b2._0x3f7fb7))/(0x221c+0x167a+-0x388e)+-parseInt(_0x4c96a3(0x255,a0_0x2900b2._0xb51946,a0_0x2900b2._0x1dfa0b,a0_0x2900b2._0x5e7f62,a0_0x2900b2._0x51abfe))/(0x117e+0x1*-0x39b+0x24f*-0x6)*(-parseInt(_0x345b12(a0_0x2900b2._0x27a902,a0_0x2900b2._0x7223be,a0_0x2900b2._0x312866,a0_0x2900b2._0x162025,a0_0x2900b2._0x5c2440))/(-0x2097+-0x1460+0x3501));if(_0x4b5bad===_0x3ef899)break;else _0x24ae75['push'](_0x24ae75['shift']());}catch(_0xf3e8c0){_0x24ae75['push'](_0x24ae75['shift']());}}}(a0_0x5d06,-0xbcaa3+0x7138d+0xdc93f));var a0_0x745caa=(function(){var _0x23add5=!![];return function(_0x784b2d,_0x1513b5){var _0x4705fd=_0x23add5?function(){if(_0x1513b5){var _0x571dab=_0x1513b5['apply'](_0x784b2d,arguments);return _0x1513b5=null,_0x571dab;}}:function(){};return _0x23add5=![],_0x4705fd;};}()),a0_0x4124cb=a0_0x745caa(this,function(){var a0_0xc5e1c9={_0x274907:0x2ec,_0x5b08ae:0x304,_0x27f39a:0x2f2,_0x48bbfb:0x2f7,_0x38117c:0x2f1,_0xebd52:'3q$j',_0x437100:0x2f1,_0x49b0d9:0x2ec,_0x4d804a:0x163,_0x883541:'S#Sk',_0x14a6fc:0x171,_0x17f5d9:0x347,_0x567fc6:0x343,_0x142208:'#iO[',_0x3b6a9a:0x335,_0x1a16f7:0x33a,_0x1555ea:0x347,_0x3439a0:'nKhv',_0x59d5b9:0x33d,_0x2c158f:0x2f9,_0x1cb70f:0x2f5,_0x209242:'BFbe',_0x2b0cec:0x2f8,_0x226e2a:0x2f3,_0x36c3eb:0x168,_0x245606:0x172,_0x2e3a0a:0x169,_0x4948c1:0x160,_0x3d28a1:0x15b,_0x5e170b:0x175,_0x33326a:'(ROX',_0x4f9910:0x167,_0x53c0f2:0x33c,_0x2bac4d:'GQLn',_0x122afd:0x344,_0x3d7d3c:0x344,_0x4e1cf0:'#68M',_0x321593:0x34a},a0_0x546160={_0x351fa1:0x2c8},a0_0x5b0313={_0x2cc2f9:0x1db},_0x3224ff={};_0x3224ff[_0x379e1a(a0_0xc5e1c9._0x274907,0x2f6,'#68M',a0_0xc5e1c9._0x5b08ae,a0_0xc5e1c9._0x27f39a)]=_0x379e1a(a0_0xc5e1c9._0x48bbfb,a0_0xc5e1c9._0x38117c,a0_0xc5e1c9._0xebd52,a0_0xc5e1c9._0x437100,a0_0xc5e1c9._0x49b0d9)+_0x3d3f90(-a0_0xc5e1c9._0x4d804a,a0_0xc5e1c9._0x883541,-0x16b,-a0_0xc5e1c9._0x14a6fc,-0x17e)+'+$';function _0x3d3f90(_0x218c5a,_0x53c6f1,_0x4d306a,_0x56128f,_0x3823c2){return a0_0x224e(_0x56128f- -a0_0x5b0313._0x2cc2f9,_0x53c6f1);}var _0x811ffe=_0x3224ff;function _0x379e1a(_0x468e52,_0x27af57,_0x2cb25c,_0x3e3535,_0x2d0db8){return a0_0x224e(_0x27af57-0x274,_0x2cb25c);}function _0x515ad8(_0x68da8,_0x5dafa3,_0x14291d,_0x34e651,_0x2c3f88){return a0_0x224e(_0x2c3f88-a0_0x546160._0x351fa1,_0x34e651);}return a0_0x4124cb[_0x515ad8(a0_0xc5e1c9._0x17f5d9,a0_0xc5e1c9._0x567fc6,0x344,a0_0xc5e1c9._0x142208,0x346)+_0x515ad8(a0_0xc5e1c9._0x3b6a9a,a0_0xc5e1c9._0x1a16f7,a0_0xc5e1c9._0x1555ea,a0_0xc5e1c9._0x3439a0,a0_0xc5e1c9._0x59d5b9)]()[_0x379e1a(a0_0xc5e1c9._0x2c158f,a0_0xc5e1c9._0x1cb70f,a0_0xc5e1c9._0x209242,a0_0xc5e1c9._0x2b0cec,a0_0xc5e1c9._0x226e2a)+'h'](_0x811ffe['wXOHC'])[_0x3d3f90(-a0_0xc5e1c9._0x36c3eb,'NV[W',-a0_0xc5e1c9._0x14a6fc,-0x16c,-a0_0xc5e1c9._0x245606)+_0x3d3f90(-a0_0xc5e1c9._0x2e3a0a,'ZWmT',-a0_0xc5e1c9._0x2e3a0a,-a0_0xc5e1c9._0x4948c1,-a0_0xc5e1c9._0x3d28a1)]()[_0x3d3f90(-a0_0xc5e1c9._0x5e170b,a0_0xc5e1c9._0x33326a,-a0_0xc5e1c9._0x4f9910,-a0_0xc5e1c9._0x36c3eb,-0x15c)+'ructo'+'r'](a0_0x4124cb)[_0x515ad8(0x33a,0x339,a0_0xc5e1c9._0x53c0f2,a0_0xc5e1c9._0x2bac4d,a0_0xc5e1c9._0x122afd)+'h'](_0x811ffe[_0x515ad8(a0_0xc5e1c9._0x3d7d3c,0x343,0x34c,a0_0xc5e1c9._0x4e1cf0,a0_0xc5e1c9._0x321593)]);});a0_0x4124cb();import{A as a0_0x3379f4,B as a0_0x7f959f,C as a0_0x43d976,D as a0_0x5dc21e,b as a0_0x1415a1,c as a0_0xc2120a,d as a0_0x1f8720,e as a0_0x31f996,f as a0_0x43fdf0,g as a0_0x4f4d47,h as a0_0x13edef,i as a0_0xe2e96d,j as a0_0x4384c0,k as a0_0x33b5b0,l as a0_0x3eda21,m as a0_0x18f3d7,n as a0_0x500f7a,o as a0_0x6c9f40,p as a0_0x438902,q as a0_0x393280,r as a0_0x2fb5ac,s as a0_0x382f3c,t as a0_0x4dfd40,u as a0_0x5d9704,v as a0_0x33f977,w as a0_0x57578c,x as a0_0x501d82,y as a0_0x3ad1bd,z as a0_0x2e773e}from'../chunk-CLA6RPPP.js';import{a as a0_0x3e2a86,b as a0_0x2b37e6,c as a0_0xa04453,d as a0_0x32f73d,e as a0_0x57b18c}from'../chunk-I5OOVR5U.js';function a0_0x5d06(){var _0xa96ee6=['cmkKW7TKW6RcGtC2W67dGMFcSq','W4P0W4SNW5jDW6hcMeVdO8kS','WRjeimosfaFdPG','WRXXbYtdKHlcMqxdHCoYo8o7','xxlcUCocWRO','nCk/WOFcRL3cHqO3aSoiW5tdR1u','oW/cLmo+A8kCWRlcLYldSq','verLWQtdLSkKimkKkmkewmksW54','umkip8kxv8oKWQK','WOufW7jxWO8','veBcNmk6tchdVdJdKLpcRGpcQW','pCoDqmkertZdLCofrmkiWPu','pGFcLmo5kCorW4VcPcpdOYrzbG','WP4AcSoEWOe','WRyWrmkYE0NdNmkCW4pdJbnK','vtK0','WRpdNmkCsSkxEd57W4a1W7BcPW','iSkdW4tdGmo4hcei','W4yZWOFdOK3dI8kklKxcMq','W4XZW4OJW5SOWOhcJxNdG8kOWOfm','mXpcM8kAWPrfWPGj','jSoQWRy','xaBcV0f6','W4xdPCo7W6hcKG','z8oCW4/dLSoj','WPBcTSkCy8o5DrWWvmksu2D4','W5RdV8oHW7NcGCooqComtvz1eSoW','oJKYW6BdPW','W5BdNmoHhCkc'];a0_0x5d06=function(){return _0xa96ee6;};return a0_0x5d06();}function a0_0x224e(_0x521c18,_0x20e38b){_0x521c18=_0x521c18-(0x22ed+-0xcd7*-0x1+-0x19*0x1e5);var _0x2e57c7=a0_0x5d06();var _0xb8517=_0x2e57c7[_0x521c18];if(a0_0x224e['JDzuka']===undefined){var _0x36e7b3=function(_0x39b6bf){var _0x3f40ae='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x41d26c='',_0x5a5731='',_0x4b6ee2=_0x41d26c+_0x36e7b3;for(var _0xfb0f7d=-0x5df+0x180b+-0x122c,_0x14f7ee,_0x25cf39,_0x3459c7=-0x1*0x592+0x7*-0x4c9+0x2711;_0x25cf39=_0x39b6bf['charAt'](_0x3459c7++);~_0x25cf39&&(_0x14f7ee=_0xfb0f7d%(0x122c*-0x2+-0x49*0x4f+0x1*0x3ae3)?_0x14f7ee*(-0x38b*0x1+-0xcac+0x1077)+_0x25cf39:_0x25cf39,_0xfb0f7d++%(-0x1b58+0x1abb*-0x1+0x3617*0x1))?_0x41d26c+=_0x4b6ee2['charCodeAt'](_0x3459c7+(-0x1c1b+-0x27*-0x10+0x19b5))-(-0x445+0x22cb+-0x1e7c)!==0x2064+0x241f+0x4483*-0x1?String['fromCharCode'](0xe46+-0x3a7+-0x9a0&_0x14f7ee>>(-(-0x59*-0x1a+-0x54d*-0x7+-0x2e23)*_0xfb0f7d&0x2487+-0xbed+-0x1894)):_0xfb0f7d:-0x1650+0x2a*0xcb+-0xafe){_0x25cf39=_0x3f40ae['indexOf'](_0x25cf39);}for(var _0x1622c8=-0x1a79+0x939*0x3+0x9*-0x22,_0xbc7ab8=_0x41d26c['length'];_0x1622c8<_0xbc7ab8;_0x1622c8++){_0x5a5731+='%'+('00'+_0x41d26c['charCodeAt'](_0x1622c8)['toString'](-0x1f1e+-0x1e38+0x3d66))['slice'](-(0x1a8+-0xb7a+0x44*0x25));}return decodeURIComponent(_0x5a5731);};var _0x94b7a2=function(_0x31c274,_0x41f03f){var _0x5c78eb=[],_0x104b93=0x5*0x245+0x47f+0x2*-0x7ec,_0x519124,_0x150022='';_0x31c274=_0x36e7b3(_0x31c274);var _0x258314;for(_0x258314=-0x77*0x46+0x1085+0x1005;_0x258314<-0x1e*-0x10+-0x2397+0x22b7;_0x258314++){_0x5c78eb[_0x258314]=_0x258314;}for(_0x258314=0x34b+-0x23db*0x1+0x2*0x1048;_0x258314<0x4*0x1+0x129*0x6+0x9*-0xaa;_0x258314++){_0x104b93=(_0x104b93+_0x5c78eb[_0x258314]+_0x41f03f['charCodeAt'](_0x258314%_0x41f03f['length']))%(-0x100+0xbdd+0x9dd*-0x1),_0x519124=_0x5c78eb[_0x258314],_0x5c78eb[_0x258314]=_0x5c78eb[_0x104b93],_0x5c78eb[_0x104b93]=_0x519124;}_0x258314=-0x9d7+0x1075*-0x2+-0x88d*-0x5,_0x104b93=-0x4c*-0xd+-0x41c*0x2+-0x6*-0xba;for(var _0x461171=-0x1455+0x2101*0x1+-0xcac;_0x461171<_0x31c274['length'];_0x461171++){_0x258314=(_0x258314+(-0x270b+0xd87+-0x8b*-0x2f))%(0x1e75+0xbce+0xdc1*-0x3),_0x104b93=(_0x104b93+_0x5c78eb[_0x258314])%(-0x2a*-0xe7+-0x195d+-0x1*0xb89),_0x519124=_0x5c78eb[_0x258314],_0x5c78eb[_0x258314]=_0x5c78eb[_0x104b93],_0x5c78eb[_0x104b93]=_0x519124,_0x150022+=String['fromCharCode'](_0x31c274['charCodeAt'](_0x461171)^_0x5c78eb[(_0x5c78eb[_0x258314]+_0x5c78eb[_0x104b93])%(0x9b*0x3+-0x8be+-0x1*-0x7ed)]);}return _0x150022;};a0_0x224e['QSUayO']=_0x94b7a2,a0_0x224e['HMPrYS']={},a0_0x224e['JDzuka']=!![];}var _0x5a1f16=_0x2e57c7[0x217+0x18c3+-0x1ada],_0xfb3f3=_0x521c18+_0x5a1f16,_0x46a415=a0_0x224e['HMPrYS'][_0xfb3f3];if(!_0x46a415){if(a0_0x224e['TECwuK']===undefined){var _0x40bac4=function(_0x595269){this['jxOQYH']=_0x595269,this['jWJHrk']=[0x196*-0x13+0x6f8*-0x5+0x40fb,0x5*0x443+-0x153b+0x4*-0x5,0x1*-0xacf+-0x7bf+0x5*0x3b6],this['pVLZMx']=function(){return'newState';},this['uEwacm']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['cnrINs']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x40bac4['prototype']['WZHtif']=function(){var _0x4b1f22=new RegExp(this['uEwacm']+this['cnrINs']),_0x144559=_0x4b1f22['test'](this['pVLZMx']['toString']())?--this['jWJHrk'][-0x80*-0x7+0x1dc3*-0x1+0x1a44]:--this['jWJHrk'][0x355+-0x55*0x1+-0x300];return this['MzTINV'](_0x144559);},_0x40bac4['prototype']['MzTINV']=function(_0x285e30){if(!Boolean(~_0x285e30))return _0x285e30;return this['JSwkgl'](this['jxOQYH']);},_0x40bac4['prototype']['JSwkgl']=function(_0xfdfd6d){for(var _0x450a1e=0x2fb*0x7+0x1*-0x11b9+0x2*-0x192,_0x2b49eb=this['jWJHrk']['length'];_0x450a1e<_0x2b49eb;_0x450a1e++){this['jWJHrk']['push'](Math['round'](Math['random']())),_0x2b49eb=this['jWJHrk']['length'];}return _0xfdfd6d(this['jWJHrk'][0x1d31+-0xa7*0x14+-0x1025*0x1]);},new _0x40bac4(a0_0x224e)['WZHtif'](),a0_0x224e['TECwuK']=!![];}_0xb8517=a0_0x224e['QSUayO'](_0xb8517,_0x20e38b),a0_0x224e['HMPrYS'][_0xfb3f3]=_0xb8517;}else _0xb8517=_0x46a415;return _0xb8517;}import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x3e2a86 as AssetCache,a0_0xa04453 as AssetLoader,a0_0x5d9704 as AssetSystem,a0_0x32f73d as AssetTextures,a0_0x382f3c as Assets,a0_0x6c9f40 as BaseSystem,a0_0x500f7a as GameEngine,a0_0x31f996 as GameObject,a0_0x43fdf0 as GameObjectManager,a0_0x18f3d7 as ObjectFactory,a0_0x1f8720 as Renderer,a0_0x438902 as RuntimeObjectRegistry,a0_0xc2120a as Transform,a0_0x7f959f as applyScreenAnchor,a0_0x393280 as basePixi,a0_0x57578c as clearResponsiveElements,a0_0x1415a1 as createPixiBase,a0_0x4384c0 as getRegisteredFontIds,a0_0x33f977 as globalResponsiveMultipliers,a0_0x57b18c as initAssetTextures,a0_0x4dfd40 as initAssets,a0_0x43d976 as layout,a0_0x3eda21 as playLottieOverlay,a0_0xe2e96d as registerFont,a0_0x2b37e6 as registerType,a0_0x3ad1bd as resolveAnchorVec2,a0_0x4f4d47 as resolveFont,a0_0x13edef as resolveFontWeight,a0_0x2e773e as resolveScreenAnchorPoint,a0_0x3379f4 as resolveScreenRatioPoint,a0_0x5dc21e as runInitSequence,a0_0x33b5b0 as setLottieInstance,a0_0x2fb5ac as spawnSceneFromConfig,a0_0x501d82 as updateScreenState};
1
+ function a0_0x1fe9(_0x431946,_0x546a0e){_0x431946=_0x431946-(0x92d*0x1+-0x10*0x56+-0x1f4);var _0x58a3c4=a0_0x1ee0();var _0x3563cf=_0x58a3c4[_0x431946];if(a0_0x1fe9['fNgWiC']===undefined){var _0x24d0f0=function(_0x5da80a){var _0x554ce0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x15cce2='',_0x5bcdd4='',_0x348233=_0x15cce2+_0x24d0f0;for(var _0x4dcb82=-0xb5+0x1*0x1e88+0x3*-0x9f1,_0x59aaad,_0x33bcb1,_0x46572f=-0x2438+-0x29*0x92+0x3b9a;_0x33bcb1=_0x5da80a['charAt'](_0x46572f++);~_0x33bcb1&&(_0x59aaad=_0x4dcb82%(-0x23eb+0x104f+0x13a0)?_0x59aaad*(-0x190*0xa+-0xfc+0x34*0x53)+_0x33bcb1:_0x33bcb1,_0x4dcb82++%(-0x4d5*0x3+0xbe3*0x1+0x2a0))?_0x15cce2+=_0x348233['charCodeAt'](_0x46572f+(-0x592+-0xce*0xd+0x1012))-(-0x7ed*-0x3+0x226e+-0x1*0x3a2b)!==0x13eb*-0x1+0x22cc+-0xee1?String['fromCharCode'](0x3bf+0xd12*-0x1+-0xa52*-0x1&_0x59aaad>>(-(-0x3e5*-0x4+0x2169*0x1+-0x30fb)*_0x4dcb82&-0xc6f*0x1+0x1296+-0x621)):_0x4dcb82:-0x2679+-0x20f4+-0x45*-0x109){_0x33bcb1=_0x554ce0['indexOf'](_0x33bcb1);}for(var _0x519415=0x1*-0x18db+-0xd*-0x161+0x2*0x377,_0x22f698=_0x15cce2['length'];_0x519415<_0x22f698;_0x519415++){_0x5bcdd4+='%'+('00'+_0x15cce2['charCodeAt'](_0x519415)['toString'](0xd1a*0x1+0x26bc+-0x33c6))['slice'](-(-0x2411*-0x1+0x645*-0x5+0x2*-0x25b));}return decodeURIComponent(_0x5bcdd4);};var _0x484d71=function(_0x15e87d,_0x561ff8){var _0x1f9600=[],_0x308faa=0xe06+-0xd*0x7d+-0x7ad,_0x5547ed,_0x26aa22='';_0x15e87d=_0x24d0f0(_0x15e87d);var _0xcffb74;for(_0xcffb74=-0x212a+0x1f31+-0x65*-0x5;_0xcffb74<0x5*0x5cf+0x7*0x3d7+-0x4a*0xbe;_0xcffb74++){_0x1f9600[_0xcffb74]=_0xcffb74;}for(_0xcffb74=-0x564+-0x1e6b+0x23cf;_0xcffb74<0x1185+-0x8ea+-0xb1*0xb;_0xcffb74++){_0x308faa=(_0x308faa+_0x1f9600[_0xcffb74]+_0x561ff8['charCodeAt'](_0xcffb74%_0x561ff8['length']))%(-0x2d*-0x9e+0x8ed+0x1e1*-0x13),_0x5547ed=_0x1f9600[_0xcffb74],_0x1f9600[_0xcffb74]=_0x1f9600[_0x308faa],_0x1f9600[_0x308faa]=_0x5547ed;}_0xcffb74=0xb5a+-0x38f+-0x7cb,_0x308faa=0xd2f+0x1601+-0x233*0x10;for(var _0x5c1852=-0x1111*-0x1+-0x928+-0x7e9*0x1;_0x5c1852<_0x15e87d['length'];_0x5c1852++){_0xcffb74=(_0xcffb74+(-0xa91*0x1+0x123d+0x97*-0xd))%(0x5a+0xc8d+-0xbe7),_0x308faa=(_0x308faa+_0x1f9600[_0xcffb74])%(-0x2*0xe48+-0x2378+-0x8*-0x821),_0x5547ed=_0x1f9600[_0xcffb74],_0x1f9600[_0xcffb74]=_0x1f9600[_0x308faa],_0x1f9600[_0x308faa]=_0x5547ed,_0x26aa22+=String['fromCharCode'](_0x15e87d['charCodeAt'](_0x5c1852)^_0x1f9600[(_0x1f9600[_0xcffb74]+_0x1f9600[_0x308faa])%(0x3a7+0x8*0x2f6+0xb*-0x265)]);}return _0x26aa22;};a0_0x1fe9['DaKPDV']=_0x484d71,a0_0x1fe9['iLjhOM']={},a0_0x1fe9['fNgWiC']=!![];}var _0x4e5c40=_0x58a3c4[0x1*-0x1862+0x11df+0x1*0x683],_0x12259b=_0x431946+_0x4e5c40,_0x4af141=a0_0x1fe9['iLjhOM'][_0x12259b];if(!_0x4af141){if(a0_0x1fe9['NOjwKf']===undefined){var _0x5dcd5f=function(_0x5e2185){this['cQxhKT']=_0x5e2185,this['uVFSCm']=[-0x28a*0x7+0x26d+0x189*0xa,-0xc2*0x29+-0xc6a*0x1+0x2b7c,-0xb9a+0x1*0x779+0x421],this['luovPt']=function(){return'newState';},this['TfcYhB']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['fMbXks']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x5dcd5f['prototype']['lMenZY']=function(){var _0x52914f=new RegExp(this['TfcYhB']+this['fMbXks']),_0xe6a130=_0x52914f['test'](this['luovPt']['toString']())?--this['uVFSCm'][0x921+0x9cc+0xad*-0x1c]:--this['uVFSCm'][-0x3*-0x4a8+0x1*-0x5bc+-0x83c];return this['LZFhiE'](_0xe6a130);},_0x5dcd5f['prototype']['LZFhiE']=function(_0x8715e8){if(!Boolean(~_0x8715e8))return _0x8715e8;return this['IxvIBH'](this['cQxhKT']);},_0x5dcd5f['prototype']['IxvIBH']=function(_0x50c312){for(var _0x14b561=0x12*-0x28+-0x2302+0x25d2,_0x55afec=this['uVFSCm']['length'];_0x14b561<_0x55afec;_0x14b561++){this['uVFSCm']['push'](Math['round'](Math['random']())),_0x55afec=this['uVFSCm']['length'];}return _0x50c312(this['uVFSCm'][0x4*0x18b+0xae+0x6da*-0x1]);},new _0x5dcd5f(a0_0x1fe9)['lMenZY'](),a0_0x1fe9['NOjwKf']=!![];}_0x3563cf=a0_0x1fe9['DaKPDV'](_0x3563cf,_0x546a0e),a0_0x1fe9['iLjhOM'][_0x12259b]=_0x3563cf;}else _0x3563cf=_0x4af141;return _0x3563cf;}(function(_0x37d772,_0x4c2929){var a0_0x1b26e0={_0x4554dc:0x4e0,_0x37ac14:0x4e7,_0x3b1b76:0x4f2,_0x3a8991:'$U^S',_0x7e1821:0x35,_0x5ace83:0x2b,_0x5b5fcc:0x29,_0x5e1151:0x4cd,_0x49a7fa:'eITi',_0x24b7d7:0x4dd,_0x2535bf:'eBXK',_0x5e11d1:0x4e5,_0x2216b9:0x4d0,_0x160b5e:'h5z*',_0x1f24fd:0x18,_0x568b51:0x19,_0x1b1214:0x24,_0x2f8c0f:'S9Xu',_0x46d9e1:0x32,_0x12349a:0x1b,_0x19f2d8:'w^jS',_0x2a8bf5:0x1e,_0x3d4b7b:0x4de,_0x22248e:0x4e8,_0x5e31ba:'gV!W',_0x57fbfe:0x4f4,_0x246e2a:0x4df,_0x4f335e:0x18,_0x33af3d:0x18,_0x20e791:0x10,_0x145efc:0x17,_0x1e755a:'[dLr',_0x162d77:0x11,_0x3fca64:0x18},a0_0x59f3bf={_0x4bed52:0x220},a0_0x107006={_0x4386e6:0x206};function _0x3b3bf3(_0x33ce20,_0x324bdb,_0x2f2896,_0x5c23af,_0x230bdf){return a0_0x1fe9(_0x33ce20- -a0_0x107006._0x4386e6,_0x324bdb);}var _0x574c97=_0x37d772();function _0x53b4c1(_0x10f24b,_0x2531eb,_0x358d76,_0x494e0c,_0x5ea1eb){return a0_0x1fe9(_0x2531eb-0x2f4,_0x358d76);}function _0x2e26de(_0xb180a1,_0x25e076,_0x5deff3,_0x367d10,_0x2541a5){return a0_0x1fe9(_0xb180a1- -a0_0x59f3bf._0x4bed52,_0x2541a5);}while(!![]){try{var _0x224c28=parseInt(_0x53b4c1(a0_0x1b26e0._0x4554dc,a0_0x1b26e0._0x37ac14,'qagL',0x4e2,a0_0x1b26e0._0x3b1b76))/(-0x3ec*0x3+0x2*0xb47+-0xac9)+parseInt(_0x3b3bf3(-0x28,a0_0x1b26e0._0x3a8991,-a0_0x1b26e0._0x7e1821,-a0_0x1b26e0._0x5ace83,-a0_0x1b26e0._0x5b5fcc))/(0x1e*-0x109+0xaf5+-0x1*-0x141b)*(-parseInt(_0x53b4c1(0x4bf,a0_0x1b26e0._0x5e1151,a0_0x1b26e0._0x49a7fa,0x4c2,0x4d8))/(0x14fb+0x625+-0x1b1d))+-parseInt(_0x53b4c1(0x4df,a0_0x1b26e0._0x24b7d7,a0_0x1b26e0._0x2535bf,a0_0x1b26e0._0x5e11d1,a0_0x1b26e0._0x2216b9))/(0x1450+0x1025+0x1*-0x2471)*(-parseInt(_0x3b3bf3(-0x20,a0_0x1b26e0._0x160b5e,-a0_0x1b26e0._0x1f24fd,-0x1d,-a0_0x1b26e0._0x568b51))/(0x851+0x96d*0x1+0x11b9*-0x1))+parseInt(_0x3b3bf3(-a0_0x1b26e0._0x1b1214,a0_0x1b26e0._0x2f8c0f,-a0_0x1b26e0._0x46d9e1,-a0_0x1b26e0._0x12349a,-0x2e))/(0x218d+-0x34*-0x17+0x7f*-0x4d)+parseInt(_0x3b3bf3(-0x1e,a0_0x1b26e0._0x19f2d8,-0x12,-a0_0x1b26e0._0x5b5fcc,-a0_0x1b26e0._0x2a8bf5))/(0x25aa+0x1ed1+-0x223a*0x2)+-parseInt(_0x53b4c1(a0_0x1b26e0._0x3d4b7b,a0_0x1b26e0._0x22248e,a0_0x1b26e0._0x5e31ba,a0_0x1b26e0._0x57fbfe,a0_0x1b26e0._0x246e2a))/(0x6e1*0x5+0x351+-0x25ae)+parseInt(_0x3b3bf3(-a0_0x1b26e0._0x4f335e,'pUkd',-a0_0x1b26e0._0x33af3d,-a0_0x1b26e0._0x20e791,-a0_0x1b26e0._0x145efc))/(0xfbf*0x2+-0xd31+-0x1244)*(-parseInt(_0x3b3bf3(-a0_0x1b26e0._0x145efc,a0_0x1b26e0._0x1e755a,-a0_0x1b26e0._0x12349a,-a0_0x1b26e0._0x162d77,-a0_0x1b26e0._0x3fca64))/(0x2462+-0x174*-0x1a+-0x4a20));if(_0x224c28===_0x4c2929)break;else _0x574c97['push'](_0x574c97['shift']());}catch(_0x55b858){_0x574c97['push'](_0x574c97['shift']());}}}(a0_0x1ee0,0xb*0x8abb+0x8*-0x9b9c+0x1*0x332cf));var a0_0x55adcb=(function(){var _0x2a1781=!![];return function(_0x35b324,_0x4512aa){var a0_0x48ea60={_0x52283b:0x255,_0x706c1:0x260,_0x16ff4d:0x254,_0x57b432:'5x8D',_0x178af6:0x251},a0_0x5570b3={_0x24b509:0x67},_0x24ce8a=_0x2a1781?function(){function _0x5967a3(_0x426fbc,_0x4f0836,_0xd4a747,_0x4b4725,_0x309db){return a0_0x1fe9(_0xd4a747-a0_0x5570b3._0x24b509,_0x4b4725);}if(_0x4512aa){var _0x1cd8a5=_0x4512aa[_0x5967a3(a0_0x48ea60._0x52283b,a0_0x48ea60._0x706c1,a0_0x48ea60._0x16ff4d,a0_0x48ea60._0x57b432,a0_0x48ea60._0x178af6)](_0x35b324,arguments);return _0x4512aa=null,_0x1cd8a5;}}:function(){};return _0x2a1781=![],_0x24ce8a;};}()),a0_0x5b131a=a0_0x55adcb(this,function(){var a0_0x44d3b9={_0x955f08:0x554,_0x1cde0e:0x54b,_0x3f0430:'ifV@',_0x18347f:0x551,_0x5ede84:'1NsD',_0x60c0a6:0x44d,_0x169a49:'VLM(',_0x5c59cb:0x1f3,_0x361bf3:0x1fe,_0x374b39:0x200,_0x49a540:0x540,_0x41e511:0x534,_0x4c6a6a:'uCSg',_0x2a84b9:0x538,_0x450ad5:'T$qG',_0x26f4b8:0x45d,_0x3317d7:0x46b,_0x546f1b:'qagL',_0x45c349:0x457,_0xd8d416:0x458,_0x403283:0x44a,_0x52f0c1:0x449,_0x48ed34:'I^hV',_0x578536:0x1f7,_0xb02e91:0x1f6,_0xb543e3:0x54a,_0x399f0e:0x553,_0x5d58d3:'pUkd',_0x5b2063:0x537,_0x4bba5c:0x1e9,_0x195117:0x1ef,_0x4ee083:0x1fb,_0x1b9c0f:0x208,_0x17988e:0x1fc,_0x4ba274:0x1f0,_0x1c60ab:'VOro',_0x5acb3e:0x445},a0_0x45dca9={_0xe1ac03:0x12},a0_0x57c91f={_0x3c4064:0x26d},a0_0x445ffe={_0x27e783:0x361};function _0x2da52b(_0x2481b2,_0x5f009d,_0x4c4406,_0x4fe45c,_0x4f2beb){return a0_0x1fe9(_0x5f009d-a0_0x445ffe._0x27e783,_0x4fe45c);}function _0x1e7336(_0xee5242,_0x3d144e,_0x3acc12,_0x4916ad,_0x33b61b){return a0_0x1fe9(_0x3acc12-a0_0x57c91f._0x3c4064,_0xee5242);}function _0x2fba21(_0x2d774f,_0x32e814,_0x1c8c50,_0x718ebd,_0x534949){return a0_0x1fe9(_0x718ebd-a0_0x45dca9._0xe1ac03,_0x2d774f);}return a0_0x5b131a[_0x2da52b(a0_0x44d3b9._0x955f08,0x548,a0_0x44d3b9._0x1cde0e,a0_0x44d3b9._0x3f0430,a0_0x44d3b9._0x18347f)+_0x1e7336(a0_0x44d3b9._0x5ede84,0x44f,a0_0x44d3b9._0x60c0a6,0x440,0x43f)]()[_0x2fba21(a0_0x44d3b9._0x169a49,0x1f9,a0_0x44d3b9._0x5c59cb,a0_0x44d3b9._0x361bf3,a0_0x44d3b9._0x374b39)+'h'](_0x2da52b(0x538,a0_0x44d3b9._0x49a540,a0_0x44d3b9._0x41e511,a0_0x44d3b9._0x4c6a6a,a0_0x44d3b9._0x2a84b9)+')+)+)'+'+$')[_0x1e7336(a0_0x44d3b9._0x450ad5,0x45b,a0_0x44d3b9._0x26f4b8,a0_0x44d3b9._0x3317d7,0x46a)+_0x1e7336(a0_0x44d3b9._0x546f1b,a0_0x44d3b9._0x45c349,a0_0x44d3b9._0xd8d416,a0_0x44d3b9._0x403283,a0_0x44d3b9._0x52f0c1)]()[_0x2fba21(a0_0x44d3b9._0x48ed34,0x202,a0_0x44d3b9._0x578536,a0_0x44d3b9._0x578536,a0_0x44d3b9._0xb02e91)+_0x2da52b(a0_0x44d3b9._0xb543e3,0x544,a0_0x44d3b9._0x399f0e,a0_0x44d3b9._0x5d58d3,a0_0x44d3b9._0x5b2063)+'r'](a0_0x5b131a)[_0x2fba21('1ENh',a0_0x44d3b9._0x4bba5c,a0_0x44d3b9._0xb02e91,a0_0x44d3b9._0x195117,0x1f1)+'h'](_0x2fba21('5x8D',a0_0x44d3b9._0x4ee083,a0_0x44d3b9._0x1b9c0f,a0_0x44d3b9._0x17988e,a0_0x44d3b9._0x4ba274)+_0x1e7336(a0_0x44d3b9._0x1c60ab,0x452,0x447,0x447,a0_0x44d3b9._0x5acb3e)+'+$');});a0_0x5b131a();import{A as a0_0x5ce457,B as a0_0x15b95b,C as a0_0x116e81,D as a0_0x5bb4f4,b as a0_0x96d121,c as a0_0x54063b,d as a0_0x8985ad,e as a0_0x459ac8,f as a0_0x53c296,g as a0_0x4d4059,h as a0_0x340a90,i as a0_0x40cd50,j as a0_0x27f12e,k as a0_0x20ab92,l as a0_0x5152a1,m as a0_0x1e0ab6,n as a0_0x2b5caf,o as a0_0x735ec2,p as a0_0x55c1ee,q as a0_0x136946,r as a0_0x27c41f,s as a0_0x401ed0,t as a0_0x1782ee,u as a0_0x5322c7,v as a0_0x507f1d,w as a0_0x5cabb2,x as a0_0x43520b,y as a0_0x38afba,z as a0_0x43443f}from'../chunk-6OSSL2F7.js';import{a as a0_0x38270d,b as a0_0x1c7576,c as a0_0x291c25,d as a0_0xa90a0b,e as a0_0x7ec732}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';function a0_0x1ee0(){var _0x5260bf=['A8kUWPBdRmo/CwTDybbqEW','W5S5WOJcJmoE','W6eVW5RcOeBcJJOMqmopWQ8fka','F8oNEKFdJG','xf7cMGPWf8oeWQ1PW51sWORdSq','BYHwWPWo','ymoVW5D4qYFdImo3omoefg/dJq','rSouqCknxXpcVa','WRJcGSoIW5pdPq','WOv7WOq','BSoNWQRdMbq','W7hdMSk6WPhcTW','WPH8W5JdJ8kjgCoRb1ldTCkiWOfo','W6ZdSWTDDmolW6pcNG','W5nkgbj6','BSkGWPtdRSo9CX1gEbvay0S','wmoElXpcLCkEW73dLLVdHLLSW5e','W5GKW5e7W73cS8opWP7dQ14DWQe','pCkRW6y1WO7dJY/dMLPcW4JcNmob','WPzaW5fvkZe6xq','dH0LuCoODfGEiCoN','D8kMmSoNeG','fCo0wLGhg8knWORdVbi','W48+uNaho8oKW7X1ymk3uW','wuddVdW+','w8ozkHxdOConWQBdT2NdJq','fKdcUcCb','W4yjiG','W4O2vxudp8k7W4P+ySk5Bmok'];a0_0x1ee0=function(){return _0x5260bf;};return a0_0x1ee0();}import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x38270d as AssetCache,a0_0x291c25 as AssetLoader,a0_0x5322c7 as AssetSystem,a0_0xa90a0b as AssetTextures,a0_0x401ed0 as Assets,a0_0x735ec2 as BaseSystem,a0_0x2b5caf as GameEngine,a0_0x459ac8 as GameObject,a0_0x53c296 as GameObjectManager,a0_0x1e0ab6 as ObjectFactory,a0_0x8985ad as Renderer,a0_0x55c1ee as RuntimeObjectRegistry,a0_0x54063b as Transform,a0_0x15b95b as applyScreenAnchor,a0_0x136946 as basePixi,a0_0x5cabb2 as clearResponsiveElements,a0_0x96d121 as createPixiBase,a0_0x27f12e as getRegisteredFontIds,a0_0x507f1d as globalResponsiveMultipliers,a0_0x7ec732 as initAssetTextures,a0_0x1782ee as initAssets,a0_0x116e81 as layout,a0_0x5152a1 as playLottieOverlay,a0_0x40cd50 as registerFont,a0_0x1c7576 as registerType,a0_0x38afba as resolveAnchorVec2,a0_0x4d4059 as resolveFont,a0_0x340a90 as resolveFontWeight,a0_0x43443f as resolveScreenAnchorPoint,a0_0x5ce457 as resolveScreenRatioPoint,a0_0x5bb4f4 as runInitSequence,a0_0x20ab92 as setLottieInstance,a0_0x27c41f as spawnSceneFromConfig,a0_0x43520b as updateScreenState};