handler-playable-sdk 0.4.47 → 0.4.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-I7YTZ5BO.js → chunk-ZL7BSSGC.js} +1 -1
- package/dist/cli/brand-dna.mjs +1 -1
- package/dist/cli/canva-import.mjs +1 -1
- package/dist/cli/cleanup-assets.mjs +1 -1
- package/dist/cli/fix-scales.mjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/screen-helper.mjs +1 -1
- package/dist/cli/setup-library.mjs +1 -1
- package/dist/cli/student-helper.mjs +1 -1
- package/dist/cli/sync-screens.mjs +1 -1
- package/dist/cli/validate-assets.mjs +1 -1
- package/dist/cli/validate.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +1 -1
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +1 -1
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};ht(pl,{COLORS:()=>ce,ConfigWatcher:()=>ze,DebugPanel:()=>Ot,DefaultReloadStrategy:()=>St,Handler:()=>ie,PlayableLoadingScreen:()=>Ui,PreviewShell:()=>Hi,STROKE_WIDTH:()=>mo,THEME:()=>bo,applyConfigOverride:()=>Se,applyConfigOverrides:()=>Ce,applyConfigsToDisk:()=>ri,applyDefaults:()=>$e,baseLottie:()=>rn,bootstrap:()=>el,clearConfigOverrides:()=>se,clearConfigOverridesForObject:()=>xr,configOverrideManager:()=>wr,createPreviewShell:()=>pa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>ui,deviceGroups:()=>Mn,devicePresets:()=>Pn,diffConfigs:()=>Sn,exportConfigsAsJSON:()=>De,getConfigOverrides:()=>Y,getConfigStateSummary:()=>ai,getOverrideMode:()=>wt,getPresetById:()=>Ne,getPresetsByCategory:()=>Os,loadAllObjectConfigs:()=>li,loadComponentSchemas:()=>si,loadEngineConfig:()=>ci,loadGamePromptConfig:()=>wn,loadObjectCentricConfig:()=>be,loadObjectConfig:()=>Te,loadSceneConfig:()=>di,rehydrateObject:()=>Cn,removeConfigOverride:()=>ni,resetToApplied:()=>Et,resetToOriginal:()=>oi,setBootstrapDependencies:()=>Zs,setOverrideMode:()=>yn,setupHotReload:()=>kn,setupLiveEditBridge:()=>Bi,toLegacyFormat:()=>En,validateObjectConfig:()=>Ze});module.exports=zo(pl);var we={};function Ut(n,e,t=!1){we[n]||(we[n]=[]),we[n].push({fn:e,once:t})}function en(n,e){if(we[n]){if(!e){delete we[n];return}we[n]=we[n].filter(t=>t.fn!==e)}}function Gt(n,...e){let t=we[n];if(t)for(let i of[...t])i.fn(...e),i.once&&en(n,i.fn)}function X(n,e){Ut(n,e,!0)}var F=null,ee=[],We=null;function Pa(n){F=n,ee=[],We!==null&&(clearTimeout(We),We=null)}function Ma(){var n,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(n=F==null?void 0:F.batchSize)!=null?n:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function ka(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function tn(n,e){let t=Ma();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let n=Ma();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await ka(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await ka(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Oa(n){return Math.max(0,Math.min(1,n))}function No(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ft(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ho(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Ia(n,e,t){try{n[e]=t}catch{}}function Bo(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ja(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Ra(n,e){let t=Bo(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Da(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),n.size>0&&i()})},a=p=>{var u;n.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),i()},r=p=>{n.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var d,u;let p=ft();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=p-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,f=Oa(h),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let w=h-y;f=Oa(w)}let v=g.ease(f);g.yoyo&&y%2===1&&(v=1-v);for(let w of g.props)Ia(g.target,w.key,w.from+(w.to-w.from)*v);g.scaleFrom&&g.scaleTo&&ja(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(h>=b){o(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var w;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),m=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((w=u==null?void 0:u.delayMsOverride)!=null?w:0)),h=No(d.ease),f=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(d)){if(y.has(E))continue;let C=d[E];typeof C=="number"&&v.push({key:E,from:Ho(p,E),to:C})}let x=Ra(p,d);return{target:p,startMs:ft(),delayMs:m,durationMs:g,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:f,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>o(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ft())},resume:()=>{var h;if(!u.paused)return;let g=(h=u.pauseAtMs)!=null?h:ft(),m=ft()-g;u.startMs+=m,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let m=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Ia(p,g,m)}let u=Ra(p,d);u.to&&ja(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))o(u)},timeline(p={}){let d=[],u=0,g=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},f=y=>{d.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return f({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return f({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(g)return b;g=!0,m=[];for(let x of d)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=[],g=!1}};return p.paused||b.play(),b}};return c}function $a(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Da()}catch{}}var za={name:"handler-playable-sdk",version:"0.4.47",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Uo=J++,Na=J++,Ha=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,Va=J++,Wa=J++,Ya=J++,Ka=J++,H=Uo;function Xa(){return H===Na}function Ja(){return H===Ha}function Za(){return H===Ba}function Qa(){return H===Fa}function Ye(){return H===Ua}function Ke(){return H===Ga}function er(){return H===qa}function tr(){return H===Va}function ir(){return H===Wa}function nn(){return H===Ya}function an(){return H===Ka}function nr(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),H=Na;return}catch{}else if(n==="dapi")try{dapi.isReady(),H=Ha;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=Ba)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=Fa)}catch{}else if(e==="mintegral")window.gameReady&&(H=Ua);else if(e==="tapjoy")window.TJ_API&&(H=Ga);else if(e==="tiktok")window.openAppStore&&(H=qa);else if(e==="smadex")try{window.smxTracking&&(H=Va)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Wa)}catch{}else e==="vungle"?H=Ya:(n==="nucleo"||e==="nucleo")&&(H=Ka)}var qt=Ve(require("lottie-web"),1),rn=qt.default;typeof window!="undefined"&&(window.lottie=qt.default,window.__baseLottie=qt.default);var Go=require("pixi.js");var on=require("pixi.js");var qo=null;function sn(n){qo=n}Vt();ln();var mt=require("pixi.js");Vt();var Jo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=Jo;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}function Zo(n){var t,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(n);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(n))return{x:(t=n[0])!=null?t:.5,y:(i=n[1])!=null?i:.5};if(n&&typeof n=="object"&&"x"in n&&"y"in n)return{x:(a=n.x)!=null?a:.5,y:(r=n.y)!=null?r:.5};if(typeof n=="string"){let s=n.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,t,i){var l,c,p,d,u,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new mt.Container;return this.applyTransform(h,t==null?void 0:t.transform,t),h}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await je.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new mt.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(d=s==null?void 0:s.constructor)==null?void 0:d.name),this.applyTransform(s,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name,o),o&&(((g=o.constructor)==null?void 0:g.name)==="Container"||o instanceof mt.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],f=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=s==null?void 0:s.constructor)==null?void 0:m.name),f=!0;break}}catch{continue}f||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,t==null?void 0:t.transform,t);return s}static applyTransform(e,t,i){var a,r,o,s;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=t.position.x)!=null?o:0,(s=t.position.y)!=null?s:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Zo(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var bt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var ts=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=ts);Xe();var Wt=require("pixi.js");Xe();var fn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new bt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Ae.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},is=new fn,ns=new Proxy(is,{get(n,e){if(e in n&&typeof n[e]=="function")return n[e].bind(n);if(n.get(e))return n.get(e)}});Xe();var cr=require("pixi.js"),he={width:400,height:600,designWidth:400,scaleFactor:1},Kt={scale:1,position:1},bn=[];function rs(n,e,t,i,a,r,o){bn.push({element:n,originalScale:r,positionHelper:e,heightPercent:a}),e(n,t,i,a,r,o,!1)}function os(){bn.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*he.scaleFactor;t(n,he.width,he.height,i,a,!0,!1)})}function mn(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),he.width=n,he.height=e,he.scaleFactor=Math.min(n/he.designWidth,1.15),Kt.scale=he.scaleFactor,Kt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Kt.scale.toFixed(3)}`),os()}var vt={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 ss(n,e,t){let i=vt[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ls(){return vt}var cs={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 Yt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Xt(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Yt(n[0],e.x),y:Yt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Yt(i.x,e.x),y:Yt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=cs[i])!=null?t:e}return e}function dr(n,e,t,i={}){var g,m,h,f,b,y;let a=Xt(t),r=(g=i.inset)!=null?g:{},o=(m=i.padding)!=null?m:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((f=r.right)!=null?f:0)+o.x,c=((b=r.top)!=null?b:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,d=Math.max(0,n-s-l),u=Math.max(0,e-c-p);return{x:s+d*a.x,y:c+u*a.y}}function pr(n,e,t,i={}){var h,f,b,y,v,x;let a=(h=i.inset)!=null?h:{},r=(f=i.padding)!=null?f:{x:0,y:0},o=((b=a.left)!=null?b:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,p=Math.max(0,n-o-s),d=Math.max(0,e-l-c),u=Xt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),m=Math.min(Math.max(u.y,0),1);return{x:o+p*g,y:l+d*m}}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,mn(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),mn(window.innerWidth,window.innerHeight),window.updateDebugConfig=ss,window.getDebugConfig=ls,window.copyConfig=xs,window.applyConfig=yt,window.applyConfigForRatio=ws,window.positionAtBottom=ur,window.positionAtTop=us,window.positionAtCenter=gs,window.positionAtLeft=hs,window.positionAtRight=fs,window.positionAtBottomLeft=ms,window.positionAtBottomRight=bs,window.positionAtTopLeft=ys,window.positionAtTopRight=vs,window.applyPositionContract=ps,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 Jt(n,e,t=0){return n*e+t}function Zt(n,e,t=0){return n*(1-e)+t}function Qt(n,e,t=0){return n*e+t}function ei(n,e,t=0){return n*(1-e)+t}function Z(n,e=0){return n/2+e}function ds(n,e){return n*e}function ps(n,e,t,i){var o,s,l,c,p,d,u,g,m,h,f,b,y,v,x,w,E,C,A,M;let a=0,r=0;switch(i.type){case"top":a=Z(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Jt(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(d=(p=i.offset)==null?void 0:p.x)!=null?d:0),r=Zt(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Qt(e,i.percent,(h=(m=i.offset)==null?void 0:m.x)!=null?h:0),r=Z(t,(b=(f=i.offset)==null?void 0:f.y)!=null?b:0);break;case"right":a=ei(e,i.percent,(v=(y=i.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(w=(x=i.offset)==null?void 0:x.y)!=null?w:0);break;case"center":a=Z(e,(C=(E=i.offset)==null?void 0:E.x)!=null?C:0),r=Z(t,(M=(A=i.offset)==null?void 0:A.y)!=null?M:0);break}n.position?n.position.set(a,r):(n.x=a,n.y=r),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ur(n,e,t,i=.2,a=1,r=!0,o=!1){let s=ds(t,i),l=Zt(t,i/2);fe(n,Z(e),l);let c=r?a*he.scaleFactor:a;me(n,c),o&&!bn.find(p=>p.element===n)&&rs(n,ur,e,t,i,a,r)}function us(n,e,t,i=.1,a=1){fe(n,Z(e),Jt(t,i)),me(n,a)}function gs(n,e,t,i=0,a=0,r=1){fe(n,Z(e,i),Z(t,a)),me(n,r)}function hs(n,e,t,i=.1,a=1){fe(n,Qt(e,i),Z(t)),me(n,a)}function fs(n,e,t,i=.1,a=1){fe(n,ei(e,i),Z(t)),me(n,a)}function ms(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Zt(t,i)),me(n,r)}function bs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Zt(t,i)),me(n,r)}function ys(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Jt(t,i)),me(n,r)}function vs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Jt(t,i)),me(n,r)}function fe(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function me(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var Re={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function xs(n){return n&&Re[n]?JSON.parse(JSON.stringify(Re[n])):JSON.parse(JSON.stringify(vt))}function yt(n){Object.keys(n).forEach(e=>{let t=e;vt[t]&&n[t]&&Object.assign(vt[t],n[t])}),console.log("Config applied:",n)}function ws(n,e){let t=n/e;t>1.6?(yt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(yt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(yt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(yt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=Re,n.resolveAnchorVec2=n.resolveAnchorVec2||Xt,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||dr,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||pr}pi();function U(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var Nc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Hc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Pn=[..._n],Mn=[{category:"playable",label:"Playable Ad",devices:_n}],ui=_n[0];function Ne(n){return Pn.find(e=>e.id===n)||ui}function Os(n){return Pn.filter(e=>e.category===n)}var gi=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};ht(pl,{COLORS:()=>ce,ConfigWatcher:()=>ze,DebugPanel:()=>Ot,DefaultReloadStrategy:()=>St,Handler:()=>ie,PlayableLoadingScreen:()=>Ui,PreviewShell:()=>Hi,STROKE_WIDTH:()=>mo,THEME:()=>bo,applyConfigOverride:()=>Se,applyConfigOverrides:()=>Ce,applyConfigsToDisk:()=>ri,applyDefaults:()=>$e,baseLottie:()=>rn,bootstrap:()=>el,clearConfigOverrides:()=>se,clearConfigOverridesForObject:()=>xr,configOverrideManager:()=>wr,createPreviewShell:()=>pa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>ui,deviceGroups:()=>Mn,devicePresets:()=>Pn,diffConfigs:()=>Sn,exportConfigsAsJSON:()=>De,getConfigOverrides:()=>Y,getConfigStateSummary:()=>ai,getOverrideMode:()=>wt,getPresetById:()=>Ne,getPresetsByCategory:()=>Os,loadAllObjectConfigs:()=>li,loadComponentSchemas:()=>si,loadEngineConfig:()=>ci,loadGamePromptConfig:()=>wn,loadObjectCentricConfig:()=>be,loadObjectConfig:()=>Te,loadSceneConfig:()=>di,rehydrateObject:()=>Cn,removeConfigOverride:()=>ni,resetToApplied:()=>Et,resetToOriginal:()=>oi,setBootstrapDependencies:()=>Zs,setOverrideMode:()=>yn,setupHotReload:()=>kn,setupLiveEditBridge:()=>Bi,toLegacyFormat:()=>En,validateObjectConfig:()=>Ze});module.exports=zo(pl);var we={};function Ut(n,e,t=!1){we[n]||(we[n]=[]),we[n].push({fn:e,once:t})}function en(n,e){if(we[n]){if(!e){delete we[n];return}we[n]=we[n].filter(t=>t.fn!==e)}}function Gt(n,...e){let t=we[n];if(t)for(let i of[...t])i.fn(...e),i.once&&en(n,i.fn)}function X(n,e){Ut(n,e,!0)}var F=null,ee=[],We=null;function Pa(n){F=n,ee=[],We!==null&&(clearTimeout(We),We=null)}function Ma(){var n,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(n=F==null?void 0:F.batchSize)!=null?n:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function ka(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function tn(n,e){let t=Ma();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let n=Ma();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await ka(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await ka(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Oa(n){return Math.max(0,Math.min(1,n))}function No(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ft(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ho(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Ia(n,e,t){try{n[e]=t}catch{}}function Bo(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ja(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Ra(n,e){let t=Bo(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Da(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),n.size>0&&i()})},a=p=>{var u;n.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),i()},r=p=>{n.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var d,u;let p=ft();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=p-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,f=Oa(h),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let w=h-y;f=Oa(w)}let v=g.ease(f);g.yoyo&&y%2===1&&(v=1-v);for(let w of g.props)Ia(g.target,w.key,w.from+(w.to-w.from)*v);g.scaleFrom&&g.scaleTo&&ja(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(h>=b){o(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var w;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),m=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((w=u==null?void 0:u.delayMsOverride)!=null?w:0)),h=No(d.ease),f=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(d)){if(y.has(E))continue;let C=d[E];typeof C=="number"&&v.push({key:E,from:Ho(p,E),to:C})}let x=Ra(p,d);return{target:p,startMs:ft(),delayMs:m,durationMs:g,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:f,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>o(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ft())},resume:()=>{var h;if(!u.paused)return;let g=(h=u.pauseAtMs)!=null?h:ft(),m=ft()-g;u.startMs+=m,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let m=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Ia(p,g,m)}let u=Ra(p,d);u.to&&ja(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))o(u)},timeline(p={}){let d=[],u=0,g=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},f=y=>{d.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return f({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return f({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(g)return b;g=!0,m=[];for(let x of d)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=[],g=!1}};return p.paused||b.play(),b}};return c}function $a(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Da()}catch{}}var za={name:"handler-playable-sdk",version:"0.4.49",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Uo=J++,Na=J++,Ha=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,Va=J++,Wa=J++,Ya=J++,Ka=J++,H=Uo;function Xa(){return H===Na}function Ja(){return H===Ha}function Za(){return H===Ba}function Qa(){return H===Fa}function Ye(){return H===Ua}function Ke(){return H===Ga}function er(){return H===qa}function tr(){return H===Va}function ir(){return H===Wa}function nn(){return H===Ya}function an(){return H===Ka}function nr(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),H=Na;return}catch{}else if(n==="dapi")try{dapi.isReady(),H=Ha;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=Ba)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=Fa)}catch{}else if(e==="mintegral")window.gameReady&&(H=Ua);else if(e==="tapjoy")window.TJ_API&&(H=Ga);else if(e==="tiktok")window.openAppStore&&(H=qa);else if(e==="smadex")try{window.smxTracking&&(H=Va)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Wa)}catch{}else e==="vungle"?H=Ya:(n==="nucleo"||e==="nucleo")&&(H=Ka)}var qt=Ve(require("lottie-web"),1),rn=qt.default;typeof window!="undefined"&&(window.lottie=qt.default,window.__baseLottie=qt.default);var Go=require("pixi.js");var on=require("pixi.js");var qo=null;function sn(n){qo=n}Vt();ln();var mt=require("pixi.js");Vt();var Jo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=Jo;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}function Zo(n){var t,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(n);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(n))return{x:(t=n[0])!=null?t:.5,y:(i=n[1])!=null?i:.5};if(n&&typeof n=="object"&&"x"in n&&"y"in n)return{x:(a=n.x)!=null?a:.5,y:(r=n.y)!=null?r:.5};if(typeof n=="string"){let s=n.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,t,i){var l,c,p,d,u,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new mt.Container;return this.applyTransform(h,t==null?void 0:t.transform,t),h}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await je.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new mt.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(d=s==null?void 0:s.constructor)==null?void 0:d.name),this.applyTransform(s,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name,o),o&&(((g=o.constructor)==null?void 0:g.name)==="Container"||o instanceof mt.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],f=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=s==null?void 0:s.constructor)==null?void 0:m.name),f=!0;break}}catch{continue}f||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,t==null?void 0:t.transform,t);return s}static applyTransform(e,t,i){var a,r,o,s;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=t.position.x)!=null?o:0,(s=t.position.y)!=null?s:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Zo(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var bt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var ts=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=ts);Xe();var Wt=require("pixi.js");Xe();var fn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new bt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Ae.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},is=new fn,ns=new Proxy(is,{get(n,e){if(e in n&&typeof n[e]=="function")return n[e].bind(n);if(n.get(e))return n.get(e)}});Xe();var cr=require("pixi.js"),he={width:400,height:600,designWidth:400,scaleFactor:1},Kt={scale:1,position:1},bn=[];function rs(n,e,t,i,a,r,o){bn.push({element:n,originalScale:r,positionHelper:e,heightPercent:a}),e(n,t,i,a,r,o,!1)}function os(){bn.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*he.scaleFactor;t(n,he.width,he.height,i,a,!0,!1)})}function mn(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),he.width=n,he.height=e,he.scaleFactor=Math.min(n/he.designWidth,1.15),Kt.scale=he.scaleFactor,Kt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Kt.scale.toFixed(3)}`),os()}var vt={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 ss(n,e,t){let i=vt[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ls(){return vt}var cs={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 Yt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Xt(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Yt(n[0],e.x),y:Yt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Yt(i.x,e.x),y:Yt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=cs[i])!=null?t:e}return e}function dr(n,e,t,i={}){var g,m,h,f,b,y;let a=Xt(t),r=(g=i.inset)!=null?g:{},o=(m=i.padding)!=null?m:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((f=r.right)!=null?f:0)+o.x,c=((b=r.top)!=null?b:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,d=Math.max(0,n-s-l),u=Math.max(0,e-c-p);return{x:s+d*a.x,y:c+u*a.y}}function pr(n,e,t,i={}){var h,f,b,y,v,x;let a=(h=i.inset)!=null?h:{},r=(f=i.padding)!=null?f:{x:0,y:0},o=((b=a.left)!=null?b:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,p=Math.max(0,n-o-s),d=Math.max(0,e-l-c),u=Xt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),m=Math.min(Math.max(u.y,0),1);return{x:o+p*g,y:l+d*m}}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,mn(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),mn(window.innerWidth,window.innerHeight),window.updateDebugConfig=ss,window.getDebugConfig=ls,window.copyConfig=xs,window.applyConfig=yt,window.applyConfigForRatio=ws,window.positionAtBottom=ur,window.positionAtTop=us,window.positionAtCenter=gs,window.positionAtLeft=hs,window.positionAtRight=fs,window.positionAtBottomLeft=ms,window.positionAtBottomRight=bs,window.positionAtTopLeft=ys,window.positionAtTopRight=vs,window.applyPositionContract=ps,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 Jt(n,e,t=0){return n*e+t}function Zt(n,e,t=0){return n*(1-e)+t}function Qt(n,e,t=0){return n*e+t}function ei(n,e,t=0){return n*(1-e)+t}function Z(n,e=0){return n/2+e}function ds(n,e){return n*e}function ps(n,e,t,i){var o,s,l,c,p,d,u,g,m,h,f,b,y,v,x,w,E,C,A,M;let a=0,r=0;switch(i.type){case"top":a=Z(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Jt(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(d=(p=i.offset)==null?void 0:p.x)!=null?d:0),r=Zt(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Qt(e,i.percent,(h=(m=i.offset)==null?void 0:m.x)!=null?h:0),r=Z(t,(b=(f=i.offset)==null?void 0:f.y)!=null?b:0);break;case"right":a=ei(e,i.percent,(v=(y=i.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(w=(x=i.offset)==null?void 0:x.y)!=null?w:0);break;case"center":a=Z(e,(C=(E=i.offset)==null?void 0:E.x)!=null?C:0),r=Z(t,(M=(A=i.offset)==null?void 0:A.y)!=null?M:0);break}n.position?n.position.set(a,r):(n.x=a,n.y=r),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ur(n,e,t,i=.2,a=1,r=!0,o=!1){let s=ds(t,i),l=Zt(t,i/2);fe(n,Z(e),l);let c=r?a*he.scaleFactor:a;me(n,c),o&&!bn.find(p=>p.element===n)&&rs(n,ur,e,t,i,a,r)}function us(n,e,t,i=.1,a=1){fe(n,Z(e),Jt(t,i)),me(n,a)}function gs(n,e,t,i=0,a=0,r=1){fe(n,Z(e,i),Z(t,a)),me(n,r)}function hs(n,e,t,i=.1,a=1){fe(n,Qt(e,i),Z(t)),me(n,a)}function fs(n,e,t,i=.1,a=1){fe(n,ei(e,i),Z(t)),me(n,a)}function ms(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Zt(t,i)),me(n,r)}function bs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Zt(t,i)),me(n,r)}function ys(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Jt(t,i)),me(n,r)}function vs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Jt(t,i)),me(n,r)}function fe(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function me(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var Re={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function xs(n){return n&&Re[n]?JSON.parse(JSON.stringify(Re[n])):JSON.parse(JSON.stringify(vt))}function yt(n){Object.keys(n).forEach(e=>{let t=e;vt[t]&&n[t]&&Object.assign(vt[t],n[t])}),console.log("Config applied:",n)}function ws(n,e){let t=n/e;t>1.6?(yt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(yt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(yt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(yt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=Re,n.resolveAnchorVec2=n.resolveAnchorVec2||Xt,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||dr,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||pr}pi();function U(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var Nc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Hc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Pn=[..._n],Mn=[{category:"playable",label:"Playable Ad",devices:_n}],ui=_n[0];function Ne(n){return Pn.find(e=>e.id===n)||ui}function Os(n){return Pn.filter(e=>e.category===n)}var gi=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
47
47
|
<div class="scene-panel scene-objects panel-accent-teal" data-panel="scene-objects">
|
|
48
48
|
<div class="scene-panel-header" data-panel-handle>
|
|
49
49
|
<div class="panel-title">
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-
|
|
1
|
+
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-ZL7BSSGC.js";import"./chunk-I5OOVR5U.js";import{a as q,b as r,c as s,d as t,e as u,f as v,g as w,h as x,i as y,j as z,k as A,l as B,m as C,n as D,o as E}from"./chunk-LV4HGC5G.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk-ZLL42OOV.js";import"./chunk-E6WJCS24.js";import"./chunk-JXBG6UFL.js";export{Q as COLORS,B as ConfigWatcher,K as DebugPanel,A as DefaultReloadStrategy,U as Handler,T as PlayableLoadingScreen,L as PreviewShell,R as STROKE_WIDTH,S as THEME,d as applyConfigOverride,e as applyConfigOverrides,n as applyConfigsToDisk,x as applyDefaults,a as baseLottie,P as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,M as createPreviewShell,k as deepClone,V as default,H as defaultPreset,G as deviceGroups,F as devicePresets,C as diffConfigs,l as exportConfigsAsJSON,i as getConfigOverrides,m as getConfigStateSummary,b as getOverrideMode,I as getPresetById,J as getPresetsByCategory,s as loadAllObjectConfigs,q as loadComponentSchemas,t as loadEngineConfig,u as loadGamePromptConfig,y as loadObjectCentricConfig,r as loadObjectConfig,v as loadSceneConfig,D as rehydrateObject,h as removeConfigOverride,o as resetToApplied,p as resetToOriginal,O as setBootstrapDependencies,c as setOverrideMode,E as setupHotReload,N as setupLiveEditBridge,z as toLegacyFormat,w as validateObjectConfig};
|
package/dist/pixi/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Nr={};Vi(Nr,{AssetCache:()=>Q,AssetLoader:()=>he,AssetSystem:()=>It,AssetTextures:()=>fe,Assets:()=>pa,BaseSystem:()=>Ne,GameEngine:()=>Ot,GameObject:()=>st,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>He,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>sa,clearResponsiveElements:()=>ga,createPixiBase:()=>Pt,getRegisteredFontIds:()=>na,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>fa,playLottieOverlay:()=>ra,registerFont:()=>ia,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Nr);var Qn=require("pixi.js");var pe={};function mt(i,e,t=!1){pe[i]||(pe[i]=[]),pe[i].push({fn:e,once:t})}function Gt(i,e){if(pe[i]){if(!e){delete pe[i];return}pe[i]=pe[i].filter(t=>t.fn!==e)}}function bt(i,...e){let t=pe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&Gt(i,n.fn)}function q(i,e){mt(i,e,!0)}var D=null,Y=[],Te=null;function Xi(i){D=i,Y=[],Te!==null&&(clearTimeout(Te),Te=null)}function Ji(){var i,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(i=D==null?void 0:D.batchSize)!=null?i:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Yi(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(i,e){let t=Ji();if(e&&t.endpoint){if(Y.push(i),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Ki();return}Te===null&&(Te=window.setTimeout(()=>{Te=null,Ki()},t.flushIntervalMs))}}async function Ki(){let i=Ji();if(!i.endpoint||Y.length===0)return;let e=Y.splice(0,i.batchSize);await Yi(i.endpoint,{events:e},i.transport,i.debug),Y.length>0&&await Yi(i.endpoint,{events:Y.splice(0,i.batchSize)},i.transport,i.debug)}function Zi(i){return Math.max(0,Math.min(1,i))}function Aa(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Qi(i,e,t){try{i[e]=t}catch{}}function Ca(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function en(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function tn(i,e){let t=Ca(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function nn(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),i.size>0&&n()})},a=u=>{var p;i.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),n()},r=u=>{i.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},o=u=>{u.killed||(u.killed=!0,r(u))},s=()=>{var l,p;let u=Ke();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,A=Zi(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let y=f-h;A=Zi(y)}let x=g.ease(A);g.yoyo&&h%2===1&&(x=1-x);for(let y of g.props)Qi(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&en(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(f>=b){o(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(h.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=tn(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:f,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>o(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Qi(u,g,m)}let p=tn(u,l);p.to&&en(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))o(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=h=>{l.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+x)},b={to(h,x,w){return A({kind:"to",target:h,vars:x,atMs:f(w)}),b},fromTo(h,x,w,y){return A({kind:"fromTo",target:h,vars:w,from:x,atMs:f(y)}),b},play(){var h,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(h=w.from)!=null?h:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let h of m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function an(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=nn()}catch{}}var rn={name:"handler-playable-sdk",version:"0.4.47",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,La=V++,on=V++,sn=V++,ln=V++,cn=V++,dn=V++,pn=V++,un=V++,gn=V++,hn=V++,fn=V++,mn=V++,M=La;function bn(){return M===on}function yn(){return M===sn}function vn(){return M===ln}function xn(){return M===cn}function Le(){return M===dn}function ke(){return M===pn}function wn(){return M===un}function En(){return M===gn}function An(){return M===hn}function Vt(){return M===fn}function Wt(){return M===mn}function Sn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),M=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),M=sn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=ln)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=cn)}catch{}else if(e==="mintegral")window.gameReady&&(M=dn);else if(e==="tapjoy")window.TJ_API&&(M=pn);else if(e==="tiktok")window.openAppStore&&(M=un);else if(e==="smadex")try{window.smxTracking&&(M=gn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=hn)}catch{}else e==="vungle"?M=fn:(i==="nucleo"||e==="nucleo")&&(M=mn)}var yt=ft(require("lottie-web"),1),Cn=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var vo=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],xo=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],wo=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Eo=[..._n];var Ra=_n[0];ue();var Ba=ft(require("jszip"),1);function za(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Na(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Ha(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function Jt(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),o=await Ha(r),s=Na(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(t=o==null?void 0:o.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function vt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let r=a.getImageData(0,0,n.width,n.height),o=r.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(l=>({r:o[l.offset],g:o[l.offset+1],b:o[l.offset+2]})),c=0;for(let l=0;l<o.length;l+=4){let p=o[l],g=o[l+1],m=o[l+2],f=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){f=!0;break}f&&(o[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var Pn=require("@google/genai");async function Zt(i,e,t=[],n={}){var a,r,o,s,d,c,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let l=new Pn.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),f="",A=(o=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(A)for(let b of A)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(l){throw console.error("[Gemini] API error:",l),(s=l.message)!=null&&s.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Mn=require("@google/genai");async function xt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Mn.GoogleGenAI({apiKey:i}),r=[{text:e}];t.length>0&&t.forEach((s,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let d=s.inlineData.data,c=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $n=require("pixi.js");var Ya=require("pixi.js");ue();function tr(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function ir(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function nr(i){return`
|
|
46
|
+
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Nr={};Vi(Nr,{AssetCache:()=>Q,AssetLoader:()=>he,AssetSystem:()=>It,AssetTextures:()=>fe,Assets:()=>pa,BaseSystem:()=>Ne,GameEngine:()=>Ot,GameObject:()=>st,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>He,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>sa,clearResponsiveElements:()=>ga,createPixiBase:()=>Pt,getRegisteredFontIds:()=>na,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>fa,playLottieOverlay:()=>ra,registerFont:()=>ia,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Nr);var Qn=require("pixi.js");var pe={};function mt(i,e,t=!1){pe[i]||(pe[i]=[]),pe[i].push({fn:e,once:t})}function Gt(i,e){if(pe[i]){if(!e){delete pe[i];return}pe[i]=pe[i].filter(t=>t.fn!==e)}}function bt(i,...e){let t=pe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&Gt(i,n.fn)}function q(i,e){mt(i,e,!0)}var D=null,Y=[],Te=null;function Xi(i){D=i,Y=[],Te!==null&&(clearTimeout(Te),Te=null)}function Ji(){var i,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(i=D==null?void 0:D.batchSize)!=null?i:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Yi(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(i,e){let t=Ji();if(e&&t.endpoint){if(Y.push(i),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Ki();return}Te===null&&(Te=window.setTimeout(()=>{Te=null,Ki()},t.flushIntervalMs))}}async function Ki(){let i=Ji();if(!i.endpoint||Y.length===0)return;let e=Y.splice(0,i.batchSize);await Yi(i.endpoint,{events:e},i.transport,i.debug),Y.length>0&&await Yi(i.endpoint,{events:Y.splice(0,i.batchSize)},i.transport,i.debug)}function Zi(i){return Math.max(0,Math.min(1,i))}function Aa(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Qi(i,e,t){try{i[e]=t}catch{}}function Ca(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function en(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function tn(i,e){let t=Ca(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function nn(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),i.size>0&&n()})},a=u=>{var p;i.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),n()},r=u=>{i.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},o=u=>{u.killed||(u.killed=!0,r(u))},s=()=>{var l,p;let u=Ke();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,A=Zi(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let y=f-h;A=Zi(y)}let x=g.ease(A);g.yoyo&&h%2===1&&(x=1-x);for(let y of g.props)Qi(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&en(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(f>=b){o(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(h.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=tn(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:f,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>o(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Qi(u,g,m)}let p=tn(u,l);p.to&&en(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))o(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=h=>{l.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+x)},b={to(h,x,w){return A({kind:"to",target:h,vars:x,atMs:f(w)}),b},fromTo(h,x,w,y){return A({kind:"fromTo",target:h,vars:w,from:x,atMs:f(y)}),b},play(){var h,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(h=w.from)!=null?h:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let h of m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function an(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=nn()}catch{}}var rn={name:"handler-playable-sdk",version:"0.4.49",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,La=V++,on=V++,sn=V++,ln=V++,cn=V++,dn=V++,pn=V++,un=V++,gn=V++,hn=V++,fn=V++,mn=V++,M=La;function bn(){return M===on}function yn(){return M===sn}function vn(){return M===ln}function xn(){return M===cn}function Le(){return M===dn}function ke(){return M===pn}function wn(){return M===un}function En(){return M===gn}function An(){return M===hn}function Vt(){return M===fn}function Wt(){return M===mn}function Sn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),M=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),M=sn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=ln)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=cn)}catch{}else if(e==="mintegral")window.gameReady&&(M=dn);else if(e==="tapjoy")window.TJ_API&&(M=pn);else if(e==="tiktok")window.openAppStore&&(M=un);else if(e==="smadex")try{window.smxTracking&&(M=gn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=hn)}catch{}else e==="vungle"?M=fn:(i==="nucleo"||e==="nucleo")&&(M=mn)}var yt=ft(require("lottie-web"),1),Cn=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var vo=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],xo=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],wo=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Eo=[..._n];var Ra=_n[0];ue();var Ba=ft(require("jszip"),1);function za(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Na(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Ha(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function Jt(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),o=await Ha(r),s=Na(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(t=o==null?void 0:o.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function vt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let r=a.getImageData(0,0,n.width,n.height),o=r.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(l=>({r:o[l.offset],g:o[l.offset+1],b:o[l.offset+2]})),c=0;for(let l=0;l<o.length;l+=4){let p=o[l],g=o[l+1],m=o[l+2],f=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){f=!0;break}f&&(o[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var Pn=require("@google/genai");async function Zt(i,e,t=[],n={}){var a,r,o,s,d,c,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let l=new Pn.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),f="",A=(o=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(A)for(let b of A)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(l){throw console.error("[Gemini] API error:",l),(s=l.message)!=null&&s.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Mn=require("@google/genai");async function xt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Mn.GoogleGenAI({apiKey:i}),r=[{text:e}];t.length>0&&t.forEach((s,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let d=s.inlineData.data,c=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $n=require("pixi.js");var Ya=require("pixi.js");ue();function tr(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function ir(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function nr(i){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|
package/dist/pixi/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0xf3abe7,_0x2c5b88){var a0_0x3d99dc={_0x1d3dba:0x4d0,_0x590866:0x4c9,_0x343f83:0x4c4,_0x3e113a:0x15a,_0x870ab0:0x14e,_0x404545:0x155,_0x198b75:'9)wj',_0x37ee9c:0x153,_0x4e2dff:0x4cd,_0x2156c7:0x4d3,_0x47ef15:'$PWt',_0x43621c:0x4c3,_0x55f510:0x4be,_0x17dd51:'YHDv',_0x58cbe7:0x4c2,_0x153bb9:0x13c,_0x35dfc3:'LN$F',_0xf85109:0x123,_0x59005f:0x131,_0x4c7bc0:0x12f,_0x1f7c10:0x160,_0x3d54b3:0x15d,_0x30d30c:0x168,_0x189ac4:0x157,_0x5bafaa:0x154,_0x3a6f23:0x150,_0x13467a:0x4b6,_0x130418:0x4b4,_0x5904ca:'^Mfn',_0x57b7bf:0x4be,_0xe77566:0x4d7,_0x20c313:0x4d6,_0x25fea9:'^Mfn',_0x29930c:0x4d5,_0x28ee52:0x4c7,_0x36f5f6:0x4c8},a0_0x220371={_0x8eb9bb:0x2e7},a0_0x3fcfaf={_0x2e2108:0x32d},a0_0x433acb={_0x5e864d:0x2cc};function _0x2ed412(_0x596d37,_0x39ed3f,_0x419c3d,_0x47e03e,_0x38123b){return a0_0x1622(_0x38123b- -a0_0x433acb._0x5e864d,_0x39ed3f);}var _0xda40c7=_0xf3abe7();function _0x5db693(_0x24ff18,_0x1ae457,_0x592a28,_0x5cbf58,_0x597a02){return a0_0x1622(_0x597a02-a0_0x3fcfaf._0x2e2108,_0x5cbf58);}function _0x5cb090(_0x43961f,_0x31a219,_0x4a58f1,_0x1727a3,_0x12a0bb){return a0_0x1622(_0x31a219- -a0_0x220371._0x8eb9bb,_0x1727a3);}while(!![]){try{var _0x31f9b8=parseInt(_0x5db693(0x4cc,a0_0x3d99dc._0x1d3dba,a0_0x3d99dc._0x590866,'TNhr',a0_0x3d99dc._0x343f83))/(-0x1487+0x1f5*-0xa+-0xae*-0x3b)+parseInt(_0x5cb090(-a0_0x3d99dc._0x3e113a,-a0_0x3d99dc._0x870ab0,-a0_0x3d99dc._0x404545,a0_0x3d99dc._0x198b75,-a0_0x3d99dc._0x37ee9c))/(0x3e*0x3d+0x60*0x57+0x3*-0xfcc)*(parseInt(_0x5db693(a0_0x3d99dc._0x343f83,a0_0x3d99dc._0x4e2dff,a0_0x3d99dc._0x2156c7,a0_0x3d99dc._0x47ef15,0x4c7))/(0x1*-0x40f+0xd8d+-0x97b))+parseInt(_0x5db693(a0_0x3d99dc._0x43621c,a0_0x3d99dc._0x55f510,0x4c6,a0_0x3d99dc._0x17dd51,a0_0x3d99dc._0x58cbe7))/(-0x31a*-0x5+-0x1*0x296+-0x1d8*0x7)*(-parseInt(_0x2ed412(-a0_0x3d99dc._0x153bb9,a0_0x3d99dc._0x35dfc3,-a0_0x3d99dc._0xf85109,-a0_0x3d99dc._0x59005f,-a0_0x3d99dc._0x4c7bc0))/(-0x1*-0x26db+0x172*-0x15+0x21f*-0x4))+parseInt(_0x5cb090(-a0_0x3d99dc._0x1f7c10,-a0_0x3d99dc._0x3d54b3,-a0_0x3d99dc._0x30d30c,'Eh&J',-a0_0x3d99dc._0x189ac4))/(-0x1*0xa37+0xade+-0x17*0x7)+parseInt(_0x5cb090(-a0_0x3d99dc._0x870ab0,-0x157,-a0_0x3d99dc._0x5bafaa,'K8n$',-a0_0x3d99dc._0x3a6f23))/(0x4*-0x687+0x1be*-0xd+0x21f*0x17)+parseInt(_0x5db693(a0_0x3d99dc._0x13467a,0x4b5,a0_0x3d99dc._0x130418,a0_0x3d99dc._0x5904ca,0x4b6))/(0x12d7*-0x1+-0x8*0x26e+0x264f)+-parseInt(_0x5db693(a0_0x3d99dc._0x57b7bf,a0_0x3d99dc._0xe77566,a0_0x3d99dc._0x20c313,a0_0x3d99dc._0x25fea9,0x4cb))/(0x794*-0x2+-0x631+0x1*0x1562)*(parseInt(_0x5db693(a0_0x3d99dc._0x29930c,a0_0x3d99dc._0x2156c7,a0_0x3d99dc._0x28ee52,'zB3x',a0_0x3d99dc._0x36f5f6))/(0xb7b+-0x13a7+0x836*0x1));if(_0x31f9b8===_0x2c5b88)break;else _0xda40c7['push'](_0xda40c7['shift']());}catch(_0x3e4a79){_0xda40c7['push'](_0xda40c7['shift']());}}}(a0_0x26b7,-0xe1500+-0x77cb5+0x3*0x9b64e));var a0_0x2e64f7=(function(){var _0x321afe=!![];return function(_0x387edb,_0x519915){var a0_0x57bf9c={_0x78f70d:0x17d,_0x27e65b:0x174,_0x593a1a:'cZj2',_0xac0f2b:0x174,_0x27c80d:0x171},_0x408178=_0x321afe?function(){var a0_0x13ae73={_0x35f7e1:0x310};function _0x4d0268(_0x2cdaf1,_0x5f424a,_0x75ffc2,_0x5395d8,_0x2818ad){return a0_0x1622(_0x2818ad- -a0_0x13ae73._0x35f7e1,_0x75ffc2);}if(_0x519915){var _0x2dd60a=_0x519915[_0x4d0268(-a0_0x57bf9c._0x78f70d,-a0_0x57bf9c._0x27e65b,a0_0x57bf9c._0x593a1a,-a0_0x57bf9c._0xac0f2b,-a0_0x57bf9c._0x27c80d)](_0x387edb,arguments);return _0x519915=null,_0x2dd60a;}}:function(){};return _0x321afe=![],_0x408178;};}()),a0_0x158b41=a0_0x2e64f7(this,function(){var a0_0x3948fd={_0x431597:0x169,_0x51a206:0x15c,_0x355282:0x454,_0x1ac7fa:0x44c,_0x10151e:'ndIm',_0x1124fb:0x44e,_0x3cfdb1:0x445,_0xd63687:0x44f,_0x1e27f8:'JeE[',_0x5c597b:0x453,_0x3d0844:0x45a,_0x40edfe:0x45f,_0x1c35a2:'QFe4',_0x57e30f:0x167,_0x24c74d:0x15f,_0x4062e9:0x172,_0x266a4:0x162,_0x19993b:0x166,_0x5970e7:0x164,_0x4804bf:0x44e,_0x3a73ef:0x442,_0x2ad069:0x442,_0x29d5be:0x448},a0_0x1133ac={_0x58873d:0x2f4},a0_0x54d2ba={_0x171bc2:0x3ad};function _0x2b6495(_0xb1e6f1,_0x3fb7cc,_0x3e64e2,_0x124d64,_0x145225){return a0_0x1622(_0x145225- -a0_0x54d2ba._0x171bc2,_0x3e64e2);}function _0x156a66(_0x15430e,_0x559a32,_0x331d49,_0x53307c,_0x220149){return a0_0x1622(_0x331d49- -a0_0x1133ac._0x58873d,_0x559a32);}function _0x9190f1(_0x26c6c7,_0x44ee39,_0x4601c0,_0x4742e0,_0x3d4628){return a0_0x1622(_0x26c6c7-0x2b8,_0x4742e0);}return a0_0x158b41[_0x156a66(-0x164,'waW[',-0x165,-0x163,-0x161)+_0x156a66(-a0_0x3948fd._0x431597,'(P[0',-0x161,-a0_0x3948fd._0x51a206,-0x16b)]()[_0x9190f1(0x458,a0_0x3948fd._0x355282,a0_0x3948fd._0x1ac7fa,a0_0x3948fd._0x10151e,a0_0x3948fd._0x1124fb)+'h'](_0x9190f1(0x44c,a0_0x3948fd._0x3cfdb1,a0_0x3948fd._0xd63687,a0_0x3948fd._0x1e27f8,a0_0x3948fd._0x5c597b)+_0x9190f1(0x454,a0_0x3948fd._0x3d0844,a0_0x3948fd._0x40edfe,a0_0x3948fd._0x1c35a2,a0_0x3948fd._0xd63687)+'+$')[_0x156a66(-0x171,'V3Jr',-a0_0x3948fd._0x57e30f,-a0_0x3948fd._0x24c74d,-a0_0x3948fd._0x4062e9)+'ing']()['const'+_0x156a66(-a0_0x3948fd._0x266a4,'QFe4',-a0_0x3948fd._0x19993b,-a0_0x3948fd._0x431597,-a0_0x3948fd._0x5970e7)+'r'](a0_0x158b41)['searc'+'h'](_0x9190f1(a0_0x3948fd._0x4804bf,a0_0x3948fd._0x3a73ef,a0_0x3948fd._0x2ad069,'BvP&',a0_0x3948fd._0x29d5be)+')+)+)'+'+$');});function a0_0x1622(_0x493784,_0xdb1102){_0x493784=_0x493784-(-0x16f*-0x17+-0x1133+-0xe3e);var _0x3bc0c8=a0_0x26b7();var _0x2669e0=_0x3bc0c8[_0x493784];if(a0_0x1622['QGeBnQ']===undefined){var _0x4d2773=function(_0x2da8f6){var _0x529070='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x5187c4='',_0x3fe114='',_0x504f55=_0x5187c4+_0x4d2773;for(var _0x233833=-0x14f0+0x2*-0x410+0x1d10,_0x3cf34c,_0x4dc75e,_0x2c2efc=-0x1*-0x13d+-0x63b*0x2+0xb39;_0x4dc75e=_0x2da8f6['charAt'](_0x2c2efc++);~_0x4dc75e&&(_0x3cf34c=_0x233833%(-0x125*-0x20+-0x2247+-0x255)?_0x3cf34c*(0x51*0x3+-0x47*0x1+0xc*-0x9)+_0x4dc75e:_0x4dc75e,_0x233833++%(-0x4*-0x66c+-0x6a*0x3+-0x186e))?_0x5187c4+=_0x504f55['charCodeAt'](_0x2c2efc+(-0x7e8+-0x69f+0xe91))-(0x1c*0x10f+0x109c+-0x2e36)!==-0xcfb+0x2487+0xbc6*-0x2?String['fromCharCode'](-0x501+0x1f*-0xb+-0x1*-0x755&_0x3cf34c>>(-(0x12e9+-0x83*-0x39+-0x3012)*_0x233833&0x34e+0x18b6+-0x2*0xdff)):_0x233833:0x1b*-0x42+0xb23+-0x42d){_0x4dc75e=_0x529070['indexOf'](_0x4dc75e);}for(var _0xefe8c1=-0x49d+-0x1*-0x70c+0x59*-0x7,_0x4ca920=_0x5187c4['length'];_0xefe8c1<_0x4ca920;_0xefe8c1++){_0x3fe114+='%'+('00'+_0x5187c4['charCodeAt'](_0xefe8c1)['toString'](-0xec5+-0x948+0x181d*0x1))['slice'](-(0x8fa+-0x36*-0x7f+-0x23c2));}return decodeURIComponent(_0x3fe114);};var _0x4aafdc=function(_0x139f82,_0xfd21b7){var _0x140bed=[],_0x4bda2b=-0x62f*-0x1+0x606+-0x7d*0x19,_0x3efd12,_0x347baf='';_0x139f82=_0x4d2773(_0x139f82);var _0x4dfdf8;for(_0x4dfdf8=0xe9c+-0xd78+0x92*-0x2;_0x4dfdf8<0x12c6*0x2+-0x2df*0xa+-0x7d6;_0x4dfdf8++){_0x140bed[_0x4dfdf8]=_0x4dfdf8;}for(_0x4dfdf8=-0x1b*-0x14d+0x2588+0x1*-0x48a7;_0x4dfdf8<0x3b3*-0x1+-0x1*0x2482+0x2935;_0x4dfdf8++){_0x4bda2b=(_0x4bda2b+_0x140bed[_0x4dfdf8]+_0xfd21b7['charCodeAt'](_0x4dfdf8%_0xfd21b7['length']))%(0x260+0x2*0x124d+-0x2*0x12fd),_0x3efd12=_0x140bed[_0x4dfdf8],_0x140bed[_0x4dfdf8]=_0x140bed[_0x4bda2b],_0x140bed[_0x4bda2b]=_0x3efd12;}_0x4dfdf8=0x7*0x201+0x1bd9+-0x29e0,_0x4bda2b=-0xfd4+-0x1966*-0x1+-0x992;for(var _0x5b5aa7=-0x2064+0x1f5f+-0x57*-0x3;_0x5b5aa7<_0x139f82['length'];_0x5b5aa7++){_0x4dfdf8=(_0x4dfdf8+(-0x24d2+0x2368+0x16b*0x1))%(-0xddd+-0x1bd5+0x2ab2),_0x4bda2b=(_0x4bda2b+_0x140bed[_0x4dfdf8])%(-0x883+0x26f*-0xe+0x3*0xe87),_0x3efd12=_0x140bed[_0x4dfdf8],_0x140bed[_0x4dfdf8]=_0x140bed[_0x4bda2b],_0x140bed[_0x4bda2b]=_0x3efd12,_0x347baf+=String['fromCharCode'](_0x139f82['charCodeAt'](_0x5b5aa7)^_0x140bed[(_0x140bed[_0x4dfdf8]+_0x140bed[_0x4bda2b])%(0x247a+-0x190c+-0xa6e)]);}return _0x347baf;};a0_0x1622['UiFaQV']=_0x4aafdc,a0_0x1622['hylPpl']={},a0_0x1622['QGeBnQ']=!![];}var _0xa4eb45=_0x3bc0c8[0xaa*0x37+-0x73a+-0x1d4c],_0x5f1c70=_0x493784+_0xa4eb45,_0xaa53ac=a0_0x1622['hylPpl'][_0x5f1c70];if(!_0xaa53ac){if(a0_0x1622['jEQcCX']===undefined){var _0x500c39=function(_0x18b13e){this['UjyDne']=_0x18b13e,this['hBQNjC']=[0x16cb+-0x1ce5+0x61b,0x1545+-0x33e+0x1207*-0x1,0xf*0x3d+-0x14db*-0x1+-0x1*0x186e],this['SHsUmX']=function(){return'newState';},this['VEeGVE']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['cYIYSg']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x500c39['prototype']['uMNHYH']=function(){var _0x17f718=new RegExp(this['VEeGVE']+this['cYIYSg']),_0x37672b=_0x17f718['test'](this['SHsUmX']['toString']())?--this['hBQNjC'][0xdd3+-0x17ce+0x9fc]:--this['hBQNjC'][0x1*-0x119+0x1760+0x1647*-0x1];return this['WJsNJm'](_0x37672b);},_0x500c39['prototype']['WJsNJm']=function(_0x5e36c1){if(!Boolean(~_0x5e36c1))return _0x5e36c1;return this['oKTdCX'](this['UjyDne']);},_0x500c39['prototype']['oKTdCX']=function(_0x439e5f){for(var _0x1cfe35=0xe3*0x18+0x2*0xb74+-0x2c30,_0x1c15b8=this['hBQNjC']['length'];_0x1cfe35<_0x1c15b8;_0x1cfe35++){this['hBQNjC']['push'](Math['round'](Math['random']())),_0x1c15b8=this['hBQNjC']['length'];}return _0x439e5f(this['hBQNjC'][-0x1*-0xd8d+0x633+-0x1*0x13c0]);},new _0x500c39(a0_0x1622)['uMNHYH'](),a0_0x1622['jEQcCX']=!![];}_0x2669e0=a0_0x1622['UiFaQV'](_0x2669e0,_0xdb1102),a0_0x1622['hylPpl'][_0x5f1c70]=_0x2669e0;}else _0x2669e0=_0xaa53ac;return _0x2669e0;}a0_0x158b41();function a0_0x26b7(){var _0x5e1794=['sIOYlam','W5L1W70kCmkBW4/cMf0XzbtdOW','W4FcH8oOxSoOFcxdI2roW6FcUSov','vmkiW6XBmaFcLSk8uGFcKG','WOBcVCoU','lmoKe1RcTG','W5OfkSk9qmoRDG','WRzKWOhdK8kL','WPrTAHT2rmkxyMtdTCkj','kZxdGblcOXXsgwq','pbtcP3fcW4CWWQzPW6NdUq','W4FcHSoSb8kufM3dH2m','W40fWOlcSCo2jKBcHupcOay','pcCHWPOB','W55JWOGMWP3dPCoHWP0Rz8kRhue','qSovWQjLqbFdN8oPWPi','WRPpv8kbuq','WOGQWQJdRCo8','W5PDzCkrz8ohEwOk','W4P9W73cRSkOWQBcIcjDw8ozWQy','tmoqWQWmnMJcT8oqWPBdMfBcKM8','W4zsqIT/z8owW6lcTuBcMSkE','jCkEtSoeWQJdGu1zWP0tzrGC','s8kFBbDBvhuHWO7dKmkZ','WPJdPmoMqNy','z3LRW4vD'];a0_0x26b7=function(){return _0x5e1794;};return a0_0x26b7();}import{A as a0_0x3aa517,B as a0_0x506241,C as a0_0x35578e,D as a0_0x5589a8,b as a0_0x19e7d4,c as a0_0x5342fa,d as a0_0x373c05,e as a0_0x3709bd,f as a0_0x4c8790,g as a0_0x445d58,h as a0_0x1ef357,i as a0_0x456254,j as a0_0x16234c,k as a0_0x418524,l as a0_0x1f403e,m as a0_0xf40a8a,n as a0_0x24c088,o as a0_0x39d655,p as a0_0x55c33f,q as a0_0x5d838b,r as a0_0xca51be,s as a0_0x30cafa,t as a0_0x5cc763,u as a0_0x4c768f,v as a0_0x93a5f2,w as a0_0x174be2,x as a0_0x5a8e21,y as a0_0x5d7f17,z as a0_0x417a91}from'../chunk-I7YTZ5BO.js';import{a as a0_0x238b66,b as a0_0x1039b2,c as a0_0x49bbf4,d as a0_0x3a06d1,e as a0_0x2b2cc0}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x238b66 as AssetCache,a0_0x49bbf4 as AssetLoader,a0_0x4c768f as AssetSystem,a0_0x3a06d1 as AssetTextures,a0_0x30cafa as Assets,a0_0x39d655 as BaseSystem,a0_0x24c088 as GameEngine,a0_0x3709bd as GameObject,a0_0x4c8790 as GameObjectManager,a0_0xf40a8a as ObjectFactory,a0_0x373c05 as Renderer,a0_0x55c33f as RuntimeObjectRegistry,a0_0x5342fa as Transform,a0_0x506241 as applyScreenAnchor,a0_0x5d838b as basePixi,a0_0x174be2 as clearResponsiveElements,a0_0x19e7d4 as createPixiBase,a0_0x16234c as getRegisteredFontIds,a0_0x93a5f2 as globalResponsiveMultipliers,a0_0x2b2cc0 as initAssetTextures,a0_0x5cc763 as initAssets,a0_0x35578e as layout,a0_0x1f403e as playLottieOverlay,a0_0x456254 as registerFont,a0_0x1039b2 as registerType,a0_0x5d7f17 as resolveAnchorVec2,a0_0x445d58 as resolveFont,a0_0x1ef357 as resolveFontWeight,a0_0x417a91 as resolveScreenAnchorPoint,a0_0x3aa517 as resolveScreenRatioPoint,a0_0x5589a8 as runInitSequence,a0_0x418524 as setLottieInstance,a0_0xca51be as spawnSceneFromConfig,a0_0x5a8e21 as updateScreenState};
|
|
1
|
+
(function(_0x28bd6f,_0x440a6b){var a0_0x4a3c2f={_0x2bd3:0x2d9,_0x4de7e7:'im[c',_0x84259:0x2ce,_0x4b555e:0x2e1,_0x2af59e:0x2de,_0x461785:'rvjp',_0x1c46fc:0x2df,_0x388c6c:0x2ec,_0x254613:0x304,_0x531b4e:0x306,_0x195b90:'Kk!U',_0x46c778:0x2f7,_0x29bf80:0x158,_0x236906:0x15b,_0x41eb54:'m4ef',_0x4f8d09:0x2e2,_0x38586b:0x2e4,_0x2457b7:'M^3v',_0x5a4500:0x2d7,_0x5d0d2d:0x14a,_0x28e108:0x13f,_0x989106:'&QYp',_0x182c91:'xOY2',_0x15a653:'n]m7',_0x349b5e:0x2e5,_0x37f299:0x14e,_0x3ce01e:0x147,_0x160f53:0x151,_0x445e2c:'ED@)',_0x577711:0x2e0,_0x28128c:'ED@)',_0x515fb0:0x2f4},a0_0x8f6cb7={_0x1fce15:0x39e},a0_0x5b3bf2={_0x44c4bf:0x237};function _0x1e9093(_0x1768a8,_0x431502,_0x4ff934,_0x59c840,_0x4fba04){return a0_0x336b(_0x1768a8-0x90,_0x4fba04);}function _0x3b668f(_0x29e867,_0xea84cc,_0x4e0a48,_0x2b2323,_0x3730d9){return a0_0x336b(_0x3730d9-a0_0x5b3bf2._0x44c4bf,_0x2b2323);}var _0x642010=_0x28bd6f();function _0x2b9fd9(_0x1b68b8,_0xc0dee7,_0x4e54c9,_0xf1f66e,_0xd90319){return a0_0x336b(_0x1b68b8- -a0_0x8f6cb7._0x1fce15,_0x4e54c9);}while(!![]){try{var _0x5da243=parseInt(_0x2b9fd9(-a0_0x4a3c2f._0x2bd3,-0x2d2,a0_0x4a3c2f._0x4de7e7,-a0_0x4a3c2f._0x84259,-a0_0x4a3c2f._0x4b555e))/(0xf*-0x91+-0xbf0*-0x1+0x16*-0x28)*(-parseInt(_0x3b668f(0x2d1,a0_0x4a3c2f._0x2af59e,0x2ed,a0_0x4a3c2f._0x461785,a0_0x4a3c2f._0x1c46fc))/(0x1*-0x706+0x1915+-0x1*0x120d))+parseInt(_0x3b668f(a0_0x4a3c2f._0x388c6c,a0_0x4a3c2f._0x254613,a0_0x4a3c2f._0x531b4e,a0_0x4a3c2f._0x195b90,a0_0x4a3c2f._0x46c778))/(0x4*-0x42d+-0x226+0x12dd)+-parseInt(_0x1e9093(0x153,a0_0x4a3c2f._0x29bf80,a0_0x4a3c2f._0x236906,0x148,a0_0x4a3c2f._0x41eb54))/(-0x1113+0xe23+0x2f4)+parseInt(_0x2b9fd9(-a0_0x4a3c2f._0x4f8d09,-a0_0x4a3c2f._0x38586b,a0_0x4a3c2f._0x2457b7,-0x2f1,-a0_0x4a3c2f._0x5a4500))/(0x1*0x1231+-0x5*0x3a1+-0x7*0x1)*(parseInt(_0x1e9093(a0_0x4a3c2f._0x5d0d2d,0x143,0x153,a0_0x4a3c2f._0x28e108,a0_0x4a3c2f._0x989106))/(0x425*0x5+0x20e7*-0x1+-0x30d*-0x4))+parseInt(_0x3b668f(0x2ec,0x2f7,0x2e7,a0_0x4a3c2f._0x182c91,0x2f6))/(-0x2567*-0x1+0x2*-0xf92+-0x63c)+parseInt(_0x3b668f(a0_0x4a3c2f._0x38586b,0x2e3,0x2ea,a0_0x4a3c2f._0x15a653,a0_0x4a3c2f._0x349b5e))/(0x5*-0x104+0x2303+-0x1de7)*(parseInt(_0x1e9093(a0_0x4a3c2f._0x37f299,a0_0x4a3c2f._0x3ce01e,a0_0x4a3c2f._0x160f53,0x154,a0_0x4a3c2f._0x445e2c))/(-0x1*-0x2431+0x2*0x97d+0x2*-0x1b91))+-parseInt(_0x2b9fd9(-0x2e7,-a0_0x4a3c2f._0x577711,a0_0x4a3c2f._0x28128c,-0x2dd,-a0_0x4a3c2f._0x515fb0))/(-0x11*0x2f+0x1*0x26b+0x5*0x26);if(_0x5da243===_0x440a6b)break;else _0x642010['push'](_0x642010['shift']());}catch(_0x1c8b3c){_0x642010['push'](_0x642010['shift']());}}}(a0_0xaa35,0x2fe51+0xb52b*0x3+-0x2685e));var a0_0x259312=(function(){var a0_0x519f06={_0x1cecec:0x23a,_0x5bcdd5:0x224,_0x19a1dc:0x233},_0x583011=!![];return function(_0x66170a,_0x12df08){var _0x1f0fda=_0x583011?function(){var a0_0x4cc586={_0x4a07da:0x178};function _0x2ecc2c(_0x312ec0,_0x363f06,_0x5110a2,_0x54512c,_0xa192db){return a0_0x336b(_0xa192db-a0_0x4cc586._0x4a07da,_0x312ec0);}if(_0x12df08){var _0x11488f=_0x12df08[_0x2ecc2c('mN28',a0_0x519f06._0x1cecec,0x241,a0_0x519f06._0x5bcdd5,a0_0x519f06._0x19a1dc)](_0x66170a,arguments);return _0x12df08=null,_0x11488f;}}:function(){};return _0x583011=![],_0x1f0fda;};}()),a0_0x2d0daf=a0_0x259312(this,function(){var a0_0x509dbc={_0x4ee19b:0x194,_0x3c2dc3:0x196,_0x2b9150:0x19c,_0x4bf3c3:'XX5M',_0x298b5f:0x179,_0x1be85b:0x178,_0x17585f:'im[c',_0x1ed8ca:0x38a,_0x1bea32:0x38e,_0x53bcce:0x398,_0x23d845:0x389,_0x2328bb:0x17d,_0x522c7c:0x181,_0x3a315e:'3w9v',_0x2fc87b:0x192,_0x42126e:0x188,_0x3be8c0:'DIgr',_0x4a69a8:0x183,_0xc5406e:'n7Du',_0xee625e:0x184,_0x3ce4d9:0x199,_0x118b28:0x18b,_0xae32dc:'Nfpp',_0x5b48a9:0x19a,_0x336c97:0x1a3,_0x6e6661:0x18f,_0x5125c8:0x191,_0x1595b3:0x18a,_0x54c54f:'mN28',_0x27a1af:0x382,_0x49a5aa:0x39d,_0x55d9eb:'Kk!U',_0x45a53b:0x38f,_0x3e5f18:0x193,_0x3e0c0c:'N^D9'},a0_0x5af05e={_0x549fae:0x24c},a0_0x3ab209={_0x141f29:0x232},a0_0x4f162d={_0x3ed88c:0x2db},_0x2ea9bd={};function _0x31f76e(_0x1d022a,_0x362a67,_0x246675,_0x54271b,_0x30f4f3){return a0_0x336b(_0x54271b-a0_0x4f162d._0x3ed88c,_0x246675);}function _0xd627bd(_0x209792,_0x397ab3,_0x4b9db1,_0x50f1cd,_0x34c392){return a0_0x336b(_0x397ab3- -a0_0x3ab209._0x141f29,_0x50f1cd);}_0x2ea9bd[_0x22f092(-a0_0x509dbc._0x4ee19b,-a0_0x509dbc._0x3c2dc3,-0x19c,-a0_0x509dbc._0x2b9150,a0_0x509dbc._0x4bf3c3)]=_0xd627bd(-0x174,-a0_0x509dbc._0x298b5f,-a0_0x509dbc._0x1be85b,a0_0x509dbc._0x17585f,-0x175)+_0x31f76e(a0_0x509dbc._0x1ed8ca,a0_0x509dbc._0x1bea32,'pCEX',a0_0x509dbc._0x53bcce,a0_0x509dbc._0x23d845)+'+$';function _0x22f092(_0x1e492d,_0x483953,_0x4b578c,_0x1b9203,_0x3c295b){return a0_0x336b(_0x1b9203- -a0_0x5af05e._0x549fae,_0x3c295b);}var _0x2add94=_0x2ea9bd;return a0_0x2d0daf[_0xd627bd(-a0_0x509dbc._0x2328bb,-0x185,-a0_0x509dbc._0x522c7c,a0_0x509dbc._0x3a315e,-0x180)+_0xd627bd(-a0_0x509dbc._0x2fc87b,-a0_0x509dbc._0x42126e,-a0_0x509dbc._0x4ee19b,a0_0x509dbc._0x3be8c0,-0x195)]()[_0xd627bd(-a0_0x509dbc._0x4a69a8,-0x187,-0x178,a0_0x509dbc._0xc5406e,-0x17e)+'h'](_0x2add94['Nkohq'])[_0x22f092(-a0_0x509dbc._0x4ee19b,-a0_0x509dbc._0xee625e,-a0_0x509dbc._0x3ce4d9,-a0_0x509dbc._0x118b28,a0_0x509dbc._0xae32dc)+'ing']()[_0x22f092(-a0_0x509dbc._0x5b48a9,-a0_0x509dbc._0x336c97,-a0_0x509dbc._0x6e6661,-a0_0x509dbc._0x3ce4d9,'Oerk')+_0x22f092(-0x188,-0x194,-a0_0x509dbc._0x5125c8,-a0_0x509dbc._0x1595b3,a0_0x509dbc._0x54c54f)+'r'](a0_0x2d0daf)[_0x31f76e(a0_0x509dbc._0x27a1af,a0_0x509dbc._0x49a5aa,a0_0x509dbc._0x55d9eb,a0_0x509dbc._0x45a53b,0x392)+'h'](_0x2add94[_0x22f092(-a0_0x509dbc._0x3e5f18,-a0_0x509dbc._0x118b28,-0x1a5,-a0_0x509dbc._0x3c2dc3,a0_0x509dbc._0x3e0c0c)]);});function a0_0xaa35(){var _0x5e49c0=['W47dJCkgFx4','W70wnd0UWOddSHxdIdtcV1De','pSoCimk4WP3cI3hdGJnMWOlcHG','cSogWQRcT8kdnSo9WQLprCoVCq','AtNdPmkbWPBcHsW','W6tdG0/cVCovhsLDWQNdMCkbAKC','WOFcTJm','W48FW6BcKmkm','WQxdR8oJCtSxWOS','z8o6W5G9la','fxpcI0NcU2KLjWOO','WPvplIlcImocW57dRh5JW5ZcSsC','gJFdTmo+uG','dmomW6FdQSoBu8oGWRK','B8kHWR3cLCoSW5iWbr7cNmonkuG','W4pdSCojqSk5','lrm3axW','WRpcR0/cIJu4WP/cR2JcUIG','fSkSnSkpWQS','WPNdP1RcP3FdV8otW5dcGXKup8kn','rvJdOSkrjuBcOCkZmCkGW6y','e8oCWRVcR8kr','WONcJuT0wM7dO10','W53dImkvzwG','W5ussbpcHhVcPuaRWR1s','WR7cR8knf14','WPJdPvdcPNpcNmkQW5BcPGyf','jSkvW7tcGSoDCwtcHSorWRtdNSojW4O','AejUrsNcKWP1WQ3cV0bl','W63cP8o2WOiO'];a0_0xaa35=function(){return _0x5e49c0;};return a0_0xaa35();}a0_0x2d0daf();import{A as a0_0x215d31,B as a0_0x168e81,C as a0_0x13393d,D as a0_0x59d62e,b as a0_0x2fcbce,c as a0_0x30046a,d as a0_0x464d6c,e as a0_0x56b3bc,f as a0_0x41bf35,g as a0_0x2467e7,h as a0_0x25bf52,i as a0_0x53cbbf,j as a0_0x72bc0c,k as a0_0x58c844,l as a0_0xe74325,m as a0_0x48adde,n as a0_0x1cb7ed,o as a0_0x1d4989,p as a0_0x320dd3,q as a0_0x4a265c,r as a0_0x2b9cf6,s as a0_0x4cabd4,t as a0_0x6b5413,u as a0_0x19c4fd,v as a0_0x3c67f8,w as a0_0x32b6c8,x as a0_0x42a1bf,y as a0_0x393fe4,z as a0_0x39d3c2}from'../chunk-ZL7BSSGC.js';import{a as a0_0x623289,b as a0_0x4c20e6,c as a0_0x41fb53,d as a0_0x46444f,e as a0_0x2516ac}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';function a0_0x336b(_0x1ad9a7,_0x40f161){_0x1ad9a7=_0x1ad9a7-(-0x1e7d*-0x1+-0x982+-0x1453);var _0x27780e=a0_0xaa35();var _0x1a38de=_0x27780e[_0x1ad9a7];if(a0_0x336b['gCqNlz']===undefined){var _0x263a3c=function(_0x4634bb){var _0x1cd881='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x487ad4='',_0x659e80='',_0x48fb3b=_0x487ad4+_0x263a3c;for(var _0x787f0c=-0x1*-0x30e+0x14*0x168+-0x1f2e,_0x5aeada,_0x496dff,_0x499e11=-0x1*-0x1a9+0x1e8+-0x391;_0x496dff=_0x4634bb['charAt'](_0x499e11++);~_0x496dff&&(_0x5aeada=_0x787f0c%(0x2264+-0x1d*-0xd5+-0x3a81)?_0x5aeada*(0x8d*-0x4+0x2490+0x94*-0x3b)+_0x496dff:_0x496dff,_0x787f0c++%(0x3*-0x8e9+0x47*-0x7b+-0x334*-0x13))?_0x487ad4+=_0x48fb3b['charCodeAt'](_0x499e11+(0x1e37+-0x6*0x567+0x23d))-(0x1154+0x1a29+0x7*-0x635)!==0xecd+-0x1d41*-0x1+-0x2c0e*0x1?String['fromCharCode'](-0x2173+0x240d+-0x1*0x19b&_0x5aeada>>(-(0x1*-0x207a+0x1622+0xa5a)*_0x787f0c&0x77+-0x1432+0x13c1)):_0x787f0c:-0x42+-0x25*-0xb5+-0x19e7){_0x496dff=_0x1cd881['indexOf'](_0x496dff);}for(var _0x48e978=0x1217+0xad3+0x1*-0x1cea,_0x382e69=_0x487ad4['length'];_0x48e978<_0x382e69;_0x48e978++){_0x659e80+='%'+('00'+_0x487ad4['charCodeAt'](_0x48e978)['toString'](-0xbef*0x2+0x7*-0x44b+0x35fb))['slice'](-(0x14e8+-0x174a+0x264));}return decodeURIComponent(_0x659e80);};var _0x3d1c31=function(_0x8cae14,_0x5d56a5){var _0x9ae890=[],_0x3dbf90=0x18a*0x4+-0x13+-0x615,_0x7efedf,_0x363128='';_0x8cae14=_0x263a3c(_0x8cae14);var _0x3e6e28;for(_0x3e6e28=0x1*-0x1752+0x374*0xa+-0x7*0x19a;_0x3e6e28<-0x825+-0x1d95*-0x1+-0x10*0x147;_0x3e6e28++){_0x9ae890[_0x3e6e28]=_0x3e6e28;}for(_0x3e6e28=-0x2*0x78a+-0xf8*-0x2+0xd24;_0x3e6e28<0x3*0x379+-0x27b*-0x1+0x2*-0x5f3;_0x3e6e28++){_0x3dbf90=(_0x3dbf90+_0x9ae890[_0x3e6e28]+_0x5d56a5['charCodeAt'](_0x3e6e28%_0x5d56a5['length']))%(-0x4a0*-0x4+-0x8af+-0x8d1),_0x7efedf=_0x9ae890[_0x3e6e28],_0x9ae890[_0x3e6e28]=_0x9ae890[_0x3dbf90],_0x9ae890[_0x3dbf90]=_0x7efedf;}_0x3e6e28=-0x18e9+-0xd7+0x19c0,_0x3dbf90=0xd2*0x1d+0x1*-0x2659+-0x1*-0xe8f;for(var _0x1b6407=-0x18bb*0x1+0x56*0x6d+-0xbe3;_0x1b6407<_0x8cae14['length'];_0x1b6407++){_0x3e6e28=(_0x3e6e28+(-0xba5+0x1f9d+-0x1*0x13f7))%(0x6*-0x3cb+-0xe*-0xb5+0xddc),_0x3dbf90=(_0x3dbf90+_0x9ae890[_0x3e6e28])%(0x1c9d+0x4*-0x401+-0x1*0xb99),_0x7efedf=_0x9ae890[_0x3e6e28],_0x9ae890[_0x3e6e28]=_0x9ae890[_0x3dbf90],_0x9ae890[_0x3dbf90]=_0x7efedf,_0x363128+=String['fromCharCode'](_0x8cae14['charCodeAt'](_0x1b6407)^_0x9ae890[(_0x9ae890[_0x3e6e28]+_0x9ae890[_0x3dbf90])%(-0x1dc3*-0x1+-0xa1a*-0x3+-0x3b11)]);}return _0x363128;};a0_0x336b['RKBFwW']=_0x3d1c31,a0_0x336b['efRNgy']={},a0_0x336b['gCqNlz']=!![];}var _0x45e49c=_0x27780e[-0x1*0x264b+0xefb+0x1750],_0x198af5=_0x1ad9a7+_0x45e49c,_0x4acb9b=a0_0x336b['efRNgy'][_0x198af5];if(!_0x4acb9b){if(a0_0x336b['STtuRu']===undefined){var _0x297dea=function(_0x5a6bd0){this['zvjBqh']=_0x5a6bd0,this['nXuZCv']=[-0x2*-0xc92+-0x129f+-0x684,-0x5*0x704+0x3*-0x44d+0x1*0x2ffb,-0xb5*-0x2e+0x1ebe+-0x2*0x1fa2],this['GMqqBG']=function(){return'newState';},this['EvkbDP']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['zpUNHo']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x297dea['prototype']['vKWoUj']=function(){var _0x444b8d=new RegExp(this['EvkbDP']+this['zpUNHo']),_0x386331=_0x444b8d['test'](this['GMqqBG']['toString']())?--this['nXuZCv'][-0x7e8*0x3+0x1*0x5a4+0x1215]:--this['nXuZCv'][0x5f8*0x2+0x207d+0x33*-0xdf];return this['umMjPC'](_0x386331);},_0x297dea['prototype']['umMjPC']=function(_0x1e71b3){if(!Boolean(~_0x1e71b3))return _0x1e71b3;return this['Pwdfep'](this['zvjBqh']);},_0x297dea['prototype']['Pwdfep']=function(_0x15796a){for(var _0x5bdca2=0x1*-0x706+0x1915+-0x1*0x120f,_0x46d9c4=this['nXuZCv']['length'];_0x5bdca2<_0x46d9c4;_0x5bdca2++){this['nXuZCv']['push'](Math['round'](Math['random']())),_0x46d9c4=this['nXuZCv']['length'];}return _0x15796a(this['nXuZCv'][0x4*-0x42d+-0x226+0x12da]);},new _0x297dea(a0_0x336b)['vKWoUj'](),a0_0x336b['STtuRu']=!![];}_0x1a38de=a0_0x336b['RKBFwW'](_0x1a38de,_0x40f161),a0_0x336b['efRNgy'][_0x198af5]=_0x1a38de;}else _0x1a38de=_0x4acb9b;return _0x1a38de;}export{a0_0x623289 as AssetCache,a0_0x41fb53 as AssetLoader,a0_0x19c4fd as AssetSystem,a0_0x46444f as AssetTextures,a0_0x4cabd4 as Assets,a0_0x1d4989 as BaseSystem,a0_0x1cb7ed as GameEngine,a0_0x56b3bc as GameObject,a0_0x41bf35 as GameObjectManager,a0_0x48adde as ObjectFactory,a0_0x464d6c as Renderer,a0_0x320dd3 as RuntimeObjectRegistry,a0_0x30046a as Transform,a0_0x168e81 as applyScreenAnchor,a0_0x4a265c as basePixi,a0_0x32b6c8 as clearResponsiveElements,a0_0x2fcbce as createPixiBase,a0_0x72bc0c as getRegisteredFontIds,a0_0x3c67f8 as globalResponsiveMultipliers,a0_0x2516ac as initAssetTextures,a0_0x6b5413 as initAssets,a0_0x13393d as layout,a0_0xe74325 as playLottieOverlay,a0_0x53cbbf as registerFont,a0_0x4c20e6 as registerType,a0_0x393fe4 as resolveAnchorVec2,a0_0x2467e7 as resolveFont,a0_0x25bf52 as resolveFontWeight,a0_0x39d3c2 as resolveScreenAnchorPoint,a0_0x215d31 as resolveScreenRatioPoint,a0_0x59d62e as runInitSequence,a0_0x58c844 as setLottieInstance,a0_0x2b9cf6 as spawnSceneFromConfig,a0_0x42a1bf as updateScreenState};
|
package/dist/three/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let d=s.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xs={};oa(Xs,{AspectClass:()=>In,GameObject:()=>st,GameObjectManager:()=>$t,Renderer:()=>ot,ResponsiveUISystem:()=>Ge,Transform:()=>rt,animateHandClick:()=>xr,animatePanelEntrance:()=>vr,createBrushTexture:()=>Lr,createEndGamePanel:()=>yr,createHandTutorial:()=>wr,createThreeBase:()=>fr,createTutorialLabel:()=>Er,getAspectClass:()=>Dt,getRegisteredFontIds:()=>br,loadAsset:()=>$n,loadCharacterFrames:()=>Tr,registerFont:()=>mr,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Sr});module.exports=wo(Xs);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var M=null,W=[],Pe=null;function da(t){M=t,W=[],Pe!==null&&(clearTimeout(Pe),Pe=null)}function pa(){var t,e,n;return{endpoint:(M==null?void 0:M.endpoint)||"",transport:(M==null?void 0:M.transport)||"beacon",batchSize:(t=M==null?void 0:M.batchSize)!=null?t:10,flushIntervalMs:(e=M==null?void 0:M.flushIntervalMs)!=null?e:300,maxQueue:(n=M==null?void 0:M.maxQueue)!=null?n:200,debug:!!(M!=null&&M.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}Pe===null&&(Pe=window.setTimeout(()=>{Pe=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Eo(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function So(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Ao(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Ao(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,s(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},r=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){o(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Eo(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:So(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>o(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))o(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.4.47",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var G=0,To=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,La=G++,_a=G++,ka=G++,T=To;function Ma(){return T===va}function Pa(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===La}function Zt(){return T===_a}function Qt(){return T===ka}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=La)}catch{}else e==="vungle"?T=_a:(t==="nucleo"||e==="nucleo")&&(T=ka)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Lo=require("pixi.js");var en=require("pixi.js");var _o=null;function tn(t){_o=t}vt();nn();var Ye=require("pixi.js");vt();var Io=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",sn=Io;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(sn=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${sn}`))}}catch{}function jo(t){var n,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(t);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(t))return{x:(n=t[0])!=null?n:.5,y:(i=t[1])!=null?i:.5};if(t&&typeof t=="object"&&"x"in t&&"y"in t)return{x:(a=t.x)!=null?a:.5,y:(r=t.y)!=null?r:.5};if(typeof t=="string"){let s=t.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${sn}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let r=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await Se.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new Ye.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(c=s==null?void 0:s.constructor)==null?void 0:c.name),this.applyTransform(s,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=o==null?void 0:o.constructor)==null?void 0:g.name,o),o&&(((u=o.constructor)==null?void 0:u.name)==="Container"||o instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=s==null?void 0:s.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,n==null?void 0:n.transform,n);return s}static applyTransform(e,n,i){var a,r,o,s;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(r=n.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=n.position.x)!=null?o:0,(s=n.position.y)!=null?s:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=jo(n.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Ho=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Ho);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},No=new cn,Fo=new Proxy(No,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Uo(t,e,n,i,a,r,o){pn.push({element:t,originalScale:r,positionHelper:e,heightPercent:a}),e(t,n,i,a,r,o,!1)}function qo(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),qo()}var Ze={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 Wo(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Vo(){return Ze}var Yo={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 Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Yo[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),r=(u=i.inset)!=null?u:{},o=(b=i.padding)!=null?b:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((x=r.right)!=null?x:0)+o.x,d=((v=r.top)!=null?v:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,c=Math.max(0,t-s-l),g=Math.max(0,e-d-p);return{x:s+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},r=(x=i.padding)!=null?x:{x:0,y:0},o=((v=a.left)!=null?v:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((f=a.top)!=null?f:0)+r.y,d=((m=a.bottom)!=null?m:0)+r.y,p=Math.max(0,t-o-s),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:o+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Wo,window.getDebugConfig=Vo,window.copyConfig=rs,window.applyConfig=Je,window.applyConfigForRatio=os,window.positionAtBottom=qa,window.positionAtTop=Jo,window.positionAtCenter=Zo,window.positionAtLeft=Qo,window.positionAtRight=es,window.positionAtBottomLeft=ts,window.positionAtBottomRight=ns,window.positionAtTopLeft=is,window.positionAtTopRight=as,window.applyPositionContract=Xo,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 Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function Lt(t,e,n=0){return t*e+n}function _t(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Ko(t,e){return t*e}function Xo(t,e,n,i){var o,s,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,k,R;let a=0,r=0;switch(i.type){case"top":a=U(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),r=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=Lt(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),r=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=_t(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),r=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),r=U(n,(R=(k=i.offset)==null?void 0:k.y)!=null?R:0);break}t.position?t.position.set(a,r):(t.x=a,t.y=r),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,r=!0,o=!1){let s=Ko(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=r?a*le.scaleFactor:a;de(t,d),o&&!pn.find(p=>p.element===t)&&Uo(t,qa,e,n,i,a,r)}function Jo(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Zo(t,e,n,i=0,a=0,r=1){ce(t,U(e,i),U(n,a)),de(t,r)}function Qo(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function es(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function ts(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Tt(n,i)),de(t,r)}function ns(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Tt(n,i)),de(t,r)}function is(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Ct(n,i)),de(t,r)}function as(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Ct(n,i)),de(t,r)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={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 rs(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function os(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function P(t,e){let n=(a,r)=>r===0?a:n(r,a%r),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:P(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:P(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:P(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:P(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:P(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:P(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:P(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:P(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:P(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:P(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:P(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:P(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:P(800,1280)}],Ka=[{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:P(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:P(768,1024),mraidScale:.7}];var qc=[...Ka];var hs=Ka[0];fe();var xs=ae(require("jszip"),1);function bs(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function ys(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vs(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await bs(a),o=await vs(r),s=ys(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(n=o==null?void 0:o.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function kt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let r=a.getImageData(0,0,i.width,i.height),o=r.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:o[c.offset],g:o[c.offset+1],b:o[c.offset+2]})),d=0;for(let c=0;c<o.length;c+=4){let g=o[c],u=o[c+1],b=o[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(o[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,r,o,s,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(o=(r=(a=b.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(s=c.message)!=null&&s.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."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),r=[{text:e}];n.length>0&&n.forEach((s,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let l=s.inlineData.data,d=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var ws=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Es=require("pixi.js");fe();function ks(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Ms(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ps(t){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let d=s.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xs={};oa(Xs,{AspectClass:()=>In,GameObject:()=>st,GameObjectManager:()=>$t,Renderer:()=>ot,ResponsiveUISystem:()=>Ge,Transform:()=>rt,animateHandClick:()=>xr,animatePanelEntrance:()=>vr,createBrushTexture:()=>Lr,createEndGamePanel:()=>yr,createHandTutorial:()=>wr,createThreeBase:()=>fr,createTutorialLabel:()=>Er,getAspectClass:()=>Dt,getRegisteredFontIds:()=>br,loadAsset:()=>$n,loadCharacterFrames:()=>Tr,registerFont:()=>mr,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Sr});module.exports=wo(Xs);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var M=null,W=[],Pe=null;function da(t){M=t,W=[],Pe!==null&&(clearTimeout(Pe),Pe=null)}function pa(){var t,e,n;return{endpoint:(M==null?void 0:M.endpoint)||"",transport:(M==null?void 0:M.transport)||"beacon",batchSize:(t=M==null?void 0:M.batchSize)!=null?t:10,flushIntervalMs:(e=M==null?void 0:M.flushIntervalMs)!=null?e:300,maxQueue:(n=M==null?void 0:M.maxQueue)!=null?n:200,debug:!!(M!=null&&M.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}Pe===null&&(Pe=window.setTimeout(()=>{Pe=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Eo(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function So(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Ao(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Ao(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,s(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},r=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){o(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Eo(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:So(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>o(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))o(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.4.49",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var G=0,To=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,La=G++,_a=G++,ka=G++,T=To;function Ma(){return T===va}function Pa(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===La}function Zt(){return T===_a}function Qt(){return T===ka}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=La)}catch{}else e==="vungle"?T=_a:(t==="nucleo"||e==="nucleo")&&(T=ka)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Lo=require("pixi.js");var en=require("pixi.js");var _o=null;function tn(t){_o=t}vt();nn();var Ye=require("pixi.js");vt();var Io=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",sn=Io;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(sn=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${sn}`))}}catch{}function jo(t){var n,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(t);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(t))return{x:(n=t[0])!=null?n:.5,y:(i=t[1])!=null?i:.5};if(t&&typeof t=="object"&&"x"in t&&"y"in t)return{x:(a=t.x)!=null?a:.5,y:(r=t.y)!=null?r:.5};if(typeof t=="string"){let s=t.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${sn}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let r=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await Se.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new Ye.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(c=s==null?void 0:s.constructor)==null?void 0:c.name),this.applyTransform(s,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=o==null?void 0:o.constructor)==null?void 0:g.name,o),o&&(((u=o.constructor)==null?void 0:u.name)==="Container"||o instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=s==null?void 0:s.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,n==null?void 0:n.transform,n);return s}static applyTransform(e,n,i){var a,r,o,s;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(r=n.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=n.position.x)!=null?o:0,(s=n.position.y)!=null?s:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=jo(n.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Ho=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Ho);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},No=new cn,Fo=new Proxy(No,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Uo(t,e,n,i,a,r,o){pn.push({element:t,originalScale:r,positionHelper:e,heightPercent:a}),e(t,n,i,a,r,o,!1)}function qo(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),qo()}var Ze={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 Wo(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Vo(){return Ze}var Yo={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 Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Yo[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),r=(u=i.inset)!=null?u:{},o=(b=i.padding)!=null?b:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((x=r.right)!=null?x:0)+o.x,d=((v=r.top)!=null?v:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,c=Math.max(0,t-s-l),g=Math.max(0,e-d-p);return{x:s+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},r=(x=i.padding)!=null?x:{x:0,y:0},o=((v=a.left)!=null?v:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((f=a.top)!=null?f:0)+r.y,d=((m=a.bottom)!=null?m:0)+r.y,p=Math.max(0,t-o-s),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:o+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Wo,window.getDebugConfig=Vo,window.copyConfig=rs,window.applyConfig=Je,window.applyConfigForRatio=os,window.positionAtBottom=qa,window.positionAtTop=Jo,window.positionAtCenter=Zo,window.positionAtLeft=Qo,window.positionAtRight=es,window.positionAtBottomLeft=ts,window.positionAtBottomRight=ns,window.positionAtTopLeft=is,window.positionAtTopRight=as,window.applyPositionContract=Xo,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 Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function Lt(t,e,n=0){return t*e+n}function _t(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Ko(t,e){return t*e}function Xo(t,e,n,i){var o,s,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,k,R;let a=0,r=0;switch(i.type){case"top":a=U(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),r=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=Lt(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),r=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=_t(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),r=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),r=U(n,(R=(k=i.offset)==null?void 0:k.y)!=null?R:0);break}t.position?t.position.set(a,r):(t.x=a,t.y=r),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,r=!0,o=!1){let s=Ko(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=r?a*le.scaleFactor:a;de(t,d),o&&!pn.find(p=>p.element===t)&&Uo(t,qa,e,n,i,a,r)}function Jo(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Zo(t,e,n,i=0,a=0,r=1){ce(t,U(e,i),U(n,a)),de(t,r)}function Qo(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function es(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function ts(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Tt(n,i)),de(t,r)}function ns(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Tt(n,i)),de(t,r)}function is(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Ct(n,i)),de(t,r)}function as(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Ct(n,i)),de(t,r)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={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 rs(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function os(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function P(t,e){let n=(a,r)=>r===0?a:n(r,a%r),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:P(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:P(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:P(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:P(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:P(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:P(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:P(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:P(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:P(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:P(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:P(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:P(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:P(800,1280)}],Ka=[{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:P(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:P(768,1024),mraidScale:.7}];var qc=[...Ka];var hs=Ka[0];fe();var xs=ae(require("jszip"),1);function bs(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function ys(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vs(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await bs(a),o=await vs(r),s=ys(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(n=o==null?void 0:o.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function kt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let r=a.getImageData(0,0,i.width,i.height),o=r.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:o[c.offset],g:o[c.offset+1],b:o[c.offset+2]})),d=0;for(let c=0;c<o.length;c+=4){let g=o[c],u=o[c+1],b=o[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(o[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,r,o,s,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(o=(r=(a=b.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(s=c.message)!=null&&s.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."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),r=[{text:e}];n.length>0&&n.forEach((s,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let l=s.inlineData.data,d=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var ws=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Es=require("pixi.js");fe();function ks(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Ms(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ps(t){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|