handler-playable-sdk 0.3.20 → 0.3.21
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
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
`,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 r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 r0={};nn(r0,{ConfigWatcher:()=>Ft,DebugPanel:()=>tr,DefaultReloadStrategy:()=>hn,Handler:()=>Re,PreviewShell:()=>ts,applyConfigOverride:()=>mt,applyConfigOverrides:()=>bt,applyConfigsToDisk:()=>kr,applyDefaults:()=>Bt,baseLottie:()=>ys,bootstrap:()=>Yw,clearConfigOverrides:()=>un,clearConfigOverridesForObject:()=>wd,configOverrideManager:()=>_d,createPreviewShell:()=>pc,deepClone:()=>ne,default:()=>jt,defaultPreset:()=>Dr,deviceGroups:()=>Gs,devicePresets:()=>qs,diffConfigs:()=>Ns,exportConfigsAsJSON:()=>Ms,getConfigOverrides:()=>de,getConfigStateSummary:()=>Tr,getOverrideMode:()=>dn,getPresetById:()=>Ht,getPresetsByCategory:()=>Wm,loadAllObjectConfigs:()=>Mr,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Rr,loadGamePromptConfig:()=>js,loadObjectCentricConfig:()=>Qe,loadObjectConfig:()=>yt,loadSceneConfig:()=>Pr,rehydrateObject:()=>Bs,removeConfigOverride:()=>Cr,resetToApplied:()=>pn,resetToOriginal:()=>Lr,setBootstrapDependencies:()=>Gw,setOverrideMode:()=>Is,setupHotReload:()=>$s,setupLiveEditBridge:()=>is,toLegacyFormat:()=>Ds,validateObjectConfig:()=>fi});module.exports=Qg(r0);var ft={};function pr(e,t,i=!1){ft[e]||(ft[e]=[]),ft[e].push({fn:t,once:i})}function hs(e,t){if(ft[e]){if(!t){delete ft[e];return}ft[e]=ft[e].filter(i=>i.fn!==t)}}function fr(e,...t){let i=ft[e];if(i)for(let n of[...i])n.fn(...t),n.once&&hs(e,n.fn)}function be(e,t){pr(e,t,!0)}var ee=null,Ce=[],ci=null;function Ic(e){ee=e,Ce=[],ci!==null&&(clearTimeout(ci),ci=null)}function Mc(){var e,t,i;return{endpoint:(ee==null?void 0:ee.endpoint)||"",transport:(ee==null?void 0:ee.transport)||"beacon",batchSize:(e=ee==null?void 0:ee.batchSize)!=null?e:10,flushIntervalMs:(t=ee==null?void 0:ee.flushIntervalMs)!=null?t:300,maxQueue:(i=ee==null?void 0:ee.maxQueue)!=null?i:200,debug:!!(ee!=null&&ee.debug)}}async function Lc(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function gs(e,t){let i=Mc();if(t&&i.endpoint){if(Ce.push(e),Ce.length>i.maxQueue&&(Ce=Ce.slice(Ce.length-i.maxQueue)),Ce.length>=i.batchSize){Oc();return}ci===null&&(ci=window.setTimeout(()=>{ci=null,Oc()},i.flushIntervalMs))}}async function Oc(){let e=Mc();if(!e.endpoint||Ce.length===0)return;let t=Ce.splice(0,e.batchSize);await Lc(e.endpoint,{events:t},e.transport,e.debug),Ce.length>0&&await Lc(e.endpoint,{events:Ce.splice(0,e.batchSize)},e.transport,e.debug)}function Rc(e){return Math.max(0,Math.min(1,e))}function em(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function rn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function tm(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function Pc(e,t,i){try{e[t]=i}catch{}}function im(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function jc(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Dc(e,t){let i=im(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function zc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=d=>{var p;e.add(d);let u=(p=t.get(d.target))!=null?p:new Set;u.add(d),t.set(d.target,u),n()},a=d=>{e.delete(d);let u=t.get(d.target);u&&(u.delete(d),u.size===0&&t.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var u,p;let d=rn();for(let f of Array.from(e)){if(f.killed||f.paused)continue;let m=d-f.startMs-f.delayMs;if(m<0)continue;let h=f.durationMs>0?m/f.durationMs:1,g=Rc(h),b=f.repeat>=0?f.repeat+1:1,y=f.repeat>0?Math.min(Math.floor(h),b-1):0;if(f.repeat>0&&h>=1){let w=h-y;g=Rc(w)}let v=f.ease(g);f.yoyo&&y%2===1&&(v=1-v);for(let w of f.props)Pc(f.target,w.key,w.from+(w.to-w.from)*v);f.scaleFrom&&f.scaleTo&&jc(f.target,{x:f.scaleFrom.x+(f.scaleTo.x-f.scaleFrom.x)*v,y:f.scaleFrom.y+(f.scaleTo.y-f.scaleFrom.y)*v});try{(u=f.onUpdate)==null||u.call(f)}catch{}if(h>=b){s(f);try{(p=f.onComplete)==null||p.call(f)}catch{}}}},l=(d,u,p)=>{var w;let f=Math.max(0,(typeof u.duration=="number"?u.duration:.5)*1e3),m=Math.max(0,(typeof u.delay=="number"?u.delay:0)*1e3+((w=p==null?void 0:p.delayMsOverride)!=null?w:0)),h=em(u.ease),g=typeof u.repeat=="number"?Math.max(0,u.repeat|0):0,b=u.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let S of Object.keys(u)){if(y.has(S))continue;let A=u[S];typeof A=="number"&&v.push({key:S,from:tm(d,S),to:A})}let x=Dc(d,u);return{target:d,startMs:rn(),delayMs:m,durationMs:f,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:g,yoyo:b,onUpdate:typeof u.onUpdate=="function"?u.onUpdate:void 0,onComplete:typeof u.onComplete=="function"?u.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,u){let p=l(d,u);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=rn())},resume:()=>{var h;if(!p.paused)return;let f=(h=p.pauseAtMs)!=null?h:rn(),m=rn()-f;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(d,u,p){return c.set(d,u),c.to(d,p)},set(d,u){if(!d||!u)return;for(let f of Object.keys(u)){let m=u[f];f==="scale"||f==="scaleX"||f==="scaleY"||typeof m=="number"&&Pc(d,f,m)}let p=Dc(d,u);p.to&&jc(d,p.to)},killTweensOf(d){let u=t.get(d);if(u)for(let p of Array.from(u))s(p)},timeline(d={}){let u=[],p=0,f=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},g=y=>{u.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);p=Math.max(p,y.atMs+v)},b={to(y,v,x){return g({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return g({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(f)return b;f=!0,m=[];for(let x of u)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.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 m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],f=!1}};return d.paused||b.play(),b}};return c}function Nc(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=zc()}catch{}}var Bc={name:"handler-playable-sdk",version:"0.3.20",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var ye=0,rm=ye++,Fc=ye++,Hc=ye++,$c=ye++,Uc=ye++,qc=ye++,Gc=ye++,Wc=ye++,Yc=ye++,Vc=ye++,Kc=ye++,Xc=ye++,K=rm;function Zc(){return K===Fc}function Jc(){return K===Hc}function Qc(){return K===$c}function ed(){return K===Uc}function di(){return K===qc}function ui(){return K===Gc}function td(){return K===Wc}function id(){return K===Yc}function nd(){return K===Vc}function ms(){return K===Kc}function bs(){return K===Xc}function rd(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),K=Fc;return}catch{}else if(e==="dapi")try{dapi.isReady(),K=Hc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(K=$c)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(K=Uc)}catch{}else if(t==="mintegral")window.gameReady&&(K=qc);else if(t==="tapjoy")window.TJ_API&&(K=Gc);else if(t==="tiktok")window.openAppStore&&(K=Wc);else if(t==="smadex")try{window.smxTracking&&(K=Yc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(K=Vc)}catch{}else t==="vungle"?K=Kc:(e==="nucleo"||t==="nucleo")&&(K=Xc)}var hr=li(require("lottie-web"),1),ys=hr.default;typeof window!="undefined"&&(window.lottie=hr.default,window.__baseLottie=hr.default);var am=require("pixi.js");var vs=require("pixi.js");var sm=null;function xs(e){sm=e}gr();ws();var an=require("pixi.js");gr();var pm=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",As=pm;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(As=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${As}`))}}catch{}var gt=class{static async create(t,i,n){var l,c,d,u,p,f,m;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${As}`);let r=(l=i==null?void 0:i.render)==null?void 0:l.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new an.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(c=i==null?void 0:i.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await zt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new an.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof an.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],g=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=o==null?void 0:o.constructor)==null?void 0:m.name),g=!0;break}}catch{continue}g||(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,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var sn=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var gm=li(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=gm);pi();var mr=require("pixi.js");pi();var ks=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new sn}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let l=await gt.create(a,s,this.app);this.instanceCache.set(a,l),console.log("[Assets] Loaded object:",a,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",a,l)}})))};return this.readyPromise=(async()=>{await n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await gt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},mm=new ks,bm=new Proxy(mm,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});pi();var dd=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},yr={scale:1,position:1},Os=[];function vm(e,t,i,n,r,a,s){Os.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function xm(){Os.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function Ls(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),yr.scale=Xe.scaleFactor,yr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${yr.scale.toFixed(3)}`),xm()}var ln={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 wm(e,t,i){let n=ln[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function _m(){return ln}var Em={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 br(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function vr(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:br(e[0],t.x),y:br(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:br(n.x,t.x),y:br(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=Em[n])!=null?i:t}return t}function ud(e,t,i,n={}){var f,m,h,g,b,y;let r=vr(i),a=(f=n.inset)!=null?f:{},s=(m=n.padding)!=null?m:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,l=((g=a.right)!=null?g:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,u=Math.max(0,e-o-l),p=Math.max(0,t-c-d);return{x:o+u*r.x,y:c+p*r.y}}function pd(e,t,i,n={}){var h,g,b,y,v,x;let r=(h=n.inset)!=null?h:{},a=(g=n.padding)!=null?g:{x:0,y:0},s=((b=r.left)!=null?b:0)+a.x,o=((y=r.right)!=null?y:0)+a.x,l=((v=r.top)!=null?v:0)+a.y,c=((x=r.bottom)!=null?x:0)+a.y,d=Math.max(0,e-s-o),u=Math.max(0,t-l-c),p=vr(i,{x:.5,y:.5}),f=Math.min(Math.max(p.x,0),1),m=Math.min(Math.max(p.y,0),1);return{x:s+d*f,y:l+u*m}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,Ls(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Ls(window.innerWidth,window.innerHeight),window.updateDebugConfig=wm,window.getDebugConfig=_m,window.copyConfig=Pm,window.applyConfig=on,window.applyConfigForRatio=jm,window.positionAtBottom=fd,window.positionAtTop=Cm,window.positionAtCenter=Tm,window.positionAtLeft=km,window.positionAtRight=Lm,window.positionAtBottomLeft=Om,window.positionAtBottomRight=Im,window.positionAtTopLeft=Mm,window.positionAtTopRight=Rm,window.applyPositionContract=Am,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 xr(e,t,i=0){return e*t+i}function wr(e,t,i=0){return e*(1-t)+i}function _r(e,t,i=0){return e*t+i}function Er(e,t,i=0){return e*(1-t)+i}function ve(e,t=0){return e/2+t}function Sm(e,t){return e*t}function Am(e,t,i,n){var s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,S,A,_,T;let r=0,a=0;switch(n.type){case"top":r=ve(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=xr(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ve(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=wr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=_r(t,n.percent,(h=(m=n.offset)==null?void 0:m.x)!=null?h:0),a=ve(i,(b=(g=n.offset)==null?void 0:g.y)!=null?b:0);break;case"right":r=Er(t,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),a=ve(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ve(t,(A=(S=n.offset)==null?void 0:S.x)!=null?A:0),a=ve(i,(T=(_=n.offset)==null?void 0:_.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function fd(e,t,i,n=.2,r=1,a=!0,s=!1){let o=Sm(i,n),l=wr(i,n/2);Ze(e,ve(t),l);let c=a?r*Xe.scaleFactor:r;Je(e,c),s&&!Os.find(d=>d.element===e)&&vm(e,fd,t,i,n,r,a)}function Cm(e,t,i,n=.1,r=1){Ze(e,ve(t),xr(i,n)),Je(e,r)}function Tm(e,t,i,n=0,r=0,a=1){Ze(e,ve(t,n),ve(i,r)),Je(e,a)}function km(e,t,i,n=.1,r=1){Ze(e,_r(t,n),ve(i)),Je(e,r)}function Lm(e,t,i,n=.1,r=1){Ze(e,Er(t,n),ve(i)),Je(e,r)}function Om(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),wr(i,n)),Je(e,a)}function Im(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),wr(i,n)),Je(e,a)}function Mm(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),xr(i,n)),Je(e,a)}function Rm(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),xr(i,n)),Je(e,a)}function Ze(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Je(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Nt={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 Pm(e){return e&&Nt[e]?JSON.parse(JSON.stringify(Nt[e])):JSON.parse(JSON.stringify(ln))}function on(e){Object.keys(e).forEach(t=>{let i=t;ln[i]&&e[i]&&Object.assign(ln[i],e[i])}),console.log("Config applied:",e)}function jm(e,t){let i=e/t;i>1.6?(on(Nt.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(on(Nt.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(on(Nt.square),console.log("Applied SQUARE config for ratio:",i)):(on(Nt.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Nt,e.resolveAnchorVec2=e.resolveAnchorVec2||vr,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||ud,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||pd}jr();function te(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var M_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:te(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:te(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:te(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:te(360,780)}],R_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:te(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:te(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:te(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:te(412,915)}],P_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:te(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:te(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:te(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:te(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:te(800,1280)}],Us=[{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:te(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:te(768,1024),mraidScale:.7}];var qs=[...Us],Gs=[{category:"playable",label:"Playable Ad",devices:Us}],Dr=Us[0];function Ht(e){return qs.find(t=>t.id===e)||Dr}function Wm(e){return qs.filter(t=>t.category===e)}var zr=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
|
+
`,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 r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 r0={};nn(r0,{ConfigWatcher:()=>Ft,DebugPanel:()=>tr,DefaultReloadStrategy:()=>hn,Handler:()=>Re,PreviewShell:()=>ts,applyConfigOverride:()=>mt,applyConfigOverrides:()=>bt,applyConfigsToDisk:()=>kr,applyDefaults:()=>Bt,baseLottie:()=>ys,bootstrap:()=>Yw,clearConfigOverrides:()=>un,clearConfigOverridesForObject:()=>wd,configOverrideManager:()=>_d,createPreviewShell:()=>pc,deepClone:()=>ne,default:()=>jt,defaultPreset:()=>Dr,deviceGroups:()=>Gs,devicePresets:()=>qs,diffConfigs:()=>Ns,exportConfigsAsJSON:()=>Ms,getConfigOverrides:()=>de,getConfigStateSummary:()=>Tr,getOverrideMode:()=>dn,getPresetById:()=>Ht,getPresetsByCategory:()=>Wm,loadAllObjectConfigs:()=>Mr,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Rr,loadGamePromptConfig:()=>js,loadObjectCentricConfig:()=>Qe,loadObjectConfig:()=>yt,loadSceneConfig:()=>Pr,rehydrateObject:()=>Bs,removeConfigOverride:()=>Cr,resetToApplied:()=>pn,resetToOriginal:()=>Lr,setBootstrapDependencies:()=>Gw,setOverrideMode:()=>Is,setupHotReload:()=>$s,setupLiveEditBridge:()=>is,toLegacyFormat:()=>Ds,validateObjectConfig:()=>fi});module.exports=Qg(r0);var ft={};function pr(e,t,i=!1){ft[e]||(ft[e]=[]),ft[e].push({fn:t,once:i})}function hs(e,t){if(ft[e]){if(!t){delete ft[e];return}ft[e]=ft[e].filter(i=>i.fn!==t)}}function fr(e,...t){let i=ft[e];if(i)for(let n of[...i])n.fn(...t),n.once&&hs(e,n.fn)}function be(e,t){pr(e,t,!0)}var ee=null,Ce=[],ci=null;function Ic(e){ee=e,Ce=[],ci!==null&&(clearTimeout(ci),ci=null)}function Mc(){var e,t,i;return{endpoint:(ee==null?void 0:ee.endpoint)||"",transport:(ee==null?void 0:ee.transport)||"beacon",batchSize:(e=ee==null?void 0:ee.batchSize)!=null?e:10,flushIntervalMs:(t=ee==null?void 0:ee.flushIntervalMs)!=null?t:300,maxQueue:(i=ee==null?void 0:ee.maxQueue)!=null?i:200,debug:!!(ee!=null&&ee.debug)}}async function Lc(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function gs(e,t){let i=Mc();if(t&&i.endpoint){if(Ce.push(e),Ce.length>i.maxQueue&&(Ce=Ce.slice(Ce.length-i.maxQueue)),Ce.length>=i.batchSize){Oc();return}ci===null&&(ci=window.setTimeout(()=>{ci=null,Oc()},i.flushIntervalMs))}}async function Oc(){let e=Mc();if(!e.endpoint||Ce.length===0)return;let t=Ce.splice(0,e.batchSize);await Lc(e.endpoint,{events:t},e.transport,e.debug),Ce.length>0&&await Lc(e.endpoint,{events:Ce.splice(0,e.batchSize)},e.transport,e.debug)}function Rc(e){return Math.max(0,Math.min(1,e))}function em(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function rn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function tm(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function Pc(e,t,i){try{e[t]=i}catch{}}function im(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function jc(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Dc(e,t){let i=im(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function zc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=d=>{var p;e.add(d);let u=(p=t.get(d.target))!=null?p:new Set;u.add(d),t.set(d.target,u),n()},a=d=>{e.delete(d);let u=t.get(d.target);u&&(u.delete(d),u.size===0&&t.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var u,p;let d=rn();for(let f of Array.from(e)){if(f.killed||f.paused)continue;let m=d-f.startMs-f.delayMs;if(m<0)continue;let h=f.durationMs>0?m/f.durationMs:1,g=Rc(h),b=f.repeat>=0?f.repeat+1:1,y=f.repeat>0?Math.min(Math.floor(h),b-1):0;if(f.repeat>0&&h>=1){let w=h-y;g=Rc(w)}let v=f.ease(g);f.yoyo&&y%2===1&&(v=1-v);for(let w of f.props)Pc(f.target,w.key,w.from+(w.to-w.from)*v);f.scaleFrom&&f.scaleTo&&jc(f.target,{x:f.scaleFrom.x+(f.scaleTo.x-f.scaleFrom.x)*v,y:f.scaleFrom.y+(f.scaleTo.y-f.scaleFrom.y)*v});try{(u=f.onUpdate)==null||u.call(f)}catch{}if(h>=b){s(f);try{(p=f.onComplete)==null||p.call(f)}catch{}}}},l=(d,u,p)=>{var w;let f=Math.max(0,(typeof u.duration=="number"?u.duration:.5)*1e3),m=Math.max(0,(typeof u.delay=="number"?u.delay:0)*1e3+((w=p==null?void 0:p.delayMsOverride)!=null?w:0)),h=em(u.ease),g=typeof u.repeat=="number"?Math.max(0,u.repeat|0):0,b=u.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let S of Object.keys(u)){if(y.has(S))continue;let A=u[S];typeof A=="number"&&v.push({key:S,from:tm(d,S),to:A})}let x=Dc(d,u);return{target:d,startMs:rn(),delayMs:m,durationMs:f,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:g,yoyo:b,onUpdate:typeof u.onUpdate=="function"?u.onUpdate:void 0,onComplete:typeof u.onComplete=="function"?u.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,u){let p=l(d,u);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=rn())},resume:()=>{var h;if(!p.paused)return;let f=(h=p.pauseAtMs)!=null?h:rn(),m=rn()-f;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(d,u,p){return c.set(d,u),c.to(d,p)},set(d,u){if(!d||!u)return;for(let f of Object.keys(u)){let m=u[f];f==="scale"||f==="scaleX"||f==="scaleY"||typeof m=="number"&&Pc(d,f,m)}let p=Dc(d,u);p.to&&jc(d,p.to)},killTweensOf(d){let u=t.get(d);if(u)for(let p of Array.from(u))s(p)},timeline(d={}){let u=[],p=0,f=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},g=y=>{u.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);p=Math.max(p,y.atMs+v)},b={to(y,v,x){return g({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return g({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(f)return b;f=!0,m=[];for(let x of u)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.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 m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],f=!1}};return d.paused||b.play(),b}};return c}function Nc(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=zc()}catch{}}var Bc={name:"handler-playable-sdk",version:"0.3.21",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var ye=0,rm=ye++,Fc=ye++,Hc=ye++,$c=ye++,Uc=ye++,qc=ye++,Gc=ye++,Wc=ye++,Yc=ye++,Vc=ye++,Kc=ye++,Xc=ye++,K=rm;function Zc(){return K===Fc}function Jc(){return K===Hc}function Qc(){return K===$c}function ed(){return K===Uc}function di(){return K===qc}function ui(){return K===Gc}function td(){return K===Wc}function id(){return K===Yc}function nd(){return K===Vc}function ms(){return K===Kc}function bs(){return K===Xc}function rd(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),K=Fc;return}catch{}else if(e==="dapi")try{dapi.isReady(),K=Hc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(K=$c)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(K=Uc)}catch{}else if(t==="mintegral")window.gameReady&&(K=qc);else if(t==="tapjoy")window.TJ_API&&(K=Gc);else if(t==="tiktok")window.openAppStore&&(K=Wc);else if(t==="smadex")try{window.smxTracking&&(K=Yc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(K=Vc)}catch{}else t==="vungle"?K=Kc:(e==="nucleo"||t==="nucleo")&&(K=Xc)}var hr=li(require("lottie-web"),1),ys=hr.default;typeof window!="undefined"&&(window.lottie=hr.default,window.__baseLottie=hr.default);var am=require("pixi.js");var vs=require("pixi.js");var sm=null;function xs(e){sm=e}gr();ws();var an=require("pixi.js");gr();var pm=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",As=pm;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(As=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${As}`))}}catch{}var gt=class{static async create(t,i,n){var l,c,d,u,p,f,m;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${As}`);let r=(l=i==null?void 0:i.render)==null?void 0:l.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new an.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(c=i==null?void 0:i.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await zt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new an.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof an.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],g=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=o==null?void 0:o.constructor)==null?void 0:m.name),g=!0;break}}catch{continue}g||(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,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var sn=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var gm=li(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=gm);pi();var mr=require("pixi.js");pi();var ks=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new sn}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let l=await gt.create(a,s,this.app);this.instanceCache.set(a,l),console.log("[Assets] Loaded object:",a,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",a,l)}})))};return this.readyPromise=(async()=>{await n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await gt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},mm=new ks,bm=new Proxy(mm,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});pi();var dd=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},yr={scale:1,position:1},Os=[];function vm(e,t,i,n,r,a,s){Os.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function xm(){Os.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function Ls(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),yr.scale=Xe.scaleFactor,yr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${yr.scale.toFixed(3)}`),xm()}var ln={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 wm(e,t,i){let n=ln[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function _m(){return ln}var Em={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 br(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function vr(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:br(e[0],t.x),y:br(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:br(n.x,t.x),y:br(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=Em[n])!=null?i:t}return t}function ud(e,t,i,n={}){var f,m,h,g,b,y;let r=vr(i),a=(f=n.inset)!=null?f:{},s=(m=n.padding)!=null?m:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,l=((g=a.right)!=null?g:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,u=Math.max(0,e-o-l),p=Math.max(0,t-c-d);return{x:o+u*r.x,y:c+p*r.y}}function pd(e,t,i,n={}){var h,g,b,y,v,x;let r=(h=n.inset)!=null?h:{},a=(g=n.padding)!=null?g:{x:0,y:0},s=((b=r.left)!=null?b:0)+a.x,o=((y=r.right)!=null?y:0)+a.x,l=((v=r.top)!=null?v:0)+a.y,c=((x=r.bottom)!=null?x:0)+a.y,d=Math.max(0,e-s-o),u=Math.max(0,t-l-c),p=vr(i,{x:.5,y:.5}),f=Math.min(Math.max(p.x,0),1),m=Math.min(Math.max(p.y,0),1);return{x:s+d*f,y:l+u*m}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,Ls(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Ls(window.innerWidth,window.innerHeight),window.updateDebugConfig=wm,window.getDebugConfig=_m,window.copyConfig=Pm,window.applyConfig=on,window.applyConfigForRatio=jm,window.positionAtBottom=fd,window.positionAtTop=Cm,window.positionAtCenter=Tm,window.positionAtLeft=km,window.positionAtRight=Lm,window.positionAtBottomLeft=Om,window.positionAtBottomRight=Im,window.positionAtTopLeft=Mm,window.positionAtTopRight=Rm,window.applyPositionContract=Am,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 xr(e,t,i=0){return e*t+i}function wr(e,t,i=0){return e*(1-t)+i}function _r(e,t,i=0){return e*t+i}function Er(e,t,i=0){return e*(1-t)+i}function ve(e,t=0){return e/2+t}function Sm(e,t){return e*t}function Am(e,t,i,n){var s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,S,A,_,T;let r=0,a=0;switch(n.type){case"top":r=ve(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=xr(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ve(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=wr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=_r(t,n.percent,(h=(m=n.offset)==null?void 0:m.x)!=null?h:0),a=ve(i,(b=(g=n.offset)==null?void 0:g.y)!=null?b:0);break;case"right":r=Er(t,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),a=ve(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ve(t,(A=(S=n.offset)==null?void 0:S.x)!=null?A:0),a=ve(i,(T=(_=n.offset)==null?void 0:_.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function fd(e,t,i,n=.2,r=1,a=!0,s=!1){let o=Sm(i,n),l=wr(i,n/2);Ze(e,ve(t),l);let c=a?r*Xe.scaleFactor:r;Je(e,c),s&&!Os.find(d=>d.element===e)&&vm(e,fd,t,i,n,r,a)}function Cm(e,t,i,n=.1,r=1){Ze(e,ve(t),xr(i,n)),Je(e,r)}function Tm(e,t,i,n=0,r=0,a=1){Ze(e,ve(t,n),ve(i,r)),Je(e,a)}function km(e,t,i,n=.1,r=1){Ze(e,_r(t,n),ve(i)),Je(e,r)}function Lm(e,t,i,n=.1,r=1){Ze(e,Er(t,n),ve(i)),Je(e,r)}function Om(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),wr(i,n)),Je(e,a)}function Im(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),wr(i,n)),Je(e,a)}function Mm(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),xr(i,n)),Je(e,a)}function Rm(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),xr(i,n)),Je(e,a)}function Ze(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Je(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Nt={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 Pm(e){return e&&Nt[e]?JSON.parse(JSON.stringify(Nt[e])):JSON.parse(JSON.stringify(ln))}function on(e){Object.keys(e).forEach(t=>{let i=t;ln[i]&&e[i]&&Object.assign(ln[i],e[i])}),console.log("Config applied:",e)}function jm(e,t){let i=e/t;i>1.6?(on(Nt.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(on(Nt.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(on(Nt.square),console.log("Applied SQUARE config for ratio:",i)):(on(Nt.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Nt,e.resolveAnchorVec2=e.resolveAnchorVec2||vr,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||ud,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||pd}jr();function te(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var M_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:te(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:te(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:te(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:te(360,780)}],R_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:te(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:te(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:te(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:te(412,915)}],P_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:te(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:te(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:te(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:te(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:te(800,1280)}],Us=[{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:te(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:te(768,1024),mraidScale:.7}];var qs=[...Us],Gs=[{category:"playable",label:"Playable Ad",devices:Us}],Dr=Us[0];function Ht(e){return qs.find(t=>t.id===e)||Dr}function Wm(e){return qs.filter(t=>t.category===e)}var zr=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`
|
|
48
48
|
<div class="scene-panel scene-objects panel-accent-teal" data-panel="scene-objects" style="left:16px; top:72px;">
|
|
49
49
|
<div class="scene-panel-header" data-panel-handle>
|
|
50
50
|
<div class="panel-title">
|
|
@@ -511,7 +511,7 @@
|
|
|
511
511
|
${a.join("")}
|
|
512
512
|
</div>
|
|
513
513
|
</div>
|
|
514
|
-
`}attachEventListeners(){var c,d,u,p;if(!this.contentContainer)return;let t=this.contentContainer.querySelectorAll("[data-property-path]"),i=Ym((f,m,h)=>{var g,b;this.updateManager.updateProperty(f,m,h),(b=(g=this.options)==null?void 0:g.onPropertyChange)==null||b.call(g,f,m,h)},300);t.forEach(f=>{let m=h=>{var v,x;let g=h.target,b=g.dataset.propertyPath,y=g.dataset.objectId;if(b&&y){let w=g.value;if(g.type==="checkbox")w=g.checked;else if(g.type==="number"&&(w=parseFloat(g.value),isNaN(w)))return;g.type==="text"||g.type==="range"||g.tagName==="TEXTAREA"?i(y,b,w):(this.updateManager.updateProperty(y,b,w),(x=(v=this.options)==null?void 0:v.onPropertyChange)==null||x.call(v,y,b,w))}};f.dataset.logicIdSelector==="true"?(console.log("[Inspector] Found logic ID selector, attaching refresh handler"),f.addEventListener("change",async h=>{let g=h.target,b=g.dataset.propertyPath,y=g.dataset.objectId;console.log("[Inspector] Logic ID changed to:",g.value,"path:",b),b&&y&&(await this.updateManager.updateProperty(y,b,g.value),console.log("[Inspector] Property updated, refreshing in 500ms..."),setTimeout(()=>{console.log("[Inspector] Refreshing inspector now"),this.selectedObjectId&&this.loadObject(this.selectedObjectId)},500))})):(f.addEventListener("change",m),(f.tagName==="INPUT"||f.tagName==="TEXTAREA")&&f.addEventListener("input",m))}),this.contentContainer.querySelectorAll("[data-action]").forEach(f=>{f.addEventListener("click",m=>{let h=m.target,g=h.dataset.action,b=h.dataset.path,y=h.dataset.object;g&&b&&y&&this.quickActions.handleAction(g,y,b)})}),this.contentContainer.querySelectorAll("[data-section-toggle]").forEach(f=>{f.addEventListener("click",m=>{var b,y;let h=m.target,g=h.dataset.sectionToggle||((b=h.closest("[data-section-toggle]"))==null?void 0:b.getAttribute("data-section-toggle"));if(g){let v=(y=this.contentContainer)==null?void 0:y.querySelector(`[data-section="${g}"]`);v==null||v.classList.toggle("collapsed")}})});let a=(c=this.root)==null?void 0:c.querySelector("[data-inspector-advanced]");a==null||a.addEventListener("click",()=>{this.showAdvanced=!this.showAdvanced,this.selectedObjectId&&this.loadObject(this.selectedObjectId)});let s=(d=this.root)==null?void 0:d.querySelector("[data-convert-toggle]");s==null||s.addEventListener("click",()=>{var m;let f=(m=this.root)==null?void 0:m.querySelector("[data-convert-menu]");f==null||f.classList.toggle("hidden")});let o=(u=this.contentContainer)==null?void 0:u.querySelector("[data-inspector-add-component-btn]"),l=(p=this.contentContainer)==null?void 0:p.querySelector("[data-inspector-component-select]");o==null||o.addEventListener("click",async()=>{let f=l.value;f&&this.selectedObjectId&&await this.addComponent(this.selectedObjectId,f)})}async addComponent(t,i){console.log("[InspectorPanel] Adding component:",i,"to:",t);let n=window.getEditableObjectConfig,r=n==null?void 0:n(t);if(!r){console.error("[InspectorPanel] Failed to get config for:",t);return}let a=window.__editableConfig,s=a==null?void 0:a.schemas,o=null;s instanceof Map?o=s.get(i):s&&typeof s=="object"&&(o=s[i]),o||console.warn("[InspectorPanel] Schema not found for component:",i);let l=(o==null?void 0:o.defaults)||{enabled:!0};r[i]={...l},await this.updateManager.updateProperty(t,i,r[i]),this.loadObject(t),console.log("[InspectorPanel] Component added successfully")}isSectionMeaningful(t,i,n){var a,s;if(["identity","transform","render"].includes(t))return!0;if(!i||typeof i!="object"||t==="ui"&&((s=(a=n.render)==null?void 0:a.asset)==null?void 0:s.type)==="image")return!1;if(t==="interaction")return i.clickable===!0||i.draggable===!0;if(i.enabled===!0||i.active===!0||i.visible===!0)return!0;if(t==="ui")return!!(i.text||i.font||i.fontSize);let r=Object.keys(i);return r.length===0||r.length===1&&r[0]==="enabled"&&i.enabled===!1?!1:["audio","effects","physics","motion","gameplay"].includes(t)?i.enabled===!0:!0}showError(t){this.contentContainer&&(this.contentContainer.innerHTML=`
|
|
514
|
+
`}attachEventListeners(){var c,d,u,p;if(!this.contentContainer)return;let t=this.contentContainer.querySelectorAll("[data-property-path]"),i=Ym((f,m,h)=>{var g,b;this.updateManager.updateProperty(f,m,h),(b=(g=this.options)==null?void 0:g.onPropertyChange)==null||b.call(g,f,m,h)},300);t.forEach(f=>{let m=h=>{var v,x;let g=h.target,b=g.dataset.propertyPath,y=g.dataset.objectId;if(b&&y){let w=g.value;if(g.type==="checkbox")w=g.checked;else if(g.type==="number"&&(w=parseFloat(g.value),isNaN(w)))return;g.type==="text"||g.type==="range"||g.tagName==="TEXTAREA"?i(y,b,w):(this.updateManager.updateProperty(y,b,w),(x=(v=this.options)==null?void 0:v.onPropertyChange)==null||x.call(v,y,b,w))}};console.log("[Inspector] Checking input:",f.tagName,"path:",f.dataset.propertyPath,"logicIdSelector:",f.dataset.logicIdSelector),f.dataset.logicIdSelector==="true"?(console.log("[Inspector] Found logic ID selector, attaching refresh handler"),f.addEventListener("change",async h=>{let g=h.target,b=g.dataset.propertyPath,y=g.dataset.objectId;console.log("[Inspector] Logic ID changed to:",g.value,"path:",b),b&&y&&(await this.updateManager.updateProperty(y,b,g.value),console.log("[Inspector] Property updated, refreshing in 500ms..."),setTimeout(()=>{console.log("[Inspector] Refreshing inspector now"),this.selectedObjectId&&this.loadObject(this.selectedObjectId)},500))})):(f.addEventListener("change",m),(f.tagName==="INPUT"||f.tagName==="TEXTAREA")&&f.addEventListener("input",m))}),this.contentContainer.querySelectorAll("[data-action]").forEach(f=>{f.addEventListener("click",m=>{let h=m.target,g=h.dataset.action,b=h.dataset.path,y=h.dataset.object;g&&b&&y&&this.quickActions.handleAction(g,y,b)})}),this.contentContainer.querySelectorAll("[data-section-toggle]").forEach(f=>{f.addEventListener("click",m=>{var b,y;let h=m.target,g=h.dataset.sectionToggle||((b=h.closest("[data-section-toggle]"))==null?void 0:b.getAttribute("data-section-toggle"));if(g){let v=(y=this.contentContainer)==null?void 0:y.querySelector(`[data-section="${g}"]`);v==null||v.classList.toggle("collapsed")}})});let a=(c=this.root)==null?void 0:c.querySelector("[data-inspector-advanced]");a==null||a.addEventListener("click",()=>{this.showAdvanced=!this.showAdvanced,this.selectedObjectId&&this.loadObject(this.selectedObjectId)});let s=(d=this.root)==null?void 0:d.querySelector("[data-convert-toggle]");s==null||s.addEventListener("click",()=>{var m;let f=(m=this.root)==null?void 0:m.querySelector("[data-convert-menu]");f==null||f.classList.toggle("hidden")});let o=(u=this.contentContainer)==null?void 0:u.querySelector("[data-inspector-add-component-btn]"),l=(p=this.contentContainer)==null?void 0:p.querySelector("[data-inspector-component-select]");o==null||o.addEventListener("click",async()=>{let f=l.value;f&&this.selectedObjectId&&await this.addComponent(this.selectedObjectId,f)})}async addComponent(t,i){console.log("[InspectorPanel] Adding component:",i,"to:",t);let n=window.getEditableObjectConfig,r=n==null?void 0:n(t);if(!r){console.error("[InspectorPanel] Failed to get config for:",t);return}let a=window.__editableConfig,s=a==null?void 0:a.schemas,o=null;s instanceof Map?o=s.get(i):s&&typeof s=="object"&&(o=s[i]),o||console.warn("[InspectorPanel] Schema not found for component:",i);let l=(o==null?void 0:o.defaults)||{enabled:!0};r[i]={...l},await this.updateManager.updateProperty(t,i,r[i]),this.loadObject(t),console.log("[InspectorPanel] Component added successfully")}isSectionMeaningful(t,i,n){var a,s;if(["identity","transform","render"].includes(t))return!0;if(!i||typeof i!="object"||t==="ui"&&((s=(a=n.render)==null?void 0:a.asset)==null?void 0:s.type)==="image")return!1;if(t==="interaction")return i.clickable===!0||i.draggable===!0;if(i.enabled===!0||i.active===!0||i.visible===!0)return!0;if(t==="ui")return!!(i.text||i.font||i.fontSize);let r=Object.keys(i);return r.length===0||r.length===1&&r[0]==="enabled"&&i.enabled===!1?!1:["audio","effects","physics","motion","gameplay"].includes(t)?i.enabled===!0:!0}showError(t){this.contentContainer&&(this.contentContainer.innerHTML=`
|
|
515
515
|
<div class="inspector-empty">
|
|
516
516
|
<span class="inspector-empty-icon">\u26A0\uFE0F</span>
|
|
517
517
|
<span class="inspector-empty-text">${t}</span>
|
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,a}from"./chunk-
|
|
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,a}from"./chunk-5UGLDQKG.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-Q7FPWOA3.js";export{B as ConfigWatcher,K as DebugPanel,A as DefaultReloadStrategy,Q as Handler,L as PreviewShell,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,R 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};
|
package/dist/pixi/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
`,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 l=o.target.dataset.tab;l&&this.switchTab(l)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 Fv={};rl(Fv,{AssetCache:()=>Be,AssetLoader:()=>xt,AssetSystem:()=>Qr,AssetTextures:()=>wt,Assets:()=>jf,BaseSystem:()=>Oi,GameEngine:()=>Jr,GameObject:()=>Dn,GameObjectManager:()=>ki,ObjectFactory:()=>_t,Renderer:()=>jn,RuntimeObjectRegistry:()=>Ii,Transform:()=>Pn,applyScreenAnchor:()=>ia,basePixi:()=>If,clearResponsiveElements:()=>zf,createPixiBase:()=>Xr,getRegisteredFontIds:()=>Tf,globalResponsiveMultipliers:()=>Nn,initAssetTextures:()=>Ur,initAssets:()=>Df,layout:()=>Bf,playLottieOverlay:()=>Lf,registerFont:()=>Cf,registerType:()=>Hr,resolveAnchorVec2:()=>Bn,resolveFont:()=>Sf,resolveFontWeight:()=>Af,resolveScreenAnchorPoint:()=>Mi,resolveScreenRatioPoint:()=>Ri,runInitSequence:()=>Ff,setLottieInstance:()=>qr,spawnSceneFromConfig:()=>Rf,updateScreenState:()=>ta});module.exports=Wf(Fv);var Ef=require("pixi.js");var st={};function Gn(e,t,i=!1){st[e]||(st[e]=[]),st[e].push({fn:t,once:i})}function ca(e,t){if(st[e]){if(!t){delete st[e];return}st[e]=st[e].filter(i=>i.fn!==t)}}function Wn(e,...t){let i=st[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ca(e,n.fn)}function ge(e,t){Gn(e,t,!0)}var X=null,Ee=[],qt=null;function ll(e){X=e,Ee=[],qt!==null&&(clearTimeout(qt),qt=null)}function cl(){var e,t,i;return{endpoint:(X==null?void 0:X.endpoint)||"",transport:(X==null?void 0:X.transport)||"beacon",batchSize:(e=X==null?void 0:X.batchSize)!=null?e:10,flushIntervalMs:(t=X==null?void 0:X.flushIntervalMs)!=null?t:300,maxQueue:(i=X==null?void 0:X.maxQueue)!=null?i:200,debug:!!(X!=null&&X.debug)}}async function sl(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function da(e,t){let i=cl();if(t&&i.endpoint){if(Ee.push(e),Ee.length>i.maxQueue&&(Ee=Ee.slice(Ee.length-i.maxQueue)),Ee.length>=i.batchSize){ol();return}qt===null&&(qt=window.setTimeout(()=>{qt=null,ol()},i.flushIntervalMs))}}async function ol(){let e=cl();if(!e.endpoint||Ee.length===0)return;let t=Ee.splice(0,e.batchSize);await sl(e.endpoint,{events:t},e.transport,e.debug),Ee.length>0&&await sl(e.endpoint,{events:Ee.splice(0,e.batchSize)},e.transport,e.debug)}function dl(e){return Math.max(0,Math.min(1,e))}function Yf(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function $i(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Vf(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function ul(e,t,i){try{e[t]=i}catch{}}function Kf(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function pl(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function fl(e,t){let i=Kf(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function hl(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=c=>{var u;e.add(c);let f=(u=t.get(c.target))!=null?u:new Set;f.add(c),t.set(c.target,f),n()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,u;let c=$i();for(let p of Array.from(e)){if(p.killed||p.paused)continue;let v=c-p.startMs-p.delayMs;if(v<0)continue;let m=p.durationMs>0?v/p.durationMs:1,w=dl(m),g=p.repeat>=0?p.repeat+1:1,h=p.repeat>0?Math.min(Math.floor(m),g-1):0;if(p.repeat>0&&m>=1){let b=m-h;w=dl(b)}let x=p.ease(w);p.yoyo&&h%2===1&&(x=1-x);for(let b of p.props)ul(p.target,b.key,b.from+(b.to-b.from)*x);p.scaleFrom&&p.scaleTo&&pl(p.target,{x:p.scaleFrom.x+(p.scaleTo.x-p.scaleFrom.x)*x,y:p.scaleFrom.y+(p.scaleTo.y-p.scaleFrom.y)*x});try{(f=p.onUpdate)==null||f.call(p)}catch{}if(m>=g){s(p);try{(u=p.onComplete)==null||u.call(p)}catch{}}}},d=(c,f,u)=>{var b;let p=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((b=u==null?void 0:u.delayMsOverride)!=null?b:0)),m=Yf(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,g=f.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let C of Object.keys(f)){if(h.has(C))continue;let S=f[C];typeof S=="number"&&x.push({key:C,from:Vf(c,C),to:S})}let y=fl(c,f);return{target:c,startMs:$i(),delayMs:v,durationMs:p,ease:m,props:x,scaleFrom:y.from,scaleTo:y.to,repeat:w,yoyo:g,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let u=d(c,f);return r(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=$i())},resume:()=>{var m;if(!u.paused)return;let p=(m=u.pauseAtMs)!=null?m:$i(),v=$i()-p;u.startMs+=v,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(c,f,u){return l.set(c,f),l.to(c,u)},set(c,f){if(!c||!f)return;for(let p of Object.keys(f)){let v=f[p];p==="scale"||p==="scaleX"||p==="scaleY"||typeof v=="number"&&ul(c,p,v)}let u=fl(c,f);u.to&&pl(c,u.to)},killTweensOf(c){let f=t.get(c);if(f)for(let u of Array.from(f))s(u)},timeline(c={}){let f=[],u=0,p=!1,v=[],m=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?u+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):u},w=h=>{f.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);u=Math.max(u,h.atMs+x)},g={to(h,x,y){return w({kind:"to",target:h,vars:x,atMs:m(y)}),g},fromTo(h,x,y,b){return w({kind:"fromTo",target:h,vars:y,from:x,atMs:m(b)}),g},play(){var h,x;if(p)return g;p=!0,v=[];for(let y of f)y.kind==="fromTo"&&l.set(y.target,(h=y.from)!=null?h:{}),v.push(l.to(y.target,{...y.vars,delay:y.atMs/1e3+((x=y.vars.delay)!=null?x:0)}));return g},pause(){for(let h of v)h.pause();return g},kill(){for(let h of v)h.kill();v=[],p=!1}};return c.paused||g.play(),g}};return l}function gl(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=hl()}catch{}}var ml={name:"handler-playable-sdk",version:"0.3.20",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var me=0,Zf=me++,bl=me++,yl=me++,vl=me++,xl=me++,wl=me++,_l=me++,El=me++,Sl=me++,Al=me++,Cl=me++,Tl=me++,q=Zf;function kl(){return q===bl}function Ll(){return q===yl}function Ol(){return q===vl}function Il(){return q===xl}function Gt(){return q===wl}function Wt(){return q===_l}function Ml(){return q===El}function Rl(){return q===Sl}function Pl(){return q===Al}function ua(){return q===Cl}function pa(){return q===Tl}function jl(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),q=bl;return}catch{}else if(e==="dapi")try{dapi.isReady(),q=yl;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(q=vl)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(q=xl)}catch{}else if(t==="mintegral")window.gameReady&&(q=wl);else if(t==="tapjoy")window.TJ_API&&(q=_l);else if(t==="tiktok")window.openAppStore&&(q=El);else if(t==="smadex")try{window.smxTracking&&(q=Sl)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(q=Al)}catch{}else t==="vungle"?q=Cl:(e==="nucleo"||t==="nucleo")&&(q=Tl)}var Yn=qn(require("lottie-web"),1),Dl=Yn.default;typeof window!="undefined"&&(window.lottie=Yn.default,window.__baseLottie=Yn.default);ga();function Z(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var vx=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:Z(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:Z(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:Z(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:Z(360,780)}],xx=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:Z(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:Z(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:Z(412,915)}],wx=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:Z(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:Z(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:Z(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:Z(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:Z(800,1280)}],Fl=[{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:Z(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:Z(768,1024),mraidScale:.7}];var _x=[...Fl];var ah=Fl[0];ot();var qy=qn(Jp(),1);function Hy(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function $y(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function Uy(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function ao(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await Hy(r),s=await Uy(a),o=$y(a);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:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Br(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,u)=>{let p=new Image;p.onload=()=>f(p),p.onerror=()=>u(new Error("Failed to load image")),p.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let u=s[f],p=s[f+1],v=s[f+2],m=!1;for(let w of d)if(Math.sqrt(Math.pow(u-w.r,2)+Math.pow(p-w.g,2)+Math.pow(v-w.b,2))<t){m=!0;break}m&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}var Qp=require("@google/genai");async function so(e,t,i=[],n={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let g=0;g<i.length;g++){let h=i[g];if(!h.base64||!h.mimeType)throw new Error(`Image ${g+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${g+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${g+1} has invalid MIME type: ${h.mimeType}`)}let f=new Qp.GoogleGenAI({apiKey:e}),u="gemini-2.5-flash",p=[t];i.length>0&&i.forEach((g,h)=>{p.push({inlineData:{data:g.base64,mimeType:g.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${g.mimeType}, size: ${Math.round(g.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:u,contents:p}),m="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let g of w)g.text&&(m+=g.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var ef=require("@google/genai");async function Fr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new ef.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.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 r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});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,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var Xy=require("pixi.js");An();ot();var of=require("pixi.js");var Zy=require("pixi.js");ot();function rv(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function av(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}function sv(e){return`
|
|
47
|
+
`,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 l=o.target.dataset.tab;l&&this.switchTab(l)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 Fv={};rl(Fv,{AssetCache:()=>Be,AssetLoader:()=>xt,AssetSystem:()=>Qr,AssetTextures:()=>wt,Assets:()=>jf,BaseSystem:()=>Oi,GameEngine:()=>Jr,GameObject:()=>Dn,GameObjectManager:()=>ki,ObjectFactory:()=>_t,Renderer:()=>jn,RuntimeObjectRegistry:()=>Ii,Transform:()=>Pn,applyScreenAnchor:()=>ia,basePixi:()=>If,clearResponsiveElements:()=>zf,createPixiBase:()=>Xr,getRegisteredFontIds:()=>Tf,globalResponsiveMultipliers:()=>Nn,initAssetTextures:()=>Ur,initAssets:()=>Df,layout:()=>Bf,playLottieOverlay:()=>Lf,registerFont:()=>Cf,registerType:()=>Hr,resolveAnchorVec2:()=>Bn,resolveFont:()=>Sf,resolveFontWeight:()=>Af,resolveScreenAnchorPoint:()=>Mi,resolveScreenRatioPoint:()=>Ri,runInitSequence:()=>Ff,setLottieInstance:()=>qr,spawnSceneFromConfig:()=>Rf,updateScreenState:()=>ta});module.exports=Wf(Fv);var Ef=require("pixi.js");var st={};function Gn(e,t,i=!1){st[e]||(st[e]=[]),st[e].push({fn:t,once:i})}function ca(e,t){if(st[e]){if(!t){delete st[e];return}st[e]=st[e].filter(i=>i.fn!==t)}}function Wn(e,...t){let i=st[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ca(e,n.fn)}function ge(e,t){Gn(e,t,!0)}var X=null,Ee=[],qt=null;function ll(e){X=e,Ee=[],qt!==null&&(clearTimeout(qt),qt=null)}function cl(){var e,t,i;return{endpoint:(X==null?void 0:X.endpoint)||"",transport:(X==null?void 0:X.transport)||"beacon",batchSize:(e=X==null?void 0:X.batchSize)!=null?e:10,flushIntervalMs:(t=X==null?void 0:X.flushIntervalMs)!=null?t:300,maxQueue:(i=X==null?void 0:X.maxQueue)!=null?i:200,debug:!!(X!=null&&X.debug)}}async function sl(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function da(e,t){let i=cl();if(t&&i.endpoint){if(Ee.push(e),Ee.length>i.maxQueue&&(Ee=Ee.slice(Ee.length-i.maxQueue)),Ee.length>=i.batchSize){ol();return}qt===null&&(qt=window.setTimeout(()=>{qt=null,ol()},i.flushIntervalMs))}}async function ol(){let e=cl();if(!e.endpoint||Ee.length===0)return;let t=Ee.splice(0,e.batchSize);await sl(e.endpoint,{events:t},e.transport,e.debug),Ee.length>0&&await sl(e.endpoint,{events:Ee.splice(0,e.batchSize)},e.transport,e.debug)}function dl(e){return Math.max(0,Math.min(1,e))}function Yf(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function $i(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Vf(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function ul(e,t,i){try{e[t]=i}catch{}}function Kf(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function pl(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function fl(e,t){let i=Kf(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function hl(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=c=>{var u;e.add(c);let f=(u=t.get(c.target))!=null?u:new Set;f.add(c),t.set(c.target,f),n()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,u;let c=$i();for(let p of Array.from(e)){if(p.killed||p.paused)continue;let v=c-p.startMs-p.delayMs;if(v<0)continue;let m=p.durationMs>0?v/p.durationMs:1,w=dl(m),g=p.repeat>=0?p.repeat+1:1,h=p.repeat>0?Math.min(Math.floor(m),g-1):0;if(p.repeat>0&&m>=1){let b=m-h;w=dl(b)}let x=p.ease(w);p.yoyo&&h%2===1&&(x=1-x);for(let b of p.props)ul(p.target,b.key,b.from+(b.to-b.from)*x);p.scaleFrom&&p.scaleTo&&pl(p.target,{x:p.scaleFrom.x+(p.scaleTo.x-p.scaleFrom.x)*x,y:p.scaleFrom.y+(p.scaleTo.y-p.scaleFrom.y)*x});try{(f=p.onUpdate)==null||f.call(p)}catch{}if(m>=g){s(p);try{(u=p.onComplete)==null||u.call(p)}catch{}}}},d=(c,f,u)=>{var b;let p=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((b=u==null?void 0:u.delayMsOverride)!=null?b:0)),m=Yf(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,g=f.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let C of Object.keys(f)){if(h.has(C))continue;let S=f[C];typeof S=="number"&&x.push({key:C,from:Vf(c,C),to:S})}let y=fl(c,f);return{target:c,startMs:$i(),delayMs:v,durationMs:p,ease:m,props:x,scaleFrom:y.from,scaleTo:y.to,repeat:w,yoyo:g,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let u=d(c,f);return r(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=$i())},resume:()=>{var m;if(!u.paused)return;let p=(m=u.pauseAtMs)!=null?m:$i(),v=$i()-p;u.startMs+=v,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(c,f,u){return l.set(c,f),l.to(c,u)},set(c,f){if(!c||!f)return;for(let p of Object.keys(f)){let v=f[p];p==="scale"||p==="scaleX"||p==="scaleY"||typeof v=="number"&&ul(c,p,v)}let u=fl(c,f);u.to&&pl(c,u.to)},killTweensOf(c){let f=t.get(c);if(f)for(let u of Array.from(f))s(u)},timeline(c={}){let f=[],u=0,p=!1,v=[],m=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?u+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):u},w=h=>{f.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);u=Math.max(u,h.atMs+x)},g={to(h,x,y){return w({kind:"to",target:h,vars:x,atMs:m(y)}),g},fromTo(h,x,y,b){return w({kind:"fromTo",target:h,vars:y,from:x,atMs:m(b)}),g},play(){var h,x;if(p)return g;p=!0,v=[];for(let y of f)y.kind==="fromTo"&&l.set(y.target,(h=y.from)!=null?h:{}),v.push(l.to(y.target,{...y.vars,delay:y.atMs/1e3+((x=y.vars.delay)!=null?x:0)}));return g},pause(){for(let h of v)h.pause();return g},kill(){for(let h of v)h.kill();v=[],p=!1}};return c.paused||g.play(),g}};return l}function gl(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=hl()}catch{}}var ml={name:"handler-playable-sdk",version:"0.3.21",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var me=0,Zf=me++,bl=me++,yl=me++,vl=me++,xl=me++,wl=me++,_l=me++,El=me++,Sl=me++,Al=me++,Cl=me++,Tl=me++,q=Zf;function kl(){return q===bl}function Ll(){return q===yl}function Ol(){return q===vl}function Il(){return q===xl}function Gt(){return q===wl}function Wt(){return q===_l}function Ml(){return q===El}function Rl(){return q===Sl}function Pl(){return q===Al}function ua(){return q===Cl}function pa(){return q===Tl}function jl(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),q=bl;return}catch{}else if(e==="dapi")try{dapi.isReady(),q=yl;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(q=vl)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(q=xl)}catch{}else if(t==="mintegral")window.gameReady&&(q=wl);else if(t==="tapjoy")window.TJ_API&&(q=_l);else if(t==="tiktok")window.openAppStore&&(q=El);else if(t==="smadex")try{window.smxTracking&&(q=Sl)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(q=Al)}catch{}else t==="vungle"?q=Cl:(e==="nucleo"||t==="nucleo")&&(q=Tl)}var Yn=qn(require("lottie-web"),1),Dl=Yn.default;typeof window!="undefined"&&(window.lottie=Yn.default,window.__baseLottie=Yn.default);ga();function Z(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var vx=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:Z(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:Z(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:Z(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:Z(360,780)}],xx=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:Z(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:Z(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:Z(412,915)}],wx=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:Z(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:Z(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:Z(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:Z(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:Z(800,1280)}],Fl=[{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:Z(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:Z(768,1024),mraidScale:.7}];var _x=[...Fl];var ah=Fl[0];ot();var qy=qn(Jp(),1);function Hy(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function $y(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function Uy(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function ao(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await Hy(r),s=await Uy(a),o=$y(a);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:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Br(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,u)=>{let p=new Image;p.onload=()=>f(p),p.onerror=()=>u(new Error("Failed to load image")),p.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let u=s[f],p=s[f+1],v=s[f+2],m=!1;for(let w of d)if(Math.sqrt(Math.pow(u-w.r,2)+Math.pow(p-w.g,2)+Math.pow(v-w.b,2))<t){m=!0;break}m&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}var Qp=require("@google/genai");async function so(e,t,i=[],n={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let g=0;g<i.length;g++){let h=i[g];if(!h.base64||!h.mimeType)throw new Error(`Image ${g+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${g+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${g+1} has invalid MIME type: ${h.mimeType}`)}let f=new Qp.GoogleGenAI({apiKey:e}),u="gemini-2.5-flash",p=[t];i.length>0&&i.forEach((g,h)=>{p.push({inlineData:{data:g.base64,mimeType:g.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${g.mimeType}, size: ${Math.round(g.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:u,contents:p}),m="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let g of w)g.text&&(m+=g.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var ef=require("@google/genai");async function Fr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new ef.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.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 r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});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,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var Xy=require("pixi.js");An();ot();var of=require("pixi.js");var Zy=require("pixi.js");ot();function rv(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function av(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}function sv(e){return`
|
|
48
48
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
49
49
|
|
|
50
50
|
Provide a concise summary (2-3 sentences) covering:
|
package/dist/pixi/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x592756,_0x36d815){var a0_0x41697c={_0x1b226a:0x4af,_0x5e6735:0x4a8,_0x48b811:'#rW^',_0x8ea72d:0x4b0,_0x14c820:0x273,_0x4c5d3b:0x273,_0x3fc3bb:0x26b,_0x184ca9:0x270,_0x129183:0x274,_0x17268d:0x272,_0x56df20:0x4b6,_0x1fac2c:0x4b2,_0x44183b:0x4b4,_0xffe8d7:'Bp(#',_0x5524e7:0x49e,_0x45c2fe:0x4af,_0x2b0001:0x4a9,_0x47ff90:0x4a4,_0x5a5e06:'(n)f',_0x389ebf:0x3f,_0x2fc42b:'5k$w',_0x192c62:0x38},a0_0x113392={_0x3f5a28:0x79},a0_0x165b9f={_0xe7de04:0x233},_0x24a2d3=_0x592756();function _0x34532a(_0x163d59,_0x539171,_0x214c57,_0x58fb4e,_0x5c3c46){return a0_0x42ec(_0x539171- -a0_0x165b9f._0xe7de04,_0x214c57);}function _0x42a27b(_0x198a19,_0x453430,_0x2af7db,_0x4a21ba,_0x5bd862){return a0_0x42ec(_0x453430-a0_0x113392._0x3f5a28,_0x4a21ba);}function _0x2abddf(_0x575210,_0x2f6703,_0x1cd833,_0x1223f2,_0x2192b9){return a0_0x42ec(_0x1cd833-0x2bb,_0x2192b9);}while(!![]){try{var _0x2930d2=parseInt(_0x2abddf(0x4a9,a0_0x41697c._0x1b226a,a0_0x41697c._0x5e6735,0x4a2,a0_0x41697c._0x48b811))/(-0x239*-0x6+-0x481+0x1*-0x8d4)+parseInt(_0x2abddf(0x4b7,0x4a7,a0_0x41697c._0x8ea72d,0x4b6,'D28u'))/(0x8ea*0x2+-0x75b+0x13*-0x8d)+-parseInt(_0x42a27b(a0_0x41697c._0x14c820,a0_0x41697c._0x4c5d3b,a0_0x41697c._0x3fc3bb,'[OIF',a0_0x41697c._0x184ca9))/(0x7*0x2d5+-0x190c+-0x43*-0x14)+-parseInt(_0x42a27b(a0_0x41697c._0x129183,a0_0x41697c._0x17268d,0x27b,'tx0w',0x27c))/(-0x61f*0x2+0x125d+-0x61b*0x1)+parseInt(_0x2abddf(0x4a8,a0_0x41697c._0x56df20,a0_0x41697c._0x1fac2c,a0_0x41697c._0x44183b,a0_0x41697c._0xffe8d7))/(-0x1*0x81a+-0xa3+0x8c2)+parseInt(_0x2abddf(a0_0x41697c._0x5524e7,a0_0x41697c._0x45c2fe,a0_0x41697c._0x2b0001,a0_0x41697c._0x47ff90,a0_0x41697c._0x5a5e06))/(-0x1f7c+0x12cb+0xcb7)+-parseInt(_0x34532a(-0x41,-a0_0x41697c._0x389ebf,a0_0x41697c._0x2fc42b,-0x40,-a0_0x41697c._0x192c62))/(-0x1c59+-0x103e+0x2c9e);if(_0x2930d2===_0x36d815)break;else _0x24a2d3['push'](_0x24a2d3['shift']());}catch(_0x16a936){_0x24a2d3['push'](_0x24a2d3['shift']());}}}(a0_0x2c1d,-0x4b11e+-0x174af3+0x1*0x291975));function a0_0x2c1d(){var _0x57a156=['WOj4tuiF','WOddISkuWRnG','CmoEtxyzW7mzfrpdMsygpW','vHxcL3tdSq','WO8UeSorWPPeW7FcUqJcR8kCW5D1','bSk6W5q','W6FdJ3/dQINcLmkQfJlcKSk1WRu','WQtdNSooW67dI8kAvXPLd8o2fCoR','W71VB8kSWPBcRCkZW5nZWO54nmol','WPaeimoTWONcN8opWPfBW53cRbek','DXLxW7Xr','BflcSCoxW6O','mCkmhdXk','WPS8W57cQxFcTSo5D8oiWQRcSCk8WPRcJG','W4iEBmkvdmkdWQhdIM1CuNZcL8oP','W4WOWR7dQXBdLGb4E17cHrm','W6ddK8o+ySok','zSofWQFdOmo8W5TKW5NdTYzre8kH','WQqtW4K','WO0LC8ktW5NdTSojWPfwWPzfv8ox','W4/dHCkiW6f7rXFcPwxcLSkYaCo4'];a0_0x2c1d=function(){return _0x57a156;};return a0_0x2c1d();}var a0_0x41461f=(function(){var a0_0x12835b={_0x8de434:0x15f,_0x6bc818:0x159},_0x522eed=!![];return function(_0x54203b,_0x29d120){var _0x3347b0=_0x522eed?function(){var a0_0x58984a={_0x598173:0xa3};function _0x2150bf(_0x2b6c92,_0x18b04b,_0x36113c,_0x3278c9,_0xf05a47){return a0_0x42ec(_0x18b04b- -a0_0x58984a._0x598173,_0x36113c);}if(_0x29d120){var _0x45a316=_0x29d120[_0x2150bf(a0_0x12835b._0x8de434,0x159,'zqzP',a0_0x12835b._0x8de434,a0_0x12835b._0x6bc818)](_0x54203b,arguments);return _0x29d120=null,_0x45a316;}}:function(){};return _0x522eed=![],_0x3347b0;};}()),a0_0x4f5097=a0_0x41461f(this,function(){var a0_0x125e82={_0x540f17:'V)EP',_0x411fdc:0x46f,_0x35a9bb:0x475,_0x4bba5f:0x47b,_0x43b98d:0x476,_0x215b73:0x571,_0x72aad9:0x577,_0x472b13:0x570,_0x4cb59d:0x470,_0x27c0a6:0x479,_0x1031cd:0x47f,_0x4b45fe:0x56e,_0x3c2994:'Anb2',_0x462ef9:0x577,_0x345a9a:'sH^D',_0x4c179d:0x46a,_0x4a8651:0x471,_0x3fc401:0x478,_0x212532:0x468,_0x7ff273:0xb0,_0x5e8f32:0xb0,_0x1a1fca:'ISQd',_0x5c7a9d:0xb2,_0x3cc860:0x566,_0x2843b6:'$wS!',_0x120cc6:0x562,_0x44472b:'c)lq',_0xa8178c:0x477,_0x254066:0x46a,_0x4fb969:0x473},a0_0x58e0a2={_0x5ecdd8:0x372},a0_0x2d8f04={_0x4396d1:0x27f},a0_0x4c91b4={_0x340e51:0x2aa},_0x2b04d3={};_0x2b04d3[_0x182edd(a0_0x125e82._0x540f17,a0_0x125e82._0x411fdc,a0_0x125e82._0x35a9bb,a0_0x125e82._0x4bba5f,a0_0x125e82._0x43b98d)]=_0x2ff49c(a0_0x125e82._0x215b73,a0_0x125e82._0x72aad9,')XMg',0x571,a0_0x125e82._0x472b13)+_0x182edd('Y&V3',a0_0x125e82._0x4cb59d,0x47a,a0_0x125e82._0x27c0a6,a0_0x125e82._0x1031cd)+'+$';var _0x229ead=_0x2b04d3;function _0x5c564f(_0x319276,_0x1b01f6,_0x36ab30,_0x28147d,_0x34f788){return a0_0x42ec(_0x34f788- -a0_0x4c91b4._0x340e51,_0x28147d);}function _0x182edd(_0x3621f6,_0x52f628,_0x4001c5,_0xb6a03b,_0x3711bd){return a0_0x42ec(_0x4001c5-a0_0x2d8f04._0x4396d1,_0x3621f6);}function _0x2ff49c(_0x79e03e,_0x5982f8,_0x3a1fa9,_0x4bc0c8,_0x429f75){return a0_0x42ec(_0x429f75-a0_0x58e0a2._0x5ecdd8,_0x3a1fa9);}return a0_0x4f5097['toStr'+_0x2ff49c(a0_0x125e82._0x4b45fe,a0_0x125e82._0x472b13,a0_0x125e82._0x3c2994,a0_0x125e82._0x462ef9,0x572)]()[_0x182edd(a0_0x125e82._0x345a9a,a0_0x125e82._0x4c179d,a0_0x125e82._0x4a8651,a0_0x125e82._0x3fc401,a0_0x125e82._0x212532)+'h'](_0x229ead['rjgXt'])['toStr'+_0x5c564f(-a0_0x125e82._0x7ff273,-a0_0x125e82._0x5e8f32,-0xad,a0_0x125e82._0x1a1fca,-a0_0x125e82._0x5c7a9d)]()[_0x2ff49c(a0_0x125e82._0x3cc860,a0_0x125e82._0x3cc860,a0_0x125e82._0x2843b6,a0_0x125e82._0x120cc6,0x563)+'ructo'+'r'](a0_0x4f5097)[_0x182edd(a0_0x125e82._0x44472b,a0_0x125e82._0xa8178c,a0_0x125e82._0x411fdc,a0_0x125e82._0x254066,a0_0x125e82._0x4fb969)+'h'](_0x229ead['rjgXt']);});a0_0x4f5097();import{A as a0_0x3a0280,B as a0_0xd6cab9,C as a0_0xa09956,D as a0_0x4b79d0,b as a0_0x53b2be,c as a0_0x813de1,d as a0_0xe12bc7,e as a0_0x377fdc,f as a0_0x10483e,g as a0_0x20bc50,h as a0_0xfa0053,i as a0_0x5045b4,j as a0_0x1d7c4f,k as a0_0x4c756f,l as a0_0x307d53,m as a0_0xbe5ca6,n as a0_0x20dc7d,o as a0_0x1961e3,p as a0_0x9c8e9c,q as a0_0x58563d,r as a0_0x194625,s as a0_0x2f423f,t as a0_0x436ba6,u as a0_0x186405,v as a0_0x3d040a,w as a0_0x55aa99,x as a0_0x5b5732,y as a0_0x506046,z as a0_0x57c5e0}from'../chunk-LLLKXWNA.js';import{a as a0_0x35d352,b as a0_0xc18632,c as a0_0x22dfad,d as a0_0x15c5a1,e as a0_0x52aec5}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-Q7FPWOA3.js';function a0_0x42ec(_0x593970,_0x2dc424){_0x593970=_0x593970-(0x1210+0x1ec3+-0x2*0x1773);var _0x28718a=a0_0x2c1d();var _0x246b85=_0x28718a[_0x593970];if(a0_0x42ec['NcDejB']===undefined){var _0x9430e5=function(_0xd16d36){var _0x1bddcf='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xa03e2c='',_0x2ec389='',_0xf1837c=_0xa03e2c+_0x9430e5;for(var _0x2728eb=-0x23a5+0x2fd+-0x5*-0x688,_0x559178,_0x50351d,_0x1e14cc=0x1b2*0x2+0x83b+-0xb9f;_0x50351d=_0xd16d36['charAt'](_0x1e14cc++);~_0x50351d&&(_0x559178=_0x2728eb%(-0x84f*-0x2+0x22f0+-0x338a)?_0x559178*(0xfc2+0x241+-0x11c3)+_0x50351d:_0x50351d,_0x2728eb++%(0xe4*0x25+-0x19a2+-0x74e))?_0xa03e2c+=_0xf1837c['charCodeAt'](_0x1e14cc+(-0x76+0x15b2*0x1+-0x1532*0x1))-(0x1*-0x2f7+-0x5f5+0x8f6)!==0xedd+-0xbff+-0x2de?String['fromCharCode'](-0x3*-0x6d9+-0x16c6+0x33a&_0x559178>>(-(-0x1dcd+-0x4f1+0x10*0x22c)*_0x2728eb&-0x1966+0x479*-0x6+0x3442)):_0x2728eb:-0x3*0x91b+-0xdd*0x1e+0x3537){_0x50351d=_0x1bddcf['indexOf'](_0x50351d);}for(var _0x40862a=0x49c+-0x23b*0x4+0x6*0xb8,_0x3134b0=_0xa03e2c['length'];_0x40862a<_0x3134b0;_0x40862a++){_0x2ec389+='%'+('00'+_0xa03e2c['charCodeAt'](_0x40862a)['toString'](-0x1f05+-0xd4f*-0x1+-0x7*-0x28a))['slice'](-(-0x3*-0xad+-0x1a62+0x185d));}return decodeURIComponent(_0x2ec389);};var _0x192f30=function(_0x592756,_0x36d815){var _0x24a2d3=[],_0x2930d2=0x2296+-0x9c0+-0x18d6,_0x16a936,_0xbebc08='';_0x592756=_0x9430e5(_0x592756);var _0x4578ac;for(_0x4578ac=0x2195+0x875+0x2a0a*-0x1;_0x4578ac<-0x86*0x3e+-0x1b8b+0x3cff;_0x4578ac++){_0x24a2d3[_0x4578ac]=_0x4578ac;}for(_0x4578ac=0x1*0x1ab2+-0xeea+-0xbc8;_0x4578ac<-0x1*0x1247+-0x1f0e+0x3255;_0x4578ac++){_0x2930d2=(_0x2930d2+_0x24a2d3[_0x4578ac]+_0x36d815['charCodeAt'](_0x4578ac%_0x36d815['length']))%(0x1317*-0x1+0x22f*0x5+-0x496*-0x2),_0x16a936=_0x24a2d3[_0x4578ac],_0x24a2d3[_0x4578ac]=_0x24a2d3[_0x2930d2],_0x24a2d3[_0x2930d2]=_0x16a936;}_0x4578ac=0xc0*-0xe+-0x3*0x714+0xc*0x2a5,_0x2930d2=0x3d3*-0x1+-0xab5*0x1+0xe88;for(var _0x33f863=0x16a4+0x22ec+-0x3990;_0x33f863<_0x592756['length'];_0x33f863++){_0x4578ac=(_0x4578ac+(-0xec6+-0xfac+0x1e73))%(0x1d19+0x2*0x994+-0x2f41),_0x2930d2=(_0x2930d2+_0x24a2d3[_0x4578ac])%(0x3*-0x87a+-0xcce+0x51*0x7c),_0x16a936=_0x24a2d3[_0x4578ac],_0x24a2d3[_0x4578ac]=_0x24a2d3[_0x2930d2],_0x24a2d3[_0x2930d2]=_0x16a936,_0xbebc08+=String['fromCharCode'](_0x592756['charCodeAt'](_0x33f863)^_0x24a2d3[(_0x24a2d3[_0x4578ac]+_0x24a2d3[_0x2930d2])%(0x25f2+0x1*0x130d+-0x37ff)]);}return _0xbebc08;};a0_0x42ec['tLumYn']=_0x192f30,a0_0x42ec['qBAYHZ']={},a0_0x42ec['NcDejB']=!![];}var _0x46a032=_0x28718a[-0x6d7+-0x301*0x3+0xfda],_0x1d2f90=_0x593970+_0x46a032,_0x1e986d=a0_0x42ec['qBAYHZ'][_0x1d2f90];if(!_0x1e986d){if(a0_0x42ec['NNOQXS']===undefined){var _0x3f6879=function(_0x2b22da){this['PaZDau']=_0x2b22da,this['OttLrM']=[-0xa1*-0x22+-0x11cc+-0x395,0xe*0xc+-0x1a6d+0x897*0x3,0x1*-0xb99+0xe21+-0x24*0x12],this['RChbbO']=function(){return'newState';},this['SzqgCi']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['otkrJb']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x3f6879['prototype']['lfbOsk']=function(){var _0x2e53c7=new RegExp(this['SzqgCi']+this['otkrJb']),_0x13f158=_0x2e53c7['test'](this['RChbbO']['toString']())?--this['OttLrM'][0x13*-0x185+0x20d2+0x1f9*-0x2]:--this['OttLrM'][0x31*-0x2e+0x1f15+0x1*-0x1647];return this['RkObWK'](_0x13f158);},_0x3f6879['prototype']['RkObWK']=function(_0x390d81){if(!Boolean(~_0x390d81))return _0x390d81;return this['Liiopi'](this['PaZDau']);},_0x3f6879['prototype']['Liiopi']=function(_0x37f691){for(var _0x52dab0=-0x1ee7+0x2e4+0x1*0x1c03,_0x1bc955=this['OttLrM']['length'];_0x52dab0<_0x1bc955;_0x52dab0++){this['OttLrM']['push'](Math['round'](Math['random']())),_0x1bc955=this['OttLrM']['length'];}return _0x37f691(this['OttLrM'][-0x1493*0x1+-0xd0a+0x219d]);},new _0x3f6879(a0_0x42ec)['lfbOsk'](),a0_0x42ec['NNOQXS']=!![];}_0x246b85=a0_0x42ec['tLumYn'](_0x246b85,_0x2dc424),a0_0x42ec['qBAYHZ'][_0x1d2f90]=_0x246b85;}else _0x246b85=_0x1e986d;return _0x246b85;}export{a0_0x35d352 as AssetCache,a0_0x22dfad as AssetLoader,a0_0x186405 as AssetSystem,a0_0x15c5a1 as AssetTextures,a0_0x2f423f as Assets,a0_0x1961e3 as BaseSystem,a0_0x20dc7d as GameEngine,a0_0x377fdc as GameObject,a0_0x10483e as GameObjectManager,a0_0xbe5ca6 as ObjectFactory,a0_0xe12bc7 as Renderer,a0_0x9c8e9c as RuntimeObjectRegistry,a0_0x813de1 as Transform,a0_0xd6cab9 as applyScreenAnchor,a0_0x58563d as basePixi,a0_0x55aa99 as clearResponsiveElements,a0_0x53b2be as createPixiBase,a0_0x1d7c4f as getRegisteredFontIds,a0_0x3d040a as globalResponsiveMultipliers,a0_0x52aec5 as initAssetTextures,a0_0x436ba6 as initAssets,a0_0xa09956 as layout,a0_0x307d53 as playLottieOverlay,a0_0x5045b4 as registerFont,a0_0xc18632 as registerType,a0_0x506046 as resolveAnchorVec2,a0_0x20bc50 as resolveFont,a0_0xfa0053 as resolveFontWeight,a0_0x57c5e0 as resolveScreenAnchorPoint,a0_0x3a0280 as resolveScreenRatioPoint,a0_0x4b79d0 as runInitSequence,a0_0x4c756f as setLottieInstance,a0_0x194625 as spawnSceneFromConfig,a0_0x5b5732 as updateScreenState};
|
|
1
|
+
function a0_0x5526(){var _0x8bcb57=['WRtcO8ocWQldKsLGW7Djv8oGaxW','t8kYW7ZcJColoSktcx7cPmkXCW','BmkiW6CUWQ41F8knoCouWQet','W4tcOSkcW457','WRKkW4tcUSodpmoAW6tcKmoqWO5bjW','cmo/wftcIq','kSoqWOfPW6S','grpdImoxW7C','WQhcO8kVW6rAlSkc','iCoRWO3cJfu','W4mKzCoruLFdRmkqi1NcRu8','W67dTu4PxW','t8k9W7JcH8ommCkiae3cHCk3qq','oSo7W7hcSwKUW6FcK8oRWQbb','DbFcSW','WR8haWldGmk4DW','W6/dU8kXAtm','WPC0WPBcRmkMW5xcIxNdLgq3WRPx','tmk9W7RcG8oluSkymK/cNCk7','WO/cNSoPjw3cK8oUmW12uCoY','WQtcSqLXaG','WQ7cKmoRuLldHSoo','WQtdG8ozW7fCpCkPWRG1','WPddK1BdUrmQicL5','W6ZcImoWWP3cUY0mqq','gCoHwbhcTCkeeha','WQxdImkvWQRcM8orWQ/dJw8','WPjbgCosja','WONcMCoViM3cLSk4ab9BCCotqq','WRLCytFdVmkyB8k2WPS','vSoNsSk4WO5Yj1pdSYZdQ8ot','j8oeW53cRSkk'];a0_0x5526=function(){return _0x8bcb57;};return a0_0x5526();}(function(_0x3005e1,_0x691251){var a0_0x263391={_0xd45684:0x11f,_0x29c086:'&V53',_0x471004:0x111,_0x2d5c56:0x116,_0x1ecd01:0x114,_0x1f0fdb:0x381,_0x6646a:0x382,_0x1bf9c5:0x373,_0x1e04a9:'uCgc',_0x2e6fb5:0x380,_0x2353e5:'SKzz',_0xc51357:0x392,_0x56c090:0x38a,_0x37ce86:0x37e,_0x1c4c04:'9hyE',_0x2a0441:0x385,_0x4ca33f:0x37b,_0xeb1b56:'w1AV',_0x14ad42:0x38a,_0x289610:0x37c,_0x4544df:0x375,_0x3e5410:'Nwd#',_0x439932:0x37b,_0x4ba07d:0x371,_0x226488:'H0Z#',_0x120221:0x365,_0x38fa72:0x137,_0x5e63c8:'q1Jy',_0x925a2d:0x122,_0x3d879f:0x128,_0x176757:0x110,_0x4eb2ac:0x120,_0x1f0a84:0x38f,_0x490968:'@9HQ',_0x4fecf7:0x382,_0x488678:0x38e,_0x6c030c:0x39e,_0x570578:'LsG^',_0x280e43:0x38d},a0_0x30385d={_0x538fbb:0x289};function _0x32495f(_0x3ba90d,_0x2c936a,_0x762b58,_0x31ca8e,_0xacc90f){return a0_0x5a59(_0x2c936a-a0_0x30385d._0x538fbb,_0x31ca8e);}function _0x249b1d(_0x4a2ac7,_0x21f89a,_0x345368,_0xf30dd0,_0x321e85){return a0_0x5a59(_0x345368- -0x76,_0x4a2ac7);}var _0x638ddf=_0x3005e1();function _0x17b38c(_0x1b01ef,_0x5cb2bc,_0x4455e7,_0x28b426,_0xb14541){return a0_0x5a59(_0x28b426-0x2b,_0xb14541);}while(!![]){try{var _0x20d046=-parseInt(_0x17b38c(0x118,0x111,0x10f,a0_0x263391._0xd45684,a0_0x263391._0x29c086))/(-0x2*0x6db+-0xa28+0x17df)+-parseInt(_0x17b38c(a0_0x263391._0x471004,0x104,a0_0x263391._0x2d5c56,a0_0x263391._0x1ecd01,a0_0x263391._0x29c086))/(0x122d+0xf*0x26f+0x4*-0xdab)+parseInt(_0x32495f(a0_0x263391._0x1f0fdb,a0_0x263391._0x6646a,a0_0x263391._0x1bf9c5,a0_0x263391._0x1e04a9,0x37a))/(-0x1196+-0x1727*0x1+0xa3*0x40)*(parseInt(_0x32495f(a0_0x263391._0x2e6fb5,0x386,0x392,a0_0x263391._0x2353e5,a0_0x263391._0xc51357))/(-0x1203+0x12a7+0x10*-0xa))+parseInt(_0x32495f(0x392,a0_0x263391._0x56c090,a0_0x263391._0x37ce86,a0_0x263391._0x1c4c04,a0_0x263391._0x2a0441))/(-0x1bad+-0x839*0x1+0x23eb)*(-parseInt(_0x32495f(a0_0x263391._0x1bf9c5,a0_0x263391._0x4ca33f,0x385,a0_0x263391._0xeb1b56,a0_0x263391._0x14ad42))/(-0x334+-0x4*-0xea+0x5*-0x16))+-parseInt(_0x32495f(a0_0x263391._0x289610,0x379,a0_0x263391._0x4544df,a0_0x263391._0x3e5410,a0_0x263391._0x439932))/(0x1*-0x1271+0x1*-0x7ae+0x1*0x1a26)*(-parseInt(_0x32495f(0x364,a0_0x263391._0x4ba07d,0x368,a0_0x263391._0x226488,a0_0x263391._0x120221))/(0x1c5d+-0x1df1*-0x1+-0x3a46))+parseInt(_0x17b38c(a0_0x263391._0x38fa72,0x129,0x126,0x12a,a0_0x263391._0x5e63c8))/(0x1fb3+-0x1*-0x22e1+-0xd4f*0x5)*(-parseInt(_0x17b38c(a0_0x263391._0x925a2d,a0_0x263391._0x3d879f,a0_0x263391._0x176757,a0_0x263391._0x4eb2ac,'PN*%'))/(-0x18ad+-0xb57*0x2+0x2f65))+parseInt(_0x32495f(0x38a,a0_0x263391._0x1f0a84,0x38d,a0_0x263391._0x490968,0x381))/(-0x7*-0x28c+-0x40*0x29+-0x789)*(parseInt(_0x32495f(a0_0x263391._0x4fecf7,a0_0x263391._0x488678,a0_0x263391._0x6c030c,a0_0x263391._0x570578,a0_0x263391._0x280e43))/(0x486*0x3+0x6f3+-0x1479));if(_0x20d046===_0x691251)break;else _0x638ddf['push'](_0x638ddf['shift']());}catch(_0x1fb597){_0x638ddf['push'](_0x638ddf['shift']());}}}(a0_0x5526,0x406*0xa6+-0x1*-0x1ac95+0x4a99));var a0_0x4c40c1=(function(){var _0x486a4a=!![];return function(_0x3603a1,_0x2db14b){var a0_0x7533d={_0x23f323:0x18,_0x34eb7f:0x28,_0xe9fefb:'g4tv',_0x4a094a:0x1b,_0x116e8f:0x37},a0_0x316fe3={_0x3a761e:0xc7},_0x495e25=_0x486a4a?function(){function _0x4a7d93(_0x159673,_0xabf002,_0x42e50c,_0x349c2d,_0x1588ef){return a0_0x5a59(_0xabf002- -a0_0x316fe3._0x3a761e,_0x42e50c);}if(_0x2db14b){var _0x44e48f=_0x2db14b[_0x4a7d93(a0_0x7533d._0x23f323,a0_0x7533d._0x34eb7f,a0_0x7533d._0xe9fefb,a0_0x7533d._0x4a094a,a0_0x7533d._0x116e8f)](_0x3603a1,arguments);return _0x2db14b=null,_0x44e48f;}}:function(){};return _0x486a4a=![],_0x495e25;};}()),a0_0x54d7ab=a0_0x4c40c1(this,function(){var a0_0x70d65a={_0x35b0c5:0x1c9,_0x3bf38a:0x1d2,_0x52c8b9:'8WU(',_0x442828:0x1d1,_0x4222b6:0x38b,_0x2476ec:'6eib',_0x1db6c0:0x392,_0x2265b4:0x38d,_0x19bfdf:0x39f,_0x19b7d6:0x1cd,_0x1a5a33:0x1c2,_0x2b1726:0x1ca,_0x55e956:0x39f,_0xfe312a:'aRT#',_0xf3fb9e:0x38f,_0x2a6f5b:0x399,_0x5411d4:'L6GA',_0x2de8d1:0x41d,_0x1c678c:0x406,_0x2d6837:0x412,_0x5262a7:0x40a,_0x2550a9:0x1c7,_0xf7a5f3:0x1b8,_0x401a02:0x3a6,_0x42157d:0x397,_0x2eefe3:0x3a0,_0x38ccd9:0x39b,_0x4a7e1a:'A]qk',_0x5931ff:0x421,_0xf75d3d:0x385,_0x5a6b98:0x397,_0x317a11:0x37c,_0xa2c69a:'Nwd#',_0x501365:0x38c,_0x244e5b:0x399},a0_0x294bf1={_0x3c017c:0xcf};function _0x4faeba(_0xba26f7,_0x9a0902,_0x17cf1d,_0x962a42,_0x571da0){return a0_0x5a59(_0x962a42-0x325,_0xba26f7);}function _0x3d9d96(_0x49bb23,_0x349dd3,_0x3c3325,_0xaa52f3,_0xb661c8){return a0_0x5a59(_0x349dd3-a0_0x294bf1._0x3c017c,_0xaa52f3);}var _0x96fd18={};function _0x4d4ff2(_0x3b6adf,_0x3188bf,_0x3cf274,_0x1e448f,_0x518780){return a0_0x5a59(_0x3cf274-0x2a1,_0x3188bf);}_0x96fd18[_0x3d9d96(a0_0x70d65a._0x35b0c5,a0_0x70d65a._0x3bf38a,0x1d7,a0_0x70d65a._0x52c8b9,a0_0x70d65a._0x442828)]=_0x4d4ff2(a0_0x70d65a._0x4222b6,a0_0x70d65a._0x2476ec,a0_0x70d65a._0x1db6c0,a0_0x70d65a._0x2265b4,a0_0x70d65a._0x19bfdf)+_0x3d9d96(a0_0x70d65a._0x19b7d6,a0_0x70d65a._0x1a5a33,0x1c0,'A]qk',a0_0x70d65a._0x2b1726)+'+$';var _0x21382a=_0x96fd18;return a0_0x54d7ab[_0x4d4ff2(a0_0x70d65a._0x55e956,a0_0x70d65a._0xfe312a,a0_0x70d65a._0xf3fb9e,a0_0x70d65a._0x2265b4,a0_0x70d65a._0x2a6f5b)+'ing']()[_0x4faeba(a0_0x70d65a._0x5411d4,a0_0x70d65a._0x2de8d1,a0_0x70d65a._0x1c678c,a0_0x70d65a._0x2d6837,a0_0x70d65a._0x5262a7)+'h'](_0x21382a[_0x3d9d96(0x1cc,a0_0x70d65a._0x2550a9,0x1b8,'iv*)',a0_0x70d65a._0xf7a5f3)])['toStr'+_0x4d4ff2(a0_0x70d65a._0x401a02,'mg4r',a0_0x70d65a._0x42157d,a0_0x70d65a._0x2eefe3,a0_0x70d65a._0x38ccd9)]()[_0x4faeba(a0_0x70d65a._0x4a7e1a,0x42f,0x42d,a0_0x70d65a._0x5931ff,0x412)+'ructo'+'r'](a0_0x54d7ab)[_0x4d4ff2(a0_0x70d65a._0xf75d3d,'QRuD',0x388,a0_0x70d65a._0x5a6b98,a0_0x70d65a._0x317a11)+'h'](_0x21382a[_0x4d4ff2(0x38a,a0_0x70d65a._0xa2c69a,a0_0x70d65a._0x501365,a0_0x70d65a._0x244e5b,0x38e)]);});a0_0x54d7ab();import{A as a0_0x3bbc74,B as a0_0x2f6246,C as a0_0x14d51c,D as a0_0x43f000,b as a0_0x1d547e,c as a0_0x4a1fd4,d as a0_0x1b5d08,e as a0_0x5b212b,f as a0_0x40007d,g as a0_0x2b10f8,h as a0_0x2c83b2,i as a0_0x11cc12,j as a0_0x1a3e87,k as a0_0x4c58e6,l as a0_0x3432c3,m as a0_0x7d42d1,n as a0_0x1ecb94,o as a0_0x3a97a3,p as a0_0x27aa81,q as a0_0x2bfebf,r as a0_0x5f1874,s as a0_0x1776f1,t as a0_0x95efa3,u as a0_0x335a16,v as a0_0x203bd0,w as a0_0x401e46,x as a0_0x54f353,y as a0_0x304ed,z as a0_0x114b6e}from'../chunk-5UGLDQKG.js';import{a as a0_0x6e5808,b as a0_0x1139fb,c as a0_0x51cddb,d as a0_0xe35a7f,e as a0_0x34669a}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';function a0_0x5a59(_0x5736d9,_0x4165cb){_0x5736d9=_0x5736d9-(0x2697+0x75*-0x28+0x4da*-0x4);var _0x1a3908=a0_0x5526();var _0x136ed0=_0x1a3908[_0x5736d9];if(a0_0x5a59['GioQpn']===undefined){var _0x1e4fb5=function(_0x19b3dd){var _0x46741e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x1209fa='',_0x30023f='',_0x33ab2e=_0x1209fa+_0x1e4fb5;for(var _0x497106=0x211f*-0x1+-0xd62*-0x2+0x65b,_0xde8b03,_0x25a786,_0x1fce2a=0x24a6+-0x1150*0x1+-0x16*0xe1;_0x25a786=_0x19b3dd['charAt'](_0x1fce2a++);~_0x25a786&&(_0xde8b03=_0x497106%(-0x3*-0x3ed+-0xfce+0x73*0x9)?_0xde8b03*(-0x1fb0+0x18*-0x34+0x24d0)+_0x25a786:_0x25a786,_0x497106++%(0x19*-0xa7+0x1453*-0x1+0x24a6))?_0x1209fa+=_0x33ab2e['charCodeAt'](_0x1fce2a+(-0x11*-0x156+-0x5df+0x1*-0x10cd))-(0xbec+0x1*-0xecd+0x2eb)!==-0x210+-0x2100+-0x21*-0x110?String['fromCharCode'](0x429*-0x5+0x106*0x17+-0x1*0x1be&_0xde8b03>>(-(0x4b*-0x5e+0xd6*0x2b+-0x433*0x2)*_0x497106&-0x15*-0xab+0xa40+-0x377*0x7)):_0x497106:-0x1811+-0xa97+-0x8*-0x455){_0x25a786=_0x46741e['indexOf'](_0x25a786);}for(var _0x314262=-0xdd6+0x1c*-0x89+0xee*0x1f,_0x2a8864=_0x1209fa['length'];_0x314262<_0x2a8864;_0x314262++){_0x30023f+='%'+('00'+_0x1209fa['charCodeAt'](_0x314262)['toString'](0x1e80+-0x16d7+-0x799))['slice'](-(0x18b4+-0x1*-0x242e+-0x3ce0));}return decodeURIComponent(_0x30023f);};var _0x4aed78=function(_0x1be063,_0x2bc797){var _0x34263a=[],_0x282832=-0x1f*-0x89+0xe*-0x2af+0x14fb,_0x38354b,_0x28d30f='';_0x1be063=_0x1e4fb5(_0x1be063);var _0x382bcf;for(_0x382bcf=-0x29a+0x5*-0x4e6+0x1b18;_0x382bcf<-0xdd7+0x8ef+-0x2a*-0x24;_0x382bcf++){_0x34263a[_0x382bcf]=_0x382bcf;}for(_0x382bcf=-0x1f65+0xc0*0x4+0x1c65;_0x382bcf<-0x18e7+-0x114*0x1f+0x3b53*0x1;_0x382bcf++){_0x282832=(_0x282832+_0x34263a[_0x382bcf]+_0x2bc797['charCodeAt'](_0x382bcf%_0x2bc797['length']))%(0x6*-0x60d+-0x1a3+0x26f1),_0x38354b=_0x34263a[_0x382bcf],_0x34263a[_0x382bcf]=_0x34263a[_0x282832],_0x34263a[_0x282832]=_0x38354b;}_0x382bcf=-0x15b8+-0x11f1*0x1+-0xd*-0x30d,_0x282832=0x611*-0x1+0xd*-0x7f+-0x4*-0x321;for(var _0x3ce2cd=0x1633*0x1+0x126d+0xd*-0x320;_0x3ce2cd<_0x1be063['length'];_0x3ce2cd++){_0x382bcf=(_0x382bcf+(-0x2*-0xc27+-0x1*0x11e1+-0x66c))%(-0x19de+-0xc5*0x27+0x38e1),_0x282832=(_0x282832+_0x34263a[_0x382bcf])%(0x1245+-0xf*-0xe1+-0x1e74),_0x38354b=_0x34263a[_0x382bcf],_0x34263a[_0x382bcf]=_0x34263a[_0x282832],_0x34263a[_0x282832]=_0x38354b,_0x28d30f+=String['fromCharCode'](_0x1be063['charCodeAt'](_0x3ce2cd)^_0x34263a[(_0x34263a[_0x382bcf]+_0x34263a[_0x282832])%(0x20fb+0x13*0x20c+0x1*-0x46df)]);}return _0x28d30f;};a0_0x5a59['mIzvlc']=_0x4aed78,a0_0x5a59['BidecV']={},a0_0x5a59['GioQpn']=!![];}var _0x5405fb=_0x1a3908[-0x601+0xb3a+-0x1*0x539],_0xe1568d=_0x5736d9+_0x5405fb,_0x5adbd4=a0_0x5a59['BidecV'][_0xe1568d];if(!_0x5adbd4){if(a0_0x5a59['VbHzNM']===undefined){var _0x192d96=function(_0x26502b){this['HcylUa']=_0x26502b,this['QKzvux']=[0x166*-0x7+-0xee6*-0x2+-0x1401,-0x1eba+0x175*0x7+-0x5*-0x41b,-0x6*0x126+-0x1a63+-0x7*-0x4c1],this['ESaCOa']=function(){return'newState';},this['SGVsLl']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['qlEypv']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x192d96['prototype']['fZhLSH']=function(){var _0x4e6998=new RegExp(this['SGVsLl']+this['qlEypv']),_0x44622f=_0x4e6998['test'](this['ESaCOa']['toString']())?--this['QKzvux'][-0x2315*0x1+0xa73+0x385*0x7]:--this['QKzvux'][0xb4f+0x27*-0x59+0x240];return this['OelLpN'](_0x44622f);},_0x192d96['prototype']['OelLpN']=function(_0x4a2cb0){if(!Boolean(~_0x4a2cb0))return _0x4a2cb0;return this['wNUPKn'](this['HcylUa']);},_0x192d96['prototype']['wNUPKn']=function(_0x3af4d3){for(var _0x5542ae=-0x7*-0x37+-0x4ea+-0x1*-0x369,_0x38a16e=this['QKzvux']['length'];_0x5542ae<_0x38a16e;_0x5542ae++){this['QKzvux']['push'](Math['round'](Math['random']())),_0x38a16e=this['QKzvux']['length'];}return _0x3af4d3(this['QKzvux'][0x179*-0x1+-0x19bb+0x2*0xd9a]);},new _0x192d96(a0_0x5a59)['fZhLSH'](),a0_0x5a59['VbHzNM']=!![];}_0x136ed0=a0_0x5a59['mIzvlc'](_0x136ed0,_0x4165cb),a0_0x5a59['BidecV'][_0xe1568d]=_0x136ed0;}else _0x136ed0=_0x5adbd4;return _0x136ed0;}import'../chunk-E6WJCS24.js';import'../chunk-Q7FPWOA3.js';export{a0_0x6e5808 as AssetCache,a0_0x51cddb as AssetLoader,a0_0x335a16 as AssetSystem,a0_0xe35a7f as AssetTextures,a0_0x1776f1 as Assets,a0_0x3a97a3 as BaseSystem,a0_0x1ecb94 as GameEngine,a0_0x5b212b as GameObject,a0_0x40007d as GameObjectManager,a0_0x7d42d1 as ObjectFactory,a0_0x1b5d08 as Renderer,a0_0x27aa81 as RuntimeObjectRegistry,a0_0x4a1fd4 as Transform,a0_0x2f6246 as applyScreenAnchor,a0_0x2bfebf as basePixi,a0_0x401e46 as clearResponsiveElements,a0_0x1d547e as createPixiBase,a0_0x1a3e87 as getRegisteredFontIds,a0_0x203bd0 as globalResponsiveMultipliers,a0_0x34669a as initAssetTextures,a0_0x95efa3 as initAssets,a0_0x14d51c as layout,a0_0x3432c3 as playLottieOverlay,a0_0x11cc12 as registerFont,a0_0x1139fb as registerType,a0_0x304ed as resolveAnchorVec2,a0_0x2b10f8 as resolveFont,a0_0x2c83b2 as resolveFontWeight,a0_0x114b6e as resolveScreenAnchorPoint,a0_0x3bbc74 as resolveScreenRatioPoint,a0_0x43f000 as runInitSequence,a0_0x4c58e6 as setLottieInstance,a0_0x5f1874 as spawnSceneFromConfig,a0_0x54f353 as updateScreenState};
|
package/dist/three/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
`,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 l=o.target.dataset.tab;l&&this.switchTab(l)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 Yw={};hc(Yw,{AspectClass:()=>$o,GameObject:()=>Dn,GameObjectManager:()=>ia,Renderer:()=>jn,ResponsiveUISystem:()=>Di,Transform:()=>Pn,animateHandClick:()=>Nh,animatePanelEntrance:()=>Hh,createBrushTexture:()=>Vh,createEndGamePanel:()=>Bh,createHandTutorial:()=>$h,createThreeBase:()=>Dh,createTutorialLabel:()=>Uh,getAspectClass:()=>ta,getRegisteredFontIds:()=>Fh,loadAsset:()=>Go,loadCharacterFrames:()=>Yh,registerFont:()=>zh,resolveFont:()=>Fe,resolveFontWeight:()=>Be,updateHandAnimation:()=>qh});module.exports=Ng(Yw);var Te=Ge(require("three"),1);var dt={};function qn(e,t,i=!1){dt[e]||(dt[e]=[]),dt[e].push({fn:t,once:i})}function ga(e,t){if(dt[e]){if(!t){delete dt[e];return}dt[e]=dt[e].filter(i=>i.fn!==t)}}function Gn(e,...t){let i=dt[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ga(e,n.fn)}function fe(e,t){qn(e,t,!0)}var q=null,we=[],Zt=null;function yc(e){q=e,we=[],Zt!==null&&(clearTimeout(Zt),Zt=null)}function vc(){var e,t,i;return{endpoint:(q==null?void 0:q.endpoint)||"",transport:(q==null?void 0:q.transport)||"beacon",batchSize:(e=q==null?void 0:q.batchSize)!=null?e:10,flushIntervalMs:(t=q==null?void 0:q.flushIntervalMs)!=null?t:300,maxQueue:(i=q==null?void 0:q.maxQueue)!=null?i:200,debug:!!(q!=null&&q.debug)}}async function mc(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function ma(e,t){let i=vc();if(t&&i.endpoint){if(we.push(e),we.length>i.maxQueue&&(we=we.slice(we.length-i.maxQueue)),we.length>=i.batchSize){bc();return}Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,bc()},i.flushIntervalMs))}}async function bc(){let e=vc();if(!e.endpoint||we.length===0)return;let t=we.splice(0,e.batchSize);await mc(e.endpoint,{events:t},e.transport,e.debug),we.length>0&&await mc(e.endpoint,{events:we.splice(0,e.batchSize)},e.transport,e.debug)}function xc(e){return Math.max(0,Math.min(1,e))}function $g(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function Hi(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ug(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function wc(e,t,i){try{e[t]=i}catch{}}function qg(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function _c(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Ec(e,t){let i=qg(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function Sc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=c=>{var p;e.add(c);let f=(p=t.get(c.target))!=null?p:new Set;f.add(c),t.set(c.target,f),n()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,p;let c=Hi();for(let u of Array.from(e)){if(u.killed||u.paused)continue;let v=c-u.startMs-u.delayMs;if(v<0)continue;let h=u.durationMs>0?v/u.durationMs:1,w=xc(h),y=u.repeat>=0?u.repeat+1:1,m=u.repeat>0?Math.min(Math.floor(h),y-1):0;if(u.repeat>0&&h>=1){let x=h-m;w=xc(x)}let b=u.ease(w);u.yoyo&&m%2===1&&(b=1-b);for(let x of u.props)wc(u.target,x.key,x.from+(x.to-x.from)*b);u.scaleFrom&&u.scaleTo&&_c(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*b,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*b});try{(f=u.onUpdate)==null||f.call(u)}catch{}if(h>=y){s(u);try{(p=u.onComplete)==null||p.call(u)}catch{}}}},d=(c,f,p)=>{var x;let u=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),h=$g(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,y=f.yoyo===!0,m=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),b=[];for(let E of Object.keys(f)){if(m.has(E))continue;let A=f[E];typeof A=="number"&&b.push({key:E,from:Ug(c,E),to:A})}let g=Ec(c,f);return{target:c,startMs:Hi(),delayMs:v,durationMs:u,ease:h,props:b,scaleFrom:g.from,scaleTo:g.to,repeat:w,yoyo:y,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let p=d(c,f);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Hi())},resume:()=>{var h;if(!p.paused)return;let u=(h=p.pauseAtMs)!=null?h:Hi(),v=Hi()-u;p.startMs+=v,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(c,f,p){return l.set(c,f),l.to(c,p)},set(c,f){if(!c||!f)return;for(let u of Object.keys(f)){let v=f[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof v=="number"&&wc(c,u,v)}let p=Ec(c,f);p.to&&_c(c,p.to)},killTweensOf(c){let f=t.get(c);if(f)for(let p of Array.from(f))s(p)},timeline(c={}){let f=[],p=0,u=!1,v=[],h=m=>{if(typeof m=="number")return Math.max(0,m*1e3);let b=typeof m=="string"?m.trim():"";return b.startsWith("+=")?p+Math.max(0,Number(b.slice(2))*1e3||0):b?Math.max(0,Number(b)*1e3||0):p},w=m=>{f.push(m);let b=Math.max(0,(typeof m.vars.duration=="number"?m.vars.duration:.5)*1e3);p=Math.max(p,m.atMs+b)},y={to(m,b,g){return w({kind:"to",target:m,vars:b,atMs:h(g)}),y},fromTo(m,b,g,x){return w({kind:"fromTo",target:m,vars:g,from:b,atMs:h(x)}),y},play(){var m,b;if(u)return y;u=!0,v=[];for(let g of f)g.kind==="fromTo"&&l.set(g.target,(m=g.from)!=null?m:{}),v.push(l.to(g.target,{...g.vars,delay:g.atMs/1e3+((b=g.vars.delay)!=null?b:0)}));return y},pause(){for(let m of v)m.pause();return y},kill(){for(let m of v)m.kill();v=[],u=!1}};return c.paused||y.play(),y}};return l}function Ac(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=Sc()}catch{}}var Cc={name:"handler-playable-sdk",version:"0.3.20",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var he=0,Wg=he++,Tc=he++,kc=he++,Lc=he++,Rc=he++,Mc=he++,Oc=he++,Ic=he++,Pc=he++,jc=he++,Dc=he++,zc=he++,H=Wg;function Fc(){return H===Tc}function Bc(){return H===kc}function Hc(){return H===Lc}function Nc(){return H===Rc}function Jt(){return H===Mc}function Qt(){return H===Oc}function $c(){return H===Ic}function Uc(){return H===Pc}function qc(){return H===jc}function ba(){return H===Dc}function ya(){return H===zc}function Gc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),H=Tc;return}catch{}else if(e==="dapi")try{dapi.isReady(),H=kc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=Lc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(H=Rc)}catch{}else if(t==="mintegral")window.gameReady&&(H=Mc);else if(t==="tapjoy")window.TJ_API&&(H=Oc);else if(t==="tiktok")window.openAppStore&&(H=Ic);else if(t==="smadex")try{window.smxTracking&&(H=Pc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(H=jc)}catch{}else t==="vungle"?H=Dc:(e==="nucleo"||t==="nucleo")&&(H=zc)}var Wn=Ge(require("lottie-web"),1),Wc=Wn.default;typeof window!="undefined"&&(window.lottie=Wn.default,window.__baseLottie=Wn.default);var Yg=require("pixi.js");var va=require("pixi.js");var Vg=null;function xa(e){Vg=e}Yn();wa();var Ni=require("pixi.js");Yn();var em=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Aa=em;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(Aa=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Aa}`))}}catch{}var Mt=class{static async create(t,i,n){var d,l,c,f,p,u,v;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${Aa}`);let r=(d=i==null?void 0:i.render)==null?void 0:d.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new Ni.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(l=i==null?void 0:i.identity)==null?void 0:l.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Rt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new Ni.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((u=s.constructor)==null?void 0:u.name)==="Container"||s instanceof Ni.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],w=!1;for(let y of h)try{let m=await fetch(y);if(m.ok){o=await m.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",y,"type:",(v=o==null?void 0:o.constructor)==null?void 0:v.name),w=!0;break}}catch{continue}w||(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,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var $i=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var nm=Ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=nm);Ui();var Xn=require("pixi.js");Ui();var Ta=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new $i}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let d=await Mt.create(a,s,this.app);this.instanceCache.set(a,d),console.log("[Assets] Loaded object:",a,(o=d==null?void 0:d.constructor)==null?void 0:o.name)}catch(d){console.error("[Assets] Failed to load object:",a,d)}})))};return this.readyPromise=(async()=>{await n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await Mt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},am=new Ta,sm=new Proxy(am,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});Ui();var Kc=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},Zn={scale:1,position:1},La=[];function cm(e,t,i,n,r,a,s){La.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function dm(){La.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function ka(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),Zn.scale=Xe.scaleFactor,Zn.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Zn.scale.toFixed(3)}`),dm()}var Gi={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 um(e,t,i){let n=Gi[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function pm(){return Gi}var fm={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 Kn(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Jn(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:Kn(e[0],t.x),y:Kn(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:Kn(n.x,t.x),y:Kn(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=fm[n])!=null?i:t}return t}function Zc(e,t,i,n={}){var u,v,h,w,y,m;let r=Jn(i),a=(u=n.inset)!=null?u:{},s=(v=n.padding)!=null?v:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,d=((w=a.right)!=null?w:0)+s.x,l=((y=a.top)!=null?y:0)+s.y,c=((m=a.bottom)!=null?m:0)+s.y,f=Math.max(0,e-o-d),p=Math.max(0,t-l-c);return{x:o+f*r.x,y:l+p*r.y}}function Jc(e,t,i,n={}){var h,w,y,m,b,g;let r=(h=n.inset)!=null?h:{},a=(w=n.padding)!=null?w:{x:0,y:0},s=((y=r.left)!=null?y:0)+a.x,o=((m=r.right)!=null?m:0)+a.x,d=((b=r.top)!=null?b:0)+a.y,l=((g=r.bottom)!=null?g:0)+a.y,c=Math.max(0,e-s-o),f=Math.max(0,t-d-l),p=Jn(i,{x:.5,y:.5}),u=Math.min(Math.max(p.x,0),1),v=Math.min(Math.max(p.y,0),1);return{x:s+c*u,y:d+f*v}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,ka(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),ka(window.innerWidth,window.innerHeight),window.updateDebugConfig=um,window.getDebugConfig=pm,window.copyConfig=Sm,window.applyConfig=qi,window.applyConfigForRatio=Am,window.positionAtBottom=Qc,window.positionAtTop=mm,window.positionAtCenter=bm,window.positionAtLeft=ym,window.positionAtRight=vm,window.positionAtBottomLeft=xm,window.positionAtBottomRight=wm,window.positionAtTopLeft=_m,window.positionAtTopRight=Em,window.applyPositionContract=gm,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 Qn(e,t,i=0){return e*t+i}function er(e,t,i=0){return e*(1-t)+i}function tr(e,t,i=0){return e*t+i}function ir(e,t,i=0){return e*(1-t)+i}function ge(e,t=0){return e/2+t}function hm(e,t){return e*t}function gm(e,t,i,n){var s,o,d,l,c,f,p,u,v,h,w,y,m,b,g,x,E,A,C,T;let r=0,a=0;switch(n.type){case"top":r=ge(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=Qn(i,n.percent,(l=(d=n.offset)==null?void 0:d.y)!=null?l:0);break;case"bottom":r=ge(t,(f=(c=n.offset)==null?void 0:c.x)!=null?f:0),a=er(i,n.percent,(u=(p=n.offset)==null?void 0:p.y)!=null?u:0);break;case"left":r=tr(t,n.percent,(h=(v=n.offset)==null?void 0:v.x)!=null?h:0),a=ge(i,(y=(w=n.offset)==null?void 0:w.y)!=null?y:0);break;case"right":r=ir(t,n.percent,(b=(m=n.offset)==null?void 0:m.x)!=null?b:0),a=ge(i,(x=(g=n.offset)==null?void 0:g.y)!=null?x:0);break;case"center":r=ge(t,(A=(E=n.offset)==null?void 0:E.x)!=null?A:0),a=ge(i,(T=(C=n.offset)==null?void 0:C.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function Qc(e,t,i,n=.2,r=1,a=!0,s=!1){let o=hm(i,n),d=er(i,n/2);Ke(e,ge(t),d);let l=a?r*Xe.scaleFactor:r;Ze(e,l),s&&!La.find(c=>c.element===e)&&cm(e,Qc,t,i,n,r,a)}function mm(e,t,i,n=.1,r=1){Ke(e,ge(t),Qn(i,n)),Ze(e,r)}function bm(e,t,i,n=0,r=0,a=1){Ke(e,ge(t,n),ge(i,r)),Ze(e,a)}function ym(e,t,i,n=.1,r=1){Ke(e,tr(t,n),ge(i)),Ze(e,r)}function vm(e,t,i,n=.1,r=1){Ke(e,ir(t,n),ge(i)),Ze(e,r)}function xm(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),er(i,n)),Ze(e,a)}function wm(e,t,i,n=.05,r=.05,a=1){Ke(e,ir(t,r),er(i,n)),Ze(e,a)}function _m(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),Qn(i,n)),Ze(e,a)}function Em(e,t,i,n=.05,r=.05,a=1){Ke(e,ir(t,r),Qn(i,n)),Ze(e,a)}function Ke(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Ze(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Ot={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 Sm(e){return e&&Ot[e]?JSON.parse(JSON.stringify(Ot[e])):JSON.parse(JSON.stringify(Gi))}function qi(e){Object.keys(e).forEach(t=>{let i=t;Gi[i]&&e[i]&&Object.assign(Gi[i],e[i])}),console.log("Config applied:",e)}function Am(e,t){let i=e/t;i>1.6?(qi(Ot.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(qi(Ot.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(qi(Ot.square),console.log("Applied SQUARE config for ratio:",i)):(qi(Ot.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Ot,e.resolveAnchorVec2=e.resolveAnchorVec2||Jn,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Zc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||Jc}Oa();function G(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var B_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],H_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],N_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],nd=[{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:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var $_=[...nd];var Im=nd[0];pt();var yw=Ge(mh(),1);function gw(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function mw(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function bw(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function Eo(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await gw(r),s=await bw(a),o=mw(a);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:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Vr(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,p)=>{let u=new Image;u.onload=()=>f(u),u.onerror=()=>p(new Error("Failed to load image")),u.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let p=s[f],u=s[f+1],v=s[f+2],h=!1;for(let w of d)if(Math.sqrt(Math.pow(p-w.r,2)+Math.pow(u-w.g,2)+Math.pow(v-w.b,2))<t){h=!0;break}h&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}var bh=require("@google/genai");async function So(e,t,i=[],n={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let y=0;y<i.length;y++){let m=i[y];if(!m.base64||!m.mimeType)throw new Error(`Image ${y+1} is missing required data`);if(m.base64.length<1e3&&console.warn(`Image ${y+1} data appears very small, may be corrupted`),!m.mimeType.startsWith("image/"))throw new Error(`Image ${y+1} has invalid MIME type: ${m.mimeType}`)}let f=new bh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",u=[t];i.length>0&&i.forEach((y,m)=>{u.push({inlineData:{data:y.base64,mimeType:y.mimeType}}),console.log(`[Gemini] Added image ${m+1}: ${y.mimeType}, size: ${Math.round(y.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:p,contents:u}),h="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let y of w)y.text&&(h+=y.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var yh=require("@google/genai");async function Xr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new yh.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.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 r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});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,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var vw=require("pixi.js");Ui();pt();var xh=require("pixi.js");var xw=require("pixi.js");pt();function Tw(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function kw(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}function Lw(e){return`
|
|
47
|
+
`,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 l=o.target.dataset.tab;l&&this.switchTab(l)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 Yw={};hc(Yw,{AspectClass:()=>$o,GameObject:()=>Dn,GameObjectManager:()=>ia,Renderer:()=>jn,ResponsiveUISystem:()=>Di,Transform:()=>Pn,animateHandClick:()=>Nh,animatePanelEntrance:()=>Hh,createBrushTexture:()=>Vh,createEndGamePanel:()=>Bh,createHandTutorial:()=>$h,createThreeBase:()=>Dh,createTutorialLabel:()=>Uh,getAspectClass:()=>ta,getRegisteredFontIds:()=>Fh,loadAsset:()=>Go,loadCharacterFrames:()=>Yh,registerFont:()=>zh,resolveFont:()=>Fe,resolveFontWeight:()=>Be,updateHandAnimation:()=>qh});module.exports=Ng(Yw);var Te=Ge(require("three"),1);var dt={};function qn(e,t,i=!1){dt[e]||(dt[e]=[]),dt[e].push({fn:t,once:i})}function ga(e,t){if(dt[e]){if(!t){delete dt[e];return}dt[e]=dt[e].filter(i=>i.fn!==t)}}function Gn(e,...t){let i=dt[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ga(e,n.fn)}function fe(e,t){qn(e,t,!0)}var q=null,we=[],Zt=null;function yc(e){q=e,we=[],Zt!==null&&(clearTimeout(Zt),Zt=null)}function vc(){var e,t,i;return{endpoint:(q==null?void 0:q.endpoint)||"",transport:(q==null?void 0:q.transport)||"beacon",batchSize:(e=q==null?void 0:q.batchSize)!=null?e:10,flushIntervalMs:(t=q==null?void 0:q.flushIntervalMs)!=null?t:300,maxQueue:(i=q==null?void 0:q.maxQueue)!=null?i:200,debug:!!(q!=null&&q.debug)}}async function mc(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function ma(e,t){let i=vc();if(t&&i.endpoint){if(we.push(e),we.length>i.maxQueue&&(we=we.slice(we.length-i.maxQueue)),we.length>=i.batchSize){bc();return}Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,bc()},i.flushIntervalMs))}}async function bc(){let e=vc();if(!e.endpoint||we.length===0)return;let t=we.splice(0,e.batchSize);await mc(e.endpoint,{events:t},e.transport,e.debug),we.length>0&&await mc(e.endpoint,{events:we.splice(0,e.batchSize)},e.transport,e.debug)}function xc(e){return Math.max(0,Math.min(1,e))}function $g(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function Hi(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ug(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function wc(e,t,i){try{e[t]=i}catch{}}function qg(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function _c(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Ec(e,t){let i=qg(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function Sc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=c=>{var p;e.add(c);let f=(p=t.get(c.target))!=null?p:new Set;f.add(c),t.set(c.target,f),n()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,p;let c=Hi();for(let u of Array.from(e)){if(u.killed||u.paused)continue;let v=c-u.startMs-u.delayMs;if(v<0)continue;let h=u.durationMs>0?v/u.durationMs:1,w=xc(h),y=u.repeat>=0?u.repeat+1:1,m=u.repeat>0?Math.min(Math.floor(h),y-1):0;if(u.repeat>0&&h>=1){let x=h-m;w=xc(x)}let b=u.ease(w);u.yoyo&&m%2===1&&(b=1-b);for(let x of u.props)wc(u.target,x.key,x.from+(x.to-x.from)*b);u.scaleFrom&&u.scaleTo&&_c(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*b,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*b});try{(f=u.onUpdate)==null||f.call(u)}catch{}if(h>=y){s(u);try{(p=u.onComplete)==null||p.call(u)}catch{}}}},d=(c,f,p)=>{var x;let u=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),h=$g(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,y=f.yoyo===!0,m=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),b=[];for(let E of Object.keys(f)){if(m.has(E))continue;let A=f[E];typeof A=="number"&&b.push({key:E,from:Ug(c,E),to:A})}let g=Ec(c,f);return{target:c,startMs:Hi(),delayMs:v,durationMs:u,ease:h,props:b,scaleFrom:g.from,scaleTo:g.to,repeat:w,yoyo:y,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let p=d(c,f);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Hi())},resume:()=>{var h;if(!p.paused)return;let u=(h=p.pauseAtMs)!=null?h:Hi(),v=Hi()-u;p.startMs+=v,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(c,f,p){return l.set(c,f),l.to(c,p)},set(c,f){if(!c||!f)return;for(let u of Object.keys(f)){let v=f[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof v=="number"&&wc(c,u,v)}let p=Ec(c,f);p.to&&_c(c,p.to)},killTweensOf(c){let f=t.get(c);if(f)for(let p of Array.from(f))s(p)},timeline(c={}){let f=[],p=0,u=!1,v=[],h=m=>{if(typeof m=="number")return Math.max(0,m*1e3);let b=typeof m=="string"?m.trim():"";return b.startsWith("+=")?p+Math.max(0,Number(b.slice(2))*1e3||0):b?Math.max(0,Number(b)*1e3||0):p},w=m=>{f.push(m);let b=Math.max(0,(typeof m.vars.duration=="number"?m.vars.duration:.5)*1e3);p=Math.max(p,m.atMs+b)},y={to(m,b,g){return w({kind:"to",target:m,vars:b,atMs:h(g)}),y},fromTo(m,b,g,x){return w({kind:"fromTo",target:m,vars:g,from:b,atMs:h(x)}),y},play(){var m,b;if(u)return y;u=!0,v=[];for(let g of f)g.kind==="fromTo"&&l.set(g.target,(m=g.from)!=null?m:{}),v.push(l.to(g.target,{...g.vars,delay:g.atMs/1e3+((b=g.vars.delay)!=null?b:0)}));return y},pause(){for(let m of v)m.pause();return y},kill(){for(let m of v)m.kill();v=[],u=!1}};return c.paused||y.play(),y}};return l}function Ac(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=Sc()}catch{}}var Cc={name:"handler-playable-sdk",version:"0.3.21",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var he=0,Wg=he++,Tc=he++,kc=he++,Lc=he++,Rc=he++,Mc=he++,Oc=he++,Ic=he++,Pc=he++,jc=he++,Dc=he++,zc=he++,H=Wg;function Fc(){return H===Tc}function Bc(){return H===kc}function Hc(){return H===Lc}function Nc(){return H===Rc}function Jt(){return H===Mc}function Qt(){return H===Oc}function $c(){return H===Ic}function Uc(){return H===Pc}function qc(){return H===jc}function ba(){return H===Dc}function ya(){return H===zc}function Gc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),H=Tc;return}catch{}else if(e==="dapi")try{dapi.isReady(),H=kc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=Lc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(H=Rc)}catch{}else if(t==="mintegral")window.gameReady&&(H=Mc);else if(t==="tapjoy")window.TJ_API&&(H=Oc);else if(t==="tiktok")window.openAppStore&&(H=Ic);else if(t==="smadex")try{window.smxTracking&&(H=Pc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(H=jc)}catch{}else t==="vungle"?H=Dc:(e==="nucleo"||t==="nucleo")&&(H=zc)}var Wn=Ge(require("lottie-web"),1),Wc=Wn.default;typeof window!="undefined"&&(window.lottie=Wn.default,window.__baseLottie=Wn.default);var Yg=require("pixi.js");var va=require("pixi.js");var Vg=null;function xa(e){Vg=e}Yn();wa();var Ni=require("pixi.js");Yn();var em=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Aa=em;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(Aa=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Aa}`))}}catch{}var Mt=class{static async create(t,i,n){var d,l,c,f,p,u,v;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${Aa}`);let r=(d=i==null?void 0:i.render)==null?void 0:d.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new Ni.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(l=i==null?void 0:i.identity)==null?void 0:l.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Rt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new Ni.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((u=s.constructor)==null?void 0:u.name)==="Container"||s instanceof Ni.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],w=!1;for(let y of h)try{let m=await fetch(y);if(m.ok){o=await m.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",y,"type:",(v=o==null?void 0:o.constructor)==null?void 0:v.name),w=!0;break}}catch{continue}w||(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,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var $i=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var nm=Ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=nm);Ui();var Xn=require("pixi.js");Ui();var Ta=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new $i}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let d=await Mt.create(a,s,this.app);this.instanceCache.set(a,d),console.log("[Assets] Loaded object:",a,(o=d==null?void 0:d.constructor)==null?void 0:o.name)}catch(d){console.error("[Assets] Failed to load object:",a,d)}})))};return this.readyPromise=(async()=>{await n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await Mt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},am=new Ta,sm=new Proxy(am,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});Ui();var Kc=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},Zn={scale:1,position:1},La=[];function cm(e,t,i,n,r,a,s){La.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function dm(){La.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function ka(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),Zn.scale=Xe.scaleFactor,Zn.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Zn.scale.toFixed(3)}`),dm()}var Gi={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 um(e,t,i){let n=Gi[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function pm(){return Gi}var fm={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 Kn(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Jn(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:Kn(e[0],t.x),y:Kn(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:Kn(n.x,t.x),y:Kn(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=fm[n])!=null?i:t}return t}function Zc(e,t,i,n={}){var u,v,h,w,y,m;let r=Jn(i),a=(u=n.inset)!=null?u:{},s=(v=n.padding)!=null?v:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,d=((w=a.right)!=null?w:0)+s.x,l=((y=a.top)!=null?y:0)+s.y,c=((m=a.bottom)!=null?m:0)+s.y,f=Math.max(0,e-o-d),p=Math.max(0,t-l-c);return{x:o+f*r.x,y:l+p*r.y}}function Jc(e,t,i,n={}){var h,w,y,m,b,g;let r=(h=n.inset)!=null?h:{},a=(w=n.padding)!=null?w:{x:0,y:0},s=((y=r.left)!=null?y:0)+a.x,o=((m=r.right)!=null?m:0)+a.x,d=((b=r.top)!=null?b:0)+a.y,l=((g=r.bottom)!=null?g:0)+a.y,c=Math.max(0,e-s-o),f=Math.max(0,t-d-l),p=Jn(i,{x:.5,y:.5}),u=Math.min(Math.max(p.x,0),1),v=Math.min(Math.max(p.y,0),1);return{x:s+c*u,y:d+f*v}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,ka(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),ka(window.innerWidth,window.innerHeight),window.updateDebugConfig=um,window.getDebugConfig=pm,window.copyConfig=Sm,window.applyConfig=qi,window.applyConfigForRatio=Am,window.positionAtBottom=Qc,window.positionAtTop=mm,window.positionAtCenter=bm,window.positionAtLeft=ym,window.positionAtRight=vm,window.positionAtBottomLeft=xm,window.positionAtBottomRight=wm,window.positionAtTopLeft=_m,window.positionAtTopRight=Em,window.applyPositionContract=gm,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 Qn(e,t,i=0){return e*t+i}function er(e,t,i=0){return e*(1-t)+i}function tr(e,t,i=0){return e*t+i}function ir(e,t,i=0){return e*(1-t)+i}function ge(e,t=0){return e/2+t}function hm(e,t){return e*t}function gm(e,t,i,n){var s,o,d,l,c,f,p,u,v,h,w,y,m,b,g,x,E,A,C,T;let r=0,a=0;switch(n.type){case"top":r=ge(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=Qn(i,n.percent,(l=(d=n.offset)==null?void 0:d.y)!=null?l:0);break;case"bottom":r=ge(t,(f=(c=n.offset)==null?void 0:c.x)!=null?f:0),a=er(i,n.percent,(u=(p=n.offset)==null?void 0:p.y)!=null?u:0);break;case"left":r=tr(t,n.percent,(h=(v=n.offset)==null?void 0:v.x)!=null?h:0),a=ge(i,(y=(w=n.offset)==null?void 0:w.y)!=null?y:0);break;case"right":r=ir(t,n.percent,(b=(m=n.offset)==null?void 0:m.x)!=null?b:0),a=ge(i,(x=(g=n.offset)==null?void 0:g.y)!=null?x:0);break;case"center":r=ge(t,(A=(E=n.offset)==null?void 0:E.x)!=null?A:0),a=ge(i,(T=(C=n.offset)==null?void 0:C.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function Qc(e,t,i,n=.2,r=1,a=!0,s=!1){let o=hm(i,n),d=er(i,n/2);Ke(e,ge(t),d);let l=a?r*Xe.scaleFactor:r;Ze(e,l),s&&!La.find(c=>c.element===e)&&cm(e,Qc,t,i,n,r,a)}function mm(e,t,i,n=.1,r=1){Ke(e,ge(t),Qn(i,n)),Ze(e,r)}function bm(e,t,i,n=0,r=0,a=1){Ke(e,ge(t,n),ge(i,r)),Ze(e,a)}function ym(e,t,i,n=.1,r=1){Ke(e,tr(t,n),ge(i)),Ze(e,r)}function vm(e,t,i,n=.1,r=1){Ke(e,ir(t,n),ge(i)),Ze(e,r)}function xm(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),er(i,n)),Ze(e,a)}function wm(e,t,i,n=.05,r=.05,a=1){Ke(e,ir(t,r),er(i,n)),Ze(e,a)}function _m(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),Qn(i,n)),Ze(e,a)}function Em(e,t,i,n=.05,r=.05,a=1){Ke(e,ir(t,r),Qn(i,n)),Ze(e,a)}function Ke(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Ze(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Ot={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 Sm(e){return e&&Ot[e]?JSON.parse(JSON.stringify(Ot[e])):JSON.parse(JSON.stringify(Gi))}function qi(e){Object.keys(e).forEach(t=>{let i=t;Gi[i]&&e[i]&&Object.assign(Gi[i],e[i])}),console.log("Config applied:",e)}function Am(e,t){let i=e/t;i>1.6?(qi(Ot.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(qi(Ot.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(qi(Ot.square),console.log("Applied SQUARE config for ratio:",i)):(qi(Ot.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Ot,e.resolveAnchorVec2=e.resolveAnchorVec2||Jn,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Zc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||Jc}Oa();function G(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var B_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],H_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],N_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],nd=[{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:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var $_=[...nd];var Im=nd[0];pt();var yw=Ge(mh(),1);function gw(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function mw(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function bw(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function Eo(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await gw(r),s=await bw(a),o=mw(a);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:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Vr(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,p)=>{let u=new Image;u.onload=()=>f(u),u.onerror=()=>p(new Error("Failed to load image")),u.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let p=s[f],u=s[f+1],v=s[f+2],h=!1;for(let w of d)if(Math.sqrt(Math.pow(p-w.r,2)+Math.pow(u-w.g,2)+Math.pow(v-w.b,2))<t){h=!0;break}h&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}var bh=require("@google/genai");async function So(e,t,i=[],n={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let y=0;y<i.length;y++){let m=i[y];if(!m.base64||!m.mimeType)throw new Error(`Image ${y+1} is missing required data`);if(m.base64.length<1e3&&console.warn(`Image ${y+1} data appears very small, may be corrupted`),!m.mimeType.startsWith("image/"))throw new Error(`Image ${y+1} has invalid MIME type: ${m.mimeType}`)}let f=new bh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",u=[t];i.length>0&&i.forEach((y,m)=>{u.push({inlineData:{data:y.base64,mimeType:y.mimeType}}),console.log(`[Gemini] Added image ${m+1}: ${y.mimeType}, size: ${Math.round(y.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:p,contents:u}),h="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let y of w)y.text&&(h+=y.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var yh=require("@google/genai");async function Xr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new yh.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.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 r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});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,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var vw=require("pixi.js");Ui();pt();var xh=require("pixi.js");var xw=require("pixi.js");pt();function Tw(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function kw(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}function Lw(e){return`
|
|
48
48
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
49
49
|
|
|
50
50
|
Provide a concise summary (2-3 sentences) covering:
|