handler-playable-sdk 1.0.101 → 1.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RZAAEBBT.js → chunk-NOMTJOWU.js} +15 -5
- package/dist/cli/brand-dna.mjs +1 -1
- package/dist/cli/canva-import.mjs +1 -1
- package/dist/cli/cleanup-assets.mjs +1 -1
- package/dist/cli/fix-scales.mjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/screen-helper.mjs +1 -1
- package/dist/cli/setup-library.mjs +1 -1
- package/dist/cli/student-helper/add-logic.mjs +1 -1
- package/dist/cli/student-helper/add-object.mjs +1 -1
- package/dist/cli/student-helper/arg-parsing.mjs +1 -1
- package/dist/cli/student-helper/asset-registry.mjs +1 -1
- package/dist/cli/student-helper/bullet-system.mjs +1 -1
- package/dist/cli/student-helper/collectable-system.mjs +1 -1
- package/dist/cli/student-helper/constants.mjs +1 -1
- package/dist/cli/student-helper/drag-snap-couples.mjs +1 -1
- package/dist/cli/student-helper/endgame-screen.mjs +1 -1
- package/dist/cli/student-helper/fs-io.mjs +1 -1
- package/dist/cli/student-helper/logic-defaults.mjs +1 -1
- package/dist/cli/student-helper/print-help.mjs +1 -1
- package/dist/cli/student-helper/prompts.mjs +1 -1
- package/dist/cli/student-helper/scratch-card.mjs +1 -1
- package/dist/cli/student-helper/screen-utils.mjs +1 -1
- package/dist/cli/student-helper/snippets.mjs +1 -1
- package/dist/cli/student-helper/start-screen.mjs +1 -1
- package/dist/cli/student-helper/swerve-collect.mjs +1 -1
- package/dist/cli/student-helper/tap-destroy.mjs +1 -1
- package/dist/cli/student-helper/template-packs.mjs +1 -1
- package/dist/cli/student-helper.mjs +1 -1
- package/dist/cli/sync-screens.mjs +1 -1
- package/dist/cli/validate-assets.mjs +1 -1
- package/dist/cli/validate.mjs +1 -1
- package/dist/index.cjs +15 -5
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +1 -1
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +10 -10
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -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 i;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=(i=this.modal)==null?void 0:i.querySelector(".asset-crop-preview-canvas");if(t){let n=t.getContext("2d");n&&(n.fillStyle="rgba(255, 0, 0, 0.2)",n.fillRect(0,0,t.width,t.height))}}initializeCrop(){var i;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),(i=this.options)!=null&&i.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(e){if(!this.image)return;let t=this.image.width/this.image.height,i=this.cropX+this.cropWidth/2,n=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,i-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,n-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,i=this.cropWidth*this.scale,n=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,i,n),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(e,t,i,n),this.ctx.fillStyle="#ffffff";let a=8;[[e,t],[e+i-a,t],[e,t+n-a],[e+i-a,t+n-a]].forEach(([o,l])=>{var c;(c=this.ctx)==null||c.fillRect(o,l,a,a)})}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 i=150;e.width=i,e.height=i,t.clearRect(0,0,i,i);let n=i/this.cropWidth,a=i/this.cropHeight,s=Math.min(n,a),o=this.cropWidth*s,l=this.cropHeight*s,c=(i-o)/2,d=(i-l)/2;try{t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,c,d,o,l)}catch(p){console.error("[AssetCropModal] Error drawing preview:",p),t.fillStyle="rgba(255, 0, 0, 0.2)",t.fillRect(0,0,i,i)}}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",i=>{let n=parseFloat(i.target.value);this.setZoom(n)});let t=this.modal.querySelector(".asset-crop-aspect-select");t==null||t.addEventListener("change",i=>{let n=i.target.value;this.setAspectRatio(n)}),this.modal.addEventListener("click",i=>{switch(i.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",i=>{i.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,i=e.clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,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,i=e.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,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 n;if(!this.image||!((n=this.options)!=null&&n.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 i=e.toDataURL("image/png");this.options.onCrop(i),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(r){new Ri().open(r)}});var Bl={};ot(Bl,{COLORS:()=>Le,ConfigWatcher:()=>tt,DebugPanel:()=>Jt,DefaultReloadStrategy:()=>Gt,Handler:()=>ye,PlayableLoadingScreen:()=>xn,PreviewShell:()=>yn,STROKE_WIDTH:()=>qr,THEME:()=>Vr,applyConfigOverride:()=>le,applyConfigOverrides:()=>He,applyConfigsToDisk:()=>Ai,applyDefaults:()=>et,baseLottie:()=>jn,bootstrap:()=>Ml,clearConfigOverrides:()=>ge,clearConfigOverridesForObject:()=>Bs,configOverrideManager:()=>Gs,createPreviewShell:()=>Ga,deepClone:()=>ee,default:()=>We,defaultPreset:()=>ji,deviceGroups:()=>da,devicePresets:()=>ca,diffConfigs:()=>na,exportConfigsAsJSON:()=>Jn,exportConfigsFromActiveCache:()=>Qe,getConfigOverrides:()=>oe,getConfigStateSummary:()=>Fe,getOverrideMode:()=>Nt,getPresetById:()=>it,getPresetsByCategory:()=>sl,loadAllObjectConfigs:()=>Ii,loadComponentSchemas:()=>Ti,loadEngineConfig:()=>ki,loadGamePromptConfig:()=>ea,loadObjectCentricConfig:()=>_e,loadObjectConfig:()=>Be,loadSceneConfig:()=>Pi,redoLastConfigChange:()=>Ci,rehydrateObject:()=>aa,removeConfigOverride:()=>Ht,resetToApplied:()=>Ft,resetToOriginal:()=>Li,setBootstrapDependencies:()=>kl,setOverrideMode:()=>Xn,setupHotReload:()=>oa,setupLiveEditBridge:()=>vn,toLegacyFormat:()=>ta,trackObjectCreation:()=>Us,trackObjectDeletion:()=>qs,undoLastConfigChange:()=>Ei,validateObjectConfig:()=>ht});module.exports=go(Bl);var $e={};function li(r,e,t=!1){$e[r]||($e[r]=[]),$e[r].push({fn:e,once:t})}function In(r,e){if($e[r]){if(!e){delete $e[r];return}$e[r]=$e[r].filter(t=>t.fn!==e)}}function ci(r,...e){let t=$e[r];if(t)for(let i of[...t])i.fn(...e),i.once&&In(r,i.fn)}function ce(r,e){li(r,e,!0)}var ie=null,me=[],ct=null;function rs(r){ie=r,me=[],ct!==null&&(clearTimeout(ct),ct=null)}function os(){var r,e,t;return{endpoint:(ie==null?void 0:ie.endpoint)||"",transport:(ie==null?void 0:ie.transport)||"beacon",batchSize:(r=ie==null?void 0:ie.batchSize)!=null?r:10,flushIntervalMs:(e=ie==null?void 0:ie.flushIntervalMs)!=null?e:300,maxQueue:(t=ie==null?void 0:ie.maxQueue)!=null?t:200,debug:!!(ie!=null&&ie.debug)}}async function as(r,e,t,i){let n=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(r,new Blob([n],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",a,e);return}catch(a){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(a){i&&console.warn("[handler.telemetry] fetch failed",a)}}function kn(r,e){let t=os();if(e&&t.endpoint){if(me.push(r),me.length>t.maxQueue&&(me=me.slice(me.length-t.maxQueue)),me.length>=t.batchSize){ss();return}ct===null&&(ct=window.setTimeout(()=>{ct=null,ss()},t.flushIntervalMs))}}async function ss(){let r=os();if(!r.endpoint||me.length===0)return;let e=me.splice(0,r.batchSize);await as(r.endpoint,{events:e},r.transport,r.debug),me.length>0&&await as(r.endpoint,{events:me.splice(0,r.batchSize)},r.transport,r.debug)}function ls(r){return Math.max(0,Math.min(1,r))}function ho(r){let e=String(r!=null?r:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return n=>1+(i+1)*Math.pow(n-1,3)+i*Math.pow(n-1,2)}return t=>1-(1-t)*(1-t)}function _t(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function fo(r,e){let t=r==null?void 0:r[e];return typeof t=="number"?t:0}function cs(r,e,t){try{r[e]=t}catch{}}function mo(r){let e=r==null?void 0:r.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ds(r,e){let t=r==null?void 0:r.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 ps(r,e){let t=mo(r);if(!t)return{from:null,to:null};let i=null,n=null;return typeof e.scale=="number"?(i=e.scale,n=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(n=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(n=e.scaleY),i===null&&n===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:n!=null?n:t.y}}}function us(){let r=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),r.size>0&&i()})},n=d=>{var u;r.add(d);let p=(u=e.get(d.target))!=null?u:new Set;p.add(d),e.set(d.target,p),i()},a=d=>{r.delete(d);let p=e.get(d.target);p&&(p.delete(d),p.size===0&&e.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var p,u;let d=_t();for(let g of Array.from(r)){if(g.killed||g.paused)continue;let h=d-g.startMs-g.delayMs;if(h<0)continue;let f=g.durationMs>0?h/g.durationMs:1,m=ls(f),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let P=f-y;m=ls(P)}let w=g.ease(m);g.yoyo&&y%2===1&&(w=1-w);for(let P of g.props)cs(g.target,P.key,P.from+(P.to-P.from)*w);g.scaleFrom&&g.scaleTo&&ds(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*w,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*w});try{(p=g.onUpdate)==null||p.call(g)}catch{}if(f>=b){s(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(d,p,u)=>{var P;let g=Math.max(0,(typeof p.duration=="number"?p.duration:.5)*1e3),h=Math.max(0,(typeof p.delay=="number"?p.delay:0)*1e3+((P=u==null?void 0:u.delayMsOverride)!=null?P:0)),f=ho(p.ease),m=typeof p.repeat=="number"?Math.max(0,p.repeat|0):0,b=p.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),w=[];for(let I of Object.keys(p)){if(y.has(I))continue;let _=p[I];typeof _=="number"&&w.push({key:I,from:fo(d,I),to:_})}let v=ps(d,p);return{target:d,startMs:_t(),delayMs:h,durationMs:g,ease:f,props:w,scaleFrom:v.from,scaleTo:v.to,repeat:m,yoyo:b,onUpdate:typeof p.onUpdate=="function"?p.onUpdate:void 0,onComplete:typeof p.onComplete=="function"?p.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,p){let u=l(d,p);return n(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=_t())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:_t(),h=_t()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(d,p,u){return c.set(d,p),c.to(d,u)},set(d,p){if(!d||!p)return;for(let g of Object.keys(p)){let h=p[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&cs(d,g,h)}let u=ps(d,p);u.to&&ds(d,u.to)},killTweensOf(d){let p=e.get(d);if(p)for(let u of Array.from(p))s(u)},timeline(d={}){let p=[],u=0,g=!1,h=[],f=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let w=typeof y=="string"?y.trim():"";return w.startsWith("+=")?u+Math.max(0,Number(w.slice(2))*1e3||0):w?Math.max(0,Number(w)*1e3||0):u},m=y=>{p.push(y);let w=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+w)},b={to(y,w,v){return m({kind:"to",target:y,vars:w,atMs:f(v)}),b},fromTo(y,w,v,P){return m({kind:"fromTo",target:y,vars:v,from:w,atMs:f(P)}),b},play(){var y,w;if(g)return b;g=!0,h=[];for(let v of p)v.kind==="fromTo"&&c.set(v.target,(y=v.from)!=null?y:{}),h.push(c.to(v.target,{...v.vars,delay:v.atMs/1e3+((w=v.vars.delay)!=null?w:0)}));return b},pause(){for(let y of h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return d.paused||b.play(),b}};return c}function gs(){if(typeof window=="undefined")return;let r=window;if(!r.gsap)try{r.gsap=us()}catch{}}var hs={name:"handler-playable-sdk",version:"1.0.101",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 de=0,yo=de++,fs=de++,ms=de++,bs=de++,ys=de++,vs=de++,ws=de++,xs=de++,Ss=de++,Es=de++,Cs=de++,As=de++,Z=yo;function Ls(){return Z===fs}function Ts(){return Z===ms}function Is(){return Z===bs}function ks(){return Z===ys}function dt(){return Z===vs}function pt(){return Z===ws}function Ps(){return Z===xs}function Ms(){return Z===Ss}function js(){return Z===Es}function Pn(){return Z===Cs}function Mn(){return Z===As}function _s(){let r=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(r==="mraid")try{mraid.getState(),Z=fs;return}catch{}else if(r==="dapi")try{dapi.isReady(),Z=ms;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(Z=bs)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(Z=ys)}catch{}else if(e==="mintegral")window.gameReady&&(Z=vs);else if(e==="tapjoy")window.TJ_API&&(Z=ws);else if(e==="tiktok")window.openAppStore&&(Z=xs);else if(e==="smadex")try{window.smxTracking&&(Z=Ss)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(Z=Es)}catch{}else e==="vungle"?Z=Cs:(r==="nucleo"||e==="nucleo")&&(Z=As)}var di=lt(require("lottie-web"),1),jn=di.default;typeof window!="undefined"&&(window.lottie=di.default,window.__baseLottie=di.default);var vo=require("pixi.js");var _n=require("pixi.js");var wo=null;function On(r){wo=r}ui();pi();var Ot=require("pixi.js");ui();var Lo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Dn=Lo;if(typeof window!="undefined")try{let r=new XMLHttpRequest;if(r.open("GET","./build-settings.json",!1),r.send(),r.status===200&&r.responseText){let e=JSON.parse(r.responseText);e!=null&&e.buildMode&&(Dn=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Dn}`))}}catch{}function To(r){var t,i,n,a,s;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(r);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(r))return{x:(t=r[0])!=null?t:.5,y:(i=r[1])!=null?i:.5};if(r&&typeof r=="object"&&"x"in r&&"y"in r)return{x:(n=r.x)!=null?n:.5,y:(a=r.y)!=null?a:.5};if(typeof r=="string"){let o=r.trim().toLowerCase();return(s=e[o])!=null?s:{x:.5,y:.5}}return null}var Se=class{static async create(e,t,i){var l,c,d,p,u,g,h;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${Dn}`);let n=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!n){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let f=new Ot.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let a=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${a}, type: ${n.type}, path: ${n.path}`);let s=await Xe.load(e,n,i,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(n.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",e),o=new Ot.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(p=o==null?void 0:o.constructor)==null?void 0:p.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(n.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=s==null?void 0:s.constructor)==null?void 0:u.name,s),s&&(((g=s.constructor)==null?void 0:g.name)==="Container"||s instanceof Ot.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[n.path,`/assets/${n.path}`,`assets/${n.path}`,`../assets/${n.path}`],m=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(h=o==null?void 0:o.constructor)==null?void 0:h.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=s)}else o=s;else o=s,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,i){var n,a,s,o;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(n=t.position.x)!=null?n:0,e.y=(a=t.position.y)!=null?a:0):"position"in e&&e.position&&e.position.set((s=t.position.x)!=null?s:0,(o=t.position.y)!=null?o:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=To(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Rt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Po=lt(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Po);ut();var gi=require("pixi.js");ut();var Fn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Rt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(n=>!this.instanceCache.has(n));if(t.length===0)return;let i=async n=>{n.length&&(console.log("[Assets] Loading objects:",n),await Promise.all(n.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let l=await Se.create(a,s,this.app);this.instanceCache.set(a,l),console.log("[Assets] Loaded object:",a,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",a,l)}})))};return this.readyPromise=(async()=>{await i(t);let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));n.length>0&&(console.warn("[Assets] Retrying missing assets:",n),await i(n)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Se.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Mo=new Fn,jo=new Proxy(Mo,{get(r,e){if(e in r&&typeof r[e]=="function")return r[e].bind(r);if(r.get(e))return r.get(e)}});ut();var Oo=require("pixi.js"),ke={width:400,height:600,designWidth:400,scaleFactor:1},fi={scale:1,position:1},Gn=[];function Ro(r,e,t,i,n,a,s){Gn.push({element:r,originalScale:a,positionHelper:e,heightPercent:n}),e(r,t,i,n,a,s,!1)}function zo(){Gn.forEach(({element:r,originalScale:e,positionHelper:t,heightPercent:i})=>{let n=e*ke.scaleFactor;t(r,ke.width,ke.height,i,n,!0,!1)})}function Bn(r,e){console.log(`[SCREEN] updateScreenState called: ${r}x${e}`),ke.width=r,ke.height=e,ke.scaleFactor=Math.min(r/ke.designWidth,1.15),fi.scale=ke.scaleFactor,fi.position=1,console.log(`[SCREEN] Global multipliers - scale: ${fi.scale.toFixed(3)}`),zo()}var $t={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 $o(r,e,t){let i=$t[r];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${r}.${e} = ${t}`))}function Do(){return $t}var No={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 hi(r,e){return typeof r=="number"&&Number.isFinite(r)?r:e}function Ze(r,e={x:.5,y:.5}){var t;if(Array.isArray(r))return{x:hi(r[0],e.x),y:hi(r[1],e.y)};if(r&&typeof r=="object"){let i=r;return{x:hi(i.x,e.x),y:hi(i.y,e.y)}}if(typeof r=="string"){let i=r.trim().toLowerCase();return(t=No[i])!=null?t:e}return e}function Ne(r,e,t,i={}){var g,h,f,m,b,y;let n=Ze(t),a=(g=i.inset)!=null?g:{},s=(h=i.padding)!=null?h:{x:0,y:0},o=((f=a.left)!=null?f:0)+s.x,l=((m=a.right)!=null?m:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,p=Math.max(0,r-o-l),u=Math.max(0,e-c-d);return{x:o+p*n.x,y:c+u*n.y}}function gt(r,e,t,i={}){var f,m,b,y,w,v;let n=(f=i.inset)!=null?f:{},a=(m=i.padding)!=null?m:{x:0,y:0},s=((b=n.left)!=null?b:0)+a.x,o=((y=n.right)!=null?y:0)+a.x,l=((w=n.top)!=null?w:0)+a.y,c=((v=n.bottom)!=null?v:0)+a.y,d=Math.max(0,r-s-o),p=Math.max(0,e-l-c),u=Ze(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:s+d*g,y:l+p*h}}if(typeof window!="undefined"){let r=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,n=window.innerHeight;(i!==r||n!==e)&&(r=i,e=n,Bn(i,n))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),Bn(window.innerWidth,window.innerHeight),window.updateDebugConfig=$o,window.getDebugConfig=Do,window.copyConfig=Xo,window.applyConfig=zt,window.applyConfigForRatio=Jo,window.positionAtBottom=Ns,window.positionAtTop=Bo,window.positionAtCenter=Go,window.positionAtLeft=Uo,window.positionAtRight=qo,window.positionAtBottomLeft=Vo,window.positionAtBottomRight=Yo,window.positionAtTopLeft=Wo,window.positionAtTopRight=Ko,window.applyPositionContract=Fo,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 mi(r,e,t=0){return r*e+t}function bi(r,e,t=0){return r*(1-e)+t}function yi(r,e,t=0){return r*e+t}function vi(r,e,t=0){return r*(1-e)+t}function ue(r,e=0){return r/2+e}function Ho(r,e){return r*e}function Fo(r,e,t,i){var s,o,l,c,d,p,u,g,h,f,m,b,y,w,v,P,I,_,k,j;let n=0,a=0;switch(i.type){case"top":n=ue(e,(o=(s=i.offset)==null?void 0:s.x)!=null?o:0),a=mi(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":n=ue(e,(p=(d=i.offset)==null?void 0:d.x)!=null?p:0),a=bi(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":n=yi(e,i.percent,(f=(h=i.offset)==null?void 0:h.x)!=null?f:0),a=ue(t,(b=(m=i.offset)==null?void 0:m.y)!=null?b:0);break;case"right":n=vi(e,i.percent,(w=(y=i.offset)==null?void 0:y.x)!=null?w:0),a=ue(t,(P=(v=i.offset)==null?void 0:v.y)!=null?P:0);break;case"center":n=ue(e,(_=(I=i.offset)==null?void 0:I.x)!=null?_:0),a=ue(t,(j=(k=i.offset)==null?void 0:k.y)!=null?j:0);break}r.position?r.position.set(n,a):(r.x=n,r.y=a),i.scale!==void 0&&i.scale!==1&&r.scale&&(typeof r.scale.set=="function"?r.scale.set(i.scale,i.scale):(r.scale.x=i.scale,r.scale.y=i.scale))}function Ns(r,e,t,i=.2,n=1,a=!0,s=!1){let o=Ho(t,i),l=bi(t,i/2);Pe(r,ue(e),l);let c=a?n*ke.scaleFactor:n;Me(r,c),s&&!Gn.find(d=>d.element===r)&&Ro(r,Ns,e,t,i,n,a)}function Bo(r,e,t,i=.1,n=1){Pe(r,ue(e),mi(t,i)),Me(r,n)}function Go(r,e,t,i=0,n=0,a=1){Pe(r,ue(e,i),ue(t,n)),Me(r,a)}function Uo(r,e,t,i=.1,n=1){Pe(r,yi(e,i),ue(t)),Me(r,n)}function qo(r,e,t,i=.1,n=1){Pe(r,vi(e,i),ue(t)),Me(r,n)}function Vo(r,e,t,i=.05,n=.05,a=1){Pe(r,yi(e,n),bi(t,i)),Me(r,a)}function Yo(r,e,t,i=.05,n=.05,a=1){Pe(r,vi(e,n),bi(t,i)),Me(r,a)}function Wo(r,e,t,i=.05,n=.05,a=1){Pe(r,yi(e,n),mi(t,i)),Me(r,a)}function Ko(r,e,t,i=.05,n=.05,a=1){Pe(r,vi(e,n),mi(t,i)),Me(r,a)}function Pe(r,e,t){r&&r.position?typeof r.position.set=="function"?r.position.set(e,t):(r.position.x=e,r.position.y=t):r&&(r.x=e,r.y=t)}function Me(r,e){e!==1&&r&&r.scale&&(typeof r.scale.set=="function"?r.scale.set(e,e):r.scale.x!==void 0&&r.scale.y!==void 0&&(r.scale.x=e,r.scale.y=e))}var Je={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 Xo(r){return r&&Je[r]?JSON.parse(JSON.stringify(Je[r])):JSON.parse(JSON.stringify($t))}function zt(r){Object.keys(r).forEach(e=>{let t=e;$t[t]&&r[t]&&Object.assign($t[t],r[t])}),console.log("Config applied:",r)}function Jo(r,e){let t=r/e;t>1.6?(zt(Je.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(zt(Je.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(zt(Je.square),console.log("Applied SQUARE config for ratio:",t)):(zt(Je.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let r=window;r.configPresets=Je,r.resolveAnchorVec2=r.resolveAnchorVec2||Ze,r.resolveScreenAnchorPoint=r.resolveScreenAnchorPoint||Ne,r.resolveScreenRatioPoint=r.resolveScreenRatioPoint||gt}Mi();function ne(r,e){let t=(n,a)=>a===0?n:t(a,n%a),i=t(r,e);return`${r/i}:${e/i}`}var bd=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:ne(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:ne(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:ne(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:ne(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:ne(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:ne(360,780)}],yd=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:ne(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:ne(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:ne(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:ne(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:ne(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:ne(412,915)}],vd=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:ne(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:ne(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:ne(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:ne(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:ne(800,1280)}],la=[{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:ne(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:ne(768,1024),mraidScale:.7}];var ca=[...la],da=[{category:"playable",label:"Playable Ad",devices:la}],ji=la[0];function it(r){return ca.find(e=>e.id===r)||ji}function sl(r){return ca.filter(e=>e.category===r)}ae();var Ce=class{async updateProperty(e,t,i,n={}){var l,c,d,p,u,g,h,f,m,b,y,w;console.log("[PropertyUpdateManager] Updating:",e,t,i);let a=window.getEditableObjectConfig;if(typeof a!="function"){console.error("[PropertyUpdateManager] getEditableObjectConfig not available");return}let s=a(e);if(!s){console.error("[PropertyUpdateManager] Config not found for:",e);return}if(le({objectId:e,path:t,value:i},{persist:!0}),t==="transform"||t.startsWith("transform.")){console.log("[DEBUG FALLBACK] PropertyUpdateManager SKIP applyEditableObjectConfig (transform path)",t,e);let v=s==null?void 0:s.motion;if(v&&typeof v=="object"&&v.enabled!==!1&&(((p=v==null?void 0:v.intro)==null?void 0:p.enabled)===!0||((u=v==null?void 0:v.pulse)==null?void 0:u.enabled)===!0||((g=v==null?void 0:v.swing)==null?void 0:g.enabled)===!0||((h=v==null?void 0:v.continuousMove)==null?void 0:h.enabled)===!0||((f=v==null?void 0:v.continuousRotate)==null?void 0:f.enabled)===!0||((m=v==null?void 0:v.orbit)==null?void 0:m.enabled)===!0)){let _=window.applyEditableObjectConfig;if(typeof _=="function"){let k=window.__editableConfig,j=(w=(y=(b=k==null?void 0:k.objects)==null?void 0:b.get)==null?void 0:y.call(b,e))!=null?w:s;await _(e,j),console.log("[PropertyUpdateManager] Applied config for motion object")}}n.refreshInspector||requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e}}))})}else{let v=window.applyEditableObjectConfig;if(typeof v=="function"){let P=window.__editableConfig,I=(d=(c=(l=P==null?void 0:P.objects)==null?void 0:l.get)==null?void 0:c.call(l,e))!=null?d:s;await v(e,I),console.log("[PropertyUpdateManager] Applied config successfully")}else console.warn("[PropertyUpdateManager] applyEditableObjectConfig not available")}this.triggerRefresh(e),n.refreshInspector&&window.dispatchEvent(new CustomEvent("inspector:refresh"))}getNestedProperty(e,t){let i=t.split("."),n=e;for(let a of i)if(n&&typeof n=="object"&&a in n)n=n[a];else return;return n}triggerRefresh(e){let t=window.__refreshHierarchy;typeof t=="function"&&t(),window.dispatchEvent(new CustomEvent("inspector:property-updated",{detail:{objectId:e}}))}};function pa(r){let e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=async t=>{var a;let i=(a=t.target.files)==null?void 0:a[0];if(!i)return;let n=new FileReader;n.onload=async()=>{var g,h,f,m;let s=n.result;if(!s||typeof s!="string"){alert("Failed to read file: Invalid data URL"),console.error("[QuickActionsBar] Invalid data URL:",typeof s,s==null?void 0:s.substring(0,50));return}if(!s.startsWith("data:image/")){alert("Invalid file format: Not an image file"),console.error("[QuickActionsBar] Invalid data URL format:",s.substring(0,100));return}let o=s.match(/^data:image\/[^;]+;base64,(.+)$/);if(!o||!o[1]||o[1].length===0){alert("Failed to read file: Invalid base64 data"),console.error("[QuickActionsBar] Invalid base64 data in data URL");return}try{let b=o[1],y=atob(b.substring(0,Math.min(100,b.length)));if(!y||y.length===0)throw new Error("Base64 decode test failed");console.log("[QuickActionsBar] \u2705 Data URL validated, length:",s.length)}catch(b){alert("Failed to read file: Corrupted image data"),console.error("[QuickActionsBar] Base64 validation failed:",b);return}let l=r.category||"misc",c=(r.objectId||"new_asset").replace(/^json\./,"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),d=((g=i.name.toLowerCase().match(/\.(png|jpg|jpeg|gif|webp)$/))==null?void 0:g[1])||"png",p=d==="jpg"?"jpeg":d,u=`${c||"new_asset"}_uploaded_${Date.now()}.${p}`;console.log("[QuickActionsBar] Uploading file:",u,"to category:",l,"data URL length:",s.length);try{let y=await(await fetch("/api/library/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:l,filename:u,data:s,overwrite:!0})})).json();if(!(y!=null&&y.success)){alert(`Upload failed: ${(y==null?void 0:y.error)||"Unknown error"}`);return}await new Promise(x=>setTimeout(x,100));let w=window.addAssetToRegistry;typeof w=="function"&&(w(l,u),console.log("[QuickActionsBar] \u2705 Added to registry:",l,u));let v=window.getEditableAssets;if(typeof v=="function"){let x=v();x&&!x.categories&&(x.categories=[]),x!=null&&x.categories&&!x.categories.includes(l)&&(x.categories.push(l),console.log(`[QuickActionsBar] Added category ${l} to registry`))}let P=!1,I=0,_=10;for(;!P&&I<_;){I++,console.log(`[QuickActionsBar] Refresh attempt ${I}/${_}...`);try{(await fetch("/api/setup-library",{method:"POST",headers:{"Content-Type":"application/json"}})).ok&&console.log("[QuickActionsBar] \u2705 Registry rebuilt from disk")}catch{}await new Promise(C=>setTimeout(C,300));let x=window.refreshAssetLibrary;typeof x=="function"&&(console.log("[QuickActionsBar] Refreshing library panel..."),await x());let S=window.reRenderAssetLibrary;typeof S=="function"&&(console.log("[QuickActionsBar] Re-rendering library panel..."),S());let E=window.getEditableAssets;if(typeof E=="function"){let C=E(),A=((h=C==null?void 0:C.libraryAssets)==null?void 0:h[l])||[];A.some(O=>(O==null?void 0:O.filename)===u)?(console.log("[QuickActionsBar] \u2705 Asset found in registry!"),P=!0):(console.log(`[QuickActionsBar] Asset not found yet, retrying... (found ${A.length} assets in ${l})`),await new Promise(O=>setTimeout(O,500)))}else I>=2&&(P=!0)}P||console.warn("[QuickActionsBar] \u26A0\uFE0F Asset not found in registry after retries, proceeding anyway..."),setTimeout(()=>{try{window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"batch"}})),console.log("[QuickActionsBar] Dispatched config:changed event")}catch(x){console.warn("[QuickActionsBar] Failed to refresh textures:",x)}},300),console.log("[QuickActionsBar] Applying asset to object:",y.path);let k=!1,j=0,L=5;for(;!k&&j<L;){j++;try{await r.onApply(y.path),await new Promise(S=>setTimeout(S,200));let x=window.getEditableObjectConfig;if(typeof x=="function"){let S=x(r.objectId),E=((m=(f=S==null?void 0:S.render)==null?void 0:f.asset)==null?void 0:m.path)||"";E===y.path||E.includes(u)?(console.log("[QuickActionsBar] \u2705 Asset confirmed applied to object"),k=!0):(console.log(`[QuickActionsBar] Asset not applied yet (attempt ${j}), retrying...`),await new Promise(C=>setTimeout(C,300)))}else k=!0}catch(x){console.error(`[QuickActionsBar] Apply attempt ${j} failed:`,x),j<L&&await new Promise(S=>setTimeout(S,500))}}k?console.log("[QuickActionsBar] \u2705 Asset upload and apply complete!"):console.warn("[QuickActionsBar] \u26A0\uFE0F Asset may not have been applied, but upload succeeded")}catch(b){console.error("[QuickActionsBar] Upload error:",b),alert("Upload failed. Check console.")}},n.readAsDataURL(i)},e.click()}var _i=class{constructor(){this.updateManager=new Ce}async handleAction(e,t,i){console.log("[QuickActionsBar] Action:",e,t,i);let n=window.getEditableObjectConfig;if(typeof n!="function")return;let a=n(t);if(!a)return;let s=this.updateManager.getNestedProperty(a,i);if(e==="ai-convert"||e==="upload"||e==="library"){let o=i==="ui.text"||i==="render.asset.path",l=i==="render.asset.path";o&&(await this.prepareForImageConversion(t,a),e==="ai-convert"&&i!=="render.asset.path"&&(i="render.asset.path"))}switch(e){case"library":this.openLibrary(t,i,s);break;case"ai-edit":this.openAIEditor(t,i,s);break;case"upload":this.openUpload(t,i);break;case"reset":await this.resetToDefault(t,i);break;case"ai-convert":this.handleAiConvert(t,i,s);break;default:console.warn("[QuickActionsBar] Unknown action:",e)}}async prepareForImageConversion(e,t){var i,n;if(console.log("[QuickActionsBar] Preparing for image conversion:",e),t.render||(t.render={alpha:1,visible:!0}),(t.render.alpha===0||t.render.alpha===void 0)&&(t.render.alpha=1,await this.updateManager.updateProperty(e,"render.alpha",1)),(t.render.visible===!1||t.render.visible===void 0)&&(t.render.visible=!0,await this.updateManager.updateProperty(e,"render.visible",!0)),t.render.asset||(t.render.asset={type:"image",path:""}),t.render.asset.type!=="image"&&(t.render.asset.type="image",await this.updateManager.updateProperty(e,"render.asset",{type:"image",path:t.render.asset.path||""})),t.ui&&t.ui.renderMode!=="png"){await this.updateManager.updateProperty(e,"ui.renderMode","png",{refreshInspector:!0}),await this.updateManager.updateProperty(e,"render.tint","#ffffff");let s=((n=(i=t.transform)==null?void 0:i.scale)!=null?n:1)*.3;await this.updateManager.updateProperty(e,"transform.scale",s),console.log("[QuickActionsBar] Text to PNG conversion: set tint white, scale",s)}this.ensureSlotInRegistry(e,t)}ensureSlotInRegistry(e,t){var o,l,c;let i=window.getEditableAssets;if(typeof i!="function")return;let n=i();if(!n||!n.slots)return;let a=e.startsWith("json.")?e.replace("json.",""):e;if(!n.slots.some(d=>d.objectId===a||d.slotId===a)){let d=((o=t.identity)==null?void 0:o.category)||"ui";console.log("[QuickActionsBar] Adding new slot to registry for converted object:",a),n.slots.push({slotId:a,displayName:a.replace(/_/g," "),objectId:a,category:d,currentAsset:((c=(l=t.render)==null?void 0:l.asset)==null?void 0:c.path)||"",defaultAsset:"",libraryFolder:d,assetType:"image"}),n.categories&&!n.categories.includes(d)&&n.categories.push(d),n.libraryAssets&&!n.libraryAssets[d]&&(n.libraryAssets[d]=[]);let p=window.reRenderAssetLibrary;typeof p=="function"&&p()}}openLibrary(e,t,i){var a;let n=window.__debugContext;if(n){if(n.activeTab!=="library"){n.activeTab="library";let s=window.__updateWorkbenchTabs;typeof s=="function"&&s()}if(n.libraryPanel){let s=window.getEditableObjectConfig,o=s==null?void 0:s(e),l=(a=o==null?void 0:o.identity)==null?void 0:a.category;l||(l=t.split(".")[0]==="render"?"environment":"ui"),console.log("[QuickActionsBar] Highlighting library slot:",e,"category:",l),n.libraryPanel.highlightSlot(e,l)}}}openAIEditor(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let a=t.split(".").pop()||t;n(a,`Edit ${a} for ${e}`,i,{objectId:e,path:t})}else console.warn("[QuickActionsBar] AI Editor not available")}openUpload(e,t){var s;let i=window.getEditableObjectConfig,n=i==null?void 0:i(e),a=((s=n==null?void 0:n.identity)==null?void 0:s.category)||(t.split(".")[0]==="render"?"environment":"ui");pa({objectId:e,category:a,onApply:async o=>{var g,h;console.log("[QuickActionsBar] Upload complete, applying asset:",o);let l=window.applyAssetToSlot,c=this.getFilenameFromPath(o),d=/render\.asset\.path/i.test(t)||/\.(png|jpg|jpeg|gif|webp)$/i.test(o);if(typeof l=="function"&&c&&d){console.log("[QuickActionsBar] Applying asset to slot:",e,c,a);try{await l(e,c,a),console.log("[QuickActionsBar] \u2705 Asset applied to slot")}catch(f){console.error("[QuickActionsBar] Failed to apply asset to slot:",f)}}console.log("[QuickActionsBar] Updating property:",e,t,o);try{await this.updateManager.updateProperty(e,t,o),console.log("[QuickActionsBar] \u2705 Property updated")}catch(f){console.error("[QuickActionsBar] Failed to update property:",f)}let p=window.__debugContext;(h=(g=p==null?void 0:p.options)==null?void 0:g.onPropertyChange)==null||h.call(g,e,t,o);let u=window.__highlightLibrarySlot;typeof u=="function"&&setTimeout(()=>{u(e,a)},1e3),window.dispatchEvent(new CustomEvent("inspector:refresh")),window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e,action:"update",path:t}})),console.log("[QuickActionsBar] \u2705 Upload and apply complete")}})}getFilenameFromPath(e){if(!e)return"";let t=e.split("?")[0].replace(/\\/g,"/");return t.split("/").pop()||t}async resetToDefault(e,t){console.log("[QuickActionsBar] Reset to default:",e,t);try{let i=await this.getDefaultValue(e,t);i!==void 0?(await this.updateManager.updateProperty(e,t,i),console.log("[QuickActionsBar] Reset to default value:",i)):alert("No default value found for this property.")}catch(i){console.error("[QuickActionsBar] Failed to reset to default:",i),alert("Failed to reset property. Check console for details.")}}async getDefaultValue(e,t){let i=t.split(".");if(i.length<2)return;let n=i[0],a=i.slice(1),s=window.__editableConfig;if(!(s!=null&&s.schemas))return;let o=null;if(s.schemas instanceof Map?o=s.schemas.get(n):typeof s.schemas=="object"&&(o=s.schemas[n]),!(o!=null&&o.defaults))return;let l=o.defaults;for(let c of a)if(l&&typeof l=="object")l=l[c];else return;return l}handleAiConvert(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let s=`A single, high-quality, high-detail game UI icon/asset representing "${String(i||e.replace(/_/g," ").replace("json.",""))}". Modern stylized 3D rendered style, vibrant colors, soft lighting, isolated on solid magenta background, highly polished professional game art.`,o="render.asset.path";console.log("[QuickActionsBar] AI Convert for:",e,"from:",t,"to:",o),n(e,s,"",{objectId:e,path:o});let l=window.__debugContext;if(l){l.activeTab="ai";let c=window.__updateWorkbenchTabs;typeof c=="function"&&c()}}else console.warn("[QuickActionsBar] AI Editor not available")}};var rl=[{value:"loading",label:"Loading"},{value:"start",label:"Start"},{value:"gameplay",label:"Gameplay"},{value:"tutorial",label:"Tutorial"},{value:"endgame",label:"Endgame"}],ol=["environment","ui","character","system","backgrounds"],ll=["bg","world","ui"],Js={SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},DragToWin:{targetId:"",successDistance:80},DragSnap:{snapTargetId:"",snapDistance:40},JoystickMove:{speed:6,bounds:{left:-400,right:400,top:-300,bottom:300}}},Oi=class{constructor(){this.modal=null;this.state=null}open(e){this.state=this.createInitialState(e),this.createModal(),document.body.appendChild(this.modal),this.attachEventListeners(),this.updateStepUI()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),window.__wizardAssetPicker=null,this.modal=null,this.state=null}createInitialState(e){return{step:1,objectType:"sprite",instanceId:"",displayName:"",category:"environment",screenId:e.screenId,layer:"world",positionMode:"static",anchorPreset:"center",anchorX:.5,anchorY:.5,positionX:0,positionY:0,offsetX:0,offsetY:0,scale:.2,rotation:0,zIndex:0,assetPath:"",tint:"",alpha:1,text:"",font:"brand.primary",fontSize:18,letterSpacing:0,align:"center",graphicsWidth:200,graphicsHeight:200,graphicsFill:"#FFFFFF",graphicsAlpha:1,interactionEnabled:!1,dragEnabled:!1,hoverEnabled:!1,clickEnabled:!1,logicId:"",logicPropsRaw:""}}createModal(){let e=document.createElement("div");e.className="wizard-modal",e.innerHTML=`
|
|
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 i;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=(i=this.modal)==null?void 0:i.querySelector(".asset-crop-preview-canvas");if(t){let n=t.getContext("2d");n&&(n.fillStyle="rgba(255, 0, 0, 0.2)",n.fillRect(0,0,t.width,t.height))}}initializeCrop(){var i;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),(i=this.options)!=null&&i.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(e){if(!this.image)return;let t=this.image.width/this.image.height,i=this.cropX+this.cropWidth/2,n=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,i-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,n-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,i=this.cropWidth*this.scale,n=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,i,n),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(e,t,i,n),this.ctx.fillStyle="#ffffff";let a=8;[[e,t],[e+i-a,t],[e,t+n-a],[e+i-a,t+n-a]].forEach(([o,l])=>{var c;(c=this.ctx)==null||c.fillRect(o,l,a,a)})}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 i=150;e.width=i,e.height=i,t.clearRect(0,0,i,i);let n=i/this.cropWidth,a=i/this.cropHeight,s=Math.min(n,a),o=this.cropWidth*s,l=this.cropHeight*s,c=(i-o)/2,d=(i-l)/2;try{t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,c,d,o,l)}catch(p){console.error("[AssetCropModal] Error drawing preview:",p),t.fillStyle="rgba(255, 0, 0, 0.2)",t.fillRect(0,0,i,i)}}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",i=>{let n=parseFloat(i.target.value);this.setZoom(n)});let t=this.modal.querySelector(".asset-crop-aspect-select");t==null||t.addEventListener("change",i=>{let n=i.target.value;this.setAspectRatio(n)}),this.modal.addEventListener("click",i=>{switch(i.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",i=>{i.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,i=e.clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,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,i=e.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,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 n;if(!this.image||!((n=this.options)!=null&&n.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 i=e.toDataURL("image/png");this.options.onCrop(i),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(r){new Ri().open(r)}});var Bl={};ot(Bl,{COLORS:()=>Le,ConfigWatcher:()=>tt,DebugPanel:()=>Jt,DefaultReloadStrategy:()=>Gt,Handler:()=>ye,PlayableLoadingScreen:()=>xn,PreviewShell:()=>yn,STROKE_WIDTH:()=>qr,THEME:()=>Vr,applyConfigOverride:()=>le,applyConfigOverrides:()=>He,applyConfigsToDisk:()=>Ai,applyDefaults:()=>et,baseLottie:()=>jn,bootstrap:()=>Ml,clearConfigOverrides:()=>ge,clearConfigOverridesForObject:()=>Bs,configOverrideManager:()=>Gs,createPreviewShell:()=>Ga,deepClone:()=>ee,default:()=>We,defaultPreset:()=>ji,deviceGroups:()=>da,devicePresets:()=>ca,diffConfigs:()=>na,exportConfigsAsJSON:()=>Jn,exportConfigsFromActiveCache:()=>Qe,getConfigOverrides:()=>oe,getConfigStateSummary:()=>Fe,getOverrideMode:()=>Nt,getPresetById:()=>it,getPresetsByCategory:()=>sl,loadAllObjectConfigs:()=>Ii,loadComponentSchemas:()=>Ti,loadEngineConfig:()=>ki,loadGamePromptConfig:()=>ea,loadObjectCentricConfig:()=>_e,loadObjectConfig:()=>Be,loadSceneConfig:()=>Pi,redoLastConfigChange:()=>Ci,rehydrateObject:()=>aa,removeConfigOverride:()=>Ht,resetToApplied:()=>Ft,resetToOriginal:()=>Li,setBootstrapDependencies:()=>kl,setOverrideMode:()=>Xn,setupHotReload:()=>oa,setupLiveEditBridge:()=>vn,toLegacyFormat:()=>ta,trackObjectCreation:()=>Us,trackObjectDeletion:()=>qs,undoLastConfigChange:()=>Ei,validateObjectConfig:()=>ht});module.exports=go(Bl);var $e={};function li(r,e,t=!1){$e[r]||($e[r]=[]),$e[r].push({fn:e,once:t})}function In(r,e){if($e[r]){if(!e){delete $e[r];return}$e[r]=$e[r].filter(t=>t.fn!==e)}}function ci(r,...e){let t=$e[r];if(t)for(let i of[...t])i.fn(...e),i.once&&In(r,i.fn)}function ce(r,e){li(r,e,!0)}var ie=null,me=[],ct=null;function rs(r){ie=r,me=[],ct!==null&&(clearTimeout(ct),ct=null)}function os(){var r,e,t;return{endpoint:(ie==null?void 0:ie.endpoint)||"",transport:(ie==null?void 0:ie.transport)||"beacon",batchSize:(r=ie==null?void 0:ie.batchSize)!=null?r:10,flushIntervalMs:(e=ie==null?void 0:ie.flushIntervalMs)!=null?e:300,maxQueue:(t=ie==null?void 0:ie.maxQueue)!=null?t:200,debug:!!(ie!=null&&ie.debug)}}async function as(r,e,t,i){let n=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(r,new Blob([n],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",a,e);return}catch(a){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(a){i&&console.warn("[handler.telemetry] fetch failed",a)}}function kn(r,e){let t=os();if(e&&t.endpoint){if(me.push(r),me.length>t.maxQueue&&(me=me.slice(me.length-t.maxQueue)),me.length>=t.batchSize){ss();return}ct===null&&(ct=window.setTimeout(()=>{ct=null,ss()},t.flushIntervalMs))}}async function ss(){let r=os();if(!r.endpoint||me.length===0)return;let e=me.splice(0,r.batchSize);await as(r.endpoint,{events:e},r.transport,r.debug),me.length>0&&await as(r.endpoint,{events:me.splice(0,r.batchSize)},r.transport,r.debug)}function ls(r){return Math.max(0,Math.min(1,r))}function ho(r){let e=String(r!=null?r:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return n=>1+(i+1)*Math.pow(n-1,3)+i*Math.pow(n-1,2)}return t=>1-(1-t)*(1-t)}function _t(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function fo(r,e){let t=r==null?void 0:r[e];return typeof t=="number"?t:0}function cs(r,e,t){try{r[e]=t}catch{}}function mo(r){let e=r==null?void 0:r.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ds(r,e){let t=r==null?void 0:r.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 ps(r,e){let t=mo(r);if(!t)return{from:null,to:null};let i=null,n=null;return typeof e.scale=="number"?(i=e.scale,n=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(n=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(n=e.scaleY),i===null&&n===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:n!=null?n:t.y}}}function us(){let r=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),r.size>0&&i()})},n=d=>{var u;r.add(d);let p=(u=e.get(d.target))!=null?u:new Set;p.add(d),e.set(d.target,p),i()},a=d=>{r.delete(d);let p=e.get(d.target);p&&(p.delete(d),p.size===0&&e.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var p,u;let d=_t();for(let g of Array.from(r)){if(g.killed||g.paused)continue;let h=d-g.startMs-g.delayMs;if(h<0)continue;let f=g.durationMs>0?h/g.durationMs:1,m=ls(f),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let P=f-y;m=ls(P)}let w=g.ease(m);g.yoyo&&y%2===1&&(w=1-w);for(let P of g.props)cs(g.target,P.key,P.from+(P.to-P.from)*w);g.scaleFrom&&g.scaleTo&&ds(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*w,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*w});try{(p=g.onUpdate)==null||p.call(g)}catch{}if(f>=b){s(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(d,p,u)=>{var P;let g=Math.max(0,(typeof p.duration=="number"?p.duration:.5)*1e3),h=Math.max(0,(typeof p.delay=="number"?p.delay:0)*1e3+((P=u==null?void 0:u.delayMsOverride)!=null?P:0)),f=ho(p.ease),m=typeof p.repeat=="number"?Math.max(0,p.repeat|0):0,b=p.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),w=[];for(let I of Object.keys(p)){if(y.has(I))continue;let _=p[I];typeof _=="number"&&w.push({key:I,from:fo(d,I),to:_})}let v=ps(d,p);return{target:d,startMs:_t(),delayMs:h,durationMs:g,ease:f,props:w,scaleFrom:v.from,scaleTo:v.to,repeat:m,yoyo:b,onUpdate:typeof p.onUpdate=="function"?p.onUpdate:void 0,onComplete:typeof p.onComplete=="function"?p.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,p){let u=l(d,p);return n(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=_t())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:_t(),h=_t()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(d,p,u){return c.set(d,p),c.to(d,u)},set(d,p){if(!d||!p)return;for(let g of Object.keys(p)){let h=p[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&cs(d,g,h)}let u=ps(d,p);u.to&&ds(d,u.to)},killTweensOf(d){let p=e.get(d);if(p)for(let u of Array.from(p))s(u)},timeline(d={}){let p=[],u=0,g=!1,h=[],f=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let w=typeof y=="string"?y.trim():"";return w.startsWith("+=")?u+Math.max(0,Number(w.slice(2))*1e3||0):w?Math.max(0,Number(w)*1e3||0):u},m=y=>{p.push(y);let w=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+w)},b={to(y,w,v){return m({kind:"to",target:y,vars:w,atMs:f(v)}),b},fromTo(y,w,v,P){return m({kind:"fromTo",target:y,vars:v,from:w,atMs:f(P)}),b},play(){var y,w;if(g)return b;g=!0,h=[];for(let v of p)v.kind==="fromTo"&&c.set(v.target,(y=v.from)!=null?y:{}),h.push(c.to(v.target,{...v.vars,delay:v.atMs/1e3+((w=v.vars.delay)!=null?w:0)}));return b},pause(){for(let y of h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return d.paused||b.play(),b}};return c}function gs(){if(typeof window=="undefined")return;let r=window;if(!r.gsap)try{r.gsap=us()}catch{}}var hs={name:"handler-playable-sdk",version:"1.0.103",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 de=0,yo=de++,fs=de++,ms=de++,bs=de++,ys=de++,vs=de++,ws=de++,xs=de++,Ss=de++,Es=de++,Cs=de++,As=de++,Z=yo;function Ls(){return Z===fs}function Ts(){return Z===ms}function Is(){return Z===bs}function ks(){return Z===ys}function dt(){return Z===vs}function pt(){return Z===ws}function Ps(){return Z===xs}function Ms(){return Z===Ss}function js(){return Z===Es}function Pn(){return Z===Cs}function Mn(){return Z===As}function _s(){let r=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(r==="mraid")try{mraid.getState(),Z=fs;return}catch{}else if(r==="dapi")try{dapi.isReady(),Z=ms;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(Z=bs)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(Z=ys)}catch{}else if(e==="mintegral")window.gameReady&&(Z=vs);else if(e==="tapjoy")window.TJ_API&&(Z=ws);else if(e==="tiktok")window.openAppStore&&(Z=xs);else if(e==="smadex")try{window.smxTracking&&(Z=Ss)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(Z=Es)}catch{}else e==="vungle"?Z=Cs:(r==="nucleo"||e==="nucleo")&&(Z=As)}var di=lt(require("lottie-web"),1),jn=di.default;typeof window!="undefined"&&(window.lottie=di.default,window.__baseLottie=di.default);var vo=require("pixi.js");var _n=require("pixi.js");var wo=null;function On(r){wo=r}ui();pi();var Ot=require("pixi.js");ui();var Lo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Dn=Lo;if(typeof window!="undefined")try{let r=new XMLHttpRequest;if(r.open("GET","./build-settings.json",!1),r.send(),r.status===200&&r.responseText){let e=JSON.parse(r.responseText);e!=null&&e.buildMode&&(Dn=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Dn}`))}}catch{}function To(r){var t,i,n,a,s;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(r);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(r))return{x:(t=r[0])!=null?t:.5,y:(i=r[1])!=null?i:.5};if(r&&typeof r=="object"&&"x"in r&&"y"in r)return{x:(n=r.x)!=null?n:.5,y:(a=r.y)!=null?a:.5};if(typeof r=="string"){let o=r.trim().toLowerCase();return(s=e[o])!=null?s:{x:.5,y:.5}}return null}var Se=class{static async create(e,t,i){var l,c,d,p,u,g,h;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${Dn}`);let n=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!n){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let f=new Ot.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let a=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${a}, type: ${n.type}, path: ${n.path}`);let s=await Xe.load(e,n,i,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(n.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",e),o=new Ot.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(p=o==null?void 0:o.constructor)==null?void 0:p.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(n.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=s==null?void 0:s.constructor)==null?void 0:u.name,s),s&&(((g=s.constructor)==null?void 0:g.name)==="Container"||s instanceof Ot.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[n.path,`/assets/${n.path}`,`assets/${n.path}`,`../assets/${n.path}`],m=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(h=o==null?void 0:o.constructor)==null?void 0:h.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=s)}else o=s;else o=s,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,i){var n,a,s,o;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(n=t.position.x)!=null?n:0,e.y=(a=t.position.y)!=null?a:0):"position"in e&&e.position&&e.position.set((s=t.position.x)!=null?s:0,(o=t.position.y)!=null?o:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=To(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Rt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Po=lt(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Po);ut();var gi=require("pixi.js");ut();var Fn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Rt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(n=>!this.instanceCache.has(n));if(t.length===0)return;let i=async n=>{n.length&&(console.log("[Assets] Loading objects:",n),await Promise.all(n.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let l=await Se.create(a,s,this.app);this.instanceCache.set(a,l),console.log("[Assets] Loaded object:",a,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",a,l)}})))};return this.readyPromise=(async()=>{await i(t);let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));n.length>0&&(console.warn("[Assets] Retrying missing assets:",n),await i(n)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Se.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Mo=new Fn,jo=new Proxy(Mo,{get(r,e){if(e in r&&typeof r[e]=="function")return r[e].bind(r);if(r.get(e))return r.get(e)}});ut();var Oo=require("pixi.js"),ke={width:400,height:600,designWidth:400,scaleFactor:1},fi={scale:1,position:1},Gn=[];function Ro(r,e,t,i,n,a,s){Gn.push({element:r,originalScale:a,positionHelper:e,heightPercent:n}),e(r,t,i,n,a,s,!1)}function zo(){Gn.forEach(({element:r,originalScale:e,positionHelper:t,heightPercent:i})=>{let n=e*ke.scaleFactor;t(r,ke.width,ke.height,i,n,!0,!1)})}function Bn(r,e){console.log(`[SCREEN] updateScreenState called: ${r}x${e}`),ke.width=r,ke.height=e,ke.scaleFactor=Math.min(r/ke.designWidth,1.15),fi.scale=ke.scaleFactor,fi.position=1,console.log(`[SCREEN] Global multipliers - scale: ${fi.scale.toFixed(3)}`),zo()}var $t={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 $o(r,e,t){let i=$t[r];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${r}.${e} = ${t}`))}function Do(){return $t}var No={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 hi(r,e){return typeof r=="number"&&Number.isFinite(r)?r:e}function Ze(r,e={x:.5,y:.5}){var t;if(Array.isArray(r))return{x:hi(r[0],e.x),y:hi(r[1],e.y)};if(r&&typeof r=="object"){let i=r;return{x:hi(i.x,e.x),y:hi(i.y,e.y)}}if(typeof r=="string"){let i=r.trim().toLowerCase();return(t=No[i])!=null?t:e}return e}function Ne(r,e,t,i={}){var g,h,f,m,b,y;let n=Ze(t),a=(g=i.inset)!=null?g:{},s=(h=i.padding)!=null?h:{x:0,y:0},o=((f=a.left)!=null?f:0)+s.x,l=((m=a.right)!=null?m:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,p=Math.max(0,r-o-l),u=Math.max(0,e-c-d);return{x:o+p*n.x,y:c+u*n.y}}function gt(r,e,t,i={}){var f,m,b,y,w,v;let n=(f=i.inset)!=null?f:{},a=(m=i.padding)!=null?m:{x:0,y:0},s=((b=n.left)!=null?b:0)+a.x,o=((y=n.right)!=null?y:0)+a.x,l=((w=n.top)!=null?w:0)+a.y,c=((v=n.bottom)!=null?v:0)+a.y,d=Math.max(0,r-s-o),p=Math.max(0,e-l-c),u=Ze(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:s+d*g,y:l+p*h}}if(typeof window!="undefined"){let r=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,n=window.innerHeight;(i!==r||n!==e)&&(r=i,e=n,Bn(i,n))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),Bn(window.innerWidth,window.innerHeight),window.updateDebugConfig=$o,window.getDebugConfig=Do,window.copyConfig=Xo,window.applyConfig=zt,window.applyConfigForRatio=Jo,window.positionAtBottom=Ns,window.positionAtTop=Bo,window.positionAtCenter=Go,window.positionAtLeft=Uo,window.positionAtRight=qo,window.positionAtBottomLeft=Vo,window.positionAtBottomRight=Yo,window.positionAtTopLeft=Wo,window.positionAtTopRight=Ko,window.applyPositionContract=Fo,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 mi(r,e,t=0){return r*e+t}function bi(r,e,t=0){return r*(1-e)+t}function yi(r,e,t=0){return r*e+t}function vi(r,e,t=0){return r*(1-e)+t}function ue(r,e=0){return r/2+e}function Ho(r,e){return r*e}function Fo(r,e,t,i){var s,o,l,c,d,p,u,g,h,f,m,b,y,w,v,P,I,_,k,j;let n=0,a=0;switch(i.type){case"top":n=ue(e,(o=(s=i.offset)==null?void 0:s.x)!=null?o:0),a=mi(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":n=ue(e,(p=(d=i.offset)==null?void 0:d.x)!=null?p:0),a=bi(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":n=yi(e,i.percent,(f=(h=i.offset)==null?void 0:h.x)!=null?f:0),a=ue(t,(b=(m=i.offset)==null?void 0:m.y)!=null?b:0);break;case"right":n=vi(e,i.percent,(w=(y=i.offset)==null?void 0:y.x)!=null?w:0),a=ue(t,(P=(v=i.offset)==null?void 0:v.y)!=null?P:0);break;case"center":n=ue(e,(_=(I=i.offset)==null?void 0:I.x)!=null?_:0),a=ue(t,(j=(k=i.offset)==null?void 0:k.y)!=null?j:0);break}r.position?r.position.set(n,a):(r.x=n,r.y=a),i.scale!==void 0&&i.scale!==1&&r.scale&&(typeof r.scale.set=="function"?r.scale.set(i.scale,i.scale):(r.scale.x=i.scale,r.scale.y=i.scale))}function Ns(r,e,t,i=.2,n=1,a=!0,s=!1){let o=Ho(t,i),l=bi(t,i/2);Pe(r,ue(e),l);let c=a?n*ke.scaleFactor:n;Me(r,c),s&&!Gn.find(d=>d.element===r)&&Ro(r,Ns,e,t,i,n,a)}function Bo(r,e,t,i=.1,n=1){Pe(r,ue(e),mi(t,i)),Me(r,n)}function Go(r,e,t,i=0,n=0,a=1){Pe(r,ue(e,i),ue(t,n)),Me(r,a)}function Uo(r,e,t,i=.1,n=1){Pe(r,yi(e,i),ue(t)),Me(r,n)}function qo(r,e,t,i=.1,n=1){Pe(r,vi(e,i),ue(t)),Me(r,n)}function Vo(r,e,t,i=.05,n=.05,a=1){Pe(r,yi(e,n),bi(t,i)),Me(r,a)}function Yo(r,e,t,i=.05,n=.05,a=1){Pe(r,vi(e,n),bi(t,i)),Me(r,a)}function Wo(r,e,t,i=.05,n=.05,a=1){Pe(r,yi(e,n),mi(t,i)),Me(r,a)}function Ko(r,e,t,i=.05,n=.05,a=1){Pe(r,vi(e,n),mi(t,i)),Me(r,a)}function Pe(r,e,t){r&&r.position?typeof r.position.set=="function"?r.position.set(e,t):(r.position.x=e,r.position.y=t):r&&(r.x=e,r.y=t)}function Me(r,e){e!==1&&r&&r.scale&&(typeof r.scale.set=="function"?r.scale.set(e,e):r.scale.x!==void 0&&r.scale.y!==void 0&&(r.scale.x=e,r.scale.y=e))}var Je={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 Xo(r){return r&&Je[r]?JSON.parse(JSON.stringify(Je[r])):JSON.parse(JSON.stringify($t))}function zt(r){Object.keys(r).forEach(e=>{let t=e;$t[t]&&r[t]&&Object.assign($t[t],r[t])}),console.log("Config applied:",r)}function Jo(r,e){let t=r/e;t>1.6?(zt(Je.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(zt(Je.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(zt(Je.square),console.log("Applied SQUARE config for ratio:",t)):(zt(Je.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let r=window;r.configPresets=Je,r.resolveAnchorVec2=r.resolveAnchorVec2||Ze,r.resolveScreenAnchorPoint=r.resolveScreenAnchorPoint||Ne,r.resolveScreenRatioPoint=r.resolveScreenRatioPoint||gt}Mi();function ne(r,e){let t=(n,a)=>a===0?n:t(a,n%a),i=t(r,e);return`${r/i}:${e/i}`}var bd=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:ne(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:ne(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:ne(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:ne(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:ne(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:ne(360,780)}],yd=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:ne(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:ne(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:ne(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:ne(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:ne(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:ne(412,915)}],vd=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:ne(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:ne(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:ne(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:ne(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:ne(800,1280)}],la=[{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:ne(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:ne(768,1024),mraidScale:.7}];var ca=[...la],da=[{category:"playable",label:"Playable Ad",devices:la}],ji=la[0];function it(r){return ca.find(e=>e.id===r)||ji}function sl(r){return ca.filter(e=>e.category===r)}ae();var Ce=class{async updateProperty(e,t,i,n={}){var l,c,d,p,u,g,h,f,m,b,y,w;console.log("[PropertyUpdateManager] Updating:",e,t,i);let a=window.getEditableObjectConfig;if(typeof a!="function"){console.error("[PropertyUpdateManager] getEditableObjectConfig not available");return}let s=a(e);if(!s){console.error("[PropertyUpdateManager] Config not found for:",e);return}if(le({objectId:e,path:t,value:i},{persist:!0}),t==="transform"||t.startsWith("transform.")){console.log("[DEBUG FALLBACK] PropertyUpdateManager SKIP applyEditableObjectConfig (transform path)",t,e);let v=s==null?void 0:s.motion;if(v&&typeof v=="object"&&v.enabled!==!1&&(((p=v==null?void 0:v.intro)==null?void 0:p.enabled)===!0||((u=v==null?void 0:v.pulse)==null?void 0:u.enabled)===!0||((g=v==null?void 0:v.swing)==null?void 0:g.enabled)===!0||((h=v==null?void 0:v.continuousMove)==null?void 0:h.enabled)===!0||((f=v==null?void 0:v.continuousRotate)==null?void 0:f.enabled)===!0||((m=v==null?void 0:v.orbit)==null?void 0:m.enabled)===!0)){let _=window.applyEditableObjectConfig;if(typeof _=="function"){let k=window.__editableConfig,j=(w=(y=(b=k==null?void 0:k.objects)==null?void 0:b.get)==null?void 0:y.call(b,e))!=null?w:s;await _(e,j),console.log("[PropertyUpdateManager] Applied config for motion object")}}n.refreshInspector||requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e}}))})}else{let v=window.applyEditableObjectConfig;if(typeof v=="function"){let P=window.__editableConfig,I=(d=(c=(l=P==null?void 0:P.objects)==null?void 0:l.get)==null?void 0:c.call(l,e))!=null?d:s;await v(e,I),console.log("[PropertyUpdateManager] Applied config successfully")}else console.warn("[PropertyUpdateManager] applyEditableObjectConfig not available")}this.triggerRefresh(e),n.refreshInspector&&window.dispatchEvent(new CustomEvent("inspector:refresh"))}getNestedProperty(e,t){let i=t.split("."),n=e;for(let a of i)if(n&&typeof n=="object"&&a in n)n=n[a];else return;return n}triggerRefresh(e){let t=window.__refreshHierarchy;typeof t=="function"&&t(),window.dispatchEvent(new CustomEvent("inspector:property-updated",{detail:{objectId:e}}))}};function pa(r){let e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=async t=>{var a;let i=(a=t.target.files)==null?void 0:a[0];if(!i)return;let n=new FileReader;n.onload=async()=>{var g,h,f,m;let s=n.result;if(!s||typeof s!="string"){alert("Failed to read file: Invalid data URL"),console.error("[QuickActionsBar] Invalid data URL:",typeof s,s==null?void 0:s.substring(0,50));return}if(!s.startsWith("data:image/")){alert("Invalid file format: Not an image file"),console.error("[QuickActionsBar] Invalid data URL format:",s.substring(0,100));return}let o=s.match(/^data:image\/[^;]+;base64,(.+)$/);if(!o||!o[1]||o[1].length===0){alert("Failed to read file: Invalid base64 data"),console.error("[QuickActionsBar] Invalid base64 data in data URL");return}try{let b=o[1],y=atob(b.substring(0,Math.min(100,b.length)));if(!y||y.length===0)throw new Error("Base64 decode test failed");console.log("[QuickActionsBar] \u2705 Data URL validated, length:",s.length)}catch(b){alert("Failed to read file: Corrupted image data"),console.error("[QuickActionsBar] Base64 validation failed:",b);return}let l=r.category||"misc",c=(r.objectId||"new_asset").replace(/^json\./,"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),d=((g=i.name.toLowerCase().match(/\.(png|jpg|jpeg|gif|webp)$/))==null?void 0:g[1])||"png",p=d==="jpg"?"jpeg":d,u=`${c||"new_asset"}_uploaded_${Date.now()}.${p}`;console.log("[QuickActionsBar] Uploading file:",u,"to category:",l,"data URL length:",s.length);try{let y=await(await fetch("/api/library/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:l,filename:u,data:s,overwrite:!0})})).json();if(!(y!=null&&y.success)){alert(`Upload failed: ${(y==null?void 0:y.error)||"Unknown error"}`);return}await new Promise(x=>setTimeout(x,100));let w=window.addAssetToRegistry;typeof w=="function"&&(w(l,u),console.log("[QuickActionsBar] \u2705 Added to registry:",l,u));let v=window.getEditableAssets;if(typeof v=="function"){let x=v();x&&!x.categories&&(x.categories=[]),x!=null&&x.categories&&!x.categories.includes(l)&&(x.categories.push(l),console.log(`[QuickActionsBar] Added category ${l} to registry`))}let P=!1,I=0,_=10;for(;!P&&I<_;){I++,console.log(`[QuickActionsBar] Refresh attempt ${I}/${_}...`);try{(await fetch("/api/setup-library",{method:"POST",headers:{"Content-Type":"application/json"}})).ok&&console.log("[QuickActionsBar] \u2705 Registry rebuilt from disk")}catch{}await new Promise(C=>setTimeout(C,300));let x=window.refreshAssetLibrary;typeof x=="function"&&(console.log("[QuickActionsBar] Refreshing library panel..."),await x());let S=window.reRenderAssetLibrary;typeof S=="function"&&(console.log("[QuickActionsBar] Re-rendering library panel..."),S());let E=window.getEditableAssets;if(typeof E=="function"){let C=E(),A=((h=C==null?void 0:C.libraryAssets)==null?void 0:h[l])||[];A.some(O=>(O==null?void 0:O.filename)===u)?(console.log("[QuickActionsBar] \u2705 Asset found in registry!"),P=!0):(console.log(`[QuickActionsBar] Asset not found yet, retrying... (found ${A.length} assets in ${l})`),await new Promise(O=>setTimeout(O,500)))}else I>=2&&(P=!0)}P||console.warn("[QuickActionsBar] \u26A0\uFE0F Asset not found in registry after retries, proceeding anyway..."),setTimeout(()=>{try{window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"batch"}})),console.log("[QuickActionsBar] Dispatched config:changed event")}catch(x){console.warn("[QuickActionsBar] Failed to refresh textures:",x)}},300),console.log("[QuickActionsBar] Applying asset to object:",y.path);let k=!1,j=0,L=5;for(;!k&&j<L;){j++;try{await r.onApply(y.path),await new Promise(S=>setTimeout(S,200));let x=window.getEditableObjectConfig;if(typeof x=="function"){let S=x(r.objectId),E=((m=(f=S==null?void 0:S.render)==null?void 0:f.asset)==null?void 0:m.path)||"";E===y.path||E.includes(u)?(console.log("[QuickActionsBar] \u2705 Asset confirmed applied to object"),k=!0):(console.log(`[QuickActionsBar] Asset not applied yet (attempt ${j}), retrying...`),await new Promise(C=>setTimeout(C,300)))}else k=!0}catch(x){console.error(`[QuickActionsBar] Apply attempt ${j} failed:`,x),j<L&&await new Promise(S=>setTimeout(S,500))}}k?console.log("[QuickActionsBar] \u2705 Asset upload and apply complete!"):console.warn("[QuickActionsBar] \u26A0\uFE0F Asset may not have been applied, but upload succeeded")}catch(b){console.error("[QuickActionsBar] Upload error:",b),alert("Upload failed. Check console.")}},n.readAsDataURL(i)},e.click()}var _i=class{constructor(){this.updateManager=new Ce}async handleAction(e,t,i){console.log("[QuickActionsBar] Action:",e,t,i);let n=window.getEditableObjectConfig;if(typeof n!="function")return;let a=n(t);if(!a)return;let s=this.updateManager.getNestedProperty(a,i);if(e==="ai-convert"||e==="upload"||e==="library"){let o=i==="ui.text"||i==="render.asset.path",l=i==="render.asset.path";o&&(await this.prepareForImageConversion(t,a),e==="ai-convert"&&i!=="render.asset.path"&&(i="render.asset.path"))}switch(e){case"library":this.openLibrary(t,i,s);break;case"ai-edit":this.openAIEditor(t,i,s);break;case"upload":this.openUpload(t,i);break;case"reset":await this.resetToDefault(t,i);break;case"ai-convert":this.handleAiConvert(t,i,s);break;default:console.warn("[QuickActionsBar] Unknown action:",e)}}async prepareForImageConversion(e,t){var i,n;if(console.log("[QuickActionsBar] Preparing for image conversion:",e),t.render||(t.render={alpha:1,visible:!0}),(t.render.alpha===0||t.render.alpha===void 0)&&(t.render.alpha=1,await this.updateManager.updateProperty(e,"render.alpha",1)),(t.render.visible===!1||t.render.visible===void 0)&&(t.render.visible=!0,await this.updateManager.updateProperty(e,"render.visible",!0)),t.render.asset||(t.render.asset={type:"image",path:""}),t.render.asset.type!=="image"&&(t.render.asset.type="image",await this.updateManager.updateProperty(e,"render.asset",{type:"image",path:t.render.asset.path||""})),t.ui&&t.ui.renderMode!=="png"){await this.updateManager.updateProperty(e,"ui.renderMode","png",{refreshInspector:!0}),await this.updateManager.updateProperty(e,"render.tint","#ffffff");let s=((n=(i=t.transform)==null?void 0:i.scale)!=null?n:1)*.3;await this.updateManager.updateProperty(e,"transform.scale",s),console.log("[QuickActionsBar] Text to PNG conversion: set tint white, scale",s)}this.ensureSlotInRegistry(e,t)}ensureSlotInRegistry(e,t){var o,l,c;let i=window.getEditableAssets;if(typeof i!="function")return;let n=i();if(!n||!n.slots)return;let a=e.startsWith("json.")?e.replace("json.",""):e;if(!n.slots.some(d=>d.objectId===a||d.slotId===a)){let d=((o=t.identity)==null?void 0:o.category)||"ui";console.log("[QuickActionsBar] Adding new slot to registry for converted object:",a),n.slots.push({slotId:a,displayName:a.replace(/_/g," "),objectId:a,category:d,currentAsset:((c=(l=t.render)==null?void 0:l.asset)==null?void 0:c.path)||"",defaultAsset:"",libraryFolder:d,assetType:"image"}),n.categories&&!n.categories.includes(d)&&n.categories.push(d),n.libraryAssets&&!n.libraryAssets[d]&&(n.libraryAssets[d]=[]);let p=window.reRenderAssetLibrary;typeof p=="function"&&p()}}openLibrary(e,t,i){var a;let n=window.__debugContext;if(n){if(n.activeTab!=="library"){n.activeTab="library";let s=window.__updateWorkbenchTabs;typeof s=="function"&&s()}if(n.libraryPanel){let s=window.getEditableObjectConfig,o=s==null?void 0:s(e),l=(a=o==null?void 0:o.identity)==null?void 0:a.category;l||(l=t.split(".")[0]==="render"?"environment":"ui"),console.log("[QuickActionsBar] Highlighting library slot:",e,"category:",l),n.libraryPanel.highlightSlot(e,l)}}}openAIEditor(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let a=t.split(".").pop()||t;n(a,`Edit ${a} for ${e}`,i,{objectId:e,path:t})}else console.warn("[QuickActionsBar] AI Editor not available")}openUpload(e,t){var s;let i=window.getEditableObjectConfig,n=i==null?void 0:i(e),a=((s=n==null?void 0:n.identity)==null?void 0:s.category)||(t.split(".")[0]==="render"?"environment":"ui");pa({objectId:e,category:a,onApply:async o=>{var g,h;console.log("[QuickActionsBar] Upload complete, applying asset:",o);let l=window.applyAssetToSlot,c=this.getFilenameFromPath(o),d=/render\.asset\.path/i.test(t)||/\.(png|jpg|jpeg|gif|webp)$/i.test(o);if(typeof l=="function"&&c&&d){console.log("[QuickActionsBar] Applying asset to slot:",e,c,a);try{await l(e,c,a),console.log("[QuickActionsBar] \u2705 Asset applied to slot")}catch(f){console.error("[QuickActionsBar] Failed to apply asset to slot:",f)}}console.log("[QuickActionsBar] Updating property:",e,t,o);try{await this.updateManager.updateProperty(e,t,o),console.log("[QuickActionsBar] \u2705 Property updated")}catch(f){console.error("[QuickActionsBar] Failed to update property:",f)}let p=window.__debugContext;(h=(g=p==null?void 0:p.options)==null?void 0:g.onPropertyChange)==null||h.call(g,e,t,o);let u=window.__highlightLibrarySlot;typeof u=="function"&&setTimeout(()=>{u(e,a)},1e3),window.dispatchEvent(new CustomEvent("inspector:refresh")),window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e,action:"update",path:t}})),console.log("[QuickActionsBar] \u2705 Upload and apply complete")}})}getFilenameFromPath(e){if(!e)return"";let t=e.split("?")[0].replace(/\\/g,"/");return t.split("/").pop()||t}async resetToDefault(e,t){console.log("[QuickActionsBar] Reset to default:",e,t);try{let i=await this.getDefaultValue(e,t);i!==void 0?(await this.updateManager.updateProperty(e,t,i),console.log("[QuickActionsBar] Reset to default value:",i)):alert("No default value found for this property.")}catch(i){console.error("[QuickActionsBar] Failed to reset to default:",i),alert("Failed to reset property. Check console for details.")}}async getDefaultValue(e,t){let i=t.split(".");if(i.length<2)return;let n=i[0],a=i.slice(1),s=window.__editableConfig;if(!(s!=null&&s.schemas))return;let o=null;if(s.schemas instanceof Map?o=s.schemas.get(n):typeof s.schemas=="object"&&(o=s.schemas[n]),!(o!=null&&o.defaults))return;let l=o.defaults;for(let c of a)if(l&&typeof l=="object")l=l[c];else return;return l}handleAiConvert(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let s=`A single, high-quality, high-detail game UI icon/asset representing "${String(i||e.replace(/_/g," ").replace("json.",""))}". Modern stylized 3D rendered style, vibrant colors, soft lighting, isolated on solid magenta background, highly polished professional game art.`,o="render.asset.path";console.log("[QuickActionsBar] AI Convert for:",e,"from:",t,"to:",o),n(e,s,"",{objectId:e,path:o});let l=window.__debugContext;if(l){l.activeTab="ai";let c=window.__updateWorkbenchTabs;typeof c=="function"&&c()}}else console.warn("[QuickActionsBar] AI Editor not available")}};var rl=[{value:"loading",label:"Loading"},{value:"start",label:"Start"},{value:"gameplay",label:"Gameplay"},{value:"tutorial",label:"Tutorial"},{value:"endgame",label:"Endgame"}],ol=["environment","ui","character","system","backgrounds"],ll=["bg","world","ui"],Js={SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},DragToWin:{targetId:"",successDistance:80},DragSnap:{snapTargetId:"",snapDistance:40},JoystickMove:{speed:6,bounds:{left:-400,right:400,top:-300,bottom:300}}},Oi=class{constructor(){this.modal=null;this.state=null}open(e){this.state=this.createInitialState(e),this.createModal(),document.body.appendChild(this.modal),this.attachEventListeners(),this.updateStepUI()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),window.__wizardAssetPicker=null,this.modal=null,this.state=null}createInitialState(e){return{step:1,objectType:"sprite",instanceId:"",displayName:"",category:"environment",screenId:e.screenId,layer:"world",positionMode:"static",anchorPreset:"center",anchorX:.5,anchorY:.5,positionX:0,positionY:0,offsetX:0,offsetY:0,scale:.2,rotation:0,zIndex:0,assetPath:"",tint:"",alpha:1,text:"",font:"brand.primary",fontSize:18,letterSpacing:0,align:"center",graphicsWidth:200,graphicsHeight:200,graphicsFill:"#FFFFFF",graphicsAlpha:1,interactionEnabled:!1,dragEnabled:!1,hoverEnabled:!1,clickEnabled:!1,logicId:"",logicPropsRaw:""}}createModal(){let e=document.createElement("div");e.className="wizard-modal",e.innerHTML=`
|
|
98
98
|
<div class="wizard-card">
|
|
99
99
|
<div class="wizard-header">
|
|
100
100
|
<div class="wizard-title">
|
|
@@ -914,7 +914,17 @@ ${o}`)}this.refreshObjects()}async syncScreens(){try{let e=this.getActiveScreenF
|
|
|
914
914
|
data-object-id="${e}"
|
|
915
915
|
step="any" />
|
|
916
916
|
</div>
|
|
917
|
-
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};var Ui=class{render(e,t,i,n){let a=String(i||"");return
|
|
917
|
+
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};var Ui=class{render(e,t,i,n){let a=String(i||"");return n.includes("html_component.html")||n.includes("html_component.css")?`
|
|
918
|
+
<div class="inspector-property inspector-property-text">
|
|
919
|
+
<label class="inspector-property-label">${this.formatLabel(t)}</label>
|
|
920
|
+
<div class="inspector-input-group">
|
|
921
|
+
<textarea class="inspector-input"
|
|
922
|
+
rows="8"
|
|
923
|
+
data-property-path="${n}"
|
|
924
|
+
data-object-id="${e}">${a}</textarea>
|
|
925
|
+
</div>
|
|
926
|
+
</div>
|
|
927
|
+
`:`
|
|
918
928
|
<div class="inspector-property inspector-property-text">
|
|
919
929
|
<label class="inspector-property-label">${this.formatLabel(t)}</label>
|
|
920
930
|
<div class="inspector-input-group">
|
|
@@ -1014,7 +1024,7 @@ ${o}`)}this.refreshObjects()}async syncScreens(){try{let e=this.getActiveScreenF
|
|
|
1014
1024
|
${a.join("")}
|
|
1015
1025
|
</div>
|
|
1016
1026
|
</div>
|
|
1017
|
-
`}renderLogic(e,t,i,n){let a=[],s=typeof(i==null?void 0:i.id)=="string"?i.id:"",o={zone:["bottom-left","bottom-center","bottom-right","top-left","top-center","top-right"],directionMode:["dominantAxis","free"],axis:["both","x","y"],ease:["power2.out","linear","sine.inOut","back.out(1.8)"],direction:["any","horizontal","vertical"],spawnPattern:["continuous","onClick","wave","burst"],positionSource:["spawner","target","custom","random","points"],spawnPointMode:["cycle","random"],movementMode:["none","velocity"],particleEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],collectSound:["","click_4.wav","click_6.wav","success_4.wav"],hitEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroyEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroySound:["","click_4.wav","click_6.wav","success_4.wav"]},l=(()=>{let u=window,g=Array.isArray(u==null?void 0:u.__HANDLER_LOGIC_OPTIONS)?u.__HANDLER_LOGIC_OPTIONS:[],f=[...["DragToWin","SwerveMove","DragSnap","JoystickMove"],...g].map(m=>String(m)).filter(m=>m.trim().length>0);return Array.from(new Set(f)).sort((m,b)=>m.localeCompare(b))})(),c=s&&!l.includes(s)?[s,...l]:l;a.push(`
|
|
1027
|
+
`}renderLogic(e,t,i,n){let a=[],s=typeof(i==null?void 0:i.id)=="string"?i.id:"",o={zone:["bottom-left","bottom-center","bottom-right","top-left","top-center","top-right"],directionMode:["dominantAxis","free"],axis:["both","x","y"],ease:["power2.out","linear","sine.inOut","back.out(1.8)"],direction:["any","horizontal","vertical"],spawnPattern:["continuous","onClick","wave","burst"],positionSource:["spawner","target","custom","random","points"],spawnPointMode:["cycle","random"],movementMode:["none","velocity"],particleEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],collectSound:["","click_4.wav","click_6.wav","success_4.wav"],hitEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroyEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroySound:["","click_4.wav","click_6.wav","success_4.wav"]},l=(()=>{let u=window,g=Array.isArray(u==null?void 0:u.__HANDLER_LOGIC_OPTIONS)?u.__HANDLER_LOGIC_OPTIONS:[],f=[...["DragToWin","SwerveMove","DragSnap","JoystickMove","DrawCanvas","HtmlComponent"],...g].map(m=>String(m)).filter(m=>m.trim().length>0);return Array.from(new Set(f)).sort((m,b)=>m.localeCompare(b))})(),c=s&&!l.includes(s)?[s,...l]:l;a.push(`
|
|
1018
1028
|
<div class="inspector-property inspector-property-text">
|
|
1019
1029
|
<label class="inspector-property-label">Id</label>
|
|
1020
1030
|
<div class="inspector-input-group">
|
|
@@ -1165,7 +1175,7 @@ ${o}`)}this.refreshObjects()}async syncScreens(){try{let e=this.getActiveScreenF
|
|
|
1165
1175
|
</div>
|
|
1166
1176
|
</div>
|
|
1167
1177
|
</div>
|
|
1168
|
-
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};var Zi=class{constructor(){this.typeDetector=new Hi,this.imageRenderer=new Fi,this.colorRenderer=new Bi,this.numberRenderer=new Gi,this.textRenderer=new Ui,this.booleanRenderer=new qi,this.arrayRenderer=new Vi(this),this.objectRenderer=new Yi(this),this.selectRenderer=new Wi,this.jsonRenderer=new Ki,this.spawnPointsRenderer=new Xi,this.spawnTemplatesRenderer=new Ji(this)}getObjectIds(){try{let e=window,t=e==null?void 0:e.__editableConfig;if(!(t!=null&&t.objects))return[];let i=[];if(t.objects instanceof Map)for(let n of t.objects.keys())i.push(n);else typeof t.objects=="object"&&i.push(...Object.keys(t.objects));return i.sort()}catch{return[]}}getEnumOptionsFromSchemas(e){var t;try{let i=window,n=i==null?void 0:i.__editableConfig,a=n==null?void 0:n.schemas;if(!a)return null;let s=String(e||"").split(".").filter(Boolean);if(s.length<2)return null;let o=s[0],l=s.slice(1).join("."),c=a instanceof Map?a.get(o):a==null?void 0:a[o];if(!c)return null;let d=(t=c==null?void 0:c.types)==null?void 0:t[l];if(typeof d!="string"||!d.startsWith("enum:"))return null;let u=d.slice(5).split("|").map(g=>g.trim()).filter(Boolean);return u.length?u:null}catch{return null}}getLogicOptions(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],n=[...["DragToWin","SwerveMove","DragSnap","JoystickMove"],...t].map(a=>String(a)).filter(a=>a.trim().length>0);return Array.from(new Set(n)).sort((a,s)=>a.localeCompare(s))}catch{return[]}}renderProperty(e,t,i,n){let a=t.toLowerCase(),s=a==="logic"||a==="logic_id"||a==="logicid",o=a==="id"&&n.toLowerCase().includes("logic");if((s||o)&&typeof i=="string"){let h=this.getLogicOptions(),f=this.selectRenderer.render(e,t,i,n,h);return s?`
|
|
1178
|
+
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};var Zi=class{constructor(){this.typeDetector=new Hi,this.imageRenderer=new Fi,this.colorRenderer=new Bi,this.numberRenderer=new Gi,this.textRenderer=new Ui,this.booleanRenderer=new qi,this.arrayRenderer=new Vi(this),this.objectRenderer=new Yi(this),this.selectRenderer=new Wi,this.jsonRenderer=new Ki,this.spawnPointsRenderer=new Xi,this.spawnTemplatesRenderer=new Ji(this)}getObjectIds(){try{let e=window,t=e==null?void 0:e.__editableConfig;if(!(t!=null&&t.objects))return[];let i=[];if(t.objects instanceof Map)for(let n of t.objects.keys())i.push(n);else typeof t.objects=="object"&&i.push(...Object.keys(t.objects));return i.sort()}catch{return[]}}getEnumOptionsFromSchemas(e){var t;try{let i=window,n=i==null?void 0:i.__editableConfig,a=n==null?void 0:n.schemas;if(!a)return null;let s=String(e||"").split(".").filter(Boolean);if(s.length<2)return null;let o=s[0],l=s.slice(1).join("."),c=a instanceof Map?a.get(o):a==null?void 0:a[o];if(!c)return null;let d=(t=c==null?void 0:c.types)==null?void 0:t[l];if(typeof d!="string"||!d.startsWith("enum:"))return null;let u=d.slice(5).split("|").map(g=>g.trim()).filter(Boolean);return u.length?u:null}catch{return null}}getLogicOptions(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],n=[...["DragToWin","SwerveMove","DragSnap","JoystickMove","DrawCanvas","HtmlComponent"],...t].map(a=>String(a)).filter(a=>a.trim().length>0);return Array.from(new Set(n)).sort((a,s)=>a.localeCompare(s))}catch{return[]}}renderProperty(e,t,i,n){let a=t.toLowerCase(),s=a==="logic"||a==="logic_id"||a==="logicid",o=a==="id"&&n.toLowerCase().includes("logic");if((s||o)&&typeof i=="string"){let h=this.getLogicOptions(),f=this.selectRenderer.render(e,t,i,n,h);return s?`
|
|
1169
1179
|
${f}
|
|
1170
1180
|
<div class="inspector-array-actions">
|
|
1171
1181
|
<button class="inspector-button"
|
|
@@ -1302,7 +1312,7 @@ ${f}
|
|
|
1302
1312
|
<span class="inspector-empty-icon">\u26A0\uFE0F</span>
|
|
1303
1313
|
<span class="inspector-empty-text">${e}</span>
|
|
1304
1314
|
</div>
|
|
1305
|
-
`)}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}getDefaultLogicId(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],i=["SwerveMove","DragSnap","JoystickMove","DragToWin"],n=[...t,...i].map(a=>String(a)).filter(a=>a.trim().length>0);return n.length?n[0]:"SwerveMove"}catch{return"SwerveMove"}}getDefaultPropsForLogic(e,t){return{DragToWin:{targetDrags:3},DragSnap:{targetId:"",snapRadius:100,snapDuration:.5,returnOnMiss:!0,returnDuration:.3,ease:"power2.out"},SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},JoystickMove:{speed:200,zone:"bottom-center",offsetX:0,offsetY:-50,inputId:""},Tap:{maxTapDuration:300,maxTapDistance:10,tapCount:1,tapTimeout:500},TapDestroy:{maxTapDuration:300,maxTapDistance:10,particleEffect:"sparkle",particleScale:1,particleColor:"",destroySound:"",autoDestroy:!0,animate:!0,animationDurationMs:180,ease:"power2.out"},ScratchCard:{revealId:"",maskTextureSize:512,brushRadius:18,brushSpacing:8,completionThreshold:.65,progressGridSize:32,completeOnce:!0,autoDisableOnComplete:!0,autoHideCoverOnComplete:!0,progressEvent:"logic:scratch-progress",completeEvent:"logic:scratch-complete",scratchParticleEffect:"",scratchParticleIntervalMs:45,scratchParticleScale:1,completeParticleEffect:"",completeParticleBurstCount:14,completeParticleBurstRadius:60,completeParticleScale:1,completeSound:"",completePunchScale:1.08,completePunchDurationMs:240},HandHint:{targetId:"",offset:{x:44,y:44},clickOffset:{x:-8,y:-8},clickScale:.92,clickDurationMs:160,delayMs:700,repeatDelayMs:1200,easing:"power2.out",enabled:!0},Swipe:{inputId:"",direction:"any",minDistance:50,maxDuration:1e3},Hold:{holdDuration:500,visualFeedback:!0,feedbackColor:16777215},Collectable:{targetId:"",collectRadius:50,particleEffect:"",particleScale:1,particleColor:"",autoDestroy:!0,collectSound:"",animateOnCollect:!1,collectAnimDurationMs:160,collectAnimScaleTo:.2,collectAnimAlphaTo:0,collectAnimEase:"power2.out"},ScoreHud:{prefix:"Score: ",initialScore:0,maxScore:null,events:[{name:"logic:collect",delta:1},{name:"logic:tap-destroy",delta:1}]},Spawner:{templateId:"",spawnPattern:"continuous",spawnRate:1e3,poolSize:20,returnOnInvisible:!1,positionSource:"spawner",targetId:"",targetOffset:{x:0,y:0},customPosition:{x:0,y:0},randomBounds:{x:[-100,100],y:[-100,100]},spawnPoints:[],spawnPointMode:"cycle",movementMode:"velocity",velocity:{x:0,y:-300},velocityRange:{x:null,y:null},lifetime:2e3,waveSize:5,waveDelay:2e3,burstCount:5},Damageable:{hitTemplateId:"",hitRadius:50,hp:1,invulnMs:150,flashAlpha:.3,flashDurationMs:100,hitScale:1,hitScaleDurationMs:120,knockback:{x:0,y:0},hpLabelId:"",autoDestroy:!0,hitEffect:"",destroyEffect:"",particleScale:1,particleColor:"",destroySound:"",hitEvent:"",destroyEvent:"",hitPopupText:"",hitPopupColor:"#ffffff",hitPopupFontSize:20,hitPopupDurationMs:600,hitPopupOffset:{x:0,y:-20},hitPopupRise:30,hitPopupTemplateId:""}}[e]||{}}getSectionIcon(e){return{identity:"\u{1F194}",transform:"\u{1F4D0}",render:"\u{1F3A8}",ui:"\u{1F4AC}",logic:"\u{1F3AE}",gameplay:"\u{1F3AE}",interaction:"\u{1F446}",audio:"\u{1F50A}",effects:"\u2728",motion:"\u{1F3AC}"}[e]||"\u{1F4E6}"}clear(){this.selectedObjectId=null,this.contentContainer&&(this.contentContainer.innerHTML=`
|
|
1315
|
+
`)}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}getDefaultLogicId(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],i=["SwerveMove","DragSnap","JoystickMove","DragToWin","DrawCanvas","HtmlComponent"],n=[...t,...i].map(a=>String(a)).filter(a=>a.trim().length>0);return n.length?n[0]:"SwerveMove"}catch{return"SwerveMove"}}getDefaultPropsForLogic(e,t){return{DragToWin:{targetDrags:3},DragSnap:{targetId:"",snapRadius:100,snapDuration:.5,returnOnMiss:!0,returnDuration:.3,ease:"power2.out"},SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},JoystickMove:{speed:200,zone:"bottom-center",offsetX:0,offsetY:-50,inputId:""},Tap:{maxTapDuration:300,maxTapDistance:10,tapCount:1,tapTimeout:500},TapDestroy:{maxTapDuration:300,maxTapDistance:10,particleEffect:"sparkle",particleScale:1,particleColor:"",destroySound:"",autoDestroy:!0,animate:!0,animationDurationMs:180,ease:"power2.out"},ScratchCard:{revealId:"",maskTextureSize:512,brushRadius:18,brushSpacing:8,completionThreshold:.65,progressGridSize:32,completeOnce:!0,autoDisableOnComplete:!0,autoHideCoverOnComplete:!0,progressEvent:"logic:scratch-progress",completeEvent:"logic:scratch-complete",scratchParticleEffect:"",scratchParticleIntervalMs:45,scratchParticleScale:1,completeParticleEffect:"",completeParticleBurstCount:14,completeParticleBurstRadius:60,completeParticleScale:1,completeSound:"",completePunchScale:1.08,completePunchDurationMs:240},DrawCanvas:{textureSize:512,canvasWidth:200,canvasHeight:200,lineWidth:8,lineSpacing:4,lineColor:"#000000",lineAlpha:1,backgroundColor:null,backgroundAlpha:1,clearOnStart:!0,enabled:!0},HtmlComponent:{enabled:!0},HandHint:{targetId:"",offset:{x:44,y:44},clickOffset:{x:-8,y:-8},clickScale:.92,clickDurationMs:160,delayMs:700,repeatDelayMs:1200,easing:"power2.out",enabled:!0},Swipe:{inputId:"",direction:"any",minDistance:50,maxDuration:1e3},Hold:{holdDuration:500,visualFeedback:!0,feedbackColor:16777215},Collectable:{targetId:"",collectRadius:50,particleEffect:"",particleScale:1,particleColor:"",autoDestroy:!0,collectSound:"",animateOnCollect:!1,collectAnimDurationMs:160,collectAnimScaleTo:.2,collectAnimAlphaTo:0,collectAnimEase:"power2.out"},ScoreHud:{prefix:"Score: ",initialScore:0,maxScore:null,events:[{name:"logic:collect",delta:1},{name:"logic:tap-destroy",delta:1}]},Spawner:{templateId:"",spawnPattern:"continuous",spawnRate:1e3,poolSize:20,returnOnInvisible:!1,positionSource:"spawner",targetId:"",targetOffset:{x:0,y:0},customPosition:{x:0,y:0},randomBounds:{x:[-100,100],y:[-100,100]},spawnPoints:[],spawnPointMode:"cycle",movementMode:"velocity",velocity:{x:0,y:-300},velocityRange:{x:null,y:null},lifetime:2e3,waveSize:5,waveDelay:2e3,burstCount:5},Damageable:{hitTemplateId:"",hitRadius:50,hp:1,invulnMs:150,flashAlpha:.3,flashDurationMs:100,hitScale:1,hitScaleDurationMs:120,knockback:{x:0,y:0},hpLabelId:"",autoDestroy:!0,hitEffect:"",destroyEffect:"",particleScale:1,particleColor:"",destroySound:"",hitEvent:"",destroyEvent:"",hitPopupText:"",hitPopupColor:"#ffffff",hitPopupFontSize:20,hitPopupDurationMs:600,hitPopupOffset:{x:0,y:-20},hitPopupRise:30,hitPopupTemplateId:""}}[e]||{}}getSectionIcon(e){return{identity:"\u{1F194}",transform:"\u{1F4D0}",render:"\u{1F3A8}",ui:"\u{1F4AC}",logic:"\u{1F3AE}",gameplay:"\u{1F3AE}",interaction:"\u{1F446}",audio:"\u{1F50A}",effects:"\u2728",motion:"\u{1F3AC}"}[e]||"\u{1F4E6}"}clear(){this.selectedObjectId=null,this.contentContainer&&(this.contentContainer.innerHTML=`
|
|
1306
1316
|
<div class="inspector-empty">
|
|
1307
1317
|
<span class="inspector-empty-icon">\u{1F3AF}</span>
|
|
1308
1318
|
<span class="inspector-empty-text">Select an object to inspect</span>
|
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-
|
|
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-NOMTJOWU.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};
|