handler-playable-sdk 0.5.47 → 0.5.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-RLJOGLPW.js → chunk-DSIGEZDQ.js} +44 -38
- 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 +39 -33
- 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.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as J,F as K,G as L,H as M,I as N,J as O,K as P,L as Q,M as R,N as S,O as T,P as U,Q as V,R as W,S as X,T as Y,U as Z,a}from"./chunk-
|
|
1
|
+
import{E as J,F as K,G as L,H as M,I as N,J as O,K as P,L as Q,M as R,N as S,O as T,P as U,Q as V,R as W,S as X,T as Y,U as Z,a}from"./chunk-DSIGEZDQ.js";import"./chunk-I5OOVR5U.js";import{a as u,b as v,c as w,d as x,e as y,f as z,g as A,h as B,i as C,j as D,k as E,l as F,m as G,n as H,o as I}from"./chunk-PW2FGMCO.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,p as q,q as r,r as s,s as t}from"./chunk-HVKF2KYL.js";import"./chunk-E6WJCS24.js";import"./chunk-JXBG6UFL.js";export{U as COLORS,F as ConfigWatcher,O as DebugPanel,E as DefaultReloadStrategy,Y as Handler,X as PlayableLoadingScreen,P as PreviewShell,V as STROKE_WIDTH,W as THEME,d as applyConfigOverride,e as applyConfigOverrides,r as applyConfigsToDisk,B as applyDefaults,a as baseLottie,T as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,Q as createPreviewShell,o as deepClone,Z as default,L as defaultPreset,K as deviceGroups,J as devicePresets,G as diffConfigs,p as exportConfigsAsJSON,i as getConfigOverrides,q as getConfigStateSummary,b as getOverrideMode,M as getPresetById,N as getPresetsByCategory,w as loadAllObjectConfigs,u as loadComponentSchemas,x as loadEngineConfig,y as loadGamePromptConfig,C as loadObjectCentricConfig,v as loadObjectConfig,z as loadSceneConfig,l as redoLastConfigChange,H as rehydrateObject,h as removeConfigOverride,s as resetToApplied,t as resetToOriginal,S as setBootstrapDependencies,c as setOverrideMode,I as setupHotReload,R as setupLiveEditBridge,D as toLegacyFormat,m as trackObjectCreation,n as trackObjectDeletion,k as undoLastConfigChange,A 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=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let d=o.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",s=>{s.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Nr={};Wn(Nr,{AssetCache:()=>ae,AssetLoader:()=>Ce,AssetSystem:()=>Kt,AssetTextures:()=>Te,Assets:()=>ua,BaseSystem:()=>Ze,GameEngine:()=>Yt,GameObject:()=>At,GameObjectManager:()=>Xe,ObjectFactory:()=>Le,Renderer:()=>St,RuntimeObjectRegistry:()=>Qe,Transform:()=>Et,applyScreenAnchor:()=>Zt,basePixi:()=>la,clearResponsiveElements:()=>ha,createPixiBase:()=>Vt,getRegisteredFontIds:()=>aa,globalResponsiveMultipliers:()=>Tt,initAssetTextures:()=>Ht,initAssets:()=>ga,layout:()=>ma,playLottieOverlay:()=>sa,registerFont:()=>ia,registerType:()=>$t,resolveAnchorVec2:()=>$e,resolveFont:()=>ta,resolveFontWeight:()=>na,resolveScreenAnchorPoint:()=>et,resolveScreenRatioPoint:()=>tt,runInitSequence:()=>ba,setLottieInstance:()=>Nt,spawnSceneFromConfig:()=>da,updateScreenState:()=>Jt});module.exports=Sa(Nr);var ea=require("pixi.js");var Se={};function _t(n,e,t=!1){Se[n]||(Se[n]=[]),Se[n].push({fn:e,once:t})}function on(n,e){if(Se[n]){if(!e){delete Se[n];return}Se[n]=Se[n].filter(t=>t.fn!==e)}}function jt(n,...e){let t=Se[n];if(t)for(let i of[...t])i.fn(...e),i.once&&on(n,i.fn)}function J(n,e){_t(n,e,!0)}var $=null,ee=[],He=null;function Jn(n){$=n,ee=[],He!==null&&(clearTimeout(He),He=null)}function Zn(){var n,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(n=$==null?void 0:$.batchSize)!=null?n:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function Kn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function ln(n,e){let t=Zn();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){Xn();return}He===null&&(He=window.setTimeout(()=>{He=null,Xn()},t.flushIntervalMs))}}async function Xn(){let n=Zn();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await Kn(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await Kn(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Qn(n){return Math.max(0,Math.min(1,n))}function Aa(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ut(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ca(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ei(n,e,t){try{n[e]=t}catch{}}function Ta(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ti(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function ni(n,e){let t=Ta(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ii(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let c=(p=e.get(u.target))!=null?p:new Set;c.add(u),e.set(u.target,c),i()},r=u=>{n.delete(u);let c=e.get(u.target);c&&(c.delete(u),c.size===0&&e.delete(u.target))},s=u=>{u.killed||(u.killed=!0,r(u))},o=()=>{var c,p;let u=ut();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,A=Qn(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=Qn(y)}let v=g.ease(A);g.yoyo&&h%2===1&&(v=1-v);for(let y of g.props)ei(g.target,y.key,y.from+(y.to-y.from)*v);g.scaleFrom&&g.scaleTo&&ti(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{(c=g.onUpdate)==null||c.call(g)}catch{}if(f>=b){s(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},l=(u,c,p)=>{var y;let g=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),m=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=Aa(c.ease),A=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,b=c.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let I of Object.keys(c)){if(h.has(I))continue;let P=c[I];typeof P=="number"&&v.push({key:I,from:Ca(u,I),to:P})}let w=ni(u,c);return{target:u,startMs:ut(),delayMs:m,durationMs:g,ease:f,props:v,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,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(u,c){let p=l(u,c);return a(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=ut())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:ut(),m=ut()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,c,p){return d.set(u,c),d.to(u,p)},set(u,c){if(!u||!c)return;for(let g of Object.keys(c)){let m=c[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ei(u,g,m)}let p=ni(u,c);p.to&&ti(u,p.to)},killTweensOf(u){let c=e.get(u);if(c)for(let p of Array.from(c))s(p)},timeline(u={}){let c=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let v=typeof h=="string"?h.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},A=h=>{c.push(h);let v=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+v)},b={to(h,v,w){return A({kind:"to",target:h,vars:v,atMs:f(w)}),b},fromTo(h,v,w,y){return A({kind:"fromTo",target:h,vars:w,from:v,atMs:f(y)}),b},play(){var h,v;if(g)return b;g=!0,m=[];for(let w of c)w.kind==="fromTo"&&d.set(w.target,(h=w.from)!=null?h:{}),m.push(d.to(w.target,{...w.vars,delay:w.atMs/1e3+((v=w.vars.delay)!=null?v: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 d}function ai(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ii()}catch{}}var ri={name:"handler-playable-sdk",version:"0.5.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 Z=0,ka=Z++,si=Z++,oi=Z++,li=Z++,ci=Z++,di=Z++,pi=Z++,ui=Z++,gi=Z++,hi=Z++,fi=Z++,mi=Z++,j=ka;function bi(){return j===si}function yi(){return j===oi}function vi(){return j===li}function wi(){return j===ci}function Ne(){return j===di}function Fe(){return j===pi}function xi(){return j===ui}function Ei(){return j===gi}function Si(){return j===hi}function cn(){return j===fi}function dn(){return j===mi}function Ai(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),j=si;return}catch{}else if(n==="dapi")try{dapi.isReady(),j=oi;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=li)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=ci)}catch{}else if(e==="mintegral")window.gameReady&&(j=di);else if(e==="tapjoy")window.TJ_API&&(j=pi);else if(e==="tiktok")window.openAppStore&&(j=ui);else if(e==="smadex")try{window.smxTracking&&(j=gi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=hi)}catch{}else e==="vungle"?j=fi:(n==="nucleo"||e==="nucleo")&&(j=mi)}var Ot=Pt(require("lottie-web"),1),Ci=Ot.default;typeof window!="undefined"&&(window.lottie=Ot.default,window.__baseLottie=Ot.default);gn();function D(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var vs=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:D(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:D(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:D(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:D(360,780)}],ws=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:D(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:D(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:D(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:D(412,915)}],xs=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:D(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:D(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:D(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:D(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:D(800,1280)}],Ii=[{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:D(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:D(768,1024),mraidScale:.7}];var Es=[...Ii];var za=Ii[0];ce();var Fa=Pt(require("jszip"),1);function Da(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ha(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Na(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function hn(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await Da(a),s=await Na(r),o=Ha(r);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:r,width:(e=s==null?void 0:s.width)!=null?e:0,height:(t=s==null?void 0:s.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Rt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((c,p)=>{let g=new Image;g.onload=()=>c(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let r=a.getImageData(0,0,i.width,i.height),s=r.data,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:s[c.offset],g:s[c.offset+1],b:s[c.offset+2]})),d=0;for(let c=0;c<s.length;c+=4){let p=s[c],g=s[c+1],m=s[c+2],f=!1;for(let A of l)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&&(s[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(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Pi=require("@google/genai");async function fn(n,e,t=[],i={}){var a,r,s,o,l,d,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let 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 c=new Pi.GoogleGenAI({apiKey:n}),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 c.models.generateContent({model:p,contents:g}),f="",A=(s=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:s.parts;if(A)for(let b of A)b.text&&(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(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(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."):(u=c.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var _i=require("@google/genai");async function zt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new _i.GoogleGenAI({apiKey:n}),r=[{text:e}];t.length>0&&t.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),r.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.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 Wa=require("pixi.js");gt();ce();var Di=require("pixi.js");var Ya=require("pixi.js");ce();function nr(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function ir(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ar(n){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let d=o.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",s=>{s.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Nr={};Wn(Nr,{AssetCache:()=>ae,AssetLoader:()=>Ce,AssetSystem:()=>Kt,AssetTextures:()=>Te,Assets:()=>ua,BaseSystem:()=>Ze,GameEngine:()=>Yt,GameObject:()=>At,GameObjectManager:()=>Xe,ObjectFactory:()=>Le,Renderer:()=>St,RuntimeObjectRegistry:()=>Qe,Transform:()=>Et,applyScreenAnchor:()=>Zt,basePixi:()=>la,clearResponsiveElements:()=>ha,createPixiBase:()=>Vt,getRegisteredFontIds:()=>aa,globalResponsiveMultipliers:()=>Tt,initAssetTextures:()=>Ht,initAssets:()=>ga,layout:()=>ma,playLottieOverlay:()=>sa,registerFont:()=>ia,registerType:()=>$t,resolveAnchorVec2:()=>$e,resolveFont:()=>ta,resolveFontWeight:()=>na,resolveScreenAnchorPoint:()=>et,resolveScreenRatioPoint:()=>tt,runInitSequence:()=>ba,setLottieInstance:()=>Nt,spawnSceneFromConfig:()=>da,updateScreenState:()=>Jt});module.exports=Sa(Nr);var ea=require("pixi.js");var Se={};function _t(n,e,t=!1){Se[n]||(Se[n]=[]),Se[n].push({fn:e,once:t})}function on(n,e){if(Se[n]){if(!e){delete Se[n];return}Se[n]=Se[n].filter(t=>t.fn!==e)}}function jt(n,...e){let t=Se[n];if(t)for(let i of[...t])i.fn(...e),i.once&&on(n,i.fn)}function J(n,e){_t(n,e,!0)}var $=null,ee=[],He=null;function Jn(n){$=n,ee=[],He!==null&&(clearTimeout(He),He=null)}function Zn(){var n,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(n=$==null?void 0:$.batchSize)!=null?n:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function Kn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function ln(n,e){let t=Zn();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){Xn();return}He===null&&(He=window.setTimeout(()=>{He=null,Xn()},t.flushIntervalMs))}}async function Xn(){let n=Zn();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await Kn(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await Kn(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Qn(n){return Math.max(0,Math.min(1,n))}function Aa(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ut(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ca(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ei(n,e,t){try{n[e]=t}catch{}}function Ta(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ti(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function ni(n,e){let t=Ta(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ii(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let c=(p=e.get(u.target))!=null?p:new Set;c.add(u),e.set(u.target,c),i()},r=u=>{n.delete(u);let c=e.get(u.target);c&&(c.delete(u),c.size===0&&e.delete(u.target))},s=u=>{u.killed||(u.killed=!0,r(u))},o=()=>{var c,p;let u=ut();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,A=Qn(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=Qn(y)}let v=g.ease(A);g.yoyo&&h%2===1&&(v=1-v);for(let y of g.props)ei(g.target,y.key,y.from+(y.to-y.from)*v);g.scaleFrom&&g.scaleTo&&ti(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{(c=g.onUpdate)==null||c.call(g)}catch{}if(f>=b){s(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},l=(u,c,p)=>{var y;let g=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),m=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=Aa(c.ease),A=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,b=c.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let I of Object.keys(c)){if(h.has(I))continue;let P=c[I];typeof P=="number"&&v.push({key:I,from:Ca(u,I),to:P})}let w=ni(u,c);return{target:u,startMs:ut(),delayMs:m,durationMs:g,ease:f,props:v,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,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(u,c){let p=l(u,c);return a(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=ut())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:ut(),m=ut()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,c,p){return d.set(u,c),d.to(u,p)},set(u,c){if(!u||!c)return;for(let g of Object.keys(c)){let m=c[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ei(u,g,m)}let p=ni(u,c);p.to&&ti(u,p.to)},killTweensOf(u){let c=e.get(u);if(c)for(let p of Array.from(c))s(p)},timeline(u={}){let c=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let v=typeof h=="string"?h.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},A=h=>{c.push(h);let v=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+v)},b={to(h,v,w){return A({kind:"to",target:h,vars:v,atMs:f(w)}),b},fromTo(h,v,w,y){return A({kind:"fromTo",target:h,vars:w,from:v,atMs:f(y)}),b},play(){var h,v;if(g)return b;g=!0,m=[];for(let w of c)w.kind==="fromTo"&&d.set(w.target,(h=w.from)!=null?h:{}),m.push(d.to(w.target,{...w.vars,delay:w.atMs/1e3+((v=w.vars.delay)!=null?v: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 d}function ai(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ii()}catch{}}var ri={name:"handler-playable-sdk",version:"0.5.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 Z=0,ka=Z++,si=Z++,oi=Z++,li=Z++,ci=Z++,di=Z++,pi=Z++,ui=Z++,gi=Z++,hi=Z++,fi=Z++,mi=Z++,j=ka;function bi(){return j===si}function yi(){return j===oi}function vi(){return j===li}function wi(){return j===ci}function Ne(){return j===di}function Fe(){return j===pi}function xi(){return j===ui}function Ei(){return j===gi}function Si(){return j===hi}function cn(){return j===fi}function dn(){return j===mi}function Ai(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),j=si;return}catch{}else if(n==="dapi")try{dapi.isReady(),j=oi;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=li)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=ci)}catch{}else if(e==="mintegral")window.gameReady&&(j=di);else if(e==="tapjoy")window.TJ_API&&(j=pi);else if(e==="tiktok")window.openAppStore&&(j=ui);else if(e==="smadex")try{window.smxTracking&&(j=gi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=hi)}catch{}else e==="vungle"?j=fi:(n==="nucleo"||e==="nucleo")&&(j=mi)}var Ot=Pt(require("lottie-web"),1),Ci=Ot.default;typeof window!="undefined"&&(window.lottie=Ot.default,window.__baseLottie=Ot.default);gn();function D(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var vs=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:D(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:D(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:D(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:D(360,780)}],ws=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:D(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:D(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:D(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:D(412,915)}],xs=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:D(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:D(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:D(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:D(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:D(800,1280)}],Ii=[{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:D(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:D(768,1024),mraidScale:.7}];var Es=[...Ii];var za=Ii[0];ce();var Fa=Pt(require("jszip"),1);function Da(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ha(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Na(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function hn(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await Da(a),s=await Na(r),o=Ha(r);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:r,width:(e=s==null?void 0:s.width)!=null?e:0,height:(t=s==null?void 0:s.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Rt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((c,p)=>{let g=new Image;g.onload=()=>c(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let r=a.getImageData(0,0,i.width,i.height),s=r.data,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:s[c.offset],g:s[c.offset+1],b:s[c.offset+2]})),d=0;for(let c=0;c<s.length;c+=4){let p=s[c],g=s[c+1],m=s[c+2],f=!1;for(let A of l)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&&(s[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(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Pi=require("@google/genai");async function fn(n,e,t=[],i={}){var a,r,s,o,l,d,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let 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 c=new Pi.GoogleGenAI({apiKey:n}),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 c.models.generateContent({model:p,contents:g}),f="",A=(s=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:s.parts;if(A)for(let b of A)b.text&&(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(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(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."):(u=c.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var _i=require("@google/genai");async function zt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new _i.GoogleGenAI({apiKey:n}),r=[{text:e}];t.length>0&&t.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),r.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.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 Wa=require("pixi.js");gt();ce();var Di=require("pixi.js");var Ya=require("pixi.js");ce();function nr(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function ir(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ar(n){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|
package/dist/pixi/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x219535,_0x5dc97){var a0_0x504066={_0x26ecab:0x2b2,_0x4271d0:0x2a7,_0x2fefb4:0x2a5,_0x5b6acd:'8x@O',_0x3a17d9:0x23e,_0x20b371:0x233,_0x5bbcd4:0x22f,_0x1f7872:0x2ad,_0x58d02b:'gNa2',_0x8d254d:0x2ab,_0x5019a6:0x29d,_0x30e7dc:0x2b2,_0x277677:0x32b,_0x2f2bba:0x32c,_0x3514a3:'5nCl',_0x447204:0x32a,_0x5b0a89:0x350,_0x1ea4eb:0x343,_0x3fb0a2:'b47D',_0x31cae2:0x245,_0x1d2773:'13BM',_0x126e7f:0x255,_0x39dd21:0x339,_0x2aacff:'YvHu',_0x2194bf:0x345,_0x1abac3:0x289,_0x2b76e0:'R[qE',_0x35214b:0x297,_0x5b95f1:0x284,_0x2a7e79:0x33e,_0x47d50f:0x338,_0x29a8f5:0x336,_0x49c5f2:0x337,_0x1a058b:0x344,_0x2fecc2:'DWrI'},a0_0x8cc4cf={_0x50613b:0x312},a0_0x4bff8f={_0x3fda2e:0x25d},a0_0x30d84c={_0x47aa47:0x1c0};function _0x59c6c9(_0x49edc8,_0x406f61,_0x18ac2b,_0xc98e1f,_0x229b33){return a0_0x2b49(_0x18ac2b-a0_0x30d84c._0x47aa47,_0x406f61);}function _0x4a1afb(_0x10f2cc,_0x1c7c6a,_0x30424c,_0xc5029f,_0x3287cb){return a0_0x2b49(_0x30424c-a0_0x4bff8f._0x3fda2e,_0xc5029f);}function _0x1aeff4(_0x5d70b3,_0x3f309d,_0x511bb9,_0x155960,_0x5e62ee){return a0_0x2b49(_0x5d70b3- -a0_0x8cc4cf._0x50613b,_0x3f309d);}var _0x154558=_0x219535();while(!![]){try{var _0x5b8299=-parseInt(_0x59c6c9(a0_0x504066._0x26ecab,'Q!rx',a0_0x504066._0x4271d0,a0_0x504066._0x2fefb4,0x29c))/(-0x2*-0x5a3+0x1da4*0x1+0x28e9*-0x1)+-parseInt(_0x1aeff4(-0x22f,a0_0x504066._0x5b6acd,-a0_0x504066._0x3a17d9,-a0_0x504066._0x20b371,-a0_0x504066._0x5bbcd4))/(-0x12ea+0xc39+0x6b3)+-parseInt(_0x59c6c9(a0_0x504066._0x1f7872,a0_0x504066._0x58d02b,a0_0x504066._0x8d254d,a0_0x504066._0x5019a6,a0_0x504066._0x30e7dc))/(0x2*-0xb7d+-0x1*-0xc73+0xa8a)+parseInt(_0x4a1afb(a0_0x504066._0x277677,a0_0x504066._0x2f2bba,0x337,a0_0x504066._0x3514a3,a0_0x504066._0x447204))/(0x5*0x19f+0x19a6+-0x21bd)*(-parseInt(_0x4a1afb(0x351,a0_0x504066._0x5b0a89,a0_0x504066._0x1ea4eb,a0_0x504066._0x3fb0a2,0x33f))/(-0x25*-0x47+-0x263b+0x1bfd))+parseInt(_0x1aeff4(-a0_0x504066._0x31cae2,a0_0x504066._0x1d2773,-0x247,-a0_0x504066._0x126e7f,-0x23c))/(0x2*0xcf5+0x74b*-0x1+-0x1*0x1299)+parseInt(_0x4a1afb(0x346,0x33d,a0_0x504066._0x39dd21,a0_0x504066._0x2aacff,a0_0x504066._0x2194bf))/(0xb65+-0x46a+-0x6f4)*(parseInt(_0x59c6c9(a0_0x504066._0x1abac3,a0_0x504066._0x2b76e0,0x294,a0_0x504066._0x35214b,a0_0x504066._0x5b95f1))/(-0xef5*0x1+-0xb1b*-0x1+0x3e2))+parseInt(_0x4a1afb(a0_0x504066._0x2a7e79,a0_0x504066._0x47d50f,a0_0x504066._0x29a8f5,a0_0x504066._0x2aacff,a0_0x504066._0x49c5f2))/(0xe5b+-0x1*-0x1c86+-0x3*0xe48)*(parseInt(_0x4a1afb(0x343,a0_0x504066._0x1a058b,0x33e,a0_0x504066._0x2fecc2,0x330))/(-0xc59*0x3+-0x2081+0x4596));if(_0x5b8299===_0x5dc97)break;else _0x154558['push'](_0x154558['shift']());}catch(_0x27c40a){_0x154558['push'](_0x154558['shift']());}}}(a0_0x579d,-0x701cc+-0xa669f+0x1a528a));var a0_0x46be5f=(function(){var a0_0x39a704={_0x1f0022:'7%o0',_0x4804b7:0x67,_0x343cab:0x73,_0x80476b:0x5c},_0xb54dbf=!![];return function(_0x337866,_0x195c9f){var a0_0x4500f6={_0x5af7b7:0x146},_0x127f9c=_0xb54dbf?function(){function _0x7bf2ea(_0x324e09,_0xe94eda,_0x15cfad,_0xd9879c,_0x2070ca){return a0_0x2b49(_0x15cfad- -a0_0x4500f6._0x5af7b7,_0xe94eda);}if(_0x195c9f){var _0x3d55c8=_0x195c9f[_0x7bf2ea(-0x6a,a0_0x39a704._0x1f0022,-a0_0x39a704._0x4804b7,-a0_0x39a704._0x343cab,-a0_0x39a704._0x80476b)](_0x337866,arguments);return _0x195c9f=null,_0x3d55c8;}}:function(){};return _0xb54dbf=![],_0x127f9c;};}()),a0_0x47d0a4=a0_0x46be5f(this,function(){var a0_0x231050={_0x53645e:0x122,_0x2d3a94:'2K1o',_0x516895:0x11d,_0x2533ce:0x123,_0xcc5504:0x11c,_0x1830a0:0xfd,_0xaca0b7:'Q!rx',_0x297ca3:0xff,_0x4dfe23:0x108,_0x26ebbe:0x116,_0x627dc0:0x141,_0x1cd0f7:0x139,_0x4d3aed:'pffV',_0xf1f5a9:0x154,_0x48b004:0x143,_0x5bd52a:0x159,_0x492132:0x14e,_0x1dc6f8:'7%o0',_0x559f22:0x15e,_0x7eef14:0x155,_0x57dbfa:'b47D',_0x2b0188:0x146,_0x12f63f:0x150,_0x5f4b1e:'aqDZ',_0x571d00:0x138,_0x486d58:0x136,_0x2b303b:0x140,_0x6c8fa9:0x134,_0x8ed14a:'Vg6M',_0x5be8b1:0x125,_0x2449f9:0x129,_0x1ec90b:0x126,_0x48364e:0x144,_0xff9fea:0x149,_0x4b4b69:'8x@O',_0x4694a5:0x13b,_0x2d4417:'R$ll',_0x14f45c:0x161,_0x36ccd6:0x157,_0x227742:0x15d,_0x3f8579:'lPxl',_0x5119b4:0x13e,_0x1e5e9d:'oecO',_0x543bf8:0x12a,_0x841fb1:0x11f,_0x3b00af:0x145,_0x12ac4e:0x147,_0x17d57f:'h$vi'},a0_0x4893d2={_0x2d954e:0x78},a0_0x285a57={_0x518abb:0x1f2},_0x24b4f4={};_0x24b4f4[_0x9af2fe(-a0_0x231050._0x53645e,a0_0x231050._0x2d3a94,-a0_0x231050._0x516895,-a0_0x231050._0x2533ce,-a0_0x231050._0xcc5504)]=_0x9af2fe(-a0_0x231050._0x1830a0,a0_0x231050._0xaca0b7,-a0_0x231050._0x297ca3,-a0_0x231050._0x4dfe23,-a0_0x231050._0x26ebbe)+_0x550da1(a0_0x231050._0x627dc0,a0_0x231050._0x1cd0f7,0x149,0x12b,a0_0x231050._0x4d3aed)+'+$';function _0x550da1(_0xa0eeac,_0x25857a,_0x4e5c80,_0x56abe3,_0x574ef5){return a0_0x2b49(_0x25857a-0x64,_0x574ef5);}var _0x6da142=_0x24b4f4;function _0x9af2fe(_0x10961e,_0x1621d8,_0x5de7e1,_0x1fa111,_0x6bcff4){return a0_0x2b49(_0x1fa111- -a0_0x285a57._0x518abb,_0x1621d8);}function _0x196aba(_0xc32031,_0x4f880d,_0x428632,_0x588d6d,_0x5a2d1d){return a0_0x2b49(_0x588d6d-a0_0x4893d2._0x2d954e,_0x5a2d1d);}return a0_0x47d0a4[_0x196aba(a0_0x231050._0xf1f5a9,a0_0x231050._0x48b004,a0_0x231050._0x5bd52a,a0_0x231050._0x492132,a0_0x231050._0x1dc6f8)+_0x196aba(0x151,0x164,a0_0x231050._0x559f22,a0_0x231050._0x7eef14,a0_0x231050._0x57dbfa)]()[_0x550da1(0x155,a0_0x231050._0x2b0188,a0_0x231050._0x12f63f,0x14e,a0_0x231050._0x5f4b1e)+'h'](_0x550da1(a0_0x231050._0x571d00,a0_0x231050._0x486d58,a0_0x231050._0x2b303b,a0_0x231050._0x6c8fa9,a0_0x231050._0x8ed14a)+_0x9af2fe(-a0_0x231050._0x5be8b1,'pffV',-a0_0x231050._0x2449f9,-0x11d,-a0_0x231050._0x1ec90b)+'+$')[_0x196aba(a0_0x231050._0x48364e,a0_0x231050._0x7eef14,0x14c,a0_0x231050._0xff9fea,a0_0x231050._0x4b4b69)+_0x550da1(0x135,a0_0x231050._0x4694a5,0x13d,0x132,a0_0x231050._0x2d4417)]()[_0x196aba(0x164,a0_0x231050._0x14f45c,a0_0x231050._0x36ccd6,a0_0x231050._0x227742,a0_0x231050._0x3f8579)+_0x550da1(0x13f,a0_0x231050._0x6c8fa9,a0_0x231050._0x5119b4,0x142,a0_0x231050._0x1e5e9d)+'r'](a0_0x47d0a4)[_0x9af2fe(-a0_0x231050._0x543bf8,'##[R',-0x129,-a0_0x231050._0x841fb1,-a0_0x231050._0x516895)+'h'](_0x6da142[_0x550da1(a0_0x231050._0x3b00af,0x13c,0x13b,a0_0x231050._0x12ac4e,a0_0x231050._0x17d57f)]);});a0_0x47d0a4();import{A as a0_0x9945c1,B as a0_0xda890a,C as a0_0x38b748,D as a0_0x538200,b as a0_0x29048f,c as a0_0x24ba52,d as a0_0x931ae1,e as a0_0x13fa92,f as a0_0x50e393,g as a0_0x1c2131,h as a0_0x19f2fa,i as a0_0x14fd3a,j as a0_0x963424,k as a0_0xdb6e8e,l as a0_0x59ad3e,m as a0_0x449b70,n as a0_0x2a7d32,o as a0_0x57f647,p as a0_0x406832,q as a0_0x395ece,r as a0_0x14ccbd,s as a0_0x473d24,t as a0_0x5825e6,u as a0_0x59ebcc,v as a0_0x458065,w as a0_0x1bb978,x as a0_0x485e57,y as a0_0x3c5144,z as a0_0x4cd55a}from'../chunk-RLJOGLPW.js';import{a as a0_0x551034,b as a0_0x5de580,c as a0_0x12ec99,d as a0_0x582e0c,e as a0_0x775f7d}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';function a0_0x2b49(_0x3c3656,_0x10721e){_0x3c3656=_0x3c3656-(0x15*0x7+0x88c*0x1+-0x852);var _0x5155bf=a0_0x579d();var _0x22effb=_0x5155bf[_0x3c3656];if(a0_0x2b49['YEUGZV']===undefined){var _0x514418=function(_0x392ff2){var _0x5736ee='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x588196='',_0x3a15de='',_0x2f3428=_0x588196+_0x514418;for(var _0x3d98c5=0x1b4*0x3+0x16fb+0x1a7*-0x11,_0x2a4c86,_0xdffa73,_0x25f753=-0x1f51+-0x7*-0x4e3+-0x2e4;_0xdffa73=_0x392ff2['charAt'](_0x25f753++);~_0xdffa73&&(_0x2a4c86=_0x3d98c5%(0x62*0x35+0x1df*-0xe+0x5ec)?_0x2a4c86*(-0x2*-0x1019+0x4e7*-0x1+0x17*-0x12d)+_0xdffa73:_0xdffa73,_0x3d98c5++%(-0x1*-0x351+-0xcbf*0x3+0x158*0x1a))?_0x588196+=_0x2f3428['charCodeAt'](_0x25f753+(-0x23b8+-0xad*0x13+0x3099))-(-0x227c+0xa47+0x183f)!==-0x1*-0x8f5+-0xfdf+0x24e*0x3?String['fromCharCode'](-0x17+-0x1c4a+0x1d60&_0x2a4c86>>(-(0x1de4*-0x1+0x13b+0x1cab*0x1)*_0x3d98c5&0x1*0x1809+-0x4c7*0x1+-0x133c)):_0x3d98c5:-0x1*-0x68f+-0x1*0x72d+0x9e){_0xdffa73=_0x5736ee['indexOf'](_0xdffa73);}for(var _0x27817b=0x184a+-0x1680+-0x1ca,_0x1d6f47=_0x588196['length'];_0x27817b<_0x1d6f47;_0x27817b++){_0x3a15de+='%'+('00'+_0x588196['charCodeAt'](_0x27817b)['toString'](-0x1dc1+-0x901*-0x4+-0x633))['slice'](-(0x765+0x1d59+-0x24bc));}return decodeURIComponent(_0x3a15de);};var _0x4a8411=function(_0x3d3eb7,_0x54b5ee){var _0x6f143a=[],_0x3d5def=-0x16b4+0x1b34+-0x480,_0x6ad6fb,_0x20d426='';_0x3d3eb7=_0x514418(_0x3d3eb7);var _0x4135ac;for(_0x4135ac=0x1d*-0x115+-0x1bd6+0x1f*0x1e9;_0x4135ac<0x7ef*0x1+0x2f*-0x78+0xf19;_0x4135ac++){_0x6f143a[_0x4135ac]=_0x4135ac;}for(_0x4135ac=0x1439*0x1+-0x373*-0x3+-0x45e*0x7;_0x4135ac<-0x1dca+0x319+-0x3*-0x93b;_0x4135ac++){_0x3d5def=(_0x3d5def+_0x6f143a[_0x4135ac]+_0x54b5ee['charCodeAt'](_0x4135ac%_0x54b5ee['length']))%(-0x2175+0x2f9+0x1f7c),_0x6ad6fb=_0x6f143a[_0x4135ac],_0x6f143a[_0x4135ac]=_0x6f143a[_0x3d5def],_0x6f143a[_0x3d5def]=_0x6ad6fb;}_0x4135ac=-0xe*0xd4+0x7f7+0x3a1,_0x3d5def=0xe48+0x8d*0x2c+0x91*-0x44;for(var _0x5280c6=-0x167*0x1+-0x3d*0x1d+0xe*0x98;_0x5280c6<_0x3d3eb7['length'];_0x5280c6++){_0x4135ac=(_0x4135ac+(0x8e4+0x19cb+-0x22ae))%(0x737*0x3+0x3f*0x31+-0x20b4),_0x3d5def=(_0x3d5def+_0x6f143a[_0x4135ac])%(0x21d9+-0x1055+0x7*-0x25c),_0x6ad6fb=_0x6f143a[_0x4135ac],_0x6f143a[_0x4135ac]=_0x6f143a[_0x3d5def],_0x6f143a[_0x3d5def]=_0x6ad6fb,_0x20d426+=String['fromCharCode'](_0x3d3eb7['charCodeAt'](_0x5280c6)^_0x6f143a[(_0x6f143a[_0x4135ac]+_0x6f143a[_0x3d5def])%(-0x16a9+-0x5d4*0x1+0x1d7d*0x1)]);}return _0x20d426;};a0_0x2b49['hsNRAf']=_0x4a8411,a0_0x2b49['hLbxND']={},a0_0x2b49['YEUGZV']=!![];}var _0x170f57=_0x5155bf[0x40*-0x37+-0x16ad+0x246d],_0x4f5167=_0x3c3656+_0x170f57,_0x26c9a1=a0_0x2b49['hLbxND'][_0x4f5167];if(!_0x26c9a1){if(a0_0x2b49['OMSdaP']===undefined){var _0x15c4ab=function(_0x49f946){this['bxxKPa']=_0x49f946,this['yKgFaM']=[0x186d*-0x1+-0xcda+0x2548,0x1*-0x1dd2+0x132b+-0x3*-0x38d,-0x43f*0x4+-0x341*0x2+0x177e],this['sLjkvn']=function(){return'newState';},this['qHHgjD']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['fcsgrQ']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x15c4ab['prototype']['NvaNJK']=function(){var _0x2aa655=new RegExp(this['qHHgjD']+this['fcsgrQ']),_0x402d75=_0x2aa655['test'](this['sLjkvn']['toString']())?--this['yKgFaM'][0x425*0x1+0xb46+0xf6a*-0x1]:--this['yKgFaM'][0x1a65+-0xba*-0x2a+-0x38e9];return this['yFpLXO'](_0x402d75);},_0x15c4ab['prototype']['yFpLXO']=function(_0x29042d){if(!Boolean(~_0x29042d))return _0x29042d;return this['dkrwMa'](this['bxxKPa']);},_0x15c4ab['prototype']['dkrwMa']=function(_0x27977f){for(var _0x803e6b=0x124*-0x4+0x15a*-0x11+0x1b8a,_0x422fb4=this['yKgFaM']['length'];_0x803e6b<_0x422fb4;_0x803e6b++){this['yKgFaM']['push'](Math['round'](Math['random']())),_0x422fb4=this['yKgFaM']['length'];}return _0x27977f(this['yKgFaM'][0x9c6*-0x1+-0x19*-0x53+0x1ab]);},new _0x15c4ab(a0_0x2b49)['NvaNJK'](),a0_0x2b49['OMSdaP']=!![];}_0x22effb=a0_0x2b49['hsNRAf'](_0x22effb,_0x10721e),a0_0x2b49['hLbxND'][_0x4f5167]=_0x22effb;}else _0x22effb=_0x26c9a1;return _0x22effb;}import'../chunk-HVKF2KYL.js';import'../chunk-E6WJCS24.js';function a0_0x579d(){var _0x19334a=['u8kFvaOjWOKpsv8dWOzbW7C','xmkPW4aHW5CgW5tdMSkjhbrguq','bsaPWRFcU8kAWOVdPq','wt7dMuRcNq','z24dWQNcUW','ASkDiSkVhG','W75qWQBcNx4','WOL6fZaJ','r3BdPSkFCmoNyMPbW7e','fvyDqhO','W7rOqCoQDG','j8ofEa','gw/cGvZcVa','xCoEl8kCpSogW6NcVmk1WQhcMCoNka','W6BdNmkTWQKrWRZdJhy9iYW3','rmo+W7WfvJNcHhpdSSk2WRlcQ1i','xSozlmkyqmkvWRtcLmkGWQy','WQdcTmoU','vmkPW4aQW5CpWPRdJCkokcff','W6f3ySoYFq','W7vauGdcQ2vzs8oTbG','jCklW74qWOK7WQddOq','se/cGCorWQO','lmodr8oTvCk6e8ojW6v1ySoKaq','WQSCW6n7aSkjw8k6nGJdRe4O','W6GPWQCjlW','W7/dQSopjSkqpeVcKa','W7LcvGhdLJLpv8omigyt','W51XtCoSW6u6ArzIt0TxWRG','ASkLWP1LW6i7aSoAWOxcJGrZ','W6HEtb3dJG'];a0_0x579d=function(){return _0x19334a;};return a0_0x579d();}import'../chunk-JXBG6UFL.js';export{a0_0x551034 as AssetCache,a0_0x12ec99 as AssetLoader,a0_0x59ebcc as AssetSystem,a0_0x582e0c as AssetTextures,a0_0x473d24 as Assets,a0_0x57f647 as BaseSystem,a0_0x2a7d32 as GameEngine,a0_0x13fa92 as GameObject,a0_0x50e393 as GameObjectManager,a0_0x449b70 as ObjectFactory,a0_0x931ae1 as Renderer,a0_0x406832 as RuntimeObjectRegistry,a0_0x24ba52 as Transform,a0_0xda890a as applyScreenAnchor,a0_0x395ece as basePixi,a0_0x1bb978 as clearResponsiveElements,a0_0x29048f as createPixiBase,a0_0x963424 as getRegisteredFontIds,a0_0x458065 as globalResponsiveMultipliers,a0_0x775f7d as initAssetTextures,a0_0x5825e6 as initAssets,a0_0x38b748 as layout,a0_0x59ad3e as playLottieOverlay,a0_0x14fd3a as registerFont,a0_0x5de580 as registerType,a0_0x3c5144 as resolveAnchorVec2,a0_0x1c2131 as resolveFont,a0_0x19f2fa as resolveFontWeight,a0_0x4cd55a as resolveScreenAnchorPoint,a0_0x9945c1 as resolveScreenRatioPoint,a0_0x538200 as runInitSequence,a0_0xdb6e8e as setLottieInstance,a0_0x14ccbd as spawnSceneFromConfig,a0_0x485e57 as updateScreenState};
|
|
1
|
+
(function(_0x4bbef9,_0x3fe141){var a0_0xf7fb69={_0xcf9407:0x25,_0x41c43e:'CcmQ',_0x38a584:0x21,_0x195ba0:0x17,_0x53c4e1:0x12,_0x120101:0x11,_0x7e4741:'OE7]',_0x3dafb1:0xd,_0xe97efa:0x1a,_0x3e36a6:0x5,_0x6d33c7:'Mq)j',_0x25d360:0xb,_0x18083e:'@I0&',_0x43abb3:0x23,_0x4d9c8f:0x1d,_0x1ed2fd:0x1e,_0x195f62:0x2c3,_0x24a1aa:'8u^r',_0x1ce4e1:0x27,_0x4356dc:'x3sc',_0x2505d0:0x11,_0x19eee3:0x23b,_0x25aa11:0x238,_0x5b2f94:0x22e,_0x1c806e:0x1c,_0x435883:'e1PB',_0x25243e:0x25,_0x5aa8d9:0x7,_0x18037b:0x2b0,_0x4778da:0x2ad,_0x4c1472:0x2b5,_0x86af11:0x2af,_0xd325:'iycS',_0x326a2c:0x2ba,_0x63b9e3:0x2b6,_0x34f27a:0x2ab,_0x1b45d5:'jPfo'},a0_0x519ee4={_0x144390:0xd2},_0x4125a5=_0x4bbef9();function _0x11317a(_0x35ec6b,_0xced4f3,_0x177f2e,_0x301104,_0x247be4){return a0_0x1e10(_0x177f2e- -a0_0x519ee4._0x144390,_0xced4f3);}function _0x50d48b(_0x5b53c1,_0x1495be,_0x14d3d2,_0x5bd62d,_0x41c578){return a0_0x1e10(_0x5b53c1- -0x321,_0x41c578);}function _0x4d1abe(_0x3f870c,_0x2f5cd6,_0x22af69,_0x4c7764,_0x12d144){return a0_0x1e10(_0x3f870c-0x1cf,_0x12d144);}while(!![]){try{var _0x515e8c=parseInt(_0x11317a(a0_0xf7fb69._0xcf9407,a0_0xf7fb69._0x41c43e,a0_0xf7fb69._0x38a584,a0_0xf7fb69._0x195ba0,a0_0xf7fb69._0x53c4e1))/(-0x16d4+0x403*0x1+0x12d2)*(parseInt(_0x11317a(a0_0xf7fb69._0x120101,a0_0xf7fb69._0x7e4741,a0_0xf7fb69._0x3dafb1,a0_0xf7fb69._0xe97efa,0x15))/(0x171*-0x13+0x1201+0x964))+parseInt(_0x11317a(-a0_0xf7fb69._0x3e36a6,a0_0xf7fb69._0x6d33c7,a0_0xf7fb69._0x25d360,-0x3,a0_0xf7fb69._0x25d360))/(0x1837*0x1+-0x16b6+-0xbf*0x2)+-parseInt(_0x11317a(0x16,a0_0xf7fb69._0x18083e,a0_0xf7fb69._0x43abb3,a0_0xf7fb69._0x4d9c8f,a0_0xf7fb69._0x1ed2fd))/(-0x99f+-0x2509+0x2eac)+-parseInt(_0x4d1abe(a0_0xf7fb69._0x195f62,0x2c8,0x2b8,0x2c6,a0_0xf7fb69._0x24a1aa))/(-0xf1b+-0x5*-0x2b2+-0x2*-0xd3)*(-parseInt(_0x11317a(a0_0xf7fb69._0x1ce4e1,a0_0xf7fb69._0x4356dc,a0_0xf7fb69._0x1ed2fd,a0_0xf7fb69._0x195ba0,a0_0xf7fb69._0x2505d0))/(-0x3b*0x5d+-0x1*-0x164f+0x6d*-0x2))+parseInt(_0x50d48b(-0x237,-a0_0xf7fb69._0x19eee3,-a0_0xf7fb69._0x25aa11,-a0_0xf7fb69._0x5b2f94,'TKW%'))/(0x220b+-0xd0d+0x14f7*-0x1)*(-parseInt(_0x11317a(a0_0xf7fb69._0x1c806e,a0_0xf7fb69._0x435883,0x17,a0_0xf7fb69._0x25243e,a0_0xf7fb69._0x5aa8d9))/(-0x1313*-0x2+-0x1556+-0x10c8))+-parseInt(_0x4d1abe(a0_0xf7fb69._0x18037b,a0_0xf7fb69._0x4778da,a0_0xf7fb69._0x4c1472,a0_0xf7fb69._0x86af11,a0_0xf7fb69._0x4356dc))/(0xa*-0xe9+-0x268c+-0x3ab*-0xd)+-parseInt(_0x4d1abe(a0_0xf7fb69._0x86af11,0x2ac,0x2b8,0x2bb,a0_0xf7fb69._0xd325))/(-0x103*0x21+-0x8b*-0x7+0x1da0)*(-parseInt(_0x4d1abe(a0_0xf7fb69._0x326a2c,a0_0xf7fb69._0x4778da,a0_0xf7fb69._0x63b9e3,a0_0xf7fb69._0x34f27a,a0_0xf7fb69._0x1b45d5))/(-0x235e+0x1c48*0x1+0x721));if(_0x515e8c===_0x3fe141)break;else _0x4125a5['push'](_0x4125a5['shift']());}catch(_0x4e3152){_0x4125a5['push'](_0x4125a5['shift']());}}}(a0_0xc510,-0x92211+-0x47*-0x1ad7+0x951ef));var a0_0x1891b0=(function(){var _0x2822f2=!![];return function(_0x3cc858,_0x3429ad){var _0x1de3f5=_0x2822f2?function(){if(_0x3429ad){var _0x4e900f=_0x3429ad['apply'](_0x3cc858,arguments);return _0x3429ad=null,_0x4e900f;}}:function(){};return _0x2822f2=![],_0x1de3f5;};}()),a0_0x3ba321=a0_0x1891b0(this,function(){var a0_0x281a42={_0x52af62:0x29,_0x3acdf6:0x26,_0x39bfbb:'V#%G',_0x2a7d6c:0x2b,_0x30e8f6:0x1b,_0x4af1a0:0x2a,_0xb43949:0x490,_0x2d8f35:0x493,_0x2ca8f0:'VbH4',_0x402aad:0x484,_0x3e92df:0x2c,_0x13ea02:0x24,_0x1539ed:0x1d,_0xa20fa7:'V#%G',_0x4e55cb:0x44,_0x2b02f7:0x37,_0x2c6ec5:0x41,_0x48c2c5:'e1PB',_0x186217:0x31,_0x5008cd:0x28,_0x1bfdd3:0x499,_0x19ca69:0x496,_0xc7c994:0x4a5,_0x15a5b2:0x49e,_0x218296:0x493,_0x441243:'4lyv',_0x580928:0x499,_0x2ace40:0x460,_0x41269e:0x46f,_0x16f145:0x471,_0x49f221:0x42,_0x21bd74:0x3b,_0x340404:0x48,_0xbee86d:0x40,_0x2b67a0:'yjPj'},a0_0xf5188f={_0xe6c2c7:0x377},a0_0x148be3={_0x3e30f9:0x3ab},a0_0x48a205={_0xc674fa:0x11e};function _0x35d12b(_0x18999d,_0x268676,_0x399b15,_0x2b5be7,_0x4452a4){return a0_0x1e10(_0x268676- -a0_0x48a205._0xc674fa,_0x4452a4);}function _0x57539f(_0x15dbd6,_0x2879a9,_0x4c010c,_0x24d033,_0x3a7cc5){return a0_0x1e10(_0x15dbd6-a0_0x148be3._0x3e30f9,_0x24d033);}var _0xa58c28={};_0xa58c28[_0x35d12b(-a0_0x281a42._0x52af62,-0x25,-a0_0x281a42._0x3acdf6,-a0_0x281a42._0x52af62,a0_0x281a42._0x39bfbb)]=_0x35d12b(-a0_0x281a42._0x2a7d6c,-0x27,-a0_0x281a42._0x30e8f6,-a0_0x281a42._0x4af1a0,'8u^r')+_0x57539f(a0_0x281a42._0xb43949,a0_0x281a42._0x2d8f35,0x49f,a0_0x281a42._0x2ca8f0,a0_0x281a42._0x402aad)+'+$';function _0x404503(_0x23a106,_0x1a9182,_0x5a4970,_0x21a6f6,_0x5b855f){return a0_0x1e10(_0x1a9182-a0_0xf5188f._0xe6c2c7,_0x5a4970);}var _0x9e19c=_0xa58c28;return a0_0x3ba321[_0x35d12b(-a0_0x281a42._0x3e92df,-a0_0x281a42._0x13ea02,-a0_0x281a42._0x1539ed,-a0_0x281a42._0x3acdf6,a0_0x281a42._0xa20fa7)+_0x35d12b(-a0_0x281a42._0x4e55cb,-a0_0x281a42._0x2b02f7,-a0_0x281a42._0x2c6ec5,-0x3e,a0_0x281a42._0x48c2c5)]()[_0x35d12b(-a0_0x281a42._0x2c6ec5,-a0_0x281a42._0x186217,-a0_0x281a42._0x5008cd,-0x36,'Vi[[')+'h'](_0x9e19c['NGExY'])['toStr'+_0x57539f(a0_0x281a42._0x1bfdd3,a0_0x281a42._0x19ca69,a0_0x281a42._0xc7c994,'YG*0',a0_0x281a42._0x15a5b2)]()[_0x57539f(a0_0x281a42._0x218296,a0_0x281a42._0x1bfdd3,0x499,a0_0x281a42._0x441243,a0_0x281a42._0x580928)+'ructo'+'r'](a0_0x3ba321)[_0x404503(a0_0x281a42._0x2ace40,a0_0x281a42._0x41269e,'cwPn',a0_0x281a42._0x16f145,0x46a)+'h'](_0x9e19c[_0x35d12b(-a0_0x281a42._0x49f221,-a0_0x281a42._0x21bd74,-a0_0x281a42._0x340404,-a0_0x281a42._0xbee86d,a0_0x281a42._0x2b67a0)]);});function a0_0x1e10(_0x2be0a5,_0x439647){_0x2be0a5=_0x2be0a5-(0x7*-0x1e2+0xe10+-0x5);var _0x106c84=a0_0xc510();var _0x23f184=_0x106c84[_0x2be0a5];if(a0_0x1e10['CRLMRM']===undefined){var _0x27c3ab=function(_0x4023a6){var _0x166bab='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x38e341='',_0x28665d='',_0x4f1b01=_0x38e341+_0x27c3ab;for(var _0x1f660c=0xe71*-0x1+-0x2*-0x8de+-0x34b*0x1,_0x15872c,_0x4aea87,_0x4e276d=-0x1*-0xcb9+-0x37f+-0x93a;_0x4aea87=_0x4023a6['charAt'](_0x4e276d++);~_0x4aea87&&(_0x15872c=_0x1f660c%(-0xdfb+-0x24b5+0x32b4)?_0x15872c*(0x1*0x1381+0x4d*-0x3a+-0x1cf)+_0x4aea87:_0x4aea87,_0x1f660c++%(-0x4ae*-0x1+0x5b5*-0x5+0x17df))?_0x38e341+=_0x4f1b01['charCodeAt'](_0x4e276d+(0xa2d+0xd*0x220+0x25c3*-0x1))-(0x8*-0x2df+0xf*0x287+-0xee7)!==-0x227*0x5+0x2d*0xb5+-0x6e*0x31?String['fromCharCode'](-0x2ad*0xd+-0x1578+0x3940&_0x15872c>>(-(-0x2221+-0x18f8*0x1+0x3b1b)*_0x1f660c&0x23*-0x27+-0x122f+0x106*0x17)):_0x1f660c:-0x993+-0x1898*0x1+0x222b){_0x4aea87=_0x166bab['indexOf'](_0x4aea87);}for(var _0x1b8b31=0x12*-0x209+-0xb3f*-0x1+-0x43*-0x61,_0x3908a5=_0x38e341['length'];_0x1b8b31<_0x3908a5;_0x1b8b31++){_0x28665d+='%'+('00'+_0x38e341['charCodeAt'](_0x1b8b31)['toString'](0x1*0x1e6d+0x1486+0x7*-0x745))['slice'](-(-0xef8*0x2+0x1a4c+0x2*0x1d3));}return decodeURIComponent(_0x28665d);};var _0x1d409e=function(_0x2c687f,_0x5cc921){var _0x48a953=[],_0x593cb5=-0x122*0x1d+0x9d*-0x14+0x2d1e,_0x1fc237,_0x158376='';_0x2c687f=_0x27c3ab(_0x2c687f);var _0x2895a9;for(_0x2895a9=0xfd7*-0x1+-0x1189+-0xb20*-0x3;_0x2895a9<-0x172*0x11+0x1*-0x1ecb+-0x133*-0x2f;_0x2895a9++){_0x48a953[_0x2895a9]=_0x2895a9;}for(_0x2895a9=0x12f8+0x1*-0x1d+-0x12db;_0x2895a9<0x17c7+0x1*0xfa+-0x17c1;_0x2895a9++){_0x593cb5=(_0x593cb5+_0x48a953[_0x2895a9]+_0x5cc921['charCodeAt'](_0x2895a9%_0x5cc921['length']))%(0x194c+-0x1e98+0x4*0x193),_0x1fc237=_0x48a953[_0x2895a9],_0x48a953[_0x2895a9]=_0x48a953[_0x593cb5],_0x48a953[_0x593cb5]=_0x1fc237;}_0x2895a9=-0x21ba+0xa8c+0xb97*0x2,_0x593cb5=-0x10a*0x22+0x106b*-0x1+0x33bf;for(var _0x38b189=0x3af+0xe3*-0x25+0x1d20;_0x38b189<_0x2c687f['length'];_0x38b189++){_0x2895a9=(_0x2895a9+(0x53*0x14+0x16f+0x1*-0x7ea))%(0x1*0x694+-0x2223+0x1c8f),_0x593cb5=(_0x593cb5+_0x48a953[_0x2895a9])%(-0x2*0x10f1+0x29*-0x73+-0x1*-0x354d),_0x1fc237=_0x48a953[_0x2895a9],_0x48a953[_0x2895a9]=_0x48a953[_0x593cb5],_0x48a953[_0x593cb5]=_0x1fc237,_0x158376+=String['fromCharCode'](_0x2c687f['charCodeAt'](_0x38b189)^_0x48a953[(_0x48a953[_0x2895a9]+_0x48a953[_0x593cb5])%(-0x2346+0x5*0x481+0xdc1)]);}return _0x158376;};a0_0x1e10['fWsNCO']=_0x1d409e,a0_0x1e10['YbYpWe']={},a0_0x1e10['CRLMRM']=!![];}var _0xe57e4d=_0x106c84[-0xa7*0x2+0x195b*0x1+-0x180d],_0x2ba3ff=_0x2be0a5+_0xe57e4d,_0x1194d0=a0_0x1e10['YbYpWe'][_0x2ba3ff];if(!_0x1194d0){if(a0_0x1e10['dbLmTZ']===undefined){var _0x567e79=function(_0x5e3f89){this['NtozJk']=_0x5e3f89,this['wJcFFu']=[-0x1282+0x17f4+-0x571,0xd*0x2+0x2081*-0x1+0x2067,-0x265d+-0xe*-0xd9+0x1a7f],this['bQgurM']=function(){return'newState';},this['cYsYwV']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['wyelNu']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x567e79['prototype']['DGRoVu']=function(){var _0x15a640=new RegExp(this['cYsYwV']+this['wyelNu']),_0x3776eb=_0x15a640['test'](this['bQgurM']['toString']())?--this['wJcFFu'][0x1453+-0x362*-0x5+0x94f*-0x4]:--this['wJcFFu'][0x24dc+0x1ae6+-0x1*0x3fc2];return this['fkkQdx'](_0x3776eb);},_0x567e79['prototype']['fkkQdx']=function(_0x68f876){if(!Boolean(~_0x68f876))return _0x68f876;return this['FhCLsS'](this['NtozJk']);},_0x567e79['prototype']['FhCLsS']=function(_0x19d1a2){for(var _0x22aa6a=0x262a+0x220f+0x4839*-0x1,_0x24945a=this['wJcFFu']['length'];_0x22aa6a<_0x24945a;_0x22aa6a++){this['wJcFFu']['push'](Math['round'](Math['random']())),_0x24945a=this['wJcFFu']['length'];}return _0x19d1a2(this['wJcFFu'][0x1cb3+-0xd3*0x1f+0x3e*-0xd]);},new _0x567e79(a0_0x1e10)['DGRoVu'](),a0_0x1e10['dbLmTZ']=!![];}_0x23f184=a0_0x1e10['fWsNCO'](_0x23f184,_0x439647),a0_0x1e10['YbYpWe'][_0x2ba3ff]=_0x23f184;}else _0x23f184=_0x1194d0;return _0x23f184;}a0_0x3ba321();import{A as a0_0x5b8d4c,B as a0_0x79b9f4,C as a0_0x413f79,D as a0_0x4120a4,b as a0_0x797e0c,c as a0_0x20b80f,d as a0_0x53572b,e as a0_0x12debc,f as a0_0x3be4cf,g as a0_0x4a9ef6,h as a0_0x251ac7,i as a0_0x1c5b02,j as a0_0x1a48c8,k as a0_0x3887e3,l as a0_0x598c69,m as a0_0x14508e,n as a0_0x3035cb,o as a0_0x5894de,p as a0_0x11b3ac,q as a0_0xa1acd0,r as a0_0x5752bd,s as a0_0xc40ef8,t as a0_0x3bf2e1,u as a0_0x3d8fe8,v as a0_0x4751c2,w as a0_0x172f7b,x as a0_0x46d750,y as a0_0x2f8d53,z as a0_0x22ee04}from'../chunk-DSIGEZDQ.js';import{a as a0_0x46bfc4,b as a0_0x3fefa4,c as a0_0x26e079,d as a0_0x4cb555,e as a0_0x30e0c9}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';import'../chunk-HVKF2KYL.js';import'../chunk-E6WJCS24.js';function a0_0xc510(){var _0x440e22=['W5dcSCkspSoGWODX','lN4VW4VdNaDMtmomcSoVksm','WPddLHZcPmkKWRFdLmo5WQLyftCg','m1JdS8oiW4z8w1i','ANxdT8k0tW','W6FcSmkFW7CPj8khWQCGAcSaW7y','lIWSW4L2','W5jUWQddS8kyaCkLla','yMrr','cSokvgBdNW','oJXFbmk2W4VcQCkB','CLVdSxq+uJJcLqZcV2pdMmoJ','W4RdQmkCWQVcQhSfW7C','W7yAWPzMW6j5W7FdLvZdImoBWRaA','DuddVSoNW5y','WPldGr8','WP7cOLBdL2jJrmoQW73dHSkEWQ8','WPddKrRdPmoSW5tcQSogWPG','WQlcGYpcIGvzmmkyW4ldM2ar','kJ3cH8oLW6WRW4RcT1S3xf5s','ublcHmk5W4LcWOyeWRLKW5pdUa','WRrwzwZcOCkIWRBcNsSGeq','WOBdKmkDW77dTgpcI30ycCk4phe','WQdcJ15wcXfn','WQ9mFhFcUG','WRKNWR4vW4i','WQ4BWOldNSkq','WPqZWPtdKSk7','WO7dNZJdU8ktrh3dT8odW5nD','j8k8WRVcNSk+W6v8WOSBW5BdTmo+','W4RcT8kUqSkTWPddVwxcKq'];a0_0xc510=function(){return _0x440e22;};return a0_0xc510();}import'../chunk-JXBG6UFL.js';export{a0_0x46bfc4 as AssetCache,a0_0x26e079 as AssetLoader,a0_0x3d8fe8 as AssetSystem,a0_0x4cb555 as AssetTextures,a0_0xc40ef8 as Assets,a0_0x5894de as BaseSystem,a0_0x3035cb as GameEngine,a0_0x12debc as GameObject,a0_0x3be4cf as GameObjectManager,a0_0x14508e as ObjectFactory,a0_0x53572b as Renderer,a0_0x11b3ac as RuntimeObjectRegistry,a0_0x20b80f as Transform,a0_0x79b9f4 as applyScreenAnchor,a0_0xa1acd0 as basePixi,a0_0x172f7b as clearResponsiveElements,a0_0x797e0c as createPixiBase,a0_0x1a48c8 as getRegisteredFontIds,a0_0x4751c2 as globalResponsiveMultipliers,a0_0x30e0c9 as initAssetTextures,a0_0x3bf2e1 as initAssets,a0_0x413f79 as layout,a0_0x598c69 as playLottieOverlay,a0_0x1c5b02 as registerFont,a0_0x3fefa4 as registerType,a0_0x2f8d53 as resolveAnchorVec2,a0_0x4a9ef6 as resolveFont,a0_0x251ac7 as resolveFontWeight,a0_0x22ee04 as resolveScreenAnchorPoint,a0_0x5b8d4c as resolveScreenRatioPoint,a0_0x4120a4 as runInitSequence,a0_0x3887e3 as setLottieInstance,a0_0x5752bd as spawnSceneFromConfig,a0_0x46d750 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(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.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 s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.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 Jo={};ra(Jo,{AspectClass:()=>On,GameObject:()=>ot,GameObjectManager:()=>$t,Renderer:()=>rt,ResponsiveUISystem:()=>Ge,Transform:()=>st,animateHandClick:()=>xs,animatePanelEntrance:()=>ws,createBrushTexture:()=>_s,createEndGamePanel:()=>vs,createHandTutorial:()=>Es,createThreeBase:()=>ms,createTutorialLabel:()=>Ss,getAspectClass:()=>zt,getRegisteredFontIds:()=>ys,loadAsset:()=>$n,loadCharacterFrames:()=>Ls,registerFont:()=>bs,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Cs});module.exports=xr(Jo);var W=ae(require("three"),1);var he={};function mt(t,e,n=!1){he[t]||(he[t]=[]),he[t].push({fn:e,once:n})}function Xt(t,e){if(he[t]){if(!e){delete he[t];return}he[t]=he[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=he[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,V=[],Pe=null;function da(t){M=t,V=[],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 s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(V.push(t),V.length>n.maxQueue&&(V=V.slice(V.length-n.maxQueue)),V.length>=n.batchSize){ca();return}Pe===null&&(Pe=window.setTimeout(()=>{Pe=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||V.length===0)return;let e=V.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),V.length>0&&await la(t.endpoint,{events:V.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Er(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 We(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sr(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 Cr(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=Cr(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,o(),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()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=We();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,w=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;w=ua(E)}let f=u.ease(w);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){r(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=Er(c.ease),w=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 C=c[S];typeof C=="number"&&f.push({key:S,from:Sr(p,S),to:C})}let m=fa(p,c);return{target:p,startMs:We(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:w,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:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=We())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:We(),b=We()-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))r(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},w=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 w({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return w({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.5.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,Tr=G++,va=G++,wa=G++,xa=G++,Ea=G++,Sa=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,_a=G++,ka=G++,T=Tr;function Ma(){return T===va}function Pa(){return T===wa}function Ia(){return T===xa}function ja(){return T===Ea}function Ie(){return T===Sa}function je(){return T===Ca}function Oa(){return T===Aa}function Ra(){return T===Ta}function za(){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=wa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=xa)}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=Ca);else if(e==="tiktok")window.openAppStore&&(T=Aa);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),Da=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Lr=require("pixi.js");var en=require("pixi.js");var _r=null;function tn(t){_r=t}vt();nn();var Ye=require("pixi.js");vt();var Or=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",on=Or;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&&(on=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${on}`))}}catch{}function Rr(t){var n,i,a,s,r;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:(s=t.y)!=null?s:.5};if(typeof t=="string"){let o=t.trim().toLowerCase();return(r=e[o])!=null?r:{x:.5,y:.5}}return null}var Ce=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${on}`);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 s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Se.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ye.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r 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}`],w=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),w=!0;break}}catch{continue}w||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=Rr(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 Dr=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Dr);Xe();var xt=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 s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ce.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ce.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Nr=new cn,Fr=new Proxy(Nr,{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 Ur(t,e,n,i,a,s,r){pn.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function qr(){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)}`),qr()}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 Vr(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Wr(){return Ze}var Yr={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 Ct(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=Yr[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,w,v,y;let a=Ct(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((w=s.right)!=null?w:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,w,v,y,f,m;let a=(h=i.inset)!=null?h:{},s=(w=i.padding)!=null?w:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((f=a.top)!=null?f:0)+s.y,d=((m=a.bottom)!=null?m:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=Ct(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:r+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=Vr,window.getDebugConfig=Wr,window.copyConfig=so,window.applyConfig=Je,window.applyConfigForRatio=ro,window.positionAtBottom=qa,window.positionAtTop=Jr,window.positionAtCenter=Zr,window.positionAtLeft=Qr,window.positionAtRight=eo,window.positionAtBottomLeft=to,window.positionAtBottomRight=no,window.positionAtTopLeft=io,window.positionAtTopRight=ao,window.applyPositionContract=Xr,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 At(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 Kr(t,e){return t*e}function Xr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,w,v,y,f,m,E,S,C,k,I;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=At(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),s=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),s=U(n,(v=(w=i.offset)==null?void 0:w.y)!=null?v:0);break;case"right":a=_t(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),s=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(C=(S=i.offset)==null?void 0:S.x)!=null?C:0),s=U(n,(I=(k=i.offset)==null?void 0:k.y)!=null?I:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),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,s=!0,r=!1){let o=Kr(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!pn.find(p=>p.element===t)&&Ur(t,qa,e,n,i,a,s)}function Jr(t,e,n,i=.1,a=1){ce(t,U(e),At(n,i)),de(t,a)}function Zr(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function Qr(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function eo(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function to(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Tt(n,i)),de(t,s)}function no(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Tt(n,i)),de(t,s)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),At(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),At(n,i)),de(t,s)}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 Ae={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 so(t){return t&&Ae[t]?JSON.parse(JSON.stringify(Ae[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 ro(t,e){let n=t/e;n>1.6?(Je(Ae.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ae.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ae.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ae.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ae,t.resolveAnchorVec2=t.resolveAnchorVec2||Ct,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function P(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Gc=[{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)}],Uc=[{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)}],qc=[{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 Vc=[...Ka];var fo=Ka[0];pe();var wo=ae(require("jszip"),1);function bo(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 yo(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 vo(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 s=await bo(a),r=await vo(s),o=yo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.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 s=a.getImageData(0,0,i.width,i.height),r=s.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:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let w of l)if(Math.sqrt(Math.pow(g-w.r,2)+Math.pow(u-w.g,2)+Math.pow(b-w.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Ja=require("@google/genai");async function mn(t,e,n=[],i={}){var a,s,r,o,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 Ja.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="",w=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(w)for(let v of w)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),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(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 Za=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Za.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.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 xo=require("pixi.js");Xe();pe();var es=require("pixi.js");var Eo=require("pixi.js");pe();function Mo(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 Po(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 Io(t){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.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 s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.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 Jo={};ra(Jo,{AspectClass:()=>On,GameObject:()=>ot,GameObjectManager:()=>$t,Renderer:()=>rt,ResponsiveUISystem:()=>Ge,Transform:()=>st,animateHandClick:()=>xs,animatePanelEntrance:()=>ws,createBrushTexture:()=>_s,createEndGamePanel:()=>vs,createHandTutorial:()=>Es,createThreeBase:()=>ms,createTutorialLabel:()=>Ss,getAspectClass:()=>zt,getRegisteredFontIds:()=>ys,loadAsset:()=>$n,loadCharacterFrames:()=>Ls,registerFont:()=>bs,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Cs});module.exports=xr(Jo);var W=ae(require("three"),1);var he={};function mt(t,e,n=!1){he[t]||(he[t]=[]),he[t].push({fn:e,once:n})}function Xt(t,e){if(he[t]){if(!e){delete he[t];return}he[t]=he[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=he[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,V=[],Pe=null;function da(t){M=t,V=[],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 s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(V.push(t),V.length>n.maxQueue&&(V=V.slice(V.length-n.maxQueue)),V.length>=n.batchSize){ca();return}Pe===null&&(Pe=window.setTimeout(()=>{Pe=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||V.length===0)return;let e=V.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),V.length>0&&await la(t.endpoint,{events:V.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Er(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 We(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sr(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 Cr(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=Cr(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,o(),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()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=We();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,w=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;w=ua(E)}let f=u.ease(w);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){r(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=Er(c.ease),w=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 C=c[S];typeof C=="number"&&f.push({key:S,from:Sr(p,S),to:C})}let m=fa(p,c);return{target:p,startMs:We(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:w,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:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=We())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:We(),b=We()-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))r(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},w=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 w({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return w({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.5.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,Tr=G++,va=G++,wa=G++,xa=G++,Ea=G++,Sa=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,_a=G++,ka=G++,T=Tr;function Ma(){return T===va}function Pa(){return T===wa}function Ia(){return T===xa}function ja(){return T===Ea}function Ie(){return T===Sa}function je(){return T===Ca}function Oa(){return T===Aa}function Ra(){return T===Ta}function za(){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=wa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=xa)}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=Ca);else if(e==="tiktok")window.openAppStore&&(T=Aa);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),Da=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Lr=require("pixi.js");var en=require("pixi.js");var _r=null;function tn(t){_r=t}vt();nn();var Ye=require("pixi.js");vt();var Or=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",on=Or;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&&(on=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${on}`))}}catch{}function Rr(t){var n,i,a,s,r;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:(s=t.y)!=null?s:.5};if(typeof t=="string"){let o=t.trim().toLowerCase();return(r=e[o])!=null?r:{x:.5,y:.5}}return null}var Ce=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${on}`);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 s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Se.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ye.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r 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}`],w=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),w=!0;break}}catch{continue}w||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=Rr(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 Dr=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Dr);Xe();var xt=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 s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ce.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ce.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Nr=new cn,Fr=new Proxy(Nr,{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 Ur(t,e,n,i,a,s,r){pn.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function qr(){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)}`),qr()}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 Vr(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Wr(){return Ze}var Yr={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 Ct(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=Yr[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,w,v,y;let a=Ct(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((w=s.right)!=null?w:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,w,v,y,f,m;let a=(h=i.inset)!=null?h:{},s=(w=i.padding)!=null?w:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((f=a.top)!=null?f:0)+s.y,d=((m=a.bottom)!=null?m:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=Ct(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:r+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=Vr,window.getDebugConfig=Wr,window.copyConfig=so,window.applyConfig=Je,window.applyConfigForRatio=ro,window.positionAtBottom=qa,window.positionAtTop=Jr,window.positionAtCenter=Zr,window.positionAtLeft=Qr,window.positionAtRight=eo,window.positionAtBottomLeft=to,window.positionAtBottomRight=no,window.positionAtTopLeft=io,window.positionAtTopRight=ao,window.applyPositionContract=Xr,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 At(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 Kr(t,e){return t*e}function Xr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,w,v,y,f,m,E,S,C,k,I;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=At(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),s=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),s=U(n,(v=(w=i.offset)==null?void 0:w.y)!=null?v:0);break;case"right":a=_t(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),s=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(C=(S=i.offset)==null?void 0:S.x)!=null?C:0),s=U(n,(I=(k=i.offset)==null?void 0:k.y)!=null?I:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),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,s=!0,r=!1){let o=Kr(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!pn.find(p=>p.element===t)&&Ur(t,qa,e,n,i,a,s)}function Jr(t,e,n,i=.1,a=1){ce(t,U(e),At(n,i)),de(t,a)}function Zr(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function Qr(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function eo(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function to(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Tt(n,i)),de(t,s)}function no(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Tt(n,i)),de(t,s)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),At(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),At(n,i)),de(t,s)}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 Ae={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 so(t){return t&&Ae[t]?JSON.parse(JSON.stringify(Ae[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 ro(t,e){let n=t/e;n>1.6?(Je(Ae.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ae.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ae.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ae.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ae,t.resolveAnchorVec2=t.resolveAnchorVec2||Ct,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function P(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Gc=[{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)}],Uc=[{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)}],qc=[{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 Vc=[...Ka];var fo=Ka[0];pe();var wo=ae(require("jszip"),1);function bo(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 yo(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 vo(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 s=await bo(a),r=await vo(s),o=yo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.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 s=a.getImageData(0,0,i.width,i.height),r=s.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:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let w of l)if(Math.sqrt(Math.pow(g-w.r,2)+Math.pow(u-w.g,2)+Math.pow(b-w.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Ja=require("@google/genai");async function mn(t,e,n=[],i={}){var a,s,r,o,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 Ja.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="",w=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(w)for(let v of w)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),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(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 Za=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Za.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.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 xo=require("pixi.js");Xe();pe();var es=require("pixi.js");var Eo=require("pixi.js");pe();function Mo(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 Po(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 Io(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:
|