handler-playable-sdk 1.0.102 → 1.0.104

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.
Files changed (42) hide show
  1. package/dist/chunk-FL4VTM6W.js +1 -0
  2. package/dist/{chunk-EMWR536B.js → chunk-M4ULXPTP.js} +16 -6
  3. package/dist/cli/brand-dna.mjs +1 -1
  4. package/dist/cli/canva-import.mjs +1 -1
  5. package/dist/cli/cleanup-assets.mjs +1 -1
  6. package/dist/cli/fix-scales.mjs +1 -1
  7. package/dist/cli/index.js +1 -1
  8. package/dist/cli/screen-helper.mjs +1 -1
  9. package/dist/cli/setup-library.mjs +1 -1
  10. package/dist/cli/student-helper/add-logic.mjs +1 -1
  11. package/dist/cli/student-helper/add-object.mjs +1 -1
  12. package/dist/cli/student-helper/arg-parsing.mjs +1 -1
  13. package/dist/cli/student-helper/asset-registry.mjs +1 -1
  14. package/dist/cli/student-helper/bullet-system.mjs +1 -1
  15. package/dist/cli/student-helper/collectable-system.mjs +1 -1
  16. package/dist/cli/student-helper/constants.mjs +1 -1
  17. package/dist/cli/student-helper/drag-snap-couples.mjs +1 -1
  18. package/dist/cli/student-helper/endgame-screen.mjs +1 -1
  19. package/dist/cli/student-helper/fs-io.mjs +1 -1
  20. package/dist/cli/student-helper/logic-defaults.mjs +1 -1
  21. package/dist/cli/student-helper/print-help.mjs +1 -1
  22. package/dist/cli/student-helper/prompts.mjs +1 -1
  23. package/dist/cli/student-helper/scratch-card.mjs +1 -1
  24. package/dist/cli/student-helper/screen-utils.mjs +1 -1
  25. package/dist/cli/student-helper/snippets.mjs +1 -1
  26. package/dist/cli/student-helper/start-screen.mjs +1 -1
  27. package/dist/cli/student-helper/swerve-collect.mjs +1 -1
  28. package/dist/cli/student-helper/tap-destroy.mjs +1 -1
  29. package/dist/cli/student-helper/template-packs.mjs +1 -1
  30. package/dist/cli/student-helper.mjs +1 -1
  31. package/dist/cli/sync-screens.mjs +1 -1
  32. package/dist/cli/validate-assets.mjs +1 -1
  33. package/dist/cli/validate.mjs +1 -1
  34. package/dist/{config-HQX4AQNX.js → config-VHVTBJGB.js} +1 -1
  35. package/dist/index.cjs +48 -38
  36. package/dist/index.js +1 -1
  37. package/dist/pixi/index.cjs +1 -1
  38. package/dist/pixi/index.js +1 -1
  39. package/dist/three/index.cjs +10 -10
  40. package/dist/three/index.js +1 -1
  41. package/package.json +1 -1
  42. package/dist/chunk-FOTLNUIS.js +0 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{E as K,F as L,G as M,H as N,I as O,J as P,K as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,a}from"./chunk-EMWR536B.js";import"./chunk-NSZ7GCS3.js";import"./chunk-I5OOVR5U.js";import{a as v,b as w,c as x,d as y,e as z,f as A,g as B,h as C,i as D,j as E,k as F,l as G,m as H,n as I,o as J}from"./chunk-FOTLNUIS.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u}from"./chunk-2MR65LDX.js";import"./chunk-E6WJCS24.js";import"./chunk-JXBG6UFL.js";export{V as COLORS,G as ConfigWatcher,P as DebugPanel,F as DefaultReloadStrategy,Z as Handler,Y as PlayableLoadingScreen,Q as PreviewShell,W as STROKE_WIDTH,X as THEME,d as applyConfigOverride,e as applyConfigOverrides,s as applyConfigsToDisk,C as applyDefaults,a as baseLottie,U as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,R as createPreviewShell,o as deepClone,_ as default,M as defaultPreset,L as deviceGroups,K as devicePresets,H as diffConfigs,p as exportConfigsAsJSON,q as exportConfigsFromActiveCache,i as getConfigOverrides,r as getConfigStateSummary,b as getOverrideMode,N as getPresetById,O as getPresetsByCategory,x as loadAllObjectConfigs,v as loadComponentSchemas,y as loadEngineConfig,z as loadGamePromptConfig,D as loadObjectCentricConfig,w as loadObjectConfig,A as loadSceneConfig,l as redoLastConfigChange,I as rehydrateObject,h as removeConfigOverride,t as resetToApplied,u as resetToOriginal,T as setBootstrapDependencies,c as setOverrideMode,J as setupHotReload,S as setupLiveEditBridge,E as toLegacyFormat,m as trackObjectCreation,n as trackObjectDeletion,k as undoLastConfigChange,B as validateObjectConfig};
1
+ import{E as K,F as L,G as M,H as N,I as O,J as P,K as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,a}from"./chunk-M4ULXPTP.js";import"./chunk-NSZ7GCS3.js";import"./chunk-I5OOVR5U.js";import{a as v,b as w,c as x,d as y,e as z,f as A,g as B,h as C,i as D,j as E,k as F,l as G,m as H,n as I,o as J}from"./chunk-FL4VTM6W.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u}from"./chunk-2MR65LDX.js";import"./chunk-E6WJCS24.js";import"./chunk-JXBG6UFL.js";export{V as COLORS,G as ConfigWatcher,P as DebugPanel,F as DefaultReloadStrategy,Z as Handler,Y as PlayableLoadingScreen,Q as PreviewShell,W as STROKE_WIDTH,X as THEME,d as applyConfigOverride,e as applyConfigOverrides,s as applyConfigsToDisk,C as applyDefaults,a as baseLottie,U as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,R as createPreviewShell,o as deepClone,_ as default,M as defaultPreset,L as deviceGroups,K as devicePresets,H as diffConfigs,p as exportConfigsAsJSON,q as exportConfigsFromActiveCache,i as getConfigOverrides,r as getConfigStateSummary,b as getOverrideMode,N as getPresetById,O as getPresetsByCategory,x as loadAllObjectConfigs,v as loadComponentSchemas,y as loadEngineConfig,z as loadGamePromptConfig,D as loadObjectCentricConfig,w as loadObjectConfig,A as loadSceneConfig,l as redoLastConfigChange,I as rehydrateObject,h as removeConfigOverride,t as resetToApplied,u as resetToOriginal,T as setBootstrapDependencies,c as setOverrideMode,J as setupHotReload,S as setupLiveEditBridge,E as toLegacyFormat,m as trackObjectCreation,n as trackObjectDeletion,k as undoLastConfigChange,B as validateObjectConfig};
@@ -94,7 +94,7 @@
94
94
  <button class="asset-crop-apply primary" data-action="apply">Apply Crop</button>
95
95
  </div>
96
96
  </div>
97
- `,this.modal=e,this.attachEventListeners(),this.initializeCanvas()}initializeCanvas(){this.modal&&(this.canvas=this.modal.querySelector(".asset-crop-canvas"),this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.canvas.width=400,this.canvas.height=300))}loadImage(){this.options&&(this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=()=>{this.image&&this.image.naturalWidth>0&&this.image.naturalHeight>0?(console.log("[AssetCropModal] Image loaded:",this.image.naturalWidth,"x",this.image.naturalHeight),this.initializeCrop(),this.render()):(console.error("[AssetCropModal] Image loaded but invalid dimensions"),this.showError("Failed to load image"))},this.image.onerror=e=>{console.error("[AssetCropModal] Image load error:",e),this.showError("Failed to load image. Please check the image URL.")},this.image.src=this.options.imageSrc,this.canvas&&this.ctx&&(this.ctx.fillStyle="rgba(128, 128, 128, 0.3)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.fillStyle="rgba(255, 255, 255, 0.7)",this.ctx.font="14px sans-serif",this.ctx.textAlign="center",this.ctx.fillText("Loading image...",this.canvas.width/2,this.canvas.height/2)))}showError(e){var n;if(!this.canvas||!this.ctx)return;this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.fillStyle="rgba(255, 0, 0, 0.2)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.fillStyle="#ff4444",this.ctx.font="14px sans-serif",this.ctx.textAlign="center",this.ctx.fillText(e,this.canvas.width/2,this.canvas.height/2);let t=(n=this.modal)==null?void 0:n.querySelector(".asset-crop-preview-canvas");if(t){let a=t.getContext("2d");a&&(a.fillStyle="rgba(255, 0, 0, 0.2)",a.fillRect(0,0,t.width,t.height))}}initializeCrop(){var n;if(!this.image||!this.canvas)return;let e=this.image.width/this.image.height,t=this.canvas.width/this.canvas.height;e>t?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*t,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/t,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(n=this.options)!=null&&n.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(e){if(!this.image)return;let t=this.image.width/this.image.height,n=this.cropX+this.cropWidth/2,a=this.cropY+this.cropHeight/2;e>t?(this.cropWidth=Math.min(this.image.width,this.cropHeight*e),this.cropHeight=this.cropWidth/e):(this.cropHeight=Math.min(this.image.height,this.cropWidth/e),this.cropWidth=this.cropHeight*e),this.cropX=Math.max(0,Math.min(this.image.width-this.cropWidth,n-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,a-this.cropHeight/2))}fitToCanvas(){if(!this.image||!this.canvas)return;let e=this.canvas.width/this.cropWidth,t=this.canvas.height/this.cropHeight;this.scale=Math.min(e,t)*.9,this.panX=(this.canvas.width-this.cropWidth*this.scale)/2,this.panY=(this.canvas.height-this.cropHeight*this.scale)/2}render(){if(!(!this.ctx||!this.canvas)){if(!this.image||!this.image.complete||this.image.naturalWidth===0||this.image.naturalHeight===0){console.warn("[AssetCropModal] Image not ready for rendering"),this.showError("Image not loaded");return}this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);try{this.ctx.save(),this.ctx.translate(this.panX,this.panY),this.ctx.scale(this.scale,this.scale),this.ctx.drawImage(this.image,-this.cropX,-this.cropY,this.image.width,this.image.height),this.ctx.restore()}catch(e){console.error("[AssetCropModal] Error drawing image:",e),this.showError("Error drawing image");return}this.drawCropOverlay(),this.updatePreview()}}drawCropOverlay(){if(!this.ctx||!this.canvas)return;let e=this.panX,t=this.panY,n=this.cropWidth*this.scale,a=this.cropHeight*this.scale;this.ctx.fillStyle="rgba(0, 0, 0, 0.5)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.clearRect(e,t,n,a),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(e,t,n,a),this.ctx.fillStyle="#ffffff";let s=8;[[e,t],[e+n-s,t],[e,t+a-s],[e+n-s,t+a-s]].forEach(([o,c])=>{var l;(l=this.ctx)==null||l.fillRect(o,c,s,s)})}updatePreview(){if(!this.modal||!this.image||!this.image.complete||this.image.naturalWidth===0||this.image.naturalHeight===0)return;let e=this.modal.querySelector(".asset-crop-preview-canvas");if(!e)return;let t=e.getContext("2d");if(!t)return;let n=150;e.width=n,e.height=n,t.clearRect(0,0,n,n);let a=n/this.cropWidth,s=n/this.cropHeight,r=Math.min(a,s),o=this.cropWidth*r,c=this.cropHeight*r,l=(n-o)/2,u=(n-c)/2;try{t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,l,u,o,c)}catch(d){console.error("[AssetCropModal] Error drawing preview:",d),t.fillStyle="rgba(255, 0, 0, 0.2)",t.fillRect(0,0,n,n)}}attachEventListeners(){if(!this.modal||!this.canvas)return;this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this));let e=this.modal.querySelector(".asset-crop-zoom-slider");e==null||e.addEventListener("input",n=>{let a=parseFloat(n.target.value);this.setZoom(a)});let t=this.modal.querySelector(".asset-crop-aspect-select");t==null||t.addEventListener("change",n=>{let a=n.target.value;this.setAspectRatio(a)}),this.modal.addEventListener("click",n=>{switch(n.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",n=>{n.target===this.modal&&this.close()})}handleMouseDown(e){this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.lastPanX=this.panX,this.lastPanY=this.panY,this.canvas.style.cursor="grabbing"}handleMouseMove(e){if(!this.isDragging)return;let t=e.clientX-this.dragStartX,n=e.clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(e){e.preventDefault();let t=e.deltaY>0?.9:1.1;this.setZoom(this.scale*t)}handleTouchStart(e){e.touches.length===1&&(this.isDragging=!0,this.dragStartX=e.touches[0].clientX,this.dragStartY=e.touches[0].clientY,this.lastPanX=this.panX,this.lastPanY=this.panY)}handleTouchMove(e){if(!this.isDragging||e.touches.length!==1)return;e.preventDefault();let t=e.touches[0].clientX-this.dragStartX,n=e.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleTouchEnd(){this.isDragging=!1}setZoom(e){this.scale=Math.max(.1,Math.min(3,e)),this.updateZoomUI(),this.constrainPan(),this.render()}setAspectRatio(e){let t;switch(e){case"1:1":t=1;break;case"4:3":t=4/3;break;case"16:9":t=16/9;break;case"3:2":t=3/2;break;default:t=void 0}t&&this.applyAspectRatio(t),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let e=this.modal.querySelector(".asset-crop-zoom-value"),t=this.modal.querySelector(".asset-crop-zoom-slider");e&&(e.textContent=`${this.scale.toFixed(1)}x`),t&&(t.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let e=this.cropWidth*this.scale,t=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-e,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-t,Math.min(0,this.panY))}reset(){this.initializeCrop(),this.render()}applyCrop(){var a;if(!this.image||!((a=this.options)!=null&&a.onCrop))return;let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;e.width=this.cropWidth,e.height=this.cropHeight,t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let n=e.toDataURL("image/png");this.options.onCrop(n),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal);let e=this.options;this.modal=null,this.canvas=null,this.ctx=null,this.image=null,this.options=null,e!=null&&e.onCancel&&e.onCancel()}};window.openAssetCrop=function(i){new Pi().open(i)}});var fr={};mn(fr,{AssetCache:()=>re,AssetLoader:()=>ke,AssetSystem:()=>li,AssetTextures:()=>Pe,Assets:()=>Fa,BaseSystem:()=>rt,GameEngine:()=>oi,GameObject:()=>Ot,GameObjectManager:()=>at,ObjectFactory:()=>ye,Renderer:()=>_t,RuntimeObjectRegistry:()=>ot,Transform:()=>jt,applyScreenAnchor:()=>Ft,basePixi:()=>$a,clearResponsiveElements:()=>ia,createPixiBase:()=>si,getRegisteredFontIds:()=>_a,globalResponsiveMultipliers:()=>St,initAssetTextures:()=>Zt,initAssets:()=>Ba,layout:()=>aa,playLottieOverlay:()=>Ra,registerFont:()=>ja,registerType:()=>Xt,resolveAnchorVec2:()=>Te,resolveFont:()=>Pa,resolveFontWeight:()=>Ma,resolveScreenAnchorPoint:()=>De,resolveScreenRatioPoint:()=>Ne,runInitSequence:()=>Ga,setLottieInstance:()=>Qt,spawnSceneFromConfig:()=>Na,updateScreenState:()=>Ht});module.exports=Ka(fr);var ka=require("pixi.js");var Le={};function zt(i,e,t=!1){Le[i]||(Le[i]=[]),Le[i].push({fn:e,once:t})}function di(i,e){if(Le[i]){if(!e){delete Le[i];return}Le[i]=Le[i].filter(t=>t.fn!==e)}}function $t(i,...e){let t=Le[i];if(t)for(let n of[...t])n.fn(...e),n.once&&di(i,n.fn)}function ee(i,e){zt(i,e,!0)}var $=null,ae=[],Ye=null;function wn(i){$=i,ae=[],Ye!==null&&(clearTimeout(Ye),Ye=null)}function xn(){var i,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(i=$==null?void 0:$.batchSize)!=null?i:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function yn(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function pi(i,e){let t=xn();if(e&&t.endpoint){if(ae.push(i),ae.length>t.maxQueue&&(ae=ae.slice(ae.length-t.maxQueue)),ae.length>=t.batchSize){vn();return}Ye===null&&(Ye=window.setTimeout(()=>{Ye=null,vn()},t.flushIntervalMs))}}async function vn(){let i=xn();if(!i.endpoint||ae.length===0)return;let e=ae.splice(0,i.batchSize);await yn(i.endpoint,{events:e},i.transport,i.debug),ae.length>0&&await yn(i.endpoint,{events:ae.splice(0,i.batchSize)},i.transport,i.debug)}function Sn(i){return Math.max(0,Math.min(1,i))}function Xa(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 wt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ja(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function En(i,e,t){try{i[e]=t}catch{}}function Za(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 Cn(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 An(i,e){let t=Za(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 Ln(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=u=>{var p;i.add(u);let d=(p=e.get(u.target))!=null?p:new Set;d.add(u),e.set(u.target,d),n()},s=u=>{i.delete(u);let d=e.get(u.target);d&&(d.delete(u),d.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var d,p;let u=wt();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let h=u-g.startMs-g.delayMs;if(h<0)continue;let m=g.durationMs>0?h/g.durationMs:1,C=Sn(m),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(m),b-1):0;if(g.repeat>0&&m>=1){let x=m-f;C=Sn(x)}let y=g.ease(C);g.yoyo&&f%2===1&&(y=1-y);for(let x of g.props)En(g.target,x.key,x.from+(x.to-x.from)*y);g.scaleFrom&&g.scaleTo&&Cn(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*y,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*y});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(m>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},c=(u,d,p)=>{var x;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),h=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),m=Xa(d.ease),C=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),y=[];for(let k of Object.keys(d)){if(f.has(k))continue;let L=d[k];typeof L=="number"&&y.push({key:k,from:Ja(u,k),to:L})}let w=An(u,d);return{target:u,startMs:wt(),delayMs:h,durationMs:g,ease:m,props:y,scaleFrom:w.from,scaleTo:w.to,repeat:C,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}},l={to(u,d){let p=c(u,d);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=wt())},resume:()=>{var m;if(!p.paused)return;let g=(m=p.pauseAtMs)!=null?m:wt(),h=wt()-g;p.startMs+=h,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,d,p){return l.set(u,d),l.to(u,p)},set(u,d){if(!u||!d)return;for(let g of Object.keys(d)){let h=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&En(u,g,h)}let p=An(u,d);p.to&&Cn(u,p.to)},killTweensOf(u){let d=e.get(u);if(d)for(let p of Array.from(d))r(p)},timeline(u={}){let d=[],p=0,g=!1,h=[],m=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let y=typeof f=="string"?f.trim():"";return y.startsWith("+=")?p+Math.max(0,Number(y.slice(2))*1e3||0):y?Math.max(0,Number(y)*1e3||0):p},C=f=>{d.push(f);let y=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+y)},b={to(f,y,w){return C({kind:"to",target:f,vars:y,atMs:m(w)}),b},fromTo(f,y,w,x){return C({kind:"fromTo",target:f,vars:w,from:y,atMs:m(x)}),b},play(){var f,y;if(g)return b;g=!0,h=[];for(let w of d)w.kind==="fromTo"&&l.set(w.target,(f=w.from)!=null?f:{}),h.push(l.to(w.target,{...w.vars,delay:w.atMs/1e3+((y=w.vars.delay)!=null?y:0)}));return b},pause(){for(let f of h)f.pause();return b},kill(){for(let f of h)f.kill();h=[],g=!1}};return u.paused||b.play(),b}};return l}function Tn(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Ln()}catch{}}var In={name:"handler-playable-sdk",version:"1.0.102",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 --external jszip && 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/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.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 --external jszip && 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 dist/cli/student-helper/*.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 te=0,es=te++,kn=te++,Pn=te++,Mn=te++,jn=te++,_n=te++,On=te++,Rn=te++,zn=te++,$n=te++,Dn=te++,Nn=te++,j=es;function Hn(){return j===kn}function Fn(){return j===Pn}function Bn(){return j===Mn}function Gn(){return j===jn}function We(){return j===_n}function Ke(){return j===On}function Un(){return j===Rn}function qn(){return j===zn}function Vn(){return j===$n}function ui(){return j===Dn}function gi(){return j===Nn}function Yn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),j=kn;return}catch{}else if(i==="dapi")try{dapi.isReady(),j=Pn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=Mn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=jn)}catch{}else if(e==="mintegral")window.gameReady&&(j=_n);else if(e==="tapjoy")window.TJ_API&&(j=On);else if(e==="tiktok")window.openAppStore&&(j=Rn);else if(e==="smadex")try{window.smxTracking&&(j=zn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=$n)}catch{}else e==="vungle"?j=Dn:(i==="nucleo"||e==="nucleo")&&(j=Nn)}var Dt=ci(require("lottie-web"),1),Wn=Dt.default;typeof window!="undefined"&&(window.lottie=Dt.default,window.__baseLottie=Dt.default);mi();function D(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var Wr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:D(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:D(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:D(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:D(360,780)}],Kr=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:D(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:D(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:D(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:D(412,915)}],Xr=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:D(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:D(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:D(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:D(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:D(800,1280)}],Zn=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:D(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:D(768,1024),mraidScale:.7}];var Jr=[...Zn];var ls=Zn[0];de();var ta=require("pixi.js"),fe={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},Bt=[];function ds(i,e,t,n,a,s,r){Bt.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function ps(){Bt.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*fe.scaleFactor;t(i,fe.width,fe.height,n,a,!0,!1)})}function ia(){Bt.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function Ht(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),fe.width=i,fe.height=e,fe.scaleFactor=Math.min(i/fe.designWidth,1.15),St.scale=fe.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),ps()}var _={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 us(i,e,t){let n=_[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function gs(){return _}var hs={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 Nt(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Te(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Nt(i[0],e.x),y:Nt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Nt(n.x,e.x),y:Nt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=hs[n])!=null?t:e}return e}function De(i,e,t,n={}){var g,h,m,C,b,f;let a=Te(t),s=(g=n.inset)!=null?g:{},r=(h=n.padding)!=null?h:{x:0,y:0},o=((m=s.left)!=null?m:0)+r.x,c=((C=s.right)!=null?C:0)+r.x,l=((b=s.top)!=null?b:0)+r.y,u=((f=s.bottom)!=null?f:0)+r.y,d=Math.max(0,i-o-c),p=Math.max(0,e-l-u);return{x:o+d*a.x,y:l+p*a.y}}function Ne(i,e,t,n={}){var m,C,b,f,y,w;let a=(m=n.inset)!=null?m:{},s=(C=n.padding)!=null?C:{x:0,y:0},r=((b=a.left)!=null?b:0)+s.x,o=((f=a.right)!=null?f:0)+s.x,c=((y=a.top)!=null?y:0)+s.y,l=((w=a.bottom)!=null?w:0)+s.y,u=Math.max(0,i-r-o),d=Math.max(0,e-c-l),p=Te(t,{x:.5,y:.5}),g=Math.min(Math.max(p.x,0),1),h=Math.min(Math.max(p.y,0),1);return{x:r+u*g,y:c+d*h}}function Ft(i,e,t,n={}){var u,d,p;if(!i)return;let a=n.positionRatio?Ne(e,t,n.positionRatio,{inset:n.inset,padding:n.screenPadding}):De(e,t,n.anchor,{inset:n.inset,padding:n.screenPadding}),s=(u=n.offset)!=null?u:{x:0,y:0},r=a.x+s.x,o=a.y+s.y;i.anchor&&n.renderAnchor&&i.anchor.set(n.renderAnchor.x,n.renderAnchor.y),se(i,r,o);let c=(d=n.scale)!=null?d:1,l=(p=n.scaleMultiplier)!=null?p:1;(n.scale!==void 0||n.scaleMultiplier!==void 0)&&pe(i,c*l)}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,Ht(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),Ht(window.innerWidth,window.innerHeight),window.updateDebugConfig=us,window.getDebugConfig=gs,window.copyConfig=As,window.applyConfig=xt,window.applyConfigForRatio=Ls,window.positionAtBottom=na,window.positionAtTop=bs,window.positionAtCenter=ys,window.positionAtLeft=vs,window.positionAtRight=ws,window.positionAtBottomLeft=xs,window.positionAtBottomRight=Ss,window.positionAtTopLeft=Es,window.positionAtTopRight=Cs,window.applyPositionContract=ms,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 Gt(i,e,t=0){return i*e+t}function Ut(i,e,t=0){return i*(1-e)+t}function qt(i,e,t=0){return i*e+t}function Vt(i,e,t=0){return i*(1-e)+t}function ie(i,e=0){return i/2+e}function fs(i,e){return i*e}function ms(i,e,t,n){var r,o,c,l,u,d,p,g,h,m,C,b,f,y,w,x,k,L,B,R;let a=0,s=0;switch(n.type){case"top":a=ie(e,(o=(r=n.offset)==null?void 0:r.x)!=null?o:0),s=Gt(t,n.percent,(l=(c=n.offset)==null?void 0:c.y)!=null?l:0);break;case"bottom":a=ie(e,(d=(u=n.offset)==null?void 0:u.x)!=null?d:0),s=Ut(t,n.percent,(g=(p=n.offset)==null?void 0:p.y)!=null?g:0);break;case"left":a=qt(e,n.percent,(m=(h=n.offset)==null?void 0:h.x)!=null?m:0),s=ie(t,(b=(C=n.offset)==null?void 0:C.y)!=null?b:0);break;case"right":a=Vt(e,n.percent,(y=(f=n.offset)==null?void 0:f.x)!=null?y:0),s=ie(t,(x=(w=n.offset)==null?void 0:w.y)!=null?x:0);break;case"center":a=ie(e,(L=(k=n.offset)==null?void 0:k.x)!=null?L:0),s=ie(t,(R=(B=n.offset)==null?void 0:B.y)!=null?R:0);break}i.position?i.position.set(a,s):(i.x=a,i.y=s),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function na(i,e,t,n=.2,a=1,s=!0,r=!1){let o=fs(t,n),c=Ut(t,n/2);se(i,ie(e),c);let l=s?a*fe.scaleFactor:a;pe(i,l),r&&!Bt.find(u=>u.element===i)&&ds(i,na,e,t,n,a,s)}function bs(i,e,t,n=.1,a=1){se(i,ie(e),Gt(t,n)),pe(i,a)}function ys(i,e,t,n=0,a=0,s=1){se(i,ie(e,n),ie(t,a)),pe(i,s)}function vs(i,e,t,n=.1,a=1){se(i,qt(e,n),ie(t)),pe(i,a)}function ws(i,e,t,n=.1,a=1){se(i,Vt(e,n),ie(t)),pe(i,a)}function xs(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Ut(t,n)),pe(i,s)}function Ss(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Ut(t,n)),pe(i,s)}function Es(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Gt(t,n)),pe(i,s)}function Cs(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Gt(t,n)),pe(i,s)}function se(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function pe(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.scale.y=e))}var $e={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 As(i){return i&&$e[i]?JSON.parse(JSON.stringify($e[i])):JSON.parse(JSON.stringify(_))}function xt(i){Object.keys(i).forEach(e=>{let t=e;_[t]&&i[t]&&Object.assign(_[t],i[t])}),console.log("Config applied:",i)}function Ls(i,e){let t=i/e;t>1.6?(xt($e.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(xt($e.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(xt($e.square),console.log("Applied SQUARE config for ratio:",t)):(xt($e.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let i=window;i.configPresets=$e,i.resolveAnchorVec2=i.resolveAnchorVec2||Te,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||De,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||Ne}var K=null,ea=new Map;function aa(i,e,t,n,a,s={}){var Se,Ee,Ce,Ae,Y,_e,lt,ct,dt,pt,ut,gt,ht,ft,mt,bt,F,Z,U,Q,Ue,Oe,Bi,Gi,Ui,qi,Vi,Yi,Wi,Ki,Xi,Ji,Zi,Qi,en,tn,nn,an,sn,rn,on,ln,cn,dn,pn,un,gn,hn,fn;let r=(Se=s.enableDebugLogs)!=null?Se:!1;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:n.width,height:n.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Time:",t),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Options:",s));let{mainContainer:o,label:c,background:l,backgroundTexture:u,app:d}=i;if(!d||!d.renderer){r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] \u274C No app or renderer, skipping layout");return}r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] App renderer dimensions:",{width:d.renderer.width,height:d.renderer.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] App screen dimensions:",{width:d.screen.width,height:d.screen.height}));let p=n.width,g=n.height;r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:p,baseHeight:g});let h=p*_.layout.screen_scale_x,m=g*_.layout.screen_scale_y,C=p/2,b=e.engine.runtime||{},f=b.layout||{};r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug config:",{screen_scale_x:_.layout.screen_scale_x,screen_scale_y:_.layout.screen_scale_y}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Calculated dimensions:",{width:h,height:m,midX:C}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",f));let y=m>h,w=(Ee=f.design_width_portrait)!=null?Ee:y?400:600,x=(Ce=f.design_height_portrait)!=null?Ce:y?600:400,k=Math.min(h/w,m/x);k=Math.min(k,1.15);let L=k*((Ae=_.engine.scale)!=null?Ae:1),B=(Y=s.skipMainContainerTransform)!=null?Y:!1;!B&&o&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(L):(o.scale.x=L,o.scale.y=L));let R=(_e=f.main_container_anchor)!=null?_e:"center",H=(lt=f.main_container_position_ratio)!=null?lt:{x:.5,y:.5},z=(ct=f.main_container_offset)!=null?ct:{x:0,y:0},T=f.main_container_position_ratio?Ne(p,g,H):De(p,g,R),E=T.x+z.x+_.layout.position_offset.x,S=T.y+z.y+_.layout.position_offset.y;if(!B&&o&&o.position&&(typeof o.position.set=="function"?o.position.set(E,S):(o.position.x=E,o.position.y=S)),a&&(o!=null&&o.toLocal)){let G=g>p,W=(dt=f.design_width_portrait)!=null?dt:G?320:480,N=(pt=f.design_height_portrait)!=null?pt:G?480:320;for(let[oe,le]of e.objects.entries()){let q=le==null?void 0:le.transform;if(!q||((ut=q.position_mode)!=null?ut:"static")!=="static")continue;let I=(gt=a.get)==null?void 0:gt.call(a,oe),yt=((ht=I==null?void 0:I.getDisplayObject)==null?void 0:ht.call(I))||(I==null?void 0:I.pixiObject)||I;if(!yt||yt.parent!==o)continue;let he=(ft=q.anchor)!=null?ft:"bottom-left";he==="bottom-left"&&q.anchor==null&&console.log("[DEBUG FALLBACK] LayoutManager transform.anchor \u2192 bottom-left");let qe=q.position_ratio!=null?Ne(W,N,q.position_ratio):De(W,N,he),Ve=(mt=q.position)!=null?mt:{x:0,y:0},vt=qe.x-W/2+Ve.x,Re=qe.y-N/2+Ve.y;typeof(I==null?void 0:I.setPosition)=="function"?I.setPosition(vt,Re):(se(yt,vt,Re),(bt=I==null?void 0:I.transform)!=null&&bt.position&&(I.transform.position.x=vt,I.transform.position.y=Re))}}let A=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,J=((A==null?void 0:A.buildMode)||(typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"dev"))==="dev";if(_.layout.debug_rect_visible&&J){(!K||K.parent!==d.stage)&&(K==null||K.destroy(),K=new ta.Graphics,K.zIndex=9999,d.stage.addChild(K)),K.clear();let G=_.layout.debug_rect_scale_x,W=_.layout.debug_rect_scale_y,N=(p-4)*G,oe=(g-4)*W,le=(p-N)/2,q=(g-oe)/2;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== DEBUG RECT POSITIONING ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect calculations:",{baseWidth:p,baseHeight:g,rectW:N,rectH:oe,offsetX:le,offsetY:q}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect final position:",{x:2+le,y:2+q,width:N,height:oe})),K.rect(2+le,2+q,N,oe).stroke({width:_.layout.debug_rect_thickness,color:_.layout.debug_rect_color})}else K&&(K.destroy(),K=null);let O=((F=i.label)==null?void 0:F.config)||e.objects.get("label_1")||e.objects.get("ui_tutorial_1");if(c&&c.position&&O){let G=(U=(Z=O==null?void 0:O.transform)==null?void 0:Z.anchor)!=null?U:"center",W=(Q=O==null?void 0:O.transform)==null?void 0:Q.position_ratio,N=((Ue=O==null?void 0:O.transform)==null?void 0:Ue.offset)||{x:0,y:0};Ft(c,p,g,{anchor:G,positionRatio:W,offset:{x:N.x*L,y:N.y*L},renderAnchor:Te(G)})}if(c&&c.alpha>0){let G=1+Math.sin(t*_.engine.label_pulse_speed)*_.engine.label_pulse_intensity,W=(Bi=(Oe=O==null?void 0:O.transform)==null?void 0:Oe.scale)!=null?Bi:1,N=G*L*W;c.scale&&(typeof c.scale.set=="function"?c.scale.set(N):(c.scale.x=N,c.scale.y=N))}r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== BACKGROUND POSITIONING =====");let ne=l?e.objects.get("background_1"):null,je=!!ne&&(l==null?void 0:l.parent)===o;if(l&&!je){r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background object exists:",!!l),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background type:",(Gi=l.constructor)==null?void 0:Gi.name)),l.alpha=((qi=(Ui=b.background)==null?void 0:Ui.alpha)!=null?qi:.98)*_.engine.background_alpha,r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background alpha set to:",l.alpha),r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background config:",ne);let G=(ne==null?void 0:ne.transform)||{};r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",G);let W=G.offset||{x:0,y:0},N=((Yi=(Vi=b.background)==null?void 0:Vi.offset_y)!=null?Yi:0)+_.engine.background_offset_y,oe=(Wi=G.anchor)!=null?Wi:"center",le=G.position_ratio;if(r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background positioning params:",{bgOffset:W,bgRuntimeOffsetY:N,bgScreenAnchor:oe,bgPositionRatio:le,baseWidth:p,baseHeight:g,finalScale:L}),Ft(l,p,g,{anchor:oe,positionRatio:le,offset:{x:W.x*L,y:W.y*L+N},renderAnchor:Te(oe)}),r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:l.x,y:l.y,scaleX:(Ki=l.scale)==null?void 0:Ki.x,scaleY:(Xi=l.scale)==null?void 0:Xi.y,anchorX:(Ji=l.anchor)==null?void 0:Ji.x,anchorY:(Zi=l.anchor)==null?void 0:Zi.y,pivotX:(Qi=l.pivot)==null?void 0:Qi.x,pivotY:(en=l.pivot)==null?void 0:en.y,width:l.width,height:l.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background texture dimensions:",{textureWidth:u==null?void 0:u.width,textureHeight:u==null?void 0:u.height})),u){let qe=Math.max(h/u.width,m/u.height),Ve=(nn=(tn=b.background)==null?void 0:tn.scale_multiplier)!=null?nn:1.05,vt=(an=G.scale)!=null?an:1,Re=qe*Ve*_.engine.background_scale*vt;l.scale&&(typeof l.scale.set=="function"?l.scale.set(Re):(l.scale.x=Re,l.scale.y=Re))}else l&&typeof l.clear=="function"&&(l.clear(),l.rect(-h/2,-m/2,h,m).fill({color:1444375}));let q=`${p}x${g}`,P=ea.get(q),I={x:Number((sn=l.x)!=null?sn:0),y:Number((rn=l.y)!=null?rn:0),scaleX:Number((ln=(on=l.scale)==null?void 0:on.x)!=null?ln:1),scaleY:Number((dn=(cn=l.scale)==null?void 0:cn.y)!=null?dn:1),rotation:Number.isFinite(l.rotation)?l.rotation:void 0,anchorX:Number.isFinite((pn=l.anchor)==null?void 0:pn.x)?l.anchor.x:void 0,anchorY:Number.isFinite((un=l.anchor)==null?void 0:un.y)?l.anchor.y:void 0,pivotX:Number.isFinite((gn=l.pivot)==null?void 0:gn.x)?l.pivot.x:void 0,pivotY:Number.isFinite((hn=l.pivot)==null?void 0:hn.y)?l.pivot.y:void 0},yt=Number.isFinite(I.x)&&Number.isFinite(I.y)&&Number.isFinite(I.scaleX)&&Number.isFinite(I.scaleY),he=I;if(P){let qe=Math.hypot(I.x-P.x,I.y-P.y),Ve=Math.max(p,g)*.5;(!yt||qe>Ve)&&((fn=l.position)!=null&&fn.set?l.position.set(P.x,P.y):(l.x=P.x,l.y=P.y),l.scale&&(typeof l.scale.set=="function"?l.scale.set(P.scaleX,P.scaleY):(l.scale.x=P.scaleX,l.scale.y=P.scaleY)),Number.isFinite(P.rotation)&&typeof l.rotation=="number"&&(l.rotation=P.rotation),l.anchor&&Number.isFinite(P.anchorX)&&Number.isFinite(P.anchorY)&&l.anchor.set(P.anchorX,P.anchorY),l.pivot&&Number.isFinite(P.pivotX)&&Number.isFinite(P.pivotY)&&l.pivot.set(P.pivotX,P.pivotY),he=P)}Number.isFinite(he.x)&&Number.isFinite(he.y)&&Number.isFinite(he.scaleX)&&Number.isFinite(he.scaleY)&&ea.set(q,he)}}function Ts(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 Is(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 ks(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 yi(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 s=await Ts(a),r=await ks(s),o=Is(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Yt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((d,p)=>{let g=new Image;g.onload=()=>d(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 s=a.getImageData(0,0,n.width,n.height),r=s.data,c=[{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(d=>({r:r[d.offset],g:r[d.offset+1],b:r[d.offset+2]})),l=0;for(let d=0;d<r.length;d+=4){let p=r[d],g=r[d+1],h=r[d+2],m=!1;for(let C of c)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(h-C.b,2))<e){m=!0;break}m&&(r[d+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var sa=require("@google/genai");async function vi(i,e,t=[],n={}){var a,s,r,o,c,l,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 f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let d=new sa.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let h=await d.models.generateContent({model:p,contents:g}),m="",C=(r=(s=(a=h.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(C)for(let b of C)b.text&&(m+=b.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(d){throw console.error("[Gemini] API error:",d),(o=d.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(c=d.message)!=null&&c.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=d.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=d.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):d}}var ra=require("@google/genai");async function Wt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ra.GoogleGenAI({apiKey:i}),s=[{text:e}];t.length>0&&t.forEach((o,c)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${c}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let c=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${c}`}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 Rs=require("pixi.js");Et();Kt();de();var ua=require("pixi.js");var $s=require("pixi.js");de();function Ws(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 Ks(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 Xs(i){return`
97
+ `,this.modal=e,this.attachEventListeners(),this.initializeCanvas()}initializeCanvas(){this.modal&&(this.canvas=this.modal.querySelector(".asset-crop-canvas"),this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.canvas.width=400,this.canvas.height=300))}loadImage(){this.options&&(this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=()=>{this.image&&this.image.naturalWidth>0&&this.image.naturalHeight>0?(console.log("[AssetCropModal] Image loaded:",this.image.naturalWidth,"x",this.image.naturalHeight),this.initializeCrop(),this.render()):(console.error("[AssetCropModal] Image loaded but invalid dimensions"),this.showError("Failed to load image"))},this.image.onerror=e=>{console.error("[AssetCropModal] Image load error:",e),this.showError("Failed to load image. Please check the image URL.")},this.image.src=this.options.imageSrc,this.canvas&&this.ctx&&(this.ctx.fillStyle="rgba(128, 128, 128, 0.3)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.fillStyle="rgba(255, 255, 255, 0.7)",this.ctx.font="14px sans-serif",this.ctx.textAlign="center",this.ctx.fillText("Loading image...",this.canvas.width/2,this.canvas.height/2)))}showError(e){var n;if(!this.canvas||!this.ctx)return;this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.fillStyle="rgba(255, 0, 0, 0.2)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.fillStyle="#ff4444",this.ctx.font="14px sans-serif",this.ctx.textAlign="center",this.ctx.fillText(e,this.canvas.width/2,this.canvas.height/2);let t=(n=this.modal)==null?void 0:n.querySelector(".asset-crop-preview-canvas");if(t){let a=t.getContext("2d");a&&(a.fillStyle="rgba(255, 0, 0, 0.2)",a.fillRect(0,0,t.width,t.height))}}initializeCrop(){var n;if(!this.image||!this.canvas)return;let e=this.image.width/this.image.height,t=this.canvas.width/this.canvas.height;e>t?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*t,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/t,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(n=this.options)!=null&&n.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(e){if(!this.image)return;let t=this.image.width/this.image.height,n=this.cropX+this.cropWidth/2,a=this.cropY+this.cropHeight/2;e>t?(this.cropWidth=Math.min(this.image.width,this.cropHeight*e),this.cropHeight=this.cropWidth/e):(this.cropHeight=Math.min(this.image.height,this.cropWidth/e),this.cropWidth=this.cropHeight*e),this.cropX=Math.max(0,Math.min(this.image.width-this.cropWidth,n-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,a-this.cropHeight/2))}fitToCanvas(){if(!this.image||!this.canvas)return;let e=this.canvas.width/this.cropWidth,t=this.canvas.height/this.cropHeight;this.scale=Math.min(e,t)*.9,this.panX=(this.canvas.width-this.cropWidth*this.scale)/2,this.panY=(this.canvas.height-this.cropHeight*this.scale)/2}render(){if(!(!this.ctx||!this.canvas)){if(!this.image||!this.image.complete||this.image.naturalWidth===0||this.image.naturalHeight===0){console.warn("[AssetCropModal] Image not ready for rendering"),this.showError("Image not loaded");return}this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);try{this.ctx.save(),this.ctx.translate(this.panX,this.panY),this.ctx.scale(this.scale,this.scale),this.ctx.drawImage(this.image,-this.cropX,-this.cropY,this.image.width,this.image.height),this.ctx.restore()}catch(e){console.error("[AssetCropModal] Error drawing image:",e),this.showError("Error drawing image");return}this.drawCropOverlay(),this.updatePreview()}}drawCropOverlay(){if(!this.ctx||!this.canvas)return;let e=this.panX,t=this.panY,n=this.cropWidth*this.scale,a=this.cropHeight*this.scale;this.ctx.fillStyle="rgba(0, 0, 0, 0.5)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.clearRect(e,t,n,a),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(e,t,n,a),this.ctx.fillStyle="#ffffff";let s=8;[[e,t],[e+n-s,t],[e,t+a-s],[e+n-s,t+a-s]].forEach(([o,c])=>{var l;(l=this.ctx)==null||l.fillRect(o,c,s,s)})}updatePreview(){if(!this.modal||!this.image||!this.image.complete||this.image.naturalWidth===0||this.image.naturalHeight===0)return;let e=this.modal.querySelector(".asset-crop-preview-canvas");if(!e)return;let t=e.getContext("2d");if(!t)return;let n=150;e.width=n,e.height=n,t.clearRect(0,0,n,n);let a=n/this.cropWidth,s=n/this.cropHeight,r=Math.min(a,s),o=this.cropWidth*r,c=this.cropHeight*r,l=(n-o)/2,u=(n-c)/2;try{t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,l,u,o,c)}catch(d){console.error("[AssetCropModal] Error drawing preview:",d),t.fillStyle="rgba(255, 0, 0, 0.2)",t.fillRect(0,0,n,n)}}attachEventListeners(){if(!this.modal||!this.canvas)return;this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this));let e=this.modal.querySelector(".asset-crop-zoom-slider");e==null||e.addEventListener("input",n=>{let a=parseFloat(n.target.value);this.setZoom(a)});let t=this.modal.querySelector(".asset-crop-aspect-select");t==null||t.addEventListener("change",n=>{let a=n.target.value;this.setAspectRatio(a)}),this.modal.addEventListener("click",n=>{switch(n.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",n=>{n.target===this.modal&&this.close()})}handleMouseDown(e){this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.lastPanX=this.panX,this.lastPanY=this.panY,this.canvas.style.cursor="grabbing"}handleMouseMove(e){if(!this.isDragging)return;let t=e.clientX-this.dragStartX,n=e.clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(e){e.preventDefault();let t=e.deltaY>0?.9:1.1;this.setZoom(this.scale*t)}handleTouchStart(e){e.touches.length===1&&(this.isDragging=!0,this.dragStartX=e.touches[0].clientX,this.dragStartY=e.touches[0].clientY,this.lastPanX=this.panX,this.lastPanY=this.panY)}handleTouchMove(e){if(!this.isDragging||e.touches.length!==1)return;e.preventDefault();let t=e.touches[0].clientX-this.dragStartX,n=e.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleTouchEnd(){this.isDragging=!1}setZoom(e){this.scale=Math.max(.1,Math.min(3,e)),this.updateZoomUI(),this.constrainPan(),this.render()}setAspectRatio(e){let t;switch(e){case"1:1":t=1;break;case"4:3":t=4/3;break;case"16:9":t=16/9;break;case"3:2":t=3/2;break;default:t=void 0}t&&this.applyAspectRatio(t),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let e=this.modal.querySelector(".asset-crop-zoom-value"),t=this.modal.querySelector(".asset-crop-zoom-slider");e&&(e.textContent=`${this.scale.toFixed(1)}x`),t&&(t.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let e=this.cropWidth*this.scale,t=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-e,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-t,Math.min(0,this.panY))}reset(){this.initializeCrop(),this.render()}applyCrop(){var a;if(!this.image||!((a=this.options)!=null&&a.onCrop))return;let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;e.width=this.cropWidth,e.height=this.cropHeight,t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let n=e.toDataURL("image/png");this.options.onCrop(n),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal);let e=this.options;this.modal=null,this.canvas=null,this.ctx=null,this.image=null,this.options=null,e!=null&&e.onCancel&&e.onCancel()}};window.openAssetCrop=function(i){new Pi().open(i)}});var fr={};mn(fr,{AssetCache:()=>re,AssetLoader:()=>ke,AssetSystem:()=>li,AssetTextures:()=>Pe,Assets:()=>Fa,BaseSystem:()=>rt,GameEngine:()=>oi,GameObject:()=>Ot,GameObjectManager:()=>at,ObjectFactory:()=>ye,Renderer:()=>_t,RuntimeObjectRegistry:()=>ot,Transform:()=>jt,applyScreenAnchor:()=>Ft,basePixi:()=>$a,clearResponsiveElements:()=>ia,createPixiBase:()=>si,getRegisteredFontIds:()=>_a,globalResponsiveMultipliers:()=>St,initAssetTextures:()=>Zt,initAssets:()=>Ba,layout:()=>aa,playLottieOverlay:()=>Ra,registerFont:()=>ja,registerType:()=>Xt,resolveAnchorVec2:()=>Te,resolveFont:()=>Pa,resolveFontWeight:()=>Ma,resolveScreenAnchorPoint:()=>De,resolveScreenRatioPoint:()=>Ne,runInitSequence:()=>Ga,setLottieInstance:()=>Qt,spawnSceneFromConfig:()=>Na,updateScreenState:()=>Ht});module.exports=Ka(fr);var ka=require("pixi.js");var Le={};function zt(i,e,t=!1){Le[i]||(Le[i]=[]),Le[i].push({fn:e,once:t})}function di(i,e){if(Le[i]){if(!e){delete Le[i];return}Le[i]=Le[i].filter(t=>t.fn!==e)}}function $t(i,...e){let t=Le[i];if(t)for(let n of[...t])n.fn(...e),n.once&&di(i,n.fn)}function ee(i,e){zt(i,e,!0)}var $=null,ae=[],Ye=null;function wn(i){$=i,ae=[],Ye!==null&&(clearTimeout(Ye),Ye=null)}function xn(){var i,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(i=$==null?void 0:$.batchSize)!=null?i:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function yn(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function pi(i,e){let t=xn();if(e&&t.endpoint){if(ae.push(i),ae.length>t.maxQueue&&(ae=ae.slice(ae.length-t.maxQueue)),ae.length>=t.batchSize){vn();return}Ye===null&&(Ye=window.setTimeout(()=>{Ye=null,vn()},t.flushIntervalMs))}}async function vn(){let i=xn();if(!i.endpoint||ae.length===0)return;let e=ae.splice(0,i.batchSize);await yn(i.endpoint,{events:e},i.transport,i.debug),ae.length>0&&await yn(i.endpoint,{events:ae.splice(0,i.batchSize)},i.transport,i.debug)}function Sn(i){return Math.max(0,Math.min(1,i))}function Xa(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 wt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ja(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function En(i,e,t){try{i[e]=t}catch{}}function Za(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 Cn(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 An(i,e){let t=Za(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 Ln(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=u=>{var p;i.add(u);let d=(p=e.get(u.target))!=null?p:new Set;d.add(u),e.set(u.target,d),n()},s=u=>{i.delete(u);let d=e.get(u.target);d&&(d.delete(u),d.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var d,p;let u=wt();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let h=u-g.startMs-g.delayMs;if(h<0)continue;let m=g.durationMs>0?h/g.durationMs:1,C=Sn(m),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(m),b-1):0;if(g.repeat>0&&m>=1){let x=m-f;C=Sn(x)}let y=g.ease(C);g.yoyo&&f%2===1&&(y=1-y);for(let x of g.props)En(g.target,x.key,x.from+(x.to-x.from)*y);g.scaleFrom&&g.scaleTo&&Cn(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*y,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*y});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(m>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},c=(u,d,p)=>{var x;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),h=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),m=Xa(d.ease),C=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),y=[];for(let k of Object.keys(d)){if(f.has(k))continue;let L=d[k];typeof L=="number"&&y.push({key:k,from:Ja(u,k),to:L})}let w=An(u,d);return{target:u,startMs:wt(),delayMs:h,durationMs:g,ease:m,props:y,scaleFrom:w.from,scaleTo:w.to,repeat:C,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}},l={to(u,d){let p=c(u,d);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=wt())},resume:()=>{var m;if(!p.paused)return;let g=(m=p.pauseAtMs)!=null?m:wt(),h=wt()-g;p.startMs+=h,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,d,p){return l.set(u,d),l.to(u,p)},set(u,d){if(!u||!d)return;for(let g of Object.keys(d)){let h=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&En(u,g,h)}let p=An(u,d);p.to&&Cn(u,p.to)},killTweensOf(u){let d=e.get(u);if(d)for(let p of Array.from(d))r(p)},timeline(u={}){let d=[],p=0,g=!1,h=[],m=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let y=typeof f=="string"?f.trim():"";return y.startsWith("+=")?p+Math.max(0,Number(y.slice(2))*1e3||0):y?Math.max(0,Number(y)*1e3||0):p},C=f=>{d.push(f);let y=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+y)},b={to(f,y,w){return C({kind:"to",target:f,vars:y,atMs:m(w)}),b},fromTo(f,y,w,x){return C({kind:"fromTo",target:f,vars:w,from:y,atMs:m(x)}),b},play(){var f,y;if(g)return b;g=!0,h=[];for(let w of d)w.kind==="fromTo"&&l.set(w.target,(f=w.from)!=null?f:{}),h.push(l.to(w.target,{...w.vars,delay:w.atMs/1e3+((y=w.vars.delay)!=null?y:0)}));return b},pause(){for(let f of h)f.pause();return b},kill(){for(let f of h)f.kill();h=[],g=!1}};return u.paused||b.play(),b}};return l}function Tn(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Ln()}catch{}}var In={name:"handler-playable-sdk",version:"1.0.104",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 --external jszip && 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/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.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 --external jszip && 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 dist/cli/student-helper/*.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 te=0,es=te++,kn=te++,Pn=te++,Mn=te++,jn=te++,_n=te++,On=te++,Rn=te++,zn=te++,$n=te++,Dn=te++,Nn=te++,j=es;function Hn(){return j===kn}function Fn(){return j===Pn}function Bn(){return j===Mn}function Gn(){return j===jn}function We(){return j===_n}function Ke(){return j===On}function Un(){return j===Rn}function qn(){return j===zn}function Vn(){return j===$n}function ui(){return j===Dn}function gi(){return j===Nn}function Yn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),j=kn;return}catch{}else if(i==="dapi")try{dapi.isReady(),j=Pn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=Mn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=jn)}catch{}else if(e==="mintegral")window.gameReady&&(j=_n);else if(e==="tapjoy")window.TJ_API&&(j=On);else if(e==="tiktok")window.openAppStore&&(j=Rn);else if(e==="smadex")try{window.smxTracking&&(j=zn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=$n)}catch{}else e==="vungle"?j=Dn:(i==="nucleo"||e==="nucleo")&&(j=Nn)}var Dt=ci(require("lottie-web"),1),Wn=Dt.default;typeof window!="undefined"&&(window.lottie=Dt.default,window.__baseLottie=Dt.default);mi();function D(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var Wr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:D(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:D(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:D(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:D(360,780)}],Kr=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:D(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:D(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:D(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:D(412,915)}],Xr=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:D(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:D(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:D(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:D(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:D(800,1280)}],Zn=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:D(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:D(768,1024),mraidScale:.7}];var Jr=[...Zn];var ls=Zn[0];de();var ta=require("pixi.js"),fe={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},Bt=[];function ds(i,e,t,n,a,s,r){Bt.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function ps(){Bt.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*fe.scaleFactor;t(i,fe.width,fe.height,n,a,!0,!1)})}function ia(){Bt.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function Ht(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),fe.width=i,fe.height=e,fe.scaleFactor=Math.min(i/fe.designWidth,1.15),St.scale=fe.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),ps()}var _={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 us(i,e,t){let n=_[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function gs(){return _}var hs={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 Nt(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Te(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Nt(i[0],e.x),y:Nt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Nt(n.x,e.x),y:Nt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=hs[n])!=null?t:e}return e}function De(i,e,t,n={}){var g,h,m,C,b,f;let a=Te(t),s=(g=n.inset)!=null?g:{},r=(h=n.padding)!=null?h:{x:0,y:0},o=((m=s.left)!=null?m:0)+r.x,c=((C=s.right)!=null?C:0)+r.x,l=((b=s.top)!=null?b:0)+r.y,u=((f=s.bottom)!=null?f:0)+r.y,d=Math.max(0,i-o-c),p=Math.max(0,e-l-u);return{x:o+d*a.x,y:l+p*a.y}}function Ne(i,e,t,n={}){var m,C,b,f,y,w;let a=(m=n.inset)!=null?m:{},s=(C=n.padding)!=null?C:{x:0,y:0},r=((b=a.left)!=null?b:0)+s.x,o=((f=a.right)!=null?f:0)+s.x,c=((y=a.top)!=null?y:0)+s.y,l=((w=a.bottom)!=null?w:0)+s.y,u=Math.max(0,i-r-o),d=Math.max(0,e-c-l),p=Te(t,{x:.5,y:.5}),g=Math.min(Math.max(p.x,0),1),h=Math.min(Math.max(p.y,0),1);return{x:r+u*g,y:c+d*h}}function Ft(i,e,t,n={}){var u,d,p;if(!i)return;let a=n.positionRatio?Ne(e,t,n.positionRatio,{inset:n.inset,padding:n.screenPadding}):De(e,t,n.anchor,{inset:n.inset,padding:n.screenPadding}),s=(u=n.offset)!=null?u:{x:0,y:0},r=a.x+s.x,o=a.y+s.y;i.anchor&&n.renderAnchor&&i.anchor.set(n.renderAnchor.x,n.renderAnchor.y),se(i,r,o);let c=(d=n.scale)!=null?d:1,l=(p=n.scaleMultiplier)!=null?p:1;(n.scale!==void 0||n.scaleMultiplier!==void 0)&&pe(i,c*l)}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,Ht(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),Ht(window.innerWidth,window.innerHeight),window.updateDebugConfig=us,window.getDebugConfig=gs,window.copyConfig=As,window.applyConfig=xt,window.applyConfigForRatio=Ls,window.positionAtBottom=na,window.positionAtTop=bs,window.positionAtCenter=ys,window.positionAtLeft=vs,window.positionAtRight=ws,window.positionAtBottomLeft=xs,window.positionAtBottomRight=Ss,window.positionAtTopLeft=Es,window.positionAtTopRight=Cs,window.applyPositionContract=ms,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 Gt(i,e,t=0){return i*e+t}function Ut(i,e,t=0){return i*(1-e)+t}function qt(i,e,t=0){return i*e+t}function Vt(i,e,t=0){return i*(1-e)+t}function ie(i,e=0){return i/2+e}function fs(i,e){return i*e}function ms(i,e,t,n){var r,o,c,l,u,d,p,g,h,m,C,b,f,y,w,x,k,L,B,R;let a=0,s=0;switch(n.type){case"top":a=ie(e,(o=(r=n.offset)==null?void 0:r.x)!=null?o:0),s=Gt(t,n.percent,(l=(c=n.offset)==null?void 0:c.y)!=null?l:0);break;case"bottom":a=ie(e,(d=(u=n.offset)==null?void 0:u.x)!=null?d:0),s=Ut(t,n.percent,(g=(p=n.offset)==null?void 0:p.y)!=null?g:0);break;case"left":a=qt(e,n.percent,(m=(h=n.offset)==null?void 0:h.x)!=null?m:0),s=ie(t,(b=(C=n.offset)==null?void 0:C.y)!=null?b:0);break;case"right":a=Vt(e,n.percent,(y=(f=n.offset)==null?void 0:f.x)!=null?y:0),s=ie(t,(x=(w=n.offset)==null?void 0:w.y)!=null?x:0);break;case"center":a=ie(e,(L=(k=n.offset)==null?void 0:k.x)!=null?L:0),s=ie(t,(R=(B=n.offset)==null?void 0:B.y)!=null?R:0);break}i.position?i.position.set(a,s):(i.x=a,i.y=s),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function na(i,e,t,n=.2,a=1,s=!0,r=!1){let o=fs(t,n),c=Ut(t,n/2);se(i,ie(e),c);let l=s?a*fe.scaleFactor:a;pe(i,l),r&&!Bt.find(u=>u.element===i)&&ds(i,na,e,t,n,a,s)}function bs(i,e,t,n=.1,a=1){se(i,ie(e),Gt(t,n)),pe(i,a)}function ys(i,e,t,n=0,a=0,s=1){se(i,ie(e,n),ie(t,a)),pe(i,s)}function vs(i,e,t,n=.1,a=1){se(i,qt(e,n),ie(t)),pe(i,a)}function ws(i,e,t,n=.1,a=1){se(i,Vt(e,n),ie(t)),pe(i,a)}function xs(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Ut(t,n)),pe(i,s)}function Ss(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Ut(t,n)),pe(i,s)}function Es(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Gt(t,n)),pe(i,s)}function Cs(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Gt(t,n)),pe(i,s)}function se(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function pe(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.scale.y=e))}var $e={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 As(i){return i&&$e[i]?JSON.parse(JSON.stringify($e[i])):JSON.parse(JSON.stringify(_))}function xt(i){Object.keys(i).forEach(e=>{let t=e;_[t]&&i[t]&&Object.assign(_[t],i[t])}),console.log("Config applied:",i)}function Ls(i,e){let t=i/e;t>1.6?(xt($e.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(xt($e.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(xt($e.square),console.log("Applied SQUARE config for ratio:",t)):(xt($e.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let i=window;i.configPresets=$e,i.resolveAnchorVec2=i.resolveAnchorVec2||Te,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||De,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||Ne}var K=null,ea=new Map;function aa(i,e,t,n,a,s={}){var Se,Ee,Ce,Ae,Y,_e,lt,ct,dt,pt,ut,gt,ht,ft,mt,bt,F,Z,U,Q,Ue,Oe,Bi,Gi,Ui,qi,Vi,Yi,Wi,Ki,Xi,Ji,Zi,Qi,en,tn,nn,an,sn,rn,on,ln,cn,dn,pn,un,gn,hn,fn;let r=(Se=s.enableDebugLogs)!=null?Se:!1;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:n.width,height:n.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Time:",t),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Options:",s));let{mainContainer:o,label:c,background:l,backgroundTexture:u,app:d}=i;if(!d||!d.renderer){r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] \u274C No app or renderer, skipping layout");return}r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] App renderer dimensions:",{width:d.renderer.width,height:d.renderer.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] App screen dimensions:",{width:d.screen.width,height:d.screen.height}));let p=n.width,g=n.height;r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:p,baseHeight:g});let h=p*_.layout.screen_scale_x,m=g*_.layout.screen_scale_y,C=p/2,b=e.engine.runtime||{},f=b.layout||{};r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug config:",{screen_scale_x:_.layout.screen_scale_x,screen_scale_y:_.layout.screen_scale_y}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Calculated dimensions:",{width:h,height:m,midX:C}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",f));let y=m>h,w=(Ee=f.design_width_portrait)!=null?Ee:y?400:600,x=(Ce=f.design_height_portrait)!=null?Ce:y?600:400,k=Math.min(h/w,m/x);k=Math.min(k,1.15);let L=k*((Ae=_.engine.scale)!=null?Ae:1),B=(Y=s.skipMainContainerTransform)!=null?Y:!1;!B&&o&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(L):(o.scale.x=L,o.scale.y=L));let R=(_e=f.main_container_anchor)!=null?_e:"center",H=(lt=f.main_container_position_ratio)!=null?lt:{x:.5,y:.5},z=(ct=f.main_container_offset)!=null?ct:{x:0,y:0},T=f.main_container_position_ratio?Ne(p,g,H):De(p,g,R),E=T.x+z.x+_.layout.position_offset.x,S=T.y+z.y+_.layout.position_offset.y;if(!B&&o&&o.position&&(typeof o.position.set=="function"?o.position.set(E,S):(o.position.x=E,o.position.y=S)),a&&(o!=null&&o.toLocal)){let G=g>p,W=(dt=f.design_width_portrait)!=null?dt:G?320:480,N=(pt=f.design_height_portrait)!=null?pt:G?480:320;for(let[oe,le]of e.objects.entries()){let q=le==null?void 0:le.transform;if(!q||((ut=q.position_mode)!=null?ut:"static")!=="static")continue;let I=(gt=a.get)==null?void 0:gt.call(a,oe),yt=((ht=I==null?void 0:I.getDisplayObject)==null?void 0:ht.call(I))||(I==null?void 0:I.pixiObject)||I;if(!yt||yt.parent!==o)continue;let he=(ft=q.anchor)!=null?ft:"bottom-left";he==="bottom-left"&&q.anchor==null&&console.log("[DEBUG FALLBACK] LayoutManager transform.anchor \u2192 bottom-left");let qe=q.position_ratio!=null?Ne(W,N,q.position_ratio):De(W,N,he),Ve=(mt=q.position)!=null?mt:{x:0,y:0},vt=qe.x-W/2+Ve.x,Re=qe.y-N/2+Ve.y;typeof(I==null?void 0:I.setPosition)=="function"?I.setPosition(vt,Re):(se(yt,vt,Re),(bt=I==null?void 0:I.transform)!=null&&bt.position&&(I.transform.position.x=vt,I.transform.position.y=Re))}}let A=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,J=((A==null?void 0:A.buildMode)||(typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"dev"))==="dev";if(_.layout.debug_rect_visible&&J){(!K||K.parent!==d.stage)&&(K==null||K.destroy(),K=new ta.Graphics,K.zIndex=9999,d.stage.addChild(K)),K.clear();let G=_.layout.debug_rect_scale_x,W=_.layout.debug_rect_scale_y,N=(p-4)*G,oe=(g-4)*W,le=(p-N)/2,q=(g-oe)/2;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== DEBUG RECT POSITIONING ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect calculations:",{baseWidth:p,baseHeight:g,rectW:N,rectH:oe,offsetX:le,offsetY:q}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect final position:",{x:2+le,y:2+q,width:N,height:oe})),K.rect(2+le,2+q,N,oe).stroke({width:_.layout.debug_rect_thickness,color:_.layout.debug_rect_color})}else K&&(K.destroy(),K=null);let O=((F=i.label)==null?void 0:F.config)||e.objects.get("label_1")||e.objects.get("ui_tutorial_1");if(c&&c.position&&O){let G=(U=(Z=O==null?void 0:O.transform)==null?void 0:Z.anchor)!=null?U:"center",W=(Q=O==null?void 0:O.transform)==null?void 0:Q.position_ratio,N=((Ue=O==null?void 0:O.transform)==null?void 0:Ue.offset)||{x:0,y:0};Ft(c,p,g,{anchor:G,positionRatio:W,offset:{x:N.x*L,y:N.y*L},renderAnchor:Te(G)})}if(c&&c.alpha>0){let G=1+Math.sin(t*_.engine.label_pulse_speed)*_.engine.label_pulse_intensity,W=(Bi=(Oe=O==null?void 0:O.transform)==null?void 0:Oe.scale)!=null?Bi:1,N=G*L*W;c.scale&&(typeof c.scale.set=="function"?c.scale.set(N):(c.scale.x=N,c.scale.y=N))}r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== BACKGROUND POSITIONING =====");let ne=l?e.objects.get("background_1"):null,je=!!ne&&(l==null?void 0:l.parent)===o;if(l&&!je){r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background object exists:",!!l),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background type:",(Gi=l.constructor)==null?void 0:Gi.name)),l.alpha=((qi=(Ui=b.background)==null?void 0:Ui.alpha)!=null?qi:.98)*_.engine.background_alpha,r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background alpha set to:",l.alpha),r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background config:",ne);let G=(ne==null?void 0:ne.transform)||{};r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",G);let W=G.offset||{x:0,y:0},N=((Yi=(Vi=b.background)==null?void 0:Vi.offset_y)!=null?Yi:0)+_.engine.background_offset_y,oe=(Wi=G.anchor)!=null?Wi:"center",le=G.position_ratio;if(r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background positioning params:",{bgOffset:W,bgRuntimeOffsetY:N,bgScreenAnchor:oe,bgPositionRatio:le,baseWidth:p,baseHeight:g,finalScale:L}),Ft(l,p,g,{anchor:oe,positionRatio:le,offset:{x:W.x*L,y:W.y*L+N},renderAnchor:Te(oe)}),r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:l.x,y:l.y,scaleX:(Ki=l.scale)==null?void 0:Ki.x,scaleY:(Xi=l.scale)==null?void 0:Xi.y,anchorX:(Ji=l.anchor)==null?void 0:Ji.x,anchorY:(Zi=l.anchor)==null?void 0:Zi.y,pivotX:(Qi=l.pivot)==null?void 0:Qi.x,pivotY:(en=l.pivot)==null?void 0:en.y,width:l.width,height:l.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background texture dimensions:",{textureWidth:u==null?void 0:u.width,textureHeight:u==null?void 0:u.height})),u){let qe=Math.max(h/u.width,m/u.height),Ve=(nn=(tn=b.background)==null?void 0:tn.scale_multiplier)!=null?nn:1.05,vt=(an=G.scale)!=null?an:1,Re=qe*Ve*_.engine.background_scale*vt;l.scale&&(typeof l.scale.set=="function"?l.scale.set(Re):(l.scale.x=Re,l.scale.y=Re))}else l&&typeof l.clear=="function"&&(l.clear(),l.rect(-h/2,-m/2,h,m).fill({color:1444375}));let q=`${p}x${g}`,P=ea.get(q),I={x:Number((sn=l.x)!=null?sn:0),y:Number((rn=l.y)!=null?rn:0),scaleX:Number((ln=(on=l.scale)==null?void 0:on.x)!=null?ln:1),scaleY:Number((dn=(cn=l.scale)==null?void 0:cn.y)!=null?dn:1),rotation:Number.isFinite(l.rotation)?l.rotation:void 0,anchorX:Number.isFinite((pn=l.anchor)==null?void 0:pn.x)?l.anchor.x:void 0,anchorY:Number.isFinite((un=l.anchor)==null?void 0:un.y)?l.anchor.y:void 0,pivotX:Number.isFinite((gn=l.pivot)==null?void 0:gn.x)?l.pivot.x:void 0,pivotY:Number.isFinite((hn=l.pivot)==null?void 0:hn.y)?l.pivot.y:void 0},yt=Number.isFinite(I.x)&&Number.isFinite(I.y)&&Number.isFinite(I.scaleX)&&Number.isFinite(I.scaleY),he=I;if(P){let qe=Math.hypot(I.x-P.x,I.y-P.y),Ve=Math.max(p,g)*.5;(!yt||qe>Ve)&&((fn=l.position)!=null&&fn.set?l.position.set(P.x,P.y):(l.x=P.x,l.y=P.y),l.scale&&(typeof l.scale.set=="function"?l.scale.set(P.scaleX,P.scaleY):(l.scale.x=P.scaleX,l.scale.y=P.scaleY)),Number.isFinite(P.rotation)&&typeof l.rotation=="number"&&(l.rotation=P.rotation),l.anchor&&Number.isFinite(P.anchorX)&&Number.isFinite(P.anchorY)&&l.anchor.set(P.anchorX,P.anchorY),l.pivot&&Number.isFinite(P.pivotX)&&Number.isFinite(P.pivotY)&&l.pivot.set(P.pivotX,P.pivotY),he=P)}Number.isFinite(he.x)&&Number.isFinite(he.y)&&Number.isFinite(he.scaleX)&&Number.isFinite(he.scaleY)&&ea.set(q,he)}}function Ts(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 Is(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 ks(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 yi(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 s=await Ts(a),r=await ks(s),o=Is(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Yt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((d,p)=>{let g=new Image;g.onload=()=>d(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 s=a.getImageData(0,0,n.width,n.height),r=s.data,c=[{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(d=>({r:r[d.offset],g:r[d.offset+1],b:r[d.offset+2]})),l=0;for(let d=0;d<r.length;d+=4){let p=r[d],g=r[d+1],h=r[d+2],m=!1;for(let C of c)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(h-C.b,2))<e){m=!0;break}m&&(r[d+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var sa=require("@google/genai");async function vi(i,e,t=[],n={}){var a,s,r,o,c,l,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 f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let d=new sa.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let h=await d.models.generateContent({model:p,contents:g}),m="",C=(r=(s=(a=h.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(C)for(let b of C)b.text&&(m+=b.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(d){throw console.error("[Gemini] API error:",d),(o=d.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(c=d.message)!=null&&c.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=d.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=d.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):d}}var ra=require("@google/genai");async function Wt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ra.GoogleGenAI({apiKey:i}),s=[{text:e}];t.length>0&&t.forEach((o,c)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${c}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let c=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${c}`}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 Rs=require("pixi.js");Et();Kt();de();var ua=require("pixi.js");var $s=require("pixi.js");de();function Ws(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 Ks(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 Xs(i){return`
98
98
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
99
99
 
100
100
  Provide a concise summary (2-3 sentences) covering:
@@ -1 +1 @@
1
- function a0_0x1adf(_0x496f23,_0x235246){_0x496f23=_0x496f23-(0x2ab*0xd+-0xd4c+-0x3*0x6f1);var _0x2f36cb=a0_0x5ee6();var _0x21b5e3=_0x2f36cb[_0x496f23];if(a0_0x1adf['hgkXJf']===undefined){var _0x13765f=function(_0x3fae19){var _0x2bb50b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xfc13e6='',_0x426e4c='',_0x45f897=_0xfc13e6+_0x13765f;for(var _0x8c23c4=-0x33*0xc2+-0x11f1+0x3897,_0x1048d0,_0x774543,_0x25922e=0x1277*0x2+-0xb4f+-0x199f;_0x774543=_0x3fae19['charAt'](_0x25922e++);~_0x774543&&(_0x1048d0=_0x8c23c4%(-0xb64+0x228e*-0x1+0x2df6)?_0x1048d0*(0x752+0xa70+0x2eb*-0x6)+_0x774543:_0x774543,_0x8c23c4++%(0x358+-0x895+0x541*0x1))?_0xfc13e6+=_0x45f897['charCodeAt'](_0x25922e+(-0x1f5b+-0x11*0x13f+0x3494))-(-0x1eb*0x14+0x165b*0x1+0x100b)!==0x2082+-0xc9f+0x1*-0x13e3?String['fromCharCode'](-0xf83+-0x345+-0x53*-0x3d&_0x1048d0>>(-(-0x1985+-0x9a6+-0x5*-0x709)*_0x8c23c4&-0x1fd*-0x11+-0x2693+0x4cc)):_0x8c23c4:0x843+0xbf7+-0x143a){_0x774543=_0x2bb50b['indexOf'](_0x774543);}for(var _0x16ce89=-0x1911+0x1*0x1a93+0x1*-0x182,_0xc441d1=_0xfc13e6['length'];_0x16ce89<_0xc441d1;_0x16ce89++){_0x426e4c+='%'+('00'+_0xfc13e6['charCodeAt'](_0x16ce89)['toString'](0x1961+0x1b9c+-0x1*0x34ed))['slice'](-(-0x1b99+0x13c0+0x7db));}return decodeURIComponent(_0x426e4c);};var _0x35ed96=function(_0x1d79e8,_0x46a9d1){var _0x555603=[],_0x4b476c=-0x1202*-0x2+0x83*-0x31+-0xaf1,_0x1f7698,_0x1078ce='';_0x1d79e8=_0x13765f(_0x1d79e8);var _0x802f01;for(_0x802f01=0x4cc*0x2+0x1b0f+0x24a7*-0x1;_0x802f01<0x4*0x123+-0x1dcd+-0x2f*-0x8f;_0x802f01++){_0x555603[_0x802f01]=_0x802f01;}for(_0x802f01=-0xeff+0x319*-0x3+0x184a;_0x802f01<0xb9e*0x1+0x1*0x1bce+-0x266c;_0x802f01++){_0x4b476c=(_0x4b476c+_0x555603[_0x802f01]+_0x46a9d1['charCodeAt'](_0x802f01%_0x46a9d1['length']))%(-0xe7c+-0xcd3*0x1+-0x1c4f*-0x1),_0x1f7698=_0x555603[_0x802f01],_0x555603[_0x802f01]=_0x555603[_0x4b476c],_0x555603[_0x4b476c]=_0x1f7698;}_0x802f01=0xeb*-0x1d+-0x2479+0x3f18,_0x4b476c=-0x23bb+0x1b97*-0x1+0x3f52;for(var _0x5c8b2a=-0x2*-0xec3+-0x84a+-0x153c;_0x5c8b2a<_0x1d79e8['length'];_0x5c8b2a++){_0x802f01=(_0x802f01+(0x2b*-0xdf+0x752+-0x4*-0x789))%(-0x28*0xe1+0x2429*-0x1+0x4851),_0x4b476c=(_0x4b476c+_0x555603[_0x802f01])%(-0x283*-0x1+0x1*-0x1aab+0x1928),_0x1f7698=_0x555603[_0x802f01],_0x555603[_0x802f01]=_0x555603[_0x4b476c],_0x555603[_0x4b476c]=_0x1f7698,_0x1078ce+=String['fromCharCode'](_0x1d79e8['charCodeAt'](_0x5c8b2a)^_0x555603[(_0x555603[_0x802f01]+_0x555603[_0x4b476c])%(0x20fe+-0x3bc*0x4+-0x110e)]);}return _0x1078ce;};a0_0x1adf['eXBruq']=_0x35ed96,a0_0x1adf['tcBSob']={},a0_0x1adf['hgkXJf']=!![];}var _0x5d5020=_0x2f36cb[0x26a8+-0x1359+-0x134f*0x1],_0xcb7cd9=_0x496f23+_0x5d5020,_0x293cca=a0_0x1adf['tcBSob'][_0xcb7cd9];if(!_0x293cca){if(a0_0x1adf['utKsGT']===undefined){var _0x932a7d=function(_0x285619){this['aYJioE']=_0x285619,this['ScIDYy']=[-0x14ea+-0x286*-0x7+0x1*0x341,0x8f*-0x34+0x64f*-0x1+0x235b,-0x15f0+0x6e3*-0x3+0xf*0x2d7],this['sUNpRi']=function(){return'newState';},this['DNyDPj']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['mPYXeh']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x932a7d['prototype']['ZkhLXZ']=function(){var _0x32caa9=new RegExp(this['DNyDPj']+this['mPYXeh']),_0x4109ff=_0x32caa9['test'](this['sUNpRi']['toString']())?--this['ScIDYy'][0x175c+0x1c4*-0x11+-0xb*-0x9b]:--this['ScIDYy'][-0x102f+0x1027+-0x8*-0x1];return this['QREswD'](_0x4109ff);},_0x932a7d['prototype']['QREswD']=function(_0x4554fe){if(!Boolean(~_0x4554fe))return _0x4554fe;return this['ytBKqf'](this['aYJioE']);},_0x932a7d['prototype']['ytBKqf']=function(_0x17893d){for(var _0x1df24e=-0x39b+0x32e*-0xb+0x2695,_0x47c507=this['ScIDYy']['length'];_0x1df24e<_0x47c507;_0x1df24e++){this['ScIDYy']['push'](Math['round'](Math['random']())),_0x47c507=this['ScIDYy']['length'];}return _0x17893d(this['ScIDYy'][0x1ce6+-0xb*-0x1f3+-0x1*0x3257]);},new _0x932a7d(a0_0x1adf)['ZkhLXZ'](),a0_0x1adf['utKsGT']=!![];}_0x21b5e3=a0_0x1adf['eXBruq'](_0x21b5e3,_0x235246),a0_0x1adf['tcBSob'][_0xcb7cd9]=_0x21b5e3;}else _0x21b5e3=_0x293cca;return _0x21b5e3;}(function(_0xf71498,_0x20011f){var a0_0x338eca={_0x36ad75:'q*$!',_0x2ac80b:0x233,_0x42fd66:0x23e,_0x47d4a6:0x232,_0x389667:0x238,_0x144fd0:'o6zS',_0xbf73d1:0x225,_0x253c4b:0x218,_0xfad0a2:'9oWD',_0x123323:0x218,_0x102539:0x230,_0x386a7e:0x1af,_0x5d242c:0x1be,_0x1319dd:'!65K',_0xeb1034:0x1b7,_0x38a740:0x1a2,_0x1f386c:0x19a,_0x1abdd4:0x1a5,_0x16234a:'&Hq@',_0x17d429:0x1a3,_0xd03ca:0x196,_0x3709d5:0x1ba,_0x285f47:'&Hq@',_0x146f76:0x22e,_0x3c918f:0x220,_0x3086d3:0x23c,_0x13acc0:0x222,_0x1467b4:0x22d,_0x3c1aae:0x21b,_0x1e90f9:'V%Fw',_0xfcd4e6:0x226,_0x179b39:0x236,_0x4c553d:0x45d,_0x2a71bf:0x46e,_0xcdf56f:0x46c,_0x4b7c84:'35RU',_0x142a34:0x462,_0x111f9e:'uMAB'},a0_0x4e5431={_0x4e278c:0x185},a0_0x47e18b={_0x54edb4:0x3cb},a0_0x20ba02={_0x2f5131:0x102};function _0x5aa1b7(_0x587094,_0x5bec94,_0x4fc68a,_0xdff8bb,_0x5a66e3){return a0_0x1adf(_0x587094-a0_0x20ba02._0x2f5131,_0x4fc68a);}function _0x3f1db2(_0x2d9c96,_0x4a37e0,_0x32727e,_0x51c779,_0x5b3a5d){return a0_0x1adf(_0x32727e-a0_0x47e18b._0x54edb4,_0x5b3a5d);}var _0x575f97=_0xf71498();function _0xd6098f(_0x47cfd7,_0x5918b8,_0x26d8d9,_0x4272ae,_0x41c760){return a0_0x1adf(_0x5918b8-a0_0x4e5431._0x4e278c,_0x47cfd7);}while(!![]){try{var _0x551ce3=-parseInt(_0xd6098f(a0_0x338eca._0x36ad75,a0_0x338eca._0x2ac80b,a0_0x338eca._0x42fd66,a0_0x338eca._0x47d4a6,a0_0x338eca._0x389667))/(0x85*0x39+-0xd3e+-0x5*0x346)*(parseInt(_0xd6098f(a0_0x338eca._0x144fd0,0x224,0x232,a0_0x338eca._0xbf73d1,a0_0x338eca._0x253c4b))/(-0x4*-0x574+-0x251+-0x137d))+-parseInt(_0xd6098f(a0_0x338eca._0xfad0a2,a0_0x338eca._0xbf73d1,a0_0x338eca._0x123323,a0_0x338eca._0x102539,0x221))/(-0x1720+0x2562+0x7*-0x209)*(parseInt(_0x5aa1b7(a0_0x338eca._0x386a7e,a0_0x338eca._0x5d242c,a0_0x338eca._0x1319dd,a0_0x338eca._0xeb1034,a0_0x338eca._0x38a740))/(0x5*-0xa7+-0x1a2a+0x1d71))+-parseInt(_0x5aa1b7(a0_0x338eca._0x1f386c,a0_0x338eca._0x1abdd4,a0_0x338eca._0x16234a,a0_0x338eca._0x17d429,a0_0x338eca._0xd03ca))/(-0x20f7+-0x84a+0x2946)+parseInt(_0x5aa1b7(0x1ad,0x1b8,'PplF',a0_0x338eca._0x3709d5,0x19d))/(-0x3d*-0x4f+0x1ed8+-0x31a5)+parseInt(_0xd6098f(a0_0x338eca._0x285f47,a0_0x338eca._0x146f76,a0_0x338eca._0x3c918f,a0_0x338eca._0x3086d3,a0_0x338eca._0x3086d3))/(0x24c0+0x1b*-0x12b+-0x53*0x10)+parseInt(_0xd6098f('9rLr',a0_0x338eca._0x13acc0,a0_0x338eca._0x1467b4,0x21b,a0_0x338eca._0x3c1aae))/(-0xe89+0x13bb+0x2*-0x295)*(-parseInt(_0xd6098f(a0_0x338eca._0x1e90f9,a0_0x338eca._0xfcd4e6,0x227,a0_0x338eca._0x179b39,a0_0x338eca._0x1467b4))/(0x2666+0x1788+-0x3de5))+-parseInt(_0x3f1db2(a0_0x338eca._0x4c553d,a0_0x338eca._0x2a71bf,0x460,a0_0x338eca._0xcdf56f,a0_0x338eca._0x4b7c84))/(-0x4*0x8cd+-0x244a+0x2*0x23c4)*(-parseInt(_0x3f1db2(0x470,0x465,0x46d,a0_0x338eca._0x142a34,a0_0x338eca._0x111f9e))/(-0x10f4+-0x1210+0x230f));if(_0x551ce3===_0x20011f)break;else _0x575f97['push'](_0x575f97['shift']());}catch(_0xdc3fdb){_0x575f97['push'](_0x575f97['shift']());}}}(a0_0x5ee6,0x67*0x153+0x27e37+-0x1*0x9a3c));var a0_0x27b753=(function(){var _0x3a6b58=!![];return function(_0xcf88c,_0xf321b0){var a0_0x35fe65={_0x1bcaa4:'fl3r',_0x2380ce:0x25c,_0x10900e:0x251,_0x2e7a33:0x241},_0x32c9e3=_0x3a6b58?function(){var a0_0x5d52f7={_0x5d3e6a:0x1c0};function _0x338324(_0x1e6e18,_0x578656,_0x287725,_0x3b6f57,_0x1a7e36){return a0_0x1adf(_0x3b6f57-a0_0x5d52f7._0x5d3e6a,_0x578656);}if(_0xf321b0){var _0x55ccc5=_0xf321b0[_0x338324(0x252,a0_0x35fe65._0x1bcaa4,a0_0x35fe65._0x2380ce,a0_0x35fe65._0x10900e,a0_0x35fe65._0x2e7a33)](_0xcf88c,arguments);return _0xf321b0=null,_0x55ccc5;}}:function(){};return _0x3a6b58=![],_0x32c9e3;};}()),a0_0x50ce3e=a0_0x27b753(this,function(){var a0_0x43eb29={_0x5712cd:0xc3,_0x49f843:0xca,_0x2da561:0xc4,_0xef0445:'TiLL',_0x3756e0:0x1e4,_0x1e6db1:0x1d9,_0xf12e48:'Lg^Z',_0x47869a:0xb4,_0x181a52:0xb6,_0x3ab927:'LrL&',_0x1976a1:0x1ec,_0x577e9c:0x1fb,_0xaaabb6:0x1ec,_0x117c84:0x1e1,_0x14ec4f:0xa8,_0x30da75:0xad,_0x5c627a:0xab,_0x597e56:0x9a,_0x4279ca:0x1d8,_0x5a99fb:0x1e9,_0x2e6ef8:0x1e3,_0x55a8e3:0x1e0,_0x260744:'!8xK',_0x4f807d:0xbe,_0x12f171:0xc3,_0x1df5cb:0xbc,_0x13e8b6:0xba,_0x4cc304:'n@Am',_0x4a5107:0xb7,_0x4082a4:0xaa,_0x32fc3f:0xb0,_0x53f9b8:0xb0,_0x37f755:0xc6,_0x63c5a5:0xc0,_0x41f981:0xc8,_0x582c30:0xb0,_0x7b5c4f:0xaf,_0x15dd19:0xb9,_0x5af9ef:0xcc,_0x4eba58:0xc9,_0x4300bb:0xd1,_0x15f644:'eseQ',_0x4af0fa:0xd9,_0x30ebd6:'&Oop',_0x2527b2:0xcd,_0x3c0d8b:'vbk@',_0xf6b26:0x1e8,_0x549738:0x1f5,_0x1a3c6a:'ryHI'},a0_0x1b8573={_0x2d95c6:0x16d},a0_0x11d9a0={_0x223b46:0x19},a0_0x3e17e8={_0x2869e9:0x13d},_0x512daa={};_0x512daa[_0x4fc8c6(a0_0x43eb29._0x5712cd,0xc4,a0_0x43eb29._0x49f843,a0_0x43eb29._0x2da561,a0_0x43eb29._0xef0445)]=_0x238b7b(a0_0x43eb29._0x3756e0,0x1ce,0x1d6,a0_0x43eb29._0x1e6db1,a0_0x43eb29._0xf12e48)+_0x4fc8c6(0xd6,a0_0x43eb29._0x47869a,0xc5,a0_0x43eb29._0x181a52,a0_0x43eb29._0x3ab927)+'+$';var _0xb9ab0e=_0x512daa;function _0x238b7b(_0x264fee,_0x424787,_0x3297ec,_0x41d7d8,_0x3fc3bd){return a0_0x1adf(_0x3297ec-a0_0x3e17e8._0x2869e9,_0x3fc3bd);}function _0x4fc8c6(_0x55ad6f,_0x46a3b0,_0x1d3c83,_0x41aea3,_0x191c69){return a0_0x1adf(_0x1d3c83-a0_0x11d9a0._0x223b46,_0x191c69);}function _0x31d8ea(_0x48a90a,_0x1047ff,_0x214c79,_0x3cb8e4,_0x52f3ac){return a0_0x1adf(_0x48a90a- -a0_0x1b8573._0x2d95c6,_0x1047ff);}return a0_0x50ce3e[_0x238b7b(a0_0x43eb29._0x1976a1,a0_0x43eb29._0x577e9c,a0_0x43eb29._0xaaabb6,a0_0x43eb29._0x117c84,'2@Ru')+_0x4fc8c6(a0_0x43eb29._0x14ec4f,a0_0x43eb29._0x30da75,a0_0x43eb29._0x5c627a,a0_0x43eb29._0x597e56,'M2O2')]()[_0x238b7b(a0_0x43eb29._0x4279ca,a0_0x43eb29._0x5a99fb,a0_0x43eb29._0x2e6ef8,a0_0x43eb29._0x55a8e3,a0_0x43eb29._0x260744)+'h'](_0x4fc8c6(a0_0x43eb29._0x4f807d,a0_0x43eb29._0x12f171,a0_0x43eb29._0x1df5cb,a0_0x43eb29._0x13e8b6,a0_0x43eb29._0x4cc304)+_0x4fc8c6(a0_0x43eb29._0x4a5107,a0_0x43eb29._0x4082a4,a0_0x43eb29._0x32fc3f,a0_0x43eb29._0x53f9b8,'2@Ru')+'+$')[_0x31d8ea(-a0_0x43eb29._0x37f755,'vbk@',-a0_0x43eb29._0x63c5a5,-a0_0x43eb29._0x4f807d,-a0_0x43eb29._0x41f981)+_0x4fc8c6(0xa4,a0_0x43eb29._0x582c30,0xb4,a0_0x43eb29._0x7b5c4f,'Rp8l')]()[_0x4fc8c6(a0_0x43eb29._0x15dd19,a0_0x43eb29._0x5af9ef,a0_0x43eb29._0x4eba58,a0_0x43eb29._0x4300bb,a0_0x43eb29._0x15f644)+_0x31d8ea(-a0_0x43eb29._0x4af0fa,a0_0x43eb29._0x30ebd6,-a0_0x43eb29._0x2527b2,-a0_0x43eb29._0x41f981,-0xdc)+'r'](a0_0x50ce3e)[_0x4fc8c6(0xbe,0xbd,a0_0x43eb29._0x4f807d,a0_0x43eb29._0x30da75,a0_0x43eb29._0x3c0d8b)+'h'](_0xb9ab0e[_0x238b7b(0x1f0,a0_0x43eb29._0xf6b26,0x1e5,a0_0x43eb29._0x549738,a0_0x43eb29._0x1a3c6a)]);});a0_0x50ce3e();import{A as a0_0x4eb315,B as a0_0x2e1f63,C as a0_0x3b6646,D as a0_0x50b6aa,b as a0_0x5be1f9,c as a0_0x537821,d as a0_0xf963c5,e as a0_0x4f6ea4,f as a0_0x5b48e0,g as a0_0x353c5e,h as a0_0xb5141a,i as a0_0x55c1bf,j as a0_0x3f7791,k as a0_0x27f8d1,l as a0_0x48e763,m as a0_0x18f411,n as a0_0x1d6222,o as a0_0x245894,p as a0_0x1faa5f,q as a0_0x371d9f,r as a0_0x561dda,s as a0_0xd08522,t as a0_0x3dde35,u as a0_0x519fa0,v as a0_0x4fbff3,w as a0_0x55cdd5,x as a0_0x45b25e,y as a0_0x378832,z as a0_0x28aed9}from'../chunk-EMWR536B.js';import'../chunk-NSZ7GCS3.js';import{a as a0_0x1e02f0,b as a0_0x200958,c as a0_0x125299,d as a0_0x3b77ed,e as a0_0x25d614}from'../chunk-I5OOVR5U.js';function a0_0x5ee6(){var _0x569598=['W7BcK8kMWQtcTq','WOHLWQrJzq','yCoTWPCUza','b1JdPmkNj33dICkepZ/cO2W','W65Pw8kHWPa','WP3cG28','WRddPge0ymkkW7JdKZhcJSk/emkv','CSk4gCkxuW','qqZcKCosySkyW6qktdeVaG','b1WPWQb7wSoEus1vW43cUG','WQVdL8oCW7VdRG','jINdQ8oercDrW67dPcr8W7Gu','W6BcHmkCWRuQ','W4BdMZNdMfmjmhSU','uH/dSW','h8kydfZdHmoNl8o4CmoAW6G','WOWBlb3dMSouWQH0kwpcJW','WPjatJfAWRfYW6pcHmoeoSkfWPi','WOOKWPz1q2dcNmkpWQSTkca','b1FcT8oEuINdHSkM','z39uW4tcM8obWOKRpa','mbLzW6tdNYiIWRpcUq','W5K2WPHHWRm','ygzjts7dTSkv','W45BWPJcP8kc','W4tdRmoEW5On','W4LrWQRcOCkt','WO0kgCoMpW','jIhdQCoatYjwW6VdHZ5yW402','WRtdPdfog8oDWPZdGW','WP5brmk9W4fZaSoSmtCfW5a/','W4/dHSkZWPD9','bSo3ymo2WPRdNmoIW5vNjwa','bd9VW7uRpSoR'];a0_0x5ee6=function(){return _0x569598;};return a0_0x5ee6();}import'../chunk-FOTLNUIS.js';import'../chunk-2MR65LDX.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x1e02f0 as AssetCache,a0_0x125299 as AssetLoader,a0_0x519fa0 as AssetSystem,a0_0x3b77ed as AssetTextures,a0_0xd08522 as Assets,a0_0x245894 as BaseSystem,a0_0x1d6222 as GameEngine,a0_0x4f6ea4 as GameObject,a0_0x5b48e0 as GameObjectManager,a0_0x18f411 as ObjectFactory,a0_0xf963c5 as Renderer,a0_0x1faa5f as RuntimeObjectRegistry,a0_0x537821 as Transform,a0_0x2e1f63 as applyScreenAnchor,a0_0x371d9f as basePixi,a0_0x55cdd5 as clearResponsiveElements,a0_0x5be1f9 as createPixiBase,a0_0x3f7791 as getRegisteredFontIds,a0_0x4fbff3 as globalResponsiveMultipliers,a0_0x25d614 as initAssetTextures,a0_0x3dde35 as initAssets,a0_0x3b6646 as layout,a0_0x48e763 as playLottieOverlay,a0_0x55c1bf as registerFont,a0_0x200958 as registerType,a0_0x378832 as resolveAnchorVec2,a0_0x353c5e as resolveFont,a0_0xb5141a as resolveFontWeight,a0_0x28aed9 as resolveScreenAnchorPoint,a0_0x4eb315 as resolveScreenRatioPoint,a0_0x50b6aa as runInitSequence,a0_0x27f8d1 as setLottieInstance,a0_0x561dda as spawnSceneFromConfig,a0_0x45b25e as updateScreenState};
1
+ (function(_0x6ec1e3,_0x2244e0){var a0_0x558fd2={_0x55b759:0x187,_0x1605fd:0x191,_0xb0c8b0:0x18c,_0x2b8549:0x18a,_0x28e382:'JY[c',_0x27b739:'wgnH',_0x181bb4:0x6b,_0x542af8:0x74,_0x2efc4b:0x188,_0x38ccb3:0x192,_0x112eea:'D0Q0',_0x39a6ab:0x196,_0x4bb293:0x197,_0x31ac21:0x18b,_0x5ad13c:'O5qQ',_0x5ee4ae:0x189,_0x5124a8:0x17d,_0x3c922d:'kRF2',_0x4c65cb:0x19a,_0x407b0e:0x1a2,_0x255bcc:'y#xG',_0x2456d0:0x8c,_0xf4b594:0x8f,_0x4037e5:'vqD^',_0x1b5663:0x72,_0x261497:0x7e,_0x451365:0x69,_0x54628f:0x1aa,_0x3a3158:0x1b9,_0x5d484c:0x1af,_0x2469a3:0x18f,_0x2756e2:0x19b},a0_0x50ada3={_0x11d544:0x9c},a0_0x449715={_0x268e94:0x8e};function _0x25e0bb(_0x2e5688,_0xcfcf52,_0x5e5528,_0x54b3d2,_0x25544b){return a0_0x2512(_0x5e5528- -a0_0x449715._0x268e94,_0x2e5688);}function _0x80628d(_0x21d01a,_0xc65bb8,_0x2acdf9,_0x5ce42b,_0x5f45a4){return a0_0x2512(_0x5ce42b-a0_0x50ada3._0x11d544,_0x2acdf9);}function _0x44540e(_0x19730b,_0x30a56d,_0x4dbdd8,_0x13999d,_0x3847ef){return a0_0x2512(_0x19730b- -0x291,_0x3847ef);}var _0xa217b9=_0x6ec1e3();while(!![]){try{var _0x1408c3=-parseInt(_0x44540e(-a0_0x558fd2._0x55b759,-a0_0x558fd2._0x1605fd,-a0_0x558fd2._0xb0c8b0,-a0_0x558fd2._0x2b8549,a0_0x558fd2._0x28e382))/(-0x997*-0x2+-0x69a*0x4+0x73b)+-parseInt(_0x25e0bb(a0_0x558fd2._0x27b739,0x66,0x6e,a0_0x558fd2._0x181bb4,a0_0x558fd2._0x542af8))/(0x1127+-0x1b75+-0x30*-0x37)*(parseInt(_0x44540e(-a0_0x558fd2._0x2efc4b,-0x195,-0x183,-a0_0x558fd2._0x38ccb3,a0_0x558fd2._0x112eea))/(-0x1*-0x24d4+-0xfe9+-0x14e8))+-parseInt(_0x44540e(-a0_0x558fd2._0x2b8549,-a0_0x558fd2._0x39a6ab,-a0_0x558fd2._0x4bb293,-a0_0x558fd2._0x31ac21,a0_0x558fd2._0x5ad13c))/(-0xc*-0x15f+0x1600+-0x2670)*(parseInt(_0x44540e(-a0_0x558fd2._0x5ee4ae,-0x188,-a0_0x558fd2._0x5124a8,-0x17d,a0_0x558fd2._0x3c922d))/(0x1*0x25f9+0x1e08+-0x43fc))+parseInt(_0x80628d(a0_0x558fd2._0x4c65cb,0x19f,'qS]7',a0_0x558fd2._0x407b0e,0x1a7))/(0x2*0x33d+-0x397*-0x8+-0x232c)+-parseInt(_0x25e0bb(a0_0x558fd2._0x255bcc,a0_0x558fd2._0x2456d0,0x81,a0_0x558fd2._0xf4b594,0x81))/(0x1*-0x352+0xfaa+0x41b*-0x3)+parseInt(_0x25e0bb(a0_0x558fd2._0x4037e5,0x6e,a0_0x558fd2._0x1b5663,a0_0x558fd2._0x261497,a0_0x558fd2._0x451365))/(0x16d2+-0x1*0x21d7+0xb0d)*(-parseInt(_0x80628d(a0_0x558fd2._0x54628f,a0_0x558fd2._0x3a3158,'a@lP',a0_0x558fd2._0x5d484c,0x1ae))/(-0x4d*0x6a+0x1a5*-0x7+-0x1*-0x2b6e))+parseInt(_0x44540e(-a0_0x558fd2._0x2469a3,-0x191,-0x191,-a0_0x558fd2._0x2756e2,a0_0x558fd2._0x27b739))/(0x639+0x20d2+0x2701*-0x1);if(_0x1408c3===_0x2244e0)break;else _0xa217b9['push'](_0xa217b9['shift']());}catch(_0x373749){_0xa217b9['push'](_0xa217b9['shift']());}}}(a0_0x34da,-0x1f*0x1741+-0x23dc3+-0x1bd7*-0x3e));var a0_0x22bc30=(function(){var _0x55cfed=!![];return function(_0x140ebf,_0x40fc80){var _0x483cc5=_0x55cfed?function(){if(_0x40fc80){var _0x490377=_0x40fc80['apply'](_0x140ebf,arguments);return _0x40fc80=null,_0x490377;}}:function(){};return _0x55cfed=![],_0x483cc5;};}()),a0_0x4163eb=a0_0x22bc30(this,function(){var a0_0x6978e3={_0x26276a:0x111,_0x1e82be:0x104,_0x2e0742:0x10e,_0x285eb3:0x106,_0x4033be:0x18,_0x5ae03d:'vqD^',_0x150e52:0xf,_0x4e4c8f:0x11,_0x31bdab:0x130,_0x2b753b:0x128,_0x1f49e0:'y#xG',_0x1cfebd:0x113,_0x5ae250:0x12b,_0x2a8e4d:0x11d,_0x42d314:'wgnH',_0xf52671:0x26,_0x49405a:'7&PA',_0x50405e:0x22,_0x49e1e6:0x12d,_0xa5a657:0x123,_0x3b1a1e:'sjdH',_0x546411:0x1f,_0x277015:'qS]7',_0x1bc421:0x26,_0x1defc6:0x16,_0x32f73c:'63!I',_0x1299a1:0x27,_0x42b200:0x1b,_0x550eec:0x11e,_0x32a4b7:0x126,_0x5146a9:'6b^l'},a0_0x449da3={_0x2b6f92:0xd},a0_0x8befe3={_0x5c3d44:0x22b},a0_0x483470={_0x17cd74:0xec};function _0x1da739(_0xdcd221,_0x4e2125,_0x485a3d,_0x2a72a1,_0x40b99a){return a0_0x2512(_0xdcd221- -a0_0x483470._0x17cd74,_0x4e2125);}var _0x44f996={};function _0x1ab1c4(_0x306d50,_0x59ce1d,_0x3ad5e1,_0x57c068,_0x250b01){return a0_0x2512(_0x57c068- -a0_0x8befe3._0x5c3d44,_0x250b01);}_0x44f996[_0x532011('nUbx',a0_0x6978e3._0x26276a,a0_0x6978e3._0x1e82be,a0_0x6978e3._0x2e0742,a0_0x6978e3._0x285eb3)]='(((.+'+_0x1da739(a0_0x6978e3._0x4033be,a0_0x6978e3._0x5ae03d,0x1a,a0_0x6978e3._0x150e52,a0_0x6978e3._0x4e4c8f)+'+$';function _0x532011(_0x30252a,_0xbb2716,_0x3a1c58,_0x4a9d2d,_0x188ef7){return a0_0x2512(_0x4a9d2d-a0_0x449da3._0x2b6f92,_0x30252a);}var _0x13d43c=_0x44f996;return a0_0x4163eb[_0x1ab1c4(-a0_0x6978e3._0x31bdab,-0x12d,-0x128,-a0_0x6978e3._0x2b753b,a0_0x6978e3._0x1f49e0)+_0x1ab1c4(-0x11d,-a0_0x6978e3._0x1cfebd,-a0_0x6978e3._0x5ae250,-a0_0x6978e3._0x2a8e4d,a0_0x6978e3._0x42d314)]()['searc'+'h'](_0x13d43c['OGWZn'])['toStr'+_0x1da739(a0_0x6978e3._0xf52671,a0_0x6978e3._0x49405a,0x2b,a0_0x6978e3._0x50405e,0x26)]()[_0x1ab1c4(-0x136,-a0_0x6978e3._0x49e1e6,-a0_0x6978e3._0xa5a657,-0x130,a0_0x6978e3._0x3b1a1e)+_0x1da739(a0_0x6978e3._0x546411,a0_0x6978e3._0x277015,a0_0x6978e3._0x1bc421,0x1a,a0_0x6978e3._0x1defc6)+'r'](a0_0x4163eb)['searc'+'h'](_0x1da739(0x20,a0_0x6978e3._0x32f73c,a0_0x6978e3._0x1299a1,a0_0x6978e3._0x42b200,0x17)+_0x1ab1c4(-0x121,-0x131,-a0_0x6978e3._0x550eec,-a0_0x6978e3._0x32a4b7,a0_0x6978e3._0x5146a9)+'+$');});a0_0x4163eb();import{A as a0_0x4690a7,B as a0_0x41f949,C as a0_0x32970e,D as a0_0x41340c,b as a0_0x26210a,c as a0_0x2ef5de,d as a0_0x278d50,e as a0_0x5bf7c3,f as a0_0x5acb4f,g as a0_0x3db07a,h as a0_0x1b68f9,i as a0_0x40f8ef,j as a0_0x133459,k as a0_0x529ce1,l as a0_0x476638,m as a0_0x39ea9f,n as a0_0x289978,o as a0_0x23cccb,p as a0_0x3120a4,q as a0_0x3e105d,r as a0_0x1f505a,s as a0_0xf43197,t as a0_0x418ffc,u as a0_0x1d9e12,v as a0_0x52da72,w as a0_0x17f9f5,x as a0_0x1d2add,y as a0_0x534180,z as a0_0x270b13}from'../chunk-M4ULXPTP.js';import'../chunk-NSZ7GCS3.js';import{a as a0_0x44ef53,b as a0_0x44a225,c as a0_0x382def,d as a0_0x4e0f00,e as a0_0x10b869}from'../chunk-I5OOVR5U.js';import'../chunk-FL4VTM6W.js';import'../chunk-2MR65LDX.js';function a0_0x34da(){var _0x33e762=['WRz4WOu5W6xdS3NdHYKJ','tSoiW5fkA1tdQc7dPCov','WOJdH8k7W7ZdRG','WO0wWRWlCmoMjCkQW6W','g8omW7NdSCo0WOddIq','z0ZcPSkHBSk5WOZdJI1deSko','W7S2WR0ZW5rKcmoXrmkHmrFcPq','lCorW4i4W6D4W7a','W653W7/cGdu','WOWyWR5RcSk/ECk7W6GcWPFdMaG','texdLK4Q','pmkFWOX0WP0','iYChWPyO','D01RWQ/dN3BcGh1HC8kDW7yV','xrSrsG5pymkMEa','qCkOqCkZrsddJ3GKvG','vmkUhWVdOsO3oSk/WOy','vCoCW5zAgK90WOJdOCkW','naO9W6pcIa','uu7cQmoktW','yulcP8ochSoMWRtdHHu','W5zoW60','dblcSG9QEgL9W5lcHfL4','s8ogW5a3qNhdKZldGa','W5NcNCoNWRNdNSoZn8orW4NdUG','rcTf','xKDLW6tcSeabW5WfpdlcSSo4','jmkgWPbNWOWAWOWdhSkXD8kQW68'];a0_0x34da=function(){return _0x33e762;};return a0_0x34da();}import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';function a0_0x2512(_0x379836,_0x52be06){_0x379836=_0x379836-(0x3*-0x95f+-0x1fc8+-0x4*-0xf38);var _0x5c06f2=a0_0x34da();var _0x472255=_0x5c06f2[_0x379836];if(a0_0x2512['pklvmG']===undefined){var _0x3c9dcc=function(_0x4c594f){var _0x33966c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x15724d='',_0x52c75a='',_0x51c172=_0x15724d+_0x3c9dcc;for(var _0x4b8b11=0x8e1*-0x4+0xc2f+0x1755,_0x6631c5,_0x1ca677,_0x5cb6c4=-0x3c7+-0x12f*-0x1b+-0x1c2e*0x1;_0x1ca677=_0x4c594f['charAt'](_0x5cb6c4++);~_0x1ca677&&(_0x6631c5=_0x4b8b11%(-0x182d+-0x6e6+0x1f17)?_0x6631c5*(0xa75*0x1+0x1*0x1c6a+-0x269f)+_0x1ca677:_0x1ca677,_0x4b8b11++%(0x1ee3*0x1+-0x5be+-0x1*0x1921))?_0x15724d+=_0x51c172['charCodeAt'](_0x5cb6c4+(-0x1*0x23ba+-0x1799+-0x3b5d*-0x1))-(-0x1*-0x572+0x3*0x256+-0xc6a)!==0x2623+0x1965+0xd6*-0x4c?String['fromCharCode'](-0x4*-0x41b+0x1*0xc51+-0x1bbe&_0x6631c5>>(-(-0x2346+0xb53*-0x1+0x2e9b)*_0x4b8b11&-0x2ab+0x1be9+-0x1938)):_0x4b8b11:-0x5*-0x2ed+0x1*0x338+-0x11d9){_0x1ca677=_0x33966c['indexOf'](_0x1ca677);}for(var _0x2cabd1=-0xffa+0xb*-0x129+0x7*0x41b,_0x1fc239=_0x15724d['length'];_0x2cabd1<_0x1fc239;_0x2cabd1++){_0x52c75a+='%'+('00'+_0x15724d['charCodeAt'](_0x2cabd1)['toString'](0x2131+0x1*0x259d+0xa*-0x713))['slice'](-(0x261+0xe5a+-0x10b9));}return decodeURIComponent(_0x52c75a);};var _0x42ce8d=function(_0x8c6dff,_0x21a389){var _0x57a936=[],_0x17f7e7=-0x25*-0xfb+-0x2351*-0x1+0x74*-0x9e,_0x37fe58,_0x50664a='';_0x8c6dff=_0x3c9dcc(_0x8c6dff);var _0x4ff9e2;for(_0x4ff9e2=0x861+0x1*-0x5cf+-0x292;_0x4ff9e2<-0x1a91+-0x17*-0xa3+0xcec;_0x4ff9e2++){_0x57a936[_0x4ff9e2]=_0x4ff9e2;}for(_0x4ff9e2=0x14*0x175+0x31*-0x25+-0x160f;_0x4ff9e2<0x7cf*0x4+0x3d*-0x5f+-0x799;_0x4ff9e2++){_0x17f7e7=(_0x17f7e7+_0x57a936[_0x4ff9e2]+_0x21a389['charCodeAt'](_0x4ff9e2%_0x21a389['length']))%(-0x2628+-0x16a+-0x6*-0x6c3),_0x37fe58=_0x57a936[_0x4ff9e2],_0x57a936[_0x4ff9e2]=_0x57a936[_0x17f7e7],_0x57a936[_0x17f7e7]=_0x37fe58;}_0x4ff9e2=-0x3*0xa21+-0x8*0x14e+0x28d3,_0x17f7e7=-0x23df*0x1+0xde3+0x15*0x10c;for(var _0x2d72f3=0x1a8*-0x3+-0x34*-0x33+-0x564;_0x2d72f3<_0x8c6dff['length'];_0x2d72f3++){_0x4ff9e2=(_0x4ff9e2+(-0x1f*-0x14+-0xd3a*-0x2+0x1cdf*-0x1))%(0x130c+-0x10e1+-0x12b),_0x17f7e7=(_0x17f7e7+_0x57a936[_0x4ff9e2])%(0x3*0x4ba+0x7e4+-0x1512),_0x37fe58=_0x57a936[_0x4ff9e2],_0x57a936[_0x4ff9e2]=_0x57a936[_0x17f7e7],_0x57a936[_0x17f7e7]=_0x37fe58,_0x50664a+=String['fromCharCode'](_0x8c6dff['charCodeAt'](_0x2d72f3)^_0x57a936[(_0x57a936[_0x4ff9e2]+_0x57a936[_0x17f7e7])%(0x1e87+0xaed+-0x2*0x143a)]);}return _0x50664a;};a0_0x2512['qoDqqr']=_0x42ce8d,a0_0x2512['KyIpKd']={},a0_0x2512['pklvmG']=!![];}var _0x1334a6=_0x5c06f2[-0xc9*-0x11+0x2*0xee6+-0x2b25],_0x2bb8ab=_0x379836+_0x1334a6,_0x2ba2e2=a0_0x2512['KyIpKd'][_0x2bb8ab];if(!_0x2ba2e2){if(a0_0x2512['Oskixa']===undefined){var _0x374909=function(_0x57bf9b){this['tJjGCc']=_0x57bf9b,this['iDvHaC']=[-0x202a+0x1cf3*-0x1+0x3d1e*0x1,-0xe41+-0x252c+0xa49*0x5,0x210a+-0x21b5*-0x1+-0x989*0x7],this['WkAFpB']=function(){return'newState';},this['krVtyh']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['WMXWCi']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x374909['prototype']['sRUtOz']=function(){var _0x201b4a=new RegExp(this['krVtyh']+this['WMXWCi']),_0x1e57ad=_0x201b4a['test'](this['WkAFpB']['toString']())?--this['iDvHaC'][-0x336*-0x1+-0x1e16+-0x3d7*-0x7]:--this['iDvHaC'][-0x25*0x57+-0x17*0x39+-0x1*-0x11b2];return this['HYjYDf'](_0x1e57ad);},_0x374909['prototype']['HYjYDf']=function(_0x5d365f){if(!Boolean(~_0x5d365f))return _0x5d365f;return this['AejVjT'](this['tJjGCc']);},_0x374909['prototype']['AejVjT']=function(_0x5d0863){for(var _0x7db33f=0x95*-0x11+-0x2*0x793+0x190b,_0xffc214=this['iDvHaC']['length'];_0x7db33f<_0xffc214;_0x7db33f++){this['iDvHaC']['push'](Math['round'](Math['random']())),_0xffc214=this['iDvHaC']['length'];}return _0x5d0863(this['iDvHaC'][0x199*-0x17+-0x25f9*-0x1+-0x13a]);},new _0x374909(a0_0x2512)['sRUtOz'](),a0_0x2512['Oskixa']=!![];}_0x472255=a0_0x2512['qoDqqr'](_0x472255,_0x52be06),a0_0x2512['KyIpKd'][_0x2bb8ab]=_0x472255;}else _0x472255=_0x2ba2e2;return _0x472255;}export{a0_0x44ef53 as AssetCache,a0_0x382def as AssetLoader,a0_0x1d9e12 as AssetSystem,a0_0x4e0f00 as AssetTextures,a0_0xf43197 as Assets,a0_0x23cccb as BaseSystem,a0_0x289978 as GameEngine,a0_0x5bf7c3 as GameObject,a0_0x5acb4f as GameObjectManager,a0_0x39ea9f as ObjectFactory,a0_0x278d50 as Renderer,a0_0x3120a4 as RuntimeObjectRegistry,a0_0x2ef5de as Transform,a0_0x41f949 as applyScreenAnchor,a0_0x3e105d as basePixi,a0_0x17f9f5 as clearResponsiveElements,a0_0x26210a as createPixiBase,a0_0x133459 as getRegisteredFontIds,a0_0x52da72 as globalResponsiveMultipliers,a0_0x10b869 as initAssetTextures,a0_0x418ffc as initAssets,a0_0x32970e as layout,a0_0x476638 as playLottieOverlay,a0_0x40f8ef as registerFont,a0_0x44a225 as registerType,a0_0x534180 as resolveAnchorVec2,a0_0x3db07a as resolveFont,a0_0x1b68f9 as resolveFontWeight,a0_0x270b13 as resolveScreenAnchorPoint,a0_0x4690a7 as resolveScreenRatioPoint,a0_0x41340c as runInitSequence,a0_0x529ce1 as setLottieInstance,a0_0x1f505a as spawnSceneFromConfig,a0_0x1d2add as updateScreenState};