handler-playable-sdk 0.3.21 → 0.3.23
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-5UGLDQKG.js → chunk-7IWQJAU5.js} +34 -34
- package/dist/index.cjs +13 -13
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +1 -1
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +1 -1
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var Vg=Object.create;var ur=Object.defineProperty;var Kg=Object.getOwnPropertyDescriptor;var Xg=Object.getOwnPropertyNames;var Zg=Object.getPrototypeOf,Jg=Object.prototype.hasOwnProperty;var We=(e,t)=>()=>(e&&(t=e(e=0)),t);var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nn=(e,t)=>{for(var i in t)ur(e,i,{get:t[i],enumerable:!0})},kc=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Xg(t))!Jg.call(e,r)&&r!==i&&ur(e,r,{get:()=>t[r],enumerable:!(n=Kg(t,r))||n.enumerable});return e};var li=(e,t,i)=>(i=e!=null?Vg(Zg(e)):{},kc(t||!e||!e.__esModule?ur(i,"default",{value:e,enumerable:!0}):i,e)),Qg=e=>kc(ur({},"__esModule",{value:!0}),e);var Ye,ws=We(()=>{"use strict";Ye=class{static get(t){var i;return(i=this.store.get(t))==null?void 0:i.data}static set(t,i){this.store.set(t,{data:i})}static has(t){return this.store.has(t)}static clear(){this.store.clear()}};Ye.store=new Map});function om(){var e,t;try{let i=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((t=(e=document.querySelector("script"))==null?void 0:e.textContent)==null?void 0:t.includes("inline-assets.js"))||window.INLINE_ASSETS),n=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(i&&!n)}catch{return!1}}async function lm(){try{if(typeof window!="undefined"){let e=await fetch("./build-settings.json");if(e.ok){let t=await e.json();return console.log("[AssetLoader] Loaded build settings:",t),t}}}catch{}return null}function cm(){try{if(typeof window!="undefined"){let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",t),t}}}catch{}return null}async function dm(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${Y}`),Object.keys(Ve).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Ve)),Ve;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Ve={...window.INLINE_ASSETS},Ve;if(!(Y==="publish"&&De!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Ve;if(!_s){let t=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",t),_s=(async()=>{try{try{let a=await import(t+"?t="+Date.now());if(a.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(a.INLINE_ASSETS)),a.INLINE_ASSETS}catch(a){console.warn("[AssetLoader] ES module import failed, trying text parse:",a)}let i=await fetch(t);if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);let n=await i.text();console.log("[AssetLoader] Received JS code, length:",n.length);let r=n.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(r)try{let a=r[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let s=new Function("return "+a)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(s)),s}catch(a){return console.warn("[AssetLoader] Failed to parse inline assets:",a),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",n.substring(0,500)),{}}catch(i){return console.warn("[AssetLoader] Failed to load inline assets:",i),{}}})()}return Ve=await _s,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Ve)),Ve}function Es(e){return e===null||typeof e!="object"||(Object.freeze(e),Object.values(e).forEach(t=>Es(t))),e}function um(e=64,t=64,i=16711680){let n=document.createElement("canvas");n.width=e,n.height=t;let r=n.getContext("2d");return r.fillStyle=`#${i.toString(16).padStart(6,"0")}`,r.fillRect(0,0,e,t),r.strokeStyle="#000",r.strokeRect(0,0,e,t),r.fillStyle="#fff",r.font="10px sans-serif",r.textAlign="center",r.fillText("MISSING",e/2,t/2),Ke.Texture.from(n)}function Ss(e,t){od.set(e,t)}var Ke,ad,sd,Dt,Y,De,ht,Ve,_s,od,zt,gr=We(()=>{"use strict";Ke=require("pixi.js");ws();ad=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",sd=om(),Dt=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,Y=sd?"publish":ad,De=Dt==null?void 0:Dt.assetsInlined;Dt!=null&&Dt.buildMode&&(Y=Dt.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${Y}`));ht=cm();ht!=null&&ht.buildMode&&(Y=ht.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${Y}`));(ht==null?void 0:ht.assetsInlined)!==void 0&&(De=ht.assetsInlined);lm().then(e=>{e!=null&&e.buildMode&&e.buildMode!==Y&&(Y=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${Y}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(De=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${ad}, Runtime: ${sd?"publish":"dev"}, Effective: ${Y}`);Ve={},_s=null;od=new Map;zt=class{static async load(t,i,n,r){let a=`${t}:${i.path}`,s=Ye.get(a);if(s!==void 0)return s;console.log(`[AssetLoader] Loading asset: ${t}, type: ${i.type}, Effective mode: ${Y}`),console.log(`[AssetLoader] Window defined: ${typeof window!="undefined"}, INLINE_ASSETS exists: ${!!(typeof window!="undefined"&&window.INLINE_ASSETS)}, keys: ${typeof window!="undefined"&&window.INLINE_ASSETS?Object.keys(window.INLINE_ASSETS).length:"N/A"}`);let o=await dm(),l=o[t];if(!l&&r&&(l=o[r],l&&console.log(`[AssetLoader] Found inline data for ${t} using configId: ${r}`)),!l&&i.path){let u=i.path.split("/");if(u.length>=2){let p=u[u.length-1].split(".")[0];o[p]&&(l=o[p],console.log(`[AssetLoader] Found inline data for ${t} using assetName: ${p}`))}}if(console.log("[AssetLoader] Inline data for",t,":",l?"FOUND":"NOT FOUND"),Y==="publish"&&De!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!l))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${t}, path: ${i.path}`);let d=od.get(i.type);if(d)try{let u=await d(i.path,l,t,n);return Ye.set(a,u),u}catch(u){return this.handleFailure(t,i.type,u)}try{let u;switch(i.type){case"image":u=await this.loadImage(i.path,l);break;case"json":u=await this.loadJSON(i.path,l),u=Es(u);break;default:throw new Error(`Unknown asset type: ${i.type}`)}return Ye.set(a,u),u}catch(u){return this.handleFailure(t,i.type,u)}}static async loadImage(t,i){let n=Y==="publish",r=n&&De!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${Y}, isPublishMode: ${n}, inlineData: ${i?"EXISTS":"MISSING"}`),r){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!i)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${t}`);if(typeof i!="string"||!i.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI string, got: ${typeof i}`);try{return await Ke.Assets.load(i)}catch(a){throw console.error("[AssetLoader] Failed to load texture from data URI:",a),a}}if(i&&typeof i=="string"&&i.startsWith("data:"))try{return await Ke.Assets.load(i)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await Ke.Assets.load(t)}return await Ke.Assets.load(t)}static async loadJSON(t,i){let n=Y==="publish",r=n&&De!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${Y}, isPublishMode: ${n}, inlineData: ${i?"EXISTS":"MISSING"}`),r){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!i)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(typeof i=="object"&&i!==null)return i;if(typeof i=="string"&&i.startsWith("data:")){let s=atob(i.split(",")[1]);return JSON.parse(s)}return JSON.parse(i)}if(i){if(typeof i=="object"&&i!==null)return i;if(typeof i=="string"&&i.startsWith("data:")){let s=atob(i.split(",")[1]);return JSON.parse(s)}return JSON.parse(i)}let a=await fetch(t);if(!a.ok)throw new Error(`JSON fetch failed: ${t}`);return a.json()}static handleFailure(t,i,n){if(Y==="dev"){let a=i==="image"?um():Es({__placeholder:!0,type:i});return Ye.set(t+":"+((n==null?void 0:n.path)||"missing"),a),a}throw n}};Ss("image",async(e,t)=>{let i=Y==="publish",n=i&&De!==!1,r=Y==="brand",a=i&&De===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${Y}, isPublishMode: ${i}, isBrandMode: ${r}, inlineData: ${t?"EXISTS":"MISSING"}`),n){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(typeof t!="string"||!t.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI string, got: ${typeof t}`);return Ke.Assets.load(t)}let s=e;return(r||a)&&e&&!e.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(s=e,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${e}" as-is`)):(s=`assets/${e}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${e}" -> "${s}"`))),Ke.Assets.load(t||s)});Ss("json",async(e,t)=>{let i=Y==="publish",n=i&&De!==!1,r=Y==="brand",a=i&&De===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${Y}, isPublishMode: ${i}, isBrandMode: ${r}, inlineData: ${t?"EXISTS":"MISSING"}`),n){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);return typeof t=="object"&&t!==null?t:typeof t=="string"&&t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t)}let s=e;if((r||a)&&e&&!e.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(s=e,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${e}" as-is`)):(s=`assets/${e}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${e}" -> "${s}"`))),t)return typeof t=="object"&&t!==null?t:typeof t=="string"&&t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t);let o=await fetch(s);if(!o.ok)throw new Error(`JSON fetch failed: ${e}`);return o.json()})});var cd={};nn(cd,{AssetTextures:()=>ze,initAssetTextures:()=>Ts});function Ts(e,t){ld.init(e,t),typeof window!="undefined"&&(window.__AssetTextures=ze)}var Cs,ld,ze,pi=We(()=>{"use strict";gr();Cs=class{constructor(){this.textures=new Map;this.readyPromise=null;this.priorityReadyPromise=null;this.priorityReadyResolve=null;this.config=null;this.app=null;this.attempted=new Set;this.waiters=new Set}init(t,i){if(this.config===t&&this.app===i&&this.priorityReadyPromise){console.log("[AssetTextures] init called with same config/app; keeping existing state");return}this.textures.clear(),this.readyPromise=null,this.priorityReadyPromise=null,this.priorityReadyResolve=null,this.attempted.clear(),this.waiters.clear(),this.priorityReadyPromise=new Promise(n=>{this.priorityReadyResolve=n}),this.config=t,this.app=i,console.log("[AssetTextures] Initialized with config, cleared previous textures")}async ready(){if(this.readyPromise){await this.readyPromise;return}if(!this.config)throw new Error("[AssetTextures] Must call init() before ready() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before ready() - app is null");let t=this.config,i=this.app;return this.readyPromise=(async()=>{var s;console.log("[AssetTextures] Loading all assets...");let n=new Set(["background_loading_1"]),r=[],a=[];for(let[o,l]of t.objects.entries()){let c=(s=l.render)==null?void 0:s.asset;if(!c)continue;let d=async()=>{var u;try{let p=(u=l.identity)==null?void 0:u.id;console.log(`[AssetTextures] Loading ${c.type}: ${o} (${p})`);let f=await zt.load(o,c,i,p);this.textures.set(o,f),console.log(`[AssetTextures] \u2713 Loaded: ${o}`)}catch(p){console.error(`[AssetTextures] \u2717 Failed to load: ${o}`,p)}finally{this.attempted.add(o);try{for(let p of Array.from(this.waiters))p()}catch{}}};n.has(o)?r.push(d()):a.push(d())}r.length>0&&(console.log("[AssetTextures] Phase 1: Loading priority assets (loading screen)..."),await Promise.all(r),console.log("[AssetTextures] Phase 1: Priority assets ready")),this.priorityReadyResolve&&this.priorityReadyResolve(),console.log("[AssetTextures] Phase 2: Loading remaining assets..."),await Promise.all(a),console.log("[AssetTextures] All textures loaded:",Array.from(this.textures.keys()))})(),this.readyPromise}async priorityReady(){return this.priorityReadyPromise?this.priorityReadyPromise:Promise.resolve()}async waitFor(t,i={}){if(!this.config)throw new Error("[AssetTextures] Must call init() before waitFor() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before waitFor() - app is null");let r=Array.from(new Set((t||[]).filter(o=>typeof o=="string"&&o))).filter(o=>{var l,c,d,u;try{let p=(d=(c=(l=this.config)==null?void 0:l.objects)==null?void 0:c.get)==null?void 0:d.call(c,o);return!!((u=p==null?void 0:p.render)!=null&&u.asset)}catch{return!1}});if(r.length===0)return;this.ready().catch(()=>{});let a=()=>r.every(o=>this.textures.has(o)||this.attempted.has(o));if(a())return;let s=typeof i.timeoutMs=="number"?i.timeoutMs:15e3;await new Promise(o=>{let l=!1,c=()=>{l||a()&&(l=!0,this.waiters.delete(c),o())};this.waiters.add(c),c(),s>0&&setTimeout(()=>{l||(l=!0,this.waiters.delete(c),console.warn("[AssetTextures] waitFor timed out; continuing",{ids:r}),o())},s)})}get(t){return this.textures.get(t)}set(t,i){this.textures.set(t,i),console.log(`[AssetTextures] Updated texture: ${t}`)}clear(){this.textures.clear(),this.readyPromise=null,console.log("[AssetTextures] Cleared all textures")}getAllIds(){return Array.from(this.textures.keys())}},ld=new Cs,ze=new Proxy(ld,{get(e,t){return t in e&&typeof e[t]=="function"?e[t].bind(e):e.get(t)},set(e,t,i){return e.set(t,i),!0}})});var Or={};nn(Or,{applyConfigOverride:()=>mt,applyConfigOverrides:()=>bt,applyConfigsToDisk:()=>kr,clearConfigOverrides:()=>un,clearConfigOverridesForObject:()=>wd,configOverrideManager:()=>_d,deepClone:()=>ne,exportConfigsAsJSON:()=>Ms,getConfigOverrides:()=>de,getConfigStateSummary:()=>Tr,getOverrideMode:()=>dn,removeConfigOverride:()=>Cr,resetToApplied:()=>pn,resetToOriginal:()=>Lr,setOverrideMode:()=>Is});function Sr(){return typeof window=="undefined"?null:window.__editableConfig||null}function md(){return typeof window=="undefined"?null:window.__editableConfigBaseline||null}function hd(e,t){var i,n;if(!e)return null;try{if(e instanceof Map)return(i=e.get(t))!=null?i:null;if(typeof e=="object")return(n=e[t])!=null?n:null}catch{}return null}function Dm(e,t,i){if(e){if(e instanceof Map){e.set(t,i);return}typeof e=="object"&&(e[t]=i)}}function bd(e,t){for(let i of t)cn(e,i.path,i.value)}function yd(e){var o;if(typeof window=="undefined")return;let t=Sr();if(!t)return;let i=md(),n=(o=i?hd(i.objects,e):null)!=null?o:hd(t.objects,e);if(!n)return;let r=ne(n),a=de().filter(l=>l.objectId===e);try{bd(r,a)}catch(l){console.error("[CONFIG] Failed to reapply overrides for object",e,l);return}Dm(t.objects,e,r);let s=window.applyEditableObjectConfig;if(typeof s=="function")try{s(e,r)}catch{}}function zm(){var r;if(typeof window=="undefined")return;let e=Sr();if(!(e!=null&&e.engine))return;let t=md(),i=ne(((r=t==null?void 0:t.engine)!=null?r:e.engine)||{}),n=de().filter(a=>!a.objectId&&!a.sceneId);try{bd(i,n)}catch(a){console.error("[CONFIG] Failed to reapply engine overrides",a);return}try{let a=e.engine;for(let s of Object.keys(a))s in i||delete a[s];for(let[s,o]of Object.entries(i))a[s]=o}catch{e.engine=i}}function Nm(){if(typeof window=="undefined")return"unknown";let e=window;return typeof e.__HANDLER_PROJECT_ID=="string"?e.__HANDLER_PROJECT_ID:"handler-default"}function vd(){return`handler_preview_config_overrides::${Nm()}`}function Bm(){if(typeof window=="undefined")return[];try{let e=window.localStorage.getItem(vd());if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Ar(e){if(typeof window!="undefined")try{window.localStorage.setItem(vd(),JSON.stringify(e))}catch{}}function dn(){return typeof window=="undefined"?!1:window.__enableConfigOverrides===!0}function Is(e){if(typeof window!="undefined"){window.__enableConfigOverrides=e;try{window.localStorage.setItem(xd,e?"true":"false")}catch{}}}function mt(e,t={}){var p,f;let{objectId:i,path:n,value:r}=e,{silent:a=!1,persist:s=!0,emitEvent:o=!0}=t,l=Sr();if(!l){console.warn("[CONFIG] applyConfigOverride: No editable config found in window.__editableConfig");return}let c=i?(f=(p=l.objects)==null?void 0:p.get)==null?void 0:f.call(p,i):l.engine;if(!c){console.warn("[CONFIG] applyConfigOverride: Override target not found:",{objectId:i,path:n,hasObjects:!!l.objects});return}a||console.log("[CONFIG] applyConfigOverride: Target found, applying...",{objectId:i,path:n,value:r});let d;try{d=Hm(c,n),cn(c,n,r)}catch(m){console.error("[CONFIG] applyConfigOverride failed:",{objectId:i,path:n,value:r},m);return}window.__configChanges=window.__configChanges||[];let u=window.__configChanges;if(u.push({objectId:i,path:n,oldValue:d,newValue:r,ts:Date.now()}),u.length>Fm&&u.shift(),s){let m=de(),h=m.findIndex(g=>g.objectId===i&&g.sceneId===e.sceneId&&g.path===n);h>=0?m[h].value=r:m.push(e),window.__configOverrides=m,Ar(m),dn()||Is(!0)}a||console.log("[CONFIG] Applied override:",e),o&&typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("config:changed",{detail:e}))}function bt(e,t={}){let i=t.emitEvent!==!1,n=[];for(let r of e)r!=null&&r.objectId&&typeof r.objectId=="string"&&n.push(r.objectId),mt(r,{...t,emitEvent:!1});if(i&&typeof window!="undefined"){let r=Array.from(new Set(n));window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"batch",objectIds:r,count:e.length}}))}}function un(){window.__configOverrides=[],window.__configChanges=[],Ar([]),console.log("[CONFIG] Cleared all overrides")}function wd(e){let t=de().filter(n=>n.objectId!==e);window.__configOverrides=t,Ar(t);let i=window.__configChanges||[];window.__configChanges=i.filter(n=>n.objectId!==e),yd(e),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"clear_object",objectId:e}}))}function Cr(e,t){let i=de().filter(r=>r.objectId!==e||r.path!==t);window.__configOverrides=i,Ar(i);let n=window.__configChanges||[];window.__configChanges=n.filter(r=>r.objectId!==e||r.path!==t),e?yd(e):zm(),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"remove",objectId:e,path:t}}))}function de(){return typeof window=="undefined"?[]:(window.__configOverrides||(window.__configOverrides=Bm()),window.__configOverrides||[])}function cn(e,t,i){var s;let n=t.split("."),r=n.pop(),a=e;for(let o of n){if(a[o]!==void 0&&typeof a[o]!="object")throw new Error(`Invalid override path: ${t} (hit primitive at ${o})`);a[o]=(s=a[o])!=null?s:{},a=a[o]}a[r]=i}function Hm(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function ne(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Set)return new Set([...e].map(i=>ne(i)));if(ArrayBuffer.isView(e))return e.slice();if(e instanceof Array)return e.map(i=>ne(i));if(e instanceof Map){let i=new Map;return e.forEach((n,r)=>i.set(r,ne(n))),i}let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=ne(e[i]));return t}function Ms(){let e=window.__editableConfigBaseline;if(!e){let t=window.__editableConfig;if(!t)throw new Error("Cannot export: no config loaded");return gd(t)}return gd(e)}function gd(e){let t={objects:{},scenes:{},engine:ne(e.engine||{})},i=e.objects;if(i instanceof Map)i.forEach((a,s)=>{t.objects[s]=ne(a)});else if(i&&typeof i=="object")for(let a in i)t.objects[a]=ne(i[a]);let n=e.scenes;if(n instanceof Map)n.forEach((a,s)=>{t.scenes[s]=ne(a)});else if(n&&typeof n=="object")for(let a in n)t.scenes[a]=ne(n[a]);let r=de();for(let a of r)a.objectId?(t.objects[a.objectId]||(t.objects[a.objectId]={}),cn(t.objects[a.objectId],a.path,a.value)):a.sceneId?(t.scenes[a.sceneId]||(t.scenes[a.sceneId]={}),cn(t.scenes[a.sceneId],a.path,a.value)):cn(t.engine,a.path,a.value);return t}function Tr(){let e=de(),t=new Set;for(let i of e)i.objectId?t.add(i.objectId):t.add("__engine__");return{modifiedObjects:Array.from(t),overrideCount:e.length,hasChanges:e.length>0,overrides:e}}async function kr(e){let t=Ms(),i={};for(let[r,a]of Object.entries(t.objects)){let s=a,o=r;/^(json\.|ui\.|effects\.|engine\.)/.test(o)||(o=`json.${r}`),s&&typeof s=="object"&&(s.identity||(s.identity={}),s.identity.id=o),i[`objects/${o}.json`]=s}t.engine&&(t.engine.runtime&&(i["engine/engine.runtime.json"]=t.engine.runtime),t.engine.assets&&(i["engine/engine.assets.json"]=t.engine.assets),t.engine.splash&&(i["engine/engine.splash.json"]=t.engine.splash),t.engine.loading&&(i["engine/engine.loading.json"]=t.engine.loading),t.engine.start&&(i["engine/engine.start.json"]=t.engine.start),t.engine.tutorial&&(i["engine/engine.tutorial.json"]=t.engine.tutorial),t.engine.endgame&&(i["engine/engine.endgame.json"]=t.engine.endgame),!t.engine.runtime&&!t.engine.assets&&(i["engine/engine.json"]=t.engine));for(let[r,a]of Object.entries(t.scenes)){let s=r.startsWith("scene.")?r:`scene.${r}`;i[`scenes/${s}.json`]=a}let n=await fetch("/api/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:i,assets:{},hadCacheAtApply:de().length>0,versionName:e})});if(!n.ok){let r=await n.json();throw new Error(`Apply failed: ${r.error||"Unknown error"}`)}un();try{let r=Sr();r&&(window.__editableConfigBaseline=ne(r))}catch{}localStorage.setItem("handler_last_applied",Date.now().toString()),console.log("[Config Persistence] \u2705 Applied to disk successfully")}function pn(){un(),window.location.reload()}async function Lr(){if(!confirm("This will restore all configs to their original state. All uncommitted changes in cache AND applied changes will be lost. Continue?"))return;let t=await fetch("/api/reset-to-original",{method:"POST"});if(!t.ok){let i=await t.json();throw new Error(`Reset failed: ${i.error||"Unknown error"}`)}un(),window.location.reload()}var xd,Fm,_d,Te=We(()=>{"use strict";xd="handler_preview_override_mode";if(typeof window!="undefined"){let e=window.localStorage.getItem(xd);window.__enableConfigOverrides=e===null?!0:e==="true"}Fm=500;_d={getCurrentConfig(){return window.__editableConfig||null},getChanges(){return window.__configChanges||[]},clearChanges(){window.__configChanges=[]}}});function $m(e,t){try{if(typeof e=="object"&&e!==null)return e;if(typeof e!="string")return null;if(e.startsWith("data:")){let n=e.indexOf(",");if(n===-1)return null;let r=e.slice(0,n);if(!r.includes("application/json")&&!r.includes("text/plain"))return null;let a=e.slice(n+1),s=r.includes("base64")?typeof atob=="function"?atob(a):a:decodeURIComponent(a);return JSON.parse(s)}let i=e.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(e):null}catch{return null}}function Um(e){if(typeof window=="undefined"||!window.INLINE_ASSETS)return null;let t=window.INLINE_ASSETS,i=e.replace(/^\.\/+/,""),n=i.split("/").pop()||i,r=[i,n,i.replace(/\.json$/,""),n.replace(/\.json$/,"")];for(let a of r){let s=t[a];if(s){let o=$m(s,a);if(o!==null)return o}}return null}async function fn(e){if(Rs.has(e)&&!Ps)return console.log(`[CONFIG] Using cached config for: "${e}"`),Rs.get(e);if(console.log(`[CONFIG] loadConfigFile called with: "${e}", MODE: ${G.toUpperCase()}, CACHE: ${Ps?"DISABLED":"ENABLED"}`),G==="publish"){let n=Um(e);return n?(console.log(`[CONFIG] \u2713 Loaded ${e} via INLINE_ASSETS`),n):(console.log(`[CONFIG] \u2139\uFE0F Optional config ${e} not in INLINE_ASSETS, skipping fetch in publish mode`),{})}G==="brand"||console.log(`[CONFIG] DEV MODE: Trying nested paths first, then flattened for "${e}"`);let t;G==="brand"?t=[`./${e.split("/").pop()||e}`,`./${e}`,`./${e.replace(/^configs\//,"")}`,`./${e.replace(/^configs\//,"").replace(/\//g,".")}`]:t=[`./${e}`,`./${e.replace(/^configs\//,"")}`,`./${e.replace(/^configs\//,"").replace(/\//g,".")}`],t=Array.from(new Set(t.flatMap(n=>n.startsWith("./")?[n,`/${n.slice(2)}`]:n.startsWith("/")?[n]:[n,`/${n}`]))),console.log("[CONFIG] Will try candidates:",t);let i=(async()=>{let n=Ps?"no-store":"force-cache";for(let r of t)try{let a=await fetch(r,{cache:n});if(!a.ok)continue;let s=await a.json();return console.log(`[CONFIG] \u2713 Loaded ${e} via ${r}`,s),s}catch(a){console.warn(`[CONFIG] \u2717 Failed to load ${r} (mode: ${G}):`,a)}return console.warn(`[CONFIG] \u2717 All attempts failed for ${e}; using defaults`),{}})();return Rs.set(e,i),i}async function Ir(){console.log("[CONFIG] Loading component schemas...");let e=["components/identity.schema.json","components/transform.schema.json","components/render.schema.json","components/motion.schema.json","components/effects.schema.json","components/interaction.schema.json","components/gameplay.rules.schema.json","components/gameplay.tuning.schema.json","components/visibility.schema.json","components/audio.schema.json","components/physics.schema.json","components/ui.schema.json"],t=new Map;for(let i of e)try{let n=G==="publish"||G==="brand"?i.split("/").pop()||i:`configs/${i}`,r=await fn(n);r.component&&(t.set(r.component,r),console.log(`[CONFIG] \u2713 Schema loaded: ${r.component} ${G==="publish"||G==="brand"?"(flattened)":"(nested)"}`))}catch(n){console.warn(`[CONFIG] \u2717 Failed to load schema ${i}:`,n)}return console.log(`[CONFIG] Loaded ${t.size} component schemas`),t}async function yt(e){console.log(`[CONFIG] Loading object config: ${e}`);let t=G==="publish"||G==="brand"?`${e}.json`:`configs/objects/${e}.json`;return await fn(t)}async function Mr(e){let t=new Map;if(e.objects&&Array.isArray(e.objects)){for(let i of e.objects)if(i.enabled&&i.object_config)try{let n=i.instance_id;/^(json\.|ui\.|effects\.|engine\.)/.test(n)||(n=`json.${n}`);let r=await yt(n);(!r||Object.keys(r).length===0)&&n!==i.instance_id&&(r=await yt(i.instance_id)),!r||Object.keys(r).length===0?(console.log(`[CONFIG] No instance snapshot for ${i.instance_id}, using template ${i.object_config}`),r=await yt(i.object_config)):console.log(`[CONFIG] \u2713 Loaded instance snapshot for ${i.instance_id}`),t.set(i.instance_id,{...r,instance_id:i.instance_id,object_config:i.object_config})}catch(n){console.warn(`Failed to load object ${i.object_config}:`,n)}}return t}async function Rr(){console.log("[CONFIG] Loading engine configs...");let e=["runtime","assets","splash","loading","start","tutorial","endgame"],t=await Promise.all(e.map(n=>{let r=`engine.${n}.json`,a=G==="publish"||G==="brand"?r:`configs/engine/${r}`;return fn(a)})),i=Object.fromEntries(e.map((n,r)=>[n,t[r]]));return console.log("[CONFIG] Engine configs loaded:",Object.fromEntries(e.map(n=>{var s;let r=(s=i[n])!=null?s:{},a=Object.keys(r);return[n,a.length>0?a:"empty"]}))),i}async function js(){return await fn(G==="publish"||G==="brand"?"game.prompt.json":"configs/engine/game.prompt.json")}async function Pr(e="scene.main"){console.log(`[CONFIG] Loading scene config: ${e}`);let t=G==="publish"||G==="brand"?`${e}.json`:`configs/scenes/${e}.json`;return await fn(t)}function fi(e,t){let i=[];if(!e.identity)return i.push("Missing required identity component"),{valid:!1,errors:i};let n=t.get("identity");if(n)for(let r of n.required||[])e.identity[r]||i.push(`Missing required identity field: ${r}`);for(let[r,a]of Object.entries(e)){if(r==="identity")continue;let s=t.get(r);if(s&&a&&typeof a=="object"){let o=a;for(let l of s.required||[])o[l]===void 0&&i.push(`Missing required field in ${r}: ${l}`);if(s.constraints&&typeof s.constraints=="object")for(let[l,c]of Object.entries(s.constraints)){let d=o[l];if(d!==void 0&&c&&typeof c=="object"){let u=c;typeof d=="number"&&(u.min!==void 0&&d<u.min&&i.push(`${r}.${l} value ${d} is below minimum ${u.min}`),u.max!==void 0&&d>u.max&&i.push(`${r}.${l} value ${d} is above maximum ${u.max}`))}}}}return{valid:i.length===0,errors:i}}function Bt(e,t){let i={...e},n=["identity","transform","render"];for(let[r,a]of t.entries())a.defaults&&Object.keys(a.defaults).length>0&&(n.includes(r)||i[r])&&(i[r]||(i[r]={}),i[r]={...a.defaults,...i[r]});return i}function xe(e,t,i,n){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(Math.max(e,i),n)}function Sd(e,t){if(Array.isArray(e))return{x:xe(e[0],t.x,-2e3,2e3),y:xe(e[1],t.y,-2e3,2e3)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:xe(i,t.x,-2e3,2e3),y:xe(n,t.y,-2e3,2e3)}}function qm(e,t){if(Array.isArray(e))return{x:xe(e[0],t.x,0,1),y:xe(e[1],t.y,0,1)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:xe(i,t.x,0,1),y:xe(n,t.y,0,1)}}function Gm(e){if(Array.isArray(e))return{x:xe(e[0],.5,-10,10),y:xe(e[1],.5,-10,10)};if(e&&typeof e=="object"){let{x:t,y:i}=e;return{x:xe(t,.5,-10,10),y:xe(i,.5,-10,10)}}return typeof e=="string"?e:null}async function Qe(e="scene.main",t){var l,c,d,u,p,f,m,h,g,b,y,v,x,w;console.log("[CONFIG] ===== Starting Object-Centric Config Load =====");let i=await Ir(),n=de();n.length>0&&console.log(`[CONFIG] Applying ${n.length} active overrides`);let r=await Pr(e);console.log(`[CONFIG] Scene config loaded: ${((l=r.objects)==null?void 0:l.length)||0} objects`);let a=await Rr();console.log("[CONFIG] Loading object configs...");let s=await Mr(r);console.log(`[CONFIG] Loaded ${s.size} object configs:`,Array.from(s.keys()));for(let[S,A]of s.entries()){let _=Bt(A,i),T=fi(_,i);T.valid||console.warn(`Object ${S} validation errors:`,T.errors),(c=_.transform)!=null&&c.position&&(_.transform.position=Sd(_.transform.position,{x:0,y:0})),(d=_.transform)!=null&&d.offset&&(_.transform.offset=Sd(_.transform.offset,{x:0,y:0})),((u=_.transform)==null?void 0:u.anchor)!==void 0&&(_.transform.anchor=Gm(_.transform.anchor)),((p=_.transform)==null?void 0:p.position_ratio)!==void 0&&_.transform.position_ratio!==null&&(_.transform.position_ratio=qm(_.transform.position_ratio,{x:.5,y:.5})),s.set(S,_)}if(t){if(t.objects)for(let[S,A]of t.objects.entries())s.set(S,A);t.engine&&(a.runtime={...a.runtime,...t.engine.runtime},a.assets={...a.assets,...t.engine.assets},a.splash={...(f=a.splash)!=null?f:{},...(m=t.engine.splash)!=null?m:{}})}let o={objects:s,engine:a,scene:r,schemas:i,theme:{background_color:"#ffffff",text_color:"#000000",square_color:"#cccccc",cta_background:"#007bff",cta_text:"#ffffff"},gameplay:{}};return typeof window!="undefined"&&(window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=Bt(o,i))),n.length>0&&dn()&&bt(n,{silent:!0,persist:!1}),console.log("[CONFIG] ===== Object-Centric Config Load Complete ====="),console.log("[CONFIG] Summary:",{schemas:Array.from(i.keys()),objects:Array.from(s.keys()),engine:{runtime:Object.keys((h=a.runtime)!=null?h:{}),assets:Object.keys((g=a.assets)!=null?g:{}),splash:Object.keys((b=a.splash)!=null?b:{}),loading:Object.keys((y=a.loading)!=null?y:{}),start:Object.keys((v=a.start)!=null?v:{}),tutorial:Object.keys((x=a.tutorial)!=null?x:{}),endgame:Object.keys((w=a.endgame)!=null?w:{})},scene:r.scene_id||"unknown"}),o}function Ds(e){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,S,A,_,T,M,E,L,z,D,B,O,P,C;let t={gameplay:{},ui:{},theme:{},assets:{}};for(let[I,j]of e.objects.entries()){let Q=((i=j.identity)==null?void 0:i.id)||I;Q.includes("character")&&(t.gameplay.character_pos=((n=j.transform)==null?void 0:n.position)||{x:0,y:0},t.gameplay.character_scale=((r=j.transform)==null?void 0:r.scale)||1,t.gameplay.character_anim_speed=((s=(a=j.gameplay)==null?void 0:a.tuning)==null?void 0:s.anim_speed)||.003,t.gameplay.character_relief_scale=((l=(o=j.gameplay)==null?void 0:o.tuning)==null?void 0:l.relief_scale)||1.22,t.gameplay.character_relief_speed=((d=(c=j.gameplay)==null?void 0:c.tuning)==null?void 0:d.relief_speed)||.22),(Q.includes("gun")||Q.includes("flame"))&&(t.gameplay.gun=j.gun||{},t.gameplay.gunmuzzle=((u=j.effects)==null?void 0:u.gunmuzzle)||{},t.gameplay.muzzle_levels=((p=j.effects)==null?void 0:p.muzzle_levels)||{},t.gameplay.flame=((f=j.effects)==null?void 0:f.flame)||{}),Q.includes("diamond")&&(t.gameplay.diamond=j),Q.includes("ice")&&(t.gameplay.melt=j.melt||{},t.gameplay.melt_anchor=((m=j.transform)==null?void 0:m.melt_anchor)||{x:0,y:0},t.gameplay.melt_pos=((h=j.transform)==null?void 0:h.position)||{x:0,y:0},t.gameplay.hybrid_melting=((g=j.effects)==null?void 0:g.hybrid_melting)||{},t.gameplay.physics_chunks=((b=j.effects)==null?void 0:b.physics_chunks)||{},t.gameplay.melting_particles=((y=j.effects)==null?void 0:y.melting_particles)||{},t.gameplay.hard_ice=j.hard_ice||{}),Q.includes("water")&&(t.gameplay.water_drops=j),Q.includes("crack")&&(t.gameplay.crack=j),Q.includes("hand")&&(t.gameplay.hand=((v=j.gameplay)==null?void 0:v.tuning)||{},t.gameplay.brush_start_pos=((x=j.transform)==null?void 0:x.brush_start_pos)||{x:0,y:-120},t.gameplay.hand_scale=((w=j.transform)==null?void 0:w.scale)||1.5),Q.includes("hazard")&&(t.gameplay.hazard=((S=j.gameplay)==null?void 0:S.tuning)||{},t.gameplay.danger_pos=((A=j.transform)==null?void 0:A.danger_pos)||{x:0,y:235},t.gameplay.danger_pulse=((T=(_=j.gameplay)==null?void 0:_.tuning)==null?void 0:T.danger_pulse)||{},t.gameplay.hazard_height=((E=(M=j.gameplay)==null?void 0:M.tuning)==null?void 0:E.hazard_height)||140)}return t.gameplay.timeline=((L=e.engine.runtime)==null?void 0:L.timeline)||{},t.gameplay.drag_surface=((z=e.engine.runtime)==null?void 0:z.drag_surface)||{},t.gameplay.background=((D=e.engine.runtime)==null?void 0:D.background)||{},t.gameplay.ui_styles=((B=e.engine.runtime)==null?void 0:B.ui_styles)||{},t.gameplay.label_pulse=((O=e.engine.runtime)==null?void 0:O.label_pulse)||{},t.ui=((P=e.engine.runtime)==null?void 0:P.ui)||{},t.theme=((C=e.engine.runtime)==null?void 0:C.theme)||{},t.assets=e.engine.assets||{},t}var Ed,G,Rs,Ps,zs=We(()=>{"use strict";Te();Ed=null,G="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)Ed=e,G=e.buildMode,console.log("[CONFIG] Loaded inline build settings:",e,"buildMode:",G);else try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let i=JSON.parse(t.responseText);Ed=i,G=i.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",i,"buildMode:",G)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",G)}catch(t){console.log("[CONFIG] Failed to load build-settings.json:",t instanceof Error?t.message:String(t))}}console.log("[CONFIG] Final buildMode:",G);Rs=new Map,Ps=G==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});function Ns(e,t){let i=[];function n(r,a,s=""){if(r!==a){if(typeof r!=typeof a){i.push(`${s}: type changed`);return}if(typeof r=="object"&&r!==null&&a!==null){let o=new Set([...Object.keys(r),...Object.keys(a)]);for(let l of o){let c=s?`${s}.${l}`:l;l in r?l in a?n(r[l],a[l],c):i.push(`${c}: removed`):i.push(`${c}: added`)}}else i.push(`${s}: changed`)}}return n(e,t),i}function Bs(e,t,i,n){let r={...i};for(let[a,s]of n.entries())r[a]&&s.defaults&&(r[a]={...s.defaults,...r[a]});return r}var hn,Ft,Fs=We(()=>{"use strict";hn=class{shouldFullReload(t){return t.type==="component"||t.type==="scene"}getAffectedObjects(t){return t.type==="object"&&t.objectId?[t.objectId]:[]}},Ft=class{constructor(t=1e3){this.pollingInterval=null;this.fileHashes=new Map;this.callbacks=new Map;this.intervalMs=t}watch(t,i){this.callbacks.set(t,i),this.pollingInterval===null&&(this.pollingInterval=window.setInterval(()=>{this.checkAllFiles()},this.intervalMs))}async checkAllFiles(){for(let[t,i]of this.callbacks.entries())try{let n=`${t}?t=${Date.now()}&r=${Math.random()}`,r=await fetch(n,{cache:"no-cache",headers:{"Cache-Control":"no-cache"}});if(r.ok){let a=await r.text(),s=this.hashString(a),o=this.fileHashes.get(t);if(o&&o!==s&&console.log(`[HOT-RELOAD] File changed: ${t}`),o&&o!==s){console.log(`[HOT-RELOAD] File changed: ${t}`);let l=this.determineEventType(t);i(l),this.fileHashes.set(t,s)}else o||this.fileHashes.set(t,s)}}catch(n){console.warn(`Failed to check ${t}:`,n)}}determineEventType(t){var i,n;return t.includes("/components/")?{type:"component",path:t,componentName:(i=t.split("/").pop())==null?void 0:i.replace(".schema.json","")}:t.includes("/engine/")?{type:"engine",path:t}:t.includes("/scenes/")?{type:"scene",path:t}:t.includes("/objects/")?{type:"object",path:t,objectId:(n=t.split("/").pop())==null?void 0:n.replace(".json","")}:{type:"object",path:t}}hashString(t){let i=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);i=(i<<5)-i+r,i=i&i}return i.toString()}unwatch(t){this.callbacks.delete(t),this.fileHashes.delete(t)}stop(){this.pollingInterval!==null&&(clearInterval(this.pollingInterval),this.pollingInterval=null),this.callbacks.clear(),this.fileHashes.clear()}}});function $s(e){if(typeof window=="undefined")return;let t=typeof Hs!="undefined"&&!!Hs.hot,i=window.location.search.includes("hot-reload");if(!(t||i))return;let r=null,a=!1,s=null;if(i){s=new Ft;let m=window.__configWatcher;m!=null&&m.stop&&m.stop(),window.__configWatcher=s}let o=new Set,l=m=>{var b,y;if(!s)return;let h=new Set;h.add("configs/engine/engine.runtime.json"),h.add("configs/engine/engine.assets.json"),h.add("configs/engine/engine.splash.json"),h.add("configs/scenes/scene.main.json");let g=(y=(b=m.scene)==null?void 0:b.objects)!=null?y:[];for(let v of g)v!=null&&v.object_config&&h.add(`configs/objects/${v.object_config}.json`);for(let v of o)h.has(v)||s.unwatch(v);for(let v of h)o.has(v)||s.watch(v,x=>f(x));o=h},c=new Set,d=!1,u=async m=>{let h=await yt(m),g=Bt(h,e.activeConfig.schemas),b=fi(g,e.activeConfig.schemas);b.valid||console.warn(`[HOT-RELOAD] ${m} validation errors:`,b.errors),await e.liveEditBridge.applyObjectConfig(m,g)};async function p(m){if(!a){a=!0;try{if(d||c.size===0){e.audioSystem.destroy();let h=await Qe("scene.main");e.setActiveConfig(h),e.gameObjectManager.updateConfig(h),e.CustomAssets.updateConfig(h),await e.CustomAssets.ready();let g=e.createAudioSystem(h);e.setAudioSystem(g),window.__audioSystem=g,await g.start(),e.liveEditBridge.rebuildIndexes(),l(h),console.log(`[GAME] Hot-reload complete (${m})`)}else{let h=Array.from(c);c.clear();for(let g of h)await u(g);console.log(`[GAME] Hot-reload updated objects: ${h.join(", ")}`)}}catch(h){console.warn("[GAME] Hot-reload failed:",h)}finally{a=!1,d=!1,c.clear()}}}function f(m){m.type==="object"&&m.objectId?c.add(m.objectId):d=!0,r&&window.clearTimeout(r),r=window.setTimeout(()=>{p(m.type)},120)}t&&Hs.hot.on("config-change",()=>{f({type:"hmr"})}),i&&(l(e.activeConfig),console.log(`[GAME] Hot-reload watcher enabled (${o.size} files)`))}var Hs,Ad=We(()=>{"use strict";Fs();zs();Hs={}});var Cd={};nn(Cd,{ConfigWatcher:()=>Ft,DefaultReloadStrategy:()=>hn,applyDefaults:()=>Bt,diffConfigs:()=>Ns,loadAllObjectConfigs:()=>Mr,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Rr,loadGamePromptConfig:()=>js,loadObjectCentricConfig:()=>Qe,loadObjectConfig:()=>yt,loadSceneConfig:()=>Pr,rehydrateObject:()=>Bs,setupHotReload:()=>$s,toLegacyFormat:()=>Ds,validateObjectConfig:()=>fi});var jr=We(()=>{"use strict";zs();Fs();Ad()});var gn=k((h1,Ws)=>{"use strict";typeof process=="undefined"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Ws.exports={nextTick:Vm}:Ws.exports=process;function Vm(e,t,i,n){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,a,s;switch(r){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,i)});case 4:return process.nextTick(function(){e.call(null,t,i,n)});default:for(a=new Array(r-1),s=0;s<a.length;)a[s++]=arguments[s];return process.nextTick(function(){e.apply(null,a)})}}});var kd=k((g1,Td)=>{"use strict";var Km={}.toString;Td.exports=Array.isArray||function(e){return Km.call(e)=="[object Array]"}});var Ys=k((m1,Ld)=>{"use strict";Ld.exports=require("stream")});var mn=k((Vs,Id)=>{"use strict";var Jr=require("buffer"),et=Jr.Buffer;function Od(e,t){for(var i in e)t[i]=e[i]}et.from&&et.alloc&&et.allocUnsafe&&et.allocUnsafeSlow?Id.exports=Jr:(Od(Jr,Vs),Vs.Buffer=gi);function gi(e,t,i){return et(e,t,i)}Od(et,gi);gi.from=function(e,t,i){if(typeof e=="number")throw new TypeError("Argument must not be a number");return et(e,t,i)};gi.alloc=function(e,t,i){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=et(e);return t!==void 0?typeof i=="string"?n.fill(t,i):n.fill(t):n.fill(0),n};gi.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return et(e)};gi.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Jr.SlowBuffer(e)}});var mi=k(oe=>{"use strict";function Xm(e){return Array.isArray?Array.isArray(e):Qr(e)==="[object Array]"}oe.isArray=Xm;function Zm(e){return typeof e=="boolean"}oe.isBoolean=Zm;function Jm(e){return e===null}oe.isNull=Jm;function Qm(e){return e==null}oe.isNullOrUndefined=Qm;function eb(e){return typeof e=="number"}oe.isNumber=eb;function tb(e){return typeof e=="string"}oe.isString=tb;function ib(e){return typeof e=="symbol"}oe.isSymbol=ib;function nb(e){return e===void 0}oe.isUndefined=nb;function rb(e){return Qr(e)==="[object RegExp]"}oe.isRegExp=rb;function ab(e){return typeof e=="object"&&e!==null}oe.isObject=ab;function sb(e){return Qr(e)==="[object Date]"}oe.isDate=sb;function ob(e){return Qr(e)==="[object Error]"||e instanceof Error}oe.isError=ob;function lb(e){return typeof e=="function"}oe.isFunction=lb;function cb(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}oe.isPrimitive=cb;oe.isBuffer=require("buffer").Buffer.isBuffer;function Qr(e){return Object.prototype.toString.call(e)}});var Md=k((y1,Ks)=>{"use strict";typeof Object.create=="function"?Ks.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Ks.exports=function(t,i){if(i){t.super_=i;var n=function(){};n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t}}});var bi=k((v1,Zs)=>{"use strict";try{if(Xs=require("util"),typeof Xs.inherits!="function")throw"";Zs.exports=Xs.inherits}catch{Zs.exports=Md()}var Xs});var Pd=k((x1,Js)=>{"use strict";function db(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Rd=mn().Buffer,bn=require("util");function ub(e,t,i){e.copy(t,i)}Js.exports=(function(){function e(){db(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(i){var n={data:i,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function(i){var n={data:i,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function(){if(this.length!==0){var i=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,i}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(i){if(this.length===0)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=i+n.data;return r},e.prototype.concat=function(i){if(this.length===0)return Rd.alloc(0);for(var n=Rd.allocUnsafe(i>>>0),r=this.head,a=0;r;)ub(r.data,n,a),a+=r.data.length,r=r.next;return n},e})();bn&&bn.inspect&&bn.inspect.custom&&(Js.exports.prototype[bn.inspect.custom]=function(){var e=bn.inspect({length:this.length});return this.constructor.name+" "+e})});var Qs=k((w1,jd)=>{"use strict";var ea=gn();function pb(e,t){var i=this,n=this._readableState&&this._readableState.destroyed,r=this._writableState&&this._writableState.destroyed;return n||r?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ea.nextTick(ta,this,e)):ea.nextTick(ta,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,ea.nextTick(ta,i,a)):ea.nextTick(ta,i,a):t&&t(a)}),this)}function fb(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function ta(e,t){e.emit("error",t)}jd.exports={destroy:pb,undestroy:fb}});var zd=k((_1,Dd)=>{"use strict";Dd.exports=require("util").deprecate});var to=k((E1,Gd)=>{"use strict";var $t=gn();Gd.exports=Z;function Bd(e){var t=this;this.next=null,this.entry=null,this.finish=function(){Ib(t,e)}}var hb=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:$t.nextTick,yi;Z.WritableState=vn;var Fd=Object.create(mi());Fd.inherits=bi();var gb={deprecate:zd()},Hd=Ys(),na=mn().Buffer,mb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function bb(e){return na.from(e)}function yb(e){return na.isBuffer(e)||e instanceof mb}var $d=Qs();Fd.inherits(Z,Hd);function vb(){}function vn(e,t){yi=yi||Ut(),e=e||{};var i=t instanceof yi;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=e.writableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:i&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(o){Cb(t,o)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Bd(this)}vn.prototype.getBuffer=function(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i};(function(){try{Object.defineProperty(vn.prototype,"buffer",{get:gb.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ia;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ia=Function.prototype[Symbol.hasInstance],Object.defineProperty(Z,Symbol.hasInstance,{value:function(e){return ia.call(this,e)?!0:this!==Z?!1:e&&e._writableState instanceof vn}})):ia=function(e){return e instanceof this};function Z(e){if(yi=yi||Ut(),!ia.call(Z,this)&&!(this instanceof yi))return new Z(e);this._writableState=new vn(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),Hd.call(this)}Z.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function xb(e,t){var i=new Error("write after end");e.emit("error",i),$t.nextTick(t,i)}function wb(e,t,i,n){var r=!0,a=!1;return i===null?a=new TypeError("May not write null values to stream"):typeof i!="string"&&i!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),$t.nextTick(n,a),r=!1),r}Z.prototype.write=function(e,t,i){var n=this._writableState,r=!1,a=!n.objectMode&&yb(e);return a&&!na.isBuffer(e)&&(e=bb(e)),typeof t=="function"&&(i=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof i!="function"&&(i=vb),n.ended?xb(this,i):(a||wb(this,n,e,i))&&(n.pendingcb++,r=Eb(this,n,a,e,t,i)),r};Z.prototype.cork=function(){var e=this._writableState;e.corked++};Z.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Ud(this,e))};Z.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function _b(e,t,i){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=na.from(t,i)),t}Object.defineProperty(Z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Eb(e,t,i,n,r,a){if(!i){var s=_b(t,n,r);n!==s&&(i=!0,r="buffer",n=s)}var o=t.objectMode?1:n.length;t.length+=o;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:a,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else eo(e,t,!1,o,n,r,a);return l}function eo(e,t,i,n,r,a,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,i?e._writev(r,t.onwrite):e._write(r,a,t.onwrite),t.sync=!1}function Sb(e,t,i,n,r){--t.pendingcb,i?($t.nextTick(r,n),$t.nextTick(yn,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(r(n),e._writableState.errorEmitted=!0,e.emit("error",n),yn(e,t))}function Ab(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function Cb(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if(Ab(i),t)Sb(e,i,n,t,r);else{var a=qd(i);!a&&!i.corked&&!i.bufferProcessing&&i.bufferedRequest&&Ud(e,i),n?hb(Nd,e,i,a,r):Nd(e,i,a,r)}}function Nd(e,t,i,n){i||Tb(e,t),t.pendingcb--,n(),yn(e,t)}function Tb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Ud(e,t){t.bufferProcessing=!0;var i=t.bufferedRequest;if(e._writev&&i&&i.next){var n=t.bufferedRequestCount,r=new Array(n),a=t.corkedRequestsFree;a.entry=i;for(var s=0,o=!0;i;)r[s]=i,i.isBuf||(o=!1),i=i.next,s+=1;r.allBuffers=o,eo(e,t,!0,t.length,r,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new Bd(t),t.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,c=i.encoding,d=i.callback,u=t.objectMode?1:l.length;if(eo(e,t,!1,u,l,c,d),i=i.next,t.bufferedRequestCount--,t.writing)break}i===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=i,t.bufferProcessing=!1}Z.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))};Z.prototype._writev=null;Z.prototype.end=function(e,t,i){var n=this._writableState;typeof e=="function"?(i=e,e=null,t=null):typeof t=="function"&&(i=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||Ob(this,n,i)};function qd(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function kb(e,t){e._final(function(i){t.pendingcb--,i&&e.emit("error",i),t.prefinished=!0,e.emit("prefinish"),yn(e,t)})}function Lb(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,$t.nextTick(kb,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function yn(e,t){var i=qd(t);return i&&(Lb(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),i}function Ob(e,t,i){t.ending=!0,yn(e,t),i&&(t.finished?$t.nextTick(i):e.once("finish",i)),t.ended=!0,e.writable=!1}function Ib(e,t,i){var n=e.entry;for(e.entry=null;n;){var r=n.callback;t.pendingcb--,r(i),n=n.next}t.corkedRequestsFree.next=e}Object.defineProperty(Z.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Z.prototype.destroy=$d.destroy;Z.prototype._undestroy=$d.undestroy;Z.prototype._destroy=function(e,t){this.end(),t(e)}});var Ut=k((S1,Kd)=>{"use strict";var Wd=gn(),Mb=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};Kd.exports=tt;var Yd=Object.create(mi());Yd.inherits=bi();var Vd=ro(),no=to();Yd.inherits(tt,Vd);for(io=Mb(no.prototype),ra=0;ra<io.length;ra++)aa=io[ra],tt.prototype[aa]||(tt.prototype[aa]=no.prototype[aa]);var io,aa,ra;function tt(e){if(!(this instanceof tt))return new tt(e);Vd.call(this,e),no.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",Rb)}Object.defineProperty(tt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Rb(){this.allowHalfOpen||this._writableState.ended||Wd.nextTick(Pb,this)}function Pb(e){e.end()}Object.defineProperty(tt.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});tt.prototype._destroy=function(e,t){this.push(null),this.end(),Wd.nextTick(t,e)}});var oo=k(Zd=>{"use strict";var so=mn().Buffer,Xd=so.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function jb(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function Db(e){var t=jb(e);if(typeof t!="string"&&(so.isEncoding===Xd||!Xd(e)))throw new Error("Unknown encoding: "+e);return t||e}Zd.StringDecoder=xn;function xn(e){this.encoding=Db(e);var t;switch(this.encoding){case"utf16le":this.text=$b,this.end=Ub,t=4;break;case"utf8":this.fillLast=Bb,t=4;break;case"base64":this.text=qb,this.end=Gb,t=3;break;default:this.write=Wb,this.end=Yb;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=so.allocUnsafe(t)}xn.prototype.write=function(e){if(e.length===0)return"";var t,i;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<e.length?t?t+this.text(e,i):this.text(e,i):t||""};xn.prototype.end=Hb;xn.prototype.text=Fb;xn.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function ao(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function zb(e,t,i){var n=t.length-1;if(n<i)return 0;var r=ao(t[n]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--n<i||r===-2?0:(r=ao(t[n]),r>=0?(r>0&&(e.lastNeed=r-2),r):--n<i||r===-2?0:(r=ao(t[n]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function Nb(e,t,i){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function Bb(e){var t=this.lastTotal-this.lastNeed,i=Nb(this,e,t);if(i!==void 0)return i;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function Fb(e,t){var i=zb(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=i;var n=e.length-(i-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function Hb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function $b(e,t){if((e.length-t)%2===0){var i=e.toString("utf16le",t);if(i){var n=i.charCodeAt(i.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function Ub(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,i)}return t}function qb(e,t){var i=(e.length-t)%3;return i===0?e.toString("base64",t):(this.lastNeed=3-i,this.lastTotal=3,i===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-i))}function Gb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Wb(e){return e.toString(this.encoding)}function Yb(e){return e&&e.length?this.write(e):""}});var ro=k((T1,cu)=>{"use strict";var xi=gn();cu.exports=q;var Vb=kd(),wn;q.ReadableState=ru;var C1=require("events").EventEmitter,tu=function(e,t){return e.listeners(t).length},fo=Ys(),_n=mn().Buffer,Kb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Xb(e){return _n.from(e)}function Zb(e){return _n.isBuffer(e)||e instanceof Kb}var iu=Object.create(mi());iu.inherits=bi();var lo=require("util"),H=void 0;lo&&lo.debuglog?H=lo.debuglog("stream"):H=function(){};var Jb=Pd(),nu=Qs(),vi;iu.inherits(q,fo);var co=["error","close","destroy","pause","resume"];function Qb(e,t,i){if(typeof e.prependListener=="function")return e.prependListener(t,i);!e._events||!e._events[t]?e.on(t,i):Vb(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]}function ru(e,t){wn=wn||Ut(),e=e||{};var i=t instanceof wn;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=e.readableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:i&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new Jb,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(vi||(vi=oo().StringDecoder),this.decoder=new vi(e.encoding),this.encoding=e.encoding)}function q(e){if(wn=wn||Ut(),!(this instanceof q))return new q(e);this._readableState=new ru(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),fo.call(this)}Object.defineProperty(q.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});q.prototype.destroy=nu.destroy;q.prototype._undestroy=nu.undestroy;q.prototype._destroy=function(e,t){this.push(null),t(e)};q.prototype.push=function(e,t){var i=this._readableState,n;return i.objectMode?n=!0:typeof e=="string"&&(t=t||i.defaultEncoding,t!==i.encoding&&(e=_n.from(e,t),t=""),n=!0),au(this,e,t,!1,n)};q.prototype.unshift=function(e){return au(this,e,null,!0,!1)};function au(e,t,i,n,r){var a=e._readableState;if(t===null)a.reading=!1,ny(e,a);else{var s;r||(s=ey(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==_n.prototype&&(t=Xb(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):uo(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!i?(t=a.decoder.write(t),a.objectMode||t.length!==0?uo(e,a,t,!1):su(e,a)):uo(e,a,t,!1))):n||(a.reading=!1)}return ty(a)}function uo(e,t,i,n){t.flowing&&t.length===0&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&sa(e)),su(e,t)}function ey(e,t){var i;return!Zb(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(i=new TypeError("Invalid non-string/buffer chunk")),i}function ty(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}q.prototype.isPaused=function(){return this._readableState.flowing===!1};q.prototype.setEncoding=function(e){return vi||(vi=oo().StringDecoder),this._readableState.decoder=new vi(e),this._readableState.encoding=e,this};var Jd=8388608;function iy(e){return e>=Jd?e=Jd:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Qd(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=iy(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}q.prototype.read=function(e){H("read",e),e=parseInt(e,10);var t=this._readableState,i=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return H("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?po(this):sa(this),null;if(e=Qd(e,t),e===0&&t.ended)return t.length===0&&po(this),null;var n=t.needReadable;H("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,H("length less than watermark",n)),t.ended||t.reading?(n=!1,H("reading or ended",n)):n&&(H("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Qd(i,t)));var r;return e>0?r=ou(e,t):r=null,r===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&po(this)),r!==null&&this.emit("data",r),r};function ny(e,t){if(!t.ended){if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,sa(e)}}function sa(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(H("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?xi.nextTick(eu,e):eu(e))}function eu(e){H("emit readable"),e.emit("readable"),ho(e)}function su(e,t){t.readingMore||(t.readingMore=!0,xi.nextTick(ry,e,t))}function ry(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(H("maybeReadMore read 0"),e.read(0),i!==t.length);)i=t.length;t.readingMore=!1}q.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};q.prototype.pipe=function(e,t){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,H("pipe count=%d opts=%j",n.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?o:g;n.endEmitted?xi.nextTick(a):i.once("end",a),e.on("unpipe",s);function s(b,y){H("onunpipe"),b===i&&y&&y.hasUnpiped===!1&&(y.hasUnpiped=!0,d())}function o(){H("onend"),e.end()}var l=ay(i);e.on("drain",l);var c=!1;function d(){H("cleanup"),e.removeListener("close",m),e.removeListener("finish",h),e.removeListener("drain",l),e.removeListener("error",f),e.removeListener("unpipe",s),i.removeListener("end",o),i.removeListener("end",g),i.removeListener("data",p),c=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&l()}var u=!1;i.on("data",p);function p(b){H("ondata"),u=!1;var y=e.write(b);y===!1&&!u&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&lu(n.pipes,e)!==-1)&&!c&&(H("false write response, pause",n.awaitDrain),n.awaitDrain++,u=!0),i.pause())}function f(b){H("onerror",b),g(),e.removeListener("error",f),tu(e,"error")===0&&e.emit("error",b)}Qb(e,"error",f);function m(){e.removeListener("finish",h),g()}e.once("close",m);function h(){H("onfinish"),e.removeListener("close",m),g()}e.once("finish",h);function g(){H("unpipe"),i.unpipe(e)}return e.emit("pipe",i),n.flowing||(H("pipe resume"),i.resume()),e};function ay(e){return function(){var t=e._readableState;H("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&tu(e,"data")&&(t.flowing=!0,ho(e))}}q.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<r;a++)n[a].emit("unpipe",this,{hasUnpiped:!1});return this}var s=lu(t.pipes,e);return s===-1?this:(t.pipes.splice(s,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,i),this)};q.prototype.on=function(e,t){var i=fo.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var n=this._readableState;!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&sa(this):xi.nextTick(sy,this))}return i};q.prototype.addListener=q.prototype.on;function sy(e){H("readable nexttick read 0"),e.read(0)}q.prototype.resume=function(){var e=this._readableState;return e.flowing||(H("resume"),e.flowing=!0,oy(this,e)),this};function oy(e,t){t.resumeScheduled||(t.resumeScheduled=!0,xi.nextTick(ly,e,t))}function ly(e,t){t.reading||(H("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),ho(e),t.flowing&&!t.reading&&e.read(0)}q.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function ho(e){var t=e._readableState;for(H("flow",t.flowing);t.flowing&&e.read()!==null;);}q.prototype.wrap=function(e){var t=this,i=this._readableState,n=!1;e.on("end",function(){if(H("wrapped end"),i.decoder&&!i.ended){var s=i.decoder.end();s&&s.length&&t.push(s)}t.push(null)}),e.on("data",function(s){if(H("wrapped data"),i.decoder&&(s=i.decoder.write(s)),!(i.objectMode&&s==null)&&!(!i.objectMode&&(!s||!s.length))){var o=t.push(s);o||(n=!0,e.pause())}});for(var r in e)this[r]===void 0&&typeof e[r]=="function"&&(this[r]=(function(s){return function(){return e[s].apply(e,arguments)}})(r));for(var a=0;a<co.length;a++)e.on(co[a],this.emit.bind(this,co[a]));return this._read=function(s){H("wrapped _read",s),n&&(n=!1,e.resume())},this};Object.defineProperty(q.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});q._fromList=ou;function ou(e,t){if(t.length===0)return null;var i;return t.objectMode?i=t.buffer.shift():!e||e>=t.length?(t.decoder?i=t.buffer.join(""):t.buffer.length===1?i=t.buffer.head.data:i=t.buffer.concat(t.length),t.buffer.clear()):i=cy(e,t.buffer,t.decoder),i}function cy(e,t,i){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?n=t.shift():n=i?dy(e,t):uy(e,t),n}function dy(e,t){var i=t.head,n=1,r=i.data;for(e-=r.length;i=i.next;){var a=i.data,s=e>a.length?a.length:e;if(s===a.length?r+=a:r+=a.slice(0,e),e-=s,e===0){s===a.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(s));break}++n}return t.length-=n,r}function uy(e,t){var i=_n.allocUnsafe(e),n=t.head,r=1;for(n.data.copy(i),e-=n.data.length;n=n.next;){var a=n.data,s=e>a.length?a.length:e;if(a.copy(i,i.length-e,0,s),e-=s,e===0){s===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(s));break}++r}return t.length-=r,i}function po(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,xi.nextTick(py,t,e))}function py(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function lu(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}});var go=k((k1,pu)=>{"use strict";pu.exports=it;var oa=Ut(),uu=Object.create(mi());uu.inherits=bi();uu.inherits(it,oa);function fy(e,t){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,t!=null&&this.push(t),n(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function it(e){if(!(this instanceof it))return new it(e);oa.call(this,e),this._transformState={afterTransform:fy.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",hy)}function hy(){var e=this;typeof this._flush=="function"?this._flush(function(t,i){du(e,t,i)}):du(this,null,null)}it.prototype.push=function(e,t){return this._transformState.needTransform=!1,oa.prototype.push.call(this,e,t)};it.prototype._transform=function(e,t,i){throw new Error("_transform() is not implemented")};it.prototype._write=function(e,t,i){var n=this._transformState;if(n.writecb=i,n.writechunk=e,n.writeencoding=t,!n.transforming){var r=this._readableState;(n.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}};it.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};it.prototype._destroy=function(e,t){var i=this;oa.prototype._destroy.call(this,e,function(n){t(n),i.emit("close")})};function du(e,t,i){if(t)return e.emit("error",t);if(i!=null&&e.push(i),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var mu=k((L1,gu)=>{"use strict";gu.exports=En;var fu=go(),hu=Object.create(mi());hu.inherits=bi();hu.inherits(En,fu);function En(e){if(!(this instanceof En))return new En(e);fu.call(this,e)}En.prototype._transform=function(e,t,i){i(null,e)}});var mo=k((re,la)=>{"use strict";var Ne=require("stream");process.env.READABLE_STREAM==="disable"&&Ne?(la.exports=Ne,re=la.exports=Ne.Readable,re.Readable=Ne.Readable,re.Writable=Ne.Writable,re.Duplex=Ne.Duplex,re.Transform=Ne.Transform,re.PassThrough=Ne.PassThrough,re.Stream=Ne):(re=la.exports=ro(),re.Stream=Ne||re,re.Readable=re,re.Writable=to(),re.Duplex=Ut(),re.Transform=go(),re.PassThrough=mu())});var nt=k(he=>{"use strict";he.base64=!0;he.array=!0;he.string=!0;he.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined";he.nodebuffer=typeof Buffer!="undefined";he.uint8array=typeof Uint8Array!="undefined";if(typeof ArrayBuffer=="undefined")he.blob=!1;else{bo=new ArrayBuffer(0);try{he.blob=new Blob([bo],{type:"application/zip"}).size===0}catch{try{bu=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,yo=new bu,yo.append(bo),he.blob=yo.getBlob("application/zip").size===0}catch{he.blob=!1}}}var bo,bu,yo;try{he.nodestream=!!mo().Readable}catch{he.nodestream=!1}});var xo=k(vo=>{"use strict";var gy=V(),my=nt(),Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";vo.encode=function(e){for(var t=[],i,n,r,a,s,o,l,c=0,d=e.length,u=d,p=gy.getTypeOf(e)!=="string";c<e.length;)u=d-c,p?(i=e[c++],n=c<d?e[c++]:0,r=c<d?e[c++]:0):(i=e.charCodeAt(c++),n=c<d?e.charCodeAt(c++):0,r=c<d?e.charCodeAt(c++):0),a=i>>2,s=(i&3)<<4|n>>4,o=u>1?(n&15)<<2|r>>6:64,l=u>2?r&63:64,t.push(Be.charAt(a)+Be.charAt(s)+Be.charAt(o)+Be.charAt(l));return t.join("")};vo.decode=function(e){var t,i,n,r,a,s,o,l=0,c=0,d="data:";if(e.substr(0,d.length)===d)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var u=e.length*3/4;if(e.charAt(e.length-1)===Be.charAt(64)&&u--,e.charAt(e.length-2)===Be.charAt(64)&&u--,u%1!==0)throw new Error("Invalid base64 input, bad content length.");var p;for(my.uint8array?p=new Uint8Array(u|0):p=new Array(u|0);l<e.length;)r=Be.indexOf(e.charAt(l++)),a=Be.indexOf(e.charAt(l++)),s=Be.indexOf(e.charAt(l++)),o=Be.indexOf(e.charAt(l++)),t=r<<2|a>>4,i=(a&15)<<4|s>>2,n=(s&3)<<6|o,p[c++]=t,s!==64&&(p[c++]=i),o!==64&&(p[c++]=n);return p}});var Sn=k((M1,yu)=>{"use strict";yu.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var _u=k((R1,wu)=>{"use strict";var vu=global.MutationObserver||global.WebKitMutationObserver,wi;process.browser?vu?(wo=0,xu=new vu(An),_o=global.document.createTextNode(""),xu.observe(_o,{characterData:!0}),wi=function(){_o.data=wo=++wo%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(Eo=new global.MessageChannel,Eo.port1.onmessage=An,wi=function(){Eo.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?wi=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){An(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:wi=function(){setTimeout(An,0)}:wi=function(){process.nextTick(An)};var wo,xu,_o,Eo,So,Cn=[];function An(){So=!0;for(var e,t,i=Cn.length;i;){for(t=Cn,Cn=[],e=-1;++e<i;)t[e]();i=Cn.length}So=!1}wu.exports=by;function by(e){Cn.push(e)===1&&!So&&wi()}});var Lu=k((P1,ku)=>{"use strict";var Eu=_u();function _i(){}var le={},Su=["REJECTED"],Ao=["FULFILLED"],Au=["PENDING"];process.browser||(Tn=["UNHANDLED"]);var Tn;ku.exports=vt;function vt(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=Au,this.queue=[],this.outcome=void 0,process.browser||(this.handled=Tn),e!==_i&&Cu(this,e)}vt.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(i,n);function i(r){function a(){return r}return t.resolve(e()).then(a)}function n(r){function a(){throw r}return t.resolve(e()).then(a)}};vt.prototype.catch=function(e){return this.then(null,e)};vt.prototype.then=function(e,t){if(typeof e!="function"&&this.state===Ao||typeof t!="function"&&this.state===Su)return this;var i=new this.constructor(_i);if(process.browser||this.handled===Tn&&(this.handled=null),this.state!==Au){var n=this.state===Ao?e:t;Co(i,n,this.outcome)}else this.queue.push(new kn(i,e,t));return i};function kn(e,t,i){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof i=="function"&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}kn.prototype.callFulfilled=function(e){le.resolve(this.promise,e)};kn.prototype.otherCallFulfilled=function(e){Co(this.promise,this.onFulfilled,e)};kn.prototype.callRejected=function(e){le.reject(this.promise,e)};kn.prototype.otherCallRejected=function(e){Co(this.promise,this.onRejected,e)};function Co(e,t,i){Eu(function(){var n;try{n=t(i)}catch(r){return le.reject(e,r)}n===e?le.reject(e,new TypeError("Cannot resolve promise with itself")):le.resolve(e,n)})}le.resolve=function(e,t){var i=Tu(yy,t);if(i.status==="error")return le.reject(e,i.value);var n=i.value;if(n)Cu(e,n);else{e.state=Ao,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};le.reject=function(e,t){e.state=Su,e.outcome=t,process.browser||e.handled===Tn&&Eu(function(){e.handled===Tn&&process.emit("unhandledRejection",t,e)});for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callRejected(t);return e};function yy(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function Cu(e,t){var i=!1;function n(o){i||(i=!0,le.reject(e,o))}function r(o){i||(i=!0,le.resolve(e,o))}function a(){t(r,n)}var s=Tu(a);s.status==="error"&&n(s.value)}function Tu(e,t){var i={};try{i.value=e(t),i.status="success"}catch(n){i.status="error",i.value=n}return i}vt.resolve=vy;function vy(e){return e instanceof this?e:le.resolve(new this(_i),e)}vt.reject=xy;function xy(e){var t=new this(_i);return le.reject(t,e)}vt.all=wy;function wy(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var i=e.length,n=!1;if(!i)return this.resolve([]);for(var r=new Array(i),a=0,s=-1,o=new this(_i);++s<i;)l(e[s],s);return o;function l(c,d){t.resolve(c).then(u,function(p){n||(n=!0,le.reject(o,p))});function u(p){r[d]=p,++a===i&&!n&&(n=!0,le.resolve(o,r))}}}vt.race=_y;function _y(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var i=e.length,n=!1;if(!i)return this.resolve([]);for(var r=-1,a=new this(_i);++r<i;)s(e[r]);return a;function s(o){t.resolve(o).then(function(l){n||(n=!0,le.resolve(a,l))},function(l){n||(n=!0,le.reject(a,l))})}}});var Ei=k((j1,Ou)=>{"use strict";var To=null;typeof Promise!="undefined"?To=Promise:To=Lu();Ou.exports={Promise:To}});var Mu=k(Iu=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var i=1,n={},r=!1,a=e.document,s;function o(y){typeof y!="function"&&(y=new Function(""+y));for(var v=new Array(arguments.length-1),x=0;x<v.length;x++)v[x]=arguments[x+1];var w={callback:y,args:v};return n[i]=w,s(i),i++}function l(y){delete n[y]}function c(y){var v=y.callback,x=y.args;switch(x.length){case 0:v();break;case 1:v(x[0]);break;case 2:v(x[0],x[1]);break;case 3:v(x[0],x[1],x[2]);break;default:v.apply(t,x);break}}function d(y){if(r)setTimeout(d,0,y);else{var v=n[y];if(v){r=!0;try{c(v)}finally{l(y),r=!1}}}}function u(){s=function(y){process.nextTick(function(){d(y)})}}function p(){if(e.postMessage&&!e.importScripts){var y=!0,v=e.onmessage;return e.onmessage=function(){y=!1},e.postMessage("","*"),e.onmessage=v,y}}function f(){var y="setImmediate$"+Math.random()+"$",v=function(x){x.source===e&&typeof x.data=="string"&&x.data.indexOf(y)===0&&d(+x.data.slice(y.length))};e.addEventListener?e.addEventListener("message",v,!1):e.attachEvent("onmessage",v),s=function(x){e.postMessage(y+x,"*")}}function m(){var y=new MessageChannel;y.port1.onmessage=function(v){var x=v.data;d(x)},s=function(v){y.port2.postMessage(v)}}function h(){var y=a.documentElement;s=function(v){var x=a.createElement("script");x.onreadystatechange=function(){d(v),x.onreadystatechange=null,y.removeChild(x),x=null},y.appendChild(x)}}function g(){s=function(y){setTimeout(d,0,y)}}var b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,{}.toString.call(e.process)==="[object process]"?u():p()?f():e.MessageChannel?m():a&&"onreadystatechange"in a.createElement("script")?h():g(),b.setImmediate=o,b.clearImmediate=l})(typeof self=="undefined"?typeof global=="undefined"?Iu:global:self)});var V=k(J=>{"use strict";var xt=nt(),Ey=xo(),Si=Sn(),ko=Ei();Mu();function Sy(e){var t=null;return xt.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),da(e,t)}J.newBlob=function(e,t){J.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var i=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,n=new i;return n.append(e),n.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function Ln(e){return e}function da(e,t){for(var i=0;i<e.length;++i)t[i]=e.charCodeAt(i)&255;return t}var ca={stringifyByChunk:function(e,t,i){var n=[],r=0,a=e.length;if(a<=i)return String.fromCharCode.apply(null,e);for(;r<a;)t==="array"||t==="nodebuffer"?n.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+i,a)))):n.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+i,a)))),r+=i;return n.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:(function(){try{return xt.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return xt.nodebuffer&&String.fromCharCode.apply(null,Si.allocBuffer(1)).length===1}catch{return!1}})()}};function On(e){var t=65536,i=J.getTypeOf(e),n=!0;if(i==="uint8array"?n=ca.applyCanBeUsed.uint8array:i==="nodebuffer"&&(n=ca.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return ca.stringifyByChunk(e,i,t)}catch{t=Math.floor(t/2)}return ca.stringifyByChar(e)}J.applyFromCharCode=On;function ua(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}var wt={};wt.string={string:Ln,array:function(e){return da(e,new Array(e.length))},arraybuffer:function(e){return wt.string.uint8array(e).buffer},uint8array:function(e){return da(e,new Uint8Array(e.length))},nodebuffer:function(e){return da(e,Si.allocBuffer(e.length))}};wt.array={string:On,array:Ln,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Si.newBufferFrom(e)}};wt.arraybuffer={string:function(e){return On(new Uint8Array(e))},array:function(e){return ua(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:Ln,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Si.newBufferFrom(new Uint8Array(e))}};wt.uint8array={string:On,array:function(e){return ua(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:Ln,nodebuffer:function(e){return Si.newBufferFrom(e)}};wt.nodebuffer={string:On,array:function(e){return ua(e,new Array(e.length))},arraybuffer:function(e){return wt.nodebuffer.uint8array(e).buffer},uint8array:function(e){return ua(e,new Uint8Array(e.length))},nodebuffer:Ln};J.transformTo=function(e,t){if(t||(t=""),!e)return t;J.checkSupport(e);var i=J.getTypeOf(t),n=wt[i][e](t);return n};J.resolve=function(e){for(var t=e.split("/"),i=[],n=0;n<t.length;n++){var r=t[n];r==="."||r===""&&n!==0&&n!==t.length-1||(r===".."?i.pop():i.push(r))}return i.join("/")};J.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(xt.nodebuffer&&Si.isBuffer(e))return"nodebuffer";if(xt.uint8array&&e instanceof Uint8Array)return"uint8array";if(xt.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};J.checkSupport=function(e){var t=xt[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};J.MAX_VALUE_16BITS=65535;J.MAX_VALUE_32BITS=-1;J.pretty=function(e){var t="",i,n;for(n=0;n<(e||"").length;n++)i=e.charCodeAt(n),t+="\\x"+(i<16?"0":"")+i.toString(16).toUpperCase();return t};J.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})};J.inherits=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i};J.extend=function(){var e={},t,i;for(t=0;t<arguments.length;t++)for(i in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],i)&&typeof e[i]=="undefined"&&(e[i]=arguments[t][i]);return e};J.prepareContent=function(e,t,i,n,r){var a=ko.Promise.resolve(t).then(function(s){var o=xt.blob&&(s instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(s))!==-1);return o&&typeof FileReader!="undefined"?new ko.Promise(function(l,c){var d=new FileReader;d.onload=function(u){l(u.target.result)},d.onerror=function(u){c(u.target.error)},d.readAsArrayBuffer(s)}):s});return a.then(function(s){var o=J.getTypeOf(s);return o?(o==="arraybuffer"?s=J.transformTo("uint8array",s):o==="string"&&(r?s=Ey.decode(s):i&&n!==!0&&(s=Sy(s))),s):ko.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var ge=k((N1,Pu)=>{"use strict";function Ru(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Ru.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(i){t.processChunk(i)}),e.on("end",function(){t.end()}),e.on("error",function(i){t.error(i)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};Pu.exports=Ru});var Ci=k(_t=>{"use strict";var Ai=V(),qt=nt(),Ay=Sn(),pa=ge(),In=new Array(256);for(rt=0;rt<256;rt++)In[rt]=rt>=252?6:rt>=248?5:rt>=240?4:rt>=224?3:rt>=192?2:1;var rt;In[254]=In[254]=1;var Cy=function(e){var t,i,n,r,a,s=e.length,o=0;for(r=0;r<s;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(qt.uint8array?t=new Uint8Array(o):t=new Array(o),a=0,r=0;a<o;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>>6,t[a++]=128|i&63):i<65536?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|i&63):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|i&63);return t},Ty=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&(e[i]&192)===128;)i--;return i<0||i===0?t:i+In[e[i]]>t?i:t},ky=function(e){var t,i,n,r,a=e.length,s=new Array(a*2);for(i=0,t=0;t<a;){if(n=e[t++],n<128){s[i++]=n;continue}if(r=In[n],r>4){s[i++]=65533,t+=r-1;continue}for(n&=r===2?31:r===3?15:7;r>1&&t<a;)n=n<<6|e[t++]&63,r--;if(r>1){s[i++]=65533;continue}n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|n&1023)}return s.length!==i&&(s.subarray?s=s.subarray(0,i):s.length=i),Ai.applyFromCharCode(s)};_t.utf8encode=function(t){return qt.nodebuffer?Ay.newBufferFrom(t,"utf-8"):Cy(t)};_t.utf8decode=function(t){return qt.nodebuffer?Ai.transformTo("nodebuffer",t).toString("utf-8"):(t=Ai.transformTo(qt.uint8array?"uint8array":"array",t),ky(t))};function fa(){pa.call(this,"utf-8 decode"),this.leftOver=null}Ai.inherits(fa,pa);fa.prototype.processChunk=function(e){var t=Ai.transformTo(qt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(qt.uint8array){var i=t;t=new Uint8Array(i.length+this.leftOver.length),t.set(this.leftOver,0),t.set(i,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=Ty(t),r=t;n!==t.length&&(qt.uint8array?(r=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(r=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:_t.utf8decode(r),meta:e.meta})};fa.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:_t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};_t.Utf8DecodeWorker=fa;function Lo(){pa.call(this,"utf-8 encode")}Ai.inherits(Lo,pa);Lo.prototype.processChunk=function(e){this.push({data:_t.utf8encode(e.data),meta:e.meta})};_t.Utf8EncodeWorker=Lo});var Nu=k((F1,zu)=>{"use strict";var ju=ge(),Du=V();function Oo(e){ju.call(this,"ConvertWorker to "+e),this.destType=e}Du.inherits(Oo,ju);Oo.prototype.processChunk=function(e){this.push({data:Du.transformTo(this.destType,e.data),meta:e.meta})};zu.exports=Oo});var Hu=k((H1,Fu)=>{"use strict";var Bu=mo().Readable,Ly=V();Ly.inherits(Io,Bu);function Io(e,t,i){Bu.call(this,t),this._helper=e;var n=this;e.on("data",function(r,a){n.push(r)||n._helper.pause(),i&&i(a)}).on("error",function(r){n.emit("error",r)}).on("end",function(){n.push(null)})}Io.prototype._read=function(){this._helper.resume()};Fu.exports=Io});var Mo=k(($1,qu)=>{"use strict";var Gt=V(),Oy=Nu(),Iy=ge(),My=xo(),Ry=nt(),Py=Ei(),$u=null;if(Ry.nodestream)try{$u=Hu()}catch{}function jy(e,t,i){switch(e){case"blob":return Gt.newBlob(Gt.transformTo("arraybuffer",t),i);case"base64":return My.encode(t);default:return Gt.transformTo(e,t)}}function Dy(e,t){var i,n=0,r=null,a=0;for(i=0;i<t.length;i++)a+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(a),i=0;i<t.length;i++)r.set(t[i],n),n+=t[i].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function zy(e,t){return new Py.Promise(function(i,n){var r=[],a=e._internalType,s=e._outputType,o=e._mimeType;e.on("data",function(l,c){r.push(l),t&&t(c)}).on("error",function(l){r=[],n(l)}).on("end",function(){try{var l=jy(s,Dy(a,r),o);i(l)}catch(c){n(c)}r=[]}).resume()})}function Uu(e,t,i){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string";break}try{this._internalType=n,this._outputType=t,this._mimeType=i,Gt.checkSupport(n),this._worker=e.pipe(new Oy(n)),e.lock()}catch(r){this._worker=new Iy("error"),this._worker.error(r)}}Uu.prototype={accumulate:function(e){return zy(this,e)},on:function(e,t){var i=this;return e==="data"?this._worker.on(e,function(n){t.call(i,n.data,n.meta)}):this._worker.on(e,function(){Gt.delay(t,arguments,i)}),this},resume:function(){return Gt.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(Gt.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new $u(this,{objectMode:this._outputType!=="nodebuffer"},e)}};qu.exports=Uu});var Ro=k(ke=>{"use strict";ke.base64=!1;ke.binary=!1;ke.dir=!1;ke.createFolders=!0;ke.date=null;ke.compression=null;ke.compressionOptions=null;ke.comment=null;ke.unixPermissions=null;ke.dosPermissions=null});var Po=k((q1,Gu)=>{"use strict";var ha=V(),ga=ge(),Ny=16*1024;function Ti(e){ga.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(i){t.dataIsReady=!0,t.data=i,t.max=i&&i.length||0,t.type=ha.getTypeOf(i),t.isPaused||t._tickAndRepeat()},function(i){t.error(i)})}ha.inherits(Ti,ga);Ti.prototype.cleanUp=function(){ga.prototype.cleanUp.call(this),this.data=null};Ti.prototype.resume=function(){return ga.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,ha.delay(this._tickAndRepeat,[],this)),!0):!1};Ti.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(ha.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};Ti.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Ny,t=null,i=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,i);break;case"uint8array":t=this.data.subarray(this.index,i);break;case"array":case"nodebuffer":t=this.data.slice(this.index,i);break}return this.index=i,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};Gu.exports=Ti});var ma=k((G1,Yu)=>{"use strict";var By=V();function Fy(){for(var e,t=[],i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[i]=e}return t}var Wu=Fy();function Hy(e,t,i,n){var r=Wu,a=n+i;e=e^-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}function $y(e,t,i,n){var r=Wu,a=n+i;e=e^-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t.charCodeAt(s))&255];return e^-1}Yu.exports=function(t,i){if(typeof t=="undefined"||!t.length)return 0;var n=By.getTypeOf(t)!=="string";return n?Hy(i|0,t,t.length,0):$y(i|0,t,t.length,0)}});var Do=k((W1,Ku)=>{"use strict";var Vu=ge(),Uy=ma(),qy=V();function jo(){Vu.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}qy.inherits(jo,Vu);jo.prototype.processChunk=function(e){this.streamInfo.crc32=Uy(e.data,this.streamInfo.crc32||0),this.push(e)};Ku.exports=jo});var Zu=k((Y1,Xu)=>{"use strict";var Gy=V(),zo=ge();function No(e){zo.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Gy.inherits(No,zo);No.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}zo.prototype.processChunk.call(this,e)};Xu.exports=No});var ba=k((V1,ep)=>{"use strict";var Ju=Ei(),Qu=Po(),Wy=Do(),Bo=Zu();function Fo(e,t,i,n,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=n,this.compressedContent=r}Fo.prototype={getContentWorker:function(){var e=new Qu(Ju.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Bo("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new Qu(Ju.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Fo.createWorkerFrom=function(e,t,i){return e.pipe(new Wy).pipe(new Bo("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new Bo("compressedSize")).withStreamInfo("compression",t)};ep.exports=Fo});var rp=k((K1,np)=>{"use strict";var Yy=Mo(),Vy=Po(),Ho=Ci(),$o=ba(),tp=ge(),Uo=function(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}};Uo.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");i=e.toLowerCase();var n=i==="string"||i==="text";(i==="binarystring"||i==="text")&&(i="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!n&&(t=t.pipe(new Ho.Utf8EncodeWorker)),!r&&n&&(t=t.pipe(new Ho.Utf8DecodeWorker))}catch(a){t=new tp("error"),t.error(a)}return new Yy(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof $o&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new Ho.Utf8EncodeWorker)),$o.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof $o?this._data.getContentWorker():this._data instanceof tp?this._data:new Vy(this._data)}};var ip=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],Ky=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(ya=0;ya<ip.length;ya++)Uo.prototype[ip[ya]]=Ky;var ya;np.exports=Uo});var at=k(ue=>{"use strict";var Xy=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function Zy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}ue.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if(typeof i!="object")throw new TypeError(i+"must be non-object");for(var n in i)Zy(i,n)&&(e[n]=i[n])}}return e};ue.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Jy={arraySet:function(e,t,i,n,r){if(t.subarray&&e.subarray){e.set(t.subarray(i,i+n),r);return}for(var a=0;a<n;a++)e[r+a]=t[i+a]},flattenChunks:function(e){var t,i,n,r,a,s;for(n=0,t=0,i=e.length;t<i;t++)n+=e[t].length;for(s=new Uint8Array(n),r=0,t=0,i=e.length;t<i;t++)a=e[t],s.set(a,r),r+=a.length;return s}},Qy={arraySet:function(e,t,i,n,r){for(var a=0;a<n;a++)e[r+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};ue.setTyped=function(e){e?(ue.Buf8=Uint8Array,ue.Buf16=Uint16Array,ue.Buf32=Int32Array,ue.assign(ue,Jy)):(ue.Buf8=Array,ue.Buf16=Array,ue.Buf32=Array,ue.assign(ue,Qy))};ue.setTyped(Xy)});var Tp=k(Oi=>{"use strict";var ev=at(),tv=4,ap=0,sp=1,iv=2;function Li(e){for(var t=e.length;--t>=0;)e[t]=0}var nv=0,pp=1,rv=2,av=3,sv=258,Xo=29,zn=256,Rn=zn+1+Xo,ki=30,Zo=19,fp=2*Rn+1,Wt=15,qo=16,ov=7,Jo=256,hp=16,gp=17,mp=18,Vo=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],va=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],lv=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bp=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],cv=512,st=new Array((Rn+2)*2);Li(st);var Mn=new Array(ki*2);Li(Mn);var Pn=new Array(cv);Li(Pn);var jn=new Array(sv-av+1);Li(jn);var Qo=new Array(Xo);Li(Qo);var xa=new Array(ki);Li(xa);function Go(e,t,i,n,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=n,this.max_length=r,this.has_stree=e&&e.length}var yp,vp,xp;function Wo(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function wp(e){return e<256?Pn[e]:Pn[256+(e>>>7)]}function Dn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function fe(e,t,i){e.bi_valid>qo-i?(e.bi_buf|=t<<e.bi_valid&65535,Dn(e,e.bi_buf),e.bi_buf=t>>qo-e.bi_valid,e.bi_valid+=i-qo):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Fe(e,t,i){fe(e,i[t*2],i[t*2+1])}function _p(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function dv(e){e.bi_valid===16?(Dn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function uv(e,t){var i=t.dyn_tree,n=t.max_code,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,d,u,p,f,m,h=0;for(p=0;p<=Wt;p++)e.bl_count[p]=0;for(i[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<fp;c++)d=e.heap[c],p=i[i[d*2+1]*2+1]+1,p>l&&(p=l,h++),i[d*2+1]=p,!(d>n)&&(e.bl_count[p]++,f=0,d>=o&&(f=s[d-o]),m=i[d*2],e.opt_len+=m*(p+f),a&&(e.static_len+=m*(r[d*2+1]+f)));if(h!==0){do{for(p=l-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,h-=2}while(h>0);for(p=l;p!==0;p--)for(d=e.bl_count[p];d!==0;)u=e.heap[--c],!(u>n)&&(i[u*2+1]!==p&&(e.opt_len+=(p-i[u*2+1])*i[u*2],i[u*2+1]=p),d--)}}function Ep(e,t,i){var n=new Array(Wt+1),r=0,a,s;for(a=1;a<=Wt;a++)n[a]=r=r+i[a-1]<<1;for(s=0;s<=t;s++){var o=e[s*2+1];o!==0&&(e[s*2]=_p(n[o]++,o))}}function pv(){var e,t,i,n,r,a=new Array(Wt+1);for(i=0,n=0;n<Xo-1;n++)for(Qo[n]=i,e=0;e<1<<Vo[n];e++)jn[i++]=n;for(jn[i-1]=n,r=0,n=0;n<16;n++)for(xa[n]=r,e=0;e<1<<va[n];e++)Pn[r++]=n;for(r>>=7;n<ki;n++)for(xa[n]=r<<7,e=0;e<1<<va[n]-7;e++)Pn[256+r++]=n;for(t=0;t<=Wt;t++)a[t]=0;for(e=0;e<=143;)st[e*2+1]=8,e++,a[8]++;for(;e<=255;)st[e*2+1]=9,e++,a[9]++;for(;e<=279;)st[e*2+1]=7,e++,a[7]++;for(;e<=287;)st[e*2+1]=8,e++,a[8]++;for(Ep(st,Rn+1,a),e=0;e<ki;e++)Mn[e*2+1]=5,Mn[e*2]=_p(e,5);yp=new Go(st,Vo,zn+1,Rn,Wt),vp=new Go(Mn,va,0,ki,Wt),xp=new Go(new Array(0),lv,0,Zo,ov)}function Sp(e){var t;for(t=0;t<Rn;t++)e.dyn_ltree[t*2]=0;for(t=0;t<ki;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Zo;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Jo*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Ap(e){e.bi_valid>8?Dn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function fv(e,t,i,n){Ap(e),n&&(Dn(e,i),Dn(e,~i)),ev.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function op(e,t,i,n){var r=t*2,a=i*2;return e[r]<e[a]||e[r]===e[a]&&n[t]<=n[i]}function Yo(e,t,i){for(var n=e.heap[i],r=i<<1;r<=e.heap_len&&(r<e.heap_len&&op(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!op(t,n,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r<<=1;e.heap[i]=n}function lp(e,t,i){var n,r,a=0,s,o;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],r=e.pending_buf[e.l_buf+a],a++,n===0?Fe(e,r,t):(s=jn[r],Fe(e,s+zn+1,t),o=Vo[s],o!==0&&(r-=Qo[s],fe(e,r,o)),n--,s=wp(n),Fe(e,s,i),o=va[s],o!==0&&(n-=xa[s],fe(e,n,o)));while(a<e.last_lit);Fe(e,Jo,t)}function Ko(e,t){var i=t.dyn_tree,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems,s,o,l=-1,c;for(e.heap_len=0,e.heap_max=fp,s=0;s<a;s++)i[s*2]!==0?(e.heap[++e.heap_len]=l=s,e.depth[s]=0):i[s*2+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,i[c*2]=1,e.depth[c]=0,e.opt_len--,r&&(e.static_len-=n[c*2+1]);for(t.max_code=l,s=e.heap_len>>1;s>=1;s--)Yo(e,i,s);c=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Yo(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,i[c*2]=i[s*2]+i[o*2],e.depth[c]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,i[s*2+1]=i[o*2+1]=c,e.heap[1]=c++,Yo(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],uv(e,t),Ep(i,l,e.bl_count)}function cp(e,t,i){var n,r=-1,a,s=t[1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),t[(i+1)*2+1]=65535,n=0;n<=i;n++)a=s,s=t[(n+1)*2+1],!(++o<l&&a===s)&&(o<c?e.bl_tree[a*2]+=o:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[hp*2]++):o<=10?e.bl_tree[gp*2]++:e.bl_tree[mp*2]++,o=0,r=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))}function dp(e,t,i){var n,r=-1,a,s=t[1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),n=0;n<=i;n++)if(a=s,s=t[(n+1)*2+1],!(++o<l&&a===s)){if(o<c)do Fe(e,a,e.bl_tree);while(--o!==0);else a!==0?(a!==r&&(Fe(e,a,e.bl_tree),o--),Fe(e,hp,e.bl_tree),fe(e,o-3,2)):o<=10?(Fe(e,gp,e.bl_tree),fe(e,o-3,3)):(Fe(e,mp,e.bl_tree),fe(e,o-11,7));o=0,r=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}}function hv(e){var t;for(cp(e,e.dyn_ltree,e.l_desc.max_code),cp(e,e.dyn_dtree,e.d_desc.max_code),Ko(e,e.bl_desc),t=Zo-1;t>=3&&e.bl_tree[bp[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function gv(e,t,i,n){var r;for(fe(e,t-257,5),fe(e,i-1,5),fe(e,n-4,4),r=0;r<n;r++)fe(e,e.bl_tree[bp[r]*2+1],3);dp(e,e.dyn_ltree,t-1),dp(e,e.dyn_dtree,i-1)}function mv(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return ap;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return sp;for(i=32;i<zn;i++)if(e.dyn_ltree[i*2]!==0)return sp;return ap}var up=!1;function bv(e){up||(pv(),up=!0),e.l_desc=new Wo(e.dyn_ltree,yp),e.d_desc=new Wo(e.dyn_dtree,vp),e.bl_desc=new Wo(e.bl_tree,xp),e.bi_buf=0,e.bi_valid=0,Sp(e)}function Cp(e,t,i,n){fe(e,(nv<<1)+(n?1:0),3),fv(e,t,i,!0)}function yv(e){fe(e,pp<<1,3),Fe(e,Jo,st),dv(e)}function vv(e,t,i,n){var r,a,s=0;e.level>0?(e.strm.data_type===iv&&(e.strm.data_type=mv(e)),Ko(e,e.l_desc),Ko(e,e.d_desc),s=hv(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=i+5,i+4<=r&&t!==-1?Cp(e,t,i,n):e.strategy===tv||a===r?(fe(e,(pp<<1)+(n?1:0),3),lp(e,st,Mn)):(fe(e,(rv<<1)+(n?1:0),3),gv(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),lp(e,e.dyn_ltree,e.dyn_dtree)),Sp(e),n&&Ap(e)}function xv(e,t,i){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=i&255,e.last_lit++,t===0?e.dyn_ltree[i*2]++:(e.matches++,t--,e.dyn_ltree[(jn[i]+zn+1)*2]++,e.dyn_dtree[wp(t)*2]++),e.last_lit===e.lit_bufsize-1}Oi._tr_init=bv;Oi._tr_stored_block=Cp;Oi._tr_flush_block=vv;Oi._tr_tally=xv;Oi._tr_align=yv});var el=k((J1,kp)=>{"use strict";function wv(e,t,i,n){for(var r=e&65535|0,a=e>>>16&65535|0,s=0;i!==0;){s=i>2e3?2e3:i,i-=s;do r=r+t[n++]|0,a=a+r|0;while(--s);r%=65521,a%=65521}return r|a<<16|0}kp.exports=wv});var tl=k((Q1,Lp)=>{"use strict";function _v(){for(var e,t=[],i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[i]=e}return t}var Ev=_v();function Sv(e,t,i,n){var r=Ev,a=n+i;e^=-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}Lp.exports=Sv});var wa=k((eE,Op)=>{"use strict";Op.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Bp=k(Ue=>{"use strict";var pe=at(),we=Tp(),Pp=el(),Et=tl(),Av=wa(),Xt=0,Cv=1,Tv=3,kt=4,Ip=5,$e=0,Mp=1,_e=-2,kv=-3,il=-5,Lv=-1,Ov=1,_a=2,Iv=3,Mv=4,Rv=0,Pv=2,Ca=8,jv=9,Dv=15,zv=8,Nv=29,Bv=256,rl=Bv+1+Nv,Fv=30,Hv=19,$v=2*rl+1,Uv=15,N=3,Ct=258,Le=Ct+N+1,qv=32,Ta=42,al=69,Ea=73,Sa=91,Aa=103,Yt=113,Bn=666,ie=1,Fn=2,Vt=3,Ri=4,Gv=3;function Tt(e,t){return e.msg=Av[t],t}function Rp(e){return(e<<1)-(e>4?9:0)}function At(e){for(var t=e.length;--t>=0;)e[t]=0}function St(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(pe.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,t.pending===0&&(t.pending_out=0))}function ae(e,t){we._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,St(e.strm)}function F(e,t){e.pending_buf[e.pending++]=t}function Nn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Wv(e,t,i,n){var r=e.avail_in;return r>n&&(r=n),r===0?0:(e.avail_in-=r,pe.arraySet(t,e.input,e.next_in,r,i),e.state.wrap===1?e.adler=Pp(e.adler,t,r,i):e.state.wrap===2&&(e.adler=Et(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function jp(e,t){var i=e.max_chain_length,n=e.strstart,r,a,s=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-Le?e.strstart-(e.w_size-Le):0,c=e.window,d=e.w_mask,u=e.prev,p=e.strstart+Ct,f=c[n+s-1],m=c[n+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(r=t,!(c[r+s]!==m||c[r+s-1]!==f||c[r]!==c[n]||c[++r]!==c[n+1])){n+=2,r++;do;while(c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&n<p);if(a=Ct-(p-n),n=p-Ct,a>s){if(e.match_start=t,s=a,a>=o)break;f=c[n+s-1],m=c[n+s]}}while((t=u[t&d])>l&&--i!==0);return s<=e.lookahead?s:e.lookahead}function Kt(e){var t=e.w_size,i,n,r,a,s;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Le)){pe.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,i=n;do r=e.head[--i],e.head[i]=r>=t?r-t:0;while(--n);n=t,i=n;do r=e.prev[--i],e.prev[i]=r>=t?r-t:0;while(--n);a+=t}if(e.strm.avail_in===0)break;if(n=Wv(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=N)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+N-1])&e.hash_mask,e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<N)););}while(e.lookahead<Le&&e.strm.avail_in!==0)}function Yv(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Kt(e),e.lookahead===0&&t===Xt)return ie;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+i;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,ae(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Le&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=0,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):(e.strstart>e.block_start&&(ae(e,!1),e.strm.avail_out===0),ie)}function nl(e,t){for(var i,n;;){if(e.lookahead<Le){if(Kt(e),e.lookahead<Le&&t===Xt)return ie;if(e.lookahead===0)break}if(i=0,e.lookahead>=N&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),i!==0&&e.strstart-i<=e.w_size-Le&&(e.match_length=jp(e,i)),e.match_length>=N)if(n=we._tr_tally(e,e.strstart-e.match_start,e.match_length-N),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=N){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=we._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=e.strstart<N-1?e.strstart:N-1,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function Ii(e,t){for(var i,n,r;;){if(e.lookahead<Le){if(Kt(e),e.lookahead<Le&&t===Xt)return ie;if(e.lookahead===0)break}if(i=0,e.lookahead>=N&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=N-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Le&&(e.match_length=jp(e,i),e.match_length<=5&&(e.strategy===Ov||e.match_length===N&&e.strstart-e.match_start>4096)&&(e.match_length=N-1)),e.prev_length>=N&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-N,n=we._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-N),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=N-1,e.strstart++,n&&(ae(e,!1),e.strm.avail_out===0))return ie}else if(e.match_available){if(n=we._tr_tally(e,0,e.window[e.strstart-1]),n&&ae(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ie}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=we._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<N-1?e.strstart:N-1,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function Vv(e,t){for(var i,n,r,a,s=e.window;;){if(e.lookahead<=Ct){if(Kt(e),e.lookahead<=Ct&&t===Xt)return ie;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=N&&e.strstart>0&&(r=e.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){a=e.strstart+Ct;do;while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<a);e.match_length=Ct-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=N?(i=we._tr_tally(e,1,e.match_length-N),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=we._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=0,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function Kv(e,t){for(var i;;){if(e.lookahead===0&&(Kt(e),e.lookahead===0)){if(t===Xt)return ie;break}if(e.match_length=0,i=we._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=0,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function He(e,t,i,n,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=n,this.func=r}var Mi;Mi=[new He(0,0,0,0,Yv),new He(4,4,8,4,nl),new He(4,5,16,8,nl),new He(4,6,32,32,nl),new He(4,4,16,16,Ii),new He(8,16,32,32,Ii),new He(8,16,128,128,Ii),new He(8,32,128,256,Ii),new He(32,128,258,1024,Ii),new He(32,258,258,4096,Ii)];function Xv(e){e.window_size=2*e.w_size,At(e.head),e.max_lazy_match=Mi[e.level].max_lazy,e.good_match=Mi[e.level].good_length,e.nice_match=Mi[e.level].nice_length,e.max_chain_length=Mi[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=N-1,e.match_available=0,e.ins_h=0}function Zv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ca,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new pe.Buf16($v*2),this.dyn_dtree=new pe.Buf16((2*Fv+1)*2),this.bl_tree=new pe.Buf16((2*Hv+1)*2),At(this.dyn_ltree),At(this.dyn_dtree),At(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new pe.Buf16(Uv+1),this.heap=new pe.Buf16(2*rl+1),At(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new pe.Buf16(2*rl+1),At(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Dp(e){var t;return!e||!e.state?Tt(e,_e):(e.total_in=e.total_out=0,e.data_type=Pv,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Ta:Yt,e.adler=t.wrap===2?0:1,t.last_flush=Xt,we._tr_init(t),$e)}function zp(e){var t=Dp(e);return t===$e&&Xv(e.state),t}function Jv(e,t){return!e||!e.state||e.state.wrap!==2?_e:(e.state.gzhead=t,$e)}function Np(e,t,i,n,r,a){if(!e)return _e;var s=1;if(t===Lv&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>jv||i!==Ca||n<8||n>15||t<0||t>9||a<0||a>Mv)return Tt(e,_e);n===8&&(n=9);var o=new Zv;return e.state=o,o.strm=e,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+N-1)/N),o.window=new pe.Buf8(o.w_size*2),o.head=new pe.Buf16(o.hash_size),o.prev=new pe.Buf16(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new pe.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=a,o.method=i,zp(e)}function Qv(e,t){return Np(e,t,Ca,Dv,zv,Rv)}function ex(e,t){var i,n,r,a;if(!e||!e.state||t>Ip||t<0)return e?Tt(e,_e):_e;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Bn&&t!==kt)return Tt(e,e.avail_out===0?il:_e);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===Ta)if(n.wrap===2)e.adler=0,F(n,31),F(n,139),F(n,8),n.gzhead?(F(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),F(n,n.gzhead.time&255),F(n,n.gzhead.time>>8&255),F(n,n.gzhead.time>>16&255),F(n,n.gzhead.time>>24&255),F(n,n.level===9?2:n.strategy>=_a||n.level<2?4:0),F(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(F(n,n.gzhead.extra.length&255),F(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Et(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=al):(F(n,0),F(n,0),F(n,0),F(n,0),F(n,0),F(n,n.level===9?2:n.strategy>=_a||n.level<2?4:0),F(n,Gv),n.status=Yt);else{var s=Ca+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=_a||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=qv),s+=31-s%31,n.status=Yt,Nn(n,s),n.strstart!==0&&(Nn(n,e.adler>>>16),Nn(n,e.adler&65535)),e.adler=1}if(n.status===al)if(n.gzhead.extra){for(r=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),St(e),r=n.pending,n.pending===n.pending_buf_size));)F(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Ea)}else n.status=Ea;if(n.status===Ea)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),St(e),r=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,F(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.gzindex=0,n.status=Sa)}else n.status=Sa;if(n.status===Sa)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),St(e),r=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,F(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.status=Aa)}else n.status=Aa;if(n.status===Aa&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&St(e),n.pending+2<=n.pending_buf_size&&(F(n,e.adler&255),F(n,e.adler>>8&255),e.adler=0,n.status=Yt)):n.status=Yt),n.pending!==0){if(St(e),e.avail_out===0)return n.last_flush=-1,$e}else if(e.avail_in===0&&Rp(t)<=Rp(i)&&t!==kt)return Tt(e,il);if(n.status===Bn&&e.avail_in!==0)return Tt(e,il);if(e.avail_in!==0||n.lookahead!==0||t!==Xt&&n.status!==Bn){var l=n.strategy===_a?Kv(n,t):n.strategy===Iv?Vv(n,t):Mi[n.level].func(n,t);if((l===Vt||l===Ri)&&(n.status=Bn),l===ie||l===Vt)return e.avail_out===0&&(n.last_flush=-1),$e;if(l===Fn&&(t===Cv?we._tr_align(n):t!==Ip&&(we._tr_stored_block(n,0,0,!1),t===Tv&&(At(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),St(e),e.avail_out===0))return n.last_flush=-1,$e}return t!==kt?$e:n.wrap<=0?Mp:(n.wrap===2?(F(n,e.adler&255),F(n,e.adler>>8&255),F(n,e.adler>>16&255),F(n,e.adler>>24&255),F(n,e.total_in&255),F(n,e.total_in>>8&255),F(n,e.total_in>>16&255),F(n,e.total_in>>24&255)):(Nn(n,e.adler>>>16),Nn(n,e.adler&65535)),St(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?$e:Mp)}function tx(e){var t;return!e||!e.state?_e:(t=e.state.status,t!==Ta&&t!==al&&t!==Ea&&t!==Sa&&t!==Aa&&t!==Yt&&t!==Bn?Tt(e,_e):(e.state=null,t===Yt?Tt(e,kv):$e))}function ix(e,t){var i=t.length,n,r,a,s,o,l,c,d;if(!e||!e.state||(n=e.state,s=n.wrap,s===2||s===1&&n.status!==Ta||n.lookahead))return _e;for(s===1&&(e.adler=Pp(e.adler,t,i,0)),n.wrap=0,i>=n.w_size&&(s===0&&(At(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new pe.Buf8(n.w_size),pe.arraySet(d,t,i-n.w_size,n.w_size,0),t=d,i=n.w_size),o=e.avail_in,l=e.next_in,c=e.input,e.avail_in=i,e.next_in=0,e.input=t,Kt(n);n.lookahead>=N;){r=n.strstart,a=n.lookahead-(N-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+N-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++;while(--a);n.strstart=r,n.lookahead=N-1,Kt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=N-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=o,n.wrap=s,$e}Ue.deflateInit=Qv;Ue.deflateInit2=Np;Ue.deflateReset=zp;Ue.deflateResetKeep=Dp;Ue.deflateSetHeader=Jv;Ue.deflate=ex;Ue.deflateEnd=tx;Ue.deflateSetDictionary=ix;Ue.deflateInfo="pako deflate (from Nodeca project)"});var sl=k(Pi=>{"use strict";var ka=at(),Fp=!0,Hp=!0;try{String.fromCharCode.apply(null,[0])}catch{Fp=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Hp=!1}var Hn=new ka.Buf8(256);for(ot=0;ot<256;ot++)Hn[ot]=ot>=252?6:ot>=248?5:ot>=240?4:ot>=224?3:ot>=192?2:1;var ot;Hn[254]=Hn[254]=1;Pi.string2buf=function(e){var t,i,n,r,a,s=e.length,o=0;for(r=0;r<s;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new ka.Buf8(o),a=0,r=0;a<o;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>>6,t[a++]=128|i&63):i<65536?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|i&63):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|i&63);return t};function $p(e,t){if(t<65534&&(e.subarray&&Hp||!e.subarray&&Fp))return String.fromCharCode.apply(null,ka.shrinkBuf(e,t));for(var i="",n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i}Pi.buf2binstring=function(e){return $p(e,e.length)};Pi.binstring2buf=function(e){for(var t=new ka.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t};Pi.buf2string=function(e,t){var i,n,r,a,s=t||e.length,o=new Array(s*2);for(n=0,i=0;i<s;){if(r=e[i++],r<128){o[n++]=r;continue}if(a=Hn[r],a>4){o[n++]=65533,i+=a-1;continue}for(r&=a===2?31:a===3?15:7;a>1&&i<s;)r=r<<6|e[i++]&63,a--;if(a>1){o[n++]=65533;continue}r<65536?o[n++]=r:(r-=65536,o[n++]=55296|r>>10&1023,o[n++]=56320|r&1023)}return $p(o,n)};Pi.utf8border=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&(e[i]&192)===128;)i--;return i<0||i===0?t:i+Hn[e[i]]>t?i:t}});var ol=k((nE,Up)=>{"use strict";function nx(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Up.exports=nx});var Yp=k(qn=>{"use strict";var $n=Bp(),Un=at(),cl=sl(),dl=wa(),rx=ol(),Wp=Object.prototype.toString,ax=0,ll=4,ji=0,qp=1,Gp=2,sx=-1,ox=0,lx=8;function Zt(e){if(!(this instanceof Zt))return new Zt(e);this.options=Un.assign({level:sx,method:lx,chunkSize:16384,windowBits:15,memLevel:8,strategy:ox,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new rx,this.strm.avail_out=0;var i=$n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==ji)throw new Error(dl[i]);if(t.header&&$n.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=cl.string2buf(t.dictionary):Wp.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,i=$n.deflateSetDictionary(this.strm,n),i!==ji)throw new Error(dl[i]);this._dict_set=!0}}Zt.prototype.push=function(e,t){var i=this.strm,n=this.options.chunkSize,r,a;if(this.ended)return!1;a=t===~~t?t:t===!0?ll:ax,typeof e=="string"?i.input=cl.string2buf(e):Wp.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new Un.Buf8(n),i.next_out=0,i.avail_out=n),r=$n.deflate(i,a),r!==qp&&r!==ji)return this.onEnd(r),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(a===ll||a===Gp))&&(this.options.to==="string"?this.onData(cl.buf2binstring(Un.shrinkBuf(i.output,i.next_out))):this.onData(Un.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&r!==qp);return a===ll?(r=$n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ji):(a===Gp&&(this.onEnd(ji),i.avail_out=0),!0)};Zt.prototype.onData=function(e){this.chunks.push(e)};Zt.prototype.onEnd=function(e){e===ji&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ul(e,t){var i=new Zt(t);if(i.push(e,!0),i.err)throw i.msg||dl[i.err];return i.result}function cx(e,t){return t=t||{},t.raw=!0,ul(e,t)}function dx(e,t){return t=t||{},t.gzip=!0,ul(e,t)}qn.Deflate=Zt;qn.deflate=ul;qn.deflateRaw=cx;qn.gzip=dx});var Kp=k((aE,Vp)=>{"use strict";var La=30,ux=12;Vp.exports=function(t,i){var n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,S,A,_,T,M,E;n=t.state,r=t.next_in,M=t.input,a=r+(t.avail_in-5),s=t.next_out,E=t.output,o=s-(i-t.avail_out),l=s+(t.avail_out-257),c=n.dmax,d=n.wsize,u=n.whave,p=n.wnext,f=n.window,m=n.hold,h=n.bits,g=n.lencode,b=n.distcode,y=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;e:do{h<15&&(m+=M[r++]<<h,h+=8,m+=M[r++]<<h,h+=8),x=g[m&y];t:for(;;){if(w=x>>>24,m>>>=w,h-=w,w=x>>>16&255,w===0)E[s++]=x&65535;else if(w&16){S=x&65535,w&=15,w&&(h<w&&(m+=M[r++]<<h,h+=8),S+=m&(1<<w)-1,m>>>=w,h-=w),h<15&&(m+=M[r++]<<h,h+=8,m+=M[r++]<<h,h+=8),x=b[m&v];i:for(;;){if(w=x>>>24,m>>>=w,h-=w,w=x>>>16&255,w&16){if(A=x&65535,w&=15,h<w&&(m+=M[r++]<<h,h+=8,h<w&&(m+=M[r++]<<h,h+=8)),A+=m&(1<<w)-1,A>c){t.msg="invalid distance too far back",n.mode=La;break e}if(m>>>=w,h-=w,w=s-o,A>w){if(w=A-w,w>u&&n.sane){t.msg="invalid distance too far back",n.mode=La;break e}if(_=0,T=f,p===0){if(_+=d-w,w<S){S-=w;do E[s++]=f[_++];while(--w);_=s-A,T=E}}else if(p<w){if(_+=d+p-w,w-=p,w<S){S-=w;do E[s++]=f[_++];while(--w);if(_=0,p<S){w=p,S-=w;do E[s++]=f[_++];while(--w);_=s-A,T=E}}}else if(_+=p-w,w<S){S-=w;do E[s++]=f[_++];while(--w);_=s-A,T=E}for(;S>2;)E[s++]=T[_++],E[s++]=T[_++],E[s++]=T[_++],S-=3;S&&(E[s++]=T[_++],S>1&&(E[s++]=T[_++]))}else{_=s-A;do E[s++]=E[_++],E[s++]=E[_++],E[s++]=E[_++],S-=3;while(S>2);S&&(E[s++]=E[_++],S>1&&(E[s++]=E[_++]))}}else if((w&64)===0){x=b[(x&65535)+(m&(1<<w)-1)];continue i}else{t.msg="invalid distance code",n.mode=La;break e}break}}else if((w&64)===0){x=g[(x&65535)+(m&(1<<w)-1)];continue t}else if(w&32){n.mode=ux;break e}else{t.msg="invalid literal/length code",n.mode=La;break e}break}}while(r<a&&s<l);S=h>>3,r-=S,h-=S<<3,m&=(1<<h)-1,t.next_in=r,t.next_out=s,t.avail_in=r<a?5+(a-r):5-(r-a),t.avail_out=s<l?257+(l-s):257-(s-l),n.hold=m,n.bits=h}});var nf=k((sE,tf)=>{"use strict";var Xp=at(),Di=15,Zp=852,Jp=592,Qp=0,pl=1,ef=2,px=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],fx=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],hx=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],gx=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];tf.exports=function(t,i,n,r,a,s,o,l){var c=l.bits,d=0,u=0,p=0,f=0,m=0,h=0,g=0,b=0,y=0,v=0,x,w,S,A,_,T=null,M=0,E,L=new Xp.Buf16(Di+1),z=new Xp.Buf16(Di+1),D=null,B=0,O,P,C;for(d=0;d<=Di;d++)L[d]=0;for(u=0;u<r;u++)L[i[n+u]]++;for(m=c,f=Di;f>=1&&L[f]===0;f--);if(m>f&&(m=f),f===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(p=1;p<f&&L[p]===0;p++);for(m<p&&(m=p),b=1,d=1;d<=Di;d++)if(b<<=1,b-=L[d],b<0)return-1;if(b>0&&(t===Qp||f!==1))return-1;for(z[1]=0,d=1;d<Di;d++)z[d+1]=z[d]+L[d];for(u=0;u<r;u++)i[n+u]!==0&&(o[z[i[n+u]]++]=u);if(t===Qp?(T=D=o,E=19):t===pl?(T=px,M-=257,D=fx,B-=257,E=256):(T=hx,D=gx,E=-1),v=0,u=0,d=p,_=s,h=m,g=0,S=-1,y=1<<m,A=y-1,t===pl&&y>Zp||t===ef&&y>Jp)return 1;for(;;){O=d-g,o[u]<E?(P=0,C=o[u]):o[u]>E?(P=D[B+o[u]],C=T[M+o[u]]):(P=96,C=0),x=1<<d-g,w=1<<h,p=w;do w-=x,a[_+(v>>g)+w]=O<<24|P<<16|C|0;while(w!==0);for(x=1<<d-1;v&x;)x>>=1;if(x!==0?(v&=x-1,v+=x):v=0,u++,--L[d]===0){if(d===f)break;d=i[n+o[u]]}if(d>m&&(v&A)!==S){for(g===0&&(g=m),_+=p,h=d-g,b=1<<h;h+g<f&&(b-=L[h+g],!(b<=0));)h++,b<<=1;if(y+=1<<h,t===pl&&y>Zp||t===ef&&y>Jp)return 1;S=v&A,a[S]=m<<24|h<<16|_-s|0}}return v!==0&&(a[_+v]=d-g<<24|64<<16|0),l.bits=m,0}});var Nf=k(Oe=>{"use strict";var me=at(),yl=el(),qe=tl(),mx=Kp(),Gn=nf(),bx=0,Lf=1,Of=2,rf=4,yx=5,Oa=6,Jt=0,vx=1,xx=2,Ee=-2,If=-3,vl=-4,wx=-5,af=8,Mf=1,sf=2,of=3,lf=4,cf=5,df=6,uf=7,pf=8,ff=9,hf=10,Ra=11,lt=12,fl=13,gf=14,hl=15,mf=16,bf=17,yf=18,vf=19,Ia=20,Ma=21,xf=22,wf=23,_f=24,Ef=25,Sf=26,gl=27,Af=28,Cf=29,W=30,xl=31,_x=32,Ex=852,Sx=592,Ax=15,Cx=Ax;function Tf(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function Tx(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new me.Buf16(320),this.work=new me.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Rf(e){var t;return!e||!e.state?Ee:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Mf,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new me.Buf32(Ex),t.distcode=t.distdyn=new me.Buf32(Sx),t.sane=1,t.back=-1,Jt)}function Pf(e){var t;return!e||!e.state?Ee:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Rf(e))}function jf(e,t){var i,n;return!e||!e.state||(n=e.state,t<0?(i=0,t=-t):(i=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Ee:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,Pf(e))}function Df(e,t){var i,n;return e?(n=new Tx,e.state=n,n.window=null,i=jf(e,t),i!==Jt&&(e.state=null),i):Ee}function kx(e){return Df(e,Cx)}var kf=!0,ml,bl;function Lx(e){if(kf){var t;for(ml=new me.Buf32(512),bl=new me.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Gn(Lf,e.lens,0,288,ml,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Gn(Of,e.lens,0,32,bl,0,e.work,{bits:5}),kf=!1}e.lencode=ml,e.lenbits=9,e.distcode=bl,e.distbits=5}function zf(e,t,i,n){var r,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new me.Buf8(a.wsize)),n>=a.wsize?(me.arraySet(a.window,t,i-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>n&&(r=n),me.arraySet(a.window,t,i-n,r,a.wnext),n-=r,n?(me.arraySet(a.window,t,i-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}function Ox(e,t){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g=0,b,y,v,x,w,S,A,_,T=new me.Buf8(4),M,E,L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Ee;i=e.state,i.mode===lt&&(i.mode=fl),s=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,c=i.hold,d=i.bits,u=o,p=l,_=Jt;e:for(;;)switch(i.mode){case Mf:if(i.wrap===0){i.mode=fl;break}for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.wrap&2&&c===35615){i.check=0,T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0),c=0,d=0,i.mode=sf;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",i.mode=W;break}if((c&15)!==af){e.msg="unknown compression method",i.mode=W;break}if(c>>>=4,d-=4,A=(c&15)+8,i.wbits===0)i.wbits=A;else if(A>i.wbits){e.msg="invalid window size",i.mode=W;break}i.dmax=1<<A,e.adler=i.check=1,i.mode=c&512?hf:lt,c=0,d=0;break;case sf:for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.flags=c,(i.flags&255)!==af){e.msg="unknown compression method",i.mode=W;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=W;break}i.head&&(i.head.text=c>>8&1),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0)),c=0,d=0,i.mode=of;case of:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.head&&(i.head.time=c),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,T[2]=c>>>16&255,T[3]=c>>>24&255,i.check=qe(i.check,T,4,0)),c=0,d=0,i.mode=lf;case lf:for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.head&&(i.head.xflags=c&255,i.head.os=c>>8),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0)),c=0,d=0,i.mode=cf;case cf:if(i.flags&1024){for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.length=c,i.head&&(i.head.extra_len=c),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0)),c=0,d=0}else i.head&&(i.head.extra=null);i.mode=df;case df:if(i.flags&1024&&(f=i.length,f>o&&(f=o),f&&(i.head&&(A=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),me.arraySet(i.head.extra,n,a,f,A)),i.flags&512&&(i.check=qe(i.check,n,f,a)),o-=f,a+=f,i.length-=f),i.length))break e;i.length=0,i.mode=uf;case uf:if(i.flags&2048){if(o===0)break e;f=0;do A=n[a+f++],i.head&&A&&i.length<65536&&(i.head.name+=String.fromCharCode(A));while(A&&f<o);if(i.flags&512&&(i.check=qe(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=pf;case pf:if(i.flags&4096){if(o===0)break e;f=0;do A=n[a+f++],i.head&&A&&i.length<65536&&(i.head.comment+=String.fromCharCode(A));while(A&&f<o);if(i.flags&512&&(i.check=qe(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.comment=null);i.mode=ff;case ff:if(i.flags&512){for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(c!==(i.check&65535)){e.msg="header crc mismatch",i.mode=W;break}c=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=lt;break;case hf:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}e.adler=i.check=Tf(c),c=0,d=0,i.mode=Ra;case Ra:if(i.havedict===0)return e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=c,i.bits=d,xx;e.adler=i.check=1,i.mode=lt;case lt:if(t===yx||t===Oa)break e;case fl:if(i.last){c>>>=d&7,d-=d&7,i.mode=gl;break}for(;d<3;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}switch(i.last=c&1,c>>>=1,d-=1,c&3){case 0:i.mode=gf;break;case 1:if(Lx(i),i.mode=Ia,t===Oa){c>>>=2,d-=2;break e}break;case 2:i.mode=bf;break;case 3:e.msg="invalid block type",i.mode=W}c>>>=2,d-=2;break;case gf:for(c>>>=d&7,d-=d&7;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",i.mode=W;break}if(i.length=c&65535,c=0,d=0,i.mode=hl,t===Oa)break e;case hl:i.mode=mf;case mf:if(f=i.length,f){if(f>o&&(f=o),f>l&&(f=l),f===0)break e;me.arraySet(r,n,a,f,s),o-=f,a+=f,l-=f,s+=f,i.length-=f;break}i.mode=lt;break;case bf:for(;d<14;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.nlen=(c&31)+257,c>>>=5,d-=5,i.ndist=(c&31)+1,c>>>=5,d-=5,i.ncode=(c&15)+4,c>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=W;break}i.have=0,i.mode=yf;case yf:for(;i.have<i.ncode;){for(;d<3;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.lens[L[i.have++]]=c&7,c>>>=3,d-=3}for(;i.have<19;)i.lens[L[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,M={bits:i.lenbits},_=Gn(bx,i.lens,0,19,i.lencode,0,i.work,M),i.lenbits=M.bits,_){e.msg="invalid code lengths set",i.mode=W;break}i.have=0,i.mode=vf;case vf:for(;i.have<i.nlen+i.ndist;){for(;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,y=g>>>16&255,v=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(v<16)c>>>=b,d-=b,i.lens[i.have++]=v;else{if(v===16){for(E=b+2;d<E;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(c>>>=b,d-=b,i.have===0){e.msg="invalid bit length repeat",i.mode=W;break}A=i.lens[i.have-1],f=3+(c&3),c>>>=2,d-=2}else if(v===17){for(E=b+3;d<E;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=b,d-=b,A=0,f=3+(c&7),c>>>=3,d-=3}else{for(E=b+7;d<E;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=b,d-=b,A=0,f=11+(c&127),c>>>=7,d-=7}if(i.have+f>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=W;break}for(;f--;)i.lens[i.have++]=A}}if(i.mode===W)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=W;break}if(i.lenbits=9,M={bits:i.lenbits},_=Gn(Lf,i.lens,0,i.nlen,i.lencode,0,i.work,M),i.lenbits=M.bits,_){e.msg="invalid literal/lengths set",i.mode=W;break}if(i.distbits=6,i.distcode=i.distdyn,M={bits:i.distbits},_=Gn(Of,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,M),i.distbits=M.bits,_){e.msg="invalid distances set",i.mode=W;break}if(i.mode=Ia,t===Oa)break e;case Ia:i.mode=Ma;case Ma:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=c,i.bits=d,mx(e,p),s=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,c=i.hold,d=i.bits,i.mode===lt&&(i.back=-1);break}for(i.back=0;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,y=g>>>16&255,v=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(y&&(y&240)===0){for(x=b,w=y,S=v;g=i.lencode[S+((c&(1<<x+w)-1)>>x)],b=g>>>24,y=g>>>16&255,v=g&65535,!(x+b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=x,d-=x,i.back+=x}if(c>>>=b,d-=b,i.back+=b,i.length=v,y===0){i.mode=Sf;break}if(y&32){i.back=-1,i.mode=lt;break}if(y&64){e.msg="invalid literal/length code",i.mode=W;break}i.extra=y&15,i.mode=xf;case xf:if(i.extra){for(E=i.extra;d<E;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.length+=c&(1<<i.extra)-1,c>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=wf;case wf:for(;g=i.distcode[c&(1<<i.distbits)-1],b=g>>>24,y=g>>>16&255,v=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if((y&240)===0){for(x=b,w=y,S=v;g=i.distcode[S+((c&(1<<x+w)-1)>>x)],b=g>>>24,y=g>>>16&255,v=g&65535,!(x+b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=x,d-=x,i.back+=x}if(c>>>=b,d-=b,i.back+=b,y&64){e.msg="invalid distance code",i.mode=W;break}i.offset=v,i.extra=y&15,i.mode=_f;case _f:if(i.extra){for(E=i.extra;d<E;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.offset+=c&(1<<i.extra)-1,c>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=W;break}i.mode=Ef;case Ef:if(l===0)break e;if(f=p-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=W;break}f>i.wnext?(f-=i.wnext,m=i.wsize-f):m=i.wnext-f,f>i.length&&(f=i.length),h=i.window}else h=r,m=s-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do r[s++]=h[m++];while(--f);i.length===0&&(i.mode=Ma);break;case Sf:if(l===0)break e;r[s++]=i.length,l--,i.mode=Ma;break;case gl:if(i.wrap){for(;d<32;){if(o===0)break e;o--,c|=n[a++]<<d,d+=8}if(p-=l,e.total_out+=p,i.total+=p,p&&(e.adler=i.check=i.flags?qe(i.check,r,p,s-p):yl(i.check,r,p,s-p)),p=l,(i.flags?c:Tf(c))!==i.check){e.msg="incorrect data check",i.mode=W;break}c=0,d=0}i.mode=Af;case Af:if(i.wrap&&i.flags){for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(c!==(i.total&4294967295)){e.msg="incorrect length check",i.mode=W;break}c=0,d=0}i.mode=Cf;case Cf:_=vx;break e;case W:_=If;break e;case xl:return vl;case _x:default:return Ee}return e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=c,i.bits=d,(i.wsize||p!==e.avail_out&&i.mode<W&&(i.mode<gl||t!==rf))&&zf(e,e.output,e.next_out,p-e.avail_out)?(i.mode=xl,vl):(u-=e.avail_in,p-=e.avail_out,e.total_in+=u,e.total_out+=p,i.total+=p,i.wrap&&p&&(e.adler=i.check=i.flags?qe(i.check,r,p,e.next_out-p):yl(i.check,r,p,e.next_out-p)),e.data_type=i.bits+(i.last?64:0)+(i.mode===lt?128:0)+(i.mode===Ia||i.mode===hl?256:0),(u===0&&p===0||t===rf)&&_===Jt&&(_=wx),_)}function Ix(e){if(!e||!e.state)return Ee;var t=e.state;return t.window&&(t.window=null),e.state=null,Jt}function Mx(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?Ee:(i.head=t,t.done=!1,Jt)}function Rx(e,t){var i=t.length,n,r,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Ra)?Ee:n.mode===Ra&&(r=1,r=yl(r,t,i,0),r!==n.check)?If:(a=zf(e,t,i,i),a?(n.mode=xl,vl):(n.havedict=1,Jt))}Oe.inflateReset=Pf;Oe.inflateReset2=jf;Oe.inflateResetKeep=Rf;Oe.inflateInit=kx;Oe.inflateInit2=Df;Oe.inflate=Ox;Oe.inflateEnd=Ix;Oe.inflateGetHeader=Mx;Oe.inflateSetDictionary=Rx;Oe.inflateInfo="pako inflate (from Nodeca project)"});var wl=k((lE,Bf)=>{"use strict";Bf.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Hf=k((cE,Ff)=>{"use strict";function Px(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Ff.exports=Px});var Uf=k(Yn=>{"use strict";var zi=Nf(),Wn=at(),Pa=sl(),X=wl(),_l=wa(),jx=ol(),Dx=Hf(),$f=Object.prototype.toString;function Qt(e){if(!(this instanceof Qt))return new Qt(e);this.options=Wn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new jx,this.strm.avail_out=0;var i=zi.inflateInit2(this.strm,t.windowBits);if(i!==X.Z_OK)throw new Error(_l[i]);if(this.header=new Dx,zi.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Pa.string2buf(t.dictionary):$f.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=zi.inflateSetDictionary(this.strm,t.dictionary),i!==X.Z_OK)))throw new Error(_l[i])}Qt.prototype.push=function(e,t){var i=this.strm,n=this.options.chunkSize,r=this.options.dictionary,a,s,o,l,c,d=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?X.Z_FINISH:X.Z_NO_FLUSH,typeof e=="string"?i.input=Pa.binstring2buf(e):$f.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new Wn.Buf8(n),i.next_out=0,i.avail_out=n),a=zi.inflate(i,X.Z_NO_FLUSH),a===X.Z_NEED_DICT&&r&&(a=zi.inflateSetDictionary(this.strm,r)),a===X.Z_BUF_ERROR&&d===!0&&(a=X.Z_OK,d=!1),a!==X.Z_STREAM_END&&a!==X.Z_OK)return this.onEnd(a),this.ended=!0,!1;i.next_out&&(i.avail_out===0||a===X.Z_STREAM_END||i.avail_in===0&&(s===X.Z_FINISH||s===X.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Pa.utf8border(i.output,i.next_out),l=i.next_out-o,c=Pa.buf2string(i.output,o),i.next_out=l,i.avail_out=n-l,l&&Wn.arraySet(i.output,i.output,o,l,0),this.onData(c)):this.onData(Wn.shrinkBuf(i.output,i.next_out))),i.avail_in===0&&i.avail_out===0&&(d=!0)}while((i.avail_in>0||i.avail_out===0)&&a!==X.Z_STREAM_END);return a===X.Z_STREAM_END&&(s=X.Z_FINISH),s===X.Z_FINISH?(a=zi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===X.Z_OK):(s===X.Z_SYNC_FLUSH&&(this.onEnd(X.Z_OK),i.avail_out=0),!0)};Qt.prototype.onData=function(e){this.chunks.push(e)};Qt.prototype.onEnd=function(e){e===X.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function El(e,t){var i=new Qt(t);if(i.push(e,!0),i.err)throw i.msg||_l[i.err];return i.result}function zx(e,t){return t=t||{},t.raw=!0,El(e,t)}Yn.Inflate=Qt;Yn.inflate=El;Yn.inflateRaw=zx;Yn.ungzip=El});var Wf=k((uE,Gf)=>{"use strict";var Nx=at().assign,Bx=Yp(),Fx=Uf(),Hx=wl(),qf={};Nx(qf,Bx,Fx,Hx);Gf.exports=qf});var Vf=k(Da=>{"use strict";var $x=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",Ux=Wf(),Yf=V(),ja=ge(),qx=$x?"uint8array":"array";Da.magic="\b\0";function ei(e,t){ja.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Yf.inherits(ei,ja);ei.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Yf.transformTo(qx,e.data),!1)};ei.prototype.flush=function(){ja.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};ei.prototype.cleanUp=function(){ja.prototype.cleanUp.call(this),this._pako=null};ei.prototype._createPako=function(){this._pako=new Ux[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Da.compressWorker=function(e){return new ei("Deflate",e)};Da.uncompressWorker=function(){return new ei("Inflate",{})}});var Al=k(Sl=>{"use strict";var Kf=ge();Sl.STORE={magic:"\0\0",compressWorker:function(){return new Kf("STORE compression")},uncompressWorker:function(){return new Kf("STORE decompression")}};Sl.DEFLATE=Vf()});var Cl=k(ti=>{"use strict";ti.LOCAL_FILE_HEADER="PK";ti.CENTRAL_FILE_HEADER="PK";ti.CENTRAL_DIRECTORY_END="PK";ti.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";ti.ZIP64_CENTRAL_DIRECTORY_END="PK";ti.DATA_DESCRIPTOR="PK\x07\b"});var Qf=k((gE,Jf)=>{"use strict";var Ni=V(),Bi=ge(),Tl=Ci(),Xf=ma(),za=Cl(),U=function(e,t){var i="",n;for(n=0;n<t;n++)i+=String.fromCharCode(e&255),e=e>>>8;return i},Gx=function(e,t){var i=e;return e||(i=t?16893:33204),(i&65535)<<16},Wx=function(e){return(e||0)&63},Zf=function(e,t,i,n,r,a){var s=e.file,o=e.compression,l=a!==Tl.utf8encode,c=Ni.transformTo("string",a(s.name)),d=Ni.transformTo("string",Tl.utf8encode(s.name)),u=s.comment,p=Ni.transformTo("string",a(u)),f=Ni.transformTo("string",Tl.utf8encode(u)),m=d.length!==s.name.length,h=f.length!==u.length,g,b,y="",v="",x="",w=s.dir,S=s.date,A={crc32:0,compressedSize:0,uncompressedSize:0};(!t||i)&&(A.crc32=e.crc32,A.compressedSize=e.compressedSize,A.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),!l&&(m||h)&&(_|=2048);var T=0,M=0;w&&(T|=16),r==="UNIX"?(M=798,T|=Gx(s.unixPermissions,w)):(M=20,T|=Wx(s.dosPermissions,w)),g=S.getUTCHours(),g=g<<6,g=g|S.getUTCMinutes(),g=g<<5,g=g|S.getUTCSeconds()/2,b=S.getUTCFullYear()-1980,b=b<<4,b=b|S.getUTCMonth()+1,b=b<<5,b=b|S.getUTCDate(),m&&(v=U(1,1)+U(Xf(c),4)+d,y+="up"+U(v.length,2)+v),h&&(x=U(1,1)+U(Xf(p),4)+f,y+="uc"+U(x.length,2)+x);var E="";E+=`
|
|
2
|
-
\0`,E+=U(_,2),E+=o.magic,E+=U(g,2),E+=U(b,2),E+=U(A.crc32,4),E+=U(A.compressedSize,4),E+=U(A.uncompressedSize,4),E+=U(c.length,2),E+=U(y.length,2);var L=za.LOCAL_FILE_HEADER+E+c+y,z=za.CENTRAL_FILE_HEADER+U(M,2)+E+U(p.length,2)+"\0\0\0\0"+U(T,4)+U(n,4)+c+y+p;return{fileRecord:L,dirRecord:z}},Yx=function(e,t,i,n,r){var a="",s=Ni.transformTo("string",r(n));return a=za.CENTRAL_DIRECTORY_END+"\0\0\0\0"+U(e,2)+U(e,2)+U(t,4)+U(i,4)+U(s.length,2)+s,a},Vx=function(e){var t="";return t=za.DATA_DESCRIPTOR+U(e.crc32,4)+U(e.compressedSize,4)+U(e.uncompressedSize,4),t};function Ie(e,t,i,n){Bi.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}Ni.inherits(Ie,Bi);Ie.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,Bi.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-n-1))/i:100}}))};Ie.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=Zf(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Ie.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=Zf(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:Vx(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};Ie.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i=this.bytesWritten-e,n=Yx(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};Ie.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};Ie.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(i){t.processChunk(i)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(i){t.error(i)}),this};Ie.prototype.resume=function(){if(!Bi.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};Ie.prototype.error=function(e){var t=this._sources;if(!Bi.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch{}return!0};Ie.prototype.lock=function(){Bi.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Jf.exports=Ie});var th=k(eh=>{"use strict";var Kx=Al(),Xx=Qf(),Zx=function(e,t){var i=e||t,n=Kx[i];if(!n)throw new Error(i+" is not a valid compression method !");return n};eh.generateWorker=function(e,t,i){var n=new Xx(t.streamFiles,i,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,s){r++;var o=Zx(s.options.compression,t.compression),l=s.options.compressionOptions||t.compressionOptions||{},c=s.dir,d=s.date;s._compressWorker(o,l).withStreamInfo("file",{name:a,dir:c,date:d,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(n)}),n.entriesCount=r}catch(a){n.error(a)}return n}});var nh=k((bE,ih)=>{"use strict";var Jx=V(),Na=ge();function Vn(e,t){Na.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Jx.inherits(Vn,Na);Vn.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(i){t.push({data:i,meta:{percent:0}})}).on("error",function(i){t.isPaused?this.generatedError=i:t.error(i)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};Vn.prototype.pause=function(){return Na.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Vn.prototype.resume=function(){return Na.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};ih.exports=Vn});var fh=k((yE,ph)=>{"use strict";var Qx=Ci(),Kn=V(),oh=ge(),ew=Mo(),lh=Ro(),rh=ba(),tw=rp(),iw=th(),ah=Sn(),nw=nh(),ch=function(e,t,i){var n=Kn.getTypeOf(t),r,a=Kn.extend(i||{},lh);a.date=a.date||new Date,a.compression!==null&&(a.compression=a.compression.toUpperCase()),typeof a.unixPermissions=="string"&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&a.unixPermissions&16384&&(a.dir=!0),a.dosPermissions&&a.dosPermissions&16&&(a.dir=!0),a.dir&&(e=dh(e)),a.createFolders&&(r=rw(e))&&uh.call(this,r,!0);var s=n==="string"&&a.binary===!1&&a.base64===!1;(!i||typeof i.binary=="undefined")&&(a.binary=!s);var o=t instanceof rh&&t.uncompressedSize===0;(o||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var l=null;t instanceof rh||t instanceof oh?l=t:ah.isNode&&ah.isStream(t)?l=new nw(e,t):l=Kn.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var c=new tw(e,l,a);this.files[e]=c},rw=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},dh=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},uh=function(e,t){return t=typeof t!="undefined"?t:lh.createFolders,e=dh(e),this.files[e]||ch.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function sh(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var aw={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,n;for(t in this.files)n=this.files[t],i=t.slice(this.root.length,t.length),i&&t.slice(0,this.root.length)===this.root&&e(i,n)},filter:function(e){var t=[];return this.forEach(function(i,n){e(i,n)&&t.push(n)}),t},file:function(e,t,i){if(arguments.length===1)if(sh(e)){var n=e;return this.filter(function(a,s){return!s.dir&&n.test(a)})}else{var r=this.files[this.root+e];return r&&!r.dir?r:null}else e=this.root+e,ch.call(this,e,t,i);return this},folder:function(e){if(!e)return this;if(sh(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,i=uh.call(this,t),n=this.clone();return n.root=i.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter(function(r,a){return a.name.slice(0,e.length)===e}),n=0;n<i.length;n++)delete this.files[i[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if(i=Kn.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Qx.utf8encode}),i.type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),i.type==="binarystring"&&(i.type="string"),!i.type)throw new Error("No output type specified.");Kn.checkSupport(i.type),(i.platform==="darwin"||i.platform==="freebsd"||i.platform==="linux"||i.platform==="sunos")&&(i.platform="UNIX"),i.platform==="win32"&&(i.platform="DOS");var n=i.comment||this.comment||"";t=iw.generateWorker(this,i,n)}catch(r){t=new oh("error"),t.error(r)}return new ew(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};ph.exports=aw});var kl=k((vE,gh)=>{"use strict";var sw=V();function hh(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}hh.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,i;for(this.checkOffset(e),i=this.index+e-1;i>=this.index;i--)t=(t<<8)+this.byteAt(i);return this.index+=e,t},readString:function(e){return sw.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};gh.exports=hh});var Ll=k((xE,bh)=>{"use strict";var mh=kl(),ow=V();function Fi(e){mh.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}ow.inherits(Fi,mh);Fi.prototype.byteAt=function(e){return this.data[this.zero+e]};Fi.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),n=e.charCodeAt(2),r=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===i&&this.data[a+2]===n&&this.data[a+3]===r)return a-this.zero;return-1};Fi.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),n=e.charCodeAt(2),r=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&i===a[1]&&n===a[2]&&r===a[3]};Fi.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};bh.exports=Fi});var xh=k((wE,vh)=>{"use strict";var yh=kl(),lw=V();function Hi(e){yh.call(this,e)}lw.inherits(Hi,yh);Hi.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};Hi.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};Hi.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};Hi.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};vh.exports=Hi});var Il=k((_E,_h)=>{"use strict";var wh=Ll(),cw=V();function Ol(e){wh.call(this,e)}cw.inherits(Ol,wh);Ol.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};_h.exports=Ol});var Ah=k((EE,Sh)=>{"use strict";var Eh=Il(),dw=V();function Ml(e){Eh.call(this,e)}dw.inherits(Ml,Eh);Ml.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Sh.exports=Ml});var Rl=k((SE,Th)=>{"use strict";var Ba=V(),Ch=nt(),uw=Ll(),pw=xh(),fw=Ah(),hw=Il();Th.exports=function(e){var t=Ba.getTypeOf(e);return Ba.checkSupport(t),t==="string"&&!Ch.uint8array?new pw(e):t==="nodebuffer"?new fw(e):Ch.uint8array?new hw(Ba.transformTo("uint8array",e)):new uw(Ba.transformTo("array",e))}});var Ih=k((AE,Oh)=>{"use strict";var Pl=Rl(),Lt=V(),gw=ba(),kh=ma(),Fa=Ci(),Ha=Al(),mw=nt(),bw=0,yw=3,vw=function(e){for(var t in Ha)if(Object.prototype.hasOwnProperty.call(Ha,t)&&Ha[t].magic===e)return Ha[t];return null};function Lh(e,t){this.options=e,this.loadOptions=t}Lh.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=vw(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+Lt.pretty(this.compressionMethod)+" unknown (inner file : "+Lt.transformTo("string",this.fileName)+")");this.decompressed=new gw(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===bw&&(this.dosPermissions=this.externalFileAttributes&63),e===yw&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Pl(this.extraFields[1].value);this.uncompressedSize===Lt.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Lt.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Lt.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Lt.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,i,n,r;for(this.extraFields||(this.extraFields={});e.index+4<t;)i=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[i]={id:i,length:n,value:r};e.setIndex(t)},handleUTF8:function(){var e=mw.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Fa.utf8decode(this.fileName),this.fileCommentStr=Fa.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var i=Lt.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var r=Lt.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Pl(e.value);return t.readInt(1)!==1||kh(this.fileName)!==t.readInt(4)?null:Fa.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Pl(e.value);return t.readInt(1)!==1||kh(this.fileComment)!==t.readInt(4)?null:Fa.utf8decode(t.readData(e.length-5))}return null}};Oh.exports=Lh});var Ph=k((CE,Rh)=>{"use strict";var xw=Rl(),ct=V(),Me=Cl(),ww=Ih(),_w=nt();function Mh(e){this.files=[],this.loadOptions=e}Mh.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+ct.pretty(t)+", expected "+ct.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4),r=n===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=_w.uint8array?"uint8array":"array",i=ct.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,i,n,r;t<e;)i=this.reader.readInt(2),n=this.reader.readInt(4),r=this.reader.readData(n),this.zip64ExtensibleData[i]={id:i,length:n,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(Me.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(Me.CENTRAL_FILE_HEADER);)e=new ww({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(Me.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,Me.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var i=e;if(this.checkSignature(Me.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===ct.MAX_VALUE_16BITS||this.diskWithCentralDirStart===ct.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===ct.MAX_VALUE_16BITS||this.centralDirRecords===ct.MAX_VALUE_16BITS||this.centralDirSize===ct.MAX_VALUE_32BITS||this.centralDirOffset===ct.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(Me.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(Me.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,Me.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(Me.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(Me.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var r=i-n;if(r>0)this.isSignature(i,Me.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=xw(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};Rh.exports=Mh});var zh=k((TE,Dh)=>{"use strict";var jl=V(),$a=Ei(),Ew=Ci(),Sw=Ph(),Aw=Do(),jh=Sn();function Cw(e){return new $a.Promise(function(t,i){var n=e.decompressed.getContentWorker().pipe(new Aw);n.on("error",function(r){i(r)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}Dh.exports=function(e,t){var i=this;return t=jl.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:Ew.utf8decode}),jh.isNode&&jh.isStream(e)?$a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):jl.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var r=new Sw(t);return r.load(n),r}).then(function(r){var a=[$a.Promise.resolve(r)],s=r.files;if(t.checkCRC32)for(var o=0;o<s.length;o++)a.push(Cw(s[o]));return $a.Promise.all(a)}).then(function(r){for(var a=r.shift(),s=a.files,o=0;o<s.length;o++){var l=s[o],c=l.fileNameStr,d=jl.resolve(l.fileNameStr);i.file(d,l.decompressed,{binary:!0,optimizedBinaryString:!0,date:l.date,dir:l.dir,comment:l.fileCommentStr.length?l.fileCommentStr:null,unixPermissions:l.unixPermissions,dosPermissions:l.dosPermissions,createFolders:t.createFolders}),l.dir||(i.file(d).unsafeOriginalName=c)}return a.zipComment.length&&(i.comment=a.zipComment),i})}});var Bh=k((kE,Nh)=>{"use strict";function Se(){if(!(this instanceof Se))return new Se;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new Se;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}Se.prototype=fh();Se.prototype.loadAsync=zh();Se.support=nt();Se.defaults=Ro();Se.version="3.10.1";Se.loadAsync=function(e,t){return new Se().loadAsync(e,t)};Se.external=Ei();Nh.exports=Se});var Ag={};nn(Ag,{AssetEditorModal:()=>lc});var lc,cc=We(()=>{"use strict";lc=class{constructor(){this.modal=null;this.currentObjectId=null;this.currentPath=null;this.currentAsset="";this.onApplyCallback=null}show(t,i,n,r){this.currentObjectId=t,this.currentPath=i,this.currentAsset=n,this.onApplyCallback=r,this.createModal(t,n),document.body.appendChild(this.modal),this.attachModalListeners()}createModal(t,i){let n=document.createElement("div");n.className="asset-editor-modal",n.innerHTML=`
|
|
1
|
+
"use strict";var Vg=Object.create;var ur=Object.defineProperty;var Kg=Object.getOwnPropertyDescriptor;var Xg=Object.getOwnPropertyNames;var Zg=Object.getPrototypeOf,Jg=Object.prototype.hasOwnProperty;var We=(e,t)=>()=>(e&&(t=e(e=0)),t);var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nn=(e,t)=>{for(var i in t)ur(e,i,{get:t[i],enumerable:!0})},kc=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Xg(t))!Jg.call(e,r)&&r!==i&&ur(e,r,{get:()=>t[r],enumerable:!(n=Kg(t,r))||n.enumerable});return e};var li=(e,t,i)=>(i=e!=null?Vg(Zg(e)):{},kc(t||!e||!e.__esModule?ur(i,"default",{value:e,enumerable:!0}):i,e)),Qg=e=>kc(ur({},"__esModule",{value:!0}),e);var Ye,ws=We(()=>{"use strict";Ye=class{static get(t){var i;return(i=this.store.get(t))==null?void 0:i.data}static set(t,i){this.store.set(t,{data:i})}static has(t){return this.store.has(t)}static clear(){this.store.clear()}};Ye.store=new Map});function om(){var e,t;try{let i=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((t=(e=document.querySelector("script"))==null?void 0:e.textContent)==null?void 0:t.includes("inline-assets.js"))||window.INLINE_ASSETS),n=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(i&&!n)}catch{return!1}}async function lm(){try{if(typeof window!="undefined"){let e=await fetch("./build-settings.json");if(e.ok){let t=await e.json();return console.log("[AssetLoader] Loaded build settings:",t),t}}}catch{}return null}function cm(){try{if(typeof window!="undefined"){let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",t),t}}}catch{}return null}async function dm(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${Y}`),Object.keys(Ve).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Ve)),Ve;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Ve={...window.INLINE_ASSETS},Ve;if(!(Y==="publish"&&De!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Ve;if(!_s){let t=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",t),_s=(async()=>{try{try{let a=await import(t+"?t="+Date.now());if(a.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(a.INLINE_ASSETS)),a.INLINE_ASSETS}catch(a){console.warn("[AssetLoader] ES module import failed, trying text parse:",a)}let i=await fetch(t);if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);let n=await i.text();console.log("[AssetLoader] Received JS code, length:",n.length);let r=n.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(r)try{let a=r[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let s=new Function("return "+a)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(s)),s}catch(a){return console.warn("[AssetLoader] Failed to parse inline assets:",a),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",n.substring(0,500)),{}}catch(i){return console.warn("[AssetLoader] Failed to load inline assets:",i),{}}})()}return Ve=await _s,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Ve)),Ve}function Es(e){return e===null||typeof e!="object"||(Object.freeze(e),Object.values(e).forEach(t=>Es(t))),e}function um(e=64,t=64,i=16711680){let n=document.createElement("canvas");n.width=e,n.height=t;let r=n.getContext("2d");return r.fillStyle=`#${i.toString(16).padStart(6,"0")}`,r.fillRect(0,0,e,t),r.strokeStyle="#000",r.strokeRect(0,0,e,t),r.fillStyle="#fff",r.font="10px sans-serif",r.textAlign="center",r.fillText("MISSING",e/2,t/2),Ke.Texture.from(n)}function Ss(e,t){od.set(e,t)}var Ke,ad,sd,Dt,Y,De,ht,Ve,_s,od,zt,gr=We(()=>{"use strict";Ke=require("pixi.js");ws();ad=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",sd=om(),Dt=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,Y=sd?"publish":ad,De=Dt==null?void 0:Dt.assetsInlined;Dt!=null&&Dt.buildMode&&(Y=Dt.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${Y}`));ht=cm();ht!=null&&ht.buildMode&&(Y=ht.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${Y}`));(ht==null?void 0:ht.assetsInlined)!==void 0&&(De=ht.assetsInlined);lm().then(e=>{e!=null&&e.buildMode&&e.buildMode!==Y&&(Y=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${Y}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(De=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${ad}, Runtime: ${sd?"publish":"dev"}, Effective: ${Y}`);Ve={},_s=null;od=new Map;zt=class{static async load(t,i,n,r){let a=`${t}:${i.path}`,s=Ye.get(a);if(s!==void 0)return s;console.log(`[AssetLoader] Loading asset: ${t}, type: ${i.type}, Effective mode: ${Y}`),console.log(`[AssetLoader] Window defined: ${typeof window!="undefined"}, INLINE_ASSETS exists: ${!!(typeof window!="undefined"&&window.INLINE_ASSETS)}, keys: ${typeof window!="undefined"&&window.INLINE_ASSETS?Object.keys(window.INLINE_ASSETS).length:"N/A"}`);let o=await dm(),l=o[t];if(!l&&r&&(l=o[r],l&&console.log(`[AssetLoader] Found inline data for ${t} using configId: ${r}`)),!l&&i.path){let u=i.path.split("/");if(u.length>=2){let p=u[u.length-1].split(".")[0];o[p]&&(l=o[p],console.log(`[AssetLoader] Found inline data for ${t} using assetName: ${p}`))}}if(console.log("[AssetLoader] Inline data for",t,":",l?"FOUND":"NOT FOUND"),Y==="publish"&&De!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!l))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${t}, path: ${i.path}`);let d=od.get(i.type);if(d)try{let u=await d(i.path,l,t,n);return Ye.set(a,u),u}catch(u){return this.handleFailure(t,i.type,u)}try{let u;switch(i.type){case"image":u=await this.loadImage(i.path,l);break;case"json":u=await this.loadJSON(i.path,l),u=Es(u);break;default:throw new Error(`Unknown asset type: ${i.type}`)}return Ye.set(a,u),u}catch(u){return this.handleFailure(t,i.type,u)}}static async loadImage(t,i){let n=Y==="publish",r=n&&De!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${Y}, isPublishMode: ${n}, inlineData: ${i?"EXISTS":"MISSING"}`),r){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!i)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${t}`);if(typeof i!="string"||!i.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI string, got: ${typeof i}`);try{return await Ke.Assets.load(i)}catch(a){throw console.error("[AssetLoader] Failed to load texture from data URI:",a),a}}if(i&&typeof i=="string"&&i.startsWith("data:"))try{return await Ke.Assets.load(i)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await Ke.Assets.load(t)}return await Ke.Assets.load(t)}static async loadJSON(t,i){let n=Y==="publish",r=n&&De!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${Y}, isPublishMode: ${n}, inlineData: ${i?"EXISTS":"MISSING"}`),r){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!i)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(typeof i=="object"&&i!==null)return i;if(typeof i=="string"&&i.startsWith("data:")){let s=atob(i.split(",")[1]);return JSON.parse(s)}return JSON.parse(i)}if(i){if(typeof i=="object"&&i!==null)return i;if(typeof i=="string"&&i.startsWith("data:")){let s=atob(i.split(",")[1]);return JSON.parse(s)}return JSON.parse(i)}let a=await fetch(t);if(!a.ok)throw new Error(`JSON fetch failed: ${t}`);return a.json()}static handleFailure(t,i,n){if(Y==="dev"){let a=i==="image"?um():Es({__placeholder:!0,type:i});return Ye.set(t+":"+((n==null?void 0:n.path)||"missing"),a),a}throw n}};Ss("image",async(e,t)=>{let i=Y==="publish",n=i&&De!==!1,r=Y==="brand",a=i&&De===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${Y}, isPublishMode: ${i}, isBrandMode: ${r}, inlineData: ${t?"EXISTS":"MISSING"}`),n){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(typeof t!="string"||!t.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI string, got: ${typeof t}`);return Ke.Assets.load(t)}let s=e;return(r||a)&&e&&!e.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(s=e,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${e}" as-is`)):(s=`assets/${e}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${e}" -> "${s}"`))),Ke.Assets.load(t||s)});Ss("json",async(e,t)=>{let i=Y==="publish",n=i&&De!==!1,r=Y==="brand",a=i&&De===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${Y}, isPublishMode: ${i}, isBrandMode: ${r}, inlineData: ${t?"EXISTS":"MISSING"}`),n){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);return typeof t=="object"&&t!==null?t:typeof t=="string"&&t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t)}let s=e;if((r||a)&&e&&!e.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(s=e,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${e}" as-is`)):(s=`assets/${e}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${e}" -> "${s}"`))),t)return typeof t=="object"&&t!==null?t:typeof t=="string"&&t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t);let o=await fetch(s);if(!o.ok)throw new Error(`JSON fetch failed: ${e}`);return o.json()})});var cd={};nn(cd,{AssetTextures:()=>ze,initAssetTextures:()=>Ts});function Ts(e,t){ld.init(e,t),typeof window!="undefined"&&(window.__AssetTextures=ze)}var Cs,ld,ze,pi=We(()=>{"use strict";gr();Cs=class{constructor(){this.textures=new Map;this.readyPromise=null;this.priorityReadyPromise=null;this.priorityReadyResolve=null;this.config=null;this.app=null;this.attempted=new Set;this.waiters=new Set}init(t,i){if(this.config===t&&this.app===i&&this.priorityReadyPromise){console.log("[AssetTextures] init called with same config/app; keeping existing state");return}this.textures.clear(),this.readyPromise=null,this.priorityReadyPromise=null,this.priorityReadyResolve=null,this.attempted.clear(),this.waiters.clear(),this.priorityReadyPromise=new Promise(n=>{this.priorityReadyResolve=n}),this.config=t,this.app=i,console.log("[AssetTextures] Initialized with config, cleared previous textures")}async ready(){if(this.readyPromise){await this.readyPromise;return}if(!this.config)throw new Error("[AssetTextures] Must call init() before ready() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before ready() - app is null");let t=this.config,i=this.app;return this.readyPromise=(async()=>{var s;console.log("[AssetTextures] Loading all assets...");let n=new Set(["background_loading_1"]),r=[],a=[];for(let[o,l]of t.objects.entries()){let c=(s=l.render)==null?void 0:s.asset;if(!c)continue;let d=async()=>{var u;try{let p=(u=l.identity)==null?void 0:u.id;console.log(`[AssetTextures] Loading ${c.type}: ${o} (${p})`);let f=await zt.load(o,c,i,p);this.textures.set(o,f),console.log(`[AssetTextures] \u2713 Loaded: ${o}`)}catch(p){console.error(`[AssetTextures] \u2717 Failed to load: ${o}`,p)}finally{this.attempted.add(o);try{for(let p of Array.from(this.waiters))p()}catch{}}};n.has(o)?r.push(d()):a.push(d())}r.length>0&&(console.log("[AssetTextures] Phase 1: Loading priority assets (loading screen)..."),await Promise.all(r),console.log("[AssetTextures] Phase 1: Priority assets ready")),this.priorityReadyResolve&&this.priorityReadyResolve(),console.log("[AssetTextures] Phase 2: Loading remaining assets..."),await Promise.all(a),console.log("[AssetTextures] All textures loaded:",Array.from(this.textures.keys()))})(),this.readyPromise}async priorityReady(){return this.priorityReadyPromise?this.priorityReadyPromise:Promise.resolve()}async waitFor(t,i={}){if(!this.config)throw new Error("[AssetTextures] Must call init() before waitFor() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before waitFor() - app is null");let r=Array.from(new Set((t||[]).filter(o=>typeof o=="string"&&o))).filter(o=>{var l,c,d,u;try{let p=(d=(c=(l=this.config)==null?void 0:l.objects)==null?void 0:c.get)==null?void 0:d.call(c,o);return!!((u=p==null?void 0:p.render)!=null&&u.asset)}catch{return!1}});if(r.length===0)return;this.ready().catch(()=>{});let a=()=>r.every(o=>this.textures.has(o)||this.attempted.has(o));if(a())return;let s=typeof i.timeoutMs=="number"?i.timeoutMs:15e3;await new Promise(o=>{let l=!1,c=()=>{l||a()&&(l=!0,this.waiters.delete(c),o())};this.waiters.add(c),c(),s>0&&setTimeout(()=>{l||(l=!0,this.waiters.delete(c),console.warn("[AssetTextures] waitFor timed out; continuing",{ids:r}),o())},s)})}get(t){return this.textures.get(t)}set(t,i){this.textures.set(t,i),console.log(`[AssetTextures] Updated texture: ${t}`)}clear(){this.textures.clear(),this.readyPromise=null,console.log("[AssetTextures] Cleared all textures")}getAllIds(){return Array.from(this.textures.keys())}},ld=new Cs,ze=new Proxy(ld,{get(e,t){return t in e&&typeof e[t]=="function"?e[t].bind(e):e.get(t)},set(e,t,i){return e.set(t,i),!0}})});var Or={};nn(Or,{applyConfigOverride:()=>mt,applyConfigOverrides:()=>bt,applyConfigsToDisk:()=>kr,clearConfigOverrides:()=>un,clearConfigOverridesForObject:()=>wd,configOverrideManager:()=>_d,deepClone:()=>ne,exportConfigsAsJSON:()=>Ms,getConfigOverrides:()=>de,getConfigStateSummary:()=>Tr,getOverrideMode:()=>dn,removeConfigOverride:()=>Cr,resetToApplied:()=>pn,resetToOriginal:()=>Lr,setOverrideMode:()=>Is});function Sr(){return typeof window=="undefined"?null:window.__editableConfig||null}function md(){return typeof window=="undefined"?null:window.__editableConfigBaseline||null}function hd(e,t){var i,n;if(!e)return null;try{if(e instanceof Map)return(i=e.get(t))!=null?i:null;if(typeof e=="object")return(n=e[t])!=null?n:null}catch{}return null}function Dm(e,t,i){if(e){if(e instanceof Map){e.set(t,i);return}typeof e=="object"&&(e[t]=i)}}function bd(e,t){for(let i of t)cn(e,i.path,i.value)}function yd(e){var o;if(typeof window=="undefined")return;let t=Sr();if(!t)return;let i=md(),n=(o=i?hd(i.objects,e):null)!=null?o:hd(t.objects,e);if(!n)return;let r=ne(n),a=de().filter(l=>l.objectId===e);try{bd(r,a)}catch(l){console.error("[CONFIG] Failed to reapply overrides for object",e,l);return}Dm(t.objects,e,r);let s=window.applyEditableObjectConfig;if(typeof s=="function")try{s(e,r)}catch{}}function zm(){var r;if(typeof window=="undefined")return;let e=Sr();if(!(e!=null&&e.engine))return;let t=md(),i=ne(((r=t==null?void 0:t.engine)!=null?r:e.engine)||{}),n=de().filter(a=>!a.objectId&&!a.sceneId);try{bd(i,n)}catch(a){console.error("[CONFIG] Failed to reapply engine overrides",a);return}try{let a=e.engine;for(let s of Object.keys(a))s in i||delete a[s];for(let[s,o]of Object.entries(i))a[s]=o}catch{e.engine=i}}function Nm(){if(typeof window=="undefined")return"unknown";let e=window;return typeof e.__HANDLER_PROJECT_ID=="string"?e.__HANDLER_PROJECT_ID:"handler-default"}function vd(){return`handler_preview_config_overrides::${Nm()}`}function Bm(){if(typeof window=="undefined")return[];try{let e=window.localStorage.getItem(vd());if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Ar(e){if(typeof window!="undefined")try{window.localStorage.setItem(vd(),JSON.stringify(e))}catch{}}function dn(){return typeof window=="undefined"?!1:window.__enableConfigOverrides===!0}function Is(e){if(typeof window!="undefined"){window.__enableConfigOverrides=e;try{window.localStorage.setItem(xd,e?"true":"false")}catch{}}}function mt(e,t={}){var p,f;let{objectId:i,path:n,value:r}=e,{silent:a=!1,persist:s=!0,emitEvent:o=!0}=t,l=Sr();if(!l){console.warn("[CONFIG] applyConfigOverride: No editable config found in window.__editableConfig");return}let c=i?(f=(p=l.objects)==null?void 0:p.get)==null?void 0:f.call(p,i):l.engine;if(!c){console.warn("[CONFIG] applyConfigOverride: Override target not found:",{objectId:i,path:n,hasObjects:!!l.objects});return}a||console.log("[CONFIG] applyConfigOverride: Target found, applying...",{objectId:i,path:n,value:r});let d;try{d=Hm(c,n),cn(c,n,r)}catch(m){console.error("[CONFIG] applyConfigOverride failed:",{objectId:i,path:n,value:r},m);return}window.__configChanges=window.__configChanges||[];let u=window.__configChanges;if(u.push({objectId:i,path:n,oldValue:d,newValue:r,ts:Date.now()}),u.length>Fm&&u.shift(),s){let m=de(),h=m.findIndex(g=>g.objectId===i&&g.sceneId===e.sceneId&&g.path===n);h>=0?m[h].value=r:m.push(e),window.__configOverrides=m,Ar(m),dn()||Is(!0)}a||console.log("[CONFIG] Applied override:",e),o&&typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("config:changed",{detail:e}))}function bt(e,t={}){let i=t.emitEvent!==!1,n=[];for(let r of e)r!=null&&r.objectId&&typeof r.objectId=="string"&&n.push(r.objectId),mt(r,{...t,emitEvent:!1});if(i&&typeof window!="undefined"){let r=Array.from(new Set(n));window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"batch",objectIds:r,count:e.length}}))}}function un(){window.__configOverrides=[],window.__configChanges=[],Ar([]),console.log("[CONFIG] Cleared all overrides")}function wd(e){let t=de().filter(n=>n.objectId!==e);window.__configOverrides=t,Ar(t);let i=window.__configChanges||[];window.__configChanges=i.filter(n=>n.objectId!==e),yd(e),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"clear_object",objectId:e}}))}function Cr(e,t){let i=de().filter(r=>r.objectId!==e||r.path!==t);window.__configOverrides=i,Ar(i);let n=window.__configChanges||[];window.__configChanges=n.filter(r=>r.objectId!==e||r.path!==t),e?yd(e):zm(),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"remove",objectId:e,path:t}}))}function de(){return typeof window=="undefined"?[]:(window.__configOverrides||(window.__configOverrides=Bm()),window.__configOverrides||[])}function cn(e,t,i){var s;let n=t.split("."),r=n.pop(),a=e;for(let o of n){if(a[o]!==void 0&&typeof a[o]!="object")throw new Error(`Invalid override path: ${t} (hit primitive at ${o})`);a[o]=(s=a[o])!=null?s:{},a=a[o]}a[r]=i}function Hm(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function ne(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Set)return new Set([...e].map(i=>ne(i)));if(ArrayBuffer.isView(e))return e.slice();if(e instanceof Array)return e.map(i=>ne(i));if(e instanceof Map){let i=new Map;return e.forEach((n,r)=>i.set(r,ne(n))),i}let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=ne(e[i]));return t}function Ms(){let e=window.__editableConfigBaseline;if(!e){let t=window.__editableConfig;if(!t)throw new Error("Cannot export: no config loaded");return gd(t)}return gd(e)}function gd(e){let t={objects:{},scenes:{},engine:ne(e.engine||{})},i=e.objects;if(i instanceof Map)i.forEach((a,s)=>{t.objects[s]=ne(a)});else if(i&&typeof i=="object")for(let a in i)t.objects[a]=ne(i[a]);let n=e.scenes;if(n instanceof Map)n.forEach((a,s)=>{t.scenes[s]=ne(a)});else if(n&&typeof n=="object")for(let a in n)t.scenes[a]=ne(n[a]);let r=de();for(let a of r)a.objectId?(t.objects[a.objectId]||(t.objects[a.objectId]={}),cn(t.objects[a.objectId],a.path,a.value)):a.sceneId?(t.scenes[a.sceneId]||(t.scenes[a.sceneId]={}),cn(t.scenes[a.sceneId],a.path,a.value)):cn(t.engine,a.path,a.value);return t}function Tr(){let e=de(),t=new Set;for(let i of e)i.objectId?t.add(i.objectId):t.add("__engine__");return{modifiedObjects:Array.from(t),overrideCount:e.length,hasChanges:e.length>0,overrides:e}}async function kr(e){let t=Ms(),i={};for(let[r,a]of Object.entries(t.objects)){let s=a,o=r;/^(json\.|ui\.|effects\.|engine\.)/.test(o)||(o=`json.${r}`),s&&typeof s=="object"&&(s.identity||(s.identity={}),s.identity.id=o),i[`objects/${o}.json`]=s}t.engine&&(t.engine.runtime&&(i["engine/engine.runtime.json"]=t.engine.runtime),t.engine.assets&&(i["engine/engine.assets.json"]=t.engine.assets),t.engine.splash&&(i["engine/engine.splash.json"]=t.engine.splash),t.engine.loading&&(i["engine/engine.loading.json"]=t.engine.loading),t.engine.start&&(i["engine/engine.start.json"]=t.engine.start),t.engine.tutorial&&(i["engine/engine.tutorial.json"]=t.engine.tutorial),t.engine.endgame&&(i["engine/engine.endgame.json"]=t.engine.endgame),!t.engine.runtime&&!t.engine.assets&&(i["engine/engine.json"]=t.engine));for(let[r,a]of Object.entries(t.scenes)){let s=r.startsWith("scene.")?r:`scene.${r}`;i[`scenes/${s}.json`]=a}let n=await fetch("/api/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:i,assets:{},hadCacheAtApply:de().length>0,versionName:e})});if(!n.ok){let r=await n.json();throw new Error(`Apply failed: ${r.error||"Unknown error"}`)}un();try{let r=Sr();r&&(window.__editableConfigBaseline=ne(r))}catch{}localStorage.setItem("handler_last_applied",Date.now().toString()),console.log("[Config Persistence] \u2705 Applied to disk successfully")}function pn(){un(),window.location.reload()}async function Lr(){if(!confirm("This will restore all configs to their original state. All uncommitted changes in cache AND applied changes will be lost. Continue?"))return;let t=await fetch("/api/reset-to-original",{method:"POST"});if(!t.ok){let i=await t.json();throw new Error(`Reset failed: ${i.error||"Unknown error"}`)}un(),window.location.reload()}var xd,Fm,_d,Te=We(()=>{"use strict";xd="handler_preview_override_mode";if(typeof window!="undefined"){let e=window.localStorage.getItem(xd);window.__enableConfigOverrides=e===null?!0:e==="true"}Fm=500;_d={getCurrentConfig(){return window.__editableConfig||null},getChanges(){return window.__configChanges||[]},clearChanges(){window.__configChanges=[]}}});function $m(e,t){try{if(typeof e=="object"&&e!==null)return e;if(typeof e!="string")return null;if(e.startsWith("data:")){let n=e.indexOf(",");if(n===-1)return null;let r=e.slice(0,n);if(!r.includes("application/json")&&!r.includes("text/plain"))return null;let a=e.slice(n+1),s=r.includes("base64")?typeof atob=="function"?atob(a):a:decodeURIComponent(a);return JSON.parse(s)}let i=e.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(e):null}catch{return null}}function Um(e){if(typeof window=="undefined"||!window.INLINE_ASSETS)return null;let t=window.INLINE_ASSETS,i=e.replace(/^\.\/+/,""),n=i.split("/").pop()||i,r=[i,n,i.replace(/\.json$/,""),n.replace(/\.json$/,"")];for(let a of r){let s=t[a];if(s){let o=$m(s,a);if(o!==null)return o}}return null}async function fn(e){if(Rs.has(e)&&!Ps)return console.log(`[CONFIG] Using cached config for: "${e}"`),Rs.get(e);if(console.log(`[CONFIG] loadConfigFile called with: "${e}", MODE: ${G.toUpperCase()}, CACHE: ${Ps?"DISABLED":"ENABLED"}`),G==="publish"){let n=Um(e);return n?(console.log(`[CONFIG] \u2713 Loaded ${e} via INLINE_ASSETS`),n):(console.log(`[CONFIG] \u2139\uFE0F Optional config ${e} not in INLINE_ASSETS, skipping fetch in publish mode`),{})}G==="brand"||console.log(`[CONFIG] DEV MODE: Trying nested paths first, then flattened for "${e}"`);let t;G==="brand"?t=[`./${e.split("/").pop()||e}`,`./${e}`,`./${e.replace(/^configs\//,"")}`,`./${e.replace(/^configs\//,"").replace(/\//g,".")}`]:t=[`./${e}`,`./${e.replace(/^configs\//,"")}`,`./${e.replace(/^configs\//,"").replace(/\//g,".")}`],t=Array.from(new Set(t.flatMap(n=>n.startsWith("./")?[n,`/${n.slice(2)}`]:n.startsWith("/")?[n]:[n,`/${n}`]))),console.log("[CONFIG] Will try candidates:",t);let i=(async()=>{let n=Ps?"no-store":"force-cache";for(let r of t)try{let a=await fetch(r,{cache:n});if(!a.ok)continue;let s=await a.json();return console.log(`[CONFIG] \u2713 Loaded ${e} via ${r}`,s),s}catch(a){console.warn(`[CONFIG] \u2717 Failed to load ${r} (mode: ${G}):`,a)}return console.warn(`[CONFIG] \u2717 All attempts failed for ${e}; using defaults`),{}})();return Rs.set(e,i),i}async function Ir(){console.log("[CONFIG] Loading component schemas...");let e=["components/identity.schema.json","components/transform.schema.json","components/render.schema.json","components/motion.schema.json","components/effects.schema.json","components/interaction.schema.json","components/gameplay.rules.schema.json","components/gameplay.tuning.schema.json","components/visibility.schema.json","components/audio.schema.json","components/physics.schema.json","components/ui.schema.json"],t=new Map;for(let i of e)try{let n=G==="publish"||G==="brand"?i.split("/").pop()||i:`configs/${i}`,r=await fn(n);r.component&&(t.set(r.component,r),console.log(`[CONFIG] \u2713 Schema loaded: ${r.component} ${G==="publish"||G==="brand"?"(flattened)":"(nested)"}`))}catch(n){console.warn(`[CONFIG] \u2717 Failed to load schema ${i}:`,n)}return console.log(`[CONFIG] Loaded ${t.size} component schemas`),t}async function yt(e){console.log(`[CONFIG] Loading object config: ${e}`);let t=G==="publish"||G==="brand"?`${e}.json`:`configs/objects/${e}.json`;return await fn(t)}async function Mr(e){let t=new Map;if(e.objects&&Array.isArray(e.objects)){for(let i of e.objects)if(i.enabled&&i.object_config)try{let n=i.instance_id;/^(json\.|ui\.|effects\.|engine\.)/.test(n)||(n=`json.${n}`);let r=await yt(n);(!r||Object.keys(r).length===0)&&n!==i.instance_id&&(r=await yt(i.instance_id)),!r||Object.keys(r).length===0?(console.log(`[CONFIG] No instance snapshot for ${i.instance_id}, using template ${i.object_config}`),r=await yt(i.object_config)):console.log(`[CONFIG] \u2713 Loaded instance snapshot for ${i.instance_id}`),t.set(i.instance_id,{...r,instance_id:i.instance_id,object_config:i.object_config})}catch(n){console.warn(`Failed to load object ${i.object_config}:`,n)}}return t}async function Rr(){console.log("[CONFIG] Loading engine configs...");let e=["runtime","assets","splash","loading","start","tutorial","endgame"],t=await Promise.all(e.map(n=>{let r=`engine.${n}.json`,a=G==="publish"||G==="brand"?r:`configs/engine/${r}`;return fn(a)})),i=Object.fromEntries(e.map((n,r)=>[n,t[r]]));return console.log("[CONFIG] Engine configs loaded:",Object.fromEntries(e.map(n=>{var s;let r=(s=i[n])!=null?s:{},a=Object.keys(r);return[n,a.length>0?a:"empty"]}))),i}async function js(){return await fn(G==="publish"||G==="brand"?"game.prompt.json":"configs/engine/game.prompt.json")}async function Pr(e="scene.main"){console.log(`[CONFIG] Loading scene config: ${e}`);let t=G==="publish"||G==="brand"?`${e}.json`:`configs/scenes/${e}.json`;return await fn(t)}function fi(e,t){let i=[];if(!e.identity)return i.push("Missing required identity component"),{valid:!1,errors:i};let n=t.get("identity");if(n)for(let r of n.required||[])e.identity[r]||i.push(`Missing required identity field: ${r}`);for(let[r,a]of Object.entries(e)){if(r==="identity")continue;let s=t.get(r);if(s&&a&&typeof a=="object"){let o=a;for(let l of s.required||[])o[l]===void 0&&i.push(`Missing required field in ${r}: ${l}`);if(s.constraints&&typeof s.constraints=="object")for(let[l,c]of Object.entries(s.constraints)){let d=o[l];if(d!==void 0&&c&&typeof c=="object"){let u=c;typeof d=="number"&&(u.min!==void 0&&d<u.min&&i.push(`${r}.${l} value ${d} is below minimum ${u.min}`),u.max!==void 0&&d>u.max&&i.push(`${r}.${l} value ${d} is above maximum ${u.max}`))}}}}return{valid:i.length===0,errors:i}}function Bt(e,t){let i={...e},n=["identity","transform","render"];for(let[r,a]of t.entries())a.defaults&&Object.keys(a.defaults).length>0&&(n.includes(r)||i[r])&&(i[r]||(i[r]={}),i[r]={...a.defaults,...i[r]});return i}function xe(e,t,i,n){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(Math.max(e,i),n)}function Sd(e,t){if(Array.isArray(e))return{x:xe(e[0],t.x,-2e3,2e3),y:xe(e[1],t.y,-2e3,2e3)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:xe(i,t.x,-2e3,2e3),y:xe(n,t.y,-2e3,2e3)}}function qm(e,t){if(Array.isArray(e))return{x:xe(e[0],t.x,0,1),y:xe(e[1],t.y,0,1)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:xe(i,t.x,0,1),y:xe(n,t.y,0,1)}}function Gm(e){if(Array.isArray(e))return{x:xe(e[0],.5,-10,10),y:xe(e[1],.5,-10,10)};if(e&&typeof e=="object"){let{x:t,y:i}=e;return{x:xe(t,.5,-10,10),y:xe(i,.5,-10,10)}}return typeof e=="string"?e:null}async function Qe(e="scene.main",t){var l,c,d,u,p,f,m,h,g,b,y,v,x,w;console.log("[CONFIG] ===== Starting Object-Centric Config Load =====");let i=await Ir(),n=de();n.length>0&&console.log(`[CONFIG] Applying ${n.length} active overrides`);let r=await Pr(e);console.log(`[CONFIG] Scene config loaded: ${((l=r.objects)==null?void 0:l.length)||0} objects`);let a=await Rr();console.log("[CONFIG] Loading object configs...");let s=await Mr(r);console.log(`[CONFIG] Loaded ${s.size} object configs:`,Array.from(s.keys()));for(let[E,A]of s.entries()){let _=Bt(A,i),T=fi(_,i);T.valid||console.warn(`Object ${E} validation errors:`,T.errors),(c=_.transform)!=null&&c.position&&(_.transform.position=Sd(_.transform.position,{x:0,y:0})),(d=_.transform)!=null&&d.offset&&(_.transform.offset=Sd(_.transform.offset,{x:0,y:0})),((u=_.transform)==null?void 0:u.anchor)!==void 0&&(_.transform.anchor=Gm(_.transform.anchor)),((p=_.transform)==null?void 0:p.position_ratio)!==void 0&&_.transform.position_ratio!==null&&(_.transform.position_ratio=qm(_.transform.position_ratio,{x:.5,y:.5})),s.set(E,_)}if(t){if(t.objects)for(let[E,A]of t.objects.entries())s.set(E,A);t.engine&&(a.runtime={...a.runtime,...t.engine.runtime},a.assets={...a.assets,...t.engine.assets},a.splash={...(f=a.splash)!=null?f:{},...(m=t.engine.splash)!=null?m:{}})}let o={objects:s,engine:a,scene:r,schemas:i,theme:{background_color:"#ffffff",text_color:"#000000",square_color:"#cccccc",cta_background:"#007bff",cta_text:"#ffffff"},gameplay:{}};return typeof window!="undefined"&&(window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=Bt(o,i))),n.length>0&&dn()&&bt(n,{silent:!0,persist:!1}),console.log("[CONFIG] ===== Object-Centric Config Load Complete ====="),console.log("[CONFIG] Summary:",{schemas:Array.from(i.keys()),objects:Array.from(s.keys()),engine:{runtime:Object.keys((h=a.runtime)!=null?h:{}),assets:Object.keys((g=a.assets)!=null?g:{}),splash:Object.keys((b=a.splash)!=null?b:{}),loading:Object.keys((y=a.loading)!=null?y:{}),start:Object.keys((v=a.start)!=null?v:{}),tutorial:Object.keys((x=a.tutorial)!=null?x:{}),endgame:Object.keys((w=a.endgame)!=null?w:{})},scene:r.scene_id||"unknown"}),o}function Ds(e){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,E,A,_,T,M,S,L,z,D,B,O,P,C;let t={gameplay:{},ui:{},theme:{},assets:{}};for(let[I,j]of e.objects.entries()){let Q=((i=j.identity)==null?void 0:i.id)||I;Q.includes("character")&&(t.gameplay.character_pos=((n=j.transform)==null?void 0:n.position)||{x:0,y:0},t.gameplay.character_scale=((r=j.transform)==null?void 0:r.scale)||1,t.gameplay.character_anim_speed=((s=(a=j.gameplay)==null?void 0:a.tuning)==null?void 0:s.anim_speed)||.003,t.gameplay.character_relief_scale=((l=(o=j.gameplay)==null?void 0:o.tuning)==null?void 0:l.relief_scale)||1.22,t.gameplay.character_relief_speed=((d=(c=j.gameplay)==null?void 0:c.tuning)==null?void 0:d.relief_speed)||.22),(Q.includes("gun")||Q.includes("flame"))&&(t.gameplay.gun=j.gun||{},t.gameplay.gunmuzzle=((u=j.effects)==null?void 0:u.gunmuzzle)||{},t.gameplay.muzzle_levels=((p=j.effects)==null?void 0:p.muzzle_levels)||{},t.gameplay.flame=((f=j.effects)==null?void 0:f.flame)||{}),Q.includes("diamond")&&(t.gameplay.diamond=j),Q.includes("ice")&&(t.gameplay.melt=j.melt||{},t.gameplay.melt_anchor=((m=j.transform)==null?void 0:m.melt_anchor)||{x:0,y:0},t.gameplay.melt_pos=((h=j.transform)==null?void 0:h.position)||{x:0,y:0},t.gameplay.hybrid_melting=((g=j.effects)==null?void 0:g.hybrid_melting)||{},t.gameplay.physics_chunks=((b=j.effects)==null?void 0:b.physics_chunks)||{},t.gameplay.melting_particles=((y=j.effects)==null?void 0:y.melting_particles)||{},t.gameplay.hard_ice=j.hard_ice||{}),Q.includes("water")&&(t.gameplay.water_drops=j),Q.includes("crack")&&(t.gameplay.crack=j),Q.includes("hand")&&(t.gameplay.hand=((v=j.gameplay)==null?void 0:v.tuning)||{},t.gameplay.brush_start_pos=((x=j.transform)==null?void 0:x.brush_start_pos)||{x:0,y:-120},t.gameplay.hand_scale=((w=j.transform)==null?void 0:w.scale)||1.5),Q.includes("hazard")&&(t.gameplay.hazard=((E=j.gameplay)==null?void 0:E.tuning)||{},t.gameplay.danger_pos=((A=j.transform)==null?void 0:A.danger_pos)||{x:0,y:235},t.gameplay.danger_pulse=((T=(_=j.gameplay)==null?void 0:_.tuning)==null?void 0:T.danger_pulse)||{},t.gameplay.hazard_height=((S=(M=j.gameplay)==null?void 0:M.tuning)==null?void 0:S.hazard_height)||140)}return t.gameplay.timeline=((L=e.engine.runtime)==null?void 0:L.timeline)||{},t.gameplay.drag_surface=((z=e.engine.runtime)==null?void 0:z.drag_surface)||{},t.gameplay.background=((D=e.engine.runtime)==null?void 0:D.background)||{},t.gameplay.ui_styles=((B=e.engine.runtime)==null?void 0:B.ui_styles)||{},t.gameplay.label_pulse=((O=e.engine.runtime)==null?void 0:O.label_pulse)||{},t.ui=((P=e.engine.runtime)==null?void 0:P.ui)||{},t.theme=((C=e.engine.runtime)==null?void 0:C.theme)||{},t.assets=e.engine.assets||{},t}var Ed,G,Rs,Ps,zs=We(()=>{"use strict";Te();Ed=null,G="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)Ed=e,G=e.buildMode,console.log("[CONFIG] Loaded inline build settings:",e,"buildMode:",G);else try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let i=JSON.parse(t.responseText);Ed=i,G=i.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",i,"buildMode:",G)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",G)}catch(t){console.log("[CONFIG] Failed to load build-settings.json:",t instanceof Error?t.message:String(t))}}console.log("[CONFIG] Final buildMode:",G);Rs=new Map,Ps=G==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});function Ns(e,t){let i=[];function n(r,a,s=""){if(r!==a){if(typeof r!=typeof a){i.push(`${s}: type changed`);return}if(typeof r=="object"&&r!==null&&a!==null){let o=new Set([...Object.keys(r),...Object.keys(a)]);for(let l of o){let c=s?`${s}.${l}`:l;l in r?l in a?n(r[l],a[l],c):i.push(`${c}: removed`):i.push(`${c}: added`)}}else i.push(`${s}: changed`)}}return n(e,t),i}function Bs(e,t,i,n){let r={...i};for(let[a,s]of n.entries())r[a]&&s.defaults&&(r[a]={...s.defaults,...r[a]});return r}var hn,Ft,Fs=We(()=>{"use strict";hn=class{shouldFullReload(t){return t.type==="component"||t.type==="scene"}getAffectedObjects(t){return t.type==="object"&&t.objectId?[t.objectId]:[]}},Ft=class{constructor(t=1e3){this.pollingInterval=null;this.fileHashes=new Map;this.callbacks=new Map;this.intervalMs=t}watch(t,i){this.callbacks.set(t,i),this.pollingInterval===null&&(this.pollingInterval=window.setInterval(()=>{this.checkAllFiles()},this.intervalMs))}async checkAllFiles(){for(let[t,i]of this.callbacks.entries())try{let n=`${t}?t=${Date.now()}&r=${Math.random()}`,r=await fetch(n,{cache:"no-cache",headers:{"Cache-Control":"no-cache"}});if(r.ok){let a=await r.text(),s=this.hashString(a),o=this.fileHashes.get(t);if(o&&o!==s&&console.log(`[HOT-RELOAD] File changed: ${t}`),o&&o!==s){console.log(`[HOT-RELOAD] File changed: ${t}`);let l=this.determineEventType(t);i(l),this.fileHashes.set(t,s)}else o||this.fileHashes.set(t,s)}}catch(n){console.warn(`Failed to check ${t}:`,n)}}determineEventType(t){var i,n;return t.includes("/components/")?{type:"component",path:t,componentName:(i=t.split("/").pop())==null?void 0:i.replace(".schema.json","")}:t.includes("/engine/")?{type:"engine",path:t}:t.includes("/scenes/")?{type:"scene",path:t}:t.includes("/objects/")?{type:"object",path:t,objectId:(n=t.split("/").pop())==null?void 0:n.replace(".json","")}:{type:"object",path:t}}hashString(t){let i=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);i=(i<<5)-i+r,i=i&i}return i.toString()}unwatch(t){this.callbacks.delete(t),this.fileHashes.delete(t)}stop(){this.pollingInterval!==null&&(clearInterval(this.pollingInterval),this.pollingInterval=null),this.callbacks.clear(),this.fileHashes.clear()}}});function $s(e){if(typeof window=="undefined")return;let t=typeof Hs!="undefined"&&!!Hs.hot,i=window.location.search.includes("hot-reload");if(!(t||i))return;let r=null,a=!1,s=null;if(i){s=new Ft;let m=window.__configWatcher;m!=null&&m.stop&&m.stop(),window.__configWatcher=s}let o=new Set,l=m=>{var b,y;if(!s)return;let h=new Set;h.add("configs/engine/engine.runtime.json"),h.add("configs/engine/engine.assets.json"),h.add("configs/engine/engine.splash.json"),h.add("configs/scenes/scene.main.json");let g=(y=(b=m.scene)==null?void 0:b.objects)!=null?y:[];for(let v of g)v!=null&&v.object_config&&h.add(`configs/objects/${v.object_config}.json`);for(let v of o)h.has(v)||s.unwatch(v);for(let v of h)o.has(v)||s.watch(v,x=>f(x));o=h},c=new Set,d=!1,u=async m=>{let h=await yt(m),g=Bt(h,e.activeConfig.schemas),b=fi(g,e.activeConfig.schemas);b.valid||console.warn(`[HOT-RELOAD] ${m} validation errors:`,b.errors),await e.liveEditBridge.applyObjectConfig(m,g)};async function p(m){if(!a){a=!0;try{if(d||c.size===0){e.audioSystem.destroy();let h=await Qe("scene.main");e.setActiveConfig(h),e.gameObjectManager.updateConfig(h),e.CustomAssets.updateConfig(h),await e.CustomAssets.ready();let g=e.createAudioSystem(h);e.setAudioSystem(g),window.__audioSystem=g,await g.start(),e.liveEditBridge.rebuildIndexes(),l(h),console.log(`[GAME] Hot-reload complete (${m})`)}else{let h=Array.from(c);c.clear();for(let g of h)await u(g);console.log(`[GAME] Hot-reload updated objects: ${h.join(", ")}`)}}catch(h){console.warn("[GAME] Hot-reload failed:",h)}finally{a=!1,d=!1,c.clear()}}}function f(m){m.type==="object"&&m.objectId?c.add(m.objectId):d=!0,r&&window.clearTimeout(r),r=window.setTimeout(()=>{p(m.type)},120)}t&&Hs.hot.on("config-change",()=>{f({type:"hmr"})}),i&&(l(e.activeConfig),console.log(`[GAME] Hot-reload watcher enabled (${o.size} files)`))}var Hs,Ad=We(()=>{"use strict";Fs();zs();Hs={}});var Cd={};nn(Cd,{ConfigWatcher:()=>Ft,DefaultReloadStrategy:()=>hn,applyDefaults:()=>Bt,diffConfigs:()=>Ns,loadAllObjectConfigs:()=>Mr,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Rr,loadGamePromptConfig:()=>js,loadObjectCentricConfig:()=>Qe,loadObjectConfig:()=>yt,loadSceneConfig:()=>Pr,rehydrateObject:()=>Bs,setupHotReload:()=>$s,toLegacyFormat:()=>Ds,validateObjectConfig:()=>fi});var jr=We(()=>{"use strict";zs();Fs();Ad()});var gn=k((h1,Ws)=>{"use strict";typeof process=="undefined"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Ws.exports={nextTick:Vm}:Ws.exports=process;function Vm(e,t,i,n){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,a,s;switch(r){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,i)});case 4:return process.nextTick(function(){e.call(null,t,i,n)});default:for(a=new Array(r-1),s=0;s<a.length;)a[s++]=arguments[s];return process.nextTick(function(){e.apply(null,a)})}}});var kd=k((g1,Td)=>{"use strict";var Km={}.toString;Td.exports=Array.isArray||function(e){return Km.call(e)=="[object Array]"}});var Ys=k((m1,Ld)=>{"use strict";Ld.exports=require("stream")});var mn=k((Vs,Id)=>{"use strict";var Jr=require("buffer"),et=Jr.Buffer;function Od(e,t){for(var i in e)t[i]=e[i]}et.from&&et.alloc&&et.allocUnsafe&&et.allocUnsafeSlow?Id.exports=Jr:(Od(Jr,Vs),Vs.Buffer=gi);function gi(e,t,i){return et(e,t,i)}Od(et,gi);gi.from=function(e,t,i){if(typeof e=="number")throw new TypeError("Argument must not be a number");return et(e,t,i)};gi.alloc=function(e,t,i){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=et(e);return t!==void 0?typeof i=="string"?n.fill(t,i):n.fill(t):n.fill(0),n};gi.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return et(e)};gi.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Jr.SlowBuffer(e)}});var mi=k(oe=>{"use strict";function Xm(e){return Array.isArray?Array.isArray(e):Qr(e)==="[object Array]"}oe.isArray=Xm;function Zm(e){return typeof e=="boolean"}oe.isBoolean=Zm;function Jm(e){return e===null}oe.isNull=Jm;function Qm(e){return e==null}oe.isNullOrUndefined=Qm;function eb(e){return typeof e=="number"}oe.isNumber=eb;function tb(e){return typeof e=="string"}oe.isString=tb;function ib(e){return typeof e=="symbol"}oe.isSymbol=ib;function nb(e){return e===void 0}oe.isUndefined=nb;function rb(e){return Qr(e)==="[object RegExp]"}oe.isRegExp=rb;function ab(e){return typeof e=="object"&&e!==null}oe.isObject=ab;function sb(e){return Qr(e)==="[object Date]"}oe.isDate=sb;function ob(e){return Qr(e)==="[object Error]"||e instanceof Error}oe.isError=ob;function lb(e){return typeof e=="function"}oe.isFunction=lb;function cb(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}oe.isPrimitive=cb;oe.isBuffer=require("buffer").Buffer.isBuffer;function Qr(e){return Object.prototype.toString.call(e)}});var Md=k((y1,Ks)=>{"use strict";typeof Object.create=="function"?Ks.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Ks.exports=function(t,i){if(i){t.super_=i;var n=function(){};n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t}}});var bi=k((v1,Zs)=>{"use strict";try{if(Xs=require("util"),typeof Xs.inherits!="function")throw"";Zs.exports=Xs.inherits}catch{Zs.exports=Md()}var Xs});var Pd=k((x1,Js)=>{"use strict";function db(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Rd=mn().Buffer,bn=require("util");function ub(e,t,i){e.copy(t,i)}Js.exports=(function(){function e(){db(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(i){var n={data:i,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function(i){var n={data:i,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function(){if(this.length!==0){var i=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,i}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(i){if(this.length===0)return"";for(var n=this.head,r=""+n.data;n=n.next;)r+=i+n.data;return r},e.prototype.concat=function(i){if(this.length===0)return Rd.alloc(0);for(var n=Rd.allocUnsafe(i>>>0),r=this.head,a=0;r;)ub(r.data,n,a),a+=r.data.length,r=r.next;return n},e})();bn&&bn.inspect&&bn.inspect.custom&&(Js.exports.prototype[bn.inspect.custom]=function(){var e=bn.inspect({length:this.length});return this.constructor.name+" "+e})});var Qs=k((w1,jd)=>{"use strict";var ea=gn();function pb(e,t){var i=this,n=this._readableState&&this._readableState.destroyed,r=this._writableState&&this._writableState.destroyed;return n||r?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ea.nextTick(ta,this,e)):ea.nextTick(ta,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,ea.nextTick(ta,i,a)):ea.nextTick(ta,i,a):t&&t(a)}),this)}function fb(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function ta(e,t){e.emit("error",t)}jd.exports={destroy:pb,undestroy:fb}});var zd=k((_1,Dd)=>{"use strict";Dd.exports=require("util").deprecate});var to=k((E1,Gd)=>{"use strict";var $t=gn();Gd.exports=Z;function Bd(e){var t=this;this.next=null,this.entry=null,this.finish=function(){Ib(t,e)}}var hb=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:$t.nextTick,yi;Z.WritableState=vn;var Fd=Object.create(mi());Fd.inherits=bi();var gb={deprecate:zd()},Hd=Ys(),na=mn().Buffer,mb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function bb(e){return na.from(e)}function yb(e){return na.isBuffer(e)||e instanceof mb}var $d=Qs();Fd.inherits(Z,Hd);function vb(){}function vn(e,t){yi=yi||Ut(),e=e||{};var i=t instanceof yi;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=e.writableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:i&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(o){Cb(t,o)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Bd(this)}vn.prototype.getBuffer=function(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i};(function(){try{Object.defineProperty(vn.prototype,"buffer",{get:gb.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ia;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ia=Function.prototype[Symbol.hasInstance],Object.defineProperty(Z,Symbol.hasInstance,{value:function(e){return ia.call(this,e)?!0:this!==Z?!1:e&&e._writableState instanceof vn}})):ia=function(e){return e instanceof this};function Z(e){if(yi=yi||Ut(),!ia.call(Z,this)&&!(this instanceof yi))return new Z(e);this._writableState=new vn(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),Hd.call(this)}Z.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function xb(e,t){var i=new Error("write after end");e.emit("error",i),$t.nextTick(t,i)}function wb(e,t,i,n){var r=!0,a=!1;return i===null?a=new TypeError("May not write null values to stream"):typeof i!="string"&&i!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),$t.nextTick(n,a),r=!1),r}Z.prototype.write=function(e,t,i){var n=this._writableState,r=!1,a=!n.objectMode&&yb(e);return a&&!na.isBuffer(e)&&(e=bb(e)),typeof t=="function"&&(i=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof i!="function"&&(i=vb),n.ended?xb(this,i):(a||wb(this,n,e,i))&&(n.pendingcb++,r=Eb(this,n,a,e,t,i)),r};Z.prototype.cork=function(){var e=this._writableState;e.corked++};Z.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Ud(this,e))};Z.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function _b(e,t,i){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=na.from(t,i)),t}Object.defineProperty(Z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Eb(e,t,i,n,r,a){if(!i){var s=_b(t,n,r);n!==s&&(i=!0,r="buffer",n=s)}var o=t.objectMode?1:n.length;t.length+=o;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:a,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else eo(e,t,!1,o,n,r,a);return l}function eo(e,t,i,n,r,a,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,i?e._writev(r,t.onwrite):e._write(r,a,t.onwrite),t.sync=!1}function Sb(e,t,i,n,r){--t.pendingcb,i?($t.nextTick(r,n),$t.nextTick(yn,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(r(n),e._writableState.errorEmitted=!0,e.emit("error",n),yn(e,t))}function Ab(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function Cb(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if(Ab(i),t)Sb(e,i,n,t,r);else{var a=qd(i);!a&&!i.corked&&!i.bufferProcessing&&i.bufferedRequest&&Ud(e,i),n?hb(Nd,e,i,a,r):Nd(e,i,a,r)}}function Nd(e,t,i,n){i||Tb(e,t),t.pendingcb--,n(),yn(e,t)}function Tb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Ud(e,t){t.bufferProcessing=!0;var i=t.bufferedRequest;if(e._writev&&i&&i.next){var n=t.bufferedRequestCount,r=new Array(n),a=t.corkedRequestsFree;a.entry=i;for(var s=0,o=!0;i;)r[s]=i,i.isBuf||(o=!1),i=i.next,s+=1;r.allBuffers=o,eo(e,t,!0,t.length,r,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new Bd(t),t.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,c=i.encoding,d=i.callback,u=t.objectMode?1:l.length;if(eo(e,t,!1,u,l,c,d),i=i.next,t.bufferedRequestCount--,t.writing)break}i===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=i,t.bufferProcessing=!1}Z.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))};Z.prototype._writev=null;Z.prototype.end=function(e,t,i){var n=this._writableState;typeof e=="function"?(i=e,e=null,t=null):typeof t=="function"&&(i=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||Ob(this,n,i)};function qd(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function kb(e,t){e._final(function(i){t.pendingcb--,i&&e.emit("error",i),t.prefinished=!0,e.emit("prefinish"),yn(e,t)})}function Lb(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,$t.nextTick(kb,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function yn(e,t){var i=qd(t);return i&&(Lb(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),i}function Ob(e,t,i){t.ending=!0,yn(e,t),i&&(t.finished?$t.nextTick(i):e.once("finish",i)),t.ended=!0,e.writable=!1}function Ib(e,t,i){var n=e.entry;for(e.entry=null;n;){var r=n.callback;t.pendingcb--,r(i),n=n.next}t.corkedRequestsFree.next=e}Object.defineProperty(Z.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Z.prototype.destroy=$d.destroy;Z.prototype._undestroy=$d.undestroy;Z.prototype._destroy=function(e,t){this.end(),t(e)}});var Ut=k((S1,Kd)=>{"use strict";var Wd=gn(),Mb=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};Kd.exports=tt;var Yd=Object.create(mi());Yd.inherits=bi();var Vd=ro(),no=to();Yd.inherits(tt,Vd);for(io=Mb(no.prototype),ra=0;ra<io.length;ra++)aa=io[ra],tt.prototype[aa]||(tt.prototype[aa]=no.prototype[aa]);var io,aa,ra;function tt(e){if(!(this instanceof tt))return new tt(e);Vd.call(this,e),no.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",Rb)}Object.defineProperty(tt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Rb(){this.allowHalfOpen||this._writableState.ended||Wd.nextTick(Pb,this)}function Pb(e){e.end()}Object.defineProperty(tt.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});tt.prototype._destroy=function(e,t){this.push(null),this.end(),Wd.nextTick(t,e)}});var oo=k(Zd=>{"use strict";var so=mn().Buffer,Xd=so.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function jb(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function Db(e){var t=jb(e);if(typeof t!="string"&&(so.isEncoding===Xd||!Xd(e)))throw new Error("Unknown encoding: "+e);return t||e}Zd.StringDecoder=xn;function xn(e){this.encoding=Db(e);var t;switch(this.encoding){case"utf16le":this.text=$b,this.end=Ub,t=4;break;case"utf8":this.fillLast=Bb,t=4;break;case"base64":this.text=qb,this.end=Gb,t=3;break;default:this.write=Wb,this.end=Yb;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=so.allocUnsafe(t)}xn.prototype.write=function(e){if(e.length===0)return"";var t,i;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<e.length?t?t+this.text(e,i):this.text(e,i):t||""};xn.prototype.end=Hb;xn.prototype.text=Fb;xn.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function ao(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function zb(e,t,i){var n=t.length-1;if(n<i)return 0;var r=ao(t[n]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--n<i||r===-2?0:(r=ao(t[n]),r>=0?(r>0&&(e.lastNeed=r-2),r):--n<i||r===-2?0:(r=ao(t[n]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function Nb(e,t,i){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function Bb(e){var t=this.lastTotal-this.lastNeed,i=Nb(this,e,t);if(i!==void 0)return i;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function Fb(e,t){var i=zb(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=i;var n=e.length-(i-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function Hb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function $b(e,t){if((e.length-t)%2===0){var i=e.toString("utf16le",t);if(i){var n=i.charCodeAt(i.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function Ub(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,i)}return t}function qb(e,t){var i=(e.length-t)%3;return i===0?e.toString("base64",t):(this.lastNeed=3-i,this.lastTotal=3,i===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-i))}function Gb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Wb(e){return e.toString(this.encoding)}function Yb(e){return e&&e.length?this.write(e):""}});var ro=k((T1,cu)=>{"use strict";var xi=gn();cu.exports=q;var Vb=kd(),wn;q.ReadableState=ru;var C1=require("events").EventEmitter,tu=function(e,t){return e.listeners(t).length},fo=Ys(),_n=mn().Buffer,Kb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Xb(e){return _n.from(e)}function Zb(e){return _n.isBuffer(e)||e instanceof Kb}var iu=Object.create(mi());iu.inherits=bi();var lo=require("util"),H=void 0;lo&&lo.debuglog?H=lo.debuglog("stream"):H=function(){};var Jb=Pd(),nu=Qs(),vi;iu.inherits(q,fo);var co=["error","close","destroy","pause","resume"];function Qb(e,t,i){if(typeof e.prependListener=="function")return e.prependListener(t,i);!e._events||!e._events[t]?e.on(t,i):Vb(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]}function ru(e,t){wn=wn||Ut(),e=e||{};var i=t instanceof wn;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=e.readableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:i&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new Jb,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(vi||(vi=oo().StringDecoder),this.decoder=new vi(e.encoding),this.encoding=e.encoding)}function q(e){if(wn=wn||Ut(),!(this instanceof q))return new q(e);this._readableState=new ru(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),fo.call(this)}Object.defineProperty(q.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});q.prototype.destroy=nu.destroy;q.prototype._undestroy=nu.undestroy;q.prototype._destroy=function(e,t){this.push(null),t(e)};q.prototype.push=function(e,t){var i=this._readableState,n;return i.objectMode?n=!0:typeof e=="string"&&(t=t||i.defaultEncoding,t!==i.encoding&&(e=_n.from(e,t),t=""),n=!0),au(this,e,t,!1,n)};q.prototype.unshift=function(e){return au(this,e,null,!0,!1)};function au(e,t,i,n,r){var a=e._readableState;if(t===null)a.reading=!1,ny(e,a);else{var s;r||(s=ey(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==_n.prototype&&(t=Xb(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):uo(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!i?(t=a.decoder.write(t),a.objectMode||t.length!==0?uo(e,a,t,!1):su(e,a)):uo(e,a,t,!1))):n||(a.reading=!1)}return ty(a)}function uo(e,t,i,n){t.flowing&&t.length===0&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&sa(e)),su(e,t)}function ey(e,t){var i;return!Zb(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(i=new TypeError("Invalid non-string/buffer chunk")),i}function ty(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}q.prototype.isPaused=function(){return this._readableState.flowing===!1};q.prototype.setEncoding=function(e){return vi||(vi=oo().StringDecoder),this._readableState.decoder=new vi(e),this._readableState.encoding=e,this};var Jd=8388608;function iy(e){return e>=Jd?e=Jd:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Qd(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=iy(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}q.prototype.read=function(e){H("read",e),e=parseInt(e,10);var t=this._readableState,i=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return H("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?po(this):sa(this),null;if(e=Qd(e,t),e===0&&t.ended)return t.length===0&&po(this),null;var n=t.needReadable;H("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,H("length less than watermark",n)),t.ended||t.reading?(n=!1,H("reading or ended",n)):n&&(H("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Qd(i,t)));var r;return e>0?r=ou(e,t):r=null,r===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&po(this)),r!==null&&this.emit("data",r),r};function ny(e,t){if(!t.ended){if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,sa(e)}}function sa(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(H("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?xi.nextTick(eu,e):eu(e))}function eu(e){H("emit readable"),e.emit("readable"),ho(e)}function su(e,t){t.readingMore||(t.readingMore=!0,xi.nextTick(ry,e,t))}function ry(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(H("maybeReadMore read 0"),e.read(0),i!==t.length);)i=t.length;t.readingMore=!1}q.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};q.prototype.pipe=function(e,t){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,H("pipe count=%d opts=%j",n.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?o:g;n.endEmitted?xi.nextTick(a):i.once("end",a),e.on("unpipe",s);function s(b,y){H("onunpipe"),b===i&&y&&y.hasUnpiped===!1&&(y.hasUnpiped=!0,d())}function o(){H("onend"),e.end()}var l=ay(i);e.on("drain",l);var c=!1;function d(){H("cleanup"),e.removeListener("close",m),e.removeListener("finish",h),e.removeListener("drain",l),e.removeListener("error",f),e.removeListener("unpipe",s),i.removeListener("end",o),i.removeListener("end",g),i.removeListener("data",p),c=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&l()}var u=!1;i.on("data",p);function p(b){H("ondata"),u=!1;var y=e.write(b);y===!1&&!u&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&lu(n.pipes,e)!==-1)&&!c&&(H("false write response, pause",n.awaitDrain),n.awaitDrain++,u=!0),i.pause())}function f(b){H("onerror",b),g(),e.removeListener("error",f),tu(e,"error")===0&&e.emit("error",b)}Qb(e,"error",f);function m(){e.removeListener("finish",h),g()}e.once("close",m);function h(){H("onfinish"),e.removeListener("close",m),g()}e.once("finish",h);function g(){H("unpipe"),i.unpipe(e)}return e.emit("pipe",i),n.flowing||(H("pipe resume"),i.resume()),e};function ay(e){return function(){var t=e._readableState;H("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&tu(e,"data")&&(t.flowing=!0,ho(e))}}q.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<r;a++)n[a].emit("unpipe",this,{hasUnpiped:!1});return this}var s=lu(t.pipes,e);return s===-1?this:(t.pipes.splice(s,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,i),this)};q.prototype.on=function(e,t){var i=fo.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var n=this._readableState;!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&sa(this):xi.nextTick(sy,this))}return i};q.prototype.addListener=q.prototype.on;function sy(e){H("readable nexttick read 0"),e.read(0)}q.prototype.resume=function(){var e=this._readableState;return e.flowing||(H("resume"),e.flowing=!0,oy(this,e)),this};function oy(e,t){t.resumeScheduled||(t.resumeScheduled=!0,xi.nextTick(ly,e,t))}function ly(e,t){t.reading||(H("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),ho(e),t.flowing&&!t.reading&&e.read(0)}q.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function ho(e){var t=e._readableState;for(H("flow",t.flowing);t.flowing&&e.read()!==null;);}q.prototype.wrap=function(e){var t=this,i=this._readableState,n=!1;e.on("end",function(){if(H("wrapped end"),i.decoder&&!i.ended){var s=i.decoder.end();s&&s.length&&t.push(s)}t.push(null)}),e.on("data",function(s){if(H("wrapped data"),i.decoder&&(s=i.decoder.write(s)),!(i.objectMode&&s==null)&&!(!i.objectMode&&(!s||!s.length))){var o=t.push(s);o||(n=!0,e.pause())}});for(var r in e)this[r]===void 0&&typeof e[r]=="function"&&(this[r]=(function(s){return function(){return e[s].apply(e,arguments)}})(r));for(var a=0;a<co.length;a++)e.on(co[a],this.emit.bind(this,co[a]));return this._read=function(s){H("wrapped _read",s),n&&(n=!1,e.resume())},this};Object.defineProperty(q.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});q._fromList=ou;function ou(e,t){if(t.length===0)return null;var i;return t.objectMode?i=t.buffer.shift():!e||e>=t.length?(t.decoder?i=t.buffer.join(""):t.buffer.length===1?i=t.buffer.head.data:i=t.buffer.concat(t.length),t.buffer.clear()):i=cy(e,t.buffer,t.decoder),i}function cy(e,t,i){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?n=t.shift():n=i?dy(e,t):uy(e,t),n}function dy(e,t){var i=t.head,n=1,r=i.data;for(e-=r.length;i=i.next;){var a=i.data,s=e>a.length?a.length:e;if(s===a.length?r+=a:r+=a.slice(0,e),e-=s,e===0){s===a.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(s));break}++n}return t.length-=n,r}function uy(e,t){var i=_n.allocUnsafe(e),n=t.head,r=1;for(n.data.copy(i),e-=n.data.length;n=n.next;){var a=n.data,s=e>a.length?a.length:e;if(a.copy(i,i.length-e,0,s),e-=s,e===0){s===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(s));break}++r}return t.length-=r,i}function po(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,xi.nextTick(py,t,e))}function py(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function lu(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}});var go=k((k1,pu)=>{"use strict";pu.exports=it;var oa=Ut(),uu=Object.create(mi());uu.inherits=bi();uu.inherits(it,oa);function fy(e,t){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));i.writechunk=null,i.writecb=null,t!=null&&this.push(t),n(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function it(e){if(!(this instanceof it))return new it(e);oa.call(this,e),this._transformState={afterTransform:fy.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",hy)}function hy(){var e=this;typeof this._flush=="function"?this._flush(function(t,i){du(e,t,i)}):du(this,null,null)}it.prototype.push=function(e,t){return this._transformState.needTransform=!1,oa.prototype.push.call(this,e,t)};it.prototype._transform=function(e,t,i){throw new Error("_transform() is not implemented")};it.prototype._write=function(e,t,i){var n=this._transformState;if(n.writecb=i,n.writechunk=e,n.writeencoding=t,!n.transforming){var r=this._readableState;(n.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}};it.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};it.prototype._destroy=function(e,t){var i=this;oa.prototype._destroy.call(this,e,function(n){t(n),i.emit("close")})};function du(e,t,i){if(t)return e.emit("error",t);if(i!=null&&e.push(i),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var mu=k((L1,gu)=>{"use strict";gu.exports=En;var fu=go(),hu=Object.create(mi());hu.inherits=bi();hu.inherits(En,fu);function En(e){if(!(this instanceof En))return new En(e);fu.call(this,e)}En.prototype._transform=function(e,t,i){i(null,e)}});var mo=k((re,la)=>{"use strict";var Ne=require("stream");process.env.READABLE_STREAM==="disable"&&Ne?(la.exports=Ne,re=la.exports=Ne.Readable,re.Readable=Ne.Readable,re.Writable=Ne.Writable,re.Duplex=Ne.Duplex,re.Transform=Ne.Transform,re.PassThrough=Ne.PassThrough,re.Stream=Ne):(re=la.exports=ro(),re.Stream=Ne||re,re.Readable=re,re.Writable=to(),re.Duplex=Ut(),re.Transform=go(),re.PassThrough=mu())});var nt=k(he=>{"use strict";he.base64=!0;he.array=!0;he.string=!0;he.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined";he.nodebuffer=typeof Buffer!="undefined";he.uint8array=typeof Uint8Array!="undefined";if(typeof ArrayBuffer=="undefined")he.blob=!1;else{bo=new ArrayBuffer(0);try{he.blob=new Blob([bo],{type:"application/zip"}).size===0}catch{try{bu=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,yo=new bu,yo.append(bo),he.blob=yo.getBlob("application/zip").size===0}catch{he.blob=!1}}}var bo,bu,yo;try{he.nodestream=!!mo().Readable}catch{he.nodestream=!1}});var xo=k(vo=>{"use strict";var gy=V(),my=nt(),Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";vo.encode=function(e){for(var t=[],i,n,r,a,s,o,l,c=0,d=e.length,u=d,p=gy.getTypeOf(e)!=="string";c<e.length;)u=d-c,p?(i=e[c++],n=c<d?e[c++]:0,r=c<d?e[c++]:0):(i=e.charCodeAt(c++),n=c<d?e.charCodeAt(c++):0,r=c<d?e.charCodeAt(c++):0),a=i>>2,s=(i&3)<<4|n>>4,o=u>1?(n&15)<<2|r>>6:64,l=u>2?r&63:64,t.push(Be.charAt(a)+Be.charAt(s)+Be.charAt(o)+Be.charAt(l));return t.join("")};vo.decode=function(e){var t,i,n,r,a,s,o,l=0,c=0,d="data:";if(e.substr(0,d.length)===d)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var u=e.length*3/4;if(e.charAt(e.length-1)===Be.charAt(64)&&u--,e.charAt(e.length-2)===Be.charAt(64)&&u--,u%1!==0)throw new Error("Invalid base64 input, bad content length.");var p;for(my.uint8array?p=new Uint8Array(u|0):p=new Array(u|0);l<e.length;)r=Be.indexOf(e.charAt(l++)),a=Be.indexOf(e.charAt(l++)),s=Be.indexOf(e.charAt(l++)),o=Be.indexOf(e.charAt(l++)),t=r<<2|a>>4,i=(a&15)<<4|s>>2,n=(s&3)<<6|o,p[c++]=t,s!==64&&(p[c++]=i),o!==64&&(p[c++]=n);return p}});var Sn=k((M1,yu)=>{"use strict";yu.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var _u=k((R1,wu)=>{"use strict";var vu=global.MutationObserver||global.WebKitMutationObserver,wi;process.browser?vu?(wo=0,xu=new vu(An),_o=global.document.createTextNode(""),xu.observe(_o,{characterData:!0}),wi=function(){_o.data=wo=++wo%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(Eo=new global.MessageChannel,Eo.port1.onmessage=An,wi=function(){Eo.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?wi=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){An(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:wi=function(){setTimeout(An,0)}:wi=function(){process.nextTick(An)};var wo,xu,_o,Eo,So,Cn=[];function An(){So=!0;for(var e,t,i=Cn.length;i;){for(t=Cn,Cn=[],e=-1;++e<i;)t[e]();i=Cn.length}So=!1}wu.exports=by;function by(e){Cn.push(e)===1&&!So&&wi()}});var Lu=k((P1,ku)=>{"use strict";var Eu=_u();function _i(){}var le={},Su=["REJECTED"],Ao=["FULFILLED"],Au=["PENDING"];process.browser||(Tn=["UNHANDLED"]);var Tn;ku.exports=vt;function vt(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=Au,this.queue=[],this.outcome=void 0,process.browser||(this.handled=Tn),e!==_i&&Cu(this,e)}vt.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(i,n);function i(r){function a(){return r}return t.resolve(e()).then(a)}function n(r){function a(){throw r}return t.resolve(e()).then(a)}};vt.prototype.catch=function(e){return this.then(null,e)};vt.prototype.then=function(e,t){if(typeof e!="function"&&this.state===Ao||typeof t!="function"&&this.state===Su)return this;var i=new this.constructor(_i);if(process.browser||this.handled===Tn&&(this.handled=null),this.state!==Au){var n=this.state===Ao?e:t;Co(i,n,this.outcome)}else this.queue.push(new kn(i,e,t));return i};function kn(e,t,i){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof i=="function"&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}kn.prototype.callFulfilled=function(e){le.resolve(this.promise,e)};kn.prototype.otherCallFulfilled=function(e){Co(this.promise,this.onFulfilled,e)};kn.prototype.callRejected=function(e){le.reject(this.promise,e)};kn.prototype.otherCallRejected=function(e){Co(this.promise,this.onRejected,e)};function Co(e,t,i){Eu(function(){var n;try{n=t(i)}catch(r){return le.reject(e,r)}n===e?le.reject(e,new TypeError("Cannot resolve promise with itself")):le.resolve(e,n)})}le.resolve=function(e,t){var i=Tu(yy,t);if(i.status==="error")return le.reject(e,i.value);var n=i.value;if(n)Cu(e,n);else{e.state=Ao,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};le.reject=function(e,t){e.state=Su,e.outcome=t,process.browser||e.handled===Tn&&Eu(function(){e.handled===Tn&&process.emit("unhandledRejection",t,e)});for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callRejected(t);return e};function yy(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function Cu(e,t){var i=!1;function n(o){i||(i=!0,le.reject(e,o))}function r(o){i||(i=!0,le.resolve(e,o))}function a(){t(r,n)}var s=Tu(a);s.status==="error"&&n(s.value)}function Tu(e,t){var i={};try{i.value=e(t),i.status="success"}catch(n){i.status="error",i.value=n}return i}vt.resolve=vy;function vy(e){return e instanceof this?e:le.resolve(new this(_i),e)}vt.reject=xy;function xy(e){var t=new this(_i);return le.reject(t,e)}vt.all=wy;function wy(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var i=e.length,n=!1;if(!i)return this.resolve([]);for(var r=new Array(i),a=0,s=-1,o=new this(_i);++s<i;)l(e[s],s);return o;function l(c,d){t.resolve(c).then(u,function(p){n||(n=!0,le.reject(o,p))});function u(p){r[d]=p,++a===i&&!n&&(n=!0,le.resolve(o,r))}}}vt.race=_y;function _y(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var i=e.length,n=!1;if(!i)return this.resolve([]);for(var r=-1,a=new this(_i);++r<i;)s(e[r]);return a;function s(o){t.resolve(o).then(function(l){n||(n=!0,le.resolve(a,l))},function(l){n||(n=!0,le.reject(a,l))})}}});var Ei=k((j1,Ou)=>{"use strict";var To=null;typeof Promise!="undefined"?To=Promise:To=Lu();Ou.exports={Promise:To}});var Mu=k(Iu=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var i=1,n={},r=!1,a=e.document,s;function o(y){typeof y!="function"&&(y=new Function(""+y));for(var v=new Array(arguments.length-1),x=0;x<v.length;x++)v[x]=arguments[x+1];var w={callback:y,args:v};return n[i]=w,s(i),i++}function l(y){delete n[y]}function c(y){var v=y.callback,x=y.args;switch(x.length){case 0:v();break;case 1:v(x[0]);break;case 2:v(x[0],x[1]);break;case 3:v(x[0],x[1],x[2]);break;default:v.apply(t,x);break}}function d(y){if(r)setTimeout(d,0,y);else{var v=n[y];if(v){r=!0;try{c(v)}finally{l(y),r=!1}}}}function u(){s=function(y){process.nextTick(function(){d(y)})}}function p(){if(e.postMessage&&!e.importScripts){var y=!0,v=e.onmessage;return e.onmessage=function(){y=!1},e.postMessage("","*"),e.onmessage=v,y}}function f(){var y="setImmediate$"+Math.random()+"$",v=function(x){x.source===e&&typeof x.data=="string"&&x.data.indexOf(y)===0&&d(+x.data.slice(y.length))};e.addEventListener?e.addEventListener("message",v,!1):e.attachEvent("onmessage",v),s=function(x){e.postMessage(y+x,"*")}}function m(){var y=new MessageChannel;y.port1.onmessage=function(v){var x=v.data;d(x)},s=function(v){y.port2.postMessage(v)}}function h(){var y=a.documentElement;s=function(v){var x=a.createElement("script");x.onreadystatechange=function(){d(v),x.onreadystatechange=null,y.removeChild(x),x=null},y.appendChild(x)}}function g(){s=function(y){setTimeout(d,0,y)}}var b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,{}.toString.call(e.process)==="[object process]"?u():p()?f():e.MessageChannel?m():a&&"onreadystatechange"in a.createElement("script")?h():g(),b.setImmediate=o,b.clearImmediate=l})(typeof self=="undefined"?typeof global=="undefined"?Iu:global:self)});var V=k(J=>{"use strict";var xt=nt(),Ey=xo(),Si=Sn(),ko=Ei();Mu();function Sy(e){var t=null;return xt.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),da(e,t)}J.newBlob=function(e,t){J.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var i=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,n=new i;return n.append(e),n.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function Ln(e){return e}function da(e,t){for(var i=0;i<e.length;++i)t[i]=e.charCodeAt(i)&255;return t}var ca={stringifyByChunk:function(e,t,i){var n=[],r=0,a=e.length;if(a<=i)return String.fromCharCode.apply(null,e);for(;r<a;)t==="array"||t==="nodebuffer"?n.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+i,a)))):n.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+i,a)))),r+=i;return n.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:(function(){try{return xt.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return xt.nodebuffer&&String.fromCharCode.apply(null,Si.allocBuffer(1)).length===1}catch{return!1}})()}};function On(e){var t=65536,i=J.getTypeOf(e),n=!0;if(i==="uint8array"?n=ca.applyCanBeUsed.uint8array:i==="nodebuffer"&&(n=ca.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return ca.stringifyByChunk(e,i,t)}catch{t=Math.floor(t/2)}return ca.stringifyByChar(e)}J.applyFromCharCode=On;function ua(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}var wt={};wt.string={string:Ln,array:function(e){return da(e,new Array(e.length))},arraybuffer:function(e){return wt.string.uint8array(e).buffer},uint8array:function(e){return da(e,new Uint8Array(e.length))},nodebuffer:function(e){return da(e,Si.allocBuffer(e.length))}};wt.array={string:On,array:Ln,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Si.newBufferFrom(e)}};wt.arraybuffer={string:function(e){return On(new Uint8Array(e))},array:function(e){return ua(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:Ln,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Si.newBufferFrom(new Uint8Array(e))}};wt.uint8array={string:On,array:function(e){return ua(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:Ln,nodebuffer:function(e){return Si.newBufferFrom(e)}};wt.nodebuffer={string:On,array:function(e){return ua(e,new Array(e.length))},arraybuffer:function(e){return wt.nodebuffer.uint8array(e).buffer},uint8array:function(e){return ua(e,new Uint8Array(e.length))},nodebuffer:Ln};J.transformTo=function(e,t){if(t||(t=""),!e)return t;J.checkSupport(e);var i=J.getTypeOf(t),n=wt[i][e](t);return n};J.resolve=function(e){for(var t=e.split("/"),i=[],n=0;n<t.length;n++){var r=t[n];r==="."||r===""&&n!==0&&n!==t.length-1||(r===".."?i.pop():i.push(r))}return i.join("/")};J.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(xt.nodebuffer&&Si.isBuffer(e))return"nodebuffer";if(xt.uint8array&&e instanceof Uint8Array)return"uint8array";if(xt.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};J.checkSupport=function(e){var t=xt[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};J.MAX_VALUE_16BITS=65535;J.MAX_VALUE_32BITS=-1;J.pretty=function(e){var t="",i,n;for(n=0;n<(e||"").length;n++)i=e.charCodeAt(n),t+="\\x"+(i<16?"0":"")+i.toString(16).toUpperCase();return t};J.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})};J.inherits=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i};J.extend=function(){var e={},t,i;for(t=0;t<arguments.length;t++)for(i in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],i)&&typeof e[i]=="undefined"&&(e[i]=arguments[t][i]);return e};J.prepareContent=function(e,t,i,n,r){var a=ko.Promise.resolve(t).then(function(s){var o=xt.blob&&(s instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(s))!==-1);return o&&typeof FileReader!="undefined"?new ko.Promise(function(l,c){var d=new FileReader;d.onload=function(u){l(u.target.result)},d.onerror=function(u){c(u.target.error)},d.readAsArrayBuffer(s)}):s});return a.then(function(s){var o=J.getTypeOf(s);return o?(o==="arraybuffer"?s=J.transformTo("uint8array",s):o==="string"&&(r?s=Ey.decode(s):i&&n!==!0&&(s=Sy(s))),s):ko.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var ge=k((N1,Pu)=>{"use strict";function Ru(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Ru.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(i){t.processChunk(i)}),e.on("end",function(){t.end()}),e.on("error",function(i){t.error(i)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};Pu.exports=Ru});var Ci=k(_t=>{"use strict";var Ai=V(),qt=nt(),Ay=Sn(),pa=ge(),In=new Array(256);for(rt=0;rt<256;rt++)In[rt]=rt>=252?6:rt>=248?5:rt>=240?4:rt>=224?3:rt>=192?2:1;var rt;In[254]=In[254]=1;var Cy=function(e){var t,i,n,r,a,s=e.length,o=0;for(r=0;r<s;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(qt.uint8array?t=new Uint8Array(o):t=new Array(o),a=0,r=0;a<o;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>>6,t[a++]=128|i&63):i<65536?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|i&63):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|i&63);return t},Ty=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&(e[i]&192)===128;)i--;return i<0||i===0?t:i+In[e[i]]>t?i:t},ky=function(e){var t,i,n,r,a=e.length,s=new Array(a*2);for(i=0,t=0;t<a;){if(n=e[t++],n<128){s[i++]=n;continue}if(r=In[n],r>4){s[i++]=65533,t+=r-1;continue}for(n&=r===2?31:r===3?15:7;r>1&&t<a;)n=n<<6|e[t++]&63,r--;if(r>1){s[i++]=65533;continue}n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|n&1023)}return s.length!==i&&(s.subarray?s=s.subarray(0,i):s.length=i),Ai.applyFromCharCode(s)};_t.utf8encode=function(t){return qt.nodebuffer?Ay.newBufferFrom(t,"utf-8"):Cy(t)};_t.utf8decode=function(t){return qt.nodebuffer?Ai.transformTo("nodebuffer",t).toString("utf-8"):(t=Ai.transformTo(qt.uint8array?"uint8array":"array",t),ky(t))};function fa(){pa.call(this,"utf-8 decode"),this.leftOver=null}Ai.inherits(fa,pa);fa.prototype.processChunk=function(e){var t=Ai.transformTo(qt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(qt.uint8array){var i=t;t=new Uint8Array(i.length+this.leftOver.length),t.set(this.leftOver,0),t.set(i,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=Ty(t),r=t;n!==t.length&&(qt.uint8array?(r=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(r=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:_t.utf8decode(r),meta:e.meta})};fa.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:_t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};_t.Utf8DecodeWorker=fa;function Lo(){pa.call(this,"utf-8 encode")}Ai.inherits(Lo,pa);Lo.prototype.processChunk=function(e){this.push({data:_t.utf8encode(e.data),meta:e.meta})};_t.Utf8EncodeWorker=Lo});var Nu=k((F1,zu)=>{"use strict";var ju=ge(),Du=V();function Oo(e){ju.call(this,"ConvertWorker to "+e),this.destType=e}Du.inherits(Oo,ju);Oo.prototype.processChunk=function(e){this.push({data:Du.transformTo(this.destType,e.data),meta:e.meta})};zu.exports=Oo});var Hu=k((H1,Fu)=>{"use strict";var Bu=mo().Readable,Ly=V();Ly.inherits(Io,Bu);function Io(e,t,i){Bu.call(this,t),this._helper=e;var n=this;e.on("data",function(r,a){n.push(r)||n._helper.pause(),i&&i(a)}).on("error",function(r){n.emit("error",r)}).on("end",function(){n.push(null)})}Io.prototype._read=function(){this._helper.resume()};Fu.exports=Io});var Mo=k(($1,qu)=>{"use strict";var Gt=V(),Oy=Nu(),Iy=ge(),My=xo(),Ry=nt(),Py=Ei(),$u=null;if(Ry.nodestream)try{$u=Hu()}catch{}function jy(e,t,i){switch(e){case"blob":return Gt.newBlob(Gt.transformTo("arraybuffer",t),i);case"base64":return My.encode(t);default:return Gt.transformTo(e,t)}}function Dy(e,t){var i,n=0,r=null,a=0;for(i=0;i<t.length;i++)a+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(a),i=0;i<t.length;i++)r.set(t[i],n),n+=t[i].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function zy(e,t){return new Py.Promise(function(i,n){var r=[],a=e._internalType,s=e._outputType,o=e._mimeType;e.on("data",function(l,c){r.push(l),t&&t(c)}).on("error",function(l){r=[],n(l)}).on("end",function(){try{var l=jy(s,Dy(a,r),o);i(l)}catch(c){n(c)}r=[]}).resume()})}function Uu(e,t,i){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string";break}try{this._internalType=n,this._outputType=t,this._mimeType=i,Gt.checkSupport(n),this._worker=e.pipe(new Oy(n)),e.lock()}catch(r){this._worker=new Iy("error"),this._worker.error(r)}}Uu.prototype={accumulate:function(e){return zy(this,e)},on:function(e,t){var i=this;return e==="data"?this._worker.on(e,function(n){t.call(i,n.data,n.meta)}):this._worker.on(e,function(){Gt.delay(t,arguments,i)}),this},resume:function(){return Gt.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(Gt.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new $u(this,{objectMode:this._outputType!=="nodebuffer"},e)}};qu.exports=Uu});var Ro=k(ke=>{"use strict";ke.base64=!1;ke.binary=!1;ke.dir=!1;ke.createFolders=!0;ke.date=null;ke.compression=null;ke.compressionOptions=null;ke.comment=null;ke.unixPermissions=null;ke.dosPermissions=null});var Po=k((q1,Gu)=>{"use strict";var ha=V(),ga=ge(),Ny=16*1024;function Ti(e){ga.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(i){t.dataIsReady=!0,t.data=i,t.max=i&&i.length||0,t.type=ha.getTypeOf(i),t.isPaused||t._tickAndRepeat()},function(i){t.error(i)})}ha.inherits(Ti,ga);Ti.prototype.cleanUp=function(){ga.prototype.cleanUp.call(this),this.data=null};Ti.prototype.resume=function(){return ga.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,ha.delay(this._tickAndRepeat,[],this)),!0):!1};Ti.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(ha.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};Ti.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Ny,t=null,i=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,i);break;case"uint8array":t=this.data.subarray(this.index,i);break;case"array":case"nodebuffer":t=this.data.slice(this.index,i);break}return this.index=i,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};Gu.exports=Ti});var ma=k((G1,Yu)=>{"use strict";var By=V();function Fy(){for(var e,t=[],i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[i]=e}return t}var Wu=Fy();function Hy(e,t,i,n){var r=Wu,a=n+i;e=e^-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}function $y(e,t,i,n){var r=Wu,a=n+i;e=e^-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t.charCodeAt(s))&255];return e^-1}Yu.exports=function(t,i){if(typeof t=="undefined"||!t.length)return 0;var n=By.getTypeOf(t)!=="string";return n?Hy(i|0,t,t.length,0):$y(i|0,t,t.length,0)}});var Do=k((W1,Ku)=>{"use strict";var Vu=ge(),Uy=ma(),qy=V();function jo(){Vu.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}qy.inherits(jo,Vu);jo.prototype.processChunk=function(e){this.streamInfo.crc32=Uy(e.data,this.streamInfo.crc32||0),this.push(e)};Ku.exports=jo});var Zu=k((Y1,Xu)=>{"use strict";var Gy=V(),zo=ge();function No(e){zo.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Gy.inherits(No,zo);No.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}zo.prototype.processChunk.call(this,e)};Xu.exports=No});var ba=k((V1,ep)=>{"use strict";var Ju=Ei(),Qu=Po(),Wy=Do(),Bo=Zu();function Fo(e,t,i,n,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=n,this.compressedContent=r}Fo.prototype={getContentWorker:function(){var e=new Qu(Ju.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Bo("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new Qu(Ju.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Fo.createWorkerFrom=function(e,t,i){return e.pipe(new Wy).pipe(new Bo("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new Bo("compressedSize")).withStreamInfo("compression",t)};ep.exports=Fo});var rp=k((K1,np)=>{"use strict";var Yy=Mo(),Vy=Po(),Ho=Ci(),$o=ba(),tp=ge(),Uo=function(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}};Uo.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");i=e.toLowerCase();var n=i==="string"||i==="text";(i==="binarystring"||i==="text")&&(i="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!n&&(t=t.pipe(new Ho.Utf8EncodeWorker)),!r&&n&&(t=t.pipe(new Ho.Utf8DecodeWorker))}catch(a){t=new tp("error"),t.error(a)}return new Yy(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof $o&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new Ho.Utf8EncodeWorker)),$o.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof $o?this._data.getContentWorker():this._data instanceof tp?this._data:new Vy(this._data)}};var ip=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],Ky=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(ya=0;ya<ip.length;ya++)Uo.prototype[ip[ya]]=Ky;var ya;np.exports=Uo});var at=k(ue=>{"use strict";var Xy=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function Zy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}ue.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if(typeof i!="object")throw new TypeError(i+"must be non-object");for(var n in i)Zy(i,n)&&(e[n]=i[n])}}return e};ue.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Jy={arraySet:function(e,t,i,n,r){if(t.subarray&&e.subarray){e.set(t.subarray(i,i+n),r);return}for(var a=0;a<n;a++)e[r+a]=t[i+a]},flattenChunks:function(e){var t,i,n,r,a,s;for(n=0,t=0,i=e.length;t<i;t++)n+=e[t].length;for(s=new Uint8Array(n),r=0,t=0,i=e.length;t<i;t++)a=e[t],s.set(a,r),r+=a.length;return s}},Qy={arraySet:function(e,t,i,n,r){for(var a=0;a<n;a++)e[r+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};ue.setTyped=function(e){e?(ue.Buf8=Uint8Array,ue.Buf16=Uint16Array,ue.Buf32=Int32Array,ue.assign(ue,Jy)):(ue.Buf8=Array,ue.Buf16=Array,ue.Buf32=Array,ue.assign(ue,Qy))};ue.setTyped(Xy)});var Tp=k(Oi=>{"use strict";var ev=at(),tv=4,ap=0,sp=1,iv=2;function Li(e){for(var t=e.length;--t>=0;)e[t]=0}var nv=0,pp=1,rv=2,av=3,sv=258,Xo=29,zn=256,Rn=zn+1+Xo,ki=30,Zo=19,fp=2*Rn+1,Wt=15,qo=16,ov=7,Jo=256,hp=16,gp=17,mp=18,Vo=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],va=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],lv=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bp=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],cv=512,st=new Array((Rn+2)*2);Li(st);var Mn=new Array(ki*2);Li(Mn);var Pn=new Array(cv);Li(Pn);var jn=new Array(sv-av+1);Li(jn);var Qo=new Array(Xo);Li(Qo);var xa=new Array(ki);Li(xa);function Go(e,t,i,n,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=n,this.max_length=r,this.has_stree=e&&e.length}var yp,vp,xp;function Wo(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function wp(e){return e<256?Pn[e]:Pn[256+(e>>>7)]}function Dn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function fe(e,t,i){e.bi_valid>qo-i?(e.bi_buf|=t<<e.bi_valid&65535,Dn(e,e.bi_buf),e.bi_buf=t>>qo-e.bi_valid,e.bi_valid+=i-qo):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Fe(e,t,i){fe(e,i[t*2],i[t*2+1])}function _p(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function dv(e){e.bi_valid===16?(Dn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function uv(e,t){var i=t.dyn_tree,n=t.max_code,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,d,u,p,f,m,h=0;for(p=0;p<=Wt;p++)e.bl_count[p]=0;for(i[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<fp;c++)d=e.heap[c],p=i[i[d*2+1]*2+1]+1,p>l&&(p=l,h++),i[d*2+1]=p,!(d>n)&&(e.bl_count[p]++,f=0,d>=o&&(f=s[d-o]),m=i[d*2],e.opt_len+=m*(p+f),a&&(e.static_len+=m*(r[d*2+1]+f)));if(h!==0){do{for(p=l-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,h-=2}while(h>0);for(p=l;p!==0;p--)for(d=e.bl_count[p];d!==0;)u=e.heap[--c],!(u>n)&&(i[u*2+1]!==p&&(e.opt_len+=(p-i[u*2+1])*i[u*2],i[u*2+1]=p),d--)}}function Ep(e,t,i){var n=new Array(Wt+1),r=0,a,s;for(a=1;a<=Wt;a++)n[a]=r=r+i[a-1]<<1;for(s=0;s<=t;s++){var o=e[s*2+1];o!==0&&(e[s*2]=_p(n[o]++,o))}}function pv(){var e,t,i,n,r,a=new Array(Wt+1);for(i=0,n=0;n<Xo-1;n++)for(Qo[n]=i,e=0;e<1<<Vo[n];e++)jn[i++]=n;for(jn[i-1]=n,r=0,n=0;n<16;n++)for(xa[n]=r,e=0;e<1<<va[n];e++)Pn[r++]=n;for(r>>=7;n<ki;n++)for(xa[n]=r<<7,e=0;e<1<<va[n]-7;e++)Pn[256+r++]=n;for(t=0;t<=Wt;t++)a[t]=0;for(e=0;e<=143;)st[e*2+1]=8,e++,a[8]++;for(;e<=255;)st[e*2+1]=9,e++,a[9]++;for(;e<=279;)st[e*2+1]=7,e++,a[7]++;for(;e<=287;)st[e*2+1]=8,e++,a[8]++;for(Ep(st,Rn+1,a),e=0;e<ki;e++)Mn[e*2+1]=5,Mn[e*2]=_p(e,5);yp=new Go(st,Vo,zn+1,Rn,Wt),vp=new Go(Mn,va,0,ki,Wt),xp=new Go(new Array(0),lv,0,Zo,ov)}function Sp(e){var t;for(t=0;t<Rn;t++)e.dyn_ltree[t*2]=0;for(t=0;t<ki;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Zo;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Jo*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Ap(e){e.bi_valid>8?Dn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function fv(e,t,i,n){Ap(e),n&&(Dn(e,i),Dn(e,~i)),ev.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function op(e,t,i,n){var r=t*2,a=i*2;return e[r]<e[a]||e[r]===e[a]&&n[t]<=n[i]}function Yo(e,t,i){for(var n=e.heap[i],r=i<<1;r<=e.heap_len&&(r<e.heap_len&&op(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!op(t,n,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r<<=1;e.heap[i]=n}function lp(e,t,i){var n,r,a=0,s,o;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],r=e.pending_buf[e.l_buf+a],a++,n===0?Fe(e,r,t):(s=jn[r],Fe(e,s+zn+1,t),o=Vo[s],o!==0&&(r-=Qo[s],fe(e,r,o)),n--,s=wp(n),Fe(e,s,i),o=va[s],o!==0&&(n-=xa[s],fe(e,n,o)));while(a<e.last_lit);Fe(e,Jo,t)}function Ko(e,t){var i=t.dyn_tree,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems,s,o,l=-1,c;for(e.heap_len=0,e.heap_max=fp,s=0;s<a;s++)i[s*2]!==0?(e.heap[++e.heap_len]=l=s,e.depth[s]=0):i[s*2+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,i[c*2]=1,e.depth[c]=0,e.opt_len--,r&&(e.static_len-=n[c*2+1]);for(t.max_code=l,s=e.heap_len>>1;s>=1;s--)Yo(e,i,s);c=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Yo(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,i[c*2]=i[s*2]+i[o*2],e.depth[c]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,i[s*2+1]=i[o*2+1]=c,e.heap[1]=c++,Yo(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],uv(e,t),Ep(i,l,e.bl_count)}function cp(e,t,i){var n,r=-1,a,s=t[1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),t[(i+1)*2+1]=65535,n=0;n<=i;n++)a=s,s=t[(n+1)*2+1],!(++o<l&&a===s)&&(o<c?e.bl_tree[a*2]+=o:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[hp*2]++):o<=10?e.bl_tree[gp*2]++:e.bl_tree[mp*2]++,o=0,r=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))}function dp(e,t,i){var n,r=-1,a,s=t[1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),n=0;n<=i;n++)if(a=s,s=t[(n+1)*2+1],!(++o<l&&a===s)){if(o<c)do Fe(e,a,e.bl_tree);while(--o!==0);else a!==0?(a!==r&&(Fe(e,a,e.bl_tree),o--),Fe(e,hp,e.bl_tree),fe(e,o-3,2)):o<=10?(Fe(e,gp,e.bl_tree),fe(e,o-3,3)):(Fe(e,mp,e.bl_tree),fe(e,o-11,7));o=0,r=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}}function hv(e){var t;for(cp(e,e.dyn_ltree,e.l_desc.max_code),cp(e,e.dyn_dtree,e.d_desc.max_code),Ko(e,e.bl_desc),t=Zo-1;t>=3&&e.bl_tree[bp[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function gv(e,t,i,n){var r;for(fe(e,t-257,5),fe(e,i-1,5),fe(e,n-4,4),r=0;r<n;r++)fe(e,e.bl_tree[bp[r]*2+1],3);dp(e,e.dyn_ltree,t-1),dp(e,e.dyn_dtree,i-1)}function mv(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return ap;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return sp;for(i=32;i<zn;i++)if(e.dyn_ltree[i*2]!==0)return sp;return ap}var up=!1;function bv(e){up||(pv(),up=!0),e.l_desc=new Wo(e.dyn_ltree,yp),e.d_desc=new Wo(e.dyn_dtree,vp),e.bl_desc=new Wo(e.bl_tree,xp),e.bi_buf=0,e.bi_valid=0,Sp(e)}function Cp(e,t,i,n){fe(e,(nv<<1)+(n?1:0),3),fv(e,t,i,!0)}function yv(e){fe(e,pp<<1,3),Fe(e,Jo,st),dv(e)}function vv(e,t,i,n){var r,a,s=0;e.level>0?(e.strm.data_type===iv&&(e.strm.data_type=mv(e)),Ko(e,e.l_desc),Ko(e,e.d_desc),s=hv(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=i+5,i+4<=r&&t!==-1?Cp(e,t,i,n):e.strategy===tv||a===r?(fe(e,(pp<<1)+(n?1:0),3),lp(e,st,Mn)):(fe(e,(rv<<1)+(n?1:0),3),gv(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),lp(e,e.dyn_ltree,e.dyn_dtree)),Sp(e),n&&Ap(e)}function xv(e,t,i){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=i&255,e.last_lit++,t===0?e.dyn_ltree[i*2]++:(e.matches++,t--,e.dyn_ltree[(jn[i]+zn+1)*2]++,e.dyn_dtree[wp(t)*2]++),e.last_lit===e.lit_bufsize-1}Oi._tr_init=bv;Oi._tr_stored_block=Cp;Oi._tr_flush_block=vv;Oi._tr_tally=xv;Oi._tr_align=yv});var el=k((J1,kp)=>{"use strict";function wv(e,t,i,n){for(var r=e&65535|0,a=e>>>16&65535|0,s=0;i!==0;){s=i>2e3?2e3:i,i-=s;do r=r+t[n++]|0,a=a+r|0;while(--s);r%=65521,a%=65521}return r|a<<16|0}kp.exports=wv});var tl=k((Q1,Lp)=>{"use strict";function _v(){for(var e,t=[],i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[i]=e}return t}var Ev=_v();function Sv(e,t,i,n){var r=Ev,a=n+i;e^=-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}Lp.exports=Sv});var wa=k((eE,Op)=>{"use strict";Op.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Bp=k(Ue=>{"use strict";var pe=at(),we=Tp(),Pp=el(),Et=tl(),Av=wa(),Xt=0,Cv=1,Tv=3,kt=4,Ip=5,$e=0,Mp=1,_e=-2,kv=-3,il=-5,Lv=-1,Ov=1,_a=2,Iv=3,Mv=4,Rv=0,Pv=2,Ca=8,jv=9,Dv=15,zv=8,Nv=29,Bv=256,rl=Bv+1+Nv,Fv=30,Hv=19,$v=2*rl+1,Uv=15,N=3,Ct=258,Le=Ct+N+1,qv=32,Ta=42,al=69,Ea=73,Sa=91,Aa=103,Yt=113,Bn=666,ie=1,Fn=2,Vt=3,Ri=4,Gv=3;function Tt(e,t){return e.msg=Av[t],t}function Rp(e){return(e<<1)-(e>4?9:0)}function At(e){for(var t=e.length;--t>=0;)e[t]=0}function St(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(pe.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,t.pending===0&&(t.pending_out=0))}function ae(e,t){we._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,St(e.strm)}function F(e,t){e.pending_buf[e.pending++]=t}function Nn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Wv(e,t,i,n){var r=e.avail_in;return r>n&&(r=n),r===0?0:(e.avail_in-=r,pe.arraySet(t,e.input,e.next_in,r,i),e.state.wrap===1?e.adler=Pp(e.adler,t,r,i):e.state.wrap===2&&(e.adler=Et(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function jp(e,t){var i=e.max_chain_length,n=e.strstart,r,a,s=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-Le?e.strstart-(e.w_size-Le):0,c=e.window,d=e.w_mask,u=e.prev,p=e.strstart+Ct,f=c[n+s-1],m=c[n+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(r=t,!(c[r+s]!==m||c[r+s-1]!==f||c[r]!==c[n]||c[++r]!==c[n+1])){n+=2,r++;do;while(c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&c[++n]===c[++r]&&n<p);if(a=Ct-(p-n),n=p-Ct,a>s){if(e.match_start=t,s=a,a>=o)break;f=c[n+s-1],m=c[n+s]}}while((t=u[t&d])>l&&--i!==0);return s<=e.lookahead?s:e.lookahead}function Kt(e){var t=e.w_size,i,n,r,a,s;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Le)){pe.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,i=n;do r=e.head[--i],e.head[i]=r>=t?r-t:0;while(--n);n=t,i=n;do r=e.prev[--i],e.prev[i]=r>=t?r-t:0;while(--n);a+=t}if(e.strm.avail_in===0)break;if(n=Wv(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=N)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+N-1])&e.hash_mask,e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<N)););}while(e.lookahead<Le&&e.strm.avail_in!==0)}function Yv(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Kt(e),e.lookahead===0&&t===Xt)return ie;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+i;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,ae(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Le&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=0,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):(e.strstart>e.block_start&&(ae(e,!1),e.strm.avail_out===0),ie)}function nl(e,t){for(var i,n;;){if(e.lookahead<Le){if(Kt(e),e.lookahead<Le&&t===Xt)return ie;if(e.lookahead===0)break}if(i=0,e.lookahead>=N&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),i!==0&&e.strstart-i<=e.w_size-Le&&(e.match_length=jp(e,i)),e.match_length>=N)if(n=we._tr_tally(e,e.strstart-e.match_start,e.match_length-N),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=N){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=we._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=e.strstart<N-1?e.strstart:N-1,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function Ii(e,t){for(var i,n,r;;){if(e.lookahead<Le){if(Kt(e),e.lookahead<Le&&t===Xt)return ie;if(e.lookahead===0)break}if(i=0,e.lookahead>=N&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=N-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Le&&(e.match_length=jp(e,i),e.match_length<=5&&(e.strategy===Ov||e.match_length===N&&e.strstart-e.match_start>4096)&&(e.match_length=N-1)),e.prev_length>=N&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-N,n=we._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-N),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+N-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=N-1,e.strstart++,n&&(ae(e,!1),e.strm.avail_out===0))return ie}else if(e.match_available){if(n=we._tr_tally(e,0,e.window[e.strstart-1]),n&&ae(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ie}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=we._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<N-1?e.strstart:N-1,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function Vv(e,t){for(var i,n,r,a,s=e.window;;){if(e.lookahead<=Ct){if(Kt(e),e.lookahead<=Ct&&t===Xt)return ie;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=N&&e.strstart>0&&(r=e.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){a=e.strstart+Ct;do;while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<a);e.match_length=Ct-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=N?(i=we._tr_tally(e,1,e.match_length-N),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=we._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=0,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function Kv(e,t){for(var i;;){if(e.lookahead===0&&(Kt(e),e.lookahead===0)){if(t===Xt)return ie;break}if(e.match_length=0,i=we._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ae(e,!1),e.strm.avail_out===0))return ie}return e.insert=0,t===kt?(ae(e,!0),e.strm.avail_out===0?Vt:Ri):e.last_lit&&(ae(e,!1),e.strm.avail_out===0)?ie:Fn}function He(e,t,i,n,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=n,this.func=r}var Mi;Mi=[new He(0,0,0,0,Yv),new He(4,4,8,4,nl),new He(4,5,16,8,nl),new He(4,6,32,32,nl),new He(4,4,16,16,Ii),new He(8,16,32,32,Ii),new He(8,16,128,128,Ii),new He(8,32,128,256,Ii),new He(32,128,258,1024,Ii),new He(32,258,258,4096,Ii)];function Xv(e){e.window_size=2*e.w_size,At(e.head),e.max_lazy_match=Mi[e.level].max_lazy,e.good_match=Mi[e.level].good_length,e.nice_match=Mi[e.level].nice_length,e.max_chain_length=Mi[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=N-1,e.match_available=0,e.ins_h=0}function Zv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ca,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new pe.Buf16($v*2),this.dyn_dtree=new pe.Buf16((2*Fv+1)*2),this.bl_tree=new pe.Buf16((2*Hv+1)*2),At(this.dyn_ltree),At(this.dyn_dtree),At(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new pe.Buf16(Uv+1),this.heap=new pe.Buf16(2*rl+1),At(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new pe.Buf16(2*rl+1),At(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Dp(e){var t;return!e||!e.state?Tt(e,_e):(e.total_in=e.total_out=0,e.data_type=Pv,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Ta:Yt,e.adler=t.wrap===2?0:1,t.last_flush=Xt,we._tr_init(t),$e)}function zp(e){var t=Dp(e);return t===$e&&Xv(e.state),t}function Jv(e,t){return!e||!e.state||e.state.wrap!==2?_e:(e.state.gzhead=t,$e)}function Np(e,t,i,n,r,a){if(!e)return _e;var s=1;if(t===Lv&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>jv||i!==Ca||n<8||n>15||t<0||t>9||a<0||a>Mv)return Tt(e,_e);n===8&&(n=9);var o=new Zv;return e.state=o,o.strm=e,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+N-1)/N),o.window=new pe.Buf8(o.w_size*2),o.head=new pe.Buf16(o.hash_size),o.prev=new pe.Buf16(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new pe.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=a,o.method=i,zp(e)}function Qv(e,t){return Np(e,t,Ca,Dv,zv,Rv)}function ex(e,t){var i,n,r,a;if(!e||!e.state||t>Ip||t<0)return e?Tt(e,_e):_e;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Bn&&t!==kt)return Tt(e,e.avail_out===0?il:_e);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===Ta)if(n.wrap===2)e.adler=0,F(n,31),F(n,139),F(n,8),n.gzhead?(F(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),F(n,n.gzhead.time&255),F(n,n.gzhead.time>>8&255),F(n,n.gzhead.time>>16&255),F(n,n.gzhead.time>>24&255),F(n,n.level===9?2:n.strategy>=_a||n.level<2?4:0),F(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(F(n,n.gzhead.extra.length&255),F(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Et(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=al):(F(n,0),F(n,0),F(n,0),F(n,0),F(n,0),F(n,n.level===9?2:n.strategy>=_a||n.level<2?4:0),F(n,Gv),n.status=Yt);else{var s=Ca+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=_a||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=qv),s+=31-s%31,n.status=Yt,Nn(n,s),n.strstart!==0&&(Nn(n,e.adler>>>16),Nn(n,e.adler&65535)),e.adler=1}if(n.status===al)if(n.gzhead.extra){for(r=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),St(e),r=n.pending,n.pending===n.pending_buf_size));)F(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Ea)}else n.status=Ea;if(n.status===Ea)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),St(e),r=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,F(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.gzindex=0,n.status=Sa)}else n.status=Sa;if(n.status===Sa)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),St(e),r=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,F(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=Et(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.status=Aa)}else n.status=Aa;if(n.status===Aa&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&St(e),n.pending+2<=n.pending_buf_size&&(F(n,e.adler&255),F(n,e.adler>>8&255),e.adler=0,n.status=Yt)):n.status=Yt),n.pending!==0){if(St(e),e.avail_out===0)return n.last_flush=-1,$e}else if(e.avail_in===0&&Rp(t)<=Rp(i)&&t!==kt)return Tt(e,il);if(n.status===Bn&&e.avail_in!==0)return Tt(e,il);if(e.avail_in!==0||n.lookahead!==0||t!==Xt&&n.status!==Bn){var l=n.strategy===_a?Kv(n,t):n.strategy===Iv?Vv(n,t):Mi[n.level].func(n,t);if((l===Vt||l===Ri)&&(n.status=Bn),l===ie||l===Vt)return e.avail_out===0&&(n.last_flush=-1),$e;if(l===Fn&&(t===Cv?we._tr_align(n):t!==Ip&&(we._tr_stored_block(n,0,0,!1),t===Tv&&(At(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),St(e),e.avail_out===0))return n.last_flush=-1,$e}return t!==kt?$e:n.wrap<=0?Mp:(n.wrap===2?(F(n,e.adler&255),F(n,e.adler>>8&255),F(n,e.adler>>16&255),F(n,e.adler>>24&255),F(n,e.total_in&255),F(n,e.total_in>>8&255),F(n,e.total_in>>16&255),F(n,e.total_in>>24&255)):(Nn(n,e.adler>>>16),Nn(n,e.adler&65535)),St(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?$e:Mp)}function tx(e){var t;return!e||!e.state?_e:(t=e.state.status,t!==Ta&&t!==al&&t!==Ea&&t!==Sa&&t!==Aa&&t!==Yt&&t!==Bn?Tt(e,_e):(e.state=null,t===Yt?Tt(e,kv):$e))}function ix(e,t){var i=t.length,n,r,a,s,o,l,c,d;if(!e||!e.state||(n=e.state,s=n.wrap,s===2||s===1&&n.status!==Ta||n.lookahead))return _e;for(s===1&&(e.adler=Pp(e.adler,t,i,0)),n.wrap=0,i>=n.w_size&&(s===0&&(At(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new pe.Buf8(n.w_size),pe.arraySet(d,t,i-n.w_size,n.w_size,0),t=d,i=n.w_size),o=e.avail_in,l=e.next_in,c=e.input,e.avail_in=i,e.next_in=0,e.input=t,Kt(n);n.lookahead>=N;){r=n.strstart,a=n.lookahead-(N-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+N-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++;while(--a);n.strstart=r,n.lookahead=N-1,Kt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=N-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=o,n.wrap=s,$e}Ue.deflateInit=Qv;Ue.deflateInit2=Np;Ue.deflateReset=zp;Ue.deflateResetKeep=Dp;Ue.deflateSetHeader=Jv;Ue.deflate=ex;Ue.deflateEnd=tx;Ue.deflateSetDictionary=ix;Ue.deflateInfo="pako deflate (from Nodeca project)"});var sl=k(Pi=>{"use strict";var ka=at(),Fp=!0,Hp=!0;try{String.fromCharCode.apply(null,[0])}catch{Fp=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Hp=!1}var Hn=new ka.Buf8(256);for(ot=0;ot<256;ot++)Hn[ot]=ot>=252?6:ot>=248?5:ot>=240?4:ot>=224?3:ot>=192?2:1;var ot;Hn[254]=Hn[254]=1;Pi.string2buf=function(e){var t,i,n,r,a,s=e.length,o=0;for(r=0;r<s;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new ka.Buf8(o),a=0,r=0;a<o;r++)i=e.charCodeAt(r),(i&64512)===55296&&r+1<s&&(n=e.charCodeAt(r+1),(n&64512)===56320&&(i=65536+(i-55296<<10)+(n-56320),r++)),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>>6,t[a++]=128|i&63):i<65536?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|i&63):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|i&63);return t};function $p(e,t){if(t<65534&&(e.subarray&&Hp||!e.subarray&&Fp))return String.fromCharCode.apply(null,ka.shrinkBuf(e,t));for(var i="",n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i}Pi.buf2binstring=function(e){return $p(e,e.length)};Pi.binstring2buf=function(e){for(var t=new ka.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t};Pi.buf2string=function(e,t){var i,n,r,a,s=t||e.length,o=new Array(s*2);for(n=0,i=0;i<s;){if(r=e[i++],r<128){o[n++]=r;continue}if(a=Hn[r],a>4){o[n++]=65533,i+=a-1;continue}for(r&=a===2?31:a===3?15:7;a>1&&i<s;)r=r<<6|e[i++]&63,a--;if(a>1){o[n++]=65533;continue}r<65536?o[n++]=r:(r-=65536,o[n++]=55296|r>>10&1023,o[n++]=56320|r&1023)}return $p(o,n)};Pi.utf8border=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&(e[i]&192)===128;)i--;return i<0||i===0?t:i+Hn[e[i]]>t?i:t}});var ol=k((nE,Up)=>{"use strict";function nx(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Up.exports=nx});var Yp=k(qn=>{"use strict";var $n=Bp(),Un=at(),cl=sl(),dl=wa(),rx=ol(),Wp=Object.prototype.toString,ax=0,ll=4,ji=0,qp=1,Gp=2,sx=-1,ox=0,lx=8;function Zt(e){if(!(this instanceof Zt))return new Zt(e);this.options=Un.assign({level:sx,method:lx,chunkSize:16384,windowBits:15,memLevel:8,strategy:ox,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new rx,this.strm.avail_out=0;var i=$n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==ji)throw new Error(dl[i]);if(t.header&&$n.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=cl.string2buf(t.dictionary):Wp.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,i=$n.deflateSetDictionary(this.strm,n),i!==ji)throw new Error(dl[i]);this._dict_set=!0}}Zt.prototype.push=function(e,t){var i=this.strm,n=this.options.chunkSize,r,a;if(this.ended)return!1;a=t===~~t?t:t===!0?ll:ax,typeof e=="string"?i.input=cl.string2buf(e):Wp.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new Un.Buf8(n),i.next_out=0,i.avail_out=n),r=$n.deflate(i,a),r!==qp&&r!==ji)return this.onEnd(r),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(a===ll||a===Gp))&&(this.options.to==="string"?this.onData(cl.buf2binstring(Un.shrinkBuf(i.output,i.next_out))):this.onData(Un.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&r!==qp);return a===ll?(r=$n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ji):(a===Gp&&(this.onEnd(ji),i.avail_out=0),!0)};Zt.prototype.onData=function(e){this.chunks.push(e)};Zt.prototype.onEnd=function(e){e===ji&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ul(e,t){var i=new Zt(t);if(i.push(e,!0),i.err)throw i.msg||dl[i.err];return i.result}function cx(e,t){return t=t||{},t.raw=!0,ul(e,t)}function dx(e,t){return t=t||{},t.gzip=!0,ul(e,t)}qn.Deflate=Zt;qn.deflate=ul;qn.deflateRaw=cx;qn.gzip=dx});var Kp=k((aE,Vp)=>{"use strict";var La=30,ux=12;Vp.exports=function(t,i){var n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,E,A,_,T,M,S;n=t.state,r=t.next_in,M=t.input,a=r+(t.avail_in-5),s=t.next_out,S=t.output,o=s-(i-t.avail_out),l=s+(t.avail_out-257),c=n.dmax,d=n.wsize,u=n.whave,p=n.wnext,f=n.window,m=n.hold,h=n.bits,g=n.lencode,b=n.distcode,y=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;e:do{h<15&&(m+=M[r++]<<h,h+=8,m+=M[r++]<<h,h+=8),x=g[m&y];t:for(;;){if(w=x>>>24,m>>>=w,h-=w,w=x>>>16&255,w===0)S[s++]=x&65535;else if(w&16){E=x&65535,w&=15,w&&(h<w&&(m+=M[r++]<<h,h+=8),E+=m&(1<<w)-1,m>>>=w,h-=w),h<15&&(m+=M[r++]<<h,h+=8,m+=M[r++]<<h,h+=8),x=b[m&v];i:for(;;){if(w=x>>>24,m>>>=w,h-=w,w=x>>>16&255,w&16){if(A=x&65535,w&=15,h<w&&(m+=M[r++]<<h,h+=8,h<w&&(m+=M[r++]<<h,h+=8)),A+=m&(1<<w)-1,A>c){t.msg="invalid distance too far back",n.mode=La;break e}if(m>>>=w,h-=w,w=s-o,A>w){if(w=A-w,w>u&&n.sane){t.msg="invalid distance too far back",n.mode=La;break e}if(_=0,T=f,p===0){if(_+=d-w,w<E){E-=w;do S[s++]=f[_++];while(--w);_=s-A,T=S}}else if(p<w){if(_+=d+p-w,w-=p,w<E){E-=w;do S[s++]=f[_++];while(--w);if(_=0,p<E){w=p,E-=w;do S[s++]=f[_++];while(--w);_=s-A,T=S}}}else if(_+=p-w,w<E){E-=w;do S[s++]=f[_++];while(--w);_=s-A,T=S}for(;E>2;)S[s++]=T[_++],S[s++]=T[_++],S[s++]=T[_++],E-=3;E&&(S[s++]=T[_++],E>1&&(S[s++]=T[_++]))}else{_=s-A;do S[s++]=S[_++],S[s++]=S[_++],S[s++]=S[_++],E-=3;while(E>2);E&&(S[s++]=S[_++],E>1&&(S[s++]=S[_++]))}}else if((w&64)===0){x=b[(x&65535)+(m&(1<<w)-1)];continue i}else{t.msg="invalid distance code",n.mode=La;break e}break}}else if((w&64)===0){x=g[(x&65535)+(m&(1<<w)-1)];continue t}else if(w&32){n.mode=ux;break e}else{t.msg="invalid literal/length code",n.mode=La;break e}break}}while(r<a&&s<l);E=h>>3,r-=E,h-=E<<3,m&=(1<<h)-1,t.next_in=r,t.next_out=s,t.avail_in=r<a?5+(a-r):5-(r-a),t.avail_out=s<l?257+(l-s):257-(s-l),n.hold=m,n.bits=h}});var nf=k((sE,tf)=>{"use strict";var Xp=at(),Di=15,Zp=852,Jp=592,Qp=0,pl=1,ef=2,px=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],fx=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],hx=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],gx=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];tf.exports=function(t,i,n,r,a,s,o,l){var c=l.bits,d=0,u=0,p=0,f=0,m=0,h=0,g=0,b=0,y=0,v=0,x,w,E,A,_,T=null,M=0,S,L=new Xp.Buf16(Di+1),z=new Xp.Buf16(Di+1),D=null,B=0,O,P,C;for(d=0;d<=Di;d++)L[d]=0;for(u=0;u<r;u++)L[i[n+u]]++;for(m=c,f=Di;f>=1&&L[f]===0;f--);if(m>f&&(m=f),f===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(p=1;p<f&&L[p]===0;p++);for(m<p&&(m=p),b=1,d=1;d<=Di;d++)if(b<<=1,b-=L[d],b<0)return-1;if(b>0&&(t===Qp||f!==1))return-1;for(z[1]=0,d=1;d<Di;d++)z[d+1]=z[d]+L[d];for(u=0;u<r;u++)i[n+u]!==0&&(o[z[i[n+u]]++]=u);if(t===Qp?(T=D=o,S=19):t===pl?(T=px,M-=257,D=fx,B-=257,S=256):(T=hx,D=gx,S=-1),v=0,u=0,d=p,_=s,h=m,g=0,E=-1,y=1<<m,A=y-1,t===pl&&y>Zp||t===ef&&y>Jp)return 1;for(;;){O=d-g,o[u]<S?(P=0,C=o[u]):o[u]>S?(P=D[B+o[u]],C=T[M+o[u]]):(P=96,C=0),x=1<<d-g,w=1<<h,p=w;do w-=x,a[_+(v>>g)+w]=O<<24|P<<16|C|0;while(w!==0);for(x=1<<d-1;v&x;)x>>=1;if(x!==0?(v&=x-1,v+=x):v=0,u++,--L[d]===0){if(d===f)break;d=i[n+o[u]]}if(d>m&&(v&A)!==E){for(g===0&&(g=m),_+=p,h=d-g,b=1<<h;h+g<f&&(b-=L[h+g],!(b<=0));)h++,b<<=1;if(y+=1<<h,t===pl&&y>Zp||t===ef&&y>Jp)return 1;E=v&A,a[E]=m<<24|h<<16|_-s|0}}return v!==0&&(a[_+v]=d-g<<24|64<<16|0),l.bits=m,0}});var Nf=k(Oe=>{"use strict";var me=at(),yl=el(),qe=tl(),mx=Kp(),Gn=nf(),bx=0,Lf=1,Of=2,rf=4,yx=5,Oa=6,Jt=0,vx=1,xx=2,Ee=-2,If=-3,vl=-4,wx=-5,af=8,Mf=1,sf=2,of=3,lf=4,cf=5,df=6,uf=7,pf=8,ff=9,hf=10,Ra=11,lt=12,fl=13,gf=14,hl=15,mf=16,bf=17,yf=18,vf=19,Ia=20,Ma=21,xf=22,wf=23,_f=24,Ef=25,Sf=26,gl=27,Af=28,Cf=29,W=30,xl=31,_x=32,Ex=852,Sx=592,Ax=15,Cx=Ax;function Tf(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function Tx(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new me.Buf16(320),this.work=new me.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Rf(e){var t;return!e||!e.state?Ee:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Mf,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new me.Buf32(Ex),t.distcode=t.distdyn=new me.Buf32(Sx),t.sane=1,t.back=-1,Jt)}function Pf(e){var t;return!e||!e.state?Ee:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Rf(e))}function jf(e,t){var i,n;return!e||!e.state||(n=e.state,t<0?(i=0,t=-t):(i=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Ee:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,Pf(e))}function Df(e,t){var i,n;return e?(n=new Tx,e.state=n,n.window=null,i=jf(e,t),i!==Jt&&(e.state=null),i):Ee}function kx(e){return Df(e,Cx)}var kf=!0,ml,bl;function Lx(e){if(kf){var t;for(ml=new me.Buf32(512),bl=new me.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Gn(Lf,e.lens,0,288,ml,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Gn(Of,e.lens,0,32,bl,0,e.work,{bits:5}),kf=!1}e.lencode=ml,e.lenbits=9,e.distcode=bl,e.distbits=5}function zf(e,t,i,n){var r,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new me.Buf8(a.wsize)),n>=a.wsize?(me.arraySet(a.window,t,i-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>n&&(r=n),me.arraySet(a.window,t,i-n,r,a.wnext),n-=r,n?(me.arraySet(a.window,t,i-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}function Ox(e,t){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g=0,b,y,v,x,w,E,A,_,T=new me.Buf8(4),M,S,L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Ee;i=e.state,i.mode===lt&&(i.mode=fl),s=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,c=i.hold,d=i.bits,u=o,p=l,_=Jt;e:for(;;)switch(i.mode){case Mf:if(i.wrap===0){i.mode=fl;break}for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.wrap&2&&c===35615){i.check=0,T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0),c=0,d=0,i.mode=sf;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",i.mode=W;break}if((c&15)!==af){e.msg="unknown compression method",i.mode=W;break}if(c>>>=4,d-=4,A=(c&15)+8,i.wbits===0)i.wbits=A;else if(A>i.wbits){e.msg="invalid window size",i.mode=W;break}i.dmax=1<<A,e.adler=i.check=1,i.mode=c&512?hf:lt,c=0,d=0;break;case sf:for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.flags=c,(i.flags&255)!==af){e.msg="unknown compression method",i.mode=W;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=W;break}i.head&&(i.head.text=c>>8&1),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0)),c=0,d=0,i.mode=of;case of:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.head&&(i.head.time=c),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,T[2]=c>>>16&255,T[3]=c>>>24&255,i.check=qe(i.check,T,4,0)),c=0,d=0,i.mode=lf;case lf:for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.head&&(i.head.xflags=c&255,i.head.os=c>>8),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0)),c=0,d=0,i.mode=cf;case cf:if(i.flags&1024){for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.length=c,i.head&&(i.head.extra_len=c),i.flags&512&&(T[0]=c&255,T[1]=c>>>8&255,i.check=qe(i.check,T,2,0)),c=0,d=0}else i.head&&(i.head.extra=null);i.mode=df;case df:if(i.flags&1024&&(f=i.length,f>o&&(f=o),f&&(i.head&&(A=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),me.arraySet(i.head.extra,n,a,f,A)),i.flags&512&&(i.check=qe(i.check,n,f,a)),o-=f,a+=f,i.length-=f),i.length))break e;i.length=0,i.mode=uf;case uf:if(i.flags&2048){if(o===0)break e;f=0;do A=n[a+f++],i.head&&A&&i.length<65536&&(i.head.name+=String.fromCharCode(A));while(A&&f<o);if(i.flags&512&&(i.check=qe(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=pf;case pf:if(i.flags&4096){if(o===0)break e;f=0;do A=n[a+f++],i.head&&A&&i.length<65536&&(i.head.comment+=String.fromCharCode(A));while(A&&f<o);if(i.flags&512&&(i.check=qe(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.comment=null);i.mode=ff;case ff:if(i.flags&512){for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(c!==(i.check&65535)){e.msg="header crc mismatch",i.mode=W;break}c=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=lt;break;case hf:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}e.adler=i.check=Tf(c),c=0,d=0,i.mode=Ra;case Ra:if(i.havedict===0)return e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=c,i.bits=d,xx;e.adler=i.check=1,i.mode=lt;case lt:if(t===yx||t===Oa)break e;case fl:if(i.last){c>>>=d&7,d-=d&7,i.mode=gl;break}for(;d<3;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}switch(i.last=c&1,c>>>=1,d-=1,c&3){case 0:i.mode=gf;break;case 1:if(Lx(i),i.mode=Ia,t===Oa){c>>>=2,d-=2;break e}break;case 2:i.mode=bf;break;case 3:e.msg="invalid block type",i.mode=W}c>>>=2,d-=2;break;case gf:for(c>>>=d&7,d-=d&7;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",i.mode=W;break}if(i.length=c&65535,c=0,d=0,i.mode=hl,t===Oa)break e;case hl:i.mode=mf;case mf:if(f=i.length,f){if(f>o&&(f=o),f>l&&(f=l),f===0)break e;me.arraySet(r,n,a,f,s),o-=f,a+=f,l-=f,s+=f,i.length-=f;break}i.mode=lt;break;case bf:for(;d<14;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.nlen=(c&31)+257,c>>>=5,d-=5,i.ndist=(c&31)+1,c>>>=5,d-=5,i.ncode=(c&15)+4,c>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=W;break}i.have=0,i.mode=yf;case yf:for(;i.have<i.ncode;){for(;d<3;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.lens[L[i.have++]]=c&7,c>>>=3,d-=3}for(;i.have<19;)i.lens[L[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,M={bits:i.lenbits},_=Gn(bx,i.lens,0,19,i.lencode,0,i.work,M),i.lenbits=M.bits,_){e.msg="invalid code lengths set",i.mode=W;break}i.have=0,i.mode=vf;case vf:for(;i.have<i.nlen+i.ndist;){for(;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,y=g>>>16&255,v=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(v<16)c>>>=b,d-=b,i.lens[i.have++]=v;else{if(v===16){for(S=b+2;d<S;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(c>>>=b,d-=b,i.have===0){e.msg="invalid bit length repeat",i.mode=W;break}A=i.lens[i.have-1],f=3+(c&3),c>>>=2,d-=2}else if(v===17){for(S=b+3;d<S;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=b,d-=b,A=0,f=3+(c&7),c>>>=3,d-=3}else{for(S=b+7;d<S;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=b,d-=b,A=0,f=11+(c&127),c>>>=7,d-=7}if(i.have+f>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=W;break}for(;f--;)i.lens[i.have++]=A}}if(i.mode===W)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=W;break}if(i.lenbits=9,M={bits:i.lenbits},_=Gn(Lf,i.lens,0,i.nlen,i.lencode,0,i.work,M),i.lenbits=M.bits,_){e.msg="invalid literal/lengths set",i.mode=W;break}if(i.distbits=6,i.distcode=i.distdyn,M={bits:i.distbits},_=Gn(Of,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,M),i.distbits=M.bits,_){e.msg="invalid distances set",i.mode=W;break}if(i.mode=Ia,t===Oa)break e;case Ia:i.mode=Ma;case Ma:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=c,i.bits=d,mx(e,p),s=e.next_out,r=e.output,l=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,c=i.hold,d=i.bits,i.mode===lt&&(i.back=-1);break}for(i.back=0;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,y=g>>>16&255,v=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(y&&(y&240)===0){for(x=b,w=y,E=v;g=i.lencode[E+((c&(1<<x+w)-1)>>x)],b=g>>>24,y=g>>>16&255,v=g&65535,!(x+b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=x,d-=x,i.back+=x}if(c>>>=b,d-=b,i.back+=b,i.length=v,y===0){i.mode=Sf;break}if(y&32){i.back=-1,i.mode=lt;break}if(y&64){e.msg="invalid literal/length code",i.mode=W;break}i.extra=y&15,i.mode=xf;case xf:if(i.extra){for(S=i.extra;d<S;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.length+=c&(1<<i.extra)-1,c>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=wf;case wf:for(;g=i.distcode[c&(1<<i.distbits)-1],b=g>>>24,y=g>>>16&255,v=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if((y&240)===0){for(x=b,w=y,E=v;g=i.distcode[E+((c&(1<<x+w)-1)>>x)],b=g>>>24,y=g>>>16&255,v=g&65535,!(x+b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}c>>>=x,d-=x,i.back+=x}if(c>>>=b,d-=b,i.back+=b,y&64){e.msg="invalid distance code",i.mode=W;break}i.offset=v,i.extra=y&15,i.mode=_f;case _f:if(i.extra){for(S=i.extra;d<S;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.offset+=c&(1<<i.extra)-1,c>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=W;break}i.mode=Ef;case Ef:if(l===0)break e;if(f=p-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=W;break}f>i.wnext?(f-=i.wnext,m=i.wsize-f):m=i.wnext-f,f>i.length&&(f=i.length),h=i.window}else h=r,m=s-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do r[s++]=h[m++];while(--f);i.length===0&&(i.mode=Ma);break;case Sf:if(l===0)break e;r[s++]=i.length,l--,i.mode=Ma;break;case gl:if(i.wrap){for(;d<32;){if(o===0)break e;o--,c|=n[a++]<<d,d+=8}if(p-=l,e.total_out+=p,i.total+=p,p&&(e.adler=i.check=i.flags?qe(i.check,r,p,s-p):yl(i.check,r,p,s-p)),p=l,(i.flags?c:Tf(c))!==i.check){e.msg="incorrect data check",i.mode=W;break}c=0,d=0}i.mode=Af;case Af:if(i.wrap&&i.flags){for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(c!==(i.total&4294967295)){e.msg="incorrect length check",i.mode=W;break}c=0,d=0}i.mode=Cf;case Cf:_=vx;break e;case W:_=If;break e;case xl:return vl;case _x:default:return Ee}return e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,i.hold=c,i.bits=d,(i.wsize||p!==e.avail_out&&i.mode<W&&(i.mode<gl||t!==rf))&&zf(e,e.output,e.next_out,p-e.avail_out)?(i.mode=xl,vl):(u-=e.avail_in,p-=e.avail_out,e.total_in+=u,e.total_out+=p,i.total+=p,i.wrap&&p&&(e.adler=i.check=i.flags?qe(i.check,r,p,e.next_out-p):yl(i.check,r,p,e.next_out-p)),e.data_type=i.bits+(i.last?64:0)+(i.mode===lt?128:0)+(i.mode===Ia||i.mode===hl?256:0),(u===0&&p===0||t===rf)&&_===Jt&&(_=wx),_)}function Ix(e){if(!e||!e.state)return Ee;var t=e.state;return t.window&&(t.window=null),e.state=null,Jt}function Mx(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?Ee:(i.head=t,t.done=!1,Jt)}function Rx(e,t){var i=t.length,n,r,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Ra)?Ee:n.mode===Ra&&(r=1,r=yl(r,t,i,0),r!==n.check)?If:(a=zf(e,t,i,i),a?(n.mode=xl,vl):(n.havedict=1,Jt))}Oe.inflateReset=Pf;Oe.inflateReset2=jf;Oe.inflateResetKeep=Rf;Oe.inflateInit=kx;Oe.inflateInit2=Df;Oe.inflate=Ox;Oe.inflateEnd=Ix;Oe.inflateGetHeader=Mx;Oe.inflateSetDictionary=Rx;Oe.inflateInfo="pako inflate (from Nodeca project)"});var wl=k((lE,Bf)=>{"use strict";Bf.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Hf=k((cE,Ff)=>{"use strict";function Px(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Ff.exports=Px});var Uf=k(Yn=>{"use strict";var zi=Nf(),Wn=at(),Pa=sl(),X=wl(),_l=wa(),jx=ol(),Dx=Hf(),$f=Object.prototype.toString;function Qt(e){if(!(this instanceof Qt))return new Qt(e);this.options=Wn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new jx,this.strm.avail_out=0;var i=zi.inflateInit2(this.strm,t.windowBits);if(i!==X.Z_OK)throw new Error(_l[i]);if(this.header=new Dx,zi.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Pa.string2buf(t.dictionary):$f.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=zi.inflateSetDictionary(this.strm,t.dictionary),i!==X.Z_OK)))throw new Error(_l[i])}Qt.prototype.push=function(e,t){var i=this.strm,n=this.options.chunkSize,r=this.options.dictionary,a,s,o,l,c,d=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?X.Z_FINISH:X.Z_NO_FLUSH,typeof e=="string"?i.input=Pa.binstring2buf(e):$f.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new Wn.Buf8(n),i.next_out=0,i.avail_out=n),a=zi.inflate(i,X.Z_NO_FLUSH),a===X.Z_NEED_DICT&&r&&(a=zi.inflateSetDictionary(this.strm,r)),a===X.Z_BUF_ERROR&&d===!0&&(a=X.Z_OK,d=!1),a!==X.Z_STREAM_END&&a!==X.Z_OK)return this.onEnd(a),this.ended=!0,!1;i.next_out&&(i.avail_out===0||a===X.Z_STREAM_END||i.avail_in===0&&(s===X.Z_FINISH||s===X.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Pa.utf8border(i.output,i.next_out),l=i.next_out-o,c=Pa.buf2string(i.output,o),i.next_out=l,i.avail_out=n-l,l&&Wn.arraySet(i.output,i.output,o,l,0),this.onData(c)):this.onData(Wn.shrinkBuf(i.output,i.next_out))),i.avail_in===0&&i.avail_out===0&&(d=!0)}while((i.avail_in>0||i.avail_out===0)&&a!==X.Z_STREAM_END);return a===X.Z_STREAM_END&&(s=X.Z_FINISH),s===X.Z_FINISH?(a=zi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===X.Z_OK):(s===X.Z_SYNC_FLUSH&&(this.onEnd(X.Z_OK),i.avail_out=0),!0)};Qt.prototype.onData=function(e){this.chunks.push(e)};Qt.prototype.onEnd=function(e){e===X.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function El(e,t){var i=new Qt(t);if(i.push(e,!0),i.err)throw i.msg||_l[i.err];return i.result}function zx(e,t){return t=t||{},t.raw=!0,El(e,t)}Yn.Inflate=Qt;Yn.inflate=El;Yn.inflateRaw=zx;Yn.ungzip=El});var Wf=k((uE,Gf)=>{"use strict";var Nx=at().assign,Bx=Yp(),Fx=Uf(),Hx=wl(),qf={};Nx(qf,Bx,Fx,Hx);Gf.exports=qf});var Vf=k(Da=>{"use strict";var $x=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",Ux=Wf(),Yf=V(),ja=ge(),qx=$x?"uint8array":"array";Da.magic="\b\0";function ei(e,t){ja.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Yf.inherits(ei,ja);ei.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Yf.transformTo(qx,e.data),!1)};ei.prototype.flush=function(){ja.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};ei.prototype.cleanUp=function(){ja.prototype.cleanUp.call(this),this._pako=null};ei.prototype._createPako=function(){this._pako=new Ux[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Da.compressWorker=function(e){return new ei("Deflate",e)};Da.uncompressWorker=function(){return new ei("Inflate",{})}});var Al=k(Sl=>{"use strict";var Kf=ge();Sl.STORE={magic:"\0\0",compressWorker:function(){return new Kf("STORE compression")},uncompressWorker:function(){return new Kf("STORE decompression")}};Sl.DEFLATE=Vf()});var Cl=k(ti=>{"use strict";ti.LOCAL_FILE_HEADER="PK";ti.CENTRAL_FILE_HEADER="PK";ti.CENTRAL_DIRECTORY_END="PK";ti.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";ti.ZIP64_CENTRAL_DIRECTORY_END="PK";ti.DATA_DESCRIPTOR="PK\x07\b"});var Qf=k((gE,Jf)=>{"use strict";var Ni=V(),Bi=ge(),Tl=Ci(),Xf=ma(),za=Cl(),U=function(e,t){var i="",n;for(n=0;n<t;n++)i+=String.fromCharCode(e&255),e=e>>>8;return i},Gx=function(e,t){var i=e;return e||(i=t?16893:33204),(i&65535)<<16},Wx=function(e){return(e||0)&63},Zf=function(e,t,i,n,r,a){var s=e.file,o=e.compression,l=a!==Tl.utf8encode,c=Ni.transformTo("string",a(s.name)),d=Ni.transformTo("string",Tl.utf8encode(s.name)),u=s.comment,p=Ni.transformTo("string",a(u)),f=Ni.transformTo("string",Tl.utf8encode(u)),m=d.length!==s.name.length,h=f.length!==u.length,g,b,y="",v="",x="",w=s.dir,E=s.date,A={crc32:0,compressedSize:0,uncompressedSize:0};(!t||i)&&(A.crc32=e.crc32,A.compressedSize=e.compressedSize,A.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),!l&&(m||h)&&(_|=2048);var T=0,M=0;w&&(T|=16),r==="UNIX"?(M=798,T|=Gx(s.unixPermissions,w)):(M=20,T|=Wx(s.dosPermissions,w)),g=E.getUTCHours(),g=g<<6,g=g|E.getUTCMinutes(),g=g<<5,g=g|E.getUTCSeconds()/2,b=E.getUTCFullYear()-1980,b=b<<4,b=b|E.getUTCMonth()+1,b=b<<5,b=b|E.getUTCDate(),m&&(v=U(1,1)+U(Xf(c),4)+d,y+="up"+U(v.length,2)+v),h&&(x=U(1,1)+U(Xf(p),4)+f,y+="uc"+U(x.length,2)+x);var S="";S+=`
|
|
2
|
+
\0`,S+=U(_,2),S+=o.magic,S+=U(g,2),S+=U(b,2),S+=U(A.crc32,4),S+=U(A.compressedSize,4),S+=U(A.uncompressedSize,4),S+=U(c.length,2),S+=U(y.length,2);var L=za.LOCAL_FILE_HEADER+S+c+y,z=za.CENTRAL_FILE_HEADER+U(M,2)+S+U(p.length,2)+"\0\0\0\0"+U(T,4)+U(n,4)+c+y+p;return{fileRecord:L,dirRecord:z}},Yx=function(e,t,i,n,r){var a="",s=Ni.transformTo("string",r(n));return a=za.CENTRAL_DIRECTORY_END+"\0\0\0\0"+U(e,2)+U(e,2)+U(t,4)+U(i,4)+U(s.length,2)+s,a},Vx=function(e){var t="";return t=za.DATA_DESCRIPTOR+U(e.crc32,4)+U(e.compressedSize,4)+U(e.uncompressedSize,4),t};function Ie(e,t,i,n){Bi.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}Ni.inherits(Ie,Bi);Ie.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,Bi.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-n-1))/i:100}}))};Ie.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=Zf(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Ie.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=Zf(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:Vx(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};Ie.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i=this.bytesWritten-e,n=Yx(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};Ie.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};Ie.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(i){t.processChunk(i)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(i){t.error(i)}),this};Ie.prototype.resume=function(){if(!Bi.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};Ie.prototype.error=function(e){var t=this._sources;if(!Bi.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch{}return!0};Ie.prototype.lock=function(){Bi.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Jf.exports=Ie});var th=k(eh=>{"use strict";var Kx=Al(),Xx=Qf(),Zx=function(e,t){var i=e||t,n=Kx[i];if(!n)throw new Error(i+" is not a valid compression method !");return n};eh.generateWorker=function(e,t,i){var n=new Xx(t.streamFiles,i,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,s){r++;var o=Zx(s.options.compression,t.compression),l=s.options.compressionOptions||t.compressionOptions||{},c=s.dir,d=s.date;s._compressWorker(o,l).withStreamInfo("file",{name:a,dir:c,date:d,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(n)}),n.entriesCount=r}catch(a){n.error(a)}return n}});var nh=k((bE,ih)=>{"use strict";var Jx=V(),Na=ge();function Vn(e,t){Na.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Jx.inherits(Vn,Na);Vn.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(i){t.push({data:i,meta:{percent:0}})}).on("error",function(i){t.isPaused?this.generatedError=i:t.error(i)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};Vn.prototype.pause=function(){return Na.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Vn.prototype.resume=function(){return Na.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};ih.exports=Vn});var fh=k((yE,ph)=>{"use strict";var Qx=Ci(),Kn=V(),oh=ge(),ew=Mo(),lh=Ro(),rh=ba(),tw=rp(),iw=th(),ah=Sn(),nw=nh(),ch=function(e,t,i){var n=Kn.getTypeOf(t),r,a=Kn.extend(i||{},lh);a.date=a.date||new Date,a.compression!==null&&(a.compression=a.compression.toUpperCase()),typeof a.unixPermissions=="string"&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&a.unixPermissions&16384&&(a.dir=!0),a.dosPermissions&&a.dosPermissions&16&&(a.dir=!0),a.dir&&(e=dh(e)),a.createFolders&&(r=rw(e))&&uh.call(this,r,!0);var s=n==="string"&&a.binary===!1&&a.base64===!1;(!i||typeof i.binary=="undefined")&&(a.binary=!s);var o=t instanceof rh&&t.uncompressedSize===0;(o||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var l=null;t instanceof rh||t instanceof oh?l=t:ah.isNode&&ah.isStream(t)?l=new nw(e,t):l=Kn.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var c=new tw(e,l,a);this.files[e]=c},rw=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},dh=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},uh=function(e,t){return t=typeof t!="undefined"?t:lh.createFolders,e=dh(e),this.files[e]||ch.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function sh(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var aw={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,n;for(t in this.files)n=this.files[t],i=t.slice(this.root.length,t.length),i&&t.slice(0,this.root.length)===this.root&&e(i,n)},filter:function(e){var t=[];return this.forEach(function(i,n){e(i,n)&&t.push(n)}),t},file:function(e,t,i){if(arguments.length===1)if(sh(e)){var n=e;return this.filter(function(a,s){return!s.dir&&n.test(a)})}else{var r=this.files[this.root+e];return r&&!r.dir?r:null}else e=this.root+e,ch.call(this,e,t,i);return this},folder:function(e){if(!e)return this;if(sh(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,i=uh.call(this,t),n=this.clone();return n.root=i.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter(function(r,a){return a.name.slice(0,e.length)===e}),n=0;n<i.length;n++)delete this.files[i[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if(i=Kn.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Qx.utf8encode}),i.type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),i.type==="binarystring"&&(i.type="string"),!i.type)throw new Error("No output type specified.");Kn.checkSupport(i.type),(i.platform==="darwin"||i.platform==="freebsd"||i.platform==="linux"||i.platform==="sunos")&&(i.platform="UNIX"),i.platform==="win32"&&(i.platform="DOS");var n=i.comment||this.comment||"";t=iw.generateWorker(this,i,n)}catch(r){t=new oh("error"),t.error(r)}return new ew(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};ph.exports=aw});var kl=k((vE,gh)=>{"use strict";var sw=V();function hh(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}hh.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,i;for(this.checkOffset(e),i=this.index+e-1;i>=this.index;i--)t=(t<<8)+this.byteAt(i);return this.index+=e,t},readString:function(e){return sw.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};gh.exports=hh});var Ll=k((xE,bh)=>{"use strict";var mh=kl(),ow=V();function Fi(e){mh.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}ow.inherits(Fi,mh);Fi.prototype.byteAt=function(e){return this.data[this.zero+e]};Fi.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),n=e.charCodeAt(2),r=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===i&&this.data[a+2]===n&&this.data[a+3]===r)return a-this.zero;return-1};Fi.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),n=e.charCodeAt(2),r=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&i===a[1]&&n===a[2]&&r===a[3]};Fi.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};bh.exports=Fi});var xh=k((wE,vh)=>{"use strict";var yh=kl(),lw=V();function Hi(e){yh.call(this,e)}lw.inherits(Hi,yh);Hi.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};Hi.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};Hi.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};Hi.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};vh.exports=Hi});var Il=k((_E,_h)=>{"use strict";var wh=Ll(),cw=V();function Ol(e){wh.call(this,e)}cw.inherits(Ol,wh);Ol.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};_h.exports=Ol});var Ah=k((EE,Sh)=>{"use strict";var Eh=Il(),dw=V();function Ml(e){Eh.call(this,e)}dw.inherits(Ml,Eh);Ml.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Sh.exports=Ml});var Rl=k((SE,Th)=>{"use strict";var Ba=V(),Ch=nt(),uw=Ll(),pw=xh(),fw=Ah(),hw=Il();Th.exports=function(e){var t=Ba.getTypeOf(e);return Ba.checkSupport(t),t==="string"&&!Ch.uint8array?new pw(e):t==="nodebuffer"?new fw(e):Ch.uint8array?new hw(Ba.transformTo("uint8array",e)):new uw(Ba.transformTo("array",e))}});var Ih=k((AE,Oh)=>{"use strict";var Pl=Rl(),Lt=V(),gw=ba(),kh=ma(),Fa=Ci(),Ha=Al(),mw=nt(),bw=0,yw=3,vw=function(e){for(var t in Ha)if(Object.prototype.hasOwnProperty.call(Ha,t)&&Ha[t].magic===e)return Ha[t];return null};function Lh(e,t){this.options=e,this.loadOptions=t}Lh.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=vw(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+Lt.pretty(this.compressionMethod)+" unknown (inner file : "+Lt.transformTo("string",this.fileName)+")");this.decompressed=new gw(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===bw&&(this.dosPermissions=this.externalFileAttributes&63),e===yw&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Pl(this.extraFields[1].value);this.uncompressedSize===Lt.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Lt.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Lt.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Lt.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,i,n,r;for(this.extraFields||(this.extraFields={});e.index+4<t;)i=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[i]={id:i,length:n,value:r};e.setIndex(t)},handleUTF8:function(){var e=mw.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Fa.utf8decode(this.fileName),this.fileCommentStr=Fa.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var i=Lt.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var r=Lt.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Pl(e.value);return t.readInt(1)!==1||kh(this.fileName)!==t.readInt(4)?null:Fa.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Pl(e.value);return t.readInt(1)!==1||kh(this.fileComment)!==t.readInt(4)?null:Fa.utf8decode(t.readData(e.length-5))}return null}};Oh.exports=Lh});var Ph=k((CE,Rh)=>{"use strict";var xw=Rl(),ct=V(),Me=Cl(),ww=Ih(),_w=nt();function Mh(e){this.files=[],this.loadOptions=e}Mh.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+ct.pretty(t)+", expected "+ct.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4),r=n===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=_w.uint8array?"uint8array":"array",i=ct.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,i,n,r;t<e;)i=this.reader.readInt(2),n=this.reader.readInt(4),r=this.reader.readData(n),this.zip64ExtensibleData[i]={id:i,length:n,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(Me.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(Me.CENTRAL_FILE_HEADER);)e=new ww({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(Me.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,Me.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var i=e;if(this.checkSignature(Me.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===ct.MAX_VALUE_16BITS||this.diskWithCentralDirStart===ct.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===ct.MAX_VALUE_16BITS||this.centralDirRecords===ct.MAX_VALUE_16BITS||this.centralDirSize===ct.MAX_VALUE_32BITS||this.centralDirOffset===ct.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(Me.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(Me.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,Me.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(Me.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(Me.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var r=i-n;if(r>0)this.isSignature(i,Me.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=xw(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};Rh.exports=Mh});var zh=k((TE,Dh)=>{"use strict";var jl=V(),$a=Ei(),Ew=Ci(),Sw=Ph(),Aw=Do(),jh=Sn();function Cw(e){return new $a.Promise(function(t,i){var n=e.decompressed.getContentWorker().pipe(new Aw);n.on("error",function(r){i(r)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}Dh.exports=function(e,t){var i=this;return t=jl.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:Ew.utf8decode}),jh.isNode&&jh.isStream(e)?$a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):jl.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var r=new Sw(t);return r.load(n),r}).then(function(r){var a=[$a.Promise.resolve(r)],s=r.files;if(t.checkCRC32)for(var o=0;o<s.length;o++)a.push(Cw(s[o]));return $a.Promise.all(a)}).then(function(r){for(var a=r.shift(),s=a.files,o=0;o<s.length;o++){var l=s[o],c=l.fileNameStr,d=jl.resolve(l.fileNameStr);i.file(d,l.decompressed,{binary:!0,optimizedBinaryString:!0,date:l.date,dir:l.dir,comment:l.fileCommentStr.length?l.fileCommentStr:null,unixPermissions:l.unixPermissions,dosPermissions:l.dosPermissions,createFolders:t.createFolders}),l.dir||(i.file(d).unsafeOriginalName=c)}return a.zipComment.length&&(i.comment=a.zipComment),i})}});var Bh=k((kE,Nh)=>{"use strict";function Se(){if(!(this instanceof Se))return new Se;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new Se;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}Se.prototype=fh();Se.prototype.loadAsync=zh();Se.support=nt();Se.defaults=Ro();Se.version="3.10.1";Se.loadAsync=function(e,t){return new Se().loadAsync(e,t)};Se.external=Ei();Nh.exports=Se});var Ag={};nn(Ag,{AssetEditorModal:()=>lc});var lc,cc=We(()=>{"use strict";lc=class{constructor(){this.modal=null;this.currentObjectId=null;this.currentPath=null;this.currentAsset="";this.onApplyCallback=null}show(t,i,n,r){this.currentObjectId=t,this.currentPath=i,this.currentAsset=n,this.onApplyCallback=r,this.createModal(t,n),document.body.appendChild(this.modal),this.attachModalListeners()}createModal(t,i){let n=document.createElement("div");n.className="asset-editor-modal",n.innerHTML=`
|
|
3
3
|
<div class="asset-editor-card">
|
|
4
4
|
<div class="asset-editor-header">
|
|
5
5
|
<div>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var r0={};nn(r0,{ConfigWatcher:()=>Ft,DebugPanel:()=>tr,DefaultReloadStrategy:()=>hn,Handler:()=>Re,PreviewShell:()=>ts,applyConfigOverride:()=>mt,applyConfigOverrides:()=>bt,applyConfigsToDisk:()=>kr,applyDefaults:()=>Bt,baseLottie:()=>ys,bootstrap:()=>Yw,clearConfigOverrides:()=>un,clearConfigOverridesForObject:()=>wd,configOverrideManager:()=>_d,createPreviewShell:()=>pc,deepClone:()=>ne,default:()=>jt,defaultPreset:()=>Dr,deviceGroups:()=>Gs,devicePresets:()=>qs,diffConfigs:()=>Ns,exportConfigsAsJSON:()=>Ms,getConfigOverrides:()=>de,getConfigStateSummary:()=>Tr,getOverrideMode:()=>dn,getPresetById:()=>Ht,getPresetsByCategory:()=>Wm,loadAllObjectConfigs:()=>Mr,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Rr,loadGamePromptConfig:()=>js,loadObjectCentricConfig:()=>Qe,loadObjectConfig:()=>yt,loadSceneConfig:()=>Pr,rehydrateObject:()=>Bs,removeConfigOverride:()=>Cr,resetToApplied:()=>pn,resetToOriginal:()=>Lr,setBootstrapDependencies:()=>Gw,setOverrideMode:()=>Is,setupHotReload:()=>$s,setupLiveEditBridge:()=>is,toLegacyFormat:()=>Ds,validateObjectConfig:()=>fi});module.exports=Qg(r0);var ft={};function pr(e,t,i=!1){ft[e]||(ft[e]=[]),ft[e].push({fn:t,once:i})}function hs(e,t){if(ft[e]){if(!t){delete ft[e];return}ft[e]=ft[e].filter(i=>i.fn!==t)}}function fr(e,...t){let i=ft[e];if(i)for(let n of[...i])n.fn(...t),n.once&&hs(e,n.fn)}function be(e,t){pr(e,t,!0)}var ee=null,Ce=[],ci=null;function Ic(e){ee=e,Ce=[],ci!==null&&(clearTimeout(ci),ci=null)}function Mc(){var e,t,i;return{endpoint:(ee==null?void 0:ee.endpoint)||"",transport:(ee==null?void 0:ee.transport)||"beacon",batchSize:(e=ee==null?void 0:ee.batchSize)!=null?e:10,flushIntervalMs:(t=ee==null?void 0:ee.flushIntervalMs)!=null?t:300,maxQueue:(i=ee==null?void 0:ee.maxQueue)!=null?i:200,debug:!!(ee!=null&&ee.debug)}}async function Lc(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function gs(e,t){let i=Mc();if(t&&i.endpoint){if(Ce.push(e),Ce.length>i.maxQueue&&(Ce=Ce.slice(Ce.length-i.maxQueue)),Ce.length>=i.batchSize){Oc();return}ci===null&&(ci=window.setTimeout(()=>{ci=null,Oc()},i.flushIntervalMs))}}async function Oc(){let e=Mc();if(!e.endpoint||Ce.length===0)return;let t=Ce.splice(0,e.batchSize);await Lc(e.endpoint,{events:t},e.transport,e.debug),Ce.length>0&&await Lc(e.endpoint,{events:Ce.splice(0,e.batchSize)},e.transport,e.debug)}function Rc(e){return Math.max(0,Math.min(1,e))}function em(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function rn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function tm(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function Pc(e,t,i){try{e[t]=i}catch{}}function im(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function jc(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Dc(e,t){let i=im(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function zc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=d=>{var p;e.add(d);let u=(p=t.get(d.target))!=null?p:new Set;u.add(d),t.set(d.target,u),n()},a=d=>{e.delete(d);let u=t.get(d.target);u&&(u.delete(d),u.size===0&&t.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var u,p;let d=rn();for(let f of Array.from(e)){if(f.killed||f.paused)continue;let m=d-f.startMs-f.delayMs;if(m<0)continue;let h=f.durationMs>0?m/f.durationMs:1,g=Rc(h),b=f.repeat>=0?f.repeat+1:1,y=f.repeat>0?Math.min(Math.floor(h),b-1):0;if(f.repeat>0&&h>=1){let w=h-y;g=Rc(w)}let v=f.ease(g);f.yoyo&&y%2===1&&(v=1-v);for(let w of f.props)Pc(f.target,w.key,w.from+(w.to-w.from)*v);f.scaleFrom&&f.scaleTo&&jc(f.target,{x:f.scaleFrom.x+(f.scaleTo.x-f.scaleFrom.x)*v,y:f.scaleFrom.y+(f.scaleTo.y-f.scaleFrom.y)*v});try{(u=f.onUpdate)==null||u.call(f)}catch{}if(h>=b){s(f);try{(p=f.onComplete)==null||p.call(f)}catch{}}}},l=(d,u,p)=>{var w;let f=Math.max(0,(typeof u.duration=="number"?u.duration:.5)*1e3),m=Math.max(0,(typeof u.delay=="number"?u.delay:0)*1e3+((w=p==null?void 0:p.delayMsOverride)!=null?w:0)),h=em(u.ease),g=typeof u.repeat=="number"?Math.max(0,u.repeat|0):0,b=u.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let S of Object.keys(u)){if(y.has(S))continue;let A=u[S];typeof A=="number"&&v.push({key:S,from:tm(d,S),to:A})}let x=Dc(d,u);return{target:d,startMs:rn(),delayMs:m,durationMs:f,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:g,yoyo:b,onUpdate:typeof u.onUpdate=="function"?u.onUpdate:void 0,onComplete:typeof u.onComplete=="function"?u.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,u){let p=l(d,u);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=rn())},resume:()=>{var h;if(!p.paused)return;let f=(h=p.pauseAtMs)!=null?h:rn(),m=rn()-f;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(d,u,p){return c.set(d,u),c.to(d,p)},set(d,u){if(!d||!u)return;for(let f of Object.keys(u)){let m=u[f];f==="scale"||f==="scaleX"||f==="scaleY"||typeof m=="number"&&Pc(d,f,m)}let p=Dc(d,u);p.to&&jc(d,p.to)},killTweensOf(d){let u=t.get(d);if(u)for(let p of Array.from(u))s(p)},timeline(d={}){let u=[],p=0,f=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},g=y=>{u.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);p=Math.max(p,y.atMs+v)},b={to(y,v,x){return g({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return g({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(f)return b;f=!0,m=[];for(let x of u)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],f=!1}};return d.paused||b.play(),b}};return c}function Nc(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=zc()}catch{}}var Bc={name:"handler-playable-sdk",version:"0.3.21",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var ye=0,rm=ye++,Fc=ye++,Hc=ye++,$c=ye++,Uc=ye++,qc=ye++,Gc=ye++,Wc=ye++,Yc=ye++,Vc=ye++,Kc=ye++,Xc=ye++,K=rm;function Zc(){return K===Fc}function Jc(){return K===Hc}function Qc(){return K===$c}function ed(){return K===Uc}function di(){return K===qc}function ui(){return K===Gc}function td(){return K===Wc}function id(){return K===Yc}function nd(){return K===Vc}function ms(){return K===Kc}function bs(){return K===Xc}function rd(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),K=Fc;return}catch{}else if(e==="dapi")try{dapi.isReady(),K=Hc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(K=$c)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(K=Uc)}catch{}else if(t==="mintegral")window.gameReady&&(K=qc);else if(t==="tapjoy")window.TJ_API&&(K=Gc);else if(t==="tiktok")window.openAppStore&&(K=Wc);else if(t==="smadex")try{window.smxTracking&&(K=Yc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(K=Vc)}catch{}else t==="vungle"?K=Kc:(e==="nucleo"||t==="nucleo")&&(K=Xc)}var hr=li(require("lottie-web"),1),ys=hr.default;typeof window!="undefined"&&(window.lottie=hr.default,window.__baseLottie=hr.default);var am=require("pixi.js");var vs=require("pixi.js");var sm=null;function xs(e){sm=e}gr();ws();var an=require("pixi.js");gr();var pm=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",As=pm;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(As=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${As}`))}}catch{}var gt=class{static async create(t,i,n){var l,c,d,u,p,f,m;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${As}`);let r=(l=i==null?void 0:i.render)==null?void 0:l.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new an.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(c=i==null?void 0:i.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await zt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new an.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof an.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],g=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=o==null?void 0:o.constructor)==null?void 0:m.name),g=!0;break}}catch{continue}g||(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,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var sn=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var gm=li(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=gm);pi();var mr=require("pixi.js");pi();var ks=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new sn}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.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 gt.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 n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await gt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},mm=new ks,bm=new Proxy(mm,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});pi();var dd=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},yr={scale:1,position:1},Os=[];function vm(e,t,i,n,r,a,s){Os.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function xm(){Os.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function Ls(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),yr.scale=Xe.scaleFactor,yr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${yr.scale.toFixed(3)}`),xm()}var ln={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 wm(e,t,i){let n=ln[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function _m(){return ln}var Em={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 br(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function vr(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:br(e[0],t.x),y:br(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:br(n.x,t.x),y:br(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=Em[n])!=null?i:t}return t}function ud(e,t,i,n={}){var f,m,h,g,b,y;let r=vr(i),a=(f=n.inset)!=null?f:{},s=(m=n.padding)!=null?m:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,l=((g=a.right)!=null?g:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,u=Math.max(0,e-o-l),p=Math.max(0,t-c-d);return{x:o+u*r.x,y:c+p*r.y}}function pd(e,t,i,n={}){var h,g,b,y,v,x;let r=(h=n.inset)!=null?h:{},a=(g=n.padding)!=null?g:{x:0,y:0},s=((b=r.left)!=null?b:0)+a.x,o=((y=r.right)!=null?y:0)+a.x,l=((v=r.top)!=null?v:0)+a.y,c=((x=r.bottom)!=null?x:0)+a.y,d=Math.max(0,e-s-o),u=Math.max(0,t-l-c),p=vr(i,{x:.5,y:.5}),f=Math.min(Math.max(p.x,0),1),m=Math.min(Math.max(p.y,0),1);return{x:s+d*f,y:l+u*m}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,Ls(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Ls(window.innerWidth,window.innerHeight),window.updateDebugConfig=wm,window.getDebugConfig=_m,window.copyConfig=Pm,window.applyConfig=on,window.applyConfigForRatio=jm,window.positionAtBottom=fd,window.positionAtTop=Cm,window.positionAtCenter=Tm,window.positionAtLeft=km,window.positionAtRight=Lm,window.positionAtBottomLeft=Om,window.positionAtBottomRight=Im,window.positionAtTopLeft=Mm,window.positionAtTopRight=Rm,window.applyPositionContract=Am,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 xr(e,t,i=0){return e*t+i}function wr(e,t,i=0){return e*(1-t)+i}function _r(e,t,i=0){return e*t+i}function Er(e,t,i=0){return e*(1-t)+i}function ve(e,t=0){return e/2+t}function Sm(e,t){return e*t}function Am(e,t,i,n){var s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,S,A,_,T;let r=0,a=0;switch(n.type){case"top":r=ve(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=xr(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ve(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=wr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=_r(t,n.percent,(h=(m=n.offset)==null?void 0:m.x)!=null?h:0),a=ve(i,(b=(g=n.offset)==null?void 0:g.y)!=null?b:0);break;case"right":r=Er(t,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),a=ve(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ve(t,(A=(S=n.offset)==null?void 0:S.x)!=null?A:0),a=ve(i,(T=(_=n.offset)==null?void 0:_.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function fd(e,t,i,n=.2,r=1,a=!0,s=!1){let o=Sm(i,n),l=wr(i,n/2);Ze(e,ve(t),l);let c=a?r*Xe.scaleFactor:r;Je(e,c),s&&!Os.find(d=>d.element===e)&&vm(e,fd,t,i,n,r,a)}function Cm(e,t,i,n=.1,r=1){Ze(e,ve(t),xr(i,n)),Je(e,r)}function Tm(e,t,i,n=0,r=0,a=1){Ze(e,ve(t,n),ve(i,r)),Je(e,a)}function km(e,t,i,n=.1,r=1){Ze(e,_r(t,n),ve(i)),Je(e,r)}function Lm(e,t,i,n=.1,r=1){Ze(e,Er(t,n),ve(i)),Je(e,r)}function Om(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),wr(i,n)),Je(e,a)}function Im(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),wr(i,n)),Je(e,a)}function Mm(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),xr(i,n)),Je(e,a)}function Rm(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),xr(i,n)),Je(e,a)}function Ze(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Je(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Nt={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 Pm(e){return e&&Nt[e]?JSON.parse(JSON.stringify(Nt[e])):JSON.parse(JSON.stringify(ln))}function on(e){Object.keys(e).forEach(t=>{let i=t;ln[i]&&e[i]&&Object.assign(ln[i],e[i])}),console.log("Config applied:",e)}function jm(e,t){let i=e/t;i>1.6?(on(Nt.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(on(Nt.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(on(Nt.square),console.log("Applied SQUARE config for ratio:",i)):(on(Nt.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Nt,e.resolveAnchorVec2=e.resolveAnchorVec2||vr,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||ud,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||pd}jr();function te(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var M_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:te(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:te(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:te(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:te(360,780)}],R_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:te(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:te(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:te(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:te(412,915)}],P_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:te(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:te(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:te(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:te(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:te(800,1280)}],Us=[{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:te(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:te(768,1024),mraidScale:.7}];var qs=[...Us],Gs=[{category:"playable",label:"Playable Ad",devices:Us}],Dr=Us[0];function Ht(e){return qs.find(t=>t.id===e)||Dr}function Wm(e){return qs.filter(t=>t.category===e)}var zr=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
47
|
+
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var r0={};nn(r0,{ConfigWatcher:()=>Ft,DebugPanel:()=>tr,DefaultReloadStrategy:()=>hn,Handler:()=>Re,PreviewShell:()=>ts,applyConfigOverride:()=>mt,applyConfigOverrides:()=>bt,applyConfigsToDisk:()=>kr,applyDefaults:()=>Bt,baseLottie:()=>ys,bootstrap:()=>Yw,clearConfigOverrides:()=>un,clearConfigOverridesForObject:()=>wd,configOverrideManager:()=>_d,createPreviewShell:()=>pc,deepClone:()=>ne,default:()=>jt,defaultPreset:()=>Dr,deviceGroups:()=>Gs,devicePresets:()=>qs,diffConfigs:()=>Ns,exportConfigsAsJSON:()=>Ms,getConfigOverrides:()=>de,getConfigStateSummary:()=>Tr,getOverrideMode:()=>dn,getPresetById:()=>Ht,getPresetsByCategory:()=>Wm,loadAllObjectConfigs:()=>Mr,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Rr,loadGamePromptConfig:()=>js,loadObjectCentricConfig:()=>Qe,loadObjectConfig:()=>yt,loadSceneConfig:()=>Pr,rehydrateObject:()=>Bs,removeConfigOverride:()=>Cr,resetToApplied:()=>pn,resetToOriginal:()=>Lr,setBootstrapDependencies:()=>Gw,setOverrideMode:()=>Is,setupHotReload:()=>$s,setupLiveEditBridge:()=>is,toLegacyFormat:()=>Ds,validateObjectConfig:()=>fi});module.exports=Qg(r0);var ft={};function pr(e,t,i=!1){ft[e]||(ft[e]=[]),ft[e].push({fn:t,once:i})}function hs(e,t){if(ft[e]){if(!t){delete ft[e];return}ft[e]=ft[e].filter(i=>i.fn!==t)}}function fr(e,...t){let i=ft[e];if(i)for(let n of[...i])n.fn(...t),n.once&&hs(e,n.fn)}function be(e,t){pr(e,t,!0)}var ee=null,Ce=[],ci=null;function Ic(e){ee=e,Ce=[],ci!==null&&(clearTimeout(ci),ci=null)}function Mc(){var e,t,i;return{endpoint:(ee==null?void 0:ee.endpoint)||"",transport:(ee==null?void 0:ee.transport)||"beacon",batchSize:(e=ee==null?void 0:ee.batchSize)!=null?e:10,flushIntervalMs:(t=ee==null?void 0:ee.flushIntervalMs)!=null?t:300,maxQueue:(i=ee==null?void 0:ee.maxQueue)!=null?i:200,debug:!!(ee!=null&&ee.debug)}}async function Lc(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function gs(e,t){let i=Mc();if(t&&i.endpoint){if(Ce.push(e),Ce.length>i.maxQueue&&(Ce=Ce.slice(Ce.length-i.maxQueue)),Ce.length>=i.batchSize){Oc();return}ci===null&&(ci=window.setTimeout(()=>{ci=null,Oc()},i.flushIntervalMs))}}async function Oc(){let e=Mc();if(!e.endpoint||Ce.length===0)return;let t=Ce.splice(0,e.batchSize);await Lc(e.endpoint,{events:t},e.transport,e.debug),Ce.length>0&&await Lc(e.endpoint,{events:Ce.splice(0,e.batchSize)},e.transport,e.debug)}function Rc(e){return Math.max(0,Math.min(1,e))}function em(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function rn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function tm(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function Pc(e,t,i){try{e[t]=i}catch{}}function im(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function jc(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Dc(e,t){let i=im(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function zc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=d=>{var p;e.add(d);let u=(p=t.get(d.target))!=null?p:new Set;u.add(d),t.set(d.target,u),n()},a=d=>{e.delete(d);let u=t.get(d.target);u&&(u.delete(d),u.size===0&&t.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var u,p;let d=rn();for(let f of Array.from(e)){if(f.killed||f.paused)continue;let m=d-f.startMs-f.delayMs;if(m<0)continue;let h=f.durationMs>0?m/f.durationMs:1,g=Rc(h),b=f.repeat>=0?f.repeat+1:1,y=f.repeat>0?Math.min(Math.floor(h),b-1):0;if(f.repeat>0&&h>=1){let w=h-y;g=Rc(w)}let v=f.ease(g);f.yoyo&&y%2===1&&(v=1-v);for(let w of f.props)Pc(f.target,w.key,w.from+(w.to-w.from)*v);f.scaleFrom&&f.scaleTo&&jc(f.target,{x:f.scaleFrom.x+(f.scaleTo.x-f.scaleFrom.x)*v,y:f.scaleFrom.y+(f.scaleTo.y-f.scaleFrom.y)*v});try{(u=f.onUpdate)==null||u.call(f)}catch{}if(h>=b){s(f);try{(p=f.onComplete)==null||p.call(f)}catch{}}}},l=(d,u,p)=>{var w;let f=Math.max(0,(typeof u.duration=="number"?u.duration:.5)*1e3),m=Math.max(0,(typeof u.delay=="number"?u.delay:0)*1e3+((w=p==null?void 0:p.delayMsOverride)!=null?w:0)),h=em(u.ease),g=typeof u.repeat=="number"?Math.max(0,u.repeat|0):0,b=u.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(u)){if(y.has(E))continue;let A=u[E];typeof A=="number"&&v.push({key:E,from:tm(d,E),to:A})}let x=Dc(d,u);return{target:d,startMs:rn(),delayMs:m,durationMs:f,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:g,yoyo:b,onUpdate:typeof u.onUpdate=="function"?u.onUpdate:void 0,onComplete:typeof u.onComplete=="function"?u.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,u){let p=l(d,u);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=rn())},resume:()=>{var h;if(!p.paused)return;let f=(h=p.pauseAtMs)!=null?h:rn(),m=rn()-f;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(d,u,p){return c.set(d,u),c.to(d,p)},set(d,u){if(!d||!u)return;for(let f of Object.keys(u)){let m=u[f];f==="scale"||f==="scaleX"||f==="scaleY"||typeof m=="number"&&Pc(d,f,m)}let p=Dc(d,u);p.to&&jc(d,p.to)},killTweensOf(d){let u=t.get(d);if(u)for(let p of Array.from(u))s(p)},timeline(d={}){let u=[],p=0,f=!1,m=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},g=y=>{u.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);p=Math.max(p,y.atMs+v)},b={to(y,v,x){return g({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return g({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(f)return b;f=!0,m=[];for(let x of u)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],f=!1}};return d.paused||b.play(),b}};return c}function Nc(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=zc()}catch{}}var Bc={name:"handler-playable-sdk",version:"0.3.23",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"}},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","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 --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks",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",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","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",sharp:"^0.34.5"}};var ye=0,rm=ye++,Fc=ye++,Hc=ye++,$c=ye++,Uc=ye++,qc=ye++,Gc=ye++,Wc=ye++,Yc=ye++,Vc=ye++,Kc=ye++,Xc=ye++,K=rm;function Zc(){return K===Fc}function Jc(){return K===Hc}function Qc(){return K===$c}function ed(){return K===Uc}function di(){return K===qc}function ui(){return K===Gc}function td(){return K===Wc}function id(){return K===Yc}function nd(){return K===Vc}function ms(){return K===Kc}function bs(){return K===Xc}function rd(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),K=Fc;return}catch{}else if(e==="dapi")try{dapi.isReady(),K=Hc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(K=$c)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(K=Uc)}catch{}else if(t==="mintegral")window.gameReady&&(K=qc);else if(t==="tapjoy")window.TJ_API&&(K=Gc);else if(t==="tiktok")window.openAppStore&&(K=Wc);else if(t==="smadex")try{window.smxTracking&&(K=Yc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(K=Vc)}catch{}else t==="vungle"?K=Kc:(e==="nucleo"||t==="nucleo")&&(K=Xc)}var hr=li(require("lottie-web"),1),ys=hr.default;typeof window!="undefined"&&(window.lottie=hr.default,window.__baseLottie=hr.default);var am=require("pixi.js");var vs=require("pixi.js");var sm=null;function xs(e){sm=e}gr();ws();var an=require("pixi.js");gr();var pm=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",As=pm;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(As=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${As}`))}}catch{}var gt=class{static async create(t,i,n){var l,c,d,u,p,f,m;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${As}`);let r=(l=i==null?void 0:i.render)==null?void 0:l.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new an.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(c=i==null?void 0:i.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await zt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new an.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof an.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],g=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=o==null?void 0:o.constructor)==null?void 0:m.name),g=!0;break}}catch{continue}g||(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,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var sn=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var gm=li(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=gm);pi();var mr=require("pixi.js");pi();var ks=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new sn}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.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 gt.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 n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await gt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},mm=new ks,bm=new Proxy(mm,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});pi();var dd=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},yr={scale:1,position:1},Os=[];function vm(e,t,i,n,r,a,s){Os.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function xm(){Os.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function Ls(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),yr.scale=Xe.scaleFactor,yr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${yr.scale.toFixed(3)}`),xm()}var ln={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 wm(e,t,i){let n=ln[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function _m(){return ln}var Em={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 br(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function vr(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:br(e[0],t.x),y:br(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:br(n.x,t.x),y:br(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=Em[n])!=null?i:t}return t}function ud(e,t,i,n={}){var f,m,h,g,b,y;let r=vr(i),a=(f=n.inset)!=null?f:{},s=(m=n.padding)!=null?m:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,l=((g=a.right)!=null?g:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,u=Math.max(0,e-o-l),p=Math.max(0,t-c-d);return{x:o+u*r.x,y:c+p*r.y}}function pd(e,t,i,n={}){var h,g,b,y,v,x;let r=(h=n.inset)!=null?h:{},a=(g=n.padding)!=null?g:{x:0,y:0},s=((b=r.left)!=null?b:0)+a.x,o=((y=r.right)!=null?y:0)+a.x,l=((v=r.top)!=null?v:0)+a.y,c=((x=r.bottom)!=null?x:0)+a.y,d=Math.max(0,e-s-o),u=Math.max(0,t-l-c),p=vr(i,{x:.5,y:.5}),f=Math.min(Math.max(p.x,0),1),m=Math.min(Math.max(p.y,0),1);return{x:s+d*f,y:l+u*m}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,Ls(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Ls(window.innerWidth,window.innerHeight),window.updateDebugConfig=wm,window.getDebugConfig=_m,window.copyConfig=Pm,window.applyConfig=on,window.applyConfigForRatio=jm,window.positionAtBottom=fd,window.positionAtTop=Cm,window.positionAtCenter=Tm,window.positionAtLeft=km,window.positionAtRight=Lm,window.positionAtBottomLeft=Om,window.positionAtBottomRight=Im,window.positionAtTopLeft=Mm,window.positionAtTopRight=Rm,window.applyPositionContract=Am,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 xr(e,t,i=0){return e*t+i}function wr(e,t,i=0){return e*(1-t)+i}function _r(e,t,i=0){return e*t+i}function Er(e,t,i=0){return e*(1-t)+i}function ve(e,t=0){return e/2+t}function Sm(e,t){return e*t}function Am(e,t,i,n){var s,o,l,c,d,u,p,f,m,h,g,b,y,v,x,w,E,A,_,T;let r=0,a=0;switch(n.type){case"top":r=ve(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=xr(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ve(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=wr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=_r(t,n.percent,(h=(m=n.offset)==null?void 0:m.x)!=null?h:0),a=ve(i,(b=(g=n.offset)==null?void 0:g.y)!=null?b:0);break;case"right":r=Er(t,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),a=ve(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ve(t,(A=(E=n.offset)==null?void 0:E.x)!=null?A:0),a=ve(i,(T=(_=n.offset)==null?void 0:_.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function fd(e,t,i,n=.2,r=1,a=!0,s=!1){let o=Sm(i,n),l=wr(i,n/2);Ze(e,ve(t),l);let c=a?r*Xe.scaleFactor:r;Je(e,c),s&&!Os.find(d=>d.element===e)&&vm(e,fd,t,i,n,r,a)}function Cm(e,t,i,n=.1,r=1){Ze(e,ve(t),xr(i,n)),Je(e,r)}function Tm(e,t,i,n=0,r=0,a=1){Ze(e,ve(t,n),ve(i,r)),Je(e,a)}function km(e,t,i,n=.1,r=1){Ze(e,_r(t,n),ve(i)),Je(e,r)}function Lm(e,t,i,n=.1,r=1){Ze(e,Er(t,n),ve(i)),Je(e,r)}function Om(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),wr(i,n)),Je(e,a)}function Im(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),wr(i,n)),Je(e,a)}function Mm(e,t,i,n=.05,r=.05,a=1){Ze(e,_r(t,r),xr(i,n)),Je(e,a)}function Rm(e,t,i,n=.05,r=.05,a=1){Ze(e,Er(t,r),xr(i,n)),Je(e,a)}function Ze(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Je(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Nt={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 Pm(e){return e&&Nt[e]?JSON.parse(JSON.stringify(Nt[e])):JSON.parse(JSON.stringify(ln))}function on(e){Object.keys(e).forEach(t=>{let i=t;ln[i]&&e[i]&&Object.assign(ln[i],e[i])}),console.log("Config applied:",e)}function jm(e,t){let i=e/t;i>1.6?(on(Nt.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(on(Nt.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(on(Nt.square),console.log("Applied SQUARE config for ratio:",i)):(on(Nt.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Nt,e.resolveAnchorVec2=e.resolveAnchorVec2||vr,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||ud,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||pd}jr();function te(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var M_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:te(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:te(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:te(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:te(360,780)}],R_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:te(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:te(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:te(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:te(412,915)}],P_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:te(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:te(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:te(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:te(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:te(800,1280)}],Us=[{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:te(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:te(768,1024),mraidScale:.7}];var qs=[...Us],Gs=[{category:"playable",label:"Playable Ad",devices:Us}],Dr=Us[0];function Ht(e){return qs.find(t=>t.id===e)||Dr}function Wm(e){return qs.filter(t=>t.category===e)}var zr=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
48
48
|
<div class="scene-panel scene-objects panel-accent-teal" data-panel="scene-objects" style="left:16px; top:72px;">
|
|
49
49
|
<div class="scene-panel-header" data-panel-handle>
|
|
50
50
|
<div class="panel-title">
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
<div class="scene-object-list" data-object-list></div>
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
75
|
-
`}initialize(t,i){var r,a,s,o,l;this.options=i,this.root=t.querySelector('[data-panel="scene-objects"]'),this.listContainer=(r=this.root)==null?void 0:r.querySelector("[data-object-list]"),this.searchInput=(a=this.root)==null?void 0:a.querySelector("#scene-object-search"),(s=this.searchInput)==null||s.addEventListener("input",()=>this.refreshObjects());let n=(o=this.root)==null?void 0:o.querySelector("#scene-screen-filter");if(n){try{let c=window.localStorage.getItem(this.getScreenFilterStorageKey());c&&(this.screenFilter=c)}catch{}n.value=this.screenFilter;try{window.__HANDLER_ACTIVE_SCREEN=this.screenFilter,window.dispatchEvent(new CustomEvent("handler:active-screen-changed",{detail:{screen:this.screenFilter}}))}catch{}n.addEventListener("change",()=>{let c=n.value||"all";this.screenFilter=c;try{window.localStorage.setItem(this.getScreenFilterStorageKey(),this.screenFilter)}catch{}try{window.__HANDLER_ACTIVE_SCREEN=this.screenFilter,window.dispatchEvent(new CustomEvent("handler:active-screen-changed",{detail:{screen:this.screenFilter}}))}catch{}this.refreshObjects()})}(l=this.root)==null||l.addEventListener("click",c=>{let d=c.target;if(!d)return;let u=d.closest("[data-object-id]");if(!u)return;let p=u.dataset.objectId;p&&this.select(p)}),window.addEventListener("handler:screen-index-loaded",()=>this.refreshObjects())}setSelected(t){if(this.selectedId=t,!this.listContainer)return;Array.from(this.listContainer.querySelectorAll("[data-object-id]")).forEach(n=>{n.classList.toggle("selected",n.dataset.objectId===t)})}refreshObjects(){var d;if(!this.listContainer)return;let t=window.getEditableObjectList,i=window.getEditableObjectConfig,n=window.refreshEditableConfigIndex;if(typeof n=="function"&&n(),typeof t!="function"){this.scheduleRetry();return}let r=t();if(!Array.isArray(r)||r.length===0){let u=window.__editableObjectConfigs;u&&typeof u.keys=="function"&&(r=Array.from(u.keys()))}if(!Array.isArray(r)||r.length===0){this.scheduleRetry();return}let a=(((d=this.searchInput)==null?void 0:d.value)||"").trim().toLowerCase(),s=["loading","start","gameplay","tutorial","endgame"],o=Object.fromEntries(s.map(u=>[u,[]])),l=Object.fromEntries(s.map(u=>[u,[]]));r.forEach(u=>{var T,M,
|
|
75
|
+
`}initialize(t,i){var r,a,s,o,l;this.options=i,this.root=t.querySelector('[data-panel="scene-objects"]'),this.listContainer=(r=this.root)==null?void 0:r.querySelector("[data-object-list]"),this.searchInput=(a=this.root)==null?void 0:a.querySelector("#scene-object-search"),(s=this.searchInput)==null||s.addEventListener("input",()=>this.refreshObjects());let n=(o=this.root)==null?void 0:o.querySelector("#scene-screen-filter");if(n){try{let c=window.localStorage.getItem(this.getScreenFilterStorageKey());c&&(this.screenFilter=c)}catch{}n.value=this.screenFilter;try{window.__HANDLER_ACTIVE_SCREEN=this.screenFilter,window.dispatchEvent(new CustomEvent("handler:active-screen-changed",{detail:{screen:this.screenFilter}}))}catch{}n.addEventListener("change",()=>{let c=n.value||"all";this.screenFilter=c;try{window.localStorage.setItem(this.getScreenFilterStorageKey(),this.screenFilter)}catch{}try{window.__HANDLER_ACTIVE_SCREEN=this.screenFilter,window.dispatchEvent(new CustomEvent("handler:active-screen-changed",{detail:{screen:this.screenFilter}}))}catch{}this.refreshObjects()})}(l=this.root)==null||l.addEventListener("click",c=>{let d=c.target;if(!d)return;let u=d.closest("[data-object-id]");if(!u)return;let p=u.dataset.objectId;p&&this.select(p)}),window.addEventListener("handler:screen-index-loaded",()=>this.refreshObjects())}setSelected(t){if(this.selectedId=t,!this.listContainer)return;Array.from(this.listContainer.querySelectorAll("[data-object-id]")).forEach(n=>{n.classList.toggle("selected",n.dataset.objectId===t)})}refreshObjects(){var d;if(!this.listContainer)return;let t=window.getEditableObjectList,i=window.getEditableObjectConfig,n=window.refreshEditableConfigIndex;if(typeof n=="function"&&n(),typeof t!="function"){this.scheduleRetry();return}let r=t();if(!Array.isArray(r)||r.length===0){let u=window.__editableObjectConfigs;u&&typeof u.keys=="function"&&(r=Array.from(u.keys()))}if(!Array.isArray(r)||r.length===0){this.scheduleRetry();return}let a=(((d=this.searchInput)==null?void 0:d.value)||"").trim().toLowerCase(),s=["loading","start","gameplay","tutorial","endgame"],o=Object.fromEntries(s.map(u=>[u,[]])),l=Object.fromEntries(s.map(u=>[u,[]]));r.forEach(u=>{var T,M,S,L;let p=typeof i=="function"?i(u):null;if(!p){let z=window.__editableObjectConfigs;z&&typeof z.get=="function"&&(p=(T=z.get(u))!=null?T:null)}let f=(((M=p==null?void 0:p.identity)==null?void 0:M.category)||"scene").toString(),m=(((S=p==null?void 0:p.identity)==null?void 0:S.id)||u).toString(),h=f.toLowerCase(),g=m.toLowerCase(),b=h.includes("ui")||g.startsWith("ui")||g.includes("label"),y=this.formatDisplayName(m||u),v=((L=p==null?void 0:p.render)==null?void 0:L.visible)===!1||(p==null?void 0:p.enabled)===!1,x=this.getObjectType(p),w={id:u,label:y,category:f,isUi:b,isUnused:v,objectType:x},E=this.inferScreen(w.id,p);if(this.screenFilter!=="all"&&E!==this.screenFilter||!(!a||w.id.toLowerCase().includes(a)||w.label.toLowerCase().includes(a)))return;(w.isUnused?l:o)[E].push(w)});let c={loading:"Loading Screen",start:"Start Screen",gameplay:"Gameplay",tutorial:"Tutorial",endgame:"Endgame"};this.listContainer.innerHTML=`
|
|
76
76
|
${s.map(u=>this.renderGroup(c[u],[...o[u],...l[u]])).join("")}
|
|
77
77
|
`,this.setSelected(this.selectedId)}formatDisplayName(t){let i=t.replace(/^json\./,"").replace(/^ui\./,"").replace(/_\d+$/,"").replace(/\./g," ").replace(/_/g," ");return i=i.split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" "),i}inferScreen(t,i){var o,l;let n=window.__HANDLER_SCREEN_INDEX,r=(o=n==null?void 0:n.instanceToScreen)==null?void 0:o[t];if(r==="loading"||r==="start"||r==="gameplay"||r==="tutorial"||r==="endgame")return r;let a=(((l=i==null?void 0:i.identity)==null?void 0:l.id)||"").toString(),s=`${t} ${a}`.toLowerCase();return s.includes("loading")?"loading":s.includes("start")?"start":s.includes("tutorial")?"tutorial":s.includes("endgame")||s.includes("end_card")||s.includes("endcard")?"endgame":"gameplay"}getObjectType(t){var i,n,r,a,s,o,l,c,d;return t?(i=t.ui)!=null&&i.text?"text":(a=(r=(n=t.render)==null?void 0:n.asset)==null?void 0:r.path)!=null&&a.endsWith(".json")?"animation":((o=(s=t.render)==null?void 0:s.asset)==null?void 0:o.type)==="image"||(l=t.render)!=null&&l.texture?"sprite":(d=(c=t.gameplay)==null?void 0:c.tuning)!=null&&d.panel_width?"graphics":"container":"container"}renderGroup(t,i){if(!i.length)return"";let n=window.getEditableObjectConfig,r=i.map(a=>{var d,u;let s=typeof n=="function"?n(a.id):null;if(!s){let p=window.__editableObjectConfigs;p&&typeof p.get=="function"&&(s=(d=p.get(a.id))!=null?d:null)}let o=this.getTypeIconByType(a.objectType),l=this.getAssetPreview(s),c=(u=s==null?void 0:s.ui)!=null&&u.text?`"${s.ui.text.substring(0,12)}${s.ui.text.length>12?"...":""}"`:"";return`
|
|
78
78
|
<button class="scene-object-item ${a.isUnused?"unused":""}" data-object-id="${a.id}">
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
</div>
|
|
247
247
|
</div>
|
|
248
248
|
</div>
|
|
249
|
-
`}initialize(t,i){var g,b,y,v,x,w,
|
|
249
|
+
`}initialize(t,i){var g,b,y,v,x,w,E,A,_,T,M,S,L,z,D,B;this.options=i,this.root=t.querySelector('[data-panel="scene-tools"]');let n=(g=this.root)==null?void 0:g.querySelector("#debug-highlight-object");n==null||n.addEventListener("change",()=>{var O;return(O=this.options)==null?void 0:O.onHighlightObject(!!n.checked)});let r=(b=this.root)==null?void 0:b.querySelector("#debug-highlight-anchor");r==null||r.addEventListener("change",()=>{var O;return(O=this.options)==null?void 0:O.onHighlightAnchor(!!r.checked)});let a=(y=this.root)==null?void 0:y.querySelector("#debug-nudge-enabled"),s=(v=this.root)==null?void 0:v.querySelector("#debug-nudge-controls");if(a&&s){let O=()=>s.classList.toggle("hidden",!a.checked);a.addEventListener("change",O),O()}Array.from(((x=this.root)==null?void 0:x.querySelectorAll(".debug-arrow-btn"))||[]).forEach(O=>{O.addEventListener("click",()=>{var C,I,j,Q;switch(O.dataset.nudge){case"up":(C=this.options)==null||C.onNudge(0,-1);break;case"down":(I=this.options)==null||I.onNudge(0,1);break;case"left":(j=this.options)==null||j.onNudge(-1,0);break;case"right":(Q=this.options)==null||Q.onNudge(1,0);break;default:break}})});let c=(()=>{var P;let O=window.getEditableEngineConfig;if(typeof O=="function"){let C=O();return(P=C==null?void 0:C.splash)!=null?P:{}}return{}})(),d=(w=this.root)==null?void 0:w.querySelector("#debug-loading-text"),u=(E=this.root)==null?void 0:E.querySelector("#debug-loading-text-scale"),p=(A=this.root)==null?void 0:A.querySelector("#debug-loading-text-scale-value"),f=(_=this.root)==null?void 0:_.querySelector("#debug-splash-on-start"),m=(T=this.root)==null?void 0:T.querySelector("#debug-show-splash");if(d&&(d.value=typeof c.loading_text=="string"&&c.loading_text.length>0?c.loading_text:"Y\xFCkleniyor...",d.addEventListener("input",()=>{var O,P;(P=(O=this.options)==null?void 0:O.onUpdateSplash)==null||P.call(O,{loading_text:d.value})})),u){let O=typeof c.loading_text_scale=="number"?c.loading_text_scale:.6;u.value=O.toString(),p&&(p.textContent=O.toFixed(2)),u.addEventListener("input",()=>{var C,I;let P=Number(u.value);p&&(p.textContent=Number.isFinite(P)?P.toFixed(2):"0.6"),Number.isFinite(P)&&((I=(C=this.options)==null?void 0:C.onUpdateSplash)==null||I.call(C,{loading_text_scale:P}))})}f&&(f.checked=!!c.show_on_start,f.addEventListener("change",()=>{var O,P;(P=(O=this.options)==null?void 0:O.onUpdateSplash)==null||P.call(O,{show_on_start:!!f.checked})})),m==null||m.addEventListener("click",()=>{var O,P;(P=(O=this.options)==null?void 0:O.onShowSplash)==null||P.call(O)}),this.infoEls={instance:(M=this.root)==null?void 0:M.querySelector("#debug-instance-id"),worldX:(S=this.root)==null?void 0:S.querySelector("#debug-world-x"),worldY:(L=this.root)==null?void 0:L.querySelector("#debug-world-y"),anchorX:(z=this.root)==null?void 0:z.querySelector("#debug-config-x"),anchorY:(D=this.root)==null?void 0:D.querySelector("#debug-config-y")};let h=(B=this.root)==null?void 0:B.querySelector("[data-advanced-toggle]");h&&h.addEventListener("click",()=>{let O=h.closest(".debug-collapsible");O==null||O.classList.toggle("collapsed")})}getNudgeStep(){var n,r;let t=(n=this.root)==null?void 0:n.querySelector("#debug-nudge-step"),i=Number((r=t==null?void 0:t.value)!=null?r:10);return Number.isFinite(i)?i:10}updateInfo(t){if(!t){this.infoEls.instance&&(this.infoEls.instance.textContent="\u2014"),this.infoEls.worldX&&(this.infoEls.worldX.textContent="0"),this.infoEls.worldY&&(this.infoEls.worldY.textContent="0"),this.infoEls.anchorX&&(this.infoEls.anchorX.textContent="\u2014"),this.infoEls.anchorY&&(this.infoEls.anchorY.textContent="\u2014");return}this.infoEls.instance&&(this.infoEls.instance.textContent=t.instanceId),this.infoEls.worldX&&(this.infoEls.worldX.textContent=t.worldX.toFixed(1)),this.infoEls.worldY&&(this.infoEls.worldY.textContent=t.worldY.toFixed(1)),this.infoEls.anchorX&&(this.infoEls.anchorX.textContent=t.anchorX==null?"\u2014":t.anchorX.toFixed(1)),this.infoEls.anchorY&&(this.infoEls.anchorY.textContent=t.anchorY==null?"\u2014":t.anchorY.toFixed(1))}};var Br=class{constructor(){this.root=null;this.slotsContainer=null;this.options=null;this.registry=null;this.expandedSlot=null}mergeRegistries(t,i){let n=t||{},r=i||{},a={slots:Array.isArray(r.slots)?[...r.slots]:[],libraryAssets:typeof r.libraryAssets=="object"&&r.libraryAssets?{...r.libraryAssets}:{},categories:Array.isArray(r.categories)?[...r.categories]:[]},s=Array.isArray(n.slots)?n.slots:[];if(s.length>0&&a.slots.length>0)for(let c of a.slots){let d=s.find(u=>(u==null?void 0:u.slotId)&&u.slotId===(c==null?void 0:c.slotId));d!=null&&d.currentAsset&&d.currentAsset!==(c==null?void 0:c.currentAsset)&&(c.currentAsset=d.currentAsset)}let o=n.libraryAssets||{};for(let[c,d]of Object.entries(o)){if(!Array.isArray(d))continue;a.libraryAssets[c]||(a.libraryAssets[c]=[]);let u=new Set((a.libraryAssets[c]||[]).map(p=>p==null?void 0:p.filename));for(let p of d){let f=p==null?void 0:p.filename;!f||u.has(f)||(a.libraryAssets[c].unshift(p),u.add(f))}}let l=new Set(a.categories||[]);for(let c of n.categories||[])typeof c=="string"&&l.add(c);return a.categories=Array.from(l),a}render(){return`
|
|
250
250
|
<div class="scene-panel library-panel panel-accent-purple" data-panel="library">
|
|
251
251
|
<div class="scene-panel-header" data-panel-handle>
|
|
252
252
|
<div class="panel-title">
|
|
@@ -402,7 +402,7 @@
|
|
|
402
402
|
</select>
|
|
403
403
|
</div>
|
|
404
404
|
</div>
|
|
405
|
-
`);for(let u in n){if(u==="id")continue;let p=n[u],f=`${r}.${u}`;if(u==="props"&&p&&typeof p=="object"){let h=[];for(let g in p){let b=p[g],y=`${f}.${g}`,v=l==null?void 0:l[g];if((g==="targetId"||g==="inputId")&&typeof b=="string"){let x=(()=>{try{let A=window,_=A==null?void 0:A.__editableConfig;if(!(_!=null&&_.objects))return[];let T=[];if(_.objects instanceof Map)for(let M of _.objects.keys())T.push(M);else typeof _.objects=="object"&&T.push(...Object.keys(_.objects));return T.sort()}catch{return[]}})(),w=b||"",
|
|
405
|
+
`);for(let u in n){if(u==="id")continue;let p=n[u],f=`${r}.${u}`;if(u==="props"&&p&&typeof p=="object"){let h=[];for(let g in p){let b=p[g],y=`${f}.${g}`,v=l==null?void 0:l[g];if((g==="targetId"||g==="inputId")&&typeof b=="string"){let x=(()=>{try{let A=window,_=A==null?void 0:A.__editableConfig;if(!(_!=null&&_.objects))return[];let T=[];if(_.objects instanceof Map)for(let M of _.objects.keys())T.push(M);else typeof _.objects=="object"&&T.push(...Object.keys(_.objects));return T.sort()}catch{return[]}})(),w=b||"",E=w&&!x.includes(w)?[w,...x]:x;h.push(`
|
|
406
406
|
<div class="inspector-property inspector-property-text">
|
|
407
407
|
<label class="inspector-property-label">${this.formatLabel(g)}</label>
|
|
408
408
|
<div class="inspector-input-group">
|
|
@@ -410,7 +410,7 @@
|
|
|
410
410
|
data-property-path="${y}"
|
|
411
411
|
data-object-id="${t}">
|
|
412
412
|
<option value="" ${w?"":"selected"}>None</option>
|
|
413
|
-
${
|
|
413
|
+
${E.map(A=>`<option value="${A}" ${A===w?"selected":""}>${A}</option>`).join("")}
|
|
414
414
|
</select>
|
|
415
415
|
</div>
|
|
416
416
|
</div>
|
|
@@ -511,7 +511,7 @@
|
|
|
511
511
|
${a.join("")}
|
|
512
512
|
</div>
|
|
513
513
|
</div>
|
|
514
|
-
`}attachEventListeners(){var c,d,u,p;if(!this.contentContainer)return;let t=this.contentContainer.querySelectorAll("[data-property-path]"),i=Ym((f,m,h)=>{var g,b;this.updateManager.updateProperty(f,m,h),(b=(g=this.options)==null?void 0:g.onPropertyChange)==null||b.call(g,f,m,h)},300);t.forEach(f=>{let m=
|
|
514
|
+
`}attachEventListeners(){var c,d,u,p;if(!this.contentContainer)return;let t=this.contentContainer.querySelectorAll("[data-property-path]"),i=Ym((f,m,h)=>{var g,b;this.updateManager.updateProperty(f,m,h),(b=(g=this.options)==null?void 0:g.onPropertyChange)==null||b.call(g,f,m,h)},300);t.forEach(f=>{let m=g=>{var x,w;let b=g.target,y=b.dataset.propertyPath,v=b.dataset.objectId;if(y&&v){let E=b.value;if(b.type==="checkbox")E=b.checked;else if(b.type==="number"&&(E=parseFloat(b.value),isNaN(E)))return;b.type==="text"||b.type==="range"||b.tagName==="TEXTAREA"?i(v,y,E):(this.updateManager.updateProperty(v,y,E),(w=(x=this.options)==null?void 0:x.onPropertyChange)==null||w.call(x,v,y,E))}},h=f.dataset.propertyPath;h==="logic.id"||h!=null&&h.endsWith(".logic.id")?(console.log("[Inspector] Found logic ID selector at path:",h),f.addEventListener("change",async g=>{let b=g.target,y=b.dataset.propertyPath,v=b.dataset.objectId;console.log("[Inspector] Logic ID changed to:",b.value,"path:",y),y&&v&&(await this.updateManager.updateProperty(v,y,b.value),console.log("[Inspector] Property updated, refreshing in 500ms..."),setTimeout(()=>{console.log("[Inspector] Refreshing inspector now"),this.selectedObjectId&&this.loadObject(this.selectedObjectId)},500))})):(f.addEventListener("change",m),(f.tagName==="INPUT"||f.tagName==="TEXTAREA")&&f.addEventListener("input",m))}),this.contentContainer.querySelectorAll("[data-action]").forEach(f=>{f.addEventListener("click",m=>{let h=m.target,g=h.dataset.action,b=h.dataset.path,y=h.dataset.object;g&&b&&y&&this.quickActions.handleAction(g,y,b)})}),this.contentContainer.querySelectorAll("[data-section-toggle]").forEach(f=>{f.addEventListener("click",m=>{var b,y;let h=m.target,g=h.dataset.sectionToggle||((b=h.closest("[data-section-toggle]"))==null?void 0:b.getAttribute("data-section-toggle"));if(g){let v=(y=this.contentContainer)==null?void 0:y.querySelector(`[data-section="${g}"]`);v==null||v.classList.toggle("collapsed")}})});let a=(c=this.root)==null?void 0:c.querySelector("[data-inspector-advanced]");a==null||a.addEventListener("click",()=>{this.showAdvanced=!this.showAdvanced,this.selectedObjectId&&this.loadObject(this.selectedObjectId)});let s=(d=this.root)==null?void 0:d.querySelector("[data-convert-toggle]");s==null||s.addEventListener("click",()=>{var m;let f=(m=this.root)==null?void 0:m.querySelector("[data-convert-menu]");f==null||f.classList.toggle("hidden")});let o=(u=this.contentContainer)==null?void 0:u.querySelector("[data-inspector-add-component-btn]"),l=(p=this.contentContainer)==null?void 0:p.querySelector("[data-inspector-component-select]");o==null||o.addEventListener("click",async()=>{let f=l.value;f&&this.selectedObjectId&&await this.addComponent(this.selectedObjectId,f)})}async addComponent(t,i){console.log("[InspectorPanel] Adding component:",i,"to:",t);let n=window.getEditableObjectConfig,r=n==null?void 0:n(t);if(!r){console.error("[InspectorPanel] Failed to get config for:",t);return}let a=window.__editableConfig,s=a==null?void 0:a.schemas,o=null;s instanceof Map?o=s.get(i):s&&typeof s=="object"&&(o=s[i]),o||console.warn("[InspectorPanel] Schema not found for component:",i);let l=(o==null?void 0:o.defaults)||{enabled:!0};r[i]={...l},await this.updateManager.updateProperty(t,i,r[i]),this.loadObject(t),console.log("[InspectorPanel] Component added successfully")}isSectionMeaningful(t,i,n){var a,s;if(["identity","transform","render"].includes(t))return!0;if(!i||typeof i!="object"||t==="ui"&&((s=(a=n.render)==null?void 0:a.asset)==null?void 0:s.type)==="image")return!1;if(t==="interaction")return i.clickable===!0||i.draggable===!0;if(i.enabled===!0||i.active===!0||i.visible===!0)return!0;if(t==="ui")return!!(i.text||i.font||i.fontSize);let r=Object.keys(i);return r.length===0||r.length===1&&r[0]==="enabled"&&i.enabled===!1?!1:["audio","effects","physics","motion","gameplay"].includes(t)?i.enabled===!0:!0}showError(t){this.contentContainer&&(this.contentContainer.innerHTML=`
|
|
515
515
|
<div class="inspector-empty">
|
|
516
516
|
<span class="inspector-empty-icon">\u26A0\uFE0F</span>
|
|
517
517
|
<span class="inspector-empty-text">${t}</span>
|
|
@@ -932,7 +932,7 @@ Generate the requested asset matching the brand style.${e.needsTransparency?" Ba
|
|
|
932
932
|
</div>
|
|
933
933
|
</div>
|
|
934
934
|
</div>
|
|
935
|
-
`;let a=r.querySelector(".ai-modal-close");a==null||a.addEventListener("click",()=>this.closeAiModal()),r.addEventListener("click",b=>{b.target===r&&this.closeAiModal()}),this.aiModal=r,this.aiKeyInput=r.querySelector("[data-ai-key]"),this.aiModelSelect=r.querySelector("[data-ai-model]"),this.aiPromptInput=r.querySelector("[data-ai-prompt]"),this.aiStrengthInput=r.querySelector("[data-ai-strength]"),this.aiStrengthValue=r.querySelector("[data-ai-strength-value]"),this.aiModalSubtitle=r.querySelector(".ai-modal-subtitle"),this.aiGalleryToggle=r.querySelector("[data-ai-gallery-toggle]"),this.aiGalleryEl=r.querySelector("[data-ai-gallery]"),this.aiGalleryGrid=r.querySelector("[data-ai-gallery-grid]"),this.aiReferenceInput=r.querySelector("[data-ai-ref-input]"),this.aiReferenceName=r.querySelector("[data-ai-ref-name]"),this.aiRemoveBgToggle=r.querySelector("[data-ai-remove-bg]"),this.aiUseOutputToggle=r.querySelector("[data-ai-use-output]"),this.aiGenerateBtn=r.querySelector("[data-ai-generate]"),this.aiApplyBtn=r.querySelector("[data-ai-apply]"),this.aiSaveLibraryBtn=r.querySelector("[data-ai-save-library]"),this.aiCropBtn=r.querySelector("[data-ai-crop]"),this.aiDownloadBtn=r.querySelector("[data-ai-download]"),this.aiPreviewImg=r.querySelector("[data-ai-preview]"),this.aiStatusEl=r.querySelector("[data-ai-status]"),this.aiLoadingEl=r.querySelector("[data-ai-loading]"),this.aiBgToleranceInput=r.querySelector("[data-ai-bg-tolerance]"),this.aiBgToleranceValue=r.querySelector("[data-ai-bg-tolerance-value]"),(o=this.aiRemoveBgToggle)==null||o.addEventListener("change",()=>{this.refreshAiOutputFromRaw()});let s=r.querySelector("[data-ai-ref-button]");s==null||s.addEventListener("click",()=>{var b;return(b=this.aiReferenceInput)==null?void 0:b.click()}),(l=this.aiGalleryToggle)==null||l.addEventListener("click",()=>this.toggleAiGallery()),(c=this.aiStrengthInput)==null||c.addEventListener("input",()=>{var y,v;let b=(v=(y=this.aiStrengthInput)==null?void 0:y.value)!=null?v:"5";this.aiStrengthValue&&(this.aiStrengthValue.textContent=b)}),(d=this.aiBgToleranceInput)==null||d.addEventListener("input",()=>{var y,v;let b=(v=(y=this.aiBgToleranceInput)==null?void 0:y.value)!=null?v:"30";this.aiBgToleranceValue&&(this.aiBgToleranceValue.textContent=b),this.refreshAiOutputFromRaw()}),(u=this.aiReferenceInput)==null||u.addEventListener("change",()=>{var y,v,x;let b=(x=(v=(y=this.aiReferenceInput)==null?void 0:y.files)==null?void 0:v[0])!=null?x:null;this.aiReferenceFile=b,this.aiReferenceName&&(this.aiReferenceName.textContent=b?`${b.name} (loaded)`:"Optional"),b&&this.setAiStatus(`Reference attached: ${b.name}`)}),(p=this.aiGenerateBtn)==null||p.addEventListener("click",()=>{this.handleAiGenerate()}),(f=this.aiApplyBtn)==null||f.addEventListener("click",()=>this.handleAiApply()),(m=this.aiSaveLibraryBtn)==null||m.addEventListener("click",()=>{this.handleAiSaveToLibrary()}),(h=this.aiCropBtn)==null||h.addEventListener("click",()=>{this.handleAiCrop()}),(g=this.aiDownloadBtn)==null||g.addEventListener("click",()=>this.handleAiDownload()),document.body.appendChild(r),this.setAiOutputButtonsEnabled(!1),this.setAiStatus("Ready."),this.updateAiBasePreview(i),this.updateAiPreview(),this.renderAiGallery()}closeAiModal(){this.aiModal&&(this.aiModal.remove(),this.aiModal=null),this.aiTargetKey=null,this.aiBaseValue=null,this.aiContext=null,this.aiKeyInput=null,this.aiModelSelect=null,this.aiPromptInput=null,this.aiStrengthInput=null,this.aiStrengthValue=null,this.aiModalSubtitle=null,this.aiGalleryToggle=null,this.aiGalleryEl=null,this.aiGalleryGrid=null,this.aiReferenceInput=null,this.aiReferenceName=null,this.aiReferenceFile=null,this.aiRemoveBgToggle=null,this.aiUseOutputToggle=null,this.aiGenerateBtn=null,this.aiApplyBtn=null,this.aiCropBtn=null,this.aiDownloadBtn=null,this.aiPreviewImg=null,this.aiStatusEl=null,this.aiLoadingEl=null,this.aiBgToleranceInput=null,this.aiBgToleranceValue=null}async handleAiGenerate(){var d,u,p,f,m,h,g,b,y,v,x,w,S,A,_,T,M,E,L,z;if(console.log("[CustomizePanel] handleAiGenerate clicked"),!this.aiGenerateBtn)return;let t=(p=(u=(d=this.aiKeyInput)==null?void 0:d.value)==null?void 0:u.trim())!=null?p:"",i=(m=(f=this.aiModelSelect)==null?void 0:f.value)!=null?m:"gemini-2.5-flash-image",n=(b=(g=(h=this.aiPromptInput)==null?void 0:h.value)==null?void 0:g.trim())!=null?b:"",r=(v=(y=this.aiRemoveBgToggle)==null?void 0:y.checked)!=null?v:!1,a=r,s=r,o=Number((w=(x=this.aiStrengthInput)==null?void 0:x.value)!=null?w:"5");if(!t){this.setAiStatus("Missing API key.");return}if(!n){this.setAiStatus("Add a prompt.");return}let l=this.getSelectedAssetInput(),c=((S=l==null?void 0:l.value)==null?void 0:S.trim())||((A=this.aiBaseValue)==null?void 0:A.trim())||"";if(!c&&!this.aiOutputDataUrl){this.setAiStatus("Select an asset first.");return}this.setAiLoading(!0),this.setAiStatus("Generating...");try{let D=null,B=(_=this.getSelectedAssetKey())!=null?_:"unknown",O=(T=this.aiUseOutputToggle)!=null&&T.checked&&this.aiOutputDataUrl?"ai-output":"asset-value";if((M=this.aiUseOutputToggle)!=null&&M.checked&&this.aiOutputDataUrl){let Pe=zl(this.aiOutputDataUrl,"ai-output.png");if(Pe){let je=await Ot(Pe);je&&(D={input:{base64:je.base64,mimeType:je.mimeType},dataUrl:je.dataUrl,width:je.width,height:je.height})}}if(D||(D=await this.getImageDataFromAsset(c)),!D){this.setAiStatus("Unable to load the base image.");return}let P=[D.input],C=!1;if(this.aiReferenceFile){let Pe=await Ot(this.aiReferenceFile);Pe?(P.push({base64:Pe.base64,mimeType:Pe.mimeType}),C=!0,this.setAiStatus(`Generating with reference: ${this.aiReferenceFile.name}`)):this.setAiStatus("Reference image failed to load, generating without reference.")}let I=tg(n,{includeReference:C,includeMagenta:a,changeLevel:o}),j=(L=(E=this.aiReferenceFile)==null?void 0:E.name)!=null?L:"none";console.info("[AI] Final prompt:",I),console.info("[AI] Image sources:",{assetKey:B,base:O,reference:j});let Q=Uh(D.width,D.height);console.info("[AI] CRITICAL: Calling generateImageWithGemini25Flash NOW...");let se=await Ui(t,I,P,{aspectRatio:Q,model:i});console.info("[AI] CRITICAL: generateImageWithGemini25Flash returned! Length:",se==null?void 0:se.length),this.aiRawOutputDataUrl=se,await this.refreshAiOutputFromRaw()}catch(D){console.error("[CustomizePanel] AI Generate Error:",D),this.setAiStatus("Generation failed. Check console.")}finally{this.setAiLoading(!1),((z=this.aiStatusEl)==null?void 0:z.textContent)==="Generating..."&&this.setAiStatus("Ready.")}}async refreshAiOutputFromRaw(){var r,a,s,o;if(!this.aiRawOutputDataUrl)return;let t=(a=(r=this.aiRemoveBgToggle)==null?void 0:r.checked)!=null?a:!1,i=Number((o=(s=this.aiBgToleranceInput)==null?void 0:s.value)!=null?o:"30"),n=this.aiRawOutputDataUrl;if(t){let l=await $i(this.aiRawOutputDataUrl,i);l&&(n=l)}this.setAiOutput(n),this.setAiStatus("Ready.")}setAiOutput(t){var n,r;this.aiOutputDataUrl=t,this.aiOutputKey=this.getSelectedAssetKey(),this.updateAiPreview(),this.setAiOutputButtonsEnabled(!0);let i=(n=this.previewModal)==null?void 0:n.querySelector("[data-asset-ai-preview]");this.updateAiModalPreview(i,(r=this.activePreviewKey)!=null?r:void 0)}setAiOutputButtonsEnabled(t){this.aiApplyBtn&&(this.aiApplyBtn.disabled=!t),this.aiSaveLibraryBtn&&(this.aiSaveLibraryBtn.disabled=!t),this.aiCropBtn&&(this.aiCropBtn.disabled=!t),this.aiDownloadBtn&&(this.aiDownloadBtn.disabled=!t)}handleAiApply(){var i,n,r;let t=this.getSelectedAssetInput();if(!this.aiOutputDataUrl){this.setAiStatus("Generate output first.");return}if(t)console.log("[CustomizePanel] Applying AI output to brand asset:",t.dataset.assetKey),t.value=this.aiOutputDataUrl,this.handleAssetValueChange((i=t.dataset.assetKey)!=null?i:"",t),this.setAiStatus("Applied. Restarting game...");else{let a=((n=this.aiContext)==null?void 0:n.objectId)||this.inferObjectIdFromAssetKey(this.aiTargetKey||""),s=((r=this.aiContext)==null?void 0:r.path)||this.inferPathFromAssetKey(this.aiTargetKey||"");if(a&&s)console.log("[CustomizePanel] Applying AI output directly to object:",a,s),this.applyObjectPropertyValue(a,s,this.aiOutputDataUrl),this.setAiStatus("Applied directly. Restarting game..."),window.dispatchEvent(new CustomEvent("inspector:refresh"));else{this.setAiStatus("No target input found to apply.");return}}setTimeout(()=>{this.closeAiModal()},500)}async handleAiSaveToLibrary(){var a,s,o;if(!this.aiOutputDataUrl){this.setAiStatus("Generate output first.");return}if(!this.getSelectedAssetKey()){this.setAiStatus("No asset selected.");return}let n=`${(this.aiTargetKey||"asset").replace(/[^a-zA-Z0-9_-]/g,"_")}_ai_${Date.now()}`,r=this.inferCategoryFromAssetKey(this.aiTargetKey||"");this.setAiStatus("Saving to library...");try{let c=await(await fetch("/api/library/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:r,filename:`${n}.png`,data:this.aiOutputDataUrl,overwrite:!0})})).json();if(c.success){console.log("[CustomizePanel] \u2705 Saved to library:",c.path),this.setAiStatus(`Saved as ${n}. Applying...`);let d=window.addAssetToRegistry;typeof d=="function"&&(console.log("[CustomizePanel] Logic: Adding to registry category:",r),d(r,`${n}.png`));let u=window.refreshAssetLibrary;typeof u=="function"&&(console.log("[CustomizePanel] Logic: Refreshing library panel"),u());let p=((a=this.aiContext)==null?void 0:a.objectId)||this.inferObjectIdFromAssetKey(this.aiTargetKey||""),f=((s=this.aiContext)==null?void 0:s.path)||this.inferPathFromAssetKey(this.aiTargetKey||""),m=this.getSelectedAssetInput();if(m&&(m.value=c.path,this.handleAssetValueChange((o=m.dataset.assetKey)!=null?o:"",m)),p&&f){console.log("[CustomizePanel] Saved and applying directly to object:",p,f);let h=window.applyAssetToSlot,g=/texture|image|sprite|asset\\.path/i.test(f)||/\\.(png|jpg|jpeg)$/i.test(String(c.path||""));if(typeof h=="function"&&g){let b=this.getFilenameFromPath(c.path);h(p,b,r)}else this.applyObjectPropertyValue(p,f,c.path);window.dispatchEvent(new CustomEvent("inspector:refresh"))}setTimeout(()=>{this.closeAiModal()},1e3)}else console.error("[CustomizePanel] \u274C Save failed:",c.error),this.setAiStatus(`Save failed: ${c.error}`)}catch(l){console.error("[CustomizePanel] \u274C Save error:",l),this.setAiStatus("Save failed. Check console.")}}inferCategoryFromAssetKey(t){var s;let i=(s=this.aiContext)==null?void 0:s.objectId,n=t||this.aiTargetKey||"",r=window.getEditableAssets;if(typeof r=="function"){let o=r();if(o!=null&&o.slots){let l=o.slots.find(c=>i&&c.objectId===i||c.currentAsset===n||c.slotId===n||c.currentAsset&&c.currentAsset.includes(n)||n.includes(c.slotId));if(l){let c=l.libraryFolder||l.category;if(c)return c}}}let a=n.toLowerCase();return a.includes("background")?"backgrounds":a.includes("character")?"characters":a.includes("key")?"collectedkeys":a.includes("draggable")?"draggables":a.includes("environment")||a.includes("env")||a.includes("hand")||a.includes("prop")||a.includes("item")||a.includes("decor")||a.includes("object")?"environment":a.includes("machine")?"machines":a.includes("tutorial")?"tutorial":a.includes("ui")||a.includes("button")||a.includes("label")||a.includes("icon")||a.includes("logo")||a.includes("cta")||a.includes("menu")||a.includes("overlay")?"ui":a.includes("effect")||a.includes("confetti")||a.includes("particle")?"effects":"ui"}inferObjectIdFromAssetKey(t){let i=window.getEditableAssets;if(typeof i!="function")return null;let n=i();if(!(n!=null&&n.slots))return null;let r=n.slots.find(a=>a.currentAsset===t||a.slotId===t);return(r==null?void 0:r.objectId)||null}inferPathFromAssetKey(t){let i=window.getEditableAssets;if(typeof i!="function")return null;let n=i();if(!(n!=null&&n.slots))return null;let r=n.slots.find(s=>s.currentAsset===t||s.slotId===t);if(!r)return null;let a=r.category;return a==="render"||a==="backgrounds"||a==="characters"?"render.texture":a==="ui"?"ui.image":a==="audio"?"audio.src":"render.texture"}getFilenameFromPath(t){if(!t)return"";let i=t.split("/");return i[i.length-1]}async handleAiCrop(){var o;if(!this.aiOutputDataUrl){this.setAiStatus("Generate output first.");return}let t=this.getSelectedAssetInput(),i=(o=t==null?void 0:t.value)!=null?o:"",n=await this.getImageDimensions(i);if(!n){this.setAiStatus("Unable to read target dimensions.");return}let r=zl(this.aiOutputDataUrl,"ai-output.png");if(!r)return;let a=await this.showManualCropModal(r,n,i);if(!a)return;let s=await $h(a);s&&this.setAiOutput(s)}handleAiDownload(){var n;if(!this.aiOutputDataUrl)return;let t=(n=this.getSelectedAssetKey())!=null?n:"ai-image",i=document.createElement("a");i.href=this.aiOutputDataUrl,i.download=`${t}-ai.png`,i.click()}handleAssetValueChange(t,i){this.previewModal&&this.closePreviewModal(),this.scheduleAutoApply(),this.updatePreviewIfOpen(t,i.value,i.dataset.assetType)}async handleAssetUpload(t,i,n){let r=i.value,a=t;if(t.type.startsWith("image/")){let l=await this.getImageDimensions(r);if(l){let c=await this.showManualCropModal(t,l,r);if(!c)return;a=c}}let s=URL.createObjectURL(a),o=i.dataset.objectUrl;if(o)try{URL.revokeObjectURL(o)}catch{}i.dataset.objectUrl=s,i.dataset.assetType=a.type,i.value=s,this.handleAssetValueChange(n,i)}scheduleAutoApply(){this.options&&(this.autoApplyTimer&&window.clearTimeout(this.autoApplyTimer),console.log("[CustomizePanel] Scheduling auto-apply in 250ms"),this.autoApplyTimer=window.setTimeout(()=>{this.autoApplyTimer=null,console.log("[CustomizePanel] Executing auto-apply now"),this.handleApplyWithSource("auto")},250))}previewAsset(t,i,n,r){if(!i)return;let a=this.resolveAssetUrls(i);if(a.length===0)return;let s=n||this.guessMimeType(i);this.activePreviewKey=t,this.activePreviewValue=i,this.activePreviewFileInput=r!=null?r:null,this.openPreviewModal(t,i,a,s)}resolveAssetUrls(t){let i=t.trim();if(!i)return[];if(console.log("[CustomizePanel] Resolving asset urls for:",i),/^(blob:|data:|https?:|\/)/.test(i))return console.log("[CustomizePanel] Path is absolute or data/blob, using as is"),[i];let n=i.replace(/^\.?\//,""),r=[];return n.startsWith("raw/")?r=[`/${n}`,`/assets/${n}`]:n.startsWith("assets/")?r=[`/${n}`]:r=[`/raw/${n}`,`/assets/raw/${n}`,`/assets/${n}`,`/${n}`],console.log("[CustomizePanel] Resolved to possible paths:",r),r}guessMimeType(t){let i=t.toLowerCase();return i.endsWith(".png")||i.endsWith(".jpg")||i.endsWith(".jpeg")||i.endsWith(".gif")||i.endsWith(".webp")||i.endsWith(".svg")?"image":i.endsWith(".mp3")||i.endsWith(".wav")||i.endsWith(".ogg")?"audio":i.endsWith(".json")?"json":"file"}openPreviewModal(t,i,n,r){this.closePreviewModal(!0);let a=document.createElement("div");a.className="asset-preview-modal",a.innerHTML=`
|
|
935
|
+
`;let a=r.querySelector(".ai-modal-close");a==null||a.addEventListener("click",()=>this.closeAiModal()),r.addEventListener("click",b=>{b.target===r&&this.closeAiModal()}),this.aiModal=r,this.aiKeyInput=r.querySelector("[data-ai-key]"),this.aiModelSelect=r.querySelector("[data-ai-model]"),this.aiPromptInput=r.querySelector("[data-ai-prompt]"),this.aiStrengthInput=r.querySelector("[data-ai-strength]"),this.aiStrengthValue=r.querySelector("[data-ai-strength-value]"),this.aiModalSubtitle=r.querySelector(".ai-modal-subtitle"),this.aiGalleryToggle=r.querySelector("[data-ai-gallery-toggle]"),this.aiGalleryEl=r.querySelector("[data-ai-gallery]"),this.aiGalleryGrid=r.querySelector("[data-ai-gallery-grid]"),this.aiReferenceInput=r.querySelector("[data-ai-ref-input]"),this.aiReferenceName=r.querySelector("[data-ai-ref-name]"),this.aiRemoveBgToggle=r.querySelector("[data-ai-remove-bg]"),this.aiUseOutputToggle=r.querySelector("[data-ai-use-output]"),this.aiGenerateBtn=r.querySelector("[data-ai-generate]"),this.aiApplyBtn=r.querySelector("[data-ai-apply]"),this.aiSaveLibraryBtn=r.querySelector("[data-ai-save-library]"),this.aiCropBtn=r.querySelector("[data-ai-crop]"),this.aiDownloadBtn=r.querySelector("[data-ai-download]"),this.aiPreviewImg=r.querySelector("[data-ai-preview]"),this.aiStatusEl=r.querySelector("[data-ai-status]"),this.aiLoadingEl=r.querySelector("[data-ai-loading]"),this.aiBgToleranceInput=r.querySelector("[data-ai-bg-tolerance]"),this.aiBgToleranceValue=r.querySelector("[data-ai-bg-tolerance-value]"),(o=this.aiRemoveBgToggle)==null||o.addEventListener("change",()=>{this.refreshAiOutputFromRaw()});let s=r.querySelector("[data-ai-ref-button]");s==null||s.addEventListener("click",()=>{var b;return(b=this.aiReferenceInput)==null?void 0:b.click()}),(l=this.aiGalleryToggle)==null||l.addEventListener("click",()=>this.toggleAiGallery()),(c=this.aiStrengthInput)==null||c.addEventListener("input",()=>{var y,v;let b=(v=(y=this.aiStrengthInput)==null?void 0:y.value)!=null?v:"5";this.aiStrengthValue&&(this.aiStrengthValue.textContent=b)}),(d=this.aiBgToleranceInput)==null||d.addEventListener("input",()=>{var y,v;let b=(v=(y=this.aiBgToleranceInput)==null?void 0:y.value)!=null?v:"30";this.aiBgToleranceValue&&(this.aiBgToleranceValue.textContent=b),this.refreshAiOutputFromRaw()}),(u=this.aiReferenceInput)==null||u.addEventListener("change",()=>{var y,v,x;let b=(x=(v=(y=this.aiReferenceInput)==null?void 0:y.files)==null?void 0:v[0])!=null?x:null;this.aiReferenceFile=b,this.aiReferenceName&&(this.aiReferenceName.textContent=b?`${b.name} (loaded)`:"Optional"),b&&this.setAiStatus(`Reference attached: ${b.name}`)}),(p=this.aiGenerateBtn)==null||p.addEventListener("click",()=>{this.handleAiGenerate()}),(f=this.aiApplyBtn)==null||f.addEventListener("click",()=>this.handleAiApply()),(m=this.aiSaveLibraryBtn)==null||m.addEventListener("click",()=>{this.handleAiSaveToLibrary()}),(h=this.aiCropBtn)==null||h.addEventListener("click",()=>{this.handleAiCrop()}),(g=this.aiDownloadBtn)==null||g.addEventListener("click",()=>this.handleAiDownload()),document.body.appendChild(r),this.setAiOutputButtonsEnabled(!1),this.setAiStatus("Ready."),this.updateAiBasePreview(i),this.updateAiPreview(),this.renderAiGallery()}closeAiModal(){this.aiModal&&(this.aiModal.remove(),this.aiModal=null),this.aiTargetKey=null,this.aiBaseValue=null,this.aiContext=null,this.aiKeyInput=null,this.aiModelSelect=null,this.aiPromptInput=null,this.aiStrengthInput=null,this.aiStrengthValue=null,this.aiModalSubtitle=null,this.aiGalleryToggle=null,this.aiGalleryEl=null,this.aiGalleryGrid=null,this.aiReferenceInput=null,this.aiReferenceName=null,this.aiReferenceFile=null,this.aiRemoveBgToggle=null,this.aiUseOutputToggle=null,this.aiGenerateBtn=null,this.aiApplyBtn=null,this.aiCropBtn=null,this.aiDownloadBtn=null,this.aiPreviewImg=null,this.aiStatusEl=null,this.aiLoadingEl=null,this.aiBgToleranceInput=null,this.aiBgToleranceValue=null}async handleAiGenerate(){var d,u,p,f,m,h,g,b,y,v,x,w,E,A,_,T,M,S,L,z;if(console.log("[CustomizePanel] handleAiGenerate clicked"),!this.aiGenerateBtn)return;let t=(p=(u=(d=this.aiKeyInput)==null?void 0:d.value)==null?void 0:u.trim())!=null?p:"",i=(m=(f=this.aiModelSelect)==null?void 0:f.value)!=null?m:"gemini-2.5-flash-image",n=(b=(g=(h=this.aiPromptInput)==null?void 0:h.value)==null?void 0:g.trim())!=null?b:"",r=(v=(y=this.aiRemoveBgToggle)==null?void 0:y.checked)!=null?v:!1,a=r,s=r,o=Number((w=(x=this.aiStrengthInput)==null?void 0:x.value)!=null?w:"5");if(!t){this.setAiStatus("Missing API key.");return}if(!n){this.setAiStatus("Add a prompt.");return}let l=this.getSelectedAssetInput(),c=((E=l==null?void 0:l.value)==null?void 0:E.trim())||((A=this.aiBaseValue)==null?void 0:A.trim())||"";if(!c&&!this.aiOutputDataUrl){this.setAiStatus("Select an asset first.");return}this.setAiLoading(!0),this.setAiStatus("Generating...");try{let D=null,B=(_=this.getSelectedAssetKey())!=null?_:"unknown",O=(T=this.aiUseOutputToggle)!=null&&T.checked&&this.aiOutputDataUrl?"ai-output":"asset-value";if((M=this.aiUseOutputToggle)!=null&&M.checked&&this.aiOutputDataUrl){let Pe=zl(this.aiOutputDataUrl,"ai-output.png");if(Pe){let je=await Ot(Pe);je&&(D={input:{base64:je.base64,mimeType:je.mimeType},dataUrl:je.dataUrl,width:je.width,height:je.height})}}if(D||(D=await this.getImageDataFromAsset(c)),!D){this.setAiStatus("Unable to load the base image.");return}let P=[D.input],C=!1;if(this.aiReferenceFile){let Pe=await Ot(this.aiReferenceFile);Pe?(P.push({base64:Pe.base64,mimeType:Pe.mimeType}),C=!0,this.setAiStatus(`Generating with reference: ${this.aiReferenceFile.name}`)):this.setAiStatus("Reference image failed to load, generating without reference.")}let I=tg(n,{includeReference:C,includeMagenta:a,changeLevel:o}),j=(L=(S=this.aiReferenceFile)==null?void 0:S.name)!=null?L:"none";console.info("[AI] Final prompt:",I),console.info("[AI] Image sources:",{assetKey:B,base:O,reference:j});let Q=Uh(D.width,D.height);console.info("[AI] CRITICAL: Calling generateImageWithGemini25Flash NOW...");let se=await Ui(t,I,P,{aspectRatio:Q,model:i});console.info("[AI] CRITICAL: generateImageWithGemini25Flash returned! Length:",se==null?void 0:se.length),this.aiRawOutputDataUrl=se,await this.refreshAiOutputFromRaw()}catch(D){console.error("[CustomizePanel] AI Generate Error:",D),this.setAiStatus("Generation failed. Check console.")}finally{this.setAiLoading(!1),((z=this.aiStatusEl)==null?void 0:z.textContent)==="Generating..."&&this.setAiStatus("Ready.")}}async refreshAiOutputFromRaw(){var r,a,s,o;if(!this.aiRawOutputDataUrl)return;let t=(a=(r=this.aiRemoveBgToggle)==null?void 0:r.checked)!=null?a:!1,i=Number((o=(s=this.aiBgToleranceInput)==null?void 0:s.value)!=null?o:"30"),n=this.aiRawOutputDataUrl;if(t){let l=await $i(this.aiRawOutputDataUrl,i);l&&(n=l)}this.setAiOutput(n),this.setAiStatus("Ready.")}setAiOutput(t){var n,r;this.aiOutputDataUrl=t,this.aiOutputKey=this.getSelectedAssetKey(),this.updateAiPreview(),this.setAiOutputButtonsEnabled(!0);let i=(n=this.previewModal)==null?void 0:n.querySelector("[data-asset-ai-preview]");this.updateAiModalPreview(i,(r=this.activePreviewKey)!=null?r:void 0)}setAiOutputButtonsEnabled(t){this.aiApplyBtn&&(this.aiApplyBtn.disabled=!t),this.aiSaveLibraryBtn&&(this.aiSaveLibraryBtn.disabled=!t),this.aiCropBtn&&(this.aiCropBtn.disabled=!t),this.aiDownloadBtn&&(this.aiDownloadBtn.disabled=!t)}handleAiApply(){var i,n,r;let t=this.getSelectedAssetInput();if(!this.aiOutputDataUrl){this.setAiStatus("Generate output first.");return}if(t)console.log("[CustomizePanel] Applying AI output to brand asset:",t.dataset.assetKey),t.value=this.aiOutputDataUrl,this.handleAssetValueChange((i=t.dataset.assetKey)!=null?i:"",t),this.setAiStatus("Applied. Restarting game...");else{let a=((n=this.aiContext)==null?void 0:n.objectId)||this.inferObjectIdFromAssetKey(this.aiTargetKey||""),s=((r=this.aiContext)==null?void 0:r.path)||this.inferPathFromAssetKey(this.aiTargetKey||"");if(a&&s)console.log("[CustomizePanel] Applying AI output directly to object:",a,s),this.applyObjectPropertyValue(a,s,this.aiOutputDataUrl),this.setAiStatus("Applied directly. Restarting game..."),window.dispatchEvent(new CustomEvent("inspector:refresh"));else{this.setAiStatus("No target input found to apply.");return}}setTimeout(()=>{this.closeAiModal()},500)}async handleAiSaveToLibrary(){var a,s,o;if(!this.aiOutputDataUrl){this.setAiStatus("Generate output first.");return}if(!this.getSelectedAssetKey()){this.setAiStatus("No asset selected.");return}let n=`${(this.aiTargetKey||"asset").replace(/[^a-zA-Z0-9_-]/g,"_")}_ai_${Date.now()}`,r=this.inferCategoryFromAssetKey(this.aiTargetKey||"");this.setAiStatus("Saving to library...");try{let c=await(await fetch("/api/library/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:r,filename:`${n}.png`,data:this.aiOutputDataUrl,overwrite:!0})})).json();if(c.success){console.log("[CustomizePanel] \u2705 Saved to library:",c.path),this.setAiStatus(`Saved as ${n}. Applying...`);let d=window.addAssetToRegistry;typeof d=="function"&&(console.log("[CustomizePanel] Logic: Adding to registry category:",r),d(r,`${n}.png`));let u=window.refreshAssetLibrary;typeof u=="function"&&(console.log("[CustomizePanel] Logic: Refreshing library panel"),u());let p=((a=this.aiContext)==null?void 0:a.objectId)||this.inferObjectIdFromAssetKey(this.aiTargetKey||""),f=((s=this.aiContext)==null?void 0:s.path)||this.inferPathFromAssetKey(this.aiTargetKey||""),m=this.getSelectedAssetInput();if(m&&(m.value=c.path,this.handleAssetValueChange((o=m.dataset.assetKey)!=null?o:"",m)),p&&f){console.log("[CustomizePanel] Saved and applying directly to object:",p,f);let h=window.applyAssetToSlot,g=/texture|image|sprite|asset\\.path/i.test(f)||/\\.(png|jpg|jpeg)$/i.test(String(c.path||""));if(typeof h=="function"&&g){let b=this.getFilenameFromPath(c.path);h(p,b,r)}else this.applyObjectPropertyValue(p,f,c.path);window.dispatchEvent(new CustomEvent("inspector:refresh"))}setTimeout(()=>{this.closeAiModal()},1e3)}else console.error("[CustomizePanel] \u274C Save failed:",c.error),this.setAiStatus(`Save failed: ${c.error}`)}catch(l){console.error("[CustomizePanel] \u274C Save error:",l),this.setAiStatus("Save failed. Check console.")}}inferCategoryFromAssetKey(t){var s;let i=(s=this.aiContext)==null?void 0:s.objectId,n=t||this.aiTargetKey||"",r=window.getEditableAssets;if(typeof r=="function"){let o=r();if(o!=null&&o.slots){let l=o.slots.find(c=>i&&c.objectId===i||c.currentAsset===n||c.slotId===n||c.currentAsset&&c.currentAsset.includes(n)||n.includes(c.slotId));if(l){let c=l.libraryFolder||l.category;if(c)return c}}}let a=n.toLowerCase();return a.includes("background")?"backgrounds":a.includes("character")?"characters":a.includes("key")?"collectedkeys":a.includes("draggable")?"draggables":a.includes("environment")||a.includes("env")||a.includes("hand")||a.includes("prop")||a.includes("item")||a.includes("decor")||a.includes("object")?"environment":a.includes("machine")?"machines":a.includes("tutorial")?"tutorial":a.includes("ui")||a.includes("button")||a.includes("label")||a.includes("icon")||a.includes("logo")||a.includes("cta")||a.includes("menu")||a.includes("overlay")?"ui":a.includes("effect")||a.includes("confetti")||a.includes("particle")?"effects":"ui"}inferObjectIdFromAssetKey(t){let i=window.getEditableAssets;if(typeof i!="function")return null;let n=i();if(!(n!=null&&n.slots))return null;let r=n.slots.find(a=>a.currentAsset===t||a.slotId===t);return(r==null?void 0:r.objectId)||null}inferPathFromAssetKey(t){let i=window.getEditableAssets;if(typeof i!="function")return null;let n=i();if(!(n!=null&&n.slots))return null;let r=n.slots.find(s=>s.currentAsset===t||s.slotId===t);if(!r)return null;let a=r.category;return a==="render"||a==="backgrounds"||a==="characters"?"render.texture":a==="ui"?"ui.image":a==="audio"?"audio.src":"render.texture"}getFilenameFromPath(t){if(!t)return"";let i=t.split("/");return i[i.length-1]}async handleAiCrop(){var o;if(!this.aiOutputDataUrl){this.setAiStatus("Generate output first.");return}let t=this.getSelectedAssetInput(),i=(o=t==null?void 0:t.value)!=null?o:"",n=await this.getImageDimensions(i);if(!n){this.setAiStatus("Unable to read target dimensions.");return}let r=zl(this.aiOutputDataUrl,"ai-output.png");if(!r)return;let a=await this.showManualCropModal(r,n,i);if(!a)return;let s=await $h(a);s&&this.setAiOutput(s)}handleAiDownload(){var n;if(!this.aiOutputDataUrl)return;let t=(n=this.getSelectedAssetKey())!=null?n:"ai-image",i=document.createElement("a");i.href=this.aiOutputDataUrl,i.download=`${t}-ai.png`,i.click()}handleAssetValueChange(t,i){this.previewModal&&this.closePreviewModal(),this.scheduleAutoApply(),this.updatePreviewIfOpen(t,i.value,i.dataset.assetType)}async handleAssetUpload(t,i,n){let r=i.value,a=t;if(t.type.startsWith("image/")){let l=await this.getImageDimensions(r);if(l){let c=await this.showManualCropModal(t,l,r);if(!c)return;a=c}}let s=URL.createObjectURL(a),o=i.dataset.objectUrl;if(o)try{URL.revokeObjectURL(o)}catch{}i.dataset.objectUrl=s,i.dataset.assetType=a.type,i.value=s,this.handleAssetValueChange(n,i)}scheduleAutoApply(){this.options&&(this.autoApplyTimer&&window.clearTimeout(this.autoApplyTimer),console.log("[CustomizePanel] Scheduling auto-apply in 250ms"),this.autoApplyTimer=window.setTimeout(()=>{this.autoApplyTimer=null,console.log("[CustomizePanel] Executing auto-apply now"),this.handleApplyWithSource("auto")},250))}previewAsset(t,i,n,r){if(!i)return;let a=this.resolveAssetUrls(i);if(a.length===0)return;let s=n||this.guessMimeType(i);this.activePreviewKey=t,this.activePreviewValue=i,this.activePreviewFileInput=r!=null?r:null,this.openPreviewModal(t,i,a,s)}resolveAssetUrls(t){let i=t.trim();if(!i)return[];if(console.log("[CustomizePanel] Resolving asset urls for:",i),/^(blob:|data:|https?:|\/)/.test(i))return console.log("[CustomizePanel] Path is absolute or data/blob, using as is"),[i];let n=i.replace(/^\.?\//,""),r=[];return n.startsWith("raw/")?r=[`/${n}`,`/assets/${n}`]:n.startsWith("assets/")?r=[`/${n}`]:r=[`/raw/${n}`,`/assets/raw/${n}`,`/assets/${n}`,`/${n}`],console.log("[CustomizePanel] Resolved to possible paths:",r),r}guessMimeType(t){let i=t.toLowerCase();return i.endsWith(".png")||i.endsWith(".jpg")||i.endsWith(".jpeg")||i.endsWith(".gif")||i.endsWith(".webp")||i.endsWith(".svg")?"image":i.endsWith(".mp3")||i.endsWith(".wav")||i.endsWith(".ogg")?"audio":i.endsWith(".json")?"json":"file"}openPreviewModal(t,i,n,r){this.closePreviewModal(!0);let a=document.createElement("div");a.className="asset-preview-modal",a.innerHTML=`
|
|
936
936
|
<div class="asset-preview-card">
|
|
937
937
|
<div class="asset-preview-header">
|
|
938
938
|
<div class="asset-preview-title">${t}</div>
|
|
@@ -978,7 +978,7 @@ Generate the requested asset matching the brand style.${e.needsTransparency?" Ba
|
|
|
978
978
|
<button class="asset-crop-apply" type="button">Apply Crop</button>
|
|
979
979
|
</div>
|
|
980
980
|
</div>
|
|
981
|
-
`;let y=c.querySelector(".asset-crop-canvas"),v=c.querySelector(".asset-crop-preview"),x=c.querySelector(".asset-crop-zoom"),w=c.querySelector(".asset-crop-zoom-value"),
|
|
981
|
+
`;let y=c.querySelector(".asset-crop-canvas"),v=c.querySelector(".asset-crop-preview"),x=c.querySelector(".asset-crop-zoom"),w=c.querySelector(".asset-crop-zoom-value"),E=c.querySelector(".asset-crop-close"),A=c.querySelector(".asset-crop-cancel"),_=c.querySelector(".asset-crop-apply"),T=c.querySelector(".asset-crop-reset");if(!y||!v||!x||!w){l(null);return}let M=y.getContext("2d"),S=v.getContext("2d");if(!M||!S){l(null);return}let L=s.naturalWidth,z=s.naturalHeight,D=Math.max(y.width/L,y.height/z),B=1,O=0,P=0,C=!1,I=0,j=0,Q=0,se=0,Pe=()=>{let $=D*B,Pt=Math.max(0,(L*$-y.width)/2),ai=Math.max(0,(z*$-y.height)/2);O=Math.min(Pt,Math.max(-Pt,O)),P=Math.min(ai,Math.max(-ai,P))},je=()=>{let $=D*B;M.clearRect(0,0,y.width,y.height);let Pt=y.width/2-L*$/2+O,ai=y.height/2-z*$/2+P;if(M.drawImage(s,Pt,ai,L*$,z*$),S.clearRect(0,0,v.width,v.height),o!=null&&o.naturalWidth&&(o!=null&&o.naturalHeight)){let oi=Math.max(v.width/o.naturalWidth,v.height/o.naturalHeight),fs=v.width/2-o.naturalWidth*oi/2,tn=v.height/2-o.naturalHeight*oi/2;S.drawImage(o,fs,tn,o.naturalWidth*oi,o.naturalHeight*oi)}else S.fillStyle="rgba(255, 255, 255, 0.04)",S.fillRect(0,0,v.width,v.height),S.strokeStyle="rgba(255, 255, 255, 0.08)",S.strokeRect(4,4,v.width-8,v.height-8);let en=v.width/y.width*(D*B),si=O*(v.width/y.width),dr=P*(v.height/y.height),us=v.width/2-L*en/2+si,ps=v.height/2-z*en/2+dr;S.save(),S.globalAlpha=.7,S.drawImage(s,us,ps,L*en,z*en),S.restore()},Tc=()=>{O=0,P=0,Pe(),je()};x.addEventListener("input",()=>{B=Number(x.value),w.textContent=`${B.toFixed(2)}\xD7`,Pe(),je()}),y.addEventListener("pointerdown",$=>{C=!0,I=$.clientX,j=$.clientY,Q=O,se=P,y.setPointerCapture($.pointerId)}),y.addEventListener("pointermove",$=>{C&&(O=Q+($.clientX-I),P=se+($.clientY-j),Pe(),je())}),y.addEventListener("pointerup",$=>{C=!1,y.releasePointerCapture($.pointerId)}),y.addEventListener("pointerleave",()=>{C=!1});let cs=()=>{c.remove()},ds=()=>{cs(),l(null)},Gg=async()=>{let $=document.createElement("canvas");$.width=i.width,$.height=i.height;let Pt=$.getContext("2d");if(!Pt){cs(),l(null);return}let ai=B,si=Math.max($.width/L,$.height/z)*ai,dr=$.width/y.width,us=O*dr,ps=P*dr,oi=$.width/2-L*si/2+us,fs=$.height/2-z*si/2+ps;Pt.drawImage(s,oi,fs,L*si,z*si);let tn=await new Promise(Wg=>{$.toBlob(Yg=>Wg(Yg),t.type||"image/png")});if(cs(),!tn){l(null);return}l(new File([tn],t.name,{type:tn.type}))};E==null||E.addEventListener("click",ds),A==null||A.addEventListener("click",ds),T==null||T.addEventListener("click",Tc),_==null||_.addEventListener("click",()=>{Gg()}),c.addEventListener("click",$=>{$.target===c&&ds()}),document.body.appendChild(c),Tc()})}async loadImageForValue(t){let i=this.resolveAssetUrls(t);if(!i.length)return null;for(let n of i){let r=await this.loadImage(n);if(r)return r}return null}};var Ya=class{constructor(){this.root=null;this.options=null}render(){return`
|
|
982
982
|
<div class="scene-panel loading-screen-panel panel-accent-purple" data-panel="loading-screen">
|
|
983
983
|
<div class="scene-panel-header" data-panel-handle>
|
|
984
984
|
<div class="panel-title">
|
|
@@ -1044,10 +1044,10 @@ Generate the requested asset matching the brand style.${e.needsTransparency?" Ba
|
|
|
1044
1044
|
</div>
|
|
1045
1045
|
</div>
|
|
1046
1046
|
</div>
|
|
1047
|
-
`}initialize(t,i){var y,v,x,w,S,A,_,T,M,E,L,z,D,B,O,P;this.options=i,this.root=t.querySelector('[data-panel="loading-screen"]');let r=(()=>{var I;let C=window.getEditableEngineConfig;if(typeof C=="function"){let j=C();return(I=j==null?void 0:j.loading)!=null?I:{}}return{}})(),a=(y=this.root)==null?void 0:y.querySelector("#loading-screen-type");a&&(a.value=r.type==="image"?"image":"color",a.addEventListener("change",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{type:a.value}),this.updateFieldVisibility(a.value)}));let s=(v=this.root)==null?void 0:v.querySelector("#loading-background-color");s&&(s.value=r.background_color||"#160a17",s.addEventListener("input",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{background_color:s.value})}));let o=(x=this.root)==null?void 0:x.querySelector("#loading-overlay-alpha"),l=(w=this.root)==null?void 0:w.querySelector("#loading-overlay-alpha-value");o&&(o.value=String((S=r.overlay_alpha)!=null?S:1),l&&(l.textContent=Number(o.value).toFixed(2)),o.addEventListener("input",()=>{var I,j;let C=Number(o.value);l&&(l.textContent=C.toFixed(2)),(j=(I=this.options)==null?void 0:I.onUpdateLoading)==null||j.call(I,{overlay_alpha:C})}));let c=(A=this.root)==null?void 0:A.querySelector("#loading-text");c&&(c.value=r.text||"",c.addEventListener("input",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{text:c.value})}));let d=(_=this.root)==null?void 0:_.querySelector("#loading-text-scale"),u=(T=this.root)==null?void 0:T.querySelector("#loading-text-scale-value");d&&(d.value=String((M=r.text_scale)!=null?M:.6),u&&(u.textContent=Number(d.value).toFixed(2)),d.addEventListener("input",()=>{var I,j;let C=Number(d.value);u&&(u.textContent=C.toFixed(2)),(j=(I=this.options)==null?void 0:I.onUpdateLoading)==null||j.call(I,{text_scale:C})}));let p=(E=this.root)==null?void 0:E.querySelector("#loading-enabled");p&&(p.checked=r.enabled!==!1,p.addEventListener("change",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{enabled:p.checked})}));let f=(L=this.root)==null?void 0:L.querySelector("#loading-blur-enabled");f&&(f.checked=r.blur_enabled!==!1,f.addEventListener("change",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{blur_enabled:f.checked})}));let m=(z=this.root)==null?void 0:z.querySelector("#loading-blur-strength"),h=(D=this.root)==null?void 0:D.querySelector("#loading-blur-strength-value");m&&(m.value=String((B=r.blur_strength)!=null?B:8),h&&(h.textContent=m.value),m.addEventListener("input",()=>{var C,I;h&&(h.textContent=m.value),(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{blur_strength:Number(m.value)})}));let g=(O=this.root)==null?void 0:O.querySelector("#loading-show-btn"),b=(P=this.root)==null?void 0:P.querySelector("#loading-hide-btn");g==null||g.addEventListener("click",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onShowLoadingScreen)==null||I.call(C)}),b==null||b.addEventListener("click",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onHideLoadingScreen)==null||I.call(C)}),this.updateFieldVisibility(r.type==="image"?"image":"color")}updateFieldVisibility(t){var r,a;let i=(r=this.root)==null?void 0:r.querySelector("#loading-color-field"),n=(a=this.root)==null?void 0:a.querySelector("#loading-alpha-field");t==="image"?(i&&(i.style.display="none"),n&&(n.style.display="none")):(i&&(i.style.display=""),n&&(n.style.display=""))}refresh(){}};var Xn=require("pixi.js");pi();Te();async function ng(e,t,i){var n,r;console.log("[LIBRARY] applyAssetChange called with:",t,i);try{let a=Date.now(),o=`/${`raw/library/${t}/${i}`}?t=${a}`;console.log("[LIBRARY] Loading texture from:",o);let l=await Xn.Assets.load(o);if(!l){console.error("[LIBRARY] Failed to load texture:",o);return}let c=window.CustomAssets,d=Object.keys(c||{}).filter(p=>{let f=t.replace(/s$/,"");return p.startsWith(f)||p.includes(f)});for(let p of d)ze[p]=l,console.log("[LIBRARY] \u2705 Updated AssetTextures."+p),(n=c[p])!=null&&n.texture&&(c[p].texture=l,console.log("[LIBRARY] \u2705 Updated CustomAssets."+p+".texture"));let u=window.gameObjectManager;if(u)for(let p of d){let f=u.get(p);if(f){let m=((r=f.getDisplayObject)==null?void 0:r.call(f))||f.pixiObject||f;m!=null&&m.texture&&(m.texture=l,console.log("[LIBRARY] \u2705 Applied to display object:",p))}}}catch(a){console.error("[LIBRARY] Error applying asset change:",a)}}async function rg(e,t){var i,n,r;console.log("[LIBRARY] resetAsset called for:",t);try{let a=window.getEditableAssets,s=typeof a=="function"?a():null,o=(i=s==null?void 0:s.slots)==null?void 0:i.find(g=>g.category===t),l=o==null?void 0:o.defaultAsset;if(!l){console.warn("[LIBRARY] Could not find default asset for:",t);return}let c=Date.now(),d=`/raw/${l}?t=${c}`;console.log("[LIBRARY] Loading default texture from:",d);let u=await Xn.Assets.load(d);if(!u){console.error("[LIBRARY] Failed to load default texture:",d);return}let p=window.CustomAssets,f=t.replace(/s$/,""),m=Object.keys(p||{}).filter(g=>g.startsWith(f)||g.includes(f));for(let g of m)ze[g]=u,console.log("[LIBRARY] \u2705 Reset AssetTextures."+g),(n=p[g])!=null&&n.texture&&(p[g].texture=u,console.log("[LIBRARY] \u2705 Reset CustomAssets."+g+" to default"));let h=window.gameObjectManager;if(h)for(let g of m){let b=h.get(g);if(b){let y=((r=b.getDisplayObject)==null?void 0:r.call(b))||b.pixiObject||b;y!=null&&y.texture&&(y.texture=u,console.log("[LIBRARY] \u2705 Reset display object:",g))}}}catch(a){console.error("[LIBRARY] Error resetting asset:",a)}}async function ag(e,t,i,n){var r,a,s,o,l,c,d,u,p,f,m,h,g,b,y;console.log("[LIBRARY] applySlotAsset:",{objectId:t,assetFilename:i,category:n});try{let v=t.startsWith("json.")?t.replace("json.",""):t;console.log("[LIBRARY] Asset key:",v);let x=Date.now(),w=`/raw/library/${n}/${i}?t=${x}`;console.log("[LIBRARY] Loading texture from:",w);let S=await Xn.Assets.load(w);if(!S){console.error("[LIBRARY] Failed to load texture:",w);return}console.log("[LIBRARY] \u2705 Texture loaded"),ze[v]=S,console.log("[LIBRARY] \u2705 Updated AssetTextures."+v);let A=window.CustomAssets;A!=null&&A[v]&&(A[v].texture=S,console.log("[LIBRARY] \u2705 Updated legacy CustomAssets."+v));let _=window.gameObjectManager;if(console.log("[LIBRARY] gameObjectManager exists?",!!_),_){let M=Array.from(((r=_.keys)==null?void 0:r.call(_))||[]).slice(0,10);console.log("[LIBRARY] Available gameObject keys (first 10):",M);let E=_.get(v);if(console.log("[LIBRARY] gameObject for "+v+"?",!!E),E){let L=((a=E.getDisplayObject)==null?void 0:a.call(E))||E.pixiObject||E.pixi||E,z=(s=L==null?void 0:L.constructor)==null?void 0:s.name;if(console.log("[LIBRARY] displayObject:",L),console.log("[LIBRARY] displayObject type:",z),console.log("[LIBRARY] has texture?",!!(L!=null&&L.texture)),L!=null&&L.texture)L.texture=S,console.log("[LIBRARY] \u2705 Applied to display object:",v);else if(z==="Text"){console.log("[LIBRARY] \u{1F504} Converting Text to Sprite...");let{Sprite:D}=await import("pixi.js"),B=L.parent,O=(l=(o=B==null?void 0:B.getChildIndex)==null?void 0:o.call(B,L))!=null?l:0,P={x:L.x,y:L.y},C={x:(d=(c=L.anchor)==null?void 0:c.x)!=null?d:.5,y:(p=(u=L.anchor)==null?void 0:u.y)!=null?p:.5},I={x:(m=(f=L.scale)==null?void 0:f.x)!=null?m:1,y:(g=(h=L.scale)==null?void 0:h.y)!=null?g:1},j=(b=L.alpha)!=null?b:1,Q=(y=L.visible)!=null?y:!0,se=new D(S);se.anchor.set(C.x,C.y),se.position.set(P.x,P.y),se.scale.set(I.x,I.y),se.alpha=j,se.visible=Q,B&&(B.removeChild(L),B.addChildAt(se,O),console.log("[LIBRARY] \u2705 Replaced Text with Sprite in parent")),E.pixiObject&&(E.pixiObject=se),E.pixi&&(E.pixi=se),console.log("[LIBRARY] \u2705 Text \u2192 Sprite conversion complete")}else if(L!=null&&L.children){let D=L.children.find(B=>B.texture);D?(D.texture=S,console.log("[LIBRARY] \u2705 Applied to child sprite")):console.warn("[LIBRARY] \u26A0\uFE0F No texture found in displayObject or children")}}}let T=`raw/library/${n}/${i}`;mt({objectId:v,path:"render.asset.path",value:T}),console.log("[LIBRARY] \u2705 Staged config override for:",v,"path:",T)}catch(v){console.error("[LIBRARY] Error applying slot asset:",v)}}async function sg(e,t,i,n){var r;console.log("[LIBRARY] resetSlotAsset:",{objectId:t,defaultAsset:i,category:n});try{let a=t.startsWith("json.")?t.replace("json.",""):t,s=Date.now(),o=`/raw/${i}?t=${s}`;console.log("[LIBRARY] Loading default texture from:",o);let l=await Xn.Assets.load(o);if(!l){console.error("[LIBRARY] Failed to load default texture:",o);return}ze[a]=l,console.log("[LIBRARY] \u2705 Reset AssetTextures."+a);let c=window.CustomAssets;c!=null&&c[a]&&(c[a].texture=l,console.log("[LIBRARY] \u2705 Reset CustomAssets."+a+" to default"));let d=window.gameObjectManager;if(d){let u=d.get(a);if(u){let p=((r=u.getDisplayObject)==null?void 0:r.call(u))||u.pixiObject||u;p!=null&&p.texture&&(p.texture=l,console.log("[LIBRARY] \u2705 Reset display object:",a))}}mt({objectId:a,path:"render.asset.path",value:i}),console.log("[LIBRARY] \u2705 Reset config override for:",a)}catch(a){console.error("[LIBRARY] Error resetting slot asset:",a)}}var Qn=require("pixi.js");var Hl=require("pixi.js"),It=()=>window.debugConfig||{},og=()=>window.resolveAnchorVec2||(e=>({x:.5,y:.5})),lg=()=>window.resolveScreenAnchorPoint||(()=>new Hl.Point),cg=()=>window.resolveScreenRatioPoint||(()=>new Hl.Point);function dg(e){Va(e)&&(e.objectDebugRaf||(e.objectDebugRaf=window.requestAnimationFrame(()=>Ka(e))))}function ug(e){e.objectDebugRaf&&(window.cancelAnimationFrame(e.objectDebugRaf),e.objectDebugRaf=null),Jn(e)}function Va(e){return e.isDebugOpen}function Ka(e){var a,s,o;if(!Va(e)){e.objectDebugRaf=null;return}e.objectDebugRaf=window.requestAnimationFrame(()=>Ka(e));let t=$l(e);if(!t){Zn(e,null),Jn(e);return}let i=Ul(e,t);if(!i){Zn(e,null),Jn(e);return}let n=new Qn.Point;(a=i.getGlobalPosition)==null||a.call(i,n);let r=ql(e,i);Zn(e,{instanceId:t,worldX:n.x,worldY:n.y,configX:(s=r==null?void 0:r.x)!=null?s:null,configY:(o=r==null?void 0:r.y)!=null?o:null}),e.highlightObject?Vl(e,i):Xl(e),e.highlightAnchor&&r?Kl(e,r):Zl(e)}function $l(e){var r;let t=e.selectedObjectId;if(!t)return null;let i=window.__editableObjectInstances,n=(r=i==null?void 0:i.get)==null?void 0:r.call(i,t);return Array.isArray(n)&&n.length>0?n[0]:t}function Ul(e,t){var r,a;let i=window.gameObjectManager,n=(r=i==null?void 0:i.get)==null?void 0:r.call(i,t);return n?((a=n.getDisplayObject)==null?void 0:a.call(n))||n.pixiObject||n:null}function er(e){let t=e.selectedObjectId;if(!t)return null;let i=window.getEditableObjectConfig;return typeof i!="function"?null:i(t)}function ql(e,t){var s,o;let i=er(e);if(!i)return null;let n=(s=i.transform)!=null?s:{},r=Gl(e);if(!r)return null;if(n.position_ratio!=null)return cg()(r.width,r.height,n.position_ratio);let a=(o=n.anchor)!=null?o:"center";return lg()(r.width,r.height,a)}function Gl(e){var a;let t=(a=e.container)==null?void 0:a.querySelector(".game-container"),i=Number(t==null?void 0:t.dataset.screenWidth),n=Number(t==null?void 0:t.dataset.screenHeight);if(Number.isFinite(i)&&i>0&&Number.isFinite(n)&&n>0)return{width:i,height:n};let r=window.gameApp;return r!=null&&r.renderer?{width:r.renderer.width,height:r.renderer.height}:null}function Wl(e){let t=window.gameApp;return t!=null&&t.stage?(e.objectBoundsGfx&&e.objectBoundsGfx.parent!==t.stage&&(e.objectBoundsGfx.destroy(),e.objectBoundsGfx=null),e.objectBoundsGfx||(e.objectBoundsGfx=new Qn.Graphics,e.objectBoundsGfx.zIndex=999999,t.stage.addChild(e.objectBoundsGfx)),e.objectBoundsGfx):null}function Yl(e){let t=window.gameApp;return t!=null&&t.stage?(e.objectAnchorGfx&&e.objectAnchorGfx.parent!==t.stage&&(e.objectAnchorGfx.destroy(),e.objectAnchorGfx=null),e.objectAnchorGfx||(e.objectAnchorGfx=new Qn.Graphics,e.objectAnchorGfx.zIndex=1e6,t.stage.addChild(e.objectAnchorGfx)),e.objectAnchorGfx):null}function Vl(e,t){var r;let i=Wl(e);if(!i)return;let n=(r=t.getBounds)==null?void 0:r.call(t);n&&(i.clear(),i.rect(n.x,n.y,n.width,n.height).stroke({width:2,color:16726832,alpha:.9}))}function Kl(e,t){let i=Yl(e);if(!i)return;let n=6;i.clear(),i.moveTo(t.x-n,t.y),i.lineTo(t.x+n,t.y),i.moveTo(t.x,t.y-n),i.lineTo(t.x,t.y+n),i.stroke({width:2,color:3066993,alpha:.9})}function Xl(e){e.objectBoundsGfx&&e.objectBoundsGfx.clear()}function Zl(e){e.objectAnchorGfx&&e.objectAnchorGfx.clear()}function Jn(e){e.objectBoundsGfx&&(e.objectBoundsGfx.destroy(),e.objectBoundsGfx=null),e.objectAnchorGfx&&(e.objectAnchorGfx.destroy(),e.objectAnchorGfx=null)}function Zn(e,t){e.sceneToolsPanel.updateInfo(t?{instanceId:t.instanceId,worldX:t.worldX,worldY:t.worldY,anchorX:t.configX,anchorY:t.configY}:null)}function pg(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function fg(e,t,i){var s;let n=t.split("."),r=n.pop(),a=e;for(let o of n)a[o]=(s=a[o])!=null?s:{},a=a[o];a[r]=i}function Jl(e){var n,r,a,s,o;if(!e)return!1;if((n=e.transform)!=null&&n.offset)return!0;let t=((a=(r=e.identity)==null?void 0:r.category)!=null?a:"").toString().toLowerCase(),i=((o=(s=e.identity)==null?void 0:s.id)!=null?o:"").toString().toLowerCase();return t.includes("ui")||i.startsWith("ui")||i.includes("label")}function Za(e){let t=It();t.layout&&(t.layout.scale_multiplier=1,t.layout.position_offset={x:0,y:0},t.layout.debug_rect_visible=!0,t.layout.debug_rect_color=16711680,t.layout.debug_rect_thickness=4),t.engine&&(t.engine.scale=1,t.engine.background_scale=1.05,t.engine.label_pulse_speed=3,t.engine.label_pulse_intensity=.03),t.physics&&(t.physics.rope_length=420),window.location.reload()}function hg(e){window.location.reload()}function Ja(e){let t=JSON.stringify(It(),null,2);navigator.clipboard.writeText(t).then(()=>{alert("Debug config copied to clipboard!")}).catch(()=>{console.log(t),alert("Config logged to console (clipboard not available)")})}async function gg(e,t){var i,n,r;if(!(!e.configViewer||!e.container))try{let a=window.getEditableObjectConfig,s=typeof a=="function"?a(t):null;if(!s){let{loadObjectCentricConfig:o,loadObjectConfig:l}=await Promise.resolve().then(()=>(jr(),Cd)),u=(((i=(await o("scene.main")).scene)==null?void 0:i.objects)||[]).find(f=>f.object_config===t||f.instance_id===t);if(!u)return;let p=await l(u.object_config);console.log("[PREVIEW] Loaded object config (fallback)",t,p),Xa(e,p),(n=e.configViewer)==null||n.style.setProperty("display","block");return}console.log("[PREVIEW] Loaded object config",t,s),Xa(e,s),(r=e.configViewer)==null||r.style.setProperty("display","block");return}catch(a){console.error("[DEBUG] Failed to load object config:",a)}}function Xa(e,t){var u,p,f,m,h,g,b,y,v,x;if(!e.container)return;let i=e.container.querySelector("#config-pos-x"),n=e.container.querySelector("#config-pos-y"),r=e.container.querySelector("#config-scale"),a=e.container.querySelector("#config-anchor-x"),s=e.container.querySelector("#config-anchor-y"),l=Jl(t)?(u=t.transform)==null?void 0:u.offset:(p=t.transform)==null?void 0:p.position;i&&(i.value=String((f=l==null?void 0:l.x)!=null?f:0)),n&&(n.value=String((m=l==null?void 0:l.y)!=null?m:0)),r&&(r.value=String((g=(h=t.transform)==null?void 0:h.scale)!=null?g:1));let c=(x=(v=(b=t.transform)==null?void 0:b.anchor)!=null?v:(y=t.render)==null?void 0:y.anchor)!=null?x:{x:.5,y:.5},d=og()(c);a&&(a.value=String(d.x)),s&&(s.value=String(d.y))}function mg(e){var l,c,d,u,p,f,m,h,g,b;let t=e.selectedObjectId;if(!t||!e.container)return;let i=(c=(l=e.container.querySelector("#config-pos-x"))==null?void 0:l.value)!=null?c:"0",n=(u=(d=e.container.querySelector("#config-pos-y"))==null?void 0:d.value)!=null?u:"0",r=(f=(p=e.container.querySelector("#config-scale"))==null?void 0:p.value)!=null?f:"1",a=(h=(m=e.container.querySelector("#config-anchor-x"))==null?void 0:m.value)!=null?h:"0.5",s=(b=(g=e.container.querySelector("#config-anchor-y"))==null?void 0:g.value)!=null?b:"0.5",o=`${t}:
|
|
1047
|
+
`}initialize(t,i){var y,v,x,w,E,A,_,T,M,S,L,z,D,B,O,P;this.options=i,this.root=t.querySelector('[data-panel="loading-screen"]');let r=(()=>{var I;let C=window.getEditableEngineConfig;if(typeof C=="function"){let j=C();return(I=j==null?void 0:j.loading)!=null?I:{}}return{}})(),a=(y=this.root)==null?void 0:y.querySelector("#loading-screen-type");a&&(a.value=r.type==="image"?"image":"color",a.addEventListener("change",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{type:a.value}),this.updateFieldVisibility(a.value)}));let s=(v=this.root)==null?void 0:v.querySelector("#loading-background-color");s&&(s.value=r.background_color||"#160a17",s.addEventListener("input",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{background_color:s.value})}));let o=(x=this.root)==null?void 0:x.querySelector("#loading-overlay-alpha"),l=(w=this.root)==null?void 0:w.querySelector("#loading-overlay-alpha-value");o&&(o.value=String((E=r.overlay_alpha)!=null?E:1),l&&(l.textContent=Number(o.value).toFixed(2)),o.addEventListener("input",()=>{var I,j;let C=Number(o.value);l&&(l.textContent=C.toFixed(2)),(j=(I=this.options)==null?void 0:I.onUpdateLoading)==null||j.call(I,{overlay_alpha:C})}));let c=(A=this.root)==null?void 0:A.querySelector("#loading-text");c&&(c.value=r.text||"",c.addEventListener("input",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{text:c.value})}));let d=(_=this.root)==null?void 0:_.querySelector("#loading-text-scale"),u=(T=this.root)==null?void 0:T.querySelector("#loading-text-scale-value");d&&(d.value=String((M=r.text_scale)!=null?M:.6),u&&(u.textContent=Number(d.value).toFixed(2)),d.addEventListener("input",()=>{var I,j;let C=Number(d.value);u&&(u.textContent=C.toFixed(2)),(j=(I=this.options)==null?void 0:I.onUpdateLoading)==null||j.call(I,{text_scale:C})}));let p=(S=this.root)==null?void 0:S.querySelector("#loading-enabled");p&&(p.checked=r.enabled!==!1,p.addEventListener("change",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{enabled:p.checked})}));let f=(L=this.root)==null?void 0:L.querySelector("#loading-blur-enabled");f&&(f.checked=r.blur_enabled!==!1,f.addEventListener("change",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{blur_enabled:f.checked})}));let m=(z=this.root)==null?void 0:z.querySelector("#loading-blur-strength"),h=(D=this.root)==null?void 0:D.querySelector("#loading-blur-strength-value");m&&(m.value=String((B=r.blur_strength)!=null?B:8),h&&(h.textContent=m.value),m.addEventListener("input",()=>{var C,I;h&&(h.textContent=m.value),(I=(C=this.options)==null?void 0:C.onUpdateLoading)==null||I.call(C,{blur_strength:Number(m.value)})}));let g=(O=this.root)==null?void 0:O.querySelector("#loading-show-btn"),b=(P=this.root)==null?void 0:P.querySelector("#loading-hide-btn");g==null||g.addEventListener("click",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onShowLoadingScreen)==null||I.call(C)}),b==null||b.addEventListener("click",()=>{var C,I;(I=(C=this.options)==null?void 0:C.onHideLoadingScreen)==null||I.call(C)}),this.updateFieldVisibility(r.type==="image"?"image":"color")}updateFieldVisibility(t){var r,a;let i=(r=this.root)==null?void 0:r.querySelector("#loading-color-field"),n=(a=this.root)==null?void 0:a.querySelector("#loading-alpha-field");t==="image"?(i&&(i.style.display="none"),n&&(n.style.display="none")):(i&&(i.style.display=""),n&&(n.style.display=""))}refresh(){}};var Xn=require("pixi.js");pi();Te();async function ng(e,t,i){var n,r;console.log("[LIBRARY] applyAssetChange called with:",t,i);try{let a=Date.now(),o=`/${`raw/library/${t}/${i}`}?t=${a}`;console.log("[LIBRARY] Loading texture from:",o);let l=await Xn.Assets.load(o);if(!l){console.error("[LIBRARY] Failed to load texture:",o);return}let c=window.CustomAssets,d=Object.keys(c||{}).filter(p=>{let f=t.replace(/s$/,"");return p.startsWith(f)||p.includes(f)});for(let p of d)ze[p]=l,console.log("[LIBRARY] \u2705 Updated AssetTextures."+p),(n=c[p])!=null&&n.texture&&(c[p].texture=l,console.log("[LIBRARY] \u2705 Updated CustomAssets."+p+".texture"));let u=window.gameObjectManager;if(u)for(let p of d){let f=u.get(p);if(f){let m=((r=f.getDisplayObject)==null?void 0:r.call(f))||f.pixiObject||f;m!=null&&m.texture&&(m.texture=l,console.log("[LIBRARY] \u2705 Applied to display object:",p))}}}catch(a){console.error("[LIBRARY] Error applying asset change:",a)}}async function rg(e,t){var i,n,r;console.log("[LIBRARY] resetAsset called for:",t);try{let a=window.getEditableAssets,s=typeof a=="function"?a():null,o=(i=s==null?void 0:s.slots)==null?void 0:i.find(g=>g.category===t),l=o==null?void 0:o.defaultAsset;if(!l){console.warn("[LIBRARY] Could not find default asset for:",t);return}let c=Date.now(),d=`/raw/${l}?t=${c}`;console.log("[LIBRARY] Loading default texture from:",d);let u=await Xn.Assets.load(d);if(!u){console.error("[LIBRARY] Failed to load default texture:",d);return}let p=window.CustomAssets,f=t.replace(/s$/,""),m=Object.keys(p||{}).filter(g=>g.startsWith(f)||g.includes(f));for(let g of m)ze[g]=u,console.log("[LIBRARY] \u2705 Reset AssetTextures."+g),(n=p[g])!=null&&n.texture&&(p[g].texture=u,console.log("[LIBRARY] \u2705 Reset CustomAssets."+g+" to default"));let h=window.gameObjectManager;if(h)for(let g of m){let b=h.get(g);if(b){let y=((r=b.getDisplayObject)==null?void 0:r.call(b))||b.pixiObject||b;y!=null&&y.texture&&(y.texture=u,console.log("[LIBRARY] \u2705 Reset display object:",g))}}}catch(a){console.error("[LIBRARY] Error resetting asset:",a)}}async function ag(e,t,i,n){var r,a,s,o,l,c,d,u,p,f,m,h,g,b,y;console.log("[LIBRARY] applySlotAsset:",{objectId:t,assetFilename:i,category:n});try{let v=t.startsWith("json.")?t.replace("json.",""):t;console.log("[LIBRARY] Asset key:",v);let x=Date.now(),w=`/raw/library/${n}/${i}?t=${x}`;console.log("[LIBRARY] Loading texture from:",w);let E=await Xn.Assets.load(w);if(!E){console.error("[LIBRARY] Failed to load texture:",w);return}console.log("[LIBRARY] \u2705 Texture loaded"),ze[v]=E,console.log("[LIBRARY] \u2705 Updated AssetTextures."+v);let A=window.CustomAssets;A!=null&&A[v]&&(A[v].texture=E,console.log("[LIBRARY] \u2705 Updated legacy CustomAssets."+v));let _=window.gameObjectManager;if(console.log("[LIBRARY] gameObjectManager exists?",!!_),_){let M=Array.from(((r=_.keys)==null?void 0:r.call(_))||[]).slice(0,10);console.log("[LIBRARY] Available gameObject keys (first 10):",M);let S=_.get(v);if(console.log("[LIBRARY] gameObject for "+v+"?",!!S),S){let L=((a=S.getDisplayObject)==null?void 0:a.call(S))||S.pixiObject||S.pixi||S,z=(s=L==null?void 0:L.constructor)==null?void 0:s.name;if(console.log("[LIBRARY] displayObject:",L),console.log("[LIBRARY] displayObject type:",z),console.log("[LIBRARY] has texture?",!!(L!=null&&L.texture)),L!=null&&L.texture)L.texture=E,console.log("[LIBRARY] \u2705 Applied to display object:",v);else if(z==="Text"){console.log("[LIBRARY] \u{1F504} Converting Text to Sprite...");let{Sprite:D}=await import("pixi.js"),B=L.parent,O=(l=(o=B==null?void 0:B.getChildIndex)==null?void 0:o.call(B,L))!=null?l:0,P={x:L.x,y:L.y},C={x:(d=(c=L.anchor)==null?void 0:c.x)!=null?d:.5,y:(p=(u=L.anchor)==null?void 0:u.y)!=null?p:.5},I={x:(m=(f=L.scale)==null?void 0:f.x)!=null?m:1,y:(g=(h=L.scale)==null?void 0:h.y)!=null?g:1},j=(b=L.alpha)!=null?b:1,Q=(y=L.visible)!=null?y:!0,se=new D(E);se.anchor.set(C.x,C.y),se.position.set(P.x,P.y),se.scale.set(I.x,I.y),se.alpha=j,se.visible=Q,B&&(B.removeChild(L),B.addChildAt(se,O),console.log("[LIBRARY] \u2705 Replaced Text with Sprite in parent")),S.pixiObject&&(S.pixiObject=se),S.pixi&&(S.pixi=se),console.log("[LIBRARY] \u2705 Text \u2192 Sprite conversion complete")}else if(L!=null&&L.children){let D=L.children.find(B=>B.texture);D?(D.texture=E,console.log("[LIBRARY] \u2705 Applied to child sprite")):console.warn("[LIBRARY] \u26A0\uFE0F No texture found in displayObject or children")}}}let T=`raw/library/${n}/${i}`;mt({objectId:v,path:"render.asset.path",value:T}),console.log("[LIBRARY] \u2705 Staged config override for:",v,"path:",T)}catch(v){console.error("[LIBRARY] Error applying slot asset:",v)}}async function sg(e,t,i,n){var r;console.log("[LIBRARY] resetSlotAsset:",{objectId:t,defaultAsset:i,category:n});try{let a=t.startsWith("json.")?t.replace("json.",""):t,s=Date.now(),o=`/raw/${i}?t=${s}`;console.log("[LIBRARY] Loading default texture from:",o);let l=await Xn.Assets.load(o);if(!l){console.error("[LIBRARY] Failed to load default texture:",o);return}ze[a]=l,console.log("[LIBRARY] \u2705 Reset AssetTextures."+a);let c=window.CustomAssets;c!=null&&c[a]&&(c[a].texture=l,console.log("[LIBRARY] \u2705 Reset CustomAssets."+a+" to default"));let d=window.gameObjectManager;if(d){let u=d.get(a);if(u){let p=((r=u.getDisplayObject)==null?void 0:r.call(u))||u.pixiObject||u;p!=null&&p.texture&&(p.texture=l,console.log("[LIBRARY] \u2705 Reset display object:",a))}}mt({objectId:a,path:"render.asset.path",value:i}),console.log("[LIBRARY] \u2705 Reset config override for:",a)}catch(a){console.error("[LIBRARY] Error resetting slot asset:",a)}}var Qn=require("pixi.js");var Hl=require("pixi.js"),It=()=>window.debugConfig||{},og=()=>window.resolveAnchorVec2||(e=>({x:.5,y:.5})),lg=()=>window.resolveScreenAnchorPoint||(()=>new Hl.Point),cg=()=>window.resolveScreenRatioPoint||(()=>new Hl.Point);function dg(e){Va(e)&&(e.objectDebugRaf||(e.objectDebugRaf=window.requestAnimationFrame(()=>Ka(e))))}function ug(e){e.objectDebugRaf&&(window.cancelAnimationFrame(e.objectDebugRaf),e.objectDebugRaf=null),Jn(e)}function Va(e){return e.isDebugOpen}function Ka(e){var a,s,o;if(!Va(e)){e.objectDebugRaf=null;return}e.objectDebugRaf=window.requestAnimationFrame(()=>Ka(e));let t=$l(e);if(!t){Zn(e,null),Jn(e);return}let i=Ul(e,t);if(!i){Zn(e,null),Jn(e);return}let n=new Qn.Point;(a=i.getGlobalPosition)==null||a.call(i,n);let r=ql(e,i);Zn(e,{instanceId:t,worldX:n.x,worldY:n.y,configX:(s=r==null?void 0:r.x)!=null?s:null,configY:(o=r==null?void 0:r.y)!=null?o:null}),e.highlightObject?Vl(e,i):Xl(e),e.highlightAnchor&&r?Kl(e,r):Zl(e)}function $l(e){var r;let t=e.selectedObjectId;if(!t)return null;let i=window.__editableObjectInstances,n=(r=i==null?void 0:i.get)==null?void 0:r.call(i,t);return Array.isArray(n)&&n.length>0?n[0]:t}function Ul(e,t){var r,a;let i=window.gameObjectManager,n=(r=i==null?void 0:i.get)==null?void 0:r.call(i,t);return n?((a=n.getDisplayObject)==null?void 0:a.call(n))||n.pixiObject||n:null}function er(e){let t=e.selectedObjectId;if(!t)return null;let i=window.getEditableObjectConfig;return typeof i!="function"?null:i(t)}function ql(e,t){var s,o;let i=er(e);if(!i)return null;let n=(s=i.transform)!=null?s:{},r=Gl(e);if(!r)return null;if(n.position_ratio!=null)return cg()(r.width,r.height,n.position_ratio);let a=(o=n.anchor)!=null?o:"center";return lg()(r.width,r.height,a)}function Gl(e){var a;let t=(a=e.container)==null?void 0:a.querySelector(".game-container"),i=Number(t==null?void 0:t.dataset.screenWidth),n=Number(t==null?void 0:t.dataset.screenHeight);if(Number.isFinite(i)&&i>0&&Number.isFinite(n)&&n>0)return{width:i,height:n};let r=window.gameApp;return r!=null&&r.renderer?{width:r.renderer.width,height:r.renderer.height}:null}function Wl(e){let t=window.gameApp;return t!=null&&t.stage?(e.objectBoundsGfx&&e.objectBoundsGfx.parent!==t.stage&&(e.objectBoundsGfx.destroy(),e.objectBoundsGfx=null),e.objectBoundsGfx||(e.objectBoundsGfx=new Qn.Graphics,e.objectBoundsGfx.zIndex=999999,t.stage.addChild(e.objectBoundsGfx)),e.objectBoundsGfx):null}function Yl(e){let t=window.gameApp;return t!=null&&t.stage?(e.objectAnchorGfx&&e.objectAnchorGfx.parent!==t.stage&&(e.objectAnchorGfx.destroy(),e.objectAnchorGfx=null),e.objectAnchorGfx||(e.objectAnchorGfx=new Qn.Graphics,e.objectAnchorGfx.zIndex=1e6,t.stage.addChild(e.objectAnchorGfx)),e.objectAnchorGfx):null}function Vl(e,t){var r;let i=Wl(e);if(!i)return;let n=(r=t.getBounds)==null?void 0:r.call(t);n&&(i.clear(),i.rect(n.x,n.y,n.width,n.height).stroke({width:2,color:16726832,alpha:.9}))}function Kl(e,t){let i=Yl(e);if(!i)return;let n=6;i.clear(),i.moveTo(t.x-n,t.y),i.lineTo(t.x+n,t.y),i.moveTo(t.x,t.y-n),i.lineTo(t.x,t.y+n),i.stroke({width:2,color:3066993,alpha:.9})}function Xl(e){e.objectBoundsGfx&&e.objectBoundsGfx.clear()}function Zl(e){e.objectAnchorGfx&&e.objectAnchorGfx.clear()}function Jn(e){e.objectBoundsGfx&&(e.objectBoundsGfx.destroy(),e.objectBoundsGfx=null),e.objectAnchorGfx&&(e.objectAnchorGfx.destroy(),e.objectAnchorGfx=null)}function Zn(e,t){e.sceneToolsPanel.updateInfo(t?{instanceId:t.instanceId,worldX:t.worldX,worldY:t.worldY,anchorX:t.configX,anchorY:t.configY}:null)}function pg(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function fg(e,t,i){var s;let n=t.split("."),r=n.pop(),a=e;for(let o of n)a[o]=(s=a[o])!=null?s:{},a=a[o];a[r]=i}function Jl(e){var n,r,a,s,o;if(!e)return!1;if((n=e.transform)!=null&&n.offset)return!0;let t=((a=(r=e.identity)==null?void 0:r.category)!=null?a:"").toString().toLowerCase(),i=((o=(s=e.identity)==null?void 0:s.id)!=null?o:"").toString().toLowerCase();return t.includes("ui")||i.startsWith("ui")||i.includes("label")}function Za(e){let t=It();t.layout&&(t.layout.scale_multiplier=1,t.layout.position_offset={x:0,y:0},t.layout.debug_rect_visible=!0,t.layout.debug_rect_color=16711680,t.layout.debug_rect_thickness=4),t.engine&&(t.engine.scale=1,t.engine.background_scale=1.05,t.engine.label_pulse_speed=3,t.engine.label_pulse_intensity=.03),t.physics&&(t.physics.rope_length=420),window.location.reload()}function hg(e){window.location.reload()}function Ja(e){let t=JSON.stringify(It(),null,2);navigator.clipboard.writeText(t).then(()=>{alert("Debug config copied to clipboard!")}).catch(()=>{console.log(t),alert("Config logged to console (clipboard not available)")})}async function gg(e,t){var i,n,r;if(!(!e.configViewer||!e.container))try{let a=window.getEditableObjectConfig,s=typeof a=="function"?a(t):null;if(!s){let{loadObjectCentricConfig:o,loadObjectConfig:l}=await Promise.resolve().then(()=>(jr(),Cd)),u=(((i=(await o("scene.main")).scene)==null?void 0:i.objects)||[]).find(f=>f.object_config===t||f.instance_id===t);if(!u)return;let p=await l(u.object_config);console.log("[PREVIEW] Loaded object config (fallback)",t,p),Xa(e,p),(n=e.configViewer)==null||n.style.setProperty("display","block");return}console.log("[PREVIEW] Loaded object config",t,s),Xa(e,s),(r=e.configViewer)==null||r.style.setProperty("display","block");return}catch(a){console.error("[DEBUG] Failed to load object config:",a)}}function Xa(e,t){var u,p,f,m,h,g,b,y,v,x;if(!e.container)return;let i=e.container.querySelector("#config-pos-x"),n=e.container.querySelector("#config-pos-y"),r=e.container.querySelector("#config-scale"),a=e.container.querySelector("#config-anchor-x"),s=e.container.querySelector("#config-anchor-y"),l=Jl(t)?(u=t.transform)==null?void 0:u.offset:(p=t.transform)==null?void 0:p.position;i&&(i.value=String((f=l==null?void 0:l.x)!=null?f:0)),n&&(n.value=String((m=l==null?void 0:l.y)!=null?m:0)),r&&(r.value=String((g=(h=t.transform)==null?void 0:h.scale)!=null?g:1));let c=(x=(v=(b=t.transform)==null?void 0:b.anchor)!=null?v:(y=t.render)==null?void 0:y.anchor)!=null?x:{x:.5,y:.5},d=og()(c);a&&(a.value=String(d.x)),s&&(s.value=String(d.y))}function mg(e){var l,c,d,u,p,f,m,h,g,b;let t=e.selectedObjectId;if(!t||!e.container)return;let i=(c=(l=e.container.querySelector("#config-pos-x"))==null?void 0:l.value)!=null?c:"0",n=(u=(d=e.container.querySelector("#config-pos-y"))==null?void 0:d.value)!=null?u:"0",r=(f=(p=e.container.querySelector("#config-scale"))==null?void 0:p.value)!=null?f:"1",a=(h=(m=e.container.querySelector("#config-anchor-x"))==null?void 0:m.value)!=null?h:"0.5",s=(b=(g=e.container.querySelector("#config-anchor-y"))==null?void 0:g.value)!=null?b:"0.5",o=`${t}:
|
|
1048
1048
|
position: (${i}, ${n})
|
|
1049
1049
|
scale: ${r}
|
|
1050
|
-
anchor: (${a}, ${s})`;navigator.clipboard.writeText(o).then(()=>console.log("[DEBUG] Config values copied to clipboard")).catch(y=>console.error("[DEBUG] Failed to copy config values:",y))}async function Ql(e,t){var u,p,f,m,h,g,b,y,v,x,w;if(console.log("[INSPECTOR] \u{1F527} applyObjectConfig called"),!e.container)return;let i=e.selectedObjectId;if(!i){console.warn("[PREVIEW] Apply object config clicked with no selection");return}let n=Number((p=(u=e.container.querySelector("#config-pos-x"))==null?void 0:u.value)!=null?p:0),r=Number((m=(f=e.container.querySelector("#config-pos-y"))==null?void 0:f.value)!=null?m:0),a=Number((g=(h=e.container.querySelector("#config-scale"))==null?void 0:h.value)!=null?g:1),s=Number((y=(b=e.container.querySelector("#config-anchor-x"))==null?void 0:b.value)!=null?y:.5),o=Number((x=(v=e.container.querySelector("#config-anchor-y"))==null?void 0:v.value)!=null?x:.5);console.log("[INSPECTOR] Applying config for:",i,{posX:n,posY:r,scale:a,anchorX:s,anchorY:o});let{applyConfigOverride:l}=await Promise.resolve().then(()=>(Te(),Or));l({objectId:i,path:"transform.position",value:{x:n,y:r}},{silent:t==null?void 0:t.silent}),l({objectId:i,path:"transform.scale",value:a},{silent:t==null?void 0:t.silent}),l({objectId:i,path:"transform.anchor",value:{x:s,y:o}},{silent:t==null?void 0:t.silent});let c=er(e);Jl(c)&&l({objectId:i,path:"transform.offset",value:{x:n,y:r}},{silent:!0}),console.log("[INSPECTOR] Calling applyEditableObjectConfig...");let d=window.applyEditableObjectConfig;if(typeof d=="function"){let S=(w=window.getEditableObjectConfig)==null?void 0:w.call(window,i);S?(console.log("[INSPECTOR] \u2705 Calling applyEditableObjectConfig for:",i),d(i,S)):console.warn("[INSPECTOR] \u26A0\uFE0F No config found for:",i)}else console.warn("[INSPECTOR] \u26A0\uFE0F applyEditableObjectConfig not available")}async function bg(e,t,i){let{applyConfigOverride:n}=await Promise.resolve().then(()=>(Te(),Or));Object.entries(t.assets).forEach(([l,c])=>{n({path:`assets.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.theme).forEach(([l,c])=>{n({path:`runtime.theme.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.ui).forEach(([l,c])=>{n({path:`runtime.ui.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.fonts).forEach(([l,c])=>{n({path:`runtime.fonts.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.audio).forEach(([l,c])=>{n({path:`runtime.audio.${l}`,value:c},{silent:!0})});let r=window.applyEditableEngineConfig;if(typeof r=="function"){let l={theme:t.runtime.theme,fonts:t.runtime.fonts,audio:t.runtime.audio},c={};Object.entries(t.runtime.ui).forEach(([d,u])=>{var p;if(d)if(d.includes(".")){let f=d.split("."),m=c;for(let h=0;h<f.length-1;h++){let g=f[h];m[g]=(p=m[g])!=null?p:{},m=m[g]}m[f[f.length-1]]=u}else c[d]=u}),l.ui=c,r({runtime:l,assets:t.assets})}let a=Object.values(t.assets).some(l=>/^(blob:|data:)/.test(l)),s=(i==null?void 0:i.source)!=="auto"&&!a,o=window.__previewShell;s&&(o!=null&&o.refresh)&&o.refresh()}function yg(e){e.selectedObjectId&&(e.objectAutoApplyTimer&&window.clearTimeout(e.objectAutoApplyTimer),e.objectAutoApplyTimer=window.setTimeout(()=>{e.objectAutoApplyTimer=null,Ql(e,{silent:!0})},150))}var zw=3e3;function vg(e,t,i){let n=i!=null?i:e.offsetParent;if(!n)return;t.style.cursor="move";let r=0,a=0,s=0,o=0,l=!1,c=u=>{if(!l)return;let p=u.clientX-r,f=u.clientY-a;e.style.left=`${s+p}px`,e.style.top=`${o+f}px`},d=()=>{l&&(l=!1,window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",d))};t.addEventListener("pointerdown",u=>{if(u.button!==0)return;let p=u.target;if(p!=null&&p.closest("button, input, select, textarea"))return;u.preventDefault();let f=e.getBoundingClientRect(),m=n.getBoundingClientRect();s=Math.max(0,f.left-m.left),o=Math.max(0,f.top-m.top);let h=f.width,g=f.height,b=m.width,y=m.height;s=Math.min(s,b-h),o=Math.min(o,y-g),r=u.clientX,a=u.clientY,e.style.left=`${s}px`,e.style.top=`${o}px`,e.style.right="auto",e.style.bottom="auto",e.style.zIndex=String(++zw);let v=e.getBoundingClientRect();(v.left<0||v.top<0||v.right>window.innerWidth||v.bottom>window.innerHeight)&&(e.style.left="16px",e.style.top="72px",e.style.right="auto",e.style.bottom="auto"),l=!0,window.addEventListener("pointermove",c),window.addEventListener("pointerup",d)})}function xg(e,t,i){t.style.cursor="nwse-resize";let n=0,r=0,a=0,s=0,o=!1,l=d=>{if(!o)return;let u=d.clientX-a,p=d.clientY-s,f=Math.max(100,n+u),m=Math.max(100,r+p);e.style.width=`${f}px`,e.style.height=`${m}px`,i==null||i(f,m)},c=()=>{o&&(o=!1,window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",c))};t.addEventListener("pointerdown",d=>{if(d.button!==0)return;d.preventDefault(),d.stopPropagation();let u=e.getBoundingClientRect();n=u.width,r=u.height,a=d.clientX,s=d.clientY,o=!0,window.addEventListener("pointermove",l),window.addEventListener("pointerup",c)})}function ec(e,t){var h,g,b;let i=(b=(g=(h=e.container)==null?void 0:h.querySelector("#debug-overlay"))!=null?g:e.debugOverlay)!=null?b:t.offsetParent;if(!i)return;let n=i.getBoundingClientRect(),r=t.getBoundingClientRect(),a=12,s=Math.max(250,Math.floor(n.width-a*2)),o=Math.max(200,Math.floor(n.height-a*2));r.width>s&&(t.style.width=`${s}px`),r.height>o&&(t.style.height=`${o}px`);let l=t.getBoundingClientRect(),c=l.left-n.left,d=l.top-n.top,u=Math.max(a,n.width-l.width-a),p=Math.max(a,n.height-l.height-a),f=Math.min(Math.max(c,a),u),m=Math.min(Math.max(d,a),p);t.style.left=`${Math.round(f)}px`,t.style.top=`${Math.round(m)}px`,t.style.right="auto",t.style.bottom="auto"}function ii(e){if(!e.container)return;let t=e.container.querySelector("#debug-workbench");if(!t)return;ec(e,t);let i={activeTab:e.activeTab,width:t.style.width,height:t.style.height,left:t.style.left,top:t.style.top};localStorage.setItem("preview_workbench_state",JSON.stringify(i))}function Qa(e){try{let t=localStorage.getItem("preview_workbench_state");if(!t)return;let i=JSON.parse(t);i.activeTab&&(e.activeTab=i.activeTab),window.requestAnimationFrame(()=>{var r;let n=(r=e.container)==null?void 0:r.querySelector("#debug-workbench");n&&(i.width&&(n.style.width=i.width),i.height&&(n.style.height=i.height),i.left&&(n.style.left=i.left,n.style.right="auto"),i.top&&(n.style.top=i.top,n.style.bottom="auto"),ec(e,n))})}catch(t){console.warn("[PREVIEW] Failed to load workbench state",t)}}function wg(e,t){let i=t.getBoundingClientRect();(i.left<0||i.top<0||i.right>window.innerWidth||i.bottom>window.innerHeight)&&(console.warn("[Workbench] Workbench positioned outside viewport, repositioning..."),t.style.left="16px",t.style.top="72px",t.style.right="auto",t.style.bottom="auto",ec(e,t),ii(e))}function _g(e){var r,a,s;if(!e.container)return;let t=e.container,i=t.querySelector("#debug-toggle");i||console.warn("[PREVIEW] Debug toggle not found in DOM"),i==null||i.addEventListener("click",()=>{var o;console.log("[PREVIEW] Debug toggle clicked"),(o=e.toggleDebug)==null||o.call(e)}),(r=t.querySelector("#debug-close"))==null||r.addEventListener("click",()=>{var o;return(o=e.toggleDebug)==null?void 0:o.call(e,!1)}),(a=t.querySelector("#debug-reset"))==null||a.addEventListener("click",()=>Za(e)),(s=t.querySelector("#debug-export"))==null||s.addEventListener("click",()=>Ja(e)),t.querySelectorAll(".workbench-tab").forEach(o=>{o.addEventListener("click",()=>{let l=o.dataset.tab;e.activeTab=l,tc(e),ii(e)})}),nc(e,t),ic(e,t)}function tc(e){if(!e.container)return;let t=e.container;t.querySelectorAll(".workbench-tab").forEach(r=>{let a=r.dataset.tab;r.classList.toggle("active",a===e.activeTab)}),t.querySelectorAll(".workbench-tab-panel").forEach(r=>{let a=r.dataset.tabPanel;r.classList.toggle("active",a===e.activeTab)})}function ic(e,t){Ae(e,t,"debug-scene-scale","engine.scale","#debug-scene-scale-value"),Ae(e,t,"debug-layout-scale","layout.scale_multiplier","#debug-layout-scale-value"),Ae(e,t,"debug-layout-offset-x","layout.position_offset.x","#debug-layout-offset-x-value"),Ae(e,t,"debug-layout-offset-y","layout.position_offset.y","#debug-layout-offset-y-value"),Ae(e,t,"debug-rect-thickness","layout.debug_rect_thickness","#debug-rect-thickness-value"),Ae(e,t,"debug-engine-scale","engine.scale","#debug-engine-scale-value"),Ae(e,t,"debug-background-scale","engine.background_scale","#debug-background-scale-value"),Ae(e,t,"debug-label-pulse-speed","engine.label_pulse_speed","#debug-label-pulse-speed-value"),Ae(e,t,"debug-label-pulse-intensity","engine.label_pulse_intensity","#debug-label-pulse-intensity-value"),Ae(e,t,"debug-rope-length","physics.rope_length","#debug-rope-length-value");let i=t.querySelector("#debug-rect-visible");i==null||i.addEventListener("change",()=>{let r=It();r.layout&&(r.layout.debug_rect_visible=!!i.checked)});let n=t.querySelector("#debug-rect-color");n==null||n.addEventListener("input",()=>{let r=n.value.replace("#",""),a=parseInt(r,16),s=It();s.layout&&(s.layout.debug_rect_color=Number.isFinite(a)?a:16711680)})}function Eg(e){if(!e.container||!e.debugOverlay)return;let t=e.container.querySelector("#debug-workbench"),i=e.container.querySelector("#workbench-handle"),n=e.container.querySelector("#workbench-resize");t&&i&&(!t.style.left&&!t.style.right&&!t.style.top&&!t.style.bottom&&(t.style.right="16px",t.style.top="72px"),vg(t,i,e.debugOverlay),i.addEventListener("pointerup",()=>{setTimeout(()=>{ii(e),wg(e,t)},10)})),t&&n&&xg(t,n,()=>ii(e)),Qa(e)}function nc(e,t){Array.from(t.querySelectorAll("[data-panel-toggle]")).forEach(n=>{n.addEventListener("click",()=>{let r=n.closest(".scene-panel");r&&r.classList.toggle("collapsed")})})}function Ae(e,t,i,n,r){let a=t.querySelector(`#${i}`),s=t.querySelector(r);if(!a||!s)return;let o=pg(It(),n);typeof o=="number"&&(a.value=String(o),s.textContent=String(o)),a.addEventListener("input",()=>{let l=Number(a.value);s.textContent=String(l),fg(It(),n,l)})}Te();var es=class{constructor(){this.container=null}initialize(t){this.container=t,window.addEventListener("config:changed",()=>{this.refreshPanel()}),this.refreshPanel()}render(){let t=Tr(),{hasChanges:i,overrideCount:n,overrides:r}=t,a={};for(let l of r){let c=l.objectId||"Engine";a[c]||(a[c]=[]),a[c].push(l)}let s=localStorage.getItem("handler_last_applied"),o=s?new Date(parseInt(s)).toLocaleString():"Never";return`
|
|
1050
|
+
anchor: (${a}, ${s})`;navigator.clipboard.writeText(o).then(()=>console.log("[DEBUG] Config values copied to clipboard")).catch(y=>console.error("[DEBUG] Failed to copy config values:",y))}async function Ql(e,t){var u,p,f,m,h,g,b,y,v,x,w;if(console.log("[INSPECTOR] \u{1F527} applyObjectConfig called"),!e.container)return;let i=e.selectedObjectId;if(!i){console.warn("[PREVIEW] Apply object config clicked with no selection");return}let n=Number((p=(u=e.container.querySelector("#config-pos-x"))==null?void 0:u.value)!=null?p:0),r=Number((m=(f=e.container.querySelector("#config-pos-y"))==null?void 0:f.value)!=null?m:0),a=Number((g=(h=e.container.querySelector("#config-scale"))==null?void 0:h.value)!=null?g:1),s=Number((y=(b=e.container.querySelector("#config-anchor-x"))==null?void 0:b.value)!=null?y:.5),o=Number((x=(v=e.container.querySelector("#config-anchor-y"))==null?void 0:v.value)!=null?x:.5);console.log("[INSPECTOR] Applying config for:",i,{posX:n,posY:r,scale:a,anchorX:s,anchorY:o});let{applyConfigOverride:l}=await Promise.resolve().then(()=>(Te(),Or));l({objectId:i,path:"transform.position",value:{x:n,y:r}},{silent:t==null?void 0:t.silent}),l({objectId:i,path:"transform.scale",value:a},{silent:t==null?void 0:t.silent}),l({objectId:i,path:"transform.anchor",value:{x:s,y:o}},{silent:t==null?void 0:t.silent});let c=er(e);Jl(c)&&l({objectId:i,path:"transform.offset",value:{x:n,y:r}},{silent:!0}),console.log("[INSPECTOR] Calling applyEditableObjectConfig...");let d=window.applyEditableObjectConfig;if(typeof d=="function"){let E=(w=window.getEditableObjectConfig)==null?void 0:w.call(window,i);E?(console.log("[INSPECTOR] \u2705 Calling applyEditableObjectConfig for:",i),d(i,E)):console.warn("[INSPECTOR] \u26A0\uFE0F No config found for:",i)}else console.warn("[INSPECTOR] \u26A0\uFE0F applyEditableObjectConfig not available")}async function bg(e,t,i){let{applyConfigOverride:n}=await Promise.resolve().then(()=>(Te(),Or));Object.entries(t.assets).forEach(([l,c])=>{n({path:`assets.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.theme).forEach(([l,c])=>{n({path:`runtime.theme.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.ui).forEach(([l,c])=>{n({path:`runtime.ui.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.fonts).forEach(([l,c])=>{n({path:`runtime.fonts.${l}`,value:c},{silent:!0})}),Object.entries(t.runtime.audio).forEach(([l,c])=>{n({path:`runtime.audio.${l}`,value:c},{silent:!0})});let r=window.applyEditableEngineConfig;if(typeof r=="function"){let l={theme:t.runtime.theme,fonts:t.runtime.fonts,audio:t.runtime.audio},c={};Object.entries(t.runtime.ui).forEach(([d,u])=>{var p;if(d)if(d.includes(".")){let f=d.split("."),m=c;for(let h=0;h<f.length-1;h++){let g=f[h];m[g]=(p=m[g])!=null?p:{},m=m[g]}m[f[f.length-1]]=u}else c[d]=u}),l.ui=c,r({runtime:l,assets:t.assets})}let a=Object.values(t.assets).some(l=>/^(blob:|data:)/.test(l)),s=(i==null?void 0:i.source)!=="auto"&&!a,o=window.__previewShell;s&&(o!=null&&o.refresh)&&o.refresh()}function yg(e){e.selectedObjectId&&(e.objectAutoApplyTimer&&window.clearTimeout(e.objectAutoApplyTimer),e.objectAutoApplyTimer=window.setTimeout(()=>{e.objectAutoApplyTimer=null,Ql(e,{silent:!0})},150))}var zw=3e3;function vg(e,t,i){let n=i!=null?i:e.offsetParent;if(!n)return;t.style.cursor="move";let r=0,a=0,s=0,o=0,l=!1,c=u=>{if(!l)return;let p=u.clientX-r,f=u.clientY-a;e.style.left=`${s+p}px`,e.style.top=`${o+f}px`},d=()=>{l&&(l=!1,window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",d))};t.addEventListener("pointerdown",u=>{if(u.button!==0)return;let p=u.target;if(p!=null&&p.closest("button, input, select, textarea"))return;u.preventDefault();let f=e.getBoundingClientRect(),m=n.getBoundingClientRect();s=Math.max(0,f.left-m.left),o=Math.max(0,f.top-m.top);let h=f.width,g=f.height,b=m.width,y=m.height;s=Math.min(s,b-h),o=Math.min(o,y-g),r=u.clientX,a=u.clientY,e.style.left=`${s}px`,e.style.top=`${o}px`,e.style.right="auto",e.style.bottom="auto",e.style.zIndex=String(++zw);let v=e.getBoundingClientRect();(v.left<0||v.top<0||v.right>window.innerWidth||v.bottom>window.innerHeight)&&(e.style.left="16px",e.style.top="72px",e.style.right="auto",e.style.bottom="auto"),l=!0,window.addEventListener("pointermove",c),window.addEventListener("pointerup",d)})}function xg(e,t,i){t.style.cursor="nwse-resize";let n=0,r=0,a=0,s=0,o=!1,l=d=>{if(!o)return;let u=d.clientX-a,p=d.clientY-s,f=Math.max(100,n+u),m=Math.max(100,r+p);e.style.width=`${f}px`,e.style.height=`${m}px`,i==null||i(f,m)},c=()=>{o&&(o=!1,window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",c))};t.addEventListener("pointerdown",d=>{if(d.button!==0)return;d.preventDefault(),d.stopPropagation();let u=e.getBoundingClientRect();n=u.width,r=u.height,a=d.clientX,s=d.clientY,o=!0,window.addEventListener("pointermove",l),window.addEventListener("pointerup",c)})}function ec(e,t){var h,g,b;let i=(b=(g=(h=e.container)==null?void 0:h.querySelector("#debug-overlay"))!=null?g:e.debugOverlay)!=null?b:t.offsetParent;if(!i)return;let n=i.getBoundingClientRect(),r=t.getBoundingClientRect(),a=12,s=Math.max(250,Math.floor(n.width-a*2)),o=Math.max(200,Math.floor(n.height-a*2));r.width>s&&(t.style.width=`${s}px`),r.height>o&&(t.style.height=`${o}px`);let l=t.getBoundingClientRect(),c=l.left-n.left,d=l.top-n.top,u=Math.max(a,n.width-l.width-a),p=Math.max(a,n.height-l.height-a),f=Math.min(Math.max(c,a),u),m=Math.min(Math.max(d,a),p);t.style.left=`${Math.round(f)}px`,t.style.top=`${Math.round(m)}px`,t.style.right="auto",t.style.bottom="auto"}function ii(e){if(!e.container)return;let t=e.container.querySelector("#debug-workbench");if(!t)return;ec(e,t);let i={activeTab:e.activeTab,width:t.style.width,height:t.style.height,left:t.style.left,top:t.style.top};localStorage.setItem("preview_workbench_state",JSON.stringify(i))}function Qa(e){try{let t=localStorage.getItem("preview_workbench_state");if(!t)return;let i=JSON.parse(t);i.activeTab&&(e.activeTab=i.activeTab),window.requestAnimationFrame(()=>{var r;let n=(r=e.container)==null?void 0:r.querySelector("#debug-workbench");n&&(i.width&&(n.style.width=i.width),i.height&&(n.style.height=i.height),i.left&&(n.style.left=i.left,n.style.right="auto"),i.top&&(n.style.top=i.top,n.style.bottom="auto"),ec(e,n))})}catch(t){console.warn("[PREVIEW] Failed to load workbench state",t)}}function wg(e,t){let i=t.getBoundingClientRect();(i.left<0||i.top<0||i.right>window.innerWidth||i.bottom>window.innerHeight)&&(console.warn("[Workbench] Workbench positioned outside viewport, repositioning..."),t.style.left="16px",t.style.top="72px",t.style.right="auto",t.style.bottom="auto",ec(e,t),ii(e))}function _g(e){var r,a,s;if(!e.container)return;let t=e.container,i=t.querySelector("#debug-toggle");i||console.warn("[PREVIEW] Debug toggle not found in DOM"),i==null||i.addEventListener("click",()=>{var o;console.log("[PREVIEW] Debug toggle clicked"),(o=e.toggleDebug)==null||o.call(e)}),(r=t.querySelector("#debug-close"))==null||r.addEventListener("click",()=>{var o;return(o=e.toggleDebug)==null?void 0:o.call(e,!1)}),(a=t.querySelector("#debug-reset"))==null||a.addEventListener("click",()=>Za(e)),(s=t.querySelector("#debug-export"))==null||s.addEventListener("click",()=>Ja(e)),t.querySelectorAll(".workbench-tab").forEach(o=>{o.addEventListener("click",()=>{let l=o.dataset.tab;e.activeTab=l,tc(e),ii(e)})}),nc(e,t),ic(e,t)}function tc(e){if(!e.container)return;let t=e.container;t.querySelectorAll(".workbench-tab").forEach(r=>{let a=r.dataset.tab;r.classList.toggle("active",a===e.activeTab)}),t.querySelectorAll(".workbench-tab-panel").forEach(r=>{let a=r.dataset.tabPanel;r.classList.toggle("active",a===e.activeTab)})}function ic(e,t){Ae(e,t,"debug-scene-scale","engine.scale","#debug-scene-scale-value"),Ae(e,t,"debug-layout-scale","layout.scale_multiplier","#debug-layout-scale-value"),Ae(e,t,"debug-layout-offset-x","layout.position_offset.x","#debug-layout-offset-x-value"),Ae(e,t,"debug-layout-offset-y","layout.position_offset.y","#debug-layout-offset-y-value"),Ae(e,t,"debug-rect-thickness","layout.debug_rect_thickness","#debug-rect-thickness-value"),Ae(e,t,"debug-engine-scale","engine.scale","#debug-engine-scale-value"),Ae(e,t,"debug-background-scale","engine.background_scale","#debug-background-scale-value"),Ae(e,t,"debug-label-pulse-speed","engine.label_pulse_speed","#debug-label-pulse-speed-value"),Ae(e,t,"debug-label-pulse-intensity","engine.label_pulse_intensity","#debug-label-pulse-intensity-value"),Ae(e,t,"debug-rope-length","physics.rope_length","#debug-rope-length-value");let i=t.querySelector("#debug-rect-visible");i==null||i.addEventListener("change",()=>{let r=It();r.layout&&(r.layout.debug_rect_visible=!!i.checked)});let n=t.querySelector("#debug-rect-color");n==null||n.addEventListener("input",()=>{let r=n.value.replace("#",""),a=parseInt(r,16),s=It();s.layout&&(s.layout.debug_rect_color=Number.isFinite(a)?a:16711680)})}function Eg(e){if(!e.container||!e.debugOverlay)return;let t=e.container.querySelector("#debug-workbench"),i=e.container.querySelector("#workbench-handle"),n=e.container.querySelector("#workbench-resize");t&&i&&(!t.style.left&&!t.style.right&&!t.style.top&&!t.style.bottom&&(t.style.right="16px",t.style.top="72px"),vg(t,i,e.debugOverlay),i.addEventListener("pointerup",()=>{setTimeout(()=>{ii(e),wg(e,t)},10)})),t&&n&&xg(t,n,()=>ii(e)),Qa(e)}function nc(e,t){Array.from(t.querySelectorAll("[data-panel-toggle]")).forEach(n=>{n.addEventListener("click",()=>{let r=n.closest(".scene-panel");r&&r.classList.toggle("collapsed")})})}function Ae(e,t,i,n,r){let a=t.querySelector(`#${i}`),s=t.querySelector(r);if(!a||!s)return;let o=pg(It(),n);typeof o=="number"&&(a.value=String(o),s.textContent=String(o)),a.addEventListener("input",()=>{let l=Number(a.value);s.textContent=String(l),fg(It(),n,l)})}Te();var es=class{constructor(){this.container=null}initialize(t){this.container=t,window.addEventListener("config:changed",()=>{this.refreshPanel()}),this.refreshPanel()}render(){let t=Tr(),{hasChanges:i,overrideCount:n,overrides:r}=t,a={};for(let l of r){let c=l.objectId||"Engine";a[c]||(a[c]=[]),a[c].push(l)}let s=localStorage.getItem("handler_last_applied"),o=s?new Date(parseInt(s)).toLocaleString():"Never";return`
|
|
1051
1051
|
<div class="config-persistence-panel">
|
|
1052
1052
|
<div class="persistence-status-bar ${i?"has-changes":"no-changes"}">
|
|
1053
1053
|
${i?`
|
|
@@ -1475,7 +1475,7 @@ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
1475
1475
|
<div class="console-messages" id="console-messages"></div>
|
|
1476
1476
|
</div>
|
|
1477
1477
|
</div>
|
|
1478
|
-
`,this.setupEventListeners(t),t}setupEventListeners(t){var r,a,s,o,l,c,d;let i=t.querySelector("#device-select");i==null||i.addEventListener("change",u=>{if(this.viewMode==="compare")return;let p=u.target.value;this.setDevice(p)}),Array.from(t.querySelectorAll("[data-view-toggle]")).forEach(u=>{u.addEventListener("click",()=>{let p=u.dataset.viewToggle;p&&this.setViewMode(p)})}),(r=t.querySelector("#rotate-btn"))==null||r.addEventListener("click",()=>this.toggleRotation()),(a=t.querySelector("#zoom-in-btn"))==null||a.addEventListener("click",()=>this.adjustUserZoom(.1)),(s=t.querySelector("#zoom-out-btn"))==null||s.addEventListener("click",()=>this.adjustUserZoom(-.1)),(o=t.querySelector("#refresh-btn"))==null||o.addEventListener("click",()=>this.refresh()),(l=t.querySelector("#console-toggle"))==null||l.addEventListener("click",()=>this.toggleConsole()),(c=t.querySelector("#console-close"))==null||c.addEventListener("click",()=>this.toggleConsole(!1)),(d=t.querySelector("#console-clear"))==null||d.addEventListener("click",()=>this.clearConsole())}applyDeviceFrameStyles(){Object.assign(this.frameDragger.style,{display:"flex",justifyContent:"center",alignItems:"center",transform:"translate(0px, 0px)",touchAction:"none"}),Object.assign(this.frameWrapper.style,{display:"flex",justifyContent:"center",alignItems:"center",transformOrigin:"center center",transition:"transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)",boxShadow:"0 20px 50px rgba(0,0,0,0.5)",borderRadius:"0px",willChange:"transform"}),Object.assign(this.deviceFrame.style,{overflow:"hidden",position:"relative",borderRadius:"0px"}),Object.assign(this.gameContainer.style,{position:"relative",overflow:"hidden",minWidth:"0px",minHeight:"0px"})}setupObserversAndListeners(){this.resizeObserver=new ResizeObserver(()=>{this.resizeListenersDisabled||!this.gameReady||this.scheduleFit()}),this.resizeObserver.observe(this.previewContainer),window.addEventListener("resize",this.onWindowResize,{passive:!0})}scheduleFit(){this.rafFitHandle&&cancelAnimationFrame(this.rafFitHandle),this.rafFitHandle=requestAnimationFrame(()=>{this.rafFitHandle=null,this.fitToScreen()})}applyPresetDimensions(){let t=this.getEffectivePreset(),i=`${t.width}px`,n=`${t.height}px`;this.deviceFrame.style.width=i,this.deviceFrame.style.height=n,this.gameContainer.style.width=i,this.gameContainer.style.height=n,this.gameContainer.style.maxWidth=i,this.gameContainer.style.maxHeight=n,this.gameContainer.style.minWidth=i,this.gameContainer.style.minHeight=n,this.gameContainer.dataset.screenWidth=String(t.width),this.gameContainer.dataset.screenHeight=String(t.height),this.container.style.setProperty("--preview-screen-width",String(t.width)),this.container.style.setProperty("--preview-screen-height",String(t.height))}fitToScreen(t){if(!this.previewContainer)return;let i=this.getEffectivePreset(),n=this.getFitBounds(),r=Math.max(0,n.width),a=Math.max(0,n.height);if(r<=0||a<=0)return;this.applyPresetDimensions(),this.viewMode==="compare"&&this.applyCompareDimensions();let s=r/i.width,o=a/i.height;if(this.autoScale=Math.max(.01,Math.min(s,o)),!this.hasInitialFit){this.hasInitialFit=!0;let l=.6;this.userScaleMultiplier=l/this.autoScale}t!=null&&t.keepVisibleScale&&t.keepVisibleScale>0&&(this.userScaleMultiplier=t.keepVisibleScale/this.autoScale),this.applyTransform(),this.viewMode==="compare"&&this.fitCompareGhosts(),this.emitScreenChange()}applyTransform(){let t=this.autoScale*this.userScaleMultiplier;this.frameWrapper.style.transform=`scale(${t})`;let i=this.container.querySelector("#zoom-label");i&&(i.textContent=`${Math.round(t*100)}%`)}applyFrameDrag(){this.frameDragger.style.transform=`translate(${this.frameDragOffsetX}px, ${this.frameDragOffsetY}px)`}setupFrameDragging(){this.frameDragger.addEventListener("pointerdown",t=>{this.gameContainer.contains(t.target)||t.button===0&&(t.preventDefault(),this.frameDragActive=!0,this.frameDragStartX=t.clientX,this.frameDragStartY=t.clientY,this.frameDragOriginX=this.frameDragOffsetX,this.frameDragOriginY=this.frameDragOffsetY,window.addEventListener("pointermove",this.onFrameDragMove),window.addEventListener("pointerup",this.onFrameDragEnd))})}adjustUserZoom(t){this.userScaleMultiplier=Math.max(.1,Math.min(6,this.userScaleMultiplier+t)),this.applyTransform(),this.emitScreenChange()}toggleRotation(){var i,n;if(this.viewMode==="compare")return;let t=this.autoScale*this.userScaleMultiplier;this.isLandscape=!this.isLandscape,this.applyPresetDimensions(),this.fitToScreen({keepVisibleScale:t}),(n=(i=this.options).onDeviceChange)==null||n.call(i,this.getEffectivePreset()),this.emitScreenChange()}emitScreenChange(){if(!this.gameReady)return;let t=this.getEffectivePreset(),i={width:t.width,height:t.height,dpr:Math.max(1,Math.floor(window.devicePixelRatio||1)),presetId:t.id,isLandscape:this.isLandscape};if(window.dispatchEvent(new CustomEvent("handler-preview:screen",{detail:i})),this.viewMode==="compare"&&this.refreshCompareSnapshots(),this.isInitialized&&this.isMounted&&this.gameReady){let n=window.gameApp;if(!(n!=null&&n.renderer))return;this.ignoreNextWindowResize=!0,window.dispatchEvent(new Event("resize"))}}safeStringify(t){var n;let i=new WeakSet;try{return JSON.stringify(t,(r,a)=>{if(typeof a=="object"&&a!==null){if(i.has(a))return"[Circular]";i.add(a)}return a},2)}catch{try{if(t&&((n=t.constructor)!=null&&n.name))return`[object ${t.constructor.name}]`}catch{}return String(t)}}setupConsoleInterceptor(){let t=console.log.bind(console),i=console.warn.bind(console),n=console.error.bind(console),r=console.info.bind(console),a=(s,...o)=>{let l=o.map(d=>typeof d=="object"?this.safeStringify(d):String(d)).join(" ");this.consoleMessages.push({type:s,message:l,timestamp:new Date}),this.appendConsoleMessage(this.consoleMessages[this.consoleMessages.length-1]);let c=this.container.querySelector("#console-badge");if(c){let d=this.consoleMessages.filter(u=>u.type==="error").length;c.textContent=d>0?`${d}!`:"0",c.classList.toggle("has-errors",d>0)}};console.log=(...s)=>{t(...s),a("log",...s)},console.warn=(...s)=>{i(...s),a("warn",...s)},console.error=(...s)=>{n(...s),a("error",...s)},console.info=(...s)=>{r(...s),a("info",...s)}}appendConsoleMessage(t){let i=this.container.querySelector("#console-messages");if(!i)return;let n=document.createElement("div");n.className=`console-msg type-${t.type}`;let r=t.timestamp.toLocaleTimeString();n.innerHTML=`<span class="time">${this.escapeHtml(r)}</span> <pre>${this.escapeHtml(t.message)}</pre>`,i.appendChild(n),i.scrollTop=i.scrollHeight}escapeHtml(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}toggleConsole(t){var i;this.isConsoleOpen=t!=null?t:!this.isConsoleOpen,(i=this.consolePanel)==null||i.classList.toggle("closed",!this.isConsoleOpen)}clearConsole(){this.consoleMessages=[];let t=this.container.querySelector("#console-messages");t&&(t.innerHTML="");let i=this.container.querySelector("#console-badge");i&&(i.textContent="0")}setupCompareViewports(){Array.from(this.container.querySelectorAll("[data-viewport]")).forEach(i=>{let n=i.dataset.viewport;if(!n)return;let r=this.comparePresets.find(u=>u.id===n);if(!r)return;let a=i.querySelector("[data-compare-slot]"),s=i.querySelector("[data-compare-ghost]"),o=i.querySelector("[data-compare-wrapper]"),l=i.querySelector("[data-compare-frame]"),c=i.querySelector("[data-compare-snapshot]"),d=i.querySelector("[data-compare-focus]");!a||!s||!o||!l||(i.addEventListener("click",u=>{let p=u.target;if(p!=null&&p.closest("[data-compare-focus]")){u.preventDefault(),this.activateCompareViewport(n);return}i.classList.contains("is-active")||this.activateCompareViewport(n)}),this.compareViewports.set(n,{preset:r,root:i,slot:a,ghost:s,wrapper:o,frame:l,canvas:c,focus:d}))})}setViewMode(t){if(this.viewMode===t)return;this.viewMode=t,this.container.classList.toggle("compare-mode",t==="compare"),this.singleStage.classList.toggle("hidden",t!=="single"),this.compareStage.classList.toggle("hidden",t!=="compare");let i=this.container.querySelector("#device-select");i&&(i.disabled=t==="compare");let n=this.container.querySelector("#rotate-btn");if(n&&(n.disabled=t==="compare"),this.updateViewToggleUI(),t==="compare"){this.lastSinglePresetId=this.currentPreset.id,this.activateCompareViewport(this.activeCompareId),this.refreshCompareSnapshots(),this.startCompareSnapshots();return}this.stopCompareSnapshots(),this.singleStage.appendChild(this.frameDragger),this.setDevice(this.lastSinglePresetId,{suppressCallback:!0}),this.fitToScreen()}updateViewToggleUI(){Array.from(this.container.querySelectorAll("[data-view-toggle]")).forEach(i=>{i.classList.toggle("active",i.dataset.viewToggle===this.viewMode)})}activateCompareViewport(t){var a,s;let i=this.compareViewports.get(t);if(!i)return;let n=this.autoScale*this.userScaleMultiplier,r=this.activeCompareId;r&&r!==t&&this.captureCompareSnapshot(r),this.activeCompareId=t,this.currentPreset=i.preset,this.isLandscape=!1,i.slot.appendChild(this.frameDragger),this.frameDragOffsetX=0,this.frameDragOffsetY=0,this.applyFrameDrag(),this.compareViewports.forEach((o,l)=>{o.root.classList.toggle("is-active",l===t),o.ghost.classList.toggle("hidden",l===t),o.focus&&(o.focus.textContent=l===t?"Live":"Focus")}),this.applyPresetDimensions(),this.applyCompareDimensions(),this.fitToScreen({keepVisibleScale:n}),(s=(a=this.options).onDeviceChange)==null||s.call(a,this.getEffectivePreset())}applyCompareDimensions(){this.compareViewports.forEach(t=>{let i=t.preset,n=`${i.width}px`,r=`${i.height}px`;t.frame.style.width=n,t.frame.style.height=r,t.canvas&&(t.canvas.width=i.width,t.canvas.height=i.height)})}fitCompareGhosts(){this.compareViewports.forEach(t=>{let i=t.root.querySelector(".compare-body");if(!i)return;let n=Math.max(0,i.clientWidth-24),r=Math.max(0,i.clientHeight-24);if(n<=0||r<=0)return;let a=n/t.preset.width,s=r/t.preset.height,o=Math.max(.01,Math.min(a,s));t.wrapper.style.transform=`scale(${o})`})}captureCompareSnapshot(t){let i=this.compareViewports.get(t);if(!(i!=null&&i.canvas))return;let n=this.gameContainer.querySelector("canvas");if(!n)return;let r=i.canvas.getContext("2d");if(!r)return;let a=i.canvas.width,s=i.canvas.height,o=Math.min(a/n.width,s/n.height),l=n.width*o,c=n.height*o,d=(a-l)/2,u=(s-c)/2;r.clearRect(0,0,a,s),r.drawImage(n,d,u,l,c)}refreshCompareSnapshots(){this.compareViewports.forEach((t,i)=>{i!==this.activeCompareId&&this.captureCompareSnapshot(i)})}startCompareSnapshots(){this.compareSnapshotTimer||(this.compareSnapshotTimer=window.setInterval(()=>{this.viewMode==="compare"&&this.refreshCompareSnapshots()},500))}stopCompareSnapshots(){this.compareSnapshotTimer&&(window.clearInterval(this.compareSnapshotTimer),this.compareSnapshotTimer=null)}getFitBounds(){if(this.viewMode!=="compare")return{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40};let t=this.compareViewports.get(this.activeCompareId),i=t==null?void 0:t.root.querySelector(".compare-body");return i?{width:i.clientWidth-24,height:i.clientHeight-24}:{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40}}mustQuery(t){let i=this.container.querySelector(t);if(!i)throw new Error(`PreviewShell missing element: ${t}`);return i}};function pc(e={}){let t=new ts(e);return typeof window!="undefined"&&(window.__previewShell=t),t.mount(),t}Te();function fc(e){try{if(e&&typeof e.keys=="function")return Array.from(e.keys())}catch{}return[]}function Cg(e){var t;return e?((t=e.getDisplayObject)==null?void 0:t.call(e))||e.pixiObject||e:null}function $w(e,t){if(!e||!(t!=null&&t.interaction))return;let i=t.interaction,n=i.enabled!==!1&&(i.draggable===!0||i.clickable===!0);e.eventMode=n?"static":"none",e.interactive=n,n&&(e.cursor=i.draggable?"move":"pointer")}function Tg(e,t){var l,c,d,u,p;if(!e||!t)return;let i=t.transform||{};$w(e,t);let n=i.position||{},r=i.offset||{},a=(typeof n.x=="number"?n.x:0)+(typeof r.x=="number"?r.x:0),s=(typeof n.y=="number"?n.y:0)+(typeof r.y=="number"?r.y:0);(l=e.position)!=null&&l.set?e.position.set(a,s):(typeof e.x=="number"&&(e.x=a),typeof e.y=="number"&&(e.y=s)),typeof i.scale=="number"&&((c=e.scale)!=null&&c.set?e.scale.set(i.scale):e.scale&&(e.scale.x=i.scale,e.scale.y=i.scale));let o=(u=i.anchor)!=null?u:(d=t.render)==null?void 0:d.anchor;o&&((p=e.anchor)!=null&&p.set)&&typeof o.x=="number"&&typeof o.y=="number"&&e.anchor.set(o.x,o.y)}function kg(e){if(typeof window=="undefined")return;let t=e==null?void 0:e.objects,i=fc(t),n=a=>{try{let s=window.__HANDLER_ACTIVE_SCREEN;if(!s||s==="all")return a;let o=window.__HANDLER_SCREEN_INDEX,l=o==null?void 0:o.instanceToScreen;return l?a.filter(c=>l[c]===s):a}catch{return a}};window.__editableObjectConfigs=t;let r=new Map;i.forEach(a=>r.set(a,[a])),window.__editableObjectInstances=r,window.refreshEditableConfigIndex=()=>kg(window.__editableConfig),window.getEditableObjectList=()=>{var a;return n(fc((a=window.__editableConfig)==null?void 0:a.objects))},window.getEditableObjectListAll=()=>{var a;return fc((a=window.__editableConfig)==null?void 0:a.objects)},window.getEditableObjectConfig=a=>{var d,u,p,f,m;let s=(f=(p=(u=(d=window.__editableConfig)==null?void 0:d.objects)==null?void 0:u.get)==null?void 0:p.call(u,a))!=null?f:null,o=window.__HANDLER_ACTIVE_SCREEN;if(!o||o==="all")return s;let l=window.__HANDLER_SCREEN_INDEX,c=(m=l==null?void 0:l.instanceToScreen)==null?void 0:m[a];return c&&c===o?s:null},window.getEditableEngineConfig=()=>{let a=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!a),!a)return null;if(a.engine&&a.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let s={...a.engine,objects:a.objects,scene:a.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(s.assets||{})),s}return a}}function Uw(){if(typeof window=="undefined")return;let e=i=>{let n=String(i||"").trim();return n?/^(data:|blob:|https?:)/.test(n)||n.startsWith("/")?n:`/${n.replace(/^\.\//,"")}`:""},t=async(i,n)=>{var a,s,o;let r=e(n);if(r)try{let[{Assets:l},{AssetTextures:c}]=await Promise.all([import("pixi.js"),Promise.resolve().then(()=>(pi(),cd))]),d=Date.now(),u=/^(data:|blob:)/.test(r)?r:r+(r.includes("?")?`&t=${d}`:`?t=${d}`),p=await l.load(u);if(!p)return;c[i]=p;let f=window.CustomAssets;(a=f==null?void 0:f[i])!=null&&a.texture&&(f[i].texture=p);let m=window.gameObjectManager,h=(s=m==null?void 0:m.get)==null?void 0:s.call(m,i);if(h){let g=((o=h.getDisplayObject)==null?void 0:o.call(h))||h.pixiObject||h.pixi||h;if(g!=null&&g.texture)g.texture=p;else if(g!=null&&g.children){let b=g.children.find(y=>y==null?void 0:y.texture);b!=null&&b.texture&&(b.texture=p)}}}catch(l){console.warn("[LIVE-EDIT] Failed to reload Pixi texture for",i,l)}};window.applyLiveEditOverrides=i=>{try{let n=de();Array.isArray(n)&&n.length&&(window.__editableConfig=i,bt(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=i=>{try{let n=de();Array.isArray(n)&&n.length&&(window.__editableConfig=i,bt(n,{silent:!0,persist:!1}))}catch{}},window.applyEditableEngineConfig=i=>{let n=window.__editableConfig;if(!(n!=null&&n.engine))return;let r=[];if(i.runtime)for(let[a,s]of Object.entries(i.runtime))r.push({path:`runtime.${a}`,value:s});if(i.assets)for(let[a,s]of Object.entries(i.assets))r.push({path:`assets.${a}`,value:s}),typeof s=="string"&&t(a,s);if(i.splash)for(let[a,s]of Object.entries(i.splash))r.push({path:`splash.${a}`,value:s});if(i.loading)for(let[a,s]of Object.entries(i.loading))r.push({path:`loading.${a}`,value:s});if(i.start)for(let[a,s]of Object.entries(i.start))r.push({path:`start.${a}`,value:s});r.length&&bt(r,{silent:!0,persist:!0,emitEvent:!0})}}function is(e){let{getConfig:t,gameObjectManager:i,onObjectConfigApplied:n}=e;i&&(i.onObjectRebuildRequired=async(a,s)=>{console.log(`[LIVE-EDIT] \u{1F3D7}\uFE0F Rebuilding object ${a} due to type change...`);let o=i.get(a),l=o==null?void 0:o.pixiObject,c=l==null?void 0:l.parent,d=c==null?void 0:c.children.indexOf(l);o?i.remove(a):l&&l.destroy();let u=window.gameApp,p=await gt.create(a,s,u);c&&(d!==void 0&&d!==-1?c.addChildAt(p,d):c.addChild(p));let f=i.create(a,p);return console.log(`[LIVE-EDIT] \u2705 Rebuild complete for ${a}`),f}),typeof window!="undefined"&&(Uw(),window.applyEditableObjectConfig=(a,s)=>{var o,l,c;console.log("[LIVE-EDIT] \u{1F504} applyEditableObjectConfig called for:",a);try{let d=window.__editableConfig;(o=d==null?void 0:d.objects)!=null&&o.set&&(d.objects.set(a,s),console.log("[LIVE-EDIT] \u2705 Updated config in __editableConfig"));let u=(l=i==null?void 0:i.get)==null?void 0:l.call(i,a);if(console.log("[LIVE-EDIT] gameObject found?",!!u),u&&(console.log("[LIVE-EDIT] gameObject type:",(c=u.constructor)==null?void 0:c.name),console.log("[LIVE-EDIT] has updateConfig?",typeof u.updateConfig=="function"),console.log("[LIVE-EDIT] has onConfigUpdate?",typeof u.onConfigUpdate=="function")),u&&typeof u.updateConfig=="function")console.log("[LIVE-EDIT] \u2705 Calling updateConfig()"),u.updateConfig(s);else if(u&&typeof u.onConfigUpdate=="function")console.log("[LIVE-EDIT] \u2705 Calling onConfigUpdate()"),u.onConfigUpdate();else{console.log("[LIVE-EDIT] \u26A0\uFE0F No updateConfig or onConfigUpdate, applying transform directly");let p=Cg(u);Tg(p,s)}}catch(d){console.error("[LIVE-EDIT] \u274C Error in applyEditableObjectConfig:",d)}});let r={async applyObjectConfig(a,s){var d,u;console.log("[BRIDGE] \u{1F504} applyObjectConfig called for:",a);let o=t();(d=o==null?void 0:o.objects)!=null&&d.set&&(o.objects.set(a,s),console.log("[BRIDGE] \u2705 Updated config"));let l=(u=i==null?void 0:i.get)==null?void 0:u.call(i,a);if(console.log("[BRIDGE] gameObject found?",!!l),l&&(console.log("[BRIDGE] has updateConfig?",typeof l.updateConfig=="function"),console.log("[BRIDGE] has onConfigUpdate?",typeof l.onConfigUpdate=="function")),l&&typeof l.updateConfig=="function")console.log("[BRIDGE] \u2705 Calling updateConfig()"),l.updateConfig(s);else if(l&&typeof l.onConfigUpdate=="function")console.log("[BRIDGE] \u2705 Calling onConfigUpdate()"),l.onConfigUpdate();else{console.log("[BRIDGE] \u26A0\uFE0F Applying transform directly");let p=Cg(l);Tg(p,s)}let c=[a];n==null||n(a,s,c)},rebuildIndexes(){let a=t();typeof window!="undefined"&&(window.__editableConfig=a,kg(a))}};return r.rebuildIndexes(),r}Te();var Ig=li(require("lottie-web"),1);xs(ys);typeof window!="undefined"&&!window.lottie&&(window.lottie=Ig.default);var Gi=null,qw=async()=>{if(!Gi){let e=typeof window!="undefined"?window.INLINE_ASSETS:null,t=(e==null?void 0:e["handler.config"])||(e==null?void 0:e["handler.config.json"]);if(t)try{if(t.startsWith("data:")){let n=atob(t.split(",")[1]);Gi=JSON.parse(n)}else Gi=JSON.parse(t);return Gi}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}Gi=await(await fetch("./handler.config.json")).json()}return Gi},bc,nr,Mg,Wi,gc,mc;function Gw(e){bc=e.initGame,nr=e.CustomAssets,Mg=e.updateScreenState,Wi=e.globalResponsiveMultipliers,gc=e.layout,mc=e.clearResponsiveElements}var ns="web_embed",ir="https://example.com",Lg={profile_id:ns},Mt=null,Ge=null,hc={width:0,height:0},Ww=!0,Yw=async()=>{var c,d,u,p;document.title="Handler Pixi Game";let e=await qw();Lg={...e.ids||{},profile_id:ns},ir=e.destination_url||((d=(c=e.export_profiles)==null?void 0:c[ns])==null?void 0:d.destination_url)||ir,jt.init({ids:Lg,profile:ns,destinationUrl:ir});let t=jt.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),Ge=pc({onDeviceChange:m=>{console.log(`[PREVIEW] Device switched to ${m.width}x${m.height}, restarting game...`),Og()},onRefresh:Og});let f=Ge.getGameContainer();f&&(t=f),window.addEventListener("handler-preview:screen",m=>{var v,x,w,S,A,_,T,M,E,L,z;let h=window.gameApp,g=window.gameObjectManager,{width:b,height:y}=m.detail;if(hc.width=b,hc.height=y,Mg(b,y),!(!h||!h.renderer)){g&&o(h,g);try{h.renderer.resize(b,y);let D=h.view;D&&(D.style.width="100%",D.style.height="100%",D.style.display="block")}catch(D){console.warn("[SCREEN] Error resizing renderer:",D);return}if(i&&g&&gc)try{let D=(v=window.__mainContainer)!=null?v:h.stage,B=(T=(_=(S=window.__tutorialLabel)!=null?S:(w=(x=g.get("label_1"))==null?void 0:x.getDisplayObject)==null?void 0:w.call(x))!=null?_:(A=g.get("label_1"))==null?void 0:A.pixiObject)!=null?T:g.get("label_1"),O=g.get("background_1"),P=(z=(L=(E=window.__background)!=null?E:(M=O==null?void 0:O.getDisplayObject)==null?void 0:M.call(O))!=null?L:O==null?void 0:O.pixiObject)!=null?z:O;if(D){let C=D===h.stage;gc({mainContainer:D,label:B,background:P,backgroundTexture:(P==null?void 0:P.texture)||null,app:h},i,0,hc,g,{skipMainContainerTransform:C})}}catch(D){console.warn("[SCREEN] Error in layout:",D)}}})}let i=await Qe("scene.main");window.__editableConfig=i,s(),window.__editableConfigBaseline||(window.__editableConfigBaseline=ne(i),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(p=(u=i.engine.runtime)==null?void 0:u.layout)!=null&&p.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(f=>setTimeout(f,100)),i=await Qe("scene.main"));let n=await bc(t,i,ir,Ge);Mt=n.app;let r=n.gameObjectManager;window.gameApp=Mt,window.gameObjectManager=r;try{window.__liveEditBridge=is({getConfig:()=>window.__editableConfig,gameObjectManager:r,assets:nr})}catch(f){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",f)}Ge&&Ge.notifyGameLoaded();let a=window.__debugScale;a&&typeof a=="number"&&(Wi.scale=a,console.log(`[DEBUG] Applied persisted debug scale: ${a}`)),o(Mt,r);async function s(){try{let f=async y=>{let v=y.startsWith("/")?y:`/${y}`,x=await fetch(v,{cache:"no-cache"});if(!x.ok)return null;let w=await x.text();try{return JSON.parse(w)}catch{return null}},m=await f("configs/flow/app.flow.json");if(!m||typeof m!="object")return;let h=m.screens;if(!h||typeof h!="object")return;let g={},b={};for(let[y,v]of Object.entries(h)){let x=v==null?void 0:v.source;if(typeof x!="string")continue;let w=await f(x),S=w==null?void 0:w.elements;if(!Array.isArray(S))continue;let A=S.map(_=>_==null?void 0:_.instance_id).filter(_=>typeof _=="string");g[y]=A;for(let _ of A)b[_]||(b[_]=y)}window.__HANDLER_APP_FLOW=m,window.__HANDLER_SCREEN_INDEX={screenToInstances:g,instanceToScreen:b},window.dispatchEvent(new CustomEvent("handler:screen-index-loaded"))}catch{}}function o(f,m){if(Ww){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${Wi.scale.toFixed(3)}`),f.stage){let g=function(b,y=0){if(!b||!b.children)return;let v=" ".repeat(y);b.children.forEach((x,w)=>{if(x&&x.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(x&&x.scale){let S=x.scale.x||1,A=x.scale.y||1;x.__originalScale||(x.__originalScale={x:S,y:A},console.log(`${v}[RESPONSIVE] Stored original scale for child[${w}]: ${S.toFixed(3)}, ${A.toFixed(3)}`));let _=x.__originalScale.x*Wi.scale,T=x.__originalScale.y*Wi.scale;typeof x.scale.set=="function"?x.scale.set(_,T):(x.scale.x=_,x.scale.y=T),console.log(`${v}[RESPONSIVE] Child[${w}] scale: ${S.toFixed(3)}\u2192${x.scale.x.toFixed(3)} (type: ${x.constructor.name})`),g(x,y+1)}else x&&console.log(`${v}[RESPONSIVE] Child[${w}] has no scale (type: ${x.constructor.name})`)})};var h=g;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),g(f.stage)}else console.warn("[RESPONSIVE] No app.stage found!");console.log("[REDDEBUG] Debug border left unscaled (fixed boundaries)"),console.log("[RESPONSIVE] ===== GLOBAL RESPONSIVE SCALING COMPLETE =====")}function l(f){if(f!==void 0){Wi.scale=f,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${f.toFixed(3)}`);let m=window.gameApp,h=window.gameObjectManager;m&&h?(o(m,h),m.renderer&&(m.renderer.render(m.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!m}) or gameObjectManager (${!!h}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=l,jt.start()},Og=async()=>{var t,i,n,r;console.log("[PREVIEW] Restarting game in 1 seconds...");let e=(t=window.gameObjectManager)==null?void 0:t.get("character_1");if(e){let a=((i=e.getDisplayObject)==null?void 0:i.call(e))||e;a&&a.scale&&console.log(`[CHARACTER] Before restart - Current scale - x: ${((n=a.scale.x)!=null?n:1).toFixed(3)}, y: ${((r=a.scale.y)!=null?r:1).toFixed(3)}`)}if(Ge){Ge.notifyGameDestroyed();try{mc&&mc()}catch(a){console.warn("Failed to clear responsive elements",a)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let a=Ge.getGameContainer(),s=window.gameObjectManager;if(s&&typeof s.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),s.clear()),Mt){try{Mt.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}Mt=null}window.gameApp=null,window.gameObjectManager=null,a&&(a.innerHTML="");try{typeof nr.resetScene=="function"&&nr.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{Qe("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=ne(o)),bc(a,o,ir).then(l=>{Mt=l.app,window.gameApp=Mt,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=is({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:nr})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}Ge&&Ge.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{jt.start()}catch{}})})},100)},1e3)}};jr();Te();var yc=Bc.version,Vw=new Set(["init","boot","view","ready","start","pause","resume","complete","error","engagement","first_interaction","retry","cta_show","cta_click","cta_dismiss","clickout","conversion","session_time","level_time","load_time","level_start","level_complete","level_fail","checkpoint","reward","tutorial_start","tutorial_complete","tutorial_skip","ab_assign","fps","memory","asset_load_start","asset_load_complete"]);Nc();var Bg={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Fg=Math.random().toString(36).slice(2),Ki=null,Yi={...Bg},Hg="web_embed",_c={},ar,vc=!1,rr=!1,or=!1,$g=!1,Cc=1,as=0,ls=!1,ut=!1,Vi="",Xi=Math.floor(window.innerWidth),Zi=Math.floor(window.innerHeight),Ec=Xi>Zi,pt=!1,sr=!1,Rg=!1,Pg=!1,xc=!1,ss=null,ri=null,Sc=!1,Ac=!1,rs=new Map;function Ug(){if(!ri)return null;let e=Date.now()-ri;return!Number.isFinite(e)||e<0?null:e}function wc(e){if(Sc)return;let t=Ug();t!==null&&(Sc=!0,R("session_time",{duration_ms:t,reason:e}))}function jg(){if(Ki)return Ki;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),Ki=e,e}function os(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function qg(e,t){return{event_name:e,ts:Date.now(),session_id:Fg,deployment_id:Yi.deployment_id,variant_id:Yi.variant_id,export_profile_id:Yi.profile_id,instance_id:Yi.instance_id||"default",env:Hg==="mraid"?"mraid":"web",attribution:ar,payload:t}}function R(e,t){let i=os(e),n=qg(i,t);gs(n,!!_c.analytics),fr(i,n),i!==e&&fr(e,n)}function lr(){ss&&(ss(Xi,Zi),ss=null)}function Ji(e){Cc=e,R("volume",e)}function Qi(e){e&&($g=!0),!or&&(or=!0,R("pause"),Ji(0))}function cr(e){!e&&$g||or&&(or=!1,R("resume"),Ji(Cc))}function Rt(e,t){Xi=Math.floor(e||window.innerWidth),Zi=Math.floor(t||window.innerHeight),Ec=Xi>Zi,R("resize",{width:Xi,height:Zi})}function Kw(){if(Zc())try{let e=mraid.getMaxSize();Rt(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?cr():Qi()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let i=mraid.getMaxSize();Rt(i.width,i.height)}),mraid.getAudioVolume){let i=mraid.getAudioVolume();Ji(i?1:0)}if(mraid.addEventListener("audioVolumeChange",i=>{i!==null&&Ji(i>0?1:0)}),mraid.addEventListener("error",(i,n)=>{console.warn("mraid error:",i,"action:",n)}),ls=!0,mraid.isViewable()&&mraid.getState()!=="hidden")pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr();else{let i=()=>{pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr()};mraid.addEventListener("ready",i)}}catch(e){console.warn("MRAID hook skipped",e)}}function Xw(){if(Jc())try{let e=dapi.getScreenSize();Rt(e.width,e.height),dapi.addEventListener("viewableChange",i=>{i.isViewable?cr():Qi()}),dapi.addEventListener("adResized",i=>{let n=dapi.getScreenSize();Rt(i.width||n.width,i.height||n.height)});let t=dapi.getAudioVolume();if(Ji(t?1:0),dapi.addEventListener("audioVolumeChange",i=>Ji(i?1:0)),ls=!0,dapi.isViewable())pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr();else{let i=()=>{pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr()};dapi.addEventListener("ready",i)}}catch(e){console.warn("DAPI hook skipped",e)}}function Dg(){let e=()=>{pt||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr(),sr&&(sr=!1,Re.start()))};window.addEventListener("resize",()=>Rt()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(cr(),e()):Qi()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),ls=!0}function Zw(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(Rg=!0),!(Rg&&t instanceof MouseEvent)&&(as+=1,Ac||(Ac=!0,R("first_interaction",{count:as})),R("interaction",as))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function zg(e){var n,r,a,s,o,l,c,d,u,p,f,m;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(n=window.ExitApi)==null||n.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(ui())(a=(r=window.TJ_API)==null?void 0:r.click)==null||a.call(r);else if(Qc())(o=(s=window.FbPlayableAd)==null?void 0:s.onCTAClick)==null||o.call(s);else if(nd())(c=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||c.call(l);else if(id())try{(u=(d=window.smxTracking)==null?void 0:d.redirect)==null||u.call(d)}catch(h){console.warn("Smadex redirect failed",h)}else if(ed()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(e||Vi||""):e&&window.open(e)}else di()?(p=window.install)==null||p.call(window):td()?(f=window.openAppStore)==null||f.call(window):ms()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):e&&window.open(e)}function Jw(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=i=>{if(!i)return;let n=new Image;n.src=i};if(e==="bigabid"){let i=window.BIGABID_BIDTIMEMACROS;if(!i)return;be("view",()=>t(i.mraid_viewable)),be("start",()=>t(i.game_viewable)),be("engagement",()=>t(i.engagement));let n=()=>t(i.complete);be("complete",n),pr("engagement",r=>{var a;((a=r==null?void 0:r.payload)==null?void 0:a.count)>3&&n()}),be("cta_click",()=>t(i.click))}else if(e==="inmobi"){let i=window.INMOBI_DSPMACROS;if(!i)return;be("view",()=>t(i.Ad_Load_Start)),be("start",()=>t(i.Ad_Viewable)),be("engagement",()=>t(i.First_Engagement)),be("complete",()=>t(i.Gameplay_Complete)),be("cta_click",()=>t(i.DSP_Click)),be("start",()=>{[5,10,15,20,25,30].forEach(n=>setTimeout(()=>t(i[`Spent_${n}_Seconds`]),n*1e3))})}}function Qw(){if(!ui())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Re.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function Ng(){var t,i,n;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(i=e==null?void 0:e.playableFinished)==null||i.call(e),(n=e==null?void 0:e.gameplayFinished)==null||n.call(e)}function e0(){di()&&(window.mintGameStart=()=>{cr(!0),Rt()},window.mintGameClose=()=>{Qi(!0)})}function t0(){if(!bs())return;let e=window.NUC;!e||!e.trigger||(Re.on("cta_click",()=>{var t,i;return(i=(t=e.trigger).convert)==null?void 0:i.call(t,Vi)}),Re.on("complete",()=>{var t,i;return(i=(t=e.trigger).tryAgain)==null?void 0:i.call(t)}))}var Re={init(e={},t){var i;if(Hg=e.profile||"web_embed",_c=e.consent||{},Yi={...Bg,...e.ids||{}},Ki=e.rootEl||Ki,ar=void 0,Ic((i=e.telemetry)!=null&&i.endpoint?e.telemetry:null),ri=null,Sc=!1,Ac=!1,rs.clear(),Vi=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(ss=t),R("init"),document.body.oncontextmenu=()=>!1,jg(),n0(Ki),rd(),Kw(),Xw(),!ls){if(document.readyState==="complete")Dg();else if(!Pg){Pg=!0;let n=()=>{Dg(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Zw(),Jw(),Qw(),e0(),t0(),console.log(`%c @handler/playable-sdk %c v${yc} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),pt&&!ut&&(R("boot"),R("view"),R("ready"),sr&&(sr=!1,Re.start()),ut=!0),ut=pt},getRoot(){return jg()},get version(){return yc},get maxWidth(){return Xi},get maxHeight(){return Zi},get isLandscape(){return Ec},get isReady(){return ut},get isStarted(){return vc},get isPaused(){return or},get isFinished(){return rr},get volume(){return Cc},get interactions(){return as},on(e,t){pr(os(e),t)},off(e,t){hs(os(e),t)},start(){var e,t;if(!vc){if(!pt){sr=!0;return}if(vc=!0,ri||(ri=Date.now()),R("start"),Rt(),di())Qi(),(e=window.gameReady)==null||e.call(window);else if(ui()){let i=window.TJ_API;(t=i==null?void 0:i.setPlayableBuild)==null||t.call(i,{orientation:Ec?"landscape":"portrait",buildID:yc})}}},finish(){var e,t;rr||(rr=!0,R("complete"),wc("complete"),di()?(e=window.gameEnd)==null||e.call(window):ms()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):ui()&&Ng())},install(e){if(!rr){rr=!0,ui()?(Ng(),setTimeout(()=>Re.install(e),300)):(R("complete"),setTimeout(()=>Re.install(e),0));return}xc||(xc=!0,setTimeout(()=>xc=!1,500),R("cta_click"),R("conversion"),wc("cta"),zg(e||Vi))},emit(e,t){let i=os(e);if(!Vw.has(i)&&i!=="resize"&&i!=="volume"&&!i.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let n=qg(i,t);gs(n,!!_c.analytics),fr(i,n)},gameStart(){Re.start()},gameEnd(){Re.finish()},ctaClick(e,t){R("cta_click",{url:e||Vi,manual:!0}),(t==null?void 0:t.open)!==!1&&zg(e||Vi)},ctaShow(e){R("cta_show",e)},ctaDismiss(e){R("cta_dismiss",e)},getGameTimeMs(){return Ug()},endSession(e="manual"){wc(e)},setAttribution(e){ar=e},abTest(e,t){if(!e)throw new Error("abTest requires experimentId");if(!Array.isArray(t)||t.length<2)throw new Error("abTest requires at least 2 variants");let i=Math.abs(i0(`${Fg}:${e}`))%t.length,n=t[i];return ar={...ar||{},experiment_id:e},Yi.variant_id=n,R("ab_assign",{experiment_id:e,variant_id:n}),n},levelStart(e,t){ri||(ri=Date.now()),R("level_start",{level_id:e,...t})},levelComplete(e,t){R("level_complete",{level_id:e,...t})},levelFail(e,t){R("level_fail",{level_id:e,...t})},checkpoint(e,t){R("checkpoint",{checkpoint_id:e,...t})},reward(e,t){R("reward",{reward_id:e,...t})},tutorialStart(e,t){R("tutorial_start",{step_id:e,...t})},tutorialComplete(e,t){R("tutorial_complete",{step_id:e,...t})},tutorialSkip(e,t){R("tutorial_skip",{step_id:e,...t})},timerStart(e){e&&rs.set(e,Date.now())},timerEnd(e,t="custom",i){if(!e)return;let n=rs.get(e);if(!n)return;rs.delete(e);let r=Date.now()-n;if(!(!Number.isFinite(r)||r<0)){if(t==="custom"){R("engagement",{action:"timer",key:e,duration_ms:r,...i});return}R(t,{key:e,duration_ms:r,...i})}},fps(e,t){R("fps",{value:e,...t})},memory(e,t){R("memory",{bytes:e,...t})},assetLoadStart(e,t){R("asset_load_start",{asset_id:e,...t})},assetLoadComplete(e,t){R("asset_load_complete",{asset_id:e,...t})},reportError(e,t,i){R("error",{code:e,message:t,...i})},retry(){var e,t,i;if(di())(e=window.gameRetry)==null||e.call(window);else if(bs()){let n=window.NUC;(i=(t=n==null?void 0:n.trigger)==null?void 0:t.tryAgain)==null||i.call(t)}R("engagement",{action:"retry"})},pause(){Qi(!0)},resume(){cr(!0)},resize(e,t){Rt(e,t)}},jt=Re;function i0(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=Math.imul(t,16777619);return t|0}function n0(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1478
|
+
`,this.setupEventListeners(t),t}setupEventListeners(t){var r,a,s,o,l,c,d;let i=t.querySelector("#device-select");i==null||i.addEventListener("change",u=>{if(this.viewMode==="compare")return;let p=u.target.value;this.setDevice(p)}),Array.from(t.querySelectorAll("[data-view-toggle]")).forEach(u=>{u.addEventListener("click",()=>{let p=u.dataset.viewToggle;p&&this.setViewMode(p)})}),(r=t.querySelector("#rotate-btn"))==null||r.addEventListener("click",()=>this.toggleRotation()),(a=t.querySelector("#zoom-in-btn"))==null||a.addEventListener("click",()=>this.adjustUserZoom(.1)),(s=t.querySelector("#zoom-out-btn"))==null||s.addEventListener("click",()=>this.adjustUserZoom(-.1)),(o=t.querySelector("#refresh-btn"))==null||o.addEventListener("click",()=>this.refresh()),(l=t.querySelector("#console-toggle"))==null||l.addEventListener("click",()=>this.toggleConsole()),(c=t.querySelector("#console-close"))==null||c.addEventListener("click",()=>this.toggleConsole(!1)),(d=t.querySelector("#console-clear"))==null||d.addEventListener("click",()=>this.clearConsole())}applyDeviceFrameStyles(){Object.assign(this.frameDragger.style,{display:"flex",justifyContent:"center",alignItems:"center",transform:"translate(0px, 0px)",touchAction:"none"}),Object.assign(this.frameWrapper.style,{display:"flex",justifyContent:"center",alignItems:"center",transformOrigin:"center center",transition:"transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)",boxShadow:"0 20px 50px rgba(0,0,0,0.5)",borderRadius:"0px",willChange:"transform"}),Object.assign(this.deviceFrame.style,{overflow:"hidden",position:"relative",borderRadius:"0px"}),Object.assign(this.gameContainer.style,{position:"relative",overflow:"hidden",minWidth:"0px",minHeight:"0px"})}setupObserversAndListeners(){this.resizeObserver=new ResizeObserver(()=>{this.resizeListenersDisabled||!this.gameReady||this.scheduleFit()}),this.resizeObserver.observe(this.previewContainer),window.addEventListener("resize",this.onWindowResize,{passive:!0})}scheduleFit(){this.rafFitHandle&&cancelAnimationFrame(this.rafFitHandle),this.rafFitHandle=requestAnimationFrame(()=>{this.rafFitHandle=null,this.fitToScreen()})}applyPresetDimensions(){let t=this.getEffectivePreset(),i=`${t.width}px`,n=`${t.height}px`;this.deviceFrame.style.width=i,this.deviceFrame.style.height=n,this.gameContainer.style.width=i,this.gameContainer.style.height=n,this.gameContainer.style.maxWidth=i,this.gameContainer.style.maxHeight=n,this.gameContainer.style.minWidth=i,this.gameContainer.style.minHeight=n,this.gameContainer.dataset.screenWidth=String(t.width),this.gameContainer.dataset.screenHeight=String(t.height),this.container.style.setProperty("--preview-screen-width",String(t.width)),this.container.style.setProperty("--preview-screen-height",String(t.height))}fitToScreen(t){if(!this.previewContainer)return;let i=this.getEffectivePreset(),n=this.getFitBounds(),r=Math.max(0,n.width),a=Math.max(0,n.height);if(r<=0||a<=0)return;this.applyPresetDimensions(),this.viewMode==="compare"&&this.applyCompareDimensions();let s=r/i.width,o=a/i.height;if(this.autoScale=Math.max(.01,Math.min(s,o)),!this.hasInitialFit){this.hasInitialFit=!0;let l=.6;this.userScaleMultiplier=l/this.autoScale}t!=null&&t.keepVisibleScale&&t.keepVisibleScale>0&&(this.userScaleMultiplier=t.keepVisibleScale/this.autoScale),this.applyTransform(),this.viewMode==="compare"&&this.fitCompareGhosts(),this.emitScreenChange()}applyTransform(){let t=this.autoScale*this.userScaleMultiplier;this.frameWrapper.style.transform=`scale(${t})`;let i=this.container.querySelector("#zoom-label");i&&(i.textContent=`${Math.round(t*100)}%`)}applyFrameDrag(){this.frameDragger.style.transform=`translate(${this.frameDragOffsetX}px, ${this.frameDragOffsetY}px)`}setupFrameDragging(){this.frameDragger.addEventListener("pointerdown",t=>{this.gameContainer.contains(t.target)||t.button===0&&(t.preventDefault(),this.frameDragActive=!0,this.frameDragStartX=t.clientX,this.frameDragStartY=t.clientY,this.frameDragOriginX=this.frameDragOffsetX,this.frameDragOriginY=this.frameDragOffsetY,window.addEventListener("pointermove",this.onFrameDragMove),window.addEventListener("pointerup",this.onFrameDragEnd))})}adjustUserZoom(t){this.userScaleMultiplier=Math.max(.1,Math.min(6,this.userScaleMultiplier+t)),this.applyTransform(),this.emitScreenChange()}toggleRotation(){var i,n;if(this.viewMode==="compare")return;let t=this.autoScale*this.userScaleMultiplier;this.isLandscape=!this.isLandscape,this.applyPresetDimensions(),this.fitToScreen({keepVisibleScale:t}),(n=(i=this.options).onDeviceChange)==null||n.call(i,this.getEffectivePreset()),this.emitScreenChange()}emitScreenChange(){if(!this.gameReady)return;let t=this.getEffectivePreset(),i={width:t.width,height:t.height,dpr:Math.max(1,Math.floor(window.devicePixelRatio||1)),presetId:t.id,isLandscape:this.isLandscape};if(window.dispatchEvent(new CustomEvent("handler-preview:screen",{detail:i})),this.viewMode==="compare"&&this.refreshCompareSnapshots(),this.isInitialized&&this.isMounted&&this.gameReady){let n=window.gameApp;if(!(n!=null&&n.renderer))return;this.ignoreNextWindowResize=!0,window.dispatchEvent(new Event("resize"))}}safeStringify(t){var n;let i=new WeakSet;try{return JSON.stringify(t,(r,a)=>{if(typeof a=="object"&&a!==null){if(i.has(a))return"[Circular]";i.add(a)}return a},2)}catch{try{if(t&&((n=t.constructor)!=null&&n.name))return`[object ${t.constructor.name}]`}catch{}return String(t)}}setupConsoleInterceptor(){let t=console.log.bind(console),i=console.warn.bind(console),n=console.error.bind(console),r=console.info.bind(console),a=(s,...o)=>{let l=o.map(d=>typeof d=="object"?this.safeStringify(d):String(d)).join(" ");this.consoleMessages.push({type:s,message:l,timestamp:new Date}),this.appendConsoleMessage(this.consoleMessages[this.consoleMessages.length-1]);let c=this.container.querySelector("#console-badge");if(c){let d=this.consoleMessages.filter(u=>u.type==="error").length;c.textContent=d>0?`${d}!`:"0",c.classList.toggle("has-errors",d>0)}};console.log=(...s)=>{t(...s),a("log",...s)},console.warn=(...s)=>{i(...s),a("warn",...s)},console.error=(...s)=>{n(...s),a("error",...s)},console.info=(...s)=>{r(...s),a("info",...s)}}appendConsoleMessage(t){let i=this.container.querySelector("#console-messages");if(!i)return;let n=document.createElement("div");n.className=`console-msg type-${t.type}`;let r=t.timestamp.toLocaleTimeString();n.innerHTML=`<span class="time">${this.escapeHtml(r)}</span> <pre>${this.escapeHtml(t.message)}</pre>`,i.appendChild(n),i.scrollTop=i.scrollHeight}escapeHtml(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}toggleConsole(t){var i;this.isConsoleOpen=t!=null?t:!this.isConsoleOpen,(i=this.consolePanel)==null||i.classList.toggle("closed",!this.isConsoleOpen)}clearConsole(){this.consoleMessages=[];let t=this.container.querySelector("#console-messages");t&&(t.innerHTML="");let i=this.container.querySelector("#console-badge");i&&(i.textContent="0")}setupCompareViewports(){Array.from(this.container.querySelectorAll("[data-viewport]")).forEach(i=>{let n=i.dataset.viewport;if(!n)return;let r=this.comparePresets.find(u=>u.id===n);if(!r)return;let a=i.querySelector("[data-compare-slot]"),s=i.querySelector("[data-compare-ghost]"),o=i.querySelector("[data-compare-wrapper]"),l=i.querySelector("[data-compare-frame]"),c=i.querySelector("[data-compare-snapshot]"),d=i.querySelector("[data-compare-focus]");!a||!s||!o||!l||(i.addEventListener("click",u=>{let p=u.target;if(p!=null&&p.closest("[data-compare-focus]")){u.preventDefault(),this.activateCompareViewport(n);return}i.classList.contains("is-active")||this.activateCompareViewport(n)}),this.compareViewports.set(n,{preset:r,root:i,slot:a,ghost:s,wrapper:o,frame:l,canvas:c,focus:d}))})}setViewMode(t){if(this.viewMode===t)return;this.viewMode=t,this.container.classList.toggle("compare-mode",t==="compare"),this.singleStage.classList.toggle("hidden",t!=="single"),this.compareStage.classList.toggle("hidden",t!=="compare");let i=this.container.querySelector("#device-select");i&&(i.disabled=t==="compare");let n=this.container.querySelector("#rotate-btn");if(n&&(n.disabled=t==="compare"),this.updateViewToggleUI(),t==="compare"){this.lastSinglePresetId=this.currentPreset.id,this.activateCompareViewport(this.activeCompareId),this.refreshCompareSnapshots(),this.startCompareSnapshots();return}this.stopCompareSnapshots(),this.singleStage.appendChild(this.frameDragger),this.setDevice(this.lastSinglePresetId,{suppressCallback:!0}),this.fitToScreen()}updateViewToggleUI(){Array.from(this.container.querySelectorAll("[data-view-toggle]")).forEach(i=>{i.classList.toggle("active",i.dataset.viewToggle===this.viewMode)})}activateCompareViewport(t){var a,s;let i=this.compareViewports.get(t);if(!i)return;let n=this.autoScale*this.userScaleMultiplier,r=this.activeCompareId;r&&r!==t&&this.captureCompareSnapshot(r),this.activeCompareId=t,this.currentPreset=i.preset,this.isLandscape=!1,i.slot.appendChild(this.frameDragger),this.frameDragOffsetX=0,this.frameDragOffsetY=0,this.applyFrameDrag(),this.compareViewports.forEach((o,l)=>{o.root.classList.toggle("is-active",l===t),o.ghost.classList.toggle("hidden",l===t),o.focus&&(o.focus.textContent=l===t?"Live":"Focus")}),this.applyPresetDimensions(),this.applyCompareDimensions(),this.fitToScreen({keepVisibleScale:n}),(s=(a=this.options).onDeviceChange)==null||s.call(a,this.getEffectivePreset())}applyCompareDimensions(){this.compareViewports.forEach(t=>{let i=t.preset,n=`${i.width}px`,r=`${i.height}px`;t.frame.style.width=n,t.frame.style.height=r,t.canvas&&(t.canvas.width=i.width,t.canvas.height=i.height)})}fitCompareGhosts(){this.compareViewports.forEach(t=>{let i=t.root.querySelector(".compare-body");if(!i)return;let n=Math.max(0,i.clientWidth-24),r=Math.max(0,i.clientHeight-24);if(n<=0||r<=0)return;let a=n/t.preset.width,s=r/t.preset.height,o=Math.max(.01,Math.min(a,s));t.wrapper.style.transform=`scale(${o})`})}captureCompareSnapshot(t){let i=this.compareViewports.get(t);if(!(i!=null&&i.canvas))return;let n=this.gameContainer.querySelector("canvas");if(!n)return;let r=i.canvas.getContext("2d");if(!r)return;let a=i.canvas.width,s=i.canvas.height,o=Math.min(a/n.width,s/n.height),l=n.width*o,c=n.height*o,d=(a-l)/2,u=(s-c)/2;r.clearRect(0,0,a,s),r.drawImage(n,d,u,l,c)}refreshCompareSnapshots(){this.compareViewports.forEach((t,i)=>{i!==this.activeCompareId&&this.captureCompareSnapshot(i)})}startCompareSnapshots(){this.compareSnapshotTimer||(this.compareSnapshotTimer=window.setInterval(()=>{this.viewMode==="compare"&&this.refreshCompareSnapshots()},500))}stopCompareSnapshots(){this.compareSnapshotTimer&&(window.clearInterval(this.compareSnapshotTimer),this.compareSnapshotTimer=null)}getFitBounds(){if(this.viewMode!=="compare")return{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40};let t=this.compareViewports.get(this.activeCompareId),i=t==null?void 0:t.root.querySelector(".compare-body");return i?{width:i.clientWidth-24,height:i.clientHeight-24}:{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40}}mustQuery(t){let i=this.container.querySelector(t);if(!i)throw new Error(`PreviewShell missing element: ${t}`);return i}};function pc(e={}){let t=new ts(e);return typeof window!="undefined"&&(window.__previewShell=t),t.mount(),t}Te();function fc(e){try{if(e&&typeof e.keys=="function")return Array.from(e.keys())}catch{}return[]}function Cg(e){var t;return e?((t=e.getDisplayObject)==null?void 0:t.call(e))||e.pixiObject||e:null}function $w(e,t){if(!e||!(t!=null&&t.interaction))return;let i=t.interaction,n=i.enabled!==!1&&(i.draggable===!0||i.clickable===!0);e.eventMode=n?"static":"none",e.interactive=n,n&&(e.cursor=i.draggable?"move":"pointer")}function Tg(e,t){var l,c,d,u,p;if(!e||!t)return;let i=t.transform||{};$w(e,t);let n=i.position||{},r=i.offset||{},a=(typeof n.x=="number"?n.x:0)+(typeof r.x=="number"?r.x:0),s=(typeof n.y=="number"?n.y:0)+(typeof r.y=="number"?r.y:0);(l=e.position)!=null&&l.set?e.position.set(a,s):(typeof e.x=="number"&&(e.x=a),typeof e.y=="number"&&(e.y=s)),typeof i.scale=="number"&&((c=e.scale)!=null&&c.set?e.scale.set(i.scale):e.scale&&(e.scale.x=i.scale,e.scale.y=i.scale));let o=(u=i.anchor)!=null?u:(d=t.render)==null?void 0:d.anchor;o&&((p=e.anchor)!=null&&p.set)&&typeof o.x=="number"&&typeof o.y=="number"&&e.anchor.set(o.x,o.y)}function kg(e){if(typeof window=="undefined")return;let t=e==null?void 0:e.objects,i=fc(t),n=a=>{try{let s=window.__HANDLER_ACTIVE_SCREEN;if(!s||s==="all")return a;let o=window.__HANDLER_SCREEN_INDEX,l=o==null?void 0:o.instanceToScreen;return l?a.filter(c=>l[c]===s):a}catch{return a}};window.__editableObjectConfigs=t;let r=new Map;i.forEach(a=>r.set(a,[a])),window.__editableObjectInstances=r,window.refreshEditableConfigIndex=()=>kg(window.__editableConfig),window.getEditableObjectList=()=>{var a;return n(fc((a=window.__editableConfig)==null?void 0:a.objects))},window.getEditableObjectListAll=()=>{var a;return fc((a=window.__editableConfig)==null?void 0:a.objects)},window.getEditableObjectConfig=a=>{var d,u,p,f,m;let s=(f=(p=(u=(d=window.__editableConfig)==null?void 0:d.objects)==null?void 0:u.get)==null?void 0:p.call(u,a))!=null?f:null,o=window.__HANDLER_ACTIVE_SCREEN;if(!o||o==="all")return s;let l=window.__HANDLER_SCREEN_INDEX,c=(m=l==null?void 0:l.instanceToScreen)==null?void 0:m[a];return c&&c===o?s:null},window.getEditableEngineConfig=()=>{let a=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!a),!a)return null;if(a.engine&&a.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let s={...a.engine,objects:a.objects,scene:a.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(s.assets||{})),s}return a}}function Uw(){if(typeof window=="undefined")return;let e=i=>{let n=String(i||"").trim();return n?/^(data:|blob:|https?:)/.test(n)||n.startsWith("/")?n:`/${n.replace(/^\.\//,"")}`:""},t=async(i,n)=>{var a,s,o;let r=e(n);if(r)try{let[{Assets:l},{AssetTextures:c}]=await Promise.all([import("pixi.js"),Promise.resolve().then(()=>(pi(),cd))]),d=Date.now(),u=/^(data:|blob:)/.test(r)?r:r+(r.includes("?")?`&t=${d}`:`?t=${d}`),p=await l.load(u);if(!p)return;c[i]=p;let f=window.CustomAssets;(a=f==null?void 0:f[i])!=null&&a.texture&&(f[i].texture=p);let m=window.gameObjectManager,h=(s=m==null?void 0:m.get)==null?void 0:s.call(m,i);if(h){let g=((o=h.getDisplayObject)==null?void 0:o.call(h))||h.pixiObject||h.pixi||h;if(g!=null&&g.texture)g.texture=p;else if(g!=null&&g.children){let b=g.children.find(y=>y==null?void 0:y.texture);b!=null&&b.texture&&(b.texture=p)}}}catch(l){console.warn("[LIVE-EDIT] Failed to reload Pixi texture for",i,l)}};window.applyLiveEditOverrides=i=>{try{let n=de();Array.isArray(n)&&n.length&&(window.__editableConfig=i,bt(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=i=>{try{let n=de();Array.isArray(n)&&n.length&&(window.__editableConfig=i,bt(n,{silent:!0,persist:!1}))}catch{}},window.applyEditableEngineConfig=i=>{let n=window.__editableConfig;if(!(n!=null&&n.engine))return;let r=[];if(i.runtime)for(let[a,s]of Object.entries(i.runtime))r.push({path:`runtime.${a}`,value:s});if(i.assets)for(let[a,s]of Object.entries(i.assets))r.push({path:`assets.${a}`,value:s}),typeof s=="string"&&t(a,s);if(i.splash)for(let[a,s]of Object.entries(i.splash))r.push({path:`splash.${a}`,value:s});if(i.loading)for(let[a,s]of Object.entries(i.loading))r.push({path:`loading.${a}`,value:s});if(i.start)for(let[a,s]of Object.entries(i.start))r.push({path:`start.${a}`,value:s});r.length&&bt(r,{silent:!0,persist:!0,emitEvent:!0})}}function is(e){let{getConfig:t,gameObjectManager:i,onObjectConfigApplied:n}=e;i&&(i.onObjectRebuildRequired=async(a,s)=>{console.log(`[LIVE-EDIT] \u{1F3D7}\uFE0F Rebuilding object ${a} due to type change...`);let o=i.get(a),l=o==null?void 0:o.pixiObject,c=l==null?void 0:l.parent,d=c==null?void 0:c.children.indexOf(l);o?i.remove(a):l&&l.destroy();let u=window.gameApp,p=await gt.create(a,s,u);c&&(d!==void 0&&d!==-1?c.addChildAt(p,d):c.addChild(p));let f=i.create(a,p);return console.log(`[LIVE-EDIT] \u2705 Rebuild complete for ${a}`),f}),typeof window!="undefined"&&(Uw(),window.applyEditableObjectConfig=(a,s)=>{var o,l,c;console.log("[LIVE-EDIT] \u{1F504} applyEditableObjectConfig called for:",a);try{let d=window.__editableConfig;(o=d==null?void 0:d.objects)!=null&&o.set&&(d.objects.set(a,s),console.log("[LIVE-EDIT] \u2705 Updated config in __editableConfig"));let u=(l=i==null?void 0:i.get)==null?void 0:l.call(i,a);if(console.log("[LIVE-EDIT] gameObject found?",!!u),u&&(console.log("[LIVE-EDIT] gameObject type:",(c=u.constructor)==null?void 0:c.name),console.log("[LIVE-EDIT] has updateConfig?",typeof u.updateConfig=="function"),console.log("[LIVE-EDIT] has onConfigUpdate?",typeof u.onConfigUpdate=="function")),u&&typeof u.updateConfig=="function")console.log("[LIVE-EDIT] \u2705 Calling updateConfig()"),u.updateConfig(s);else if(u&&typeof u.onConfigUpdate=="function")console.log("[LIVE-EDIT] \u2705 Calling onConfigUpdate()"),u.onConfigUpdate();else{console.log("[LIVE-EDIT] \u26A0\uFE0F No updateConfig or onConfigUpdate, applying transform directly");let p=Cg(u);Tg(p,s)}}catch(d){console.error("[LIVE-EDIT] \u274C Error in applyEditableObjectConfig:",d)}});let r={async applyObjectConfig(a,s){var d,u;console.log("[BRIDGE] \u{1F504} applyObjectConfig called for:",a);let o=t();(d=o==null?void 0:o.objects)!=null&&d.set&&(o.objects.set(a,s),console.log("[BRIDGE] \u2705 Updated config"));let l=(u=i==null?void 0:i.get)==null?void 0:u.call(i,a);if(console.log("[BRIDGE] gameObject found?",!!l),l&&(console.log("[BRIDGE] has updateConfig?",typeof l.updateConfig=="function"),console.log("[BRIDGE] has onConfigUpdate?",typeof l.onConfigUpdate=="function")),l&&typeof l.updateConfig=="function")console.log("[BRIDGE] \u2705 Calling updateConfig()"),l.updateConfig(s);else if(l&&typeof l.onConfigUpdate=="function")console.log("[BRIDGE] \u2705 Calling onConfigUpdate()"),l.onConfigUpdate();else{console.log("[BRIDGE] \u26A0\uFE0F Applying transform directly");let p=Cg(l);Tg(p,s)}let c=[a];n==null||n(a,s,c)},rebuildIndexes(){let a=t();typeof window!="undefined"&&(window.__editableConfig=a,kg(a))}};return r.rebuildIndexes(),r}Te();var Ig=li(require("lottie-web"),1);xs(ys);typeof window!="undefined"&&!window.lottie&&(window.lottie=Ig.default);var Gi=null,qw=async()=>{if(!Gi){let e=typeof window!="undefined"?window.INLINE_ASSETS:null,t=(e==null?void 0:e["handler.config"])||(e==null?void 0:e["handler.config.json"]);if(t)try{if(t.startsWith("data:")){let n=atob(t.split(",")[1]);Gi=JSON.parse(n)}else Gi=JSON.parse(t);return Gi}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}Gi=await(await fetch("./handler.config.json")).json()}return Gi},bc,nr,Mg,Wi,gc,mc;function Gw(e){bc=e.initGame,nr=e.CustomAssets,Mg=e.updateScreenState,Wi=e.globalResponsiveMultipliers,gc=e.layout,mc=e.clearResponsiveElements}var ns="web_embed",ir="https://example.com",Lg={profile_id:ns},Mt=null,Ge=null,hc={width:0,height:0},Ww=!0,Yw=async()=>{var c,d,u,p;document.title="Handler Pixi Game";let e=await qw();Lg={...e.ids||{},profile_id:ns},ir=e.destination_url||((d=(c=e.export_profiles)==null?void 0:c[ns])==null?void 0:d.destination_url)||ir,jt.init({ids:Lg,profile:ns,destinationUrl:ir});let t=jt.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),Ge=pc({onDeviceChange:m=>{console.log(`[PREVIEW] Device switched to ${m.width}x${m.height}, restarting game...`),Og()},onRefresh:Og});let f=Ge.getGameContainer();f&&(t=f),window.addEventListener("handler-preview:screen",m=>{var v,x,w,E,A,_,T,M,S,L,z;let h=window.gameApp,g=window.gameObjectManager,{width:b,height:y}=m.detail;if(hc.width=b,hc.height=y,Mg(b,y),!(!h||!h.renderer)){g&&o(h,g);try{h.renderer.resize(b,y);let D=h.view;D&&(D.style.width="100%",D.style.height="100%",D.style.display="block")}catch(D){console.warn("[SCREEN] Error resizing renderer:",D);return}if(i&&g&&gc)try{let D=(v=window.__mainContainer)!=null?v:h.stage,B=(T=(_=(E=window.__tutorialLabel)!=null?E:(w=(x=g.get("label_1"))==null?void 0:x.getDisplayObject)==null?void 0:w.call(x))!=null?_:(A=g.get("label_1"))==null?void 0:A.pixiObject)!=null?T:g.get("label_1"),O=g.get("background_1"),P=(z=(L=(S=window.__background)!=null?S:(M=O==null?void 0:O.getDisplayObject)==null?void 0:M.call(O))!=null?L:O==null?void 0:O.pixiObject)!=null?z:O;if(D){let C=D===h.stage;gc({mainContainer:D,label:B,background:P,backgroundTexture:(P==null?void 0:P.texture)||null,app:h},i,0,hc,g,{skipMainContainerTransform:C})}}catch(D){console.warn("[SCREEN] Error in layout:",D)}}})}let i=await Qe("scene.main");window.__editableConfig=i,s(),window.__editableConfigBaseline||(window.__editableConfigBaseline=ne(i),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(p=(u=i.engine.runtime)==null?void 0:u.layout)!=null&&p.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(f=>setTimeout(f,100)),i=await Qe("scene.main"));let n=await bc(t,i,ir,Ge);Mt=n.app;let r=n.gameObjectManager;window.gameApp=Mt,window.gameObjectManager=r;try{window.__liveEditBridge=is({getConfig:()=>window.__editableConfig,gameObjectManager:r,assets:nr})}catch(f){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",f)}Ge&&Ge.notifyGameLoaded();let a=window.__debugScale;a&&typeof a=="number"&&(Wi.scale=a,console.log(`[DEBUG] Applied persisted debug scale: ${a}`)),o(Mt,r);async function s(){try{let f=async y=>{let v=y.startsWith("/")?y:`/${y}`,x=await fetch(v,{cache:"no-cache"});if(!x.ok)return null;let w=await x.text();try{return JSON.parse(w)}catch{return null}},m=await f("configs/flow/app.flow.json");if(!m||typeof m!="object")return;let h=m.screens;if(!h||typeof h!="object")return;let g={},b={};for(let[y,v]of Object.entries(h)){let x=v==null?void 0:v.source;if(typeof x!="string")continue;let w=await f(x),E=w==null?void 0:w.elements;if(!Array.isArray(E))continue;let A=E.map(_=>_==null?void 0:_.instance_id).filter(_=>typeof _=="string");g[y]=A;for(let _ of A)b[_]||(b[_]=y)}window.__HANDLER_APP_FLOW=m,window.__HANDLER_SCREEN_INDEX={screenToInstances:g,instanceToScreen:b},window.dispatchEvent(new CustomEvent("handler:screen-index-loaded"))}catch{}}function o(f,m){if(Ww){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${Wi.scale.toFixed(3)}`),f.stage){let g=function(b,y=0){if(!b||!b.children)return;let v=" ".repeat(y);b.children.forEach((x,w)=>{if(x&&x.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(x&&x.scale){let E=x.scale.x||1,A=x.scale.y||1;x.__originalScale||(x.__originalScale={x:E,y:A},console.log(`${v}[RESPONSIVE] Stored original scale for child[${w}]: ${E.toFixed(3)}, ${A.toFixed(3)}`));let _=x.__originalScale.x*Wi.scale,T=x.__originalScale.y*Wi.scale;typeof x.scale.set=="function"?x.scale.set(_,T):(x.scale.x=_,x.scale.y=T),console.log(`${v}[RESPONSIVE] Child[${w}] scale: ${E.toFixed(3)}\u2192${x.scale.x.toFixed(3)} (type: ${x.constructor.name})`),g(x,y+1)}else x&&console.log(`${v}[RESPONSIVE] Child[${w}] has no scale (type: ${x.constructor.name})`)})};var h=g;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),g(f.stage)}else console.warn("[RESPONSIVE] No app.stage found!");console.log("[REDDEBUG] Debug border left unscaled (fixed boundaries)"),console.log("[RESPONSIVE] ===== GLOBAL RESPONSIVE SCALING COMPLETE =====")}function l(f){if(f!==void 0){Wi.scale=f,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${f.toFixed(3)}`);let m=window.gameApp,h=window.gameObjectManager;m&&h?(o(m,h),m.renderer&&(m.renderer.render(m.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!m}) or gameObjectManager (${!!h}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=l,jt.start()},Og=async()=>{var t,i,n,r;console.log("[PREVIEW] Restarting game in 1 seconds...");let e=(t=window.gameObjectManager)==null?void 0:t.get("character_1");if(e){let a=((i=e.getDisplayObject)==null?void 0:i.call(e))||e;a&&a.scale&&console.log(`[CHARACTER] Before restart - Current scale - x: ${((n=a.scale.x)!=null?n:1).toFixed(3)}, y: ${((r=a.scale.y)!=null?r:1).toFixed(3)}`)}if(Ge){Ge.notifyGameDestroyed();try{mc&&mc()}catch(a){console.warn("Failed to clear responsive elements",a)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let a=Ge.getGameContainer(),s=window.gameObjectManager;if(s&&typeof s.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),s.clear()),Mt){try{Mt.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}Mt=null}window.gameApp=null,window.gameObjectManager=null,a&&(a.innerHTML="");try{typeof nr.resetScene=="function"&&nr.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{Qe("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=ne(o)),bc(a,o,ir).then(l=>{Mt=l.app,window.gameApp=Mt,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=is({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:nr})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}Ge&&Ge.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{jt.start()}catch{}})})},100)},1e3)}};jr();Te();var yc=Bc.version,Vw=new Set(["init","boot","view","ready","start","pause","resume","complete","error","engagement","first_interaction","retry","cta_show","cta_click","cta_dismiss","clickout","conversion","session_time","level_time","load_time","level_start","level_complete","level_fail","checkpoint","reward","tutorial_start","tutorial_complete","tutorial_skip","ab_assign","fps","memory","asset_load_start","asset_load_complete"]);Nc();var Bg={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Fg=Math.random().toString(36).slice(2),Ki=null,Yi={...Bg},Hg="web_embed",_c={},ar,vc=!1,rr=!1,or=!1,$g=!1,Cc=1,as=0,ls=!1,ut=!1,Vi="",Xi=Math.floor(window.innerWidth),Zi=Math.floor(window.innerHeight),Ec=Xi>Zi,pt=!1,sr=!1,Rg=!1,Pg=!1,xc=!1,ss=null,ri=null,Sc=!1,Ac=!1,rs=new Map;function Ug(){if(!ri)return null;let e=Date.now()-ri;return!Number.isFinite(e)||e<0?null:e}function wc(e){if(Sc)return;let t=Ug();t!==null&&(Sc=!0,R("session_time",{duration_ms:t,reason:e}))}function jg(){if(Ki)return Ki;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),Ki=e,e}function os(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function qg(e,t){return{event_name:e,ts:Date.now(),session_id:Fg,deployment_id:Yi.deployment_id,variant_id:Yi.variant_id,export_profile_id:Yi.profile_id,instance_id:Yi.instance_id||"default",env:Hg==="mraid"?"mraid":"web",attribution:ar,payload:t}}function R(e,t){let i=os(e),n=qg(i,t);gs(n,!!_c.analytics),fr(i,n),i!==e&&fr(e,n)}function lr(){ss&&(ss(Xi,Zi),ss=null)}function Ji(e){Cc=e,R("volume",e)}function Qi(e){e&&($g=!0),!or&&(or=!0,R("pause"),Ji(0))}function cr(e){!e&&$g||or&&(or=!1,R("resume"),Ji(Cc))}function Rt(e,t){Xi=Math.floor(e||window.innerWidth),Zi=Math.floor(t||window.innerHeight),Ec=Xi>Zi,R("resize",{width:Xi,height:Zi})}function Kw(){if(Zc())try{let e=mraid.getMaxSize();Rt(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?cr():Qi()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let i=mraid.getMaxSize();Rt(i.width,i.height)}),mraid.getAudioVolume){let i=mraid.getAudioVolume();Ji(i?1:0)}if(mraid.addEventListener("audioVolumeChange",i=>{i!==null&&Ji(i>0?1:0)}),mraid.addEventListener("error",(i,n)=>{console.warn("mraid error:",i,"action:",n)}),ls=!0,mraid.isViewable()&&mraid.getState()!=="hidden")pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr();else{let i=()=>{pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr()};mraid.addEventListener("ready",i)}}catch(e){console.warn("MRAID hook skipped",e)}}function Xw(){if(Jc())try{let e=dapi.getScreenSize();Rt(e.width,e.height),dapi.addEventListener("viewableChange",i=>{i.isViewable?cr():Qi()}),dapi.addEventListener("adResized",i=>{let n=dapi.getScreenSize();Rt(i.width||n.width,i.height||n.height)});let t=dapi.getAudioVolume();if(Ji(t?1:0),dapi.addEventListener("audioVolumeChange",i=>Ji(i?1:0)),ls=!0,dapi.isViewable())pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr();else{let i=()=>{pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr()};dapi.addEventListener("ready",i)}}catch(e){console.warn("DAPI hook skipped",e)}}function Dg(){let e=()=>{pt||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(pt=!0,R("boot"),R("view"),R("ready"),ut=!0,lr(),sr&&(sr=!1,Re.start()))};window.addEventListener("resize",()=>Rt()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(cr(),e()):Qi()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),ls=!0}function Zw(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(Rg=!0),!(Rg&&t instanceof MouseEvent)&&(as+=1,Ac||(Ac=!0,R("first_interaction",{count:as})),R("interaction",as))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function zg(e){var n,r,a,s,o,l,c,d,u,p,f,m;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(n=window.ExitApi)==null||n.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(ui())(a=(r=window.TJ_API)==null?void 0:r.click)==null||a.call(r);else if(Qc())(o=(s=window.FbPlayableAd)==null?void 0:s.onCTAClick)==null||o.call(s);else if(nd())(c=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||c.call(l);else if(id())try{(u=(d=window.smxTracking)==null?void 0:d.redirect)==null||u.call(d)}catch(h){console.warn("Smadex redirect failed",h)}else if(ed()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(e||Vi||""):e&&window.open(e)}else di()?(p=window.install)==null||p.call(window):td()?(f=window.openAppStore)==null||f.call(window):ms()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):e&&window.open(e)}function Jw(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=i=>{if(!i)return;let n=new Image;n.src=i};if(e==="bigabid"){let i=window.BIGABID_BIDTIMEMACROS;if(!i)return;be("view",()=>t(i.mraid_viewable)),be("start",()=>t(i.game_viewable)),be("engagement",()=>t(i.engagement));let n=()=>t(i.complete);be("complete",n),pr("engagement",r=>{var a;((a=r==null?void 0:r.payload)==null?void 0:a.count)>3&&n()}),be("cta_click",()=>t(i.click))}else if(e==="inmobi"){let i=window.INMOBI_DSPMACROS;if(!i)return;be("view",()=>t(i.Ad_Load_Start)),be("start",()=>t(i.Ad_Viewable)),be("engagement",()=>t(i.First_Engagement)),be("complete",()=>t(i.Gameplay_Complete)),be("cta_click",()=>t(i.DSP_Click)),be("start",()=>{[5,10,15,20,25,30].forEach(n=>setTimeout(()=>t(i[`Spent_${n}_Seconds`]),n*1e3))})}}function Qw(){if(!ui())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Re.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function Ng(){var t,i,n;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(i=e==null?void 0:e.playableFinished)==null||i.call(e),(n=e==null?void 0:e.gameplayFinished)==null||n.call(e)}function e0(){di()&&(window.mintGameStart=()=>{cr(!0),Rt()},window.mintGameClose=()=>{Qi(!0)})}function t0(){if(!bs())return;let e=window.NUC;!e||!e.trigger||(Re.on("cta_click",()=>{var t,i;return(i=(t=e.trigger).convert)==null?void 0:i.call(t,Vi)}),Re.on("complete",()=>{var t,i;return(i=(t=e.trigger).tryAgain)==null?void 0:i.call(t)}))}var Re={init(e={},t){var i;if(Hg=e.profile||"web_embed",_c=e.consent||{},Yi={...Bg,...e.ids||{}},Ki=e.rootEl||Ki,ar=void 0,Ic((i=e.telemetry)!=null&&i.endpoint?e.telemetry:null),ri=null,Sc=!1,Ac=!1,rs.clear(),Vi=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(ss=t),R("init"),document.body.oncontextmenu=()=>!1,jg(),n0(Ki),rd(),Kw(),Xw(),!ls){if(document.readyState==="complete")Dg();else if(!Pg){Pg=!0;let n=()=>{Dg(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Zw(),Jw(),Qw(),e0(),t0(),console.log(`%c @handler/playable-sdk %c v${yc} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),pt&&!ut&&(R("boot"),R("view"),R("ready"),sr&&(sr=!1,Re.start()),ut=!0),ut=pt},getRoot(){return jg()},get version(){return yc},get maxWidth(){return Xi},get maxHeight(){return Zi},get isLandscape(){return Ec},get isReady(){return ut},get isStarted(){return vc},get isPaused(){return or},get isFinished(){return rr},get volume(){return Cc},get interactions(){return as},on(e,t){pr(os(e),t)},off(e,t){hs(os(e),t)},start(){var e,t;if(!vc){if(!pt){sr=!0;return}if(vc=!0,ri||(ri=Date.now()),R("start"),Rt(),di())Qi(),(e=window.gameReady)==null||e.call(window);else if(ui()){let i=window.TJ_API;(t=i==null?void 0:i.setPlayableBuild)==null||t.call(i,{orientation:Ec?"landscape":"portrait",buildID:yc})}}},finish(){var e,t;rr||(rr=!0,R("complete"),wc("complete"),di()?(e=window.gameEnd)==null||e.call(window):ms()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):ui()&&Ng())},install(e){if(!rr){rr=!0,ui()?(Ng(),setTimeout(()=>Re.install(e),300)):(R("complete"),setTimeout(()=>Re.install(e),0));return}xc||(xc=!0,setTimeout(()=>xc=!1,500),R("cta_click"),R("conversion"),wc("cta"),zg(e||Vi))},emit(e,t){let i=os(e);if(!Vw.has(i)&&i!=="resize"&&i!=="volume"&&!i.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let n=qg(i,t);gs(n,!!_c.analytics),fr(i,n)},gameStart(){Re.start()},gameEnd(){Re.finish()},ctaClick(e,t){R("cta_click",{url:e||Vi,manual:!0}),(t==null?void 0:t.open)!==!1&&zg(e||Vi)},ctaShow(e){R("cta_show",e)},ctaDismiss(e){R("cta_dismiss",e)},getGameTimeMs(){return Ug()},endSession(e="manual"){wc(e)},setAttribution(e){ar=e},abTest(e,t){if(!e)throw new Error("abTest requires experimentId");if(!Array.isArray(t)||t.length<2)throw new Error("abTest requires at least 2 variants");let i=Math.abs(i0(`${Fg}:${e}`))%t.length,n=t[i];return ar={...ar||{},experiment_id:e},Yi.variant_id=n,R("ab_assign",{experiment_id:e,variant_id:n}),n},levelStart(e,t){ri||(ri=Date.now()),R("level_start",{level_id:e,...t})},levelComplete(e,t){R("level_complete",{level_id:e,...t})},levelFail(e,t){R("level_fail",{level_id:e,...t})},checkpoint(e,t){R("checkpoint",{checkpoint_id:e,...t})},reward(e,t){R("reward",{reward_id:e,...t})},tutorialStart(e,t){R("tutorial_start",{step_id:e,...t})},tutorialComplete(e,t){R("tutorial_complete",{step_id:e,...t})},tutorialSkip(e,t){R("tutorial_skip",{step_id:e,...t})},timerStart(e){e&&rs.set(e,Date.now())},timerEnd(e,t="custom",i){if(!e)return;let n=rs.get(e);if(!n)return;rs.delete(e);let r=Date.now()-n;if(!(!Number.isFinite(r)||r<0)){if(t==="custom"){R("engagement",{action:"timer",key:e,duration_ms:r,...i});return}R(t,{key:e,duration_ms:r,...i})}},fps(e,t){R("fps",{value:e,...t})},memory(e,t){R("memory",{bytes:e,...t})},assetLoadStart(e,t){R("asset_load_start",{asset_id:e,...t})},assetLoadComplete(e,t){R("asset_load_complete",{asset_id:e,...t})},reportError(e,t,i){R("error",{code:e,message:t,...i})},retry(){var e,t,i;if(di())(e=window.gameRetry)==null||e.call(window);else if(bs()){let n=window.NUC;(i=(t=n==null?void 0:n.trigger)==null?void 0:t.tryAgain)==null||i.call(t)}R("engagement",{action:"retry"})},pause(){Qi(!0)},resume(){cr(!0)},resize(e,t){Rt(e,t)}},jt=Re;function i0(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=Math.imul(t,16777619);return t|0}function n0(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1479
1479
|
(function(){
|
|
1480
1480
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
1481
1481
|
function unlock(){
|