handler-playable-sdk 0.3.76 → 0.3.78
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-GNO7ZYE4.js → chunk-DE4OA2P6.js} +1 -1
- package/dist/cli/brand-dna.mjs +1 -1
- package/dist/cli/canva-import.mjs +1 -1
- package/dist/cli/cleanup-assets.mjs +1 -1
- package/dist/cli/fix-scales.mjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/screen-helper.mjs +1 -1
- package/dist/cli/setup-library.mjs +1 -1
- package/dist/cli/student-helper.mjs +1 -1
- package/dist/cli/sync-screens.mjs +1 -1
- package/dist/cli/validate-assets.mjs +1 -1
- package/dist/cli/validate.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +1 -1
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +1 -1
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};ht(pl,{COLORS:()=>ce,ConfigWatcher:()=>ze,DebugPanel:()=>Ot,DefaultReloadStrategy:()=>St,Handler:()=>ie,PlayableLoadingScreen:()=>Ui,PreviewShell:()=>Ni,STROKE_WIDTH:()=>mo,THEME:()=>bo,applyConfigOverride:()=>Se,applyConfigOverrides:()=>Ce,applyConfigsToDisk:()=>ri,applyDefaults:()=>$e,baseLottie:()=>rn,bootstrap:()=>el,clearConfigOverrides:()=>se,clearConfigOverridesForObject:()=>xr,configOverrideManager:()=>wr,createPreviewShell:()=>pa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>ui,deviceGroups:()=>Pn,devicePresets:()=>Mn,diffConfigs:()=>Sn,exportConfigsAsJSON:()=>De,getConfigOverrides:()=>Y,getConfigStateSummary:()=>ai,getOverrideMode:()=>wt,getPresetById:()=>He,getPresetsByCategory:()=>Os,loadAllObjectConfigs:()=>li,loadComponentSchemas:()=>si,loadEngineConfig:()=>ci,loadGamePromptConfig:()=>wn,loadObjectCentricConfig:()=>be,loadObjectConfig:()=>Te,loadSceneConfig:()=>di,rehydrateObject:()=>Cn,removeConfigOverride:()=>ni,resetToApplied:()=>Et,resetToOriginal:()=>oi,setBootstrapDependencies:()=>Zs,setOverrideMode:()=>yn,setupHotReload:()=>kn,setupLiveEditBridge:()=>Bi,toLegacyFormat:()=>En,validateObjectConfig:()=>Ze});module.exports=zo(pl);var we={};function Ut(n,e,t=!1){we[n]||(we[n]=[]),we[n].push({fn:e,once:t})}function en(n,e){if(we[n]){if(!e){delete we[n];return}we[n]=we[n].filter(t=>t.fn!==e)}}function Gt(n,...e){let t=we[n];if(t)for(let i of[...t])i.fn(...e),i.once&&en(n,i.fn)}function X(n,e){Ut(n,e,!0)}var F=null,ee=[],We=null;function Ma(n){F=n,ee=[],We!==null&&(clearTimeout(We),We=null)}function Pa(){var n,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(n=F==null?void 0:F.batchSize)!=null?n:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function ka(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function tn(n,e){let t=Pa();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let n=Pa();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await ka(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await ka(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Oa(n){return Math.max(0,Math.min(1,n))}function Ho(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ft(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function No(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Ia(n,e,t){try{n[e]=t}catch{}}function Bo(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ja(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Ra(n,e){let t=Bo(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Da(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),n.size>0&&i()})},a=p=>{var u;n.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),i()},r=p=>{n.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var d,u;let p=ft();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=p-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,f=Oa(h),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let E=h-y;f=Oa(E)}let v=g.ease(f);g.yoyo&&y%2===1&&(v=1-v);for(let E of g.props)Ia(g.target,E.key,E.from+(E.to-E.from)*v);g.scaleFrom&&g.scaleTo&&ja(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(h>=b){o(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var E;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),m=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((E=u==null?void 0:u.delayMsOverride)!=null?E:0)),h=Ho(d.ease),f=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let w of Object.keys(d)){if(y.has(w))continue;let S=d[w];typeof S=="number"&&v.push({key:w,from:No(p,w),to:S})}let x=Ra(p,d);return{target:p,startMs:ft(),delayMs:m,durationMs:g,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:f,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>o(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ft())},resume:()=>{var h;if(!u.paused)return;let g=(h=u.pauseAtMs)!=null?h:ft(),m=ft()-g;u.startMs+=m,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let m=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Ia(p,g,m)}let u=Ra(p,d);u.to&&ja(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))o(u)},timeline(p={}){let d=[],u=0,g=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},f=y=>{d.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return f({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,E){return f({kind:"fromTo",target:y,vars:x,from:v,atMs:h(E)}),b},play(){var y,v;if(g)return b;g=!0,m=[];for(let x of d)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],g=!1}};return p.paused||b.play(),b}};return c}function $a(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Da()}catch{}}var za={name:"handler-playable-sdk",version:"0.3.76",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Uo=J++,Ha=J++,Na=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,Va=J++,Wa=J++,Ya=J++,Ka=J++,N=Uo;function Xa(){return N===Ha}function Ja(){return N===Na}function Za(){return N===Ba}function Qa(){return N===Fa}function Ye(){return N===Ua}function Ke(){return N===Ga}function er(){return N===qa}function tr(){return N===Va}function ir(){return N===Wa}function nn(){return N===Ya}function an(){return N===Ka}function nr(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),N=Ha;return}catch{}else if(n==="dapi")try{dapi.isReady(),N=Na;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=Ba)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(N=Fa)}catch{}else if(e==="mintegral")window.gameReady&&(N=Ua);else if(e==="tapjoy")window.TJ_API&&(N=Ga);else if(e==="tiktok")window.openAppStore&&(N=qa);else if(e==="smadex")try{window.smxTracking&&(N=Va)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(N=Wa)}catch{}else e==="vungle"?N=Ya:(n==="nucleo"||e==="nucleo")&&(N=Ka)}var qt=Ve(require("lottie-web"),1),rn=qt.default;typeof window!="undefined"&&(window.lottie=qt.default,window.__baseLottie=qt.default);var Go=require("pixi.js");var on=require("pixi.js");var qo=null;function sn(n){qo=n}Vt();ln();var mt=require("pixi.js");Vt();var Jo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=Jo;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}function Zo(n){var t,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(n);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(n))return{x:(t=n[0])!=null?t:.5,y:(i=n[1])!=null?i:.5};if(n&&typeof n=="object"&&"x"in n&&"y"in n)return{x:(a=n.x)!=null?a:.5,y:(r=n.y)!=null?r:.5};if(typeof n=="string"){let s=n.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,t,i){var l,c,p,d,u,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new mt.Container;return this.applyTransform(h,t==null?void 0:t.transform,t),h}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await je.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new mt.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(d=s==null?void 0:s.constructor)==null?void 0:d.name),this.applyTransform(s,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name,o),o&&(((g=o.constructor)==null?void 0:g.name)==="Container"||o instanceof mt.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],f=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=s==null?void 0:s.constructor)==null?void 0:m.name),f=!0;break}}catch{continue}f||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,t==null?void 0:t.transform,t);return s}static applyTransform(e,t,i){var a,r,o,s;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=t.position.x)!=null?o:0,(s=t.position.y)!=null?s:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Zo(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var bt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var ts=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=ts);Xe();var Wt=require("pixi.js");Xe();var fn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new bt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Ae.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},is=new fn,ns=new Proxy(is,{get(n,e){if(e in n&&typeof n[e]=="function")return n[e].bind(n);if(n.get(e))return n.get(e)}});Xe();var cr=require("pixi.js"),he={width:400,height:600,designWidth:400,scaleFactor:1},Kt={scale:1,position:1},bn=[];function rs(n,e,t,i,a,r,o){bn.push({element:n,originalScale:r,positionHelper:e,heightPercent:a}),e(n,t,i,a,r,o,!1)}function os(){bn.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*he.scaleFactor;t(n,he.width,he.height,i,a,!0,!1)})}function mn(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),he.width=n,he.height=e,he.scaleFactor=Math.min(n/he.designWidth,1.15),Kt.scale=he.scaleFactor,Kt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Kt.scale.toFixed(3)}`),os()}var vt={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function ss(n,e,t){let i=vt[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ls(){return vt}var cs={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Yt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Xt(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Yt(n[0],e.x),y:Yt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Yt(i.x,e.x),y:Yt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=cs[i])!=null?t:e}return e}function dr(n,e,t,i={}){var g,m,h,f,b,y;let a=Xt(t),r=(g=i.inset)!=null?g:{},o=(m=i.padding)!=null?m:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((f=r.right)!=null?f:0)+o.x,c=((b=r.top)!=null?b:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,d=Math.max(0,n-s-l),u=Math.max(0,e-c-p);return{x:s+d*a.x,y:c+u*a.y}}function pr(n,e,t,i={}){var h,f,b,y,v,x;let a=(h=i.inset)!=null?h:{},r=(f=i.padding)!=null?f:{x:0,y:0},o=((b=a.left)!=null?b:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,p=Math.max(0,n-o-s),d=Math.max(0,e-l-c),u=Xt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),m=Math.min(Math.max(u.y,0),1);return{x:o+p*g,y:l+d*m}}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,mn(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),mn(window.innerWidth,window.innerHeight),window.updateDebugConfig=ss,window.getDebugConfig=ls,window.copyConfig=xs,window.applyConfig=yt,window.applyConfigForRatio=ws,window.positionAtBottom=ur,window.positionAtTop=us,window.positionAtCenter=gs,window.positionAtLeft=hs,window.positionAtRight=fs,window.positionAtBottomLeft=ms,window.positionAtBottomRight=bs,window.positionAtTopLeft=ys,window.positionAtTopRight=vs,window.applyPositionContract=ps,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Jt(n,e,t=0){return n*e+t}function Zt(n,e,t=0){return n*(1-e)+t}function Qt(n,e,t=0){return n*e+t}function ei(n,e,t=0){return n*(1-e)+t}function Z(n,e=0){return n/2+e}function ds(n,e){return n*e}function ps(n,e,t,i){var o,s,l,c,p,d,u,g,m,h,f,b,y,v,x,E,w,S,C,O;let a=0,r=0;switch(i.type){case"top":a=Z(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Jt(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(d=(p=i.offset)==null?void 0:p.x)!=null?d:0),r=Zt(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Qt(e,i.percent,(h=(m=i.offset)==null?void 0:m.x)!=null?h:0),r=Z(t,(b=(f=i.offset)==null?void 0:f.y)!=null?b:0);break;case"right":a=ei(e,i.percent,(v=(y=i.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(E=(x=i.offset)==null?void 0:x.y)!=null?E:0);break;case"center":a=Z(e,(S=(w=i.offset)==null?void 0:w.x)!=null?S:0),r=Z(t,(O=(C=i.offset)==null?void 0:C.y)!=null?O:0);break}n.position?n.position.set(a,r):(n.x=a,n.y=r),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ur(n,e,t,i=.2,a=1,r=!0,o=!1){let s=ds(t,i),l=Zt(t,i/2);fe(n,Z(e),l);let c=r?a*he.scaleFactor:a;me(n,c),o&&!bn.find(p=>p.element===n)&&rs(n,ur,e,t,i,a,r)}function us(n,e,t,i=.1,a=1){fe(n,Z(e),Jt(t,i)),me(n,a)}function gs(n,e,t,i=0,a=0,r=1){fe(n,Z(e,i),Z(t,a)),me(n,r)}function hs(n,e,t,i=.1,a=1){fe(n,Qt(e,i),Z(t)),me(n,a)}function fs(n,e,t,i=.1,a=1){fe(n,ei(e,i),Z(t)),me(n,a)}function ms(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Zt(t,i)),me(n,r)}function bs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Zt(t,i)),me(n,r)}function ys(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Jt(t,i)),me(n,r)}function vs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Jt(t,i)),me(n,r)}function fe(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function me(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var Re={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function xs(n){return n&&Re[n]?JSON.parse(JSON.stringify(Re[n])):JSON.parse(JSON.stringify(vt))}function yt(n){Object.keys(n).forEach(e=>{let t=e;vt[t]&&n[t]&&Object.assign(vt[t],n[t])}),console.log("Config applied:",n)}function ws(n,e){let t=n/e;t>1.6?(yt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(yt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(yt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(yt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=Re,n.resolveAnchorVec2=n.resolveAnchorVec2||Xt,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||dr,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||pr}pi();function U(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var Hc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Nc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Mn=[..._n],Pn=[{category:"playable",label:"Playable Ad",devices:_n}],ui=_n[0];function He(n){return Mn.find(e=>e.id===n)||ui}function Os(n){return Mn.filter(e=>e.category===n)}var gi=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};ht(pl,{COLORS:()=>ce,ConfigWatcher:()=>ze,DebugPanel:()=>Ot,DefaultReloadStrategy:()=>St,Handler:()=>ie,PlayableLoadingScreen:()=>Ui,PreviewShell:()=>Ni,STROKE_WIDTH:()=>mo,THEME:()=>bo,applyConfigOverride:()=>Se,applyConfigOverrides:()=>Ce,applyConfigsToDisk:()=>ri,applyDefaults:()=>$e,baseLottie:()=>rn,bootstrap:()=>el,clearConfigOverrides:()=>se,clearConfigOverridesForObject:()=>xr,configOverrideManager:()=>wr,createPreviewShell:()=>pa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>ui,deviceGroups:()=>Pn,devicePresets:()=>Mn,diffConfigs:()=>Sn,exportConfigsAsJSON:()=>De,getConfigOverrides:()=>Y,getConfigStateSummary:()=>ai,getOverrideMode:()=>wt,getPresetById:()=>He,getPresetsByCategory:()=>Os,loadAllObjectConfigs:()=>li,loadComponentSchemas:()=>si,loadEngineConfig:()=>ci,loadGamePromptConfig:()=>wn,loadObjectCentricConfig:()=>be,loadObjectConfig:()=>Te,loadSceneConfig:()=>di,rehydrateObject:()=>Cn,removeConfigOverride:()=>ni,resetToApplied:()=>Et,resetToOriginal:()=>oi,setBootstrapDependencies:()=>Zs,setOverrideMode:()=>yn,setupHotReload:()=>kn,setupLiveEditBridge:()=>Bi,toLegacyFormat:()=>En,validateObjectConfig:()=>Ze});module.exports=zo(pl);var we={};function Ut(n,e,t=!1){we[n]||(we[n]=[]),we[n].push({fn:e,once:t})}function en(n,e){if(we[n]){if(!e){delete we[n];return}we[n]=we[n].filter(t=>t.fn!==e)}}function Gt(n,...e){let t=we[n];if(t)for(let i of[...t])i.fn(...e),i.once&&en(n,i.fn)}function X(n,e){Ut(n,e,!0)}var F=null,ee=[],We=null;function Ma(n){F=n,ee=[],We!==null&&(clearTimeout(We),We=null)}function Pa(){var n,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(n=F==null?void 0:F.batchSize)!=null?n:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function ka(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function tn(n,e){let t=Pa();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let n=Pa();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await ka(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await ka(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Oa(n){return Math.max(0,Math.min(1,n))}function Ho(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ft(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function No(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Ia(n,e,t){try{n[e]=t}catch{}}function Bo(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ja(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Ra(n,e){let t=Bo(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Da(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),n.size>0&&i()})},a=p=>{var u;n.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),i()},r=p=>{n.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var d,u;let p=ft();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=p-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,f=Oa(h),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let E=h-y;f=Oa(E)}let v=g.ease(f);g.yoyo&&y%2===1&&(v=1-v);for(let E of g.props)Ia(g.target,E.key,E.from+(E.to-E.from)*v);g.scaleFrom&&g.scaleTo&&ja(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(h>=b){o(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var E;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),m=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((E=u==null?void 0:u.delayMsOverride)!=null?E:0)),h=Ho(d.ease),f=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let w of Object.keys(d)){if(y.has(w))continue;let S=d[w];typeof S=="number"&&v.push({key:w,from:No(p,w),to:S})}let x=Ra(p,d);return{target:p,startMs:ft(),delayMs:m,durationMs:g,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:f,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>o(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ft())},resume:()=>{var h;if(!u.paused)return;let g=(h=u.pauseAtMs)!=null?h:ft(),m=ft()-g;u.startMs+=m,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let m=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Ia(p,g,m)}let u=Ra(p,d);u.to&&ja(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))o(u)},timeline(p={}){let d=[],u=0,g=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},f=y=>{d.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return f({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,E){return f({kind:"fromTo",target:y,vars:x,from:v,atMs:h(E)}),b},play(){var y,v;if(g)return b;g=!0,m=[];for(let x of d)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],g=!1}};return p.paused||b.play(),b}};return c}function $a(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Da()}catch{}}var za={name:"handler-playable-sdk",version:"0.3.78",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Uo=J++,Ha=J++,Na=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,Va=J++,Wa=J++,Ya=J++,Ka=J++,N=Uo;function Xa(){return N===Ha}function Ja(){return N===Na}function Za(){return N===Ba}function Qa(){return N===Fa}function Ye(){return N===Ua}function Ke(){return N===Ga}function er(){return N===qa}function tr(){return N===Va}function ir(){return N===Wa}function nn(){return N===Ya}function an(){return N===Ka}function nr(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),N=Ha;return}catch{}else if(n==="dapi")try{dapi.isReady(),N=Na;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=Ba)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(N=Fa)}catch{}else if(e==="mintegral")window.gameReady&&(N=Ua);else if(e==="tapjoy")window.TJ_API&&(N=Ga);else if(e==="tiktok")window.openAppStore&&(N=qa);else if(e==="smadex")try{window.smxTracking&&(N=Va)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(N=Wa)}catch{}else e==="vungle"?N=Ya:(n==="nucleo"||e==="nucleo")&&(N=Ka)}var qt=Ve(require("lottie-web"),1),rn=qt.default;typeof window!="undefined"&&(window.lottie=qt.default,window.__baseLottie=qt.default);var Go=require("pixi.js");var on=require("pixi.js");var qo=null;function sn(n){qo=n}Vt();ln();var mt=require("pixi.js");Vt();var Jo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=Jo;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}function Zo(n){var t,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(n);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(n))return{x:(t=n[0])!=null?t:.5,y:(i=n[1])!=null?i:.5};if(n&&typeof n=="object"&&"x"in n&&"y"in n)return{x:(a=n.x)!=null?a:.5,y:(r=n.y)!=null?r:.5};if(typeof n=="string"){let s=n.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,t,i){var l,c,p,d,u,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new mt.Container;return this.applyTransform(h,t==null?void 0:t.transform,t),h}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await je.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new mt.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(d=s==null?void 0:s.constructor)==null?void 0:d.name),this.applyTransform(s,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name,o),o&&(((g=o.constructor)==null?void 0:g.name)==="Container"||o instanceof mt.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],f=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=s==null?void 0:s.constructor)==null?void 0:m.name),f=!0;break}}catch{continue}f||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,t==null?void 0:t.transform,t);return s}static applyTransform(e,t,i){var a,r,o,s;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=t.position.x)!=null?o:0,(s=t.position.y)!=null?s:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Zo(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var bt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var ts=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=ts);Xe();var Wt=require("pixi.js");Xe();var fn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new bt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Ae.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},is=new fn,ns=new Proxy(is,{get(n,e){if(e in n&&typeof n[e]=="function")return n[e].bind(n);if(n.get(e))return n.get(e)}});Xe();var cr=require("pixi.js"),he={width:400,height:600,designWidth:400,scaleFactor:1},Kt={scale:1,position:1},bn=[];function rs(n,e,t,i,a,r,o){bn.push({element:n,originalScale:r,positionHelper:e,heightPercent:a}),e(n,t,i,a,r,o,!1)}function os(){bn.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*he.scaleFactor;t(n,he.width,he.height,i,a,!0,!1)})}function mn(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),he.width=n,he.height=e,he.scaleFactor=Math.min(n/he.designWidth,1.15),Kt.scale=he.scaleFactor,Kt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Kt.scale.toFixed(3)}`),os()}var vt={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function ss(n,e,t){let i=vt[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ls(){return vt}var cs={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Yt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Xt(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Yt(n[0],e.x),y:Yt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Yt(i.x,e.x),y:Yt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=cs[i])!=null?t:e}return e}function dr(n,e,t,i={}){var g,m,h,f,b,y;let a=Xt(t),r=(g=i.inset)!=null?g:{},o=(m=i.padding)!=null?m:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((f=r.right)!=null?f:0)+o.x,c=((b=r.top)!=null?b:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,d=Math.max(0,n-s-l),u=Math.max(0,e-c-p);return{x:s+d*a.x,y:c+u*a.y}}function pr(n,e,t,i={}){var h,f,b,y,v,x;let a=(h=i.inset)!=null?h:{},r=(f=i.padding)!=null?f:{x:0,y:0},o=((b=a.left)!=null?b:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,p=Math.max(0,n-o-s),d=Math.max(0,e-l-c),u=Xt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),m=Math.min(Math.max(u.y,0),1);return{x:o+p*g,y:l+d*m}}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,mn(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),mn(window.innerWidth,window.innerHeight),window.updateDebugConfig=ss,window.getDebugConfig=ls,window.copyConfig=xs,window.applyConfig=yt,window.applyConfigForRatio=ws,window.positionAtBottom=ur,window.positionAtTop=us,window.positionAtCenter=gs,window.positionAtLeft=hs,window.positionAtRight=fs,window.positionAtBottomLeft=ms,window.positionAtBottomRight=bs,window.positionAtTopLeft=ys,window.positionAtTopRight=vs,window.applyPositionContract=ps,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Jt(n,e,t=0){return n*e+t}function Zt(n,e,t=0){return n*(1-e)+t}function Qt(n,e,t=0){return n*e+t}function ei(n,e,t=0){return n*(1-e)+t}function Z(n,e=0){return n/2+e}function ds(n,e){return n*e}function ps(n,e,t,i){var o,s,l,c,p,d,u,g,m,h,f,b,y,v,x,E,w,S,C,O;let a=0,r=0;switch(i.type){case"top":a=Z(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Jt(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(d=(p=i.offset)==null?void 0:p.x)!=null?d:0),r=Zt(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Qt(e,i.percent,(h=(m=i.offset)==null?void 0:m.x)!=null?h:0),r=Z(t,(b=(f=i.offset)==null?void 0:f.y)!=null?b:0);break;case"right":a=ei(e,i.percent,(v=(y=i.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(E=(x=i.offset)==null?void 0:x.y)!=null?E:0);break;case"center":a=Z(e,(S=(w=i.offset)==null?void 0:w.x)!=null?S:0),r=Z(t,(O=(C=i.offset)==null?void 0:C.y)!=null?O:0);break}n.position?n.position.set(a,r):(n.x=a,n.y=r),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ur(n,e,t,i=.2,a=1,r=!0,o=!1){let s=ds(t,i),l=Zt(t,i/2);fe(n,Z(e),l);let c=r?a*he.scaleFactor:a;me(n,c),o&&!bn.find(p=>p.element===n)&&rs(n,ur,e,t,i,a,r)}function us(n,e,t,i=.1,a=1){fe(n,Z(e),Jt(t,i)),me(n,a)}function gs(n,e,t,i=0,a=0,r=1){fe(n,Z(e,i),Z(t,a)),me(n,r)}function hs(n,e,t,i=.1,a=1){fe(n,Qt(e,i),Z(t)),me(n,a)}function fs(n,e,t,i=.1,a=1){fe(n,ei(e,i),Z(t)),me(n,a)}function ms(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Zt(t,i)),me(n,r)}function bs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Zt(t,i)),me(n,r)}function ys(n,e,t,i=.05,a=.05,r=1){fe(n,Qt(e,a),Jt(t,i)),me(n,r)}function vs(n,e,t,i=.05,a=.05,r=1){fe(n,ei(e,a),Jt(t,i)),me(n,r)}function fe(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function me(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var Re={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function xs(n){return n&&Re[n]?JSON.parse(JSON.stringify(Re[n])):JSON.parse(JSON.stringify(vt))}function yt(n){Object.keys(n).forEach(e=>{let t=e;vt[t]&&n[t]&&Object.assign(vt[t],n[t])}),console.log("Config applied:",n)}function ws(n,e){let t=n/e;t>1.6?(yt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(yt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(yt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(yt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=Re,n.resolveAnchorVec2=n.resolveAnchorVec2||Xt,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||dr,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||pr}pi();function U(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var Hc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Nc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Mn=[..._n],Pn=[{category:"playable",label:"Playable Ad",devices:_n}],ui=_n[0];function He(n){return Mn.find(e=>e.id===n)||ui}function Os(n){return Mn.filter(e=>e.category===n)}var gi=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
47
47
|
<div class="scene-panel scene-objects panel-accent-teal" data-panel="scene-objects">
|
|
48
48
|
<div class="scene-panel-header" data-panel-handle>
|
|
49
49
|
<div class="panel-title">
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-
|
|
1
|
+
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-DE4OA2P6.js";import"./chunk-I5OOVR5U.js";import{a as q,b as r,c as s,d as t,e as u,f as v,g as w,h as x,i as y,j as z,k as A,l as B,m as C,n as D,o as E}from"./chunk-LV4HGC5G.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk-ZLL42OOV.js";import"./chunk-E6WJCS24.js";import"./chunk-JXBG6UFL.js";export{Q as COLORS,B as ConfigWatcher,K as DebugPanel,A as DefaultReloadStrategy,U as Handler,T as PlayableLoadingScreen,L as PreviewShell,R as STROKE_WIDTH,S as THEME,d as applyConfigOverride,e as applyConfigOverrides,n as applyConfigsToDisk,x as applyDefaults,a as baseLottie,P as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,M as createPreviewShell,k as deepClone,V as default,H as defaultPreset,G as deviceGroups,F as devicePresets,C as diffConfigs,l as exportConfigsAsJSON,i as getConfigOverrides,m as getConfigStateSummary,b as getOverrideMode,I as getPresetById,J as getPresetsByCategory,s as loadAllObjectConfigs,q as loadComponentSchemas,t as loadEngineConfig,u as loadGamePromptConfig,y as loadObjectCentricConfig,r as loadObjectConfig,v as loadSceneConfig,D as rehydrateObject,h as removeConfigOverride,o as resetToApplied,p as resetToOriginal,O as setBootstrapDependencies,c as setOverrideMode,E as setupHotReload,N as setupLiveEditBridge,z as toLegacyFormat,w as validateObjectConfig};
|
package/dist/pixi/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Hr={};Vi(Hr,{AssetCache:()=>Q,AssetLoader:()=>he,AssetSystem:()=>It,AssetTextures:()=>fe,Assets:()=>pa,BaseSystem:()=>He,GameEngine:()=>Ot,GameObject:()=>st,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>sa,clearResponsiveElements:()=>ga,createPixiBase:()=>Mt,getRegisteredFontIds:()=>na,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>fa,playLottieOverlay:()=>ra,registerFont:()=>ia,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Hr);var Qn=require("pixi.js");var pe={};function mt(i,e,t=!1){pe[i]||(pe[i]=[]),pe[i].push({fn:e,once:t})}function Gt(i,e){if(pe[i]){if(!e){delete pe[i];return}pe[i]=pe[i].filter(t=>t.fn!==e)}}function bt(i,...e){let t=pe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&Gt(i,n.fn)}function q(i,e){mt(i,e,!0)}var D=null,Y=[],Te=null;function Xi(i){D=i,Y=[],Te!==null&&(clearTimeout(Te),Te=null)}function Ji(){var i,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(i=D==null?void 0:D.batchSize)!=null?i:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Yi(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(i,e){let t=Ji();if(e&&t.endpoint){if(Y.push(i),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Ki();return}Te===null&&(Te=window.setTimeout(()=>{Te=null,Ki()},t.flushIntervalMs))}}async function Ki(){let i=Ji();if(!i.endpoint||Y.length===0)return;let e=Y.splice(0,i.batchSize);await Yi(i.endpoint,{events:e},i.transport,i.debug),Y.length>0&&await Yi(i.endpoint,{events:Y.splice(0,i.batchSize)},i.transport,i.debug)}function Zi(i){return Math.max(0,Math.min(1,i))}function Aa(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Qi(i,e,t){try{i[e]=t}catch{}}function Ca(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function en(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function tn(i,e){let t=Ca(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function nn(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),i.size>0&&n()})},a=u=>{var p;i.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),n()},r=u=>{i.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},o=u=>{u.killed||(u.killed=!0,r(u))},s=()=>{var l,p;let u=Ke();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,A=Zi(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let y=f-h;A=Zi(y)}let x=g.ease(A);g.yoyo&&h%2===1&&(x=1-x);for(let y of g.props)Qi(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&en(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(f>=b){o(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(h.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=tn(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:f,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>o(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Qi(u,g,m)}let p=tn(u,l);p.to&&en(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))o(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=h=>{l.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+x)},b={to(h,x,w){return A({kind:"to",target:h,vars:x,atMs:f(w)}),b},fromTo(h,x,w,y){return A({kind:"fromTo",target:h,vars:w,from:x,atMs:f(y)}),b},play(){var h,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(h=w.from)!=null?h:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let h of m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function an(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=nn()}catch{}}var rn={name:"handler-playable-sdk",version:"0.3.76",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,La=V++,on=V++,sn=V++,ln=V++,cn=V++,dn=V++,pn=V++,un=V++,gn=V++,hn=V++,fn=V++,mn=V++,P=La;function bn(){return P===on}function yn(){return P===sn}function vn(){return P===ln}function xn(){return P===cn}function Le(){return P===dn}function ke(){return P===pn}function wn(){return P===un}function En(){return P===gn}function An(){return P===hn}function Vt(){return P===fn}function Wt(){return P===mn}function Sn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),P=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),P=sn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(P=ln)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(P=cn)}catch{}else if(e==="mintegral")window.gameReady&&(P=dn);else if(e==="tapjoy")window.TJ_API&&(P=pn);else if(e==="tiktok")window.openAppStore&&(P=un);else if(e==="smadex")try{window.smxTracking&&(P=gn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(P=hn)}catch{}else e==="vungle"?P=fn:(i==="nucleo"||e==="nucleo")&&(P=mn)}var yt=ft(require("lottie-web"),1),Cn=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var vo=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],xo=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],wo=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Eo=[..._n];var Ra=_n[0];ue();var Ba=ft(require("jszip"),1);function za(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Ha(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Na(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function Jt(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),o=await Na(r),s=Ha(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(t=o==null?void 0:o.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function vt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let r=a.getImageData(0,0,n.width,n.height),o=r.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(l=>({r:o[l.offset],g:o[l.offset+1],b:o[l.offset+2]})),c=0;for(let l=0;l<o.length;l+=4){let p=o[l],g=o[l+1],m=o[l+2],f=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){f=!0;break}f&&(o[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var Mn=require("@google/genai");async function Zt(i,e,t=[],n={}){var a,r,o,s,d,c,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let l=new Mn.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),f="",A=(o=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(A)for(let b of A)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(l){throw console.error("[Gemini] API error:",l),(s=l.message)!=null&&s.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Pn=require("@google/genai");async function xt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Pn.GoogleGenAI({apiKey:i}),r=[{text:e}];t.length>0&&t.forEach((s,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let d=s.inlineData.data,c=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $n=require("pixi.js");var Ya=require("pixi.js");ue();function tr(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function ir(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function nr(i){return`
|
|
46
|
+
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Hr={};Vi(Hr,{AssetCache:()=>Q,AssetLoader:()=>he,AssetSystem:()=>It,AssetTextures:()=>fe,Assets:()=>pa,BaseSystem:()=>He,GameEngine:()=>Ot,GameObject:()=>st,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>sa,clearResponsiveElements:()=>ga,createPixiBase:()=>Mt,getRegisteredFontIds:()=>na,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>fa,playLottieOverlay:()=>ra,registerFont:()=>ia,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Hr);var Qn=require("pixi.js");var pe={};function mt(i,e,t=!1){pe[i]||(pe[i]=[]),pe[i].push({fn:e,once:t})}function Gt(i,e){if(pe[i]){if(!e){delete pe[i];return}pe[i]=pe[i].filter(t=>t.fn!==e)}}function bt(i,...e){let t=pe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&Gt(i,n.fn)}function q(i,e){mt(i,e,!0)}var D=null,Y=[],Te=null;function Xi(i){D=i,Y=[],Te!==null&&(clearTimeout(Te),Te=null)}function Ji(){var i,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(i=D==null?void 0:D.batchSize)!=null?i:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Yi(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(i,e){let t=Ji();if(e&&t.endpoint){if(Y.push(i),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Ki();return}Te===null&&(Te=window.setTimeout(()=>{Te=null,Ki()},t.flushIntervalMs))}}async function Ki(){let i=Ji();if(!i.endpoint||Y.length===0)return;let e=Y.splice(0,i.batchSize);await Yi(i.endpoint,{events:e},i.transport,i.debug),Y.length>0&&await Yi(i.endpoint,{events:Y.splice(0,i.batchSize)},i.transport,i.debug)}function Zi(i){return Math.max(0,Math.min(1,i))}function Aa(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Qi(i,e,t){try{i[e]=t}catch{}}function Ca(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function en(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function tn(i,e){let t=Ca(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function nn(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),i.size>0&&n()})},a=u=>{var p;i.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),n()},r=u=>{i.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},o=u=>{u.killed||(u.killed=!0,r(u))},s=()=>{var l,p;let u=Ke();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,A=Zi(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let y=f-h;A=Zi(y)}let x=g.ease(A);g.yoyo&&h%2===1&&(x=1-x);for(let y of g.props)Qi(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&en(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(f>=b){o(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(h.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=tn(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:f,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>o(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Qi(u,g,m)}let p=tn(u,l);p.to&&en(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))o(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=h=>{l.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+x)},b={to(h,x,w){return A({kind:"to",target:h,vars:x,atMs:f(w)}),b},fromTo(h,x,w,y){return A({kind:"fromTo",target:h,vars:w,from:x,atMs:f(y)}),b},play(){var h,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(h=w.from)!=null?h:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let h of m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function an(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=nn()}catch{}}var rn={name:"handler-playable-sdk",version:"0.3.78",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,La=V++,on=V++,sn=V++,ln=V++,cn=V++,dn=V++,pn=V++,un=V++,gn=V++,hn=V++,fn=V++,mn=V++,P=La;function bn(){return P===on}function yn(){return P===sn}function vn(){return P===ln}function xn(){return P===cn}function Le(){return P===dn}function ke(){return P===pn}function wn(){return P===un}function En(){return P===gn}function An(){return P===hn}function Vt(){return P===fn}function Wt(){return P===mn}function Sn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),P=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),P=sn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(P=ln)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(P=cn)}catch{}else if(e==="mintegral")window.gameReady&&(P=dn);else if(e==="tapjoy")window.TJ_API&&(P=pn);else if(e==="tiktok")window.openAppStore&&(P=un);else if(e==="smadex")try{window.smxTracking&&(P=gn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(P=hn)}catch{}else e==="vungle"?P=fn:(i==="nucleo"||e==="nucleo")&&(P=mn)}var yt=ft(require("lottie-web"),1),Cn=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var vo=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],xo=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],wo=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Eo=[..._n];var Ra=_n[0];ue();var Ba=ft(require("jszip"),1);function za(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Ha(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Na(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function Jt(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),o=await Na(r),s=Ha(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(t=o==null?void 0:o.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function vt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let r=a.getImageData(0,0,n.width,n.height),o=r.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(l=>({r:o[l.offset],g:o[l.offset+1],b:o[l.offset+2]})),c=0;for(let l=0;l<o.length;l+=4){let p=o[l],g=o[l+1],m=o[l+2],f=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){f=!0;break}f&&(o[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var Mn=require("@google/genai");async function Zt(i,e,t=[],n={}){var a,r,o,s,d,c,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let l=new Mn.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),f="",A=(o=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(A)for(let b of A)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(l){throw console.error("[Gemini] API error:",l),(s=l.message)!=null&&s.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Pn=require("@google/genai");async function xt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Pn.GoogleGenAI({apiKey:i}),r=[{text:e}];t.length>0&&t.forEach((s,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let d=s.inlineData.data,c=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $n=require("pixi.js");var Ya=require("pixi.js");ue();function tr(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function ir(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function nr(i){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|
package/dist/pixi/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a0_0x44e6(){var _0x2e4709=['egRdIhJcSW','WRxdISovW6XQeYFcNZW','WRrcW70Ne8o6WQ3cR8kCiSk8gq','EmkaoG9UW4JdKedcQW','a1ddOxRcIvyhBW','ihePqmoEWOGGmWNcUmotBW','mSk4hdZdMIGwW5lcJvldOMG','xCodqSksWPlcNx/dGsC8WRRdIN0','B8kWW7pcHv0sySkk','xCkorbLmBSolaCoR','W7eicmoSn8oZWP1hWOtdTrCRW7i','WPVdI8kaW4xcKG','qqFdRhNcKG','jmkzxCoyW5ezAmkiWOddGtv8','nCkdqSoaW4G','dCosAfVcSXddKdK','iuRcMwm9','W40boCokWOuhp8ob','B8k0W4VcU04JuSkM','W4xcS1hdH8owW4tdQKxcSZj/lq','WRrxBmkODG','Cs3cHt/dUa','dCoubtJdR2pdQbZdHh4ztW','gMPXEbe','CSk0W4uyWP3dTSkAWPTfW4KsnZi','WQbZk8kpfq','WQLwwa','FcrxWOxcICkyW4pcICoE','WR5lg8oJW74/j8k3WQqZsmkhvq','a8kIW6uKWOVcNSombG','W60eWR98wa','n8kIe8keWOXrlSketbCFW7NcPa','jutdNJTG','WRhcMKRcUmoTcSkWlNXkBmkHWQu'];a0_0x44e6=function(){return _0x2e4709;};return a0_0x44e6();}(function(_0x54b3a9,_0x2f15cf){var a0_0x2d2507={_0xa6e9f0:0x17e,_0x149313:0x16d,_0x162dc4:0x174,_0x3facb6:0x16f,_0x464eb9:0x484,_0x396a9e:0x491,_0x238fa4:0x483,_0x35ee82:0x490,_0x2b22dc:0x499,_0x25b84e:0x48c,_0x29951a:0x48b,_0x43fcae:0x48f,_0x2a677a:0x49f,_0x5f1195:0x488,_0x4ceca0:0x48f,_0x1433fa:0x486,_0x15b485:0x17b,_0x543273:0x179,_0x5e10f0:0x17e,_0x424c55:'qf$y',_0x5d412a:0x185,_0x29b128:0x481,_0x174419:0x47b,_0x2dfdbf:0x482,_0x577c04:0x473,_0x4f9e28:0x47c,_0x2878ce:0x478,_0x36375e:0x475,_0x511ec5:'VWw9',_0x341b14:0x49a,_0x4ee0f8:0x49c,_0x3e75c9:0x483,_0x49f6f5:'e95A',_0x476b9a:0x24d,_0x1835be:0x253,_0x16a77b:'a^VO',_0x4ac5d9:0x238,_0x500255:0x245},a0_0x1ebc07={_0x2413b4:0x373},a0_0x1579a7={_0x2ad394:0x59},a0_0x13e612={_0xf626b7:0x125};function _0x3dbc85(_0x17d290,_0x34dfee,_0x5680b6,_0x11cb77,_0x2ffc2b){return a0_0x3e1a(_0x2ffc2b-a0_0x13e612._0xf626b7,_0x5680b6);}function _0x4b1008(_0x455eca,_0x210c22,_0x296e7e,_0x31e84d,_0x1b591e){return a0_0x3e1a(_0x296e7e-a0_0x1579a7._0x2ad394,_0x1b591e);}var _0x3e89e0=_0x54b3a9();function _0x4c2375(_0x4c6314,_0x44f1c8,_0xc3bb30,_0x5914c0,_0x2497dc){return a0_0x3e1a(_0x44f1c8-a0_0x1ebc07._0x2413b4,_0x2497dc);}while(!![]){try{var _0x5cd2c3=parseInt(_0x4b1008(a0_0x2d2507._0xa6e9f0,a0_0x2d2507._0x149313,a0_0x2d2507._0x162dc4,a0_0x2d2507._0x3facb6,'owZo'))/(0x1*0x385+0x3be*-0x1+0x1d*0x2)*(parseInt(_0x4c2375(0x47c,a0_0x2d2507._0x464eb9,0x48a,a0_0x2d2507._0x396a9e,'Cp4H'))/(0x1*0x8c6+-0x6b2+-0x212*0x1))+parseInt(_0x4c2375(a0_0x2d2507._0x238fa4,a0_0x2d2507._0x35ee82,a0_0x2d2507._0x2b22dc,a0_0x2d2507._0x25b84e,'KCbM'))/(0x1f39+-0x456+-0x56*0x50)+-parseInt(_0x4c2375(a0_0x2d2507._0x29951a,a0_0x2d2507._0x43fcae,0x49c,a0_0x2d2507._0x2a677a,'KO5V'))/(0x414+0x1df*-0x14+-0x2*-0x10ae)*(parseInt(_0x4c2375(0x487,a0_0x2d2507._0x5f1195,a0_0x2d2507._0x4ceca0,a0_0x2d2507._0x1433fa,'Yi7V'))/(0x32b+-0x240b+0x191*0x15))+parseInt(_0x4b1008(a0_0x2d2507._0x15b485,a0_0x2d2507._0x543273,0x178,a0_0x2d2507._0x5e10f0,a0_0x2d2507._0x424c55))/(-0x1*0x187b+-0x549+-0x52*-0x5d)+parseInt(_0x4b1008(0x18a,0x16b,0x17b,a0_0x2d2507._0x5d412a,'(f)W'))/(-0x1*0x1f0+0x1*-0x16b7+-0xc57*-0x2)+-parseInt(_0x4c2375(a0_0x2d2507._0x29b128,a0_0x2d2507._0x174419,a0_0x2d2507._0x29951a,a0_0x2d2507._0x2dfdbf,'a^VO'))/(0x602*-0x5+-0x16d9+-0x1f*-0x1b5)*(-parseInt(_0x4c2375(a0_0x2d2507._0x577c04,a0_0x2d2507._0x4f9e28,a0_0x2d2507._0x2878ce,a0_0x2d2507._0x36375e,a0_0x2d2507._0x511ec5))/(0x26bf+-0x26*0x9d+-0xf68))+parseInt(_0x4c2375(a0_0x2d2507._0x341b14,0x491,a0_0x2d2507._0x4ee0f8,a0_0x2d2507._0x3e75c9,a0_0x2d2507._0x49f6f5))/(-0x1492+-0x2058+-0x1*-0x34f4)*(-parseInt(_0x3dbc85(a0_0x2d2507._0x476b9a,a0_0x2d2507._0x1835be,a0_0x2d2507._0x16a77b,a0_0x2d2507._0x4ac5d9,a0_0x2d2507._0x500255))/(-0xc*-0x290+0x70+-0x1f25));if(_0x5cd2c3===_0x2f15cf)break;else _0x3e89e0['push'](_0x3e89e0['shift']());}catch(_0x144a81){_0x3e89e0['push'](_0x3e89e0['shift']());}}}(a0_0x44e6,0x96ec*-0x15+-0x45833*-0x3+0x192d*0x55));var a0_0xf7f982=(function(){var _0x2f5bdb=!![];return function(_0x11ee7a,_0x1b5a9e){var a0_0x58d6c4={_0xeff376:0x233,_0x3e79d9:0x223,_0x17bffc:0x220,_0x5a2a4c:'O#j7',_0x28b36d:0x22a},a0_0x186b85={_0x4bd690:0x337},_0xa7bf27=_0x2f5bdb?function(){function _0x278b35(_0x446eb4,_0xe69cac,_0x34ec8c,_0x2ecd47,_0x51eeab){return a0_0x3e1a(_0xe69cac- -a0_0x186b85._0x4bd690,_0x2ecd47);}if(_0x1b5a9e){var _0xa35028=_0x1b5a9e[_0x278b35(-a0_0x58d6c4._0xeff376,-a0_0x58d6c4._0x3e79d9,-a0_0x58d6c4._0x17bffc,a0_0x58d6c4._0x5a2a4c,-a0_0x58d6c4._0x28b36d)](_0x11ee7a,arguments);return _0x1b5a9e=null,_0xa35028;}}:function(){};return _0x2f5bdb=![],_0xa7bf27;};}()),a0_0xe784c9=a0_0xf7f982(this,function(){var a0_0x4c74a8={_0x3346bd:0x235,_0x45d4c2:0x229,_0x42e906:0x222,_0x19081b:'nb[E',_0x3f00ac:0x227,_0x2aa102:0x32f,_0x5c96a6:'FjSa',_0x416cd2:0x32b,_0x4d118f:0x31f,_0x5c49e3:0x317,_0xd3ebce:0x31f,_0x221826:0x216,_0x25b9bb:0x20e,_0x6af902:0x236,_0x5c022b:0x22d,_0x52f381:0x22c,_0xc4c853:0x22e,_0xcb6315:0x263,_0x237c80:0x252,_0x5ec90d:0x25a,_0x1c72ec:'(f)W',_0x41d1e9:0x22a,_0x4127a4:0x228,_0x1f4681:0x223,_0x51d648:0x33c,_0x3b7bba:'(uHX',_0x13a309:0x33b,_0x1055e8:0x341,_0x26af09:0x326,_0x21a229:0x332,_0x347acf:0x318,_0x35b97c:0x32a,_0x372f83:0x251,_0x26b364:0x255,_0x2feb33:0x256,_0x2f539c:'S&kz',_0x514841:0x331,_0x2d821f:'Aa5g',_0x4cf42f:0x332,_0x2424df:0x328},a0_0x5592f9={_0x374a07:0x151},a0_0x2cdba5={_0x39833e:0x338},_0x422c36={};function _0xdc3f8c(_0x579047,_0x13c153,_0x4a0be,_0x271f1b,_0x33146e){return a0_0x3e1a(_0x13c153- -a0_0x2cdba5._0x39833e,_0x271f1b);}_0x422c36[_0xdc3f8c(-a0_0x4c74a8._0x3346bd,-a0_0x4c74a8._0x45d4c2,-a0_0x4c74a8._0x42e906,a0_0x4c74a8._0x19081b,-a0_0x4c74a8._0x3f00ac)]='(((.+'+_0x5730ab(a0_0x4c74a8._0x2aa102,a0_0x4c74a8._0x5c96a6,0x32e,a0_0x4c74a8._0x416cd2,0x340)+'+$';function _0x5730ab(_0x320c0b,_0x3c95c7,_0x2619b9,_0x227497,_0x571dda){return a0_0x3e1a(_0x320c0b-0x219,_0x3c95c7);}function _0x233c9a(_0x1f9f38,_0x1ccd4c,_0xdf9cd8,_0x1b22e4,_0x38dc04){return a0_0x3e1a(_0x1ccd4c-a0_0x5592f9._0x374a07,_0x38dc04);}var _0x51c762=_0x422c36;return a0_0xe784c9[_0x5730ab(a0_0x4c74a8._0x4d118f,'h%xE',0x323,a0_0x4c74a8._0x5c49e3,a0_0x4c74a8._0xd3ebce)+'ing']()[_0xdc3f8c(-0x204,-0x214,-a0_0x4c74a8._0x221826,'KO5V',-a0_0x4c74a8._0x25b9bb)+'h'](_0x51c762[_0xdc3f8c(-a0_0x4c74a8._0x6af902,-a0_0x4c74a8._0x5c022b,-a0_0x4c74a8._0x52f381,'Aa5g',-a0_0x4c74a8._0xc4c853)])[_0x233c9a(a0_0x4c74a8._0xcb6315,0x25b,a0_0x4c74a8._0x237c80,a0_0x4c74a8._0x5ec90d,a0_0x4c74a8._0x1c72ec)+_0xdc3f8c(-a0_0x4c74a8._0x41d1e9,-a0_0x4c74a8._0x4127a4,-a0_0x4c74a8._0x1f4681,'(f)W',-a0_0x4c74a8._0xc4c853)]()[_0x5730ab(a0_0x4c74a8._0x51d648,a0_0x4c74a8._0x3b7bba,a0_0x4c74a8._0x13a309,0x347,a0_0x4c74a8._0x1055e8)+'ructo'+'r'](a0_0xe784c9)[_0x5730ab(a0_0x4c74a8._0x26af09,'r[[*',a0_0x4c74a8._0x21a229,a0_0x4c74a8._0x347acf,a0_0x4c74a8._0x35b97c)+'h'](_0x233c9a(a0_0x4c74a8._0x372f83,a0_0x4c74a8._0x26b364,a0_0x4c74a8._0x2feb33,0x252,a0_0x4c74a8._0x2f539c)+_0x5730ab(a0_0x4c74a8._0x514841,a0_0x4c74a8._0x2d821f,a0_0x4c74a8._0x4cf42f,0x33b,a0_0x4c74a8._0x2424df)+'+$');});a0_0xe784c9();import{A as a0_0x4918bb,B as a0_0x480fd4,C as a0_0x24aca7,D as a0_0x5502e4,b as a0_0x2ad237,c as a0_0x4f4d22,d as a0_0x56f289,e as a0_0x2f1093,f as a0_0x259da7,g as a0_0xb6c11d,h as a0_0x5effc2,i as a0_0x524686,j as a0_0x20c425,k as a0_0x32aca4,l as a0_0x36c694,m as a0_0x2dc47f,n as a0_0x551c3a,o as a0_0x412eca,p as a0_0x481713,q as a0_0x5b0f2b,r as a0_0x45254c,s as a0_0x5aa893,t as a0_0x2565dc,u as a0_0x167307,v as a0_0x18a372,w as a0_0x29b0ea,x as a0_0x19fc25,y as a0_0x4f5231,z as a0_0x50ae36}from'../chunk-GNO7ZYE4.js';function a0_0x3e1a(_0x1ebcc0,_0x24f88b){_0x1ebcc0=_0x1ebcc0-(-0x322*-0x4+0x20a9+0x2b*-0x107);var _0x5f4da3=a0_0x44e6();var _0x164cb1=_0x5f4da3[_0x1ebcc0];if(a0_0x3e1a['UaQdXH']===undefined){var _0x34aa2f=function(_0x55cbc0){var _0x2d3155='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x338e8a='',_0x3b2173='',_0x2e9814=_0x338e8a+_0x34aa2f;for(var _0x24ff0a=0x1*0x185a+0x75*-0x28+-0x612,_0x44299b,_0x4c0f0f,_0x11cf00=-0x34a*0x5+-0x163*0x4+0x15fe;_0x4c0f0f=_0x55cbc0['charAt'](_0x11cf00++);~_0x4c0f0f&&(_0x44299b=_0x24ff0a%(0x27f*-0xe+0x18e6+-0x8*-0x142)?_0x44299b*(0x1a1e+0x1*0x975+-0x2353)+_0x4c0f0f:_0x4c0f0f,_0x24ff0a++%(0x12+-0x4f6+0x4e8))?_0x338e8a+=_0x2e9814['charCodeAt'](_0x11cf00+(-0x3*0x2e8+0x1*-0x21f4+0x2ab6))-(0x8*-0x5a+0x226b+-0x1f91)!==-0x26eb+0xe5*0x1d+0xcfa?String['fromCharCode'](0x1f52+-0x5*-0x147+-0x24b6&_0x44299b>>(-(-0x21cf+0xe5*0x2b+0xaa*-0x7)*_0x24ff0a&0x2e3*0x3+0xbf4*0x3+0xed5*-0x3)):_0x24ff0a:0x1482+-0x4ce+-0xfb4){_0x4c0f0f=_0x2d3155['indexOf'](_0x4c0f0f);}for(var _0x293c8d=-0x3*0xceb+-0xb04+-0x89*-0x5d,_0x50e861=_0x338e8a['length'];_0x293c8d<_0x50e861;_0x293c8d++){_0x3b2173+='%'+('00'+_0x338e8a['charCodeAt'](_0x293c8d)['toString'](-0x219e+0x1eb*-0xb+0x17b*0x25))['slice'](-(-0x906+0x7a5*0x4+-0x158c));}return decodeURIComponent(_0x3b2173);};var _0x4b1b9d=function(_0x2e12c4,_0x3fa183){var _0x5432f5=[],_0x18b933=-0x841+-0x1*0x1db7+0x9*0x438,_0x2d5365,_0x13f664='';_0x2e12c4=_0x34aa2f(_0x2e12c4);var _0x4c70de;for(_0x4c70de=0x1f*-0xd+0x2f*0xa7+-0x1d16;_0x4c70de<-0x86e+-0x14ae+0x1e1c;_0x4c70de++){_0x5432f5[_0x4c70de]=_0x4c70de;}for(_0x4c70de=0x52f*0x5+-0x15a*-0x14+-0x1*0x34f3;_0x4c70de<-0x1861+-0x10a9+0x1505*0x2;_0x4c70de++){_0x18b933=(_0x18b933+_0x5432f5[_0x4c70de]+_0x3fa183['charCodeAt'](_0x4c70de%_0x3fa183['length']))%(-0x12d*-0x3+0x5*0x176+0x1*-0x9d5),_0x2d5365=_0x5432f5[_0x4c70de],_0x5432f5[_0x4c70de]=_0x5432f5[_0x18b933],_0x5432f5[_0x18b933]=_0x2d5365;}_0x4c70de=-0xb*-0x1f9+-0x1660+0xad,_0x18b933=0xb24*0x2+-0xdbc+0x223*-0x4;for(var _0x2bfd6e=-0x8e*-0x1f+0x24cf+-0x3601;_0x2bfd6e<_0x2e12c4['length'];_0x2bfd6e++){_0x4c70de=(_0x4c70de+(0x2b+0x1014+-0x103e))%(0x1b51+0x225b+-0x3cac),_0x18b933=(_0x18b933+_0x5432f5[_0x4c70de])%(0xa3*-0x17+0x7*-0x73+0x12ca),_0x2d5365=_0x5432f5[_0x4c70de],_0x5432f5[_0x4c70de]=_0x5432f5[_0x18b933],_0x5432f5[_0x18b933]=_0x2d5365,_0x13f664+=String['fromCharCode'](_0x2e12c4['charCodeAt'](_0x2bfd6e)^_0x5432f5[(_0x5432f5[_0x4c70de]+_0x5432f5[_0x18b933])%(-0x20*-0x108+-0x1*0x195c+-0x6a4)]);}return _0x13f664;};a0_0x3e1a['VXxcqT']=_0x4b1b9d,a0_0x3e1a['dSuksU']={},a0_0x3e1a['UaQdXH']=!![];}var _0x203a1a=_0x5f4da3[0x2344+-0x195a+-0x9ea],_0x1c965c=_0x1ebcc0+_0x203a1a,_0x54c17d=a0_0x3e1a['dSuksU'][_0x1c965c];if(!_0x54c17d){if(a0_0x3e1a['XYcORq']===undefined){var _0x368f7e=function(_0x35901f){this['Lninpa']=_0x35901f,this['dVpPsn']=[0xc31+0xca6+0x242*-0xb,0x8*-0x331+0x3d7*0x1+0x15b1,0xae9+0x26d+-0xd56],this['xcXZbd']=function(){return'newState';},this['LRAfhw']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['GBlWOH']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x368f7e['prototype']['deIrWh']=function(){var _0x5d1646=new RegExp(this['LRAfhw']+this['GBlWOH']),_0x3ebe15=_0x5d1646['test'](this['xcXZbd']['toString']())?--this['dVpPsn'][0x69d+-0x4f*0xe+-0x24a]:--this['dVpPsn'][-0x237+-0xc4c+-0x1*-0xe83];return this['fTSWaH'](_0x3ebe15);},_0x368f7e['prototype']['fTSWaH']=function(_0xb0703c){if(!Boolean(~_0xb0703c))return _0xb0703c;return this['tYzfLm'](this['Lninpa']);},_0x368f7e['prototype']['tYzfLm']=function(_0x13cdc3){for(var _0x446d42=0x746*0x5+0x3b*0x4+-0x3*0xc6e,_0x529eed=this['dVpPsn']['length'];_0x446d42<_0x529eed;_0x446d42++){this['dVpPsn']['push'](Math['round'](Math['random']())),_0x529eed=this['dVpPsn']['length'];}return _0x13cdc3(this['dVpPsn'][0xc84+-0x520*-0x1+-0x1*0x11a4]);},new _0x368f7e(a0_0x3e1a)['deIrWh'](),a0_0x3e1a['XYcORq']=!![];}_0x164cb1=a0_0x3e1a['VXxcqT'](_0x164cb1,_0x24f88b),a0_0x3e1a['dSuksU'][_0x1c965c]=_0x164cb1;}else _0x164cb1=_0x54c17d;return _0x164cb1;}import{a as a0_0x444a10,b as a0_0x4db16c,c as a0_0x44ed57,d as a0_0x13de12,e as a0_0x531dbe}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x444a10 as AssetCache,a0_0x44ed57 as AssetLoader,a0_0x167307 as AssetSystem,a0_0x13de12 as AssetTextures,a0_0x5aa893 as Assets,a0_0x412eca as BaseSystem,a0_0x551c3a as GameEngine,a0_0x2f1093 as GameObject,a0_0x259da7 as GameObjectManager,a0_0x2dc47f as ObjectFactory,a0_0x56f289 as Renderer,a0_0x481713 as RuntimeObjectRegistry,a0_0x4f4d22 as Transform,a0_0x480fd4 as applyScreenAnchor,a0_0x5b0f2b as basePixi,a0_0x29b0ea as clearResponsiveElements,a0_0x2ad237 as createPixiBase,a0_0x20c425 as getRegisteredFontIds,a0_0x18a372 as globalResponsiveMultipliers,a0_0x531dbe as initAssetTextures,a0_0x2565dc as initAssets,a0_0x24aca7 as layout,a0_0x36c694 as playLottieOverlay,a0_0x524686 as registerFont,a0_0x4db16c as registerType,a0_0x4f5231 as resolveAnchorVec2,a0_0xb6c11d as resolveFont,a0_0x5effc2 as resolveFontWeight,a0_0x50ae36 as resolveScreenAnchorPoint,a0_0x4918bb as resolveScreenRatioPoint,a0_0x5502e4 as runInitSequence,a0_0x32aca4 as setLottieInstance,a0_0x45254c as spawnSceneFromConfig,a0_0x19fc25 as updateScreenState};
|
|
1
|
+
(function(_0x27e5e6,_0xff9244){var a0_0x4e2198={_0x1bd7d8:'EpG@',_0x42df5c:0x25,_0x45f9d8:0x2f,_0x57e877:0x29b,_0x4f0c97:'nHo8',_0x593116:0x299,_0x510adc:0x2a6,_0x58427c:0x295,_0x431777:0x28c,_0x5ac33b:0x28a,_0x39015d:0x291,_0x22fb77:0x1c0,_0x26e027:0x1c2,_0x2140c1:0x1bc,_0x4ee3b0:'QlkD',_0x258462:0x20,_0xb8d8f1:0x23,_0x3f14b9:0x23,_0x5bf6f9:0x291,_0x59a5fe:0x28e,_0x3aa08d:0x1ce,_0x423085:0x1d6,_0x418f8b:0x1c8,_0x1668c7:0x28b,_0x4d8db4:'LYxk',_0x5c17b9:0x293,_0x46d57e:0x290,_0x3e0e9c:0x1bc,_0x5d30e9:0x1ad,_0x2bfa06:0x1b8,_0x4212d3:'f*N8',_0x49e879:0x1b7,_0x247828:0x1ba,_0x3198ff:0x1c3,_0x37d681:'59BU'},a0_0x3faf89={_0x1b1751:0x80},a0_0x2b8b54={_0x3a089a:0x117},a0_0x1b6fdc={_0x4577c2:0x345},_0x3a65bc=_0x27e5e6();function _0x9ae0f4(_0x2aee21,_0x22feda,_0x10898b,_0x83d2e0,_0x382f6b){return a0_0xab19(_0x22feda- -a0_0x1b6fdc._0x4577c2,_0x10898b);}function _0x145aff(_0x12e24f,_0x241546,_0x180ad2,_0x4cde62,_0x241019){return a0_0xab19(_0x241546-a0_0x2b8b54._0x3a089a,_0x241019);}function _0x1e1e49(_0x2a093b,_0x4bbf0c,_0x567e98,_0x3dcf2e,_0x3f3f3f){return a0_0xab19(_0x3f3f3f- -a0_0x3faf89._0x1b1751,_0x2a093b);}while(!![]){try{var _0x363270=parseInt(_0x1e1e49(a0_0x4e2198._0x1bd7d8,0x21,a0_0x4e2198._0x42df5c,0x39,a0_0x4e2198._0x45f9d8))/(0x15e*-0x1b+-0x2*-0x184+-0x15b*-0x19)+-parseInt(_0x9ae0f4(-0x29d,-a0_0x4e2198._0x57e877,a0_0x4e2198._0x4f0c97,-a0_0x4e2198._0x593116,-a0_0x4e2198._0x510adc))/(0x862+0x1273*-0x1+-0xa13*-0x1)*(parseInt(_0x9ae0f4(-a0_0x4e2198._0x58427c,-a0_0x4e2198._0x431777,'EpG@',-a0_0x4e2198._0x5ac33b,-a0_0x4e2198._0x39015d))/(-0x53d+-0x1530+0x468*0x6))+-parseInt(_0x145aff(a0_0x4e2198._0x22fb77,a0_0x4e2198._0x26e027,0x1d1,a0_0x4e2198._0x2140c1,a0_0x4e2198._0x4ee3b0))/(-0x1*-0x1462+0xda2+-0x2200)*(parseInt(_0x1e1e49('Id5U',a0_0x4e2198._0x258462,a0_0x4e2198._0xb8d8f1,0x2f,a0_0x4e2198._0x3f14b9))/(-0x8f*0x3a+0x49*-0x37+0x301a))+parseInt(_0x9ae0f4(-0x296,-a0_0x4e2198._0x5bf6f9,a0_0x4e2198._0x4f0c97,-a0_0x4e2198._0x59a5fe,-0x299))/(-0x140+-0x1607+0x5*0x4a9)+parseInt(_0x145aff(0x1d9,a0_0x4e2198._0x3aa08d,a0_0x4e2198._0x423085,a0_0x4e2198._0x418f8b,'%lT8'))/(0x2*-0x943+0xebc+-0x1*-0x3d1)+parseInt(_0x9ae0f4(-a0_0x4e2198._0x1668c7,-0x289,a0_0x4e2198._0x4d8db4,-a0_0x4e2198._0x5c17b9,-a0_0x4e2198._0x46d57e))/(0xe*-0x27d+0x107*-0x3+-0x797*-0x5)*(-parseInt(_0x145aff(0x1b2,a0_0x4e2198._0x3e0e9c,a0_0x4e2198._0x5d30e9,a0_0x4e2198._0x2bfa06,a0_0x4e2198._0x4212d3))/(0xfa*-0xe+-0x21be+0x2f73))+parseInt(_0x145aff(0x1be,a0_0x4e2198._0x49e879,a0_0x4e2198._0x247828,a0_0x4e2198._0x3198ff,a0_0x4e2198._0x37d681))/(0x1ae4+-0x26f*0x1+-0x149*0x13);if(_0x363270===_0xff9244)break;else _0x3a65bc['push'](_0x3a65bc['shift']());}catch(_0x1f3900){_0x3a65bc['push'](_0x3a65bc['shift']());}}}(a0_0x5608,-0x1*-0x98d07+0x4f19*-0x54+0x1f7cbe));var a0_0xf71c31=(function(){var _0x372af9=!![];return function(_0x2b4522,_0x2ce12f){var _0x429915=_0x372af9?function(){if(_0x2ce12f){var _0xaaf0ec=_0x2ce12f['apply'](_0x2b4522,arguments);return _0x2ce12f=null,_0xaaf0ec;}}:function(){};return _0x372af9=![],_0x429915;};}()),a0_0x519025=a0_0xf71c31(this,function(){var a0_0x35ef03={_0x5b9446:0x1e8,_0x90d252:'lH2E',_0x6c41a2:0x1f6,_0xc87b13:0x1e5,_0x32e23a:0x1e0,_0xa491a7:0x1db,_0x341dd4:'1OL0',_0x4e1cc8:0x1e9,_0x375fd6:0x1cf,_0x491654:0xde,_0x53bbe7:0xc7,_0x5d7e38:0xd0,_0x5ae26a:0xc6,_0x1cacbb:'3IgH',_0x174ca6:0xc2,_0x56717c:0xd4,_0x1bd494:0xcc,_0xb79738:0xc9,_0x75ac70:0x164,_0x5bf7f6:0x156,_0x266170:0x161,_0x3e7524:0x17d,_0x447dc2:'W!xA',_0x4d8410:0x183,_0x2e2053:0x170,_0x534064:0xbf,_0x45686d:0xba,_0x46fa89:'oq[A',_0x4bb135:0xcb,_0x4fc9d4:0xc6,_0x1d7b5c:0x17b,_0x450cd7:'Id5U',_0x2cd6ba:0x178,_0x43be52:0x16d,_0x91be70:0x172,_0x24a658:'u(8e',_0x1cf92b:'%lT8',_0x419865:0x169,_0x33d9ed:0x16e,_0x12e5c0:0x1e6,_0x2255fd:'s2lO'},a0_0x40a563={_0x3d6722:0x135},_0x492450={};function _0x5770e4(_0xc89a63,_0x8d84b1,_0x4b8ef5,_0x24f278,_0x618b30){return a0_0xab19(_0x4b8ef5- -0x174,_0x618b30);}_0x492450[_0x60f0e5(a0_0x35ef03._0x5b9446,a0_0x35ef03._0x90d252,a0_0x35ef03._0x6c41a2,a0_0x35ef03._0xc87b13,a0_0x35ef03._0x32e23a)]='(((.+'+_0x60f0e5(a0_0x35ef03._0xa491a7,a0_0x35ef03._0x341dd4,a0_0x35ef03._0x4e1cc8,0x1e8,a0_0x35ef03._0x375fd6)+'+$';var _0x4b21e1=_0x492450;function _0x60f0e5(_0x15fdb3,_0x155c78,_0x578583,_0x587320,_0x4ae0f6){return a0_0xab19(_0x15fdb3-a0_0x40a563._0x3d6722,_0x155c78);}function _0x3d9c06(_0xb7a9c5,_0x365835,_0x19cd1f,_0x1442a5,_0x1d5fe8){return a0_0xab19(_0x19cd1f-0xc2,_0x365835);}return a0_0x519025[_0x5770e4(-a0_0x35ef03._0x491654,-a0_0x35ef03._0x53bbe7,-a0_0x35ef03._0x5d7e38,-a0_0x35ef03._0x5ae26a,a0_0x35ef03._0x1cacbb)+_0x5770e4(-a0_0x35ef03._0x174ca6,-a0_0x35ef03._0x56717c,-a0_0x35ef03._0x1bd494,-a0_0x35ef03._0xb79738,'vq3)')]()[_0x3d9c06(0x161,'X@oq',a0_0x35ef03._0x75ac70,a0_0x35ef03._0x5bf7f6,a0_0x35ef03._0x266170)+'h']('(((.+'+_0x3d9c06(a0_0x35ef03._0x3e7524,a0_0x35ef03._0x447dc2,0x17c,a0_0x35ef03._0x4d8410,a0_0x35ef03._0x2e2053)+'+$')[_0x5770e4(-a0_0x35ef03._0x174ca6,-0xbc,-a0_0x35ef03._0x534064,-a0_0x35ef03._0x45686d,a0_0x35ef03._0x46fa89)+_0x5770e4(-a0_0x35ef03._0x4bb135,-0xcc,-a0_0x35ef03._0x4fc9d4,-0xc4,'MmaR')]()[_0x3d9c06(a0_0x35ef03._0x1d7b5c,a0_0x35ef03._0x450cd7,0x172,a0_0x35ef03._0x2cd6ba,a0_0x35ef03._0x43be52)+_0x3d9c06(a0_0x35ef03._0x91be70,a0_0x35ef03._0x24a658,0x163,a0_0x35ef03._0x2e2053,0x16a)+'r'](a0_0x519025)[_0x3d9c06(0x165,a0_0x35ef03._0x1cf92b,a0_0x35ef03._0x419865,a0_0x35ef03._0x33d9ed,0x160)+'h'](_0x4b21e1[_0x60f0e5(a0_0x35ef03._0x12e5c0,a0_0x35ef03._0x2255fd,0x1e9,0x1e0,0x1dc)]);});a0_0x519025();function a0_0xab19(_0x4fcb60,_0x2c3512){_0x4fcb60=_0x4fcb60-(0x12d7+0x1679+-0x28b0);var _0x2af915=a0_0x5608();var _0x1d0bb1=_0x2af915[_0x4fcb60];if(a0_0xab19['isrbEx']===undefined){var _0x824ddd=function(_0x47cc34){var _0xcf762b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x2e29bf='',_0x14cd6e='',_0x1aa5ea=_0x2e29bf+_0x824ddd;for(var _0x575fb0=0x1f6b+0x5*-0x610+0x11b*-0x1,_0x5b4e0f,_0x3fc77d,_0x191424=0x1ed3+0x24cb+0x5*-0xd86;_0x3fc77d=_0x47cc34['charAt'](_0x191424++);~_0x3fc77d&&(_0x5b4e0f=_0x575fb0%(-0xc67+0x9*0x386+-0x1*0x134b)?_0x5b4e0f*(0x2*-0xdf5+-0x1b31*0x1+0x1*0x375b)+_0x3fc77d:_0x3fc77d,_0x575fb0++%(0x48*-0x2e+-0x5c*-0x17+0x4b0))?_0x2e29bf+=_0x1aa5ea['charCodeAt'](_0x191424+(0xb8d*-0x2+-0x139*-0x13+-0x17*0x1))-(-0x6*0x16+0x1157*-0x2+0x233c)!==0x2*-0xfca+-0x1e23+0x103*0x3d?String['fromCharCode'](0x1912+-0x2b*0xbe+-0x1*-0x7d7&_0x5b4e0f>>(-(0x1acf+0x1541+0x2*-0x1807)*_0x575fb0&-0x1af9*0x1+-0x5dc*-0x1+0x305*0x7)):_0x575fb0:0x6c6+0x129e*0x1+-0x7d*0x34){_0x3fc77d=_0xcf762b['indexOf'](_0x3fc77d);}for(var _0x41abc5=0x13a3+-0x25*-0xfb+-0x37ea,_0x5a85cc=_0x2e29bf['length'];_0x41abc5<_0x5a85cc;_0x41abc5++){_0x14cd6e+='%'+('00'+_0x2e29bf['charCodeAt'](_0x41abc5)['toString'](0x12bb+-0xb90+-0x71b))['slice'](-(-0x75c+-0x4*0x94+-0x2*-0x4d7));}return decodeURIComponent(_0x14cd6e);};var _0x4393f5=function(_0x3c9c56,_0x766918){var _0x303e21=[],_0x2515b3=-0x11*-0x224+0x156d+-0x39d1,_0x52bd33,_0x2becd6='';_0x3c9c56=_0x824ddd(_0x3c9c56);var _0x375eb0;for(_0x375eb0=-0x3c3*0x7+0x837+0x121e;_0x375eb0<-0x24a8+-0x22*-0x59+0x19d6*0x1;_0x375eb0++){_0x303e21[_0x375eb0]=_0x375eb0;}for(_0x375eb0=0x1f1f+-0x1526*0x1+-0x9f9;_0x375eb0<-0xaf+-0x1*0x151d+0x16cc;_0x375eb0++){_0x2515b3=(_0x2515b3+_0x303e21[_0x375eb0]+_0x766918['charCodeAt'](_0x375eb0%_0x766918['length']))%(0x295*0x6+0x2*-0xf29+0xfd4),_0x52bd33=_0x303e21[_0x375eb0],_0x303e21[_0x375eb0]=_0x303e21[_0x2515b3],_0x303e21[_0x2515b3]=_0x52bd33;}_0x375eb0=-0xc01*0x2+0xdc2+-0x148*-0x8,_0x2515b3=0x19a5+-0x15e2+0x3*-0x141;for(var _0x3dbf31=-0x178d+-0x1b1a+0x32a7;_0x3dbf31<_0x3c9c56['length'];_0x3dbf31++){_0x375eb0=(_0x375eb0+(0x1049+-0x11*0x10f+0x1b7))%(0x1*0x1156+-0x6f3+-0x321*0x3),_0x2515b3=(_0x2515b3+_0x303e21[_0x375eb0])%(0x94*-0x26+-0x2203+0x38fb),_0x52bd33=_0x303e21[_0x375eb0],_0x303e21[_0x375eb0]=_0x303e21[_0x2515b3],_0x303e21[_0x2515b3]=_0x52bd33,_0x2becd6+=String['fromCharCode'](_0x3c9c56['charCodeAt'](_0x3dbf31)^_0x303e21[(_0x303e21[_0x375eb0]+_0x303e21[_0x2515b3])%(-0x1cd*-0x9+-0x30*0x59+0x17b)]);}return _0x2becd6;};a0_0xab19['sonkQL']=_0x4393f5,a0_0xab19['GKMLoj']={},a0_0xab19['isrbEx']=!![];}var _0x1c8c31=_0x2af915[0x26d8+0x22*0x10b+-0x4a4e],_0x5a9628=_0x4fcb60+_0x1c8c31,_0x16df44=a0_0xab19['GKMLoj'][_0x5a9628];if(!_0x16df44){if(a0_0xab19['kApzwu']===undefined){var _0x526104=function(_0x4a65db){this['TRdcto']=_0x4a65db,this['HLQtip']=[-0x2013+-0x655*0x1+0x2669*0x1,0x2243+-0x2253*-0x1+-0x4496,-0x19*-0xb5+0x35*-0x3a+-0x5ab],this['YBheSP']=function(){return'newState';},this['zugVwz']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['PhZqCp']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x526104['prototype']['ezZKpN']=function(){var _0x3247af=new RegExp(this['zugVwz']+this['PhZqCp']),_0x6462ea=_0x3247af['test'](this['YBheSP']['toString']())?--this['HLQtip'][-0x189c+-0x400*-0x1+0x149d*0x1]:--this['HLQtip'][0x1c7a+-0x6d*-0x33+-0x3*0x10bb];return this['MfdNfe'](_0x6462ea);},_0x526104['prototype']['MfdNfe']=function(_0x1f00b4){if(!Boolean(~_0x1f00b4))return _0x1f00b4;return this['FaWMxu'](this['TRdcto']);},_0x526104['prototype']['FaWMxu']=function(_0x680d07){for(var _0x5a9adc=0x65b*-0x3+0x10e2+0x22f,_0x536171=this['HLQtip']['length'];_0x5a9adc<_0x536171;_0x5a9adc++){this['HLQtip']['push'](Math['round'](Math['random']())),_0x536171=this['HLQtip']['length'];}return _0x680d07(this['HLQtip'][-0x1530+0x190d*-0x1+0x13*0x26f]);},new _0x526104(a0_0xab19)['ezZKpN'](),a0_0xab19['kApzwu']=!![];}_0x1d0bb1=a0_0xab19['sonkQL'](_0x1d0bb1,_0x2c3512),a0_0xab19['GKMLoj'][_0x5a9628]=_0x1d0bb1;}else _0x1d0bb1=_0x16df44;return _0x1d0bb1;}import{A as a0_0x2cdd50,B as a0_0x173fa1,C as a0_0x492786,D as a0_0x2371eb,b as a0_0x56cfb4,c as a0_0x2af85b,d as a0_0x5c1b16,e as a0_0x49d69b,f as a0_0x3d0567,g as a0_0x21dad7,h as a0_0x2075f3,i as a0_0x2e1c7c,j as a0_0xf8cc39,k as a0_0x39b688,l as a0_0x3b1866,m as a0_0x9250d0,n as a0_0x2f82a6,o as a0_0xbf5727,p as a0_0x2f310b,q as a0_0x3e1dd1,r as a0_0x102bbd,s as a0_0x4c7ed6,t as a0_0x1b74db,u as a0_0x533d7f,v as a0_0x5ec33e,w as a0_0x55abab,x as a0_0x15e07a,y as a0_0x184e1a,z as a0_0x3354aa}from'../chunk-DE4OA2P6.js';import{a as a0_0x9f0074,b as a0_0x679f62,c as a0_0x2edac1,d as a0_0x15eba2,e as a0_0x15c235}from'../chunk-I5OOVR5U.js';function a0_0x5608(){var _0x4bfde5=['w0LnsSoPvdGPWPP5kmoA','WPmIW7LzmtuYW4qoeKldOCkcWRa','WPbFl0yTwCo6WOZdTSkA','mCoXdJSkECoarG','n8o8gSofW4i','xSkKpee0W43dKColW7G','WQRcH0FcVH8BfYZcVq','n8kChM1oquKzW5/dRxzC','aYjmW78aW77cHKyEW5FcH8k3pvO','f3tcLSoOW6u','WQLqr0ZdRG','d1ybtIuVjv9/gW','dmohW5uxdG','W7xdJfVdU8o/WPP3F8oLWQC/WPa','cCoLWQJdO8oV','W5f2WQ4Bzq','wbHg','WQhdM8kiW63cPCoUWRtdICoOh0BcVmoX','hSoheSoBW7ldQ0X+mubQeW','WOLDWPFcQL1lW47dKdFdPW','eSkoW43cGmouWQ9VWOxdKXZcOmk6','vdidtL3dQColWOldJJT3nrXq','fmo3CG','pmoYFuXDgSonqLGwuGa','xWfzcd4','W4SoW4NcGLq','fSorxejeAJLeWPWaWOLDWQ/dNW','khDceq0','g8oeeSoBW7tdRbP3bLzIlmkK','CSobEIei'];a0_0x5608=function(){return _0x4bfde5;};return a0_0x5608();}import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x9f0074 as AssetCache,a0_0x2edac1 as AssetLoader,a0_0x533d7f as AssetSystem,a0_0x15eba2 as AssetTextures,a0_0x4c7ed6 as Assets,a0_0xbf5727 as BaseSystem,a0_0x2f82a6 as GameEngine,a0_0x49d69b as GameObject,a0_0x3d0567 as GameObjectManager,a0_0x9250d0 as ObjectFactory,a0_0x5c1b16 as Renderer,a0_0x2f310b as RuntimeObjectRegistry,a0_0x2af85b as Transform,a0_0x173fa1 as applyScreenAnchor,a0_0x3e1dd1 as basePixi,a0_0x55abab as clearResponsiveElements,a0_0x56cfb4 as createPixiBase,a0_0xf8cc39 as getRegisteredFontIds,a0_0x5ec33e as globalResponsiveMultipliers,a0_0x15c235 as initAssetTextures,a0_0x1b74db as initAssets,a0_0x492786 as layout,a0_0x3b1866 as playLottieOverlay,a0_0x2e1c7c as registerFont,a0_0x679f62 as registerType,a0_0x184e1a as resolveAnchorVec2,a0_0x21dad7 as resolveFont,a0_0x2075f3 as resolveFontWeight,a0_0x3354aa as resolveScreenAnchorPoint,a0_0x2cdd50 as resolveScreenRatioPoint,a0_0x2371eb as runInitSequence,a0_0x39b688 as setLottieInstance,a0_0x102bbd as spawnSceneFromConfig,a0_0x15e07a as updateScreenState};
|
package/dist/three/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let d=s.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xs={};oa(Xs,{AspectClass:()=>In,GameObject:()=>st,GameObjectManager:()=>$t,Renderer:()=>ot,ResponsiveUISystem:()=>Ge,Transform:()=>rt,animateHandClick:()=>xr,animatePanelEntrance:()=>vr,createBrushTexture:()=>Lr,createEndGamePanel:()=>yr,createHandTutorial:()=>wr,createThreeBase:()=>fr,createTutorialLabel:()=>Er,getAspectClass:()=>Dt,getRegisteredFontIds:()=>br,loadAsset:()=>$n,loadCharacterFrames:()=>Tr,registerFont:()=>mr,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Sr});module.exports=wo(Xs);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var M=null,W=[],Pe=null;function da(t){M=t,W=[],Pe!==null&&(clearTimeout(Pe),Pe=null)}function pa(){var t,e,n;return{endpoint:(M==null?void 0:M.endpoint)||"",transport:(M==null?void 0:M.transport)||"beacon",batchSize:(t=M==null?void 0:M.batchSize)!=null?t:10,flushIntervalMs:(e=M==null?void 0:M.flushIntervalMs)!=null?e:300,maxQueue:(n=M==null?void 0:M.maxQueue)!=null?n:200,debug:!!(M!=null&&M.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}Pe===null&&(Pe=window.setTimeout(()=>{Pe=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Eo(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function So(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Ao(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Ao(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,s(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},r=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){o(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Eo(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:So(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>o(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))o(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.3.76",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var G=0,To=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,La=G++,_a=G++,ka=G++,T=To;function Ma(){return T===va}function Pa(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===La}function Zt(){return T===_a}function Qt(){return T===ka}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=La)}catch{}else e==="vungle"?T=_a:(t==="nucleo"||e==="nucleo")&&(T=ka)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Lo=require("pixi.js");var en=require("pixi.js");var _o=null;function tn(t){_o=t}vt();nn();var Ye=require("pixi.js");vt();var Io=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",sn=Io;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(sn=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${sn}`))}}catch{}function jo(t){var n,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(t);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(t))return{x:(n=t[0])!=null?n:.5,y:(i=t[1])!=null?i:.5};if(t&&typeof t=="object"&&"x"in t&&"y"in t)return{x:(a=t.x)!=null?a:.5,y:(r=t.y)!=null?r:.5};if(typeof t=="string"){let s=t.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${sn}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let r=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await Se.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new Ye.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(c=s==null?void 0:s.constructor)==null?void 0:c.name),this.applyTransform(s,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=o==null?void 0:o.constructor)==null?void 0:g.name,o),o&&(((u=o.constructor)==null?void 0:u.name)==="Container"||o instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=s==null?void 0:s.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,n==null?void 0:n.transform,n);return s}static applyTransform(e,n,i){var a,r,o,s;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(r=n.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=n.position.x)!=null?o:0,(s=n.position.y)!=null?s:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=jo(n.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Ho=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Ho);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Fo=new cn,No=new Proxy(Fo,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Uo(t,e,n,i,a,r,o){pn.push({element:t,originalScale:r,positionHelper:e,heightPercent:a}),e(t,n,i,a,r,o,!1)}function qo(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),qo()}var Ze={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function Wo(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Vo(){return Ze}var Yo={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Yo[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),r=(u=i.inset)!=null?u:{},o=(b=i.padding)!=null?b:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((x=r.right)!=null?x:0)+o.x,d=((v=r.top)!=null?v:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,c=Math.max(0,t-s-l),g=Math.max(0,e-d-p);return{x:s+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},r=(x=i.padding)!=null?x:{x:0,y:0},o=((v=a.left)!=null?v:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((f=a.top)!=null?f:0)+r.y,d=((m=a.bottom)!=null?m:0)+r.y,p=Math.max(0,t-o-s),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:o+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Wo,window.getDebugConfig=Vo,window.copyConfig=rs,window.applyConfig=Je,window.applyConfigForRatio=os,window.positionAtBottom=qa,window.positionAtTop=Jo,window.positionAtCenter=Zo,window.positionAtLeft=Qo,window.positionAtRight=es,window.positionAtBottomLeft=ts,window.positionAtBottomRight=ns,window.positionAtTopLeft=is,window.positionAtTopRight=as,window.applyPositionContract=Xo,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function Lt(t,e,n=0){return t*e+n}function _t(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Ko(t,e){return t*e}function Xo(t,e,n,i){var o,s,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,k,R;let a=0,r=0;switch(i.type){case"top":a=U(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),r=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=Lt(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),r=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=_t(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),r=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),r=U(n,(R=(k=i.offset)==null?void 0:k.y)!=null?R:0);break}t.position?t.position.set(a,r):(t.x=a,t.y=r),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,r=!0,o=!1){let s=Ko(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=r?a*le.scaleFactor:a;de(t,d),o&&!pn.find(p=>p.element===t)&&Uo(t,qa,e,n,i,a,r)}function Jo(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Zo(t,e,n,i=0,a=0,r=1){ce(t,U(e,i),U(n,a)),de(t,r)}function Qo(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function es(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function ts(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Tt(n,i)),de(t,r)}function ns(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Tt(n,i)),de(t,r)}function is(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Ct(n,i)),de(t,r)}function as(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Ct(n,i)),de(t,r)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function rs(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function os(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function P(t,e){let n=(a,r)=>r===0?a:n(r,a%r),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:P(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:P(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:P(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:P(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:P(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:P(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:P(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:P(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:P(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:P(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:P(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:P(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:P(800,1280)}],Ka=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:P(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:P(768,1024),mraidScale:.7}];var qc=[...Ka];var hs=Ka[0];fe();var xs=ae(require("jszip"),1);function bs(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function ys(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vs(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await bs(a),o=await vs(r),s=ys(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(n=o==null?void 0:o.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function kt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let r=a.getImageData(0,0,i.width,i.height),o=r.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:o[c.offset],g:o[c.offset+1],b:o[c.offset+2]})),d=0;for(let c=0;c<o.length;c+=4){let g=o[c],u=o[c+1],b=o[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(o[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,r,o,s,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(o=(r=(a=b.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(s=c.message)!=null&&s.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),r=[{text:e}];n.length>0&&n.forEach((s,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let l=s.inlineData.data,d=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var ws=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Es=require("pixi.js");fe();function ks(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Ms(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ps(t){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let d=s.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xs={};oa(Xs,{AspectClass:()=>In,GameObject:()=>st,GameObjectManager:()=>$t,Renderer:()=>ot,ResponsiveUISystem:()=>Ge,Transform:()=>rt,animateHandClick:()=>xr,animatePanelEntrance:()=>vr,createBrushTexture:()=>Lr,createEndGamePanel:()=>yr,createHandTutorial:()=>wr,createThreeBase:()=>fr,createTutorialLabel:()=>Er,getAspectClass:()=>Dt,getRegisteredFontIds:()=>br,loadAsset:()=>$n,loadCharacterFrames:()=>Tr,registerFont:()=>mr,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Sr});module.exports=wo(Xs);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var M=null,W=[],Pe=null;function da(t){M=t,W=[],Pe!==null&&(clearTimeout(Pe),Pe=null)}function pa(){var t,e,n;return{endpoint:(M==null?void 0:M.endpoint)||"",transport:(M==null?void 0:M.transport)||"beacon",batchSize:(t=M==null?void 0:M.batchSize)!=null?t:10,flushIntervalMs:(e=M==null?void 0:M.flushIntervalMs)!=null?e:300,maxQueue:(n=M==null?void 0:M.maxQueue)!=null?n:200,debug:!!(M!=null&&M.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}Pe===null&&(Pe=window.setTimeout(()=>{Pe=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Eo(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function So(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Ao(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Ao(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,s(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},r=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},o=p=>{p.killed||(p.killed=!0,r(p))},s=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){o(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Eo(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:So(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>o(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))o(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.3.78",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var G=0,To=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,La=G++,_a=G++,ka=G++,T=To;function Ma(){return T===va}function Pa(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===La}function Zt(){return T===_a}function Qt(){return T===ka}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=La)}catch{}else e==="vungle"?T=_a:(t==="nucleo"||e==="nucleo")&&(T=ka)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Lo=require("pixi.js");var en=require("pixi.js");var _o=null;function tn(t){_o=t}vt();nn();var Ye=require("pixi.js");vt();var Io=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",sn=Io;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(sn=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${sn}`))}}catch{}function jo(t){var n,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(t);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(t))return{x:(n=t[0])!=null?n:.5,y:(i=t[1])!=null?i:.5};if(t&&typeof t=="object"&&"x"in t&&"y"in t)return{x:(a=t.x)!=null?a:.5,y:(r=t.y)!=null?r:.5};if(typeof t=="string"){let s=t.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${sn}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let r=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await Se.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=o==null?void 0:o.constructor)==null?void 0:p.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new Ye.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(c=s==null?void 0:s.constructor)==null?void 0:c.name),this.applyTransform(s,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=o==null?void 0:o.constructor)==null?void 0:g.name,o),o&&(((u=o.constructor)==null?void 0:u.name)==="Container"||o instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=s==null?void 0:s.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,n==null?void 0:n.transform,n);return s}static applyTransform(e,n,i){var a,r,o,s;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(r=n.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=n.position.x)!=null?o:0,(s=n.position.y)!=null?s:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=jo(n.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Ho=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Ho);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Fo=new cn,No=new Proxy(Fo,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Uo(t,e,n,i,a,r,o){pn.push({element:t,originalScale:r,positionHelper:e,heightPercent:a}),e(t,n,i,a,r,o,!1)}function qo(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),qo()}var Ze={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function Wo(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Vo(){return Ze}var Yo={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Yo[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),r=(u=i.inset)!=null?u:{},o=(b=i.padding)!=null?b:{x:0,y:0},s=((h=r.left)!=null?h:0)+o.x,l=((x=r.right)!=null?x:0)+o.x,d=((v=r.top)!=null?v:0)+o.y,p=((y=r.bottom)!=null?y:0)+o.y,c=Math.max(0,t-s-l),g=Math.max(0,e-d-p);return{x:s+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},r=(x=i.padding)!=null?x:{x:0,y:0},o=((v=a.left)!=null?v:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((f=a.top)!=null?f:0)+r.y,d=((m=a.bottom)!=null?m:0)+r.y,p=Math.max(0,t-o-s),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:o+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Wo,window.getDebugConfig=Vo,window.copyConfig=rs,window.applyConfig=Je,window.applyConfigForRatio=os,window.positionAtBottom=qa,window.positionAtTop=Jo,window.positionAtCenter=Zo,window.positionAtLeft=Qo,window.positionAtRight=es,window.positionAtBottomLeft=ts,window.positionAtBottomRight=ns,window.positionAtTopLeft=is,window.positionAtTopRight=as,window.applyPositionContract=Xo,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function Lt(t,e,n=0){return t*e+n}function _t(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Ko(t,e){return t*e}function Xo(t,e,n,i){var o,s,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,k,R;let a=0,r=0;switch(i.type){case"top":a=U(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),r=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=Lt(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),r=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=_t(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),r=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),r=U(n,(R=(k=i.offset)==null?void 0:k.y)!=null?R:0);break}t.position?t.position.set(a,r):(t.x=a,t.y=r),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,r=!0,o=!1){let s=Ko(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=r?a*le.scaleFactor:a;de(t,d),o&&!pn.find(p=>p.element===t)&&Uo(t,qa,e,n,i,a,r)}function Jo(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Zo(t,e,n,i=0,a=0,r=1){ce(t,U(e,i),U(n,a)),de(t,r)}function Qo(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function es(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function ts(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Tt(n,i)),de(t,r)}function ns(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Tt(n,i)),de(t,r)}function is(t,e,n,i=.05,a=.05,r=1){ce(t,Lt(e,a),Ct(n,i)),de(t,r)}function as(t,e,n,i=.05,a=.05,r=1){ce(t,_t(e,a),Ct(n,i)),de(t,r)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function rs(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function os(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function P(t,e){let n=(a,r)=>r===0?a:n(r,a%r),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:P(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:P(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:P(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:P(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:P(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:P(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:P(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:P(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:P(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:P(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:P(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:P(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:P(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:P(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:P(800,1280)}],Ka=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:P(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:P(768,1024),mraidScale:.7}];var qc=[...Ka];var hs=Ka[0];fe();var xs=ae(require("jszip"),1);function bs(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function ys(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vs(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await bs(a),o=await vs(r),s=ys(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(n=o==null?void 0:o.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function kt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let r=a.getImageData(0,0,i.width,i.height),o=r.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:o[c.offset],g:o[c.offset+1],b:o[c.offset+2]})),d=0;for(let c=0;c<o.length;c+=4){let g=o[c],u=o[c+1],b=o[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(o[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,r,o,s,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(o=(r=(a=b.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(s=c.message)!=null&&s.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),r=[{text:e}];n.length>0&&n.forEach((s,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let l=s.inlineData.data,d=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var ws=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Es=require("pixi.js");fe();function ks(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Ms(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ps(t){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|