handler-playable-sdk 0.3.6 → 0.3.7
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/AssetTextures-NWHSMZNV.js +1 -0
- package/dist/{chunk-JUMSCTWX.js → chunk-BC5GBAMY.js} +2 -2
- package/dist/chunk-J2CL6VOZ.js +1 -0
- package/dist/index.cjs +11 -11
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +6 -6
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +1 -1
- package/dist/three/index.js +1 -1
- package/package.json +5 -5
- package/dist/AssetTextures-AZY5VKWH.js +0 -1
- package/dist/chunk-DEUORFXE.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var Rg=Object.create;var lr=Object.defineProperty;var Mg=Object.getOwnPropertyDescriptor;var jg=Object.getOwnPropertyNames;var Dg=Object.getPrototypeOf,zg=Object.prototype.hasOwnProperty;var Ye=(e,t)=>()=>(e&&(t=e(e=0)),t);var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),rn=(e,t)=>{for(var i in t)lr(e,i,{get:t[i],enumerable:!0})},Ec=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jg(t))!zg.call(e,r)&&r!==i&&lr(e,r,{get:()=>t[r],enumerable:!(n=Mg(t,r))||n.enumerable});return e};var ci=(e,t,i)=>(i=e!=null?Rg(Dg(e)):{},Ec(t||!e||!e.__esModule?lr(i,"default",{value:e,enumerable:!0}):i,e)),Bg=e=>Ec(lr({},"__esModule",{value:!0}),e);var Ve,vs=Ye(()=>{"use strict";Ve=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()}};Ve.store=new Map});function Hg(){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 Ug(){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 qg(){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 Gg(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${W}`),Object.keys(Ke).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Ke)),Ke;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Ke={...window.INLINE_ASSETS},Ke;if(!(W==="publish"&&ze!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Ke;if(!ys){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),ys=(async()=>{try{try{let a=await fetch(t+"?t="+Date.now());if(a.ok){let o=(await a.text()).match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(o){let l=new Function("return "+o[1])();return console.log("[AssetLoader] Loaded INLINE_ASSETS via fetch:",Object.keys(l)),l}}}catch(a){console.warn("[AssetLoader] Fetch loading 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 Ke=await ys,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Ke)),Ke}function xs(e){return e===null||typeof e!="object"||(Object.freeze(e),Object.values(e).forEach(t=>xs(t))),e}function Wg(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),Xe.Texture.from(n)}function ws(e,t){Kc.set(e,t)}var Xe,Yc,Vc,jt,W,ze,gt,Ke,ys,Kc,Dt,pr=Ye(()=>{"use strict";Xe=require("pixi.js");vs();Yc=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Vc=Hg(),jt=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,W=Vc?"publish":Yc,ze=jt==null?void 0:jt.assetsInlined;jt!=null&&jt.buildMode&&(W=jt.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${W}`));gt=qg();gt!=null&>.buildMode&&(W=gt.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${W}`));(gt==null?void 0:gt.assetsInlined)!==void 0&&(ze=gt.assetsInlined);Ug().then(e=>{e!=null&&e.buildMode&&e.buildMode!==W&&(W=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${W}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(ze=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${Yc}, Runtime: ${Vc?"publish":"dev"}, Effective: ${W}`);Ke={},ys=null;Kc=new Map;Dt=class{static async load(t,i,n,r){let a=`${t}:${i.path}`,s=Ve.get(a);if(s!==void 0)return s;console.log(`[AssetLoader] Loading asset: ${t}, type: ${i.type}, Effective mode: ${W}`),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 Gg(),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"),W==="publish"&&ze!==!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=Kc.get(i.type);if(d)try{let u=await d(i.path,l,t,n);return Ve.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=xs(u);break;default:throw new Error(`Unknown asset type: ${i.type}`)}return Ve.set(a,u),u}catch(u){return this.handleFailure(t,i.type,u)}}static async loadImage(t,i){let n=W==="publish",r=n&&ze!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${W}, 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 Xe.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 Xe.Assets.load(i)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await Xe.Assets.load(t)}return await Xe.Assets.load(t)}static async loadJSON(t,i){let n=W==="publish",r=n&&ze!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${W}, 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(W==="dev"){let a=i==="image"?Wg():xs({__placeholder:!0,type:i});return Ve.set(t+":"+((n==null?void 0:n.path)||"missing"),a),a}throw n}};ws("image",async(e,t)=>{let i=W==="publish",n=i&&ze!==!1,r=W==="brand",a=i&&ze===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${W}, 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 Xe.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}"`))),Xe.Assets.load(t||s)});ws("json",async(e,t)=>{let i=W==="publish",n=i&&ze!==!1,r=W==="brand",a=i&&ze===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${W}, 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 Zc={};rn(Zc,{AssetTextures:()=>Be,initAssetTextures:()=>Ss});function Ss(e,t){Xc.init(e,t),typeof window!="undefined"&&(window.__AssetTextures=Be)}var Es,Xc,Be,fi=Ye(()=>{"use strict";pr();Es=class{constructor(){this.textures=new Map;this.readyPromise=null;this.config=null;this.app=null}init(t,i){this.textures.clear(),this.readyPromise=null,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 r;console.log("[AssetTextures] Loading all assets...");let n=[];for(let[a,s]of t.objects.entries()){let o=(r=s.render)==null?void 0:r.asset;if(!o)continue;let l=(async()=>{var c;try{let d=(c=s.identity)==null?void 0:c.id;console.log(`[AssetTextures] Loading ${o.type}: ${a} (${d})`);let u=await Dt.load(a,o,i,d);this.textures.set(a,u),console.log(`[AssetTextures] \u2713 Loaded: ${a}`)}catch(d){console.error(`[AssetTextures] \u2717 Failed to load: ${a}`,d)}})();n.push(l)}await Promise.all(n),console.log("[AssetTextures] All textures loaded:",Array.from(this.textures.keys()))})(),this.readyPromise}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())}},Xc=new Es,Be=new Proxy(Xc,{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 Lr={};rn(Lr,{applyConfigOverride:()=>xe,applyConfigOverrides:()=>Bt,applyConfigsToDisk:()=>Tr,clearConfigOverrides:()=>cn,clearConfigOverridesForObject:()=>ad,configOverrideManager:()=>sd,deepClone:()=>ue,exportConfigsAsJSON:()=>ks,getConfigOverrides:()=>fe,getConfigStateSummary:()=>Cr,getOverrideMode:()=>Er,removeConfigOverride:()=>Ar,resetToApplied:()=>dn,resetToOriginal:()=>kr,setOverrideMode:()=>Sr});function bm(){if(typeof window=="undefined")return"unknown";let e=window;return typeof e.__HANDLER_PROJECT_ID=="string"?e.__HANDLER_PROJECT_ID:"handler-default"}function nd(){return`handler_preview_config_overrides::${bm()}`}function vm(){if(typeof window=="undefined")return[];try{let e=window.localStorage.getItem(nd());if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function _r(e){if(typeof window!="undefined")try{window.localStorage.setItem(nd(),JSON.stringify(e))}catch{}}function Er(){return typeof window=="undefined"?!1:window.__enableConfigOverrides===!0}function Sr(e){if(typeof window!="undefined"){window.__enableConfigOverrides=e;try{window.localStorage.setItem(rd,e?"true":"false")}catch{}}}function xe(e,t={}){var u,p;let{objectId:i,path:n,value:r}=e,{silent:a=!1,persist:s=!0}=t,o=window.__editableConfig;if(!o){console.warn("[CONFIG] applyConfigOverride: No editable config found in window.__editableConfig");return}let l=i?(p=(u=o.objects)==null?void 0:u.get)==null?void 0:p.call(u,i):o.engine;if(!l){console.warn("[CONFIG] applyConfigOverride: Override target not found:",{objectId:i,path:n,hasObjects:!!o.objects});return}console.log("[CONFIG] applyConfigOverride: Target found, applying...",{objectId:i,path:n,value:r});let c=xm(l,n);wr(l,n,r),window.__configChanges=window.__configChanges||[];let d=window.__configChanges;if(d.push({objectId:i,path:n,oldValue:c,newValue:r,ts:Date.now()}),d.length>ym&&d.shift(),s){let f=fe(),m=f.findIndex(h=>h.objectId===i&&h.sceneId===e.sceneId&&h.path===n);m>=0?f[m].value=r:f.push(e),window.__configOverrides=f,_r(f)}a||console.log("[CONFIG] Applied override:",e),typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("config:changed",{detail:e}))}function Bt(e,t={}){e.forEach(i=>xe(i,t))}function cn(){window.__configOverrides=[],window.__configChanges=[],_r([]),console.log("[CONFIG] Cleared all overrides")}function ad(e){let t=fe().filter(n=>n.objectId!==e);window.__configOverrides=t,_r(t);let i=window.__configChanges||[];window.__configChanges=i.filter(n=>n.objectId!==e),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"clear_object",objectId:e}}))}function Ar(e,t){let i=fe().filter(n=>n.objectId!==e||n.path!==t);window.__configOverrides=i,_r(i),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"remove",objectId:e,path:t}}))}function fe(){return typeof window=="undefined"?[]:(window.__configOverrides||(window.__configOverrides=vm()),window.__configOverrides||[])}function wr(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 xm(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function ue(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=>ue(i)));if(ArrayBuffer.isView(e))return e.slice();if(e instanceof Array)return e.map(i=>ue(i));if(e instanceof Map){let i=new Map;return e.forEach((n,r)=>i.set(r,ue(n))),i}let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=ue(e[i]));return t}function ks(){let e=window.__editableConfigBaseline;if(!e){let t=window.__editableConfig;if(!t)throw new Error("Cannot export: no config loaded");return id(t)}return id(e)}function id(e){let t={objects:{},scenes:{},engine:ue(e.engine||{})},i=e.objects;if(i instanceof Map)i.forEach((a,s)=>{t.objects[s]=ue(a)});else if(i&&typeof i=="object")for(let a in i)t.objects[a]=ue(i[a]);let n=e.scenes;if(n instanceof Map)n.forEach((a,s)=>{t.scenes[s]=ue(a)});else if(n&&typeof n=="object")for(let a in n)t.scenes[a]=ue(n[a]);let r=fe();for(let a of r)a.objectId?(t.objects[a.objectId]||(t.objects[a.objectId]={}),wr(t.objects[a.objectId],a.path,a.value)):a.sceneId?(t.scenes[a.sceneId]||(t.scenes[a.sceneId]={}),wr(t.scenes[a.sceneId],a.path,a.value)):wr(t.engine,a.path,a.value);return t}function Cr(){let e=fe(),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 Tr(){let e=ks(),t={};for(let[n,r]of Object.entries(e.objects)){let a=r,s=n;/^(json\.|ui\.|effects\.|engine\.)/.test(s)||(s=`json.${n}`),a&&typeof a=="object"&&(a.identity||(a.identity={}),a.identity.id=s),t[`objects/${s}.json`]=a}e.engine&&(e.engine.runtime&&(t["engine/engine.runtime.json"]=e.engine.runtime),e.engine.assets&&(t["engine/engine.assets.json"]=e.engine.assets),e.engine.splash&&(t["engine/engine.splash.json"]=e.engine.splash),!e.engine.runtime&&!e.engine.assets&&(t["engine/engine.json"]=e.engine));for(let[n,r]of Object.entries(e.scenes)){let a=n.startsWith("scene.")?n:`scene.${n}`;t[`scenes/${a}.json`]=r}let i=await fetch("/api/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:t,assets:{},hadCacheAtApply:fe().length>0})});if(!i.ok){let n=await i.json();throw new Error(`Apply failed: ${n.error||"Unknown error"}`)}cn(),localStorage.setItem("handler_last_applied",Date.now().toString()),console.log("[Config Persistence] \u2705 Applied to disk successfully")}function dn(){cn(),Sr(!1),window.location.reload()}async function kr(){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"}`)}cn(),Sr(!1),window.location.reload()}var rd,ym,sd,ke=Ye(()=>{"use strict";rd="handler_preview_override_mode";if(typeof window!="undefined"){let e=window.localStorage.getItem(rd);window.__enableConfigOverrides=e===null?!0:e==="true"}ym=500;sd={getCurrentConfig(){return window.__editableConfig||null},getChanges(){return window.__configChanges||[]},clearChanges(){window.__configChanges=[]}}});function wm(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 _m(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=wm(s,a);if(o!==null)return o}}return null}async function Nt(e){if(Ls.has(e)&&!Os)return console.log(`[CONFIG] Using cached config for: "${e}"`),Ls.get(e);if(console.log(`[CONFIG] loadConfigFile called with: "${e}", MODE: ${H.toUpperCase()}, CACHE: ${Os?"DISABLED":"ENABLED"}`),H==="publish"){let n=_m(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`),{})}H==="brand"||console.log(`[CONFIG] DEV MODE: Trying nested paths first, then flattened for "${e}"`);let t;H==="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=Os?"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: ${H}):`,a)}return console.warn(`[CONFIG] \u2717 All attempts failed for ${e}; using defaults`),{}})();return Ls.set(e,i),i}async function Or(){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=H==="publish"||H==="brand"?i.split("/").pop()||i:`configs/${i}`,r=await Nt(n);r.component&&(t.set(r.component,r),console.log(`[CONFIG] \u2713 Schema loaded: ${r.component} ${H==="publish"||H==="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 bt(e){console.log(`[CONFIG] Loading object config: ${e}`);let t=H==="publish"||H==="brand"?`${e}.json`:`configs/objects/${e}.json`;return await Nt(t)}async function Ir(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 bt(n);(!r||Object.keys(r).length===0)&&n!==i.instance_id&&(r=await bt(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 bt(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 Pr(){console.log("[CONFIG] Loading engine configs...");let[e,t,i]=await Promise.all([Nt(H==="publish"||H==="brand"?"engine.runtime.json":"configs/engine/engine.runtime.json"),Nt(H==="publish"||H==="brand"?"engine.assets.json":"configs/engine/engine.assets.json"),Nt(H==="publish"||H==="brand"?"engine.splash.json":"configs/engine/engine.splash.json")]);return console.log("[CONFIG] Engine configs loaded:",{runtime:Object.keys(e).length>0?Object.keys(e):"empty",assets:Object.keys(t).length>0?Object.keys(t):"empty",splash:Object.keys(i).length>0?Object.keys(i):"empty"}),{runtime:e,assets:t,splash:i}}async function Is(){return await Nt(H==="publish"||H==="brand"?"game.prompt.json":"configs/engine/game.prompt.json")}async function Rr(e="scene.main"){console.log(`[CONFIG] Loading scene config: ${e}`);let t=H==="publish"||H==="brand"?`${e}.json`:`configs/scenes/${e}.json`;return await Nt(t)}function hi(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 Ft(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 we(e,t,i,n){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(Math.max(e,i),n)}function ld(e,t){if(Array.isArray(e))return{x:we(e[0],t.x,-2e3,2e3),y:we(e[1],t.y,-2e3,2e3)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:we(i,t.x,-2e3,2e3),y:we(n,t.y,-2e3,2e3)}}function Em(e,t){if(Array.isArray(e))return{x:we(e[0],t.x,0,1),y:we(e[1],t.y,0,1)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:we(i,t.x,0,1),y:we(n,t.y,0,1)}}function Sm(e){if(Array.isArray(e))return{x:we(e[0],.5,-10,10),y:we(e[1],.5,-10,10)};if(e&&typeof e=="object"){let{x:t,y:i}=e;return{x:we(t,.5,-10,10),y:we(i,.5,-10,10)}}return typeof e=="string"?e:null}async function et(e="scene.main",t){var l,c,d,u,p,f,m,h;console.log("[CONFIG] ===== Starting Object-Centric Config Load =====");let i=await Or(),n=fe();n.length>0&&console.log(`[CONFIG] Applying ${n.length} active overrides`);let r=await Rr(e);console.log(`[CONFIG] Scene config loaded: ${((l=r.objects)==null?void 0:l.length)||0} objects`);let a=await Pr();console.log("[CONFIG] Loading object configs...");let s=await Ir(r);console.log(`[CONFIG] Loaded ${s.size} object configs:`,Array.from(s.keys()));for(let[g,b]of s.entries()){let v=Ft(b,i),y=hi(v,i);y.valid||console.warn(`Object ${g} validation errors:`,y.errors),(c=v.transform)!=null&&c.position&&(v.transform.position=ld(v.transform.position,{x:0,y:0})),(d=v.transform)!=null&&d.offset&&(v.transform.offset=ld(v.transform.offset,{x:0,y:0})),((u=v.transform)==null?void 0:u.anchor)!==void 0&&(v.transform.anchor=Sm(v.transform.anchor)),((p=v.transform)==null?void 0:p.position_ratio)!==void 0&&v.transform.position_ratio!==null&&(v.transform.position_ratio=Em(v.transform.position_ratio,{x:.5,y:.5})),s.set(g,v)}if(t){if(t.objects)for(let[g,b]of t.objects.entries())s.set(g,b);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=Ft(o,i))),n.length>0&&Er()&&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(a.runtime),assets:Object.keys(a.assets),splash:Object.keys((h=a.splash)!=null?h:{})},scene:r.scene_id||"unknown"}),o}function Ps(e){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,v,y,x,w,S,A,E,k,I,_,T,R,B,M,L,P,F;let t={gameplay:{},ui:{},theme:{},assets:{}};for(let[re,j]of e.objects.entries()){let J=((i=j.identity)==null?void 0:i.id)||re;J.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),(J.includes("gun")||J.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)||{}),J.includes("diamond")&&(t.gameplay.diamond=j),J.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=((v=j.effects)==null?void 0:v.melting_particles)||{},t.gameplay.hard_ice=j.hard_ice||{}),J.includes("water")&&(t.gameplay.water_drops=j),J.includes("crack")&&(t.gameplay.crack=j),J.includes("hand")&&(t.gameplay.hand=((y=j.gameplay)==null?void 0:y.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),J.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=((k=(E=j.gameplay)==null?void 0:E.tuning)==null?void 0:k.danger_pulse)||{},t.gameplay.hazard_height=((_=(I=j.gameplay)==null?void 0:I.tuning)==null?void 0:_.hazard_height)||140)}return t.gameplay.timeline=((T=e.engine.runtime)==null?void 0:T.timeline)||{},t.gameplay.drag_surface=((R=e.engine.runtime)==null?void 0:R.drag_surface)||{},t.gameplay.background=((B=e.engine.runtime)==null?void 0:B.background)||{},t.gameplay.ui_styles=((M=e.engine.runtime)==null?void 0:M.ui_styles)||{},t.gameplay.label_pulse=((L=e.engine.runtime)==null?void 0:L.label_pulse)||{},t.ui=((P=e.engine.runtime)==null?void 0:P.ui)||{},t.theme=((F=e.engine.runtime)==null?void 0:F.theme)||{},t.assets=e.engine.assets||{},t}var od,H,Ls,Os,Rs=Ye(()=>{"use strict";ke();od=null,H="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)od=e,H=e.buildMode,console.log("[CONFIG] Loaded inline build settings:",e,"buildMode:",H);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);od=i,H=i.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",i,"buildMode:",H)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",H)}catch(t){console.log("[CONFIG] Failed to load build-settings.json:",t instanceof Error?t.message:String(t))}}console.log("[CONFIG] Final buildMode:",H);Ls=new Map,Os=H==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});function Ms(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 js(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 un,$t,Ds=Ye(()=>{"use strict";un=class{shouldFullReload(t){return t.type==="component"||t.type==="scene"}getAffectedObjects(t){return t.type==="object"&&t.objectId?[t.objectId]:[]}},$t=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 Bs(e){if(typeof window=="undefined")return;let t=typeof zs!="undefined"&&!!zs.hot,i=window.location.search.includes("hot-reload");if(!(t||i))return;let r=null,a=!1,s=null;if(i){s=new $t;let m=window.__configWatcher;m!=null&&m.stop&&m.stop(),window.__configWatcher=s}let o=new Set,l=m=>{var b,v;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=(v=(b=m.scene)==null?void 0:b.objects)!=null?v:[];for(let y of g)y!=null&&y.object_config&&h.add(`configs/objects/${y.object_config}.json`);for(let y of o)h.has(y)||s.unwatch(y);for(let y of h)o.has(y)||s.watch(y,x=>f(x));o=h},c=new Set,d=!1,u=async m=>{let h=await bt(m),g=Ft(h,e.activeConfig.schemas),b=hi(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 et("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&&zs.hot.on("config-change",()=>{f({type:"hmr"})}),i&&(l(e.activeConfig),console.log(`[GAME] Hot-reload watcher enabled (${o.size} files)`))}var zs,cd=Ye(()=>{"use strict";Ds();Rs();zs={}});var dd={};rn(dd,{ConfigWatcher:()=>$t,DefaultReloadStrategy:()=>un,applyDefaults:()=>Ft,diffConfigs:()=>Ms,loadAllObjectConfigs:()=>Ir,loadComponentSchemas:()=>Or,loadEngineConfig:()=>Pr,loadGamePromptConfig:()=>Is,loadObjectCentricConfig:()=>et,loadObjectConfig:()=>bt,loadSceneConfig:()=>Rr,rehydrateObject:()=>js,setupHotReload:()=>Bs,toLegacyFormat:()=>Ps,validateObjectConfig:()=>hi});var Mr=Ye(()=>{"use strict";Rs();Ds();cd()});var pn=C(($_,Hs)=>{"use strict";typeof process=="undefined"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Hs.exports={nextTick:Tm}:Hs.exports=process;function Tm(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 pd=C((H_,ud)=>{"use strict";var km={}.toString;ud.exports=Array.isArray||function(e){return km.call(e)=="[object Array]"}});var Us=C((U_,fd)=>{"use strict";fd.exports=require("stream")});var fn=C((qs,gd)=>{"use strict";var Xr=require("buffer"),tt=Xr.Buffer;function hd(e,t){for(var i in e)t[i]=e[i]}tt.from&&tt.alloc&&tt.allocUnsafe&&tt.allocUnsafeSlow?gd.exports=Xr:(hd(Xr,qs),qs.Buffer=mi);function mi(e,t,i){return tt(e,t,i)}hd(tt,mi);mi.from=function(e,t,i){if(typeof e=="number")throw new TypeError("Argument must not be a number");return tt(e,t,i)};mi.alloc=function(e,t,i){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=tt(e);return t!==void 0?typeof i=="string"?n.fill(t,i):n.fill(t):n.fill(0),n};mi.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return tt(e)};mi.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Xr.SlowBuffer(e)}});var bi=C(se=>{"use strict";function Lm(e){return Array.isArray?Array.isArray(e):Zr(e)==="[object Array]"}se.isArray=Lm;function Om(e){return typeof e=="boolean"}se.isBoolean=Om;function Im(e){return e===null}se.isNull=Im;function Pm(e){return e==null}se.isNullOrUndefined=Pm;function Rm(e){return typeof e=="number"}se.isNumber=Rm;function Mm(e){return typeof e=="string"}se.isString=Mm;function jm(e){return typeof e=="symbol"}se.isSymbol=jm;function Dm(e){return e===void 0}se.isUndefined=Dm;function zm(e){return Zr(e)==="[object RegExp]"}se.isRegExp=zm;function Bm(e){return typeof e=="object"&&e!==null}se.isObject=Bm;function Nm(e){return Zr(e)==="[object Date]"}se.isDate=Nm;function Fm(e){return Zr(e)==="[object Error]"||e instanceof Error}se.isError=Fm;function $m(e){return typeof e=="function"}se.isFunction=$m;function Hm(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}se.isPrimitive=Hm;se.isBuffer=require("buffer").Buffer.isBuffer;function Zr(e){return Object.prototype.toString.call(e)}});var md=C((G_,Gs)=>{"use strict";typeof Object.create=="function"?Gs.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Gs.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 vi=C((W_,Ys)=>{"use strict";try{if(Ws=require("util"),typeof Ws.inherits!="function")throw"";Ys.exports=Ws.inherits}catch{Ys.exports=md()}var Ws});var vd=C((Y_,Vs)=>{"use strict";function Um(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var bd=fn().Buffer,hn=require("util");function qm(e,t,i){e.copy(t,i)}Vs.exports=(function(){function e(){Um(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 bd.alloc(0);for(var n=bd.allocUnsafe(i>>>0),r=this.head,a=0;r;)qm(r.data,n,a),a+=r.data.length,r=r.next;return n},e})();hn&&hn.inspect&&hn.inspect.custom&&(Vs.exports.prototype[hn.inspect.custom]=function(){var e=hn.inspect({length:this.length});return this.constructor.name+" "+e})});var Ks=C((V_,yd)=>{"use strict";var Jr=pn();function Gm(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,Jr.nextTick(Qr,this,e)):Jr.nextTick(Qr,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,Jr.nextTick(Qr,i,a)):Jr.nextTick(Qr,i,a):t&&t(a)}),this)}function Wm(){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 Qr(e,t){e.emit("error",t)}yd.exports={destroy:Gm,undestroy:Wm}});var wd=C((K_,xd)=>{"use strict";xd.exports=require("util").deprecate});var Zs=C((X_,Ld)=>{"use strict";var Ut=pn();Ld.exports=X;function Ed(e){var t=this;this.next=null,this.entry=null,this.finish=function(){db(t,e)}}var Ym=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Ut.nextTick,yi;X.WritableState=mn;var Sd=Object.create(bi());Sd.inherits=vi();var Vm={deprecate:wd()},Ad=Us(),ta=fn().Buffer,Km=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Xm(e){return ta.from(e)}function Zm(e){return ta.isBuffer(e)||e instanceof Km}var Cd=Ks();Sd.inherits(X,Ad);function Jm(){}function mn(e,t){yi=yi||qt(),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){ab(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 Ed(this)}mn.prototype.getBuffer=function(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i};(function(){try{Object.defineProperty(mn.prototype,"buffer",{get:Vm.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ea;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ea=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(e){return ea.call(this,e)?!0:this!==X?!1:e&&e._writableState instanceof mn}})):ea=function(e){return e instanceof this};function X(e){if(yi=yi||qt(),!ea.call(X,this)&&!(this instanceof yi))return new X(e);this._writableState=new mn(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)),Ad.call(this)}X.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Qm(e,t){var i=new Error("write after end");e.emit("error",i),Ut.nextTick(t,i)}function eb(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),Ut.nextTick(n,a),r=!1),r}X.prototype.write=function(e,t,i){var n=this._writableState,r=!1,a=!n.objectMode&&Zm(e);return a&&!ta.isBuffer(e)&&(e=Xm(e)),typeof t=="function"&&(i=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof i!="function"&&(i=Jm),n.ended?Qm(this,i):(a||eb(this,n,e,i))&&(n.pendingcb++,r=ib(this,n,a,e,t,i)),r};X.prototype.cork=function(){var e=this._writableState;e.corked++};X.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Td(this,e))};X.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 tb(e,t,i){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=ta.from(t,i)),t}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ib(e,t,i,n,r,a){if(!i){var s=tb(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 Xs(e,t,!1,o,n,r,a);return l}function Xs(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 nb(e,t,i,n,r){--t.pendingcb,i?(Ut.nextTick(r,n),Ut.nextTick(gn,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(r(n),e._writableState.errorEmitted=!0,e.emit("error",n),gn(e,t))}function rb(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function ab(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if(rb(i),t)nb(e,i,n,t,r);else{var a=kd(i);!a&&!i.corked&&!i.bufferProcessing&&i.bufferedRequest&&Td(e,i),n?Ym(_d,e,i,a,r):_d(e,i,a,r)}}function _d(e,t,i,n){i||sb(e,t),t.pendingcb--,n(),gn(e,t)}function sb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Td(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,Xs(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 Ed(t),t.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,c=i.encoding,d=i.callback,u=t.objectMode?1:l.length;if(Xs(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}X.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))};X.prototype._writev=null;X.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||cb(this,n,i)};function kd(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function ob(e,t){e._final(function(i){t.pendingcb--,i&&e.emit("error",i),t.prefinished=!0,e.emit("prefinish"),gn(e,t)})}function lb(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Ut.nextTick(ob,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function gn(e,t){var i=kd(t);return i&&(lb(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),i}function cb(e,t,i){t.ending=!0,gn(e,t),i&&(t.finished?Ut.nextTick(i):e.once("finish",i)),t.ended=!0,e.writable=!1}function db(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(X.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});X.prototype.destroy=Cd.destroy;X.prototype._undestroy=Cd.undestroy;X.prototype._destroy=function(e,t){this.end(),t(e)}});var qt=C((Z_,Rd)=>{"use strict";var Od=pn(),ub=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};Rd.exports=it;var Id=Object.create(bi());Id.inherits=vi();var Pd=eo(),Qs=Zs();Id.inherits(it,Pd);for(Js=ub(Qs.prototype),ia=0;ia<Js.length;ia++)na=Js[ia],it.prototype[na]||(it.prototype[na]=Qs.prototype[na]);var Js,na,ia;function it(e){if(!(this instanceof it))return new it(e);Pd.call(this,e),Qs.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",pb)}Object.defineProperty(it.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function pb(){this.allowHalfOpen||this._writableState.ended||Od.nextTick(fb,this)}function fb(e){e.end()}Object.defineProperty(it.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)}});it.prototype._destroy=function(e,t){this.push(null),this.end(),Od.nextTick(t,e)}});var no=C(jd=>{"use strict";var io=fn().Buffer,Md=io.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 hb(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 gb(e){var t=hb(e);if(typeof t!="string"&&(io.isEncoding===Md||!Md(e)))throw new Error("Unknown encoding: "+e);return t||e}jd.StringDecoder=bn;function bn(e){this.encoding=gb(e);var t;switch(this.encoding){case"utf16le":this.text=wb,this.end=_b,t=4;break;case"utf8":this.fillLast=vb,t=4;break;case"base64":this.text=Eb,this.end=Sb,t=3;break;default:this.write=Ab,this.end=Cb;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=io.allocUnsafe(t)}bn.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||""};bn.prototype.end=xb;bn.prototype.text=yb;bn.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 to(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function mb(e,t,i){var n=t.length-1;if(n<i)return 0;var r=to(t[n]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--n<i||r===-2?0:(r=to(t[n]),r>=0?(r>0&&(e.lastNeed=r-2),r):--n<i||r===-2?0:(r=to(t[n]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function bb(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 vb(e){var t=this.lastTotal-this.lastNeed,i=bb(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 yb(e,t){var i=mb(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 xb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function wb(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 _b(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 Eb(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 Sb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Ab(e){return e.toString(this.encoding)}function Cb(e){return e&&e.length?this.write(e):""}});var eo=C((e1,Yd)=>{"use strict";var wi=pn();Yd.exports=q;var Tb=pd(),vn;q.ReadableState=Hd;var Q_=require("events").EventEmitter,Nd=function(e,t){return e.listeners(t).length},lo=Us(),yn=fn().Buffer,kb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Lb(e){return yn.from(e)}function Ob(e){return yn.isBuffer(e)||e instanceof kb}var Fd=Object.create(bi());Fd.inherits=vi();var ro=require("util"),N=void 0;ro&&ro.debuglog?N=ro.debuglog("stream"):N=function(){};var Ib=vd(),$d=Ks(),xi;Fd.inherits(q,lo);var ao=["error","close","destroy","pause","resume"];function Pb(e,t,i){if(typeof e.prependListener=="function")return e.prependListener(t,i);!e._events||!e._events[t]?e.on(t,i):Tb(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]}function Hd(e,t){vn=vn||qt(),e=e||{};var i=t instanceof vn;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 Ib,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&&(xi||(xi=no().StringDecoder),this.decoder=new xi(e.encoding),this.encoding=e.encoding)}function q(e){if(vn=vn||qt(),!(this instanceof q))return new q(e);this._readableState=new Hd(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),lo.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=$d.destroy;q.prototype._undestroy=$d.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=yn.from(e,t),t=""),n=!0),Ud(this,e,t,!1,n)};q.prototype.unshift=function(e){return Ud(this,e,null,!0,!1)};function Ud(e,t,i,n,r){var a=e._readableState;if(t===null)a.reading=!1,Db(e,a);else{var s;r||(s=Rb(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==yn.prototype&&(t=Lb(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):so(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?so(e,a,t,!1):qd(e,a)):so(e,a,t,!1))):n||(a.reading=!1)}return Mb(a)}function so(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&&ra(e)),qd(e,t)}function Rb(e,t){var i;return!Ob(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(i=new TypeError("Invalid non-string/buffer chunk")),i}function Mb(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 xi||(xi=no().StringDecoder),this._readableState.decoder=new xi(e),this._readableState.encoding=e,this};var Dd=8388608;function jb(e){return e>=Dd?e=Dd:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function zd(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=jb(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}q.prototype.read=function(e){N("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 N("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?oo(this):ra(this),null;if(e=zd(e,t),e===0&&t.ended)return t.length===0&&oo(this),null;var n=t.needReadable;N("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,N("length less than watermark",n)),t.ended||t.reading?(n=!1,N("reading or ended",n)):n&&(N("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=zd(i,t)));var r;return e>0?r=Gd(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&&oo(this)),r!==null&&this.emit("data",r),r};function Db(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,ra(e)}}function ra(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?wi.nextTick(Bd,e):Bd(e))}function Bd(e){N("emit readable"),e.emit("readable"),co(e)}function qd(e,t){t.readingMore||(t.readingMore=!0,wi.nextTick(zb,e,t))}function zb(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(N("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,N("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?wi.nextTick(a):i.once("end",a),e.on("unpipe",s);function s(b,v){N("onunpipe"),b===i&&v&&v.hasUnpiped===!1&&(v.hasUnpiped=!0,d())}function o(){N("onend"),e.end()}var l=Bb(i);e.on("drain",l);var c=!1;function d(){N("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){N("ondata"),u=!1;var v=e.write(b);v===!1&&!u&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&Wd(n.pipes,e)!==-1)&&!c&&(N("false write response, pause",n.awaitDrain),n.awaitDrain++,u=!0),i.pause())}function f(b){N("onerror",b),g(),e.removeListener("error",f),Nd(e,"error")===0&&e.emit("error",b)}Pb(e,"error",f);function m(){e.removeListener("finish",h),g()}e.once("close",m);function h(){N("onfinish"),e.removeListener("close",m),g()}e.once("finish",h);function g(){N("unpipe"),i.unpipe(e)}return e.emit("pipe",i),n.flowing||(N("pipe resume"),i.resume()),e};function Bb(e){return function(){var t=e._readableState;N("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Nd(e,"data")&&(t.flowing=!0,co(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=Wd(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=lo.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&&ra(this):wi.nextTick(Nb,this))}return i};q.prototype.addListener=q.prototype.on;function Nb(e){N("readable nexttick read 0"),e.read(0)}q.prototype.resume=function(){var e=this._readableState;return e.flowing||(N("resume"),e.flowing=!0,Fb(this,e)),this};function Fb(e,t){t.resumeScheduled||(t.resumeScheduled=!0,wi.nextTick($b,e,t))}function $b(e,t){t.reading||(N("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),co(e),t.flowing&&!t.reading&&e.read(0)}q.prototype.pause=function(){return N("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(N("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function co(e){var t=e._readableState;for(N("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(N("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(N("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<ao.length;a++)e.on(ao[a],this.emit.bind(this,ao[a]));return this._read=function(s){N("wrapped _read",s),n&&(n=!1,e.resume())},this};Object.defineProperty(q.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});q._fromList=Gd;function Gd(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=Hb(e,t.buffer,t.decoder),i}function Hb(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?Ub(e,t):qb(e,t),n}function Ub(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 qb(e,t){var i=yn.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 oo(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,wi.nextTick(Gb,t,e))}function Gb(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Wd(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}});var uo=C((t1,Xd)=>{"use strict";Xd.exports=nt;var aa=qt(),Kd=Object.create(bi());Kd.inherits=vi();Kd.inherits(nt,aa);function Wb(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 nt(e){if(!(this instanceof nt))return new nt(e);aa.call(this,e),this._transformState={afterTransform:Wb.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",Yb)}function Yb(){var e=this;typeof this._flush=="function"?this._flush(function(t,i){Vd(e,t,i)}):Vd(this,null,null)}nt.prototype.push=function(e,t){return this._transformState.needTransform=!1,aa.prototype.push.call(this,e,t)};nt.prototype._transform=function(e,t,i){throw new Error("_transform() is not implemented")};nt.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)}};nt.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};nt.prototype._destroy=function(e,t){var i=this;aa.prototype._destroy.call(this,e,function(n){t(n),i.emit("close")})};function Vd(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 eu=C((i1,Qd)=>{"use strict";Qd.exports=xn;var Zd=uo(),Jd=Object.create(bi());Jd.inherits=vi();Jd.inherits(xn,Zd);function xn(e){if(!(this instanceof xn))return new xn(e);Zd.call(this,e)}xn.prototype._transform=function(e,t,i){i(null,e)}});var po=C((ie,sa)=>{"use strict";var Ne=require("stream");process.env.READABLE_STREAM==="disable"&&Ne?(sa.exports=Ne,ie=sa.exports=Ne.Readable,ie.Readable=Ne.Readable,ie.Writable=Ne.Writable,ie.Duplex=Ne.Duplex,ie.Transform=Ne.Transform,ie.PassThrough=Ne.PassThrough,ie.Stream=Ne):(ie=sa.exports=eo(),ie.Stream=Ne||ie,ie.Readable=ie,ie.Writable=Zs(),ie.Duplex=qt(),ie.Transform=uo(),ie.PassThrough=eu())});var rt=C(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{fo=new ArrayBuffer(0);try{he.blob=new Blob([fo],{type:"application/zip"}).size===0}catch{try{tu=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,ho=new tu,ho.append(fo),he.blob=ho.getBlob("application/zip").size===0}catch{he.blob=!1}}}var fo,tu,ho;try{he.nodestream=!!po().Readable}catch{he.nodestream=!1}});var mo=C(go=>{"use strict";var Vb=Y(),Kb=rt(),Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";go.encode=function(e){for(var t=[],i,n,r,a,s,o,l,c=0,d=e.length,u=d,p=Vb.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(Fe.charAt(a)+Fe.charAt(s)+Fe.charAt(o)+Fe.charAt(l));return t.join("")};go.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)===Fe.charAt(64)&&u--,e.charAt(e.length-2)===Fe.charAt(64)&&u--,u%1!==0)throw new Error("Invalid base64 input, bad content length.");var p;for(Kb.uint8array?p=new Uint8Array(u|0):p=new Array(u|0);l<e.length;)r=Fe.indexOf(e.charAt(l++)),a=Fe.indexOf(e.charAt(l++)),s=Fe.indexOf(e.charAt(l++)),o=Fe.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 wn=C((a1,iu)=>{"use strict";iu.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 su=C((s1,au)=>{"use strict";var nu=global.MutationObserver||global.WebKitMutationObserver,_i;process.browser?nu?(bo=0,ru=new nu(_n),vo=global.document.createTextNode(""),ru.observe(vo,{characterData:!0}),_i=function(){vo.data=bo=++bo%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(yo=new global.MessageChannel,yo.port1.onmessage=_n,_i=function(){yo.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?_i=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){_n(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:_i=function(){setTimeout(_n,0)}:_i=function(){process.nextTick(_n)};var bo,ru,vo,yo,xo,En=[];function _n(){xo=!0;for(var e,t,i=En.length;i;){for(t=En,En=[],e=-1;++e<i;)t[e]();i=En.length}xo=!1}au.exports=Xb;function Xb(e){En.push(e)===1&&!xo&&_i()}});var fu=C((o1,pu)=>{"use strict";var ou=su();function Ei(){}var oe={},lu=["REJECTED"],wo=["FULFILLED"],cu=["PENDING"];process.browser||(Sn=["UNHANDLED"]);var Sn;pu.exports=vt;function vt(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=cu,this.queue=[],this.outcome=void 0,process.browser||(this.handled=Sn),e!==Ei&&du(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===wo||typeof t!="function"&&this.state===lu)return this;var i=new this.constructor(Ei);if(process.browser||this.handled===Sn&&(this.handled=null),this.state!==cu){var n=this.state===wo?e:t;_o(i,n,this.outcome)}else this.queue.push(new An(i,e,t));return i};function An(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)}An.prototype.callFulfilled=function(e){oe.resolve(this.promise,e)};An.prototype.otherCallFulfilled=function(e){_o(this.promise,this.onFulfilled,e)};An.prototype.callRejected=function(e){oe.reject(this.promise,e)};An.prototype.otherCallRejected=function(e){_o(this.promise,this.onRejected,e)};function _o(e,t,i){ou(function(){var n;try{n=t(i)}catch(r){return oe.reject(e,r)}n===e?oe.reject(e,new TypeError("Cannot resolve promise with itself")):oe.resolve(e,n)})}oe.resolve=function(e,t){var i=uu(Zb,t);if(i.status==="error")return oe.reject(e,i.value);var n=i.value;if(n)du(e,n);else{e.state=wo,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};oe.reject=function(e,t){e.state=lu,e.outcome=t,process.browser||e.handled===Sn&&ou(function(){e.handled===Sn&&process.emit("unhandledRejection",t,e)});for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callRejected(t);return e};function Zb(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function du(e,t){var i=!1;function n(o){i||(i=!0,oe.reject(e,o))}function r(o){i||(i=!0,oe.resolve(e,o))}function a(){t(r,n)}var s=uu(a);s.status==="error"&&n(s.value)}function uu(e,t){var i={};try{i.value=e(t),i.status="success"}catch(n){i.status="error",i.value=n}return i}vt.resolve=Jb;function Jb(e){return e instanceof this?e:oe.resolve(new this(Ei),e)}vt.reject=Qb;function Qb(e){var t=new this(Ei);return oe.reject(t,e)}vt.all=ev;function ev(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(Ei);++s<i;)l(e[s],s);return o;function l(c,d){t.resolve(c).then(u,function(p){n||(n=!0,oe.reject(o,p))});function u(p){r[d]=p,++a===i&&!n&&(n=!0,oe.resolve(o,r))}}}vt.race=tv;function tv(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(Ei);++r<i;)s(e[r]);return a;function s(o){t.resolve(o).then(function(l){n||(n=!0,oe.resolve(a,l))},function(l){n||(n=!0,oe.reject(a,l))})}}});var Si=C((l1,hu)=>{"use strict";var Eo=null;typeof Promise!="undefined"?Eo=Promise:Eo=fu();hu.exports={Promise:Eo}});var mu=C(gu=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var i=1,n={},r=!1,a=e.document,s;function o(v){typeof v!="function"&&(v=new Function(""+v));for(var y=new Array(arguments.length-1),x=0;x<y.length;x++)y[x]=arguments[x+1];var w={callback:v,args:y};return n[i]=w,s(i),i++}function l(v){delete n[v]}function c(v){var y=v.callback,x=v.args;switch(x.length){case 0:y();break;case 1:y(x[0]);break;case 2:y(x[0],x[1]);break;case 3:y(x[0],x[1],x[2]);break;default:y.apply(t,x);break}}function d(v){if(r)setTimeout(d,0,v);else{var y=n[v];if(y){r=!0;try{c(y)}finally{l(v),r=!1}}}}function u(){s=function(v){process.nextTick(function(){d(v)})}}function p(){if(e.postMessage&&!e.importScripts){var v=!0,y=e.onmessage;return e.onmessage=function(){v=!1},e.postMessage("","*"),e.onmessage=y,v}}function f(){var v="setImmediate$"+Math.random()+"$",y=function(x){x.source===e&&typeof x.data=="string"&&x.data.indexOf(v)===0&&d(+x.data.slice(v.length))};e.addEventListener?e.addEventListener("message",y,!1):e.attachEvent("onmessage",y),s=function(x){e.postMessage(v+x,"*")}}function m(){var v=new MessageChannel;v.port1.onmessage=function(y){var x=y.data;d(x)},s=function(y){v.port2.postMessage(y)}}function h(){var v=a.documentElement;s=function(y){var x=a.createElement("script");x.onreadystatechange=function(){d(y),x.onreadystatechange=null,v.removeChild(x),x=null},v.appendChild(x)}}function g(){s=function(v){setTimeout(d,0,v)}}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"?gu:global:self)});var Y=C(Z=>{"use strict";var yt=rt(),iv=mo(),Ai=wn(),So=Si();mu();function nv(e){var t=null;return yt.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),la(e,t)}Z.newBlob=function(e,t){Z.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 Cn(e){return e}function la(e,t){for(var i=0;i<e.length;++i)t[i]=e.charCodeAt(i)&255;return t}var oa={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 yt.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return yt.nodebuffer&&String.fromCharCode.apply(null,Ai.allocBuffer(1)).length===1}catch{return!1}})()}};function Tn(e){var t=65536,i=Z.getTypeOf(e),n=!0;if(i==="uint8array"?n=oa.applyCanBeUsed.uint8array:i==="nodebuffer"&&(n=oa.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return oa.stringifyByChunk(e,i,t)}catch{t=Math.floor(t/2)}return oa.stringifyByChar(e)}Z.applyFromCharCode=Tn;function ca(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}var xt={};xt.string={string:Cn,array:function(e){return la(e,new Array(e.length))},arraybuffer:function(e){return xt.string.uint8array(e).buffer},uint8array:function(e){return la(e,new Uint8Array(e.length))},nodebuffer:function(e){return la(e,Ai.allocBuffer(e.length))}};xt.array={string:Tn,array:Cn,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Ai.newBufferFrom(e)}};xt.arraybuffer={string:function(e){return Tn(new Uint8Array(e))},array:function(e){return ca(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:Cn,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Ai.newBufferFrom(new Uint8Array(e))}};xt.uint8array={string:Tn,array:function(e){return ca(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:Cn,nodebuffer:function(e){return Ai.newBufferFrom(e)}};xt.nodebuffer={string:Tn,array:function(e){return ca(e,new Array(e.length))},arraybuffer:function(e){return xt.nodebuffer.uint8array(e).buffer},uint8array:function(e){return ca(e,new Uint8Array(e.length))},nodebuffer:Cn};Z.transformTo=function(e,t){if(t||(t=""),!e)return t;Z.checkSupport(e);var i=Z.getTypeOf(t),n=xt[i][e](t);return n};Z.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("/")};Z.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(yt.nodebuffer&&Ai.isBuffer(e))return"nodebuffer";if(yt.uint8array&&e instanceof Uint8Array)return"uint8array";if(yt.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};Z.checkSupport=function(e){var t=yt[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};Z.MAX_VALUE_16BITS=65535;Z.MAX_VALUE_32BITS=-1;Z.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};Z.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})};Z.inherits=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i};Z.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};Z.prepareContent=function(e,t,i,n,r){var a=So.Promise.resolve(t).then(function(s){var o=yt.blob&&(s instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(s))!==-1);return o&&typeof FileReader!="undefined"?new So.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=Z.getTypeOf(s);return o?(o==="arraybuffer"?s=Z.transformTo("uint8array",s):o==="string"&&(r?s=iv.decode(s):i&&n!==!0&&(s=nv(s))),s):So.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var ge=C((u1,vu)=>{"use strict";function bu(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}bu.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}};vu.exports=bu});var Ti=C(wt=>{"use strict";var Ci=Y(),Gt=rt(),rv=wn(),da=ge(),kn=new Array(256);for(at=0;at<256;at++)kn[at]=at>=252?6:at>=248?5:at>=240?4:at>=224?3:at>=192?2:1;var at;kn[254]=kn[254]=1;var av=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(Gt.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},sv=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+kn[e[i]]>t?i:t},ov=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=kn[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),Ci.applyFromCharCode(s)};wt.utf8encode=function(t){return Gt.nodebuffer?rv.newBufferFrom(t,"utf-8"):av(t)};wt.utf8decode=function(t){return Gt.nodebuffer?Ci.transformTo("nodebuffer",t).toString("utf-8"):(t=Ci.transformTo(Gt.uint8array?"uint8array":"array",t),ov(t))};function ua(){da.call(this,"utf-8 decode"),this.leftOver=null}Ci.inherits(ua,da);ua.prototype.processChunk=function(e){var t=Ci.transformTo(Gt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(Gt.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=sv(t),r=t;n!==t.length&&(Gt.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:wt.utf8decode(r),meta:e.meta})};ua.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:wt.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};wt.Utf8DecodeWorker=ua;function Ao(){da.call(this,"utf-8 encode")}Ci.inherits(Ao,da);Ao.prototype.processChunk=function(e){this.push({data:wt.utf8encode(e.data),meta:e.meta})};wt.Utf8EncodeWorker=Ao});var _u=C((f1,wu)=>{"use strict";var yu=ge(),xu=Y();function Co(e){yu.call(this,"ConvertWorker to "+e),this.destType=e}xu.inherits(Co,yu);Co.prototype.processChunk=function(e){this.push({data:xu.transformTo(this.destType,e.data),meta:e.meta})};wu.exports=Co});var Au=C((h1,Su)=>{"use strict";var Eu=po().Readable,lv=Y();lv.inherits(To,Eu);function To(e,t,i){Eu.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)})}To.prototype._read=function(){this._helper.resume()};Su.exports=To});var ko=C((g1,ku)=>{"use strict";var Wt=Y(),cv=_u(),dv=ge(),uv=mo(),pv=rt(),fv=Si(),Cu=null;if(pv.nodestream)try{Cu=Au()}catch{}function hv(e,t,i){switch(e){case"blob":return Wt.newBlob(Wt.transformTo("arraybuffer",t),i);case"base64":return uv.encode(t);default:return Wt.transformTo(e,t)}}function gv(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 mv(e,t){return new fv.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=hv(s,gv(a,r),o);i(l)}catch(c){n(c)}r=[]}).resume()})}function Tu(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,Wt.checkSupport(n),this._worker=e.pipe(new cv(n)),e.lock()}catch(r){this._worker=new dv("error"),this._worker.error(r)}}Tu.prototype={accumulate:function(e){return mv(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(){Wt.delay(t,arguments,i)}),this},resume:function(){return Wt.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(Wt.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new Cu(this,{objectMode:this._outputType!=="nodebuffer"},e)}};ku.exports=Tu});var Lo=C(Le=>{"use strict";Le.base64=!1;Le.binary=!1;Le.dir=!1;Le.createFolders=!0;Le.date=null;Le.compression=null;Le.compressionOptions=null;Le.comment=null;Le.unixPermissions=null;Le.dosPermissions=null});var Oo=C((b1,Lu)=>{"use strict";var pa=Y(),fa=ge(),bv=16*1024;function ki(e){fa.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=pa.getTypeOf(i),t.isPaused||t._tickAndRepeat()},function(i){t.error(i)})}pa.inherits(ki,fa);ki.prototype.cleanUp=function(){fa.prototype.cleanUp.call(this),this.data=null};ki.prototype.resume=function(){return fa.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,pa.delay(this._tickAndRepeat,[],this)),!0):!1};ki.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(pa.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};ki.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=bv,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}})};Lu.exports=ki});var ha=C((v1,Iu)=>{"use strict";var vv=Y();function yv(){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 Ou=yv();function xv(e,t,i,n){var r=Ou,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 wv(e,t,i,n){var r=Ou,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}Iu.exports=function(t,i){if(typeof t=="undefined"||!t.length)return 0;var n=vv.getTypeOf(t)!=="string";return n?xv(i|0,t,t.length,0):wv(i|0,t,t.length,0)}});var Po=C((y1,Ru)=>{"use strict";var Pu=ge(),_v=ha(),Ev=Y();function Io(){Pu.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Ev.inherits(Io,Pu);Io.prototype.processChunk=function(e){this.streamInfo.crc32=_v(e.data,this.streamInfo.crc32||0),this.push(e)};Ru.exports=Io});var ju=C((x1,Mu)=>{"use strict";var Sv=Y(),Ro=ge();function Mo(e){Ro.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Sv.inherits(Mo,Ro);Mo.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Ro.prototype.processChunk.call(this,e)};Mu.exports=Mo});var ga=C((w1,Bu)=>{"use strict";var Du=Si(),zu=Oo(),Av=Po(),jo=ju();function Do(e,t,i,n,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=n,this.compressedContent=r}Do.prototype={getContentWorker:function(){var e=new zu(Du.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new jo("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 zu(Du.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Do.createWorkerFrom=function(e,t,i){return e.pipe(new Av).pipe(new jo("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new jo("compressedSize")).withStreamInfo("compression",t)};Bu.exports=Do});var Hu=C((_1,$u)=>{"use strict";var Cv=ko(),Tv=Oo(),zo=Ti(),Bo=ga(),Nu=ge(),No=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}};No.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 zo.Utf8EncodeWorker)),!r&&n&&(t=t.pipe(new zo.Utf8DecodeWorker))}catch(a){t=new Nu("error"),t.error(a)}return new Cv(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 Bo&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new zo.Utf8EncodeWorker)),Bo.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof Bo?this._data.getContentWorker():this._data instanceof Nu?this._data:new Tv(this._data)}};var Fu=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],kv=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(ma=0;ma<Fu.length;ma++)No.prototype[Fu[ma]]=kv;var ma;$u.exports=No});var st=C(ce=>{"use strict";var Lv=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function Ov(e,t){return Object.prototype.hasOwnProperty.call(e,t)}ce.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)Ov(i,n)&&(e[n]=i[n])}}return e};ce.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Iv={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}},Pv={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)}};ce.setTyped=function(e){e?(ce.Buf8=Uint8Array,ce.Buf16=Uint16Array,ce.Buf32=Int32Array,ce.assign(ce,Iv)):(ce.Buf8=Array,ce.Buf16=Array,ce.Buf32=Array,ce.assign(ce,Pv))};ce.setTyped(Lv)});var up=C(Ii=>{"use strict";var Rv=st(),Mv=4,Uu=0,qu=1,jv=2;function Oi(e){for(var t=e.length;--t>=0;)e[t]=0}var Dv=0,Xu=1,zv=2,Bv=3,Nv=258,Wo=29,Mn=256,On=Mn+1+Wo,Li=30,Yo=19,Zu=2*On+1,Yt=15,Fo=16,Fv=7,Vo=256,Ju=16,Qu=17,ep=18,qo=[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],ba=[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],$v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],tp=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Hv=512,ot=new Array((On+2)*2);Oi(ot);var Ln=new Array(Li*2);Oi(Ln);var In=new Array(Hv);Oi(In);var Pn=new Array(Nv-Bv+1);Oi(Pn);var Ko=new Array(Wo);Oi(Ko);var va=new Array(Li);Oi(va);function $o(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 ip,np,rp;function Ho(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function ap(e){return e<256?In[e]:In[256+(e>>>7)]}function Rn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function pe(e,t,i){e.bi_valid>Fo-i?(e.bi_buf|=t<<e.bi_valid&65535,Rn(e,e.bi_buf),e.bi_buf=t>>Fo-e.bi_valid,e.bi_valid+=i-Fo):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function $e(e,t,i){pe(e,i[t*2],i[t*2+1])}function sp(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function Uv(e){e.bi_valid===16?(Rn(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 qv(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<=Yt;p++)e.bl_count[p]=0;for(i[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<Zu;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 op(e,t,i){var n=new Array(Yt+1),r=0,a,s;for(a=1;a<=Yt;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]=sp(n[o]++,o))}}function Gv(){var e,t,i,n,r,a=new Array(Yt+1);for(i=0,n=0;n<Wo-1;n++)for(Ko[n]=i,e=0;e<1<<qo[n];e++)Pn[i++]=n;for(Pn[i-1]=n,r=0,n=0;n<16;n++)for(va[n]=r,e=0;e<1<<ba[n];e++)In[r++]=n;for(r>>=7;n<Li;n++)for(va[n]=r<<7,e=0;e<1<<ba[n]-7;e++)In[256+r++]=n;for(t=0;t<=Yt;t++)a[t]=0;for(e=0;e<=143;)ot[e*2+1]=8,e++,a[8]++;for(;e<=255;)ot[e*2+1]=9,e++,a[9]++;for(;e<=279;)ot[e*2+1]=7,e++,a[7]++;for(;e<=287;)ot[e*2+1]=8,e++,a[8]++;for(op(ot,On+1,a),e=0;e<Li;e++)Ln[e*2+1]=5,Ln[e*2]=sp(e,5);ip=new $o(ot,qo,Mn+1,On,Yt),np=new $o(Ln,ba,0,Li,Yt),rp=new $o(new Array(0),$v,0,Yo,Fv)}function lp(e){var t;for(t=0;t<On;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Li;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Yo;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Vo*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function cp(e){e.bi_valid>8?Rn(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 Wv(e,t,i,n){cp(e),n&&(Rn(e,i),Rn(e,~i)),Rv.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function Gu(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 Uo(e,t,i){for(var n=e.heap[i],r=i<<1;r<=e.heap_len&&(r<e.heap_len&&Gu(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Gu(t,n,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r<<=1;e.heap[i]=n}function Wu(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?$e(e,r,t):(s=Pn[r],$e(e,s+Mn+1,t),o=qo[s],o!==0&&(r-=Ko[s],pe(e,r,o)),n--,s=ap(n),$e(e,s,i),o=ba[s],o!==0&&(n-=va[s],pe(e,n,o)));while(a<e.last_lit);$e(e,Vo,t)}function Go(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=Zu,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--)Uo(e,i,s);c=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Uo(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++,Uo(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],qv(e,t),op(i,l,e.bl_count)}function Yu(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[Ju*2]++):o<=10?e.bl_tree[Qu*2]++:e.bl_tree[ep*2]++,o=0,r=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))}function Vu(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 $e(e,a,e.bl_tree);while(--o!==0);else a!==0?(a!==r&&($e(e,a,e.bl_tree),o--),$e(e,Ju,e.bl_tree),pe(e,o-3,2)):o<=10?($e(e,Qu,e.bl_tree),pe(e,o-3,3)):($e(e,ep,e.bl_tree),pe(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 Yv(e){var t;for(Yu(e,e.dyn_ltree,e.l_desc.max_code),Yu(e,e.dyn_dtree,e.d_desc.max_code),Go(e,e.bl_desc),t=Yo-1;t>=3&&e.bl_tree[tp[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Vv(e,t,i,n){var r;for(pe(e,t-257,5),pe(e,i-1,5),pe(e,n-4,4),r=0;r<n;r++)pe(e,e.bl_tree[tp[r]*2+1],3);Vu(e,e.dyn_ltree,t-1),Vu(e,e.dyn_dtree,i-1)}function Kv(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return Uu;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return qu;for(i=32;i<Mn;i++)if(e.dyn_ltree[i*2]!==0)return qu;return Uu}var Ku=!1;function Xv(e){Ku||(Gv(),Ku=!0),e.l_desc=new Ho(e.dyn_ltree,ip),e.d_desc=new Ho(e.dyn_dtree,np),e.bl_desc=new Ho(e.bl_tree,rp),e.bi_buf=0,e.bi_valid=0,lp(e)}function dp(e,t,i,n){pe(e,(Dv<<1)+(n?1:0),3),Wv(e,t,i,!0)}function Zv(e){pe(e,Xu<<1,3),$e(e,Vo,ot),Uv(e)}function Jv(e,t,i,n){var r,a,s=0;e.level>0?(e.strm.data_type===jv&&(e.strm.data_type=Kv(e)),Go(e,e.l_desc),Go(e,e.d_desc),s=Yv(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?dp(e,t,i,n):e.strategy===Mv||a===r?(pe(e,(Xu<<1)+(n?1:0),3),Wu(e,ot,Ln)):(pe(e,(zv<<1)+(n?1:0),3),Vv(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Wu(e,e.dyn_ltree,e.dyn_dtree)),lp(e),n&&cp(e)}function Qv(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[(Pn[i]+Mn+1)*2]++,e.dyn_dtree[ap(t)*2]++),e.last_lit===e.lit_bufsize-1}Ii._tr_init=Xv;Ii._tr_stored_block=dp;Ii._tr_flush_block=Jv;Ii._tr_tally=Qv;Ii._tr_align=Zv});var Xo=C((A1,pp)=>{"use strict";function ey(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}pp.exports=ey});var Zo=C((C1,fp)=>{"use strict";function ty(){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 iy=ty();function ny(e,t,i,n){var r=iy,a=n+i;e^=-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}fp.exports=ny});var ya=C((T1,hp)=>{"use strict";hp.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 Ep=C(qe=>{"use strict";var de=st(),_e=up(),vp=Xo(),_t=Zo(),ry=ya(),Zt=0,ay=1,sy=3,Tt=4,gp=5,Ue=0,mp=1,Ee=-2,oy=-3,Jo=-5,ly=-1,cy=1,xa=2,dy=3,uy=4,py=0,fy=2,Sa=8,hy=9,gy=15,my=8,by=29,vy=256,el=vy+1+by,yy=30,xy=19,wy=2*el+1,_y=15,D=3,At=258,Oe=At+D+1,Ey=32,Aa=42,tl=69,wa=73,_a=91,Ea=103,Vt=113,Dn=666,te=1,zn=2,Kt=3,Mi=4,Sy=3;function Ct(e,t){return e.msg=ry[t],t}function bp(e){return(e<<1)-(e>4?9:0)}function St(e){for(var t=e.length;--t>=0;)e[t]=0}function Et(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(de.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 ne(e,t){_e._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Et(e.strm)}function z(e,t){e.pending_buf[e.pending++]=t}function jn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Ay(e,t,i,n){var r=e.avail_in;return r>n&&(r=n),r===0?0:(e.avail_in-=r,de.arraySet(t,e.input,e.next_in,r,i),e.state.wrap===1?e.adler=vp(e.adler,t,r,i):e.state.wrap===2&&(e.adler=_t(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function yp(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-Oe?e.strstart-(e.w_size-Oe):0,c=e.window,d=e.w_mask,u=e.prev,p=e.strstart+At,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=At-(p-n),n=p-At,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 Xt(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-Oe)){de.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=Ay(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=D)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+D-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<D)););}while(e.lookahead<Oe&&e.strm.avail_in!==0)}function Cy(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Xt(e),e.lookahead===0&&t===Zt)return te;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,ne(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Oe&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=0,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):(e.strstart>e.block_start&&(ne(e,!1),e.strm.avail_out===0),te)}function Qo(e,t){for(var i,n;;){if(e.lookahead<Oe){if(Xt(e),e.lookahead<Oe&&t===Zt)return te;if(e.lookahead===0)break}if(i=0,e.lookahead>=D&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+D-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-Oe&&(e.match_length=yp(e,i)),e.match_length>=D)if(n=_e._tr_tally(e,e.strstart-e.match_start,e.match_length-D),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=D){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+D-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=_e._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=e.strstart<D-1?e.strstart:D-1,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}function Pi(e,t){for(var i,n,r;;){if(e.lookahead<Oe){if(Xt(e),e.lookahead<Oe&&t===Zt)return te;if(e.lookahead===0)break}if(i=0,e.lookahead>=D&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+D-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=D-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Oe&&(e.match_length=yp(e,i),e.match_length<=5&&(e.strategy===cy||e.match_length===D&&e.strstart-e.match_start>4096)&&(e.match_length=D-1)),e.prev_length>=D&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-D,n=_e._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-D),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+D-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=D-1,e.strstart++,n&&(ne(e,!1),e.strm.avail_out===0))return te}else if(e.match_available){if(n=_e._tr_tally(e,0,e.window[e.strstart-1]),n&&ne(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return te}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=_e._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<D-1?e.strstart:D-1,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}function Ty(e,t){for(var i,n,r,a,s=e.window;;){if(e.lookahead<=At){if(Xt(e),e.lookahead<=At&&t===Zt)return te;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=D&&e.strstart>0&&(r=e.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){a=e.strstart+At;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=At-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=D?(i=_e._tr_tally(e,1,e.match_length-D),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=_e._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=0,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}function ky(e,t){for(var i;;){if(e.lookahead===0&&(Xt(e),e.lookahead===0)){if(t===Zt)return te;break}if(e.match_length=0,i=_e._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=0,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}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 Ri;Ri=[new He(0,0,0,0,Cy),new He(4,4,8,4,Qo),new He(4,5,16,8,Qo),new He(4,6,32,32,Qo),new He(4,4,16,16,Pi),new He(8,16,32,32,Pi),new He(8,16,128,128,Pi),new He(8,32,128,256,Pi),new He(32,128,258,1024,Pi),new He(32,258,258,4096,Pi)];function Ly(e){e.window_size=2*e.w_size,St(e.head),e.max_lazy_match=Ri[e.level].max_lazy,e.good_match=Ri[e.level].good_length,e.nice_match=Ri[e.level].nice_length,e.max_chain_length=Ri[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=D-1,e.match_available=0,e.ins_h=0}function Oy(){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=Sa,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 de.Buf16(wy*2),this.dyn_dtree=new de.Buf16((2*yy+1)*2),this.bl_tree=new de.Buf16((2*xy+1)*2),St(this.dyn_ltree),St(this.dyn_dtree),St(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new de.Buf16(_y+1),this.heap=new de.Buf16(2*el+1),St(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new de.Buf16(2*el+1),St(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 xp(e){var t;return!e||!e.state?Ct(e,Ee):(e.total_in=e.total_out=0,e.data_type=fy,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Aa:Vt,e.adler=t.wrap===2?0:1,t.last_flush=Zt,_e._tr_init(t),Ue)}function wp(e){var t=xp(e);return t===Ue&&Ly(e.state),t}function Iy(e,t){return!e||!e.state||e.state.wrap!==2?Ee:(e.state.gzhead=t,Ue)}function _p(e,t,i,n,r,a){if(!e)return Ee;var s=1;if(t===ly&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>hy||i!==Sa||n<8||n>15||t<0||t>9||a<0||a>uy)return Ct(e,Ee);n===8&&(n=9);var o=new Oy;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+D-1)/D),o.window=new de.Buf8(o.w_size*2),o.head=new de.Buf16(o.hash_size),o.prev=new de.Buf16(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new de.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,wp(e)}function Py(e,t){return _p(e,t,Sa,gy,my,py)}function Ry(e,t){var i,n,r,a;if(!e||!e.state||t>gp||t<0)return e?Ct(e,Ee):Ee;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Dn&&t!==Tt)return Ct(e,e.avail_out===0?Jo:Ee);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===Aa)if(n.wrap===2)e.adler=0,z(n,31),z(n,139),z(n,8),n.gzhead?(z(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)),z(n,n.gzhead.time&255),z(n,n.gzhead.time>>8&255),z(n,n.gzhead.time>>16&255),z(n,n.gzhead.time>>24&255),z(n,n.level===9?2:n.strategy>=xa||n.level<2?4:0),z(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(z(n,n.gzhead.extra.length&255),z(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=_t(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=tl):(z(n,0),z(n,0),z(n,0),z(n,0),z(n,0),z(n,n.level===9?2:n.strategy>=xa||n.level<2?4:0),z(n,Sy),n.status=Vt);else{var s=Sa+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=xa||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=Ey),s+=31-s%31,n.status=Vt,jn(n,s),n.strstart!==0&&(jn(n,e.adler>>>16),jn(n,e.adler&65535)),e.adler=1}if(n.status===tl)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=_t(e.adler,n.pending_buf,n.pending-r,r)),Et(e),r=n.pending,n.pending===n.pending_buf_size));)z(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=wa)}else n.status=wa;if(n.status===wa)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),Et(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,z(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.gzindex=0,n.status=_a)}else n.status=_a;if(n.status===_a)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),Et(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,z(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.status=Ea)}else n.status=Ea;if(n.status===Ea&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&Et(e),n.pending+2<=n.pending_buf_size&&(z(n,e.adler&255),z(n,e.adler>>8&255),e.adler=0,n.status=Vt)):n.status=Vt),n.pending!==0){if(Et(e),e.avail_out===0)return n.last_flush=-1,Ue}else if(e.avail_in===0&&bp(t)<=bp(i)&&t!==Tt)return Ct(e,Jo);if(n.status===Dn&&e.avail_in!==0)return Ct(e,Jo);if(e.avail_in!==0||n.lookahead!==0||t!==Zt&&n.status!==Dn){var l=n.strategy===xa?ky(n,t):n.strategy===dy?Ty(n,t):Ri[n.level].func(n,t);if((l===Kt||l===Mi)&&(n.status=Dn),l===te||l===Kt)return e.avail_out===0&&(n.last_flush=-1),Ue;if(l===zn&&(t===ay?_e._tr_align(n):t!==gp&&(_e._tr_stored_block(n,0,0,!1),t===sy&&(St(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Et(e),e.avail_out===0))return n.last_flush=-1,Ue}return t!==Tt?Ue:n.wrap<=0?mp:(n.wrap===2?(z(n,e.adler&255),z(n,e.adler>>8&255),z(n,e.adler>>16&255),z(n,e.adler>>24&255),z(n,e.total_in&255),z(n,e.total_in>>8&255),z(n,e.total_in>>16&255),z(n,e.total_in>>24&255)):(jn(n,e.adler>>>16),jn(n,e.adler&65535)),Et(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ue:mp)}function My(e){var t;return!e||!e.state?Ee:(t=e.state.status,t!==Aa&&t!==tl&&t!==wa&&t!==_a&&t!==Ea&&t!==Vt&&t!==Dn?Ct(e,Ee):(e.state=null,t===Vt?Ct(e,oy):Ue))}function jy(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!==Aa||n.lookahead))return Ee;for(s===1&&(e.adler=vp(e.adler,t,i,0)),n.wrap=0,i>=n.w_size&&(s===0&&(St(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new de.Buf8(n.w_size),de.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,Xt(n);n.lookahead>=D;){r=n.strstart,a=n.lookahead-(D-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+D-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=D-1,Xt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=D-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=o,n.wrap=s,Ue}qe.deflateInit=Py;qe.deflateInit2=_p;qe.deflateReset=wp;qe.deflateResetKeep=xp;qe.deflateSetHeader=Iy;qe.deflate=Ry;qe.deflateEnd=My;qe.deflateSetDictionary=jy;qe.deflateInfo="pako deflate (from Nodeca project)"});var il=C(ji=>{"use strict";var Ca=st(),Sp=!0,Ap=!0;try{String.fromCharCode.apply(null,[0])}catch{Sp=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ap=!1}var Bn=new Ca.Buf8(256);for(lt=0;lt<256;lt++)Bn[lt]=lt>=252?6:lt>=248?5:lt>=240?4:lt>=224?3:lt>=192?2:1;var lt;Bn[254]=Bn[254]=1;ji.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 Ca.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 Cp(e,t){if(t<65534&&(e.subarray&&Ap||!e.subarray&&Sp))return String.fromCharCode.apply(null,Ca.shrinkBuf(e,t));for(var i="",n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i}ji.buf2binstring=function(e){return Cp(e,e.length)};ji.binstring2buf=function(e){for(var t=new Ca.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t};ji.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=Bn[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 Cp(o,n)};ji.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+Bn[e[i]]>t?i:t}});var nl=C((O1,Tp)=>{"use strict";function Dy(){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}Tp.exports=Dy});var Ip=C($n=>{"use strict";var Nn=Ep(),Fn=st(),al=il(),sl=ya(),zy=nl(),Op=Object.prototype.toString,By=0,rl=4,Di=0,kp=1,Lp=2,Ny=-1,Fy=0,$y=8;function Jt(e){if(!(this instanceof Jt))return new Jt(e);this.options=Fn.assign({level:Ny,method:$y,chunkSize:16384,windowBits:15,memLevel:8,strategy:Fy,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 zy,this.strm.avail_out=0;var i=Nn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Di)throw new Error(sl[i]);if(t.header&&Nn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=al.string2buf(t.dictionary):Op.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,i=Nn.deflateSetDictionary(this.strm,n),i!==Di)throw new Error(sl[i]);this._dict_set=!0}}Jt.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?rl:By,typeof e=="string"?i.input=al.string2buf(e):Op.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 Fn.Buf8(n),i.next_out=0,i.avail_out=n),r=Nn.deflate(i,a),r!==kp&&r!==Di)return this.onEnd(r),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(a===rl||a===Lp))&&(this.options.to==="string"?this.onData(al.buf2binstring(Fn.shrinkBuf(i.output,i.next_out))):this.onData(Fn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&r!==kp);return a===rl?(r=Nn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Di):(a===Lp&&(this.onEnd(Di),i.avail_out=0),!0)};Jt.prototype.onData=function(e){this.chunks.push(e)};Jt.prototype.onEnd=function(e){e===Di&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ol(e,t){var i=new Jt(t);if(i.push(e,!0),i.err)throw i.msg||sl[i.err];return i.result}function Hy(e,t){return t=t||{},t.raw=!0,ol(e,t)}function Uy(e,t){return t=t||{},t.gzip=!0,ol(e,t)}$n.Deflate=Jt;$n.deflate=ol;$n.deflateRaw=Hy;$n.gzip=Uy});var Rp=C((P1,Pp)=>{"use strict";var Ta=30,qy=12;Pp.exports=function(t,i){var n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,v,y,x,w,S,A,E,k,I,_;n=t.state,r=t.next_in,I=t.input,a=r+(t.avail_in-5),s=t.next_out,_=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,v=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;e:do{h<15&&(m+=I[r++]<<h,h+=8,m+=I[r++]<<h,h+=8),x=g[m&v];t:for(;;){if(w=x>>>24,m>>>=w,h-=w,w=x>>>16&255,w===0)_[s++]=x&65535;else if(w&16){S=x&65535,w&=15,w&&(h<w&&(m+=I[r++]<<h,h+=8),S+=m&(1<<w)-1,m>>>=w,h-=w),h<15&&(m+=I[r++]<<h,h+=8,m+=I[r++]<<h,h+=8),x=b[m&y];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+=I[r++]<<h,h+=8,h<w&&(m+=I[r++]<<h,h+=8)),A+=m&(1<<w)-1,A>c){t.msg="invalid distance too far back",n.mode=Ta;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=Ta;break e}if(E=0,k=f,p===0){if(E+=d-w,w<S){S-=w;do _[s++]=f[E++];while(--w);E=s-A,k=_}}else if(p<w){if(E+=d+p-w,w-=p,w<S){S-=w;do _[s++]=f[E++];while(--w);if(E=0,p<S){w=p,S-=w;do _[s++]=f[E++];while(--w);E=s-A,k=_}}}else if(E+=p-w,w<S){S-=w;do _[s++]=f[E++];while(--w);E=s-A,k=_}for(;S>2;)_[s++]=k[E++],_[s++]=k[E++],_[s++]=k[E++],S-=3;S&&(_[s++]=k[E++],S>1&&(_[s++]=k[E++]))}else{E=s-A;do _[s++]=_[E++],_[s++]=_[E++],_[s++]=_[E++],S-=3;while(S>2);S&&(_[s++]=_[E++],S>1&&(_[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=Ta;break e}break}}else if((w&64)===0){x=g[(x&65535)+(m&(1<<w)-1)];continue t}else if(w&32){n.mode=qy;break e}else{t.msg="invalid literal/length code",n.mode=Ta;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 Fp=C((R1,Np)=>{"use strict";var Mp=st(),zi=15,jp=852,Dp=592,zp=0,ll=1,Bp=2,Gy=[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],Wy=[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],Yy=[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],Vy=[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];Np.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,v=0,y=0,x,w,S,A,E,k=null,I=0,_,T=new Mp.Buf16(zi+1),R=new Mp.Buf16(zi+1),B=null,M=0,L,P,F;for(d=0;d<=zi;d++)T[d]=0;for(u=0;u<r;u++)T[i[n+u]]++;for(m=c,f=zi;f>=1&&T[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&&T[p]===0;p++);for(m<p&&(m=p),b=1,d=1;d<=zi;d++)if(b<<=1,b-=T[d],b<0)return-1;if(b>0&&(t===zp||f!==1))return-1;for(R[1]=0,d=1;d<zi;d++)R[d+1]=R[d]+T[d];for(u=0;u<r;u++)i[n+u]!==0&&(o[R[i[n+u]]++]=u);if(t===zp?(k=B=o,_=19):t===ll?(k=Gy,I-=257,B=Wy,M-=257,_=256):(k=Yy,B=Vy,_=-1),y=0,u=0,d=p,E=s,h=m,g=0,S=-1,v=1<<m,A=v-1,t===ll&&v>jp||t===Bp&&v>Dp)return 1;for(;;){L=d-g,o[u]<_?(P=0,F=o[u]):o[u]>_?(P=B[M+o[u]],F=k[I+o[u]]):(P=96,F=0),x=1<<d-g,w=1<<h,p=w;do w-=x,a[E+(y>>g)+w]=L<<24|P<<16|F|0;while(w!==0);for(x=1<<d-1;y&x;)x>>=1;if(x!==0?(y&=x-1,y+=x):y=0,u++,--T[d]===0){if(d===f)break;d=i[n+o[u]]}if(d>m&&(y&A)!==S){for(g===0&&(g=m),E+=p,h=d-g,b=1<<h;h+g<f&&(b-=T[h+g],!(b<=0));)h++,b<<=1;if(v+=1<<h,t===ll&&v>jp||t===Bp&&v>Dp)return 1;S=y&A,a[S]=m<<24|h<<16|E-s|0}}return y!==0&&(a[E+y]=d-g<<24|64<<16|0),l.bits=m,0}});var _f=C(Ie=>{"use strict";var me=st(),hl=Xo(),Ge=Zo(),Ky=Rp(),Hn=Fp(),Xy=0,ff=1,hf=2,$p=4,Zy=5,ka=6,Qt=0,Jy=1,Qy=2,Se=-2,gf=-3,gl=-4,ex=-5,Hp=8,mf=1,Up=2,qp=3,Gp=4,Wp=5,Yp=6,Vp=7,Kp=8,Xp=9,Zp=10,Ia=11,ct=12,cl=13,Jp=14,dl=15,Qp=16,ef=17,tf=18,nf=19,La=20,Oa=21,rf=22,af=23,sf=24,of=25,lf=26,ul=27,cf=28,df=29,G=30,ml=31,tx=32,ix=852,nx=592,rx=15,ax=rx;function uf(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function sx(){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 bf(e){var t;return!e||!e.state?Se:(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(ix),t.distcode=t.distdyn=new me.Buf32(nx),t.sane=1,t.back=-1,Qt)}function vf(e){var t;return!e||!e.state?Se:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,bf(e))}function yf(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))?Se:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,vf(e))}function xf(e,t){var i,n;return e?(n=new sx,e.state=n,n.window=null,i=yf(e,t),i!==Qt&&(e.state=null),i):Se}function ox(e){return xf(e,ax)}var pf=!0,pl,fl;function lx(e){if(pf){var t;for(pl=new me.Buf32(512),fl=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(Hn(ff,e.lens,0,288,pl,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Hn(hf,e.lens,0,32,fl,0,e.work,{bits:5}),pf=!1}e.lencode=pl,e.lenbits=9,e.distcode=fl,e.distbits=5}function wf(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 cx(e,t){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g=0,b,v,y,x,w,S,A,E,k=new me.Buf8(4),I,_,T=[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 Se;i=e.state,i.mode===ct&&(i.mode=cl),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,E=Qt;e:for(;;)switch(i.mode){case mf:if(i.wrap===0){i.mode=cl;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,k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0),c=0,d=0,i.mode=Up;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=G;break}if((c&15)!==Hp){e.msg="unknown compression method",i.mode=G;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=G;break}i.dmax=1<<A,e.adler=i.check=1,i.mode=c&512?Zp:ct,c=0,d=0;break;case Up:for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.flags=c,(i.flags&255)!==Hp){e.msg="unknown compression method",i.mode=G;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=G;break}i.head&&(i.head.text=c>>8&1),i.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0)),c=0,d=0,i.mode=qp;case qp:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.head&&(i.head.time=c),i.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,k[2]=c>>>16&255,k[3]=c>>>24&255,i.check=Ge(i.check,k,4,0)),c=0,d=0,i.mode=Gp;case Gp: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&&(k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0)),c=0,d=0,i.mode=Wp;case Wp: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&&(k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0)),c=0,d=0}else i.head&&(i.head.extra=null);i.mode=Yp;case Yp: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=Ge(i.check,n,f,a)),o-=f,a+=f,i.length-=f),i.length))break e;i.length=0,i.mode=Vp;case Vp: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=Ge(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=Kp;case Kp: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=Ge(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.comment=null);i.mode=Xp;case Xp: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=G;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=ct;break;case Zp:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}e.adler=i.check=uf(c),c=0,d=0,i.mode=Ia;case Ia: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,Qy;e.adler=i.check=1,i.mode=ct;case ct:if(t===Zy||t===ka)break e;case cl:if(i.last){c>>>=d&7,d-=d&7,i.mode=ul;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=Jp;break;case 1:if(lx(i),i.mode=La,t===ka){c>>>=2,d-=2;break e}break;case 2:i.mode=ef;break;case 3:e.msg="invalid block type",i.mode=G}c>>>=2,d-=2;break;case Jp: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=G;break}if(i.length=c&65535,c=0,d=0,i.mode=dl,t===ka)break e;case dl:i.mode=Qp;case Qp: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=ct;break;case ef: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=G;break}i.have=0,i.mode=tf;case tf:for(;i.have<i.ncode;){for(;d<3;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.lens[T[i.have++]]=c&7,c>>>=3,d-=3}for(;i.have<19;)i.lens[T[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,I={bits:i.lenbits},E=Hn(Xy,i.lens,0,19,i.lencode,0,i.work,I),i.lenbits=I.bits,E){e.msg="invalid code lengths set",i.mode=G;break}i.have=0,i.mode=nf;case nf:for(;i.have<i.nlen+i.ndist;){for(;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(y<16)c>>>=b,d-=b,i.lens[i.have++]=y;else{if(y===16){for(_=b+2;d<_;){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=G;break}A=i.lens[i.have-1],f=3+(c&3),c>>>=2,d-=2}else if(y===17){for(_=b+3;d<_;){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(_=b+7;d<_;){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=G;break}for(;f--;)i.lens[i.have++]=A}}if(i.mode===G)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=G;break}if(i.lenbits=9,I={bits:i.lenbits},E=Hn(ff,i.lens,0,i.nlen,i.lencode,0,i.work,I),i.lenbits=I.bits,E){e.msg="invalid literal/lengths set",i.mode=G;break}if(i.distbits=6,i.distcode=i.distdyn,I={bits:i.distbits},E=Hn(hf,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,I),i.distbits=I.bits,E){e.msg="invalid distances set",i.mode=G;break}if(i.mode=La,t===ka)break e;case La:i.mode=Oa;case Oa: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,Ky(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===ct&&(i.back=-1);break}for(i.back=0;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(v&&(v&240)===0){for(x=b,w=v,S=y;g=i.lencode[S+((c&(1<<x+w)-1)>>x)],b=g>>>24,v=g>>>16&255,y=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=y,v===0){i.mode=lf;break}if(v&32){i.back=-1,i.mode=ct;break}if(v&64){e.msg="invalid literal/length code",i.mode=G;break}i.extra=v&15,i.mode=rf;case rf:if(i.extra){for(_=i.extra;d<_;){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=af;case af:for(;g=i.distcode[c&(1<<i.distbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if((v&240)===0){for(x=b,w=v,S=y;g=i.distcode[S+((c&(1<<x+w)-1)>>x)],b=g>>>24,v=g>>>16&255,y=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,v&64){e.msg="invalid distance code",i.mode=G;break}i.offset=y,i.extra=v&15,i.mode=sf;case sf:if(i.extra){for(_=i.extra;d<_;){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=G;break}i.mode=of;case of: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=G;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=Oa);break;case lf:if(l===0)break e;r[s++]=i.length,l--,i.mode=Oa;break;case ul: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?Ge(i.check,r,p,s-p):hl(i.check,r,p,s-p)),p=l,(i.flags?c:uf(c))!==i.check){e.msg="incorrect data check",i.mode=G;break}c=0,d=0}i.mode=cf;case cf: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=G;break}c=0,d=0}i.mode=df;case df:E=Jy;break e;case G:E=gf;break e;case ml:return gl;case tx:default:return Se}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<G&&(i.mode<ul||t!==$p))&&wf(e,e.output,e.next_out,p-e.avail_out)?(i.mode=ml,gl):(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?Ge(i.check,r,p,e.next_out-p):hl(i.check,r,p,e.next_out-p)),e.data_type=i.bits+(i.last?64:0)+(i.mode===ct?128:0)+(i.mode===La||i.mode===dl?256:0),(u===0&&p===0||t===$p)&&E===Qt&&(E=ex),E)}function dx(e){if(!e||!e.state)return Se;var t=e.state;return t.window&&(t.window=null),e.state=null,Qt}function ux(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?Se:(i.head=t,t.done=!1,Qt)}function px(e,t){var i=t.length,n,r,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Ia)?Se:n.mode===Ia&&(r=1,r=hl(r,t,i,0),r!==n.check)?gf:(a=wf(e,t,i,i),a?(n.mode=ml,gl):(n.havedict=1,Qt))}Ie.inflateReset=vf;Ie.inflateReset2=yf;Ie.inflateResetKeep=bf;Ie.inflateInit=ox;Ie.inflateInit2=xf;Ie.inflate=cx;Ie.inflateEnd=dx;Ie.inflateGetHeader=ux;Ie.inflateSetDictionary=px;Ie.inflateInfo="pako inflate (from Nodeca project)"});var bl=C((j1,Ef)=>{"use strict";Ef.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 Af=C((D1,Sf)=>{"use strict";function fx(){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}Sf.exports=fx});var Tf=C(qn=>{"use strict";var Bi=_f(),Un=st(),Pa=il(),K=bl(),vl=ya(),hx=nl(),gx=Af(),Cf=Object.prototype.toString;function ei(e){if(!(this instanceof ei))return new ei(e);this.options=Un.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 hx,this.strm.avail_out=0;var i=Bi.inflateInit2(this.strm,t.windowBits);if(i!==K.Z_OK)throw new Error(vl[i]);if(this.header=new gx,Bi.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Pa.string2buf(t.dictionary):Cf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Bi.inflateSetDictionary(this.strm,t.dictionary),i!==K.Z_OK)))throw new Error(vl[i])}ei.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?K.Z_FINISH:K.Z_NO_FLUSH,typeof e=="string"?i.input=Pa.binstring2buf(e):Cf.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),a=Bi.inflate(i,K.Z_NO_FLUSH),a===K.Z_NEED_DICT&&r&&(a=Bi.inflateSetDictionary(this.strm,r)),a===K.Z_BUF_ERROR&&d===!0&&(a=K.Z_OK,d=!1),a!==K.Z_STREAM_END&&a!==K.Z_OK)return this.onEnd(a),this.ended=!0,!1;i.next_out&&(i.avail_out===0||a===K.Z_STREAM_END||i.avail_in===0&&(s===K.Z_FINISH||s===K.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&&Un.arraySet(i.output,i.output,o,l,0),this.onData(c)):this.onData(Un.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!==K.Z_STREAM_END);return a===K.Z_STREAM_END&&(s=K.Z_FINISH),s===K.Z_FINISH?(a=Bi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===K.Z_OK):(s===K.Z_SYNC_FLUSH&&(this.onEnd(K.Z_OK),i.avail_out=0),!0)};ei.prototype.onData=function(e){this.chunks.push(e)};ei.prototype.onEnd=function(e){e===K.Z_OK&&(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 yl(e,t){var i=new ei(t);if(i.push(e,!0),i.err)throw i.msg||vl[i.err];return i.result}function mx(e,t){return t=t||{},t.raw=!0,yl(e,t)}qn.Inflate=ei;qn.inflate=yl;qn.inflateRaw=mx;qn.ungzip=yl});var Of=C((B1,Lf)=>{"use strict";var bx=st().assign,vx=Ip(),yx=Tf(),xx=bl(),kf={};bx(kf,vx,yx,xx);Lf.exports=kf});var Pf=C(Ma=>{"use strict";var wx=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",_x=Of(),If=Y(),Ra=ge(),Ex=wx?"uint8array":"array";Ma.magic="\b\0";function ti(e,t){Ra.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}If.inherits(ti,Ra);ti.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(If.transformTo(Ex,e.data),!1)};ti.prototype.flush=function(){Ra.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};ti.prototype.cleanUp=function(){Ra.prototype.cleanUp.call(this),this._pako=null};ti.prototype._createPako=function(){this._pako=new _x[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Ma.compressWorker=function(e){return new ti("Deflate",e)};Ma.uncompressWorker=function(){return new ti("Inflate",{})}});var wl=C(xl=>{"use strict";var Rf=ge();xl.STORE={magic:"\0\0",compressWorker:function(){return new Rf("STORE compression")},uncompressWorker:function(){return new Rf("STORE decompression")}};xl.DEFLATE=Pf()});var _l=C(ii=>{"use strict";ii.LOCAL_FILE_HEADER="PK";ii.CENTRAL_FILE_HEADER="PK";ii.CENTRAL_DIRECTORY_END="PK";ii.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";ii.ZIP64_CENTRAL_DIRECTORY_END="PK";ii.DATA_DESCRIPTOR="PK\x07\b"});var zf=C((H1,Df)=>{"use strict";var Ni=Y(),Fi=ge(),El=Ti(),Mf=ha(),ja=_l(),U=function(e,t){var i="",n;for(n=0;n<t;n++)i+=String.fromCharCode(e&255),e=e>>>8;return i},Sx=function(e,t){var i=e;return e||(i=t?16893:33204),(i&65535)<<16},Ax=function(e){return(e||0)&63},jf=function(e,t,i,n,r,a){var s=e.file,o=e.compression,l=a!==El.utf8encode,c=Ni.transformTo("string",a(s.name)),d=Ni.transformTo("string",El.utf8encode(s.name)),u=s.comment,p=Ni.transformTo("string",a(u)),f=Ni.transformTo("string",El.utf8encode(u)),m=d.length!==s.name.length,h=f.length!==u.length,g,b,v="",y="",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 E=0;t&&(E|=8),!l&&(m||h)&&(E|=2048);var k=0,I=0;w&&(k|=16),r==="UNIX"?(I=798,k|=Sx(s.unixPermissions,w)):(I=20,k|=Ax(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&&(y=U(1,1)+U(Mf(c),4)+d,v+="up"+U(y.length,2)+y),h&&(x=U(1,1)+U(Mf(p),4)+f,v+="uc"+U(x.length,2)+x);var _="";_+=`
|
|
2
|
-
\0`,_+=U(E,2),_+=o.magic,_+=U(g,2),_+=U(b,2),_+=U(A.crc32,4),_+=U(A.compressedSize,4),_+=U(A.uncompressedSize,4),_+=U(c.length,2),_+=U(v.length,2);var T=ja.LOCAL_FILE_HEADER+_+c+v,R=ja.CENTRAL_FILE_HEADER+U(I,2)+_+U(p.length,2)+"\0\0\0\0"+U(k,4)+U(n,4)+c+v+p;return{fileRecord:T,dirRecord:R}},Cx=function(e,t,i,n,r){var a="",s=Ni.transformTo("string",r(n));return a=ja.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},Tx=function(e){var t="";return t=ja.DATA_DESCRIPTOR+U(e.crc32,4)+U(e.compressedSize,4)+U(e.uncompressedSize,4),t};function Pe(e,t,i,n){Fi.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(Pe,Fi);Pe.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,Fi.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-n-1))/i:100}}))};Pe.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=jf(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Pe.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=jf(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:Tx(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};Pe.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=Cx(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};Pe.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};Pe.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};Pe.prototype.resume=function(){if(!Fi.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};Pe.prototype.error=function(e){var t=this._sources;if(!Fi.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch{}return!0};Pe.prototype.lock=function(){Fi.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Df.exports=Pe});var Nf=C(Bf=>{"use strict";var kx=wl(),Lx=zf(),Ox=function(e,t){var i=e||t,n=kx[i];if(!n)throw new Error(i+" is not a valid compression method !");return n};Bf.generateWorker=function(e,t,i){var n=new Lx(t.streamFiles,i,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,s){r++;var o=Ox(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 $f=C((q1,Ff)=>{"use strict";var Ix=Y(),Da=ge();function Gn(e,t){Da.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Ix.inherits(Gn,Da);Gn.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()})};Gn.prototype.pause=function(){return Da.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Gn.prototype.resume=function(){return Da.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Ff.exports=Gn});var Zf=C((G1,Xf)=>{"use strict";var Px=Ti(),Wn=Y(),Gf=ge(),Rx=ko(),Wf=Lo(),Hf=ga(),Mx=Hu(),jx=Nf(),Uf=wn(),Dx=$f(),Yf=function(e,t,i){var n=Wn.getTypeOf(t),r,a=Wn.extend(i||{},Wf);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=Vf(e)),a.createFolders&&(r=zx(e))&&Kf.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 Hf&&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 Hf||t instanceof Gf?l=t:Uf.isNode&&Uf.isStream(t)?l=new Dx(e,t):l=Wn.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var c=new Mx(e,l,a);this.files[e]=c},zx=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},Vf=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},Kf=function(e,t){return t=typeof t!="undefined"?t:Wf.createFolders,e=Vf(e),this.files[e]||Yf.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function qf(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var Bx={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(qf(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,Yf.call(this,e,t,i);return this},folder:function(e){if(!e)return this;if(qf(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,i=Kf.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=Wn.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Px.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.");Wn.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=jx.generateWorker(this,i,n)}catch(r){t=new Gf("error"),t.error(r)}return new Rx(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)}};Xf.exports=Bx});var Sl=C((W1,Qf)=>{"use strict";var Nx=Y();function Jf(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}Jf.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 Nx.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))}};Qf.exports=Jf});var Al=C((Y1,th)=>{"use strict";var eh=Sl(),Fx=Y();function $i(e){eh.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}Fx.inherits($i,eh);$i.prototype.byteAt=function(e){return this.data[this.zero+e]};$i.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};$i.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]};$i.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};th.exports=$i});var rh=C((V1,nh)=>{"use strict";var ih=Sl(),$x=Y();function Hi(e){ih.call(this,e)}$x.inherits(Hi,ih);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};nh.exports=Hi});var Tl=C((K1,sh)=>{"use strict";var ah=Al(),Hx=Y();function Cl(e){ah.call(this,e)}Hx.inherits(Cl,ah);Cl.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};sh.exports=Cl});var ch=C((X1,lh)=>{"use strict";var oh=Tl(),Ux=Y();function kl(e){oh.call(this,e)}Ux.inherits(kl,oh);kl.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};lh.exports=kl});var Ll=C((Z1,uh)=>{"use strict";var za=Y(),dh=rt(),qx=Al(),Gx=rh(),Wx=ch(),Yx=Tl();uh.exports=function(e){var t=za.getTypeOf(e);return za.checkSupport(t),t==="string"&&!dh.uint8array?new Gx(e):t==="nodebuffer"?new Wx(e):dh.uint8array?new Yx(za.transformTo("uint8array",e)):new qx(za.transformTo("array",e))}});var gh=C((J1,hh)=>{"use strict";var Ol=Ll(),kt=Y(),Vx=ga(),ph=ha(),Ba=Ti(),Na=wl(),Kx=rt(),Xx=0,Zx=3,Jx=function(e){for(var t in Na)if(Object.prototype.hasOwnProperty.call(Na,t)&&Na[t].magic===e)return Na[t];return null};function fh(e,t){this.options=e,this.loadOptions=t}fh.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=Jx(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+kt.pretty(this.compressionMethod)+" unknown (inner file : "+kt.transformTo("string",this.fileName)+")");this.decompressed=new Vx(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===Xx&&(this.dosPermissions=this.externalFileAttributes&63),e===Zx&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Ol(this.extraFields[1].value);this.uncompressedSize===kt.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===kt.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===kt.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===kt.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=Kx.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Ba.utf8decode(this.fileName),this.fileCommentStr=Ba.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var i=kt.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var r=kt.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Ol(e.value);return t.readInt(1)!==1||ph(this.fileName)!==t.readInt(4)?null:Ba.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Ol(e.value);return t.readInt(1)!==1||ph(this.fileComment)!==t.readInt(4)?null:Ba.utf8decode(t.readData(e.length-5))}return null}};hh.exports=fh});var vh=C((Q1,bh)=>{"use strict";var Qx=Ll(),dt=Y(),Re=_l(),ew=gh(),tw=rt();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 ("+dt.pretty(t)+", expected "+dt.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=tw.uint8array?"uint8array":"array",i=dt.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(Re.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(Re.CENTRAL_FILE_HEADER);)e=new ew({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(Re.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,Re.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(Re.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===dt.MAX_VALUE_16BITS||this.diskWithCentralDirStart===dt.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===dt.MAX_VALUE_16BITS||this.centralDirRecords===dt.MAX_VALUE_16BITS||this.centralDirSize===dt.MAX_VALUE_32BITS||this.centralDirOffset===dt.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(Re.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(Re.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,Re.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(Re.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(Re.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,Re.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=Qx(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};bh.exports=mh});var wh=C((eE,xh)=>{"use strict";var Il=Y(),Fa=Si(),iw=Ti(),nw=vh(),rw=Po(),yh=wn();function aw(e){return new Fa.Promise(function(t,i){var n=e.decompressed.getContentWorker().pipe(new rw);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()})}xh.exports=function(e,t){var i=this;return t=Il.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:iw.utf8decode}),yh.isNode&&yh.isStream(e)?Fa.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):Il.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var r=new nw(t);return r.load(n),r}).then(function(r){var a=[Fa.Promise.resolve(r)],s=r.files;if(t.checkCRC32)for(var o=0;o<s.length;o++)a.push(aw(s[o]));return Fa.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=Il.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 Eh=C((tE,_h)=>{"use strict";function Ae(){if(!(this instanceof Ae))return new Ae;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 Ae;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}Ae.prototype=Zf();Ae.prototype.loadAsync=wh();Ae.support=rt();Ae.defaults=Lo();Ae.version="3.10.1";Ae.loadAsync=function(e,t){return new Ae().loadAsync(e,t)};Ae.external=Si();_h.exports=Ae});var cg={};rn(cg,{AssetEditorModal:()=>rc});var rc,ac=Ye(()=>{"use strict";rc=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 Rg=Object.create;var lr=Object.defineProperty;var Mg=Object.getOwnPropertyDescriptor;var jg=Object.getOwnPropertyNames;var Dg=Object.getPrototypeOf,zg=Object.prototype.hasOwnProperty;var Ye=(e,t)=>()=>(e&&(t=e(e=0)),t);var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),rn=(e,t)=>{for(var i in t)lr(e,i,{get:t[i],enumerable:!0})},Ec=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jg(t))!zg.call(e,r)&&r!==i&&lr(e,r,{get:()=>t[r],enumerable:!(n=Mg(t,r))||n.enumerable});return e};var ci=(e,t,i)=>(i=e!=null?Rg(Dg(e)):{},Ec(t||!e||!e.__esModule?lr(i,"default",{value:e,enumerable:!0}):i,e)),Bg=e=>Ec(lr({},"__esModule",{value:!0}),e);var Ve,vs=Ye(()=>{"use strict";Ve=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()}};Ve.store=new Map});function Hg(){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 Ug(){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 qg(){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 Gg(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${W}`),Object.keys(Ke).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Ke)),Ke;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Ke={...window.INLINE_ASSETS},Ke;if(!(W==="publish"&&ze!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Ke;if(!ys){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),ys=(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 Ke=await ys,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Ke)),Ke}function xs(e){return e===null||typeof e!="object"||(Object.freeze(e),Object.values(e).forEach(t=>xs(t))),e}function Wg(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),Xe.Texture.from(n)}function ws(e,t){Kc.set(e,t)}var Xe,Yc,Vc,jt,W,ze,gt,Ke,ys,Kc,Dt,pr=Ye(()=>{"use strict";Xe=require("pixi.js");vs();Yc=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Vc=Hg(),jt=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,W=Vc?"publish":Yc,ze=jt==null?void 0:jt.assetsInlined;jt!=null&&jt.buildMode&&(W=jt.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${W}`));gt=qg();gt!=null&>.buildMode&&(W=gt.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${W}`));(gt==null?void 0:gt.assetsInlined)!==void 0&&(ze=gt.assetsInlined);Ug().then(e=>{e!=null&&e.buildMode&&e.buildMode!==W&&(W=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${W}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(ze=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${Yc}, Runtime: ${Vc?"publish":"dev"}, Effective: ${W}`);Ke={},ys=null;Kc=new Map;Dt=class{static async load(t,i,n,r){let a=`${t}:${i.path}`,s=Ve.get(a);if(s!==void 0)return s;console.log(`[AssetLoader] Loading asset: ${t}, type: ${i.type}, Effective mode: ${W}`),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 Gg(),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"),W==="publish"&&ze!==!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=Kc.get(i.type);if(d)try{let u=await d(i.path,l,t,n);return Ve.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=xs(u);break;default:throw new Error(`Unknown asset type: ${i.type}`)}return Ve.set(a,u),u}catch(u){return this.handleFailure(t,i.type,u)}}static async loadImage(t,i){let n=W==="publish",r=n&&ze!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${W}, 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 Xe.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 Xe.Assets.load(i)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await Xe.Assets.load(t)}return await Xe.Assets.load(t)}static async loadJSON(t,i){let n=W==="publish",r=n&&ze!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${W}, 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(W==="dev"){let a=i==="image"?Wg():xs({__placeholder:!0,type:i});return Ve.set(t+":"+((n==null?void 0:n.path)||"missing"),a),a}throw n}};ws("image",async(e,t)=>{let i=W==="publish",n=i&&ze!==!1,r=W==="brand",a=i&&ze===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${W}, 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 Xe.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}"`))),Xe.Assets.load(t||s)});ws("json",async(e,t)=>{let i=W==="publish",n=i&&ze!==!1,r=W==="brand",a=i&&ze===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${W}, 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 Zc={};rn(Zc,{AssetTextures:()=>Be,initAssetTextures:()=>Ss});function Ss(e,t){Xc.init(e,t),typeof window!="undefined"&&(window.__AssetTextures=Be)}var Es,Xc,Be,fi=Ye(()=>{"use strict";pr();Es=class{constructor(){this.textures=new Map;this.readyPromise=null;this.config=null;this.app=null}init(t,i){this.textures.clear(),this.readyPromise=null,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 r;console.log("[AssetTextures] Loading all assets...");let n=[];for(let[a,s]of t.objects.entries()){let o=(r=s.render)==null?void 0:r.asset;if(!o)continue;let l=(async()=>{var c;try{let d=(c=s.identity)==null?void 0:c.id;console.log(`[AssetTextures] Loading ${o.type}: ${a} (${d})`);let u=await Dt.load(a,o,i,d);this.textures.set(a,u),console.log(`[AssetTextures] \u2713 Loaded: ${a}`)}catch(d){console.error(`[AssetTextures] \u2717 Failed to load: ${a}`,d)}})();n.push(l)}await Promise.all(n),console.log("[AssetTextures] All textures loaded:",Array.from(this.textures.keys()))})(),this.readyPromise}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())}},Xc=new Es,Be=new Proxy(Xc,{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 Lr={};rn(Lr,{applyConfigOverride:()=>xe,applyConfigOverrides:()=>Bt,applyConfigsToDisk:()=>Tr,clearConfigOverrides:()=>cn,clearConfigOverridesForObject:()=>ad,configOverrideManager:()=>sd,deepClone:()=>ue,exportConfigsAsJSON:()=>ks,getConfigOverrides:()=>fe,getConfigStateSummary:()=>Cr,getOverrideMode:()=>Er,removeConfigOverride:()=>Ar,resetToApplied:()=>dn,resetToOriginal:()=>kr,setOverrideMode:()=>Sr});function bm(){if(typeof window=="undefined")return"unknown";let e=window;return typeof e.__HANDLER_PROJECT_ID=="string"?e.__HANDLER_PROJECT_ID:"handler-default"}function nd(){return`handler_preview_config_overrides::${bm()}`}function vm(){if(typeof window=="undefined")return[];try{let e=window.localStorage.getItem(nd());if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function _r(e){if(typeof window!="undefined")try{window.localStorage.setItem(nd(),JSON.stringify(e))}catch{}}function Er(){return typeof window=="undefined"?!1:window.__enableConfigOverrides===!0}function Sr(e){if(typeof window!="undefined"){window.__enableConfigOverrides=e;try{window.localStorage.setItem(rd,e?"true":"false")}catch{}}}function xe(e,t={}){var u,p;let{objectId:i,path:n,value:r}=e,{silent:a=!1,persist:s=!0}=t,o=window.__editableConfig;if(!o){console.warn("[CONFIG] applyConfigOverride: No editable config found in window.__editableConfig");return}let l=i?(p=(u=o.objects)==null?void 0:u.get)==null?void 0:p.call(u,i):o.engine;if(!l){console.warn("[CONFIG] applyConfigOverride: Override target not found:",{objectId:i,path:n,hasObjects:!!o.objects});return}console.log("[CONFIG] applyConfigOverride: Target found, applying...",{objectId:i,path:n,value:r});let c=xm(l,n);wr(l,n,r),window.__configChanges=window.__configChanges||[];let d=window.__configChanges;if(d.push({objectId:i,path:n,oldValue:c,newValue:r,ts:Date.now()}),d.length>ym&&d.shift(),s){let f=fe(),m=f.findIndex(h=>h.objectId===i&&h.sceneId===e.sceneId&&h.path===n);m>=0?f[m].value=r:f.push(e),window.__configOverrides=f,_r(f)}a||console.log("[CONFIG] Applied override:",e),typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("config:changed",{detail:e}))}function Bt(e,t={}){e.forEach(i=>xe(i,t))}function cn(){window.__configOverrides=[],window.__configChanges=[],_r([]),console.log("[CONFIG] Cleared all overrides")}function ad(e){let t=fe().filter(n=>n.objectId!==e);window.__configOverrides=t,_r(t);let i=window.__configChanges||[];window.__configChanges=i.filter(n=>n.objectId!==e),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"clear_object",objectId:e}}))}function Ar(e,t){let i=fe().filter(n=>n.objectId!==e||n.path!==t);window.__configOverrides=i,_r(i),window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"remove",objectId:e,path:t}}))}function fe(){return typeof window=="undefined"?[]:(window.__configOverrides||(window.__configOverrides=vm()),window.__configOverrides||[])}function wr(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 xm(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function ue(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=>ue(i)));if(ArrayBuffer.isView(e))return e.slice();if(e instanceof Array)return e.map(i=>ue(i));if(e instanceof Map){let i=new Map;return e.forEach((n,r)=>i.set(r,ue(n))),i}let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=ue(e[i]));return t}function ks(){let e=window.__editableConfigBaseline;if(!e){let t=window.__editableConfig;if(!t)throw new Error("Cannot export: no config loaded");return id(t)}return id(e)}function id(e){let t={objects:{},scenes:{},engine:ue(e.engine||{})},i=e.objects;if(i instanceof Map)i.forEach((a,s)=>{t.objects[s]=ue(a)});else if(i&&typeof i=="object")for(let a in i)t.objects[a]=ue(i[a]);let n=e.scenes;if(n instanceof Map)n.forEach((a,s)=>{t.scenes[s]=ue(a)});else if(n&&typeof n=="object")for(let a in n)t.scenes[a]=ue(n[a]);let r=fe();for(let a of r)a.objectId?(t.objects[a.objectId]||(t.objects[a.objectId]={}),wr(t.objects[a.objectId],a.path,a.value)):a.sceneId?(t.scenes[a.sceneId]||(t.scenes[a.sceneId]={}),wr(t.scenes[a.sceneId],a.path,a.value)):wr(t.engine,a.path,a.value);return t}function Cr(){let e=fe(),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 Tr(){let e=ks(),t={};for(let[n,r]of Object.entries(e.objects)){let a=r,s=n;/^(json\.|ui\.|effects\.|engine\.)/.test(s)||(s=`json.${n}`),a&&typeof a=="object"&&(a.identity||(a.identity={}),a.identity.id=s),t[`objects/${s}.json`]=a}e.engine&&(e.engine.runtime&&(t["engine/engine.runtime.json"]=e.engine.runtime),e.engine.assets&&(t["engine/engine.assets.json"]=e.engine.assets),e.engine.splash&&(t["engine/engine.splash.json"]=e.engine.splash),!e.engine.runtime&&!e.engine.assets&&(t["engine/engine.json"]=e.engine));for(let[n,r]of Object.entries(e.scenes)){let a=n.startsWith("scene.")?n:`scene.${n}`;t[`scenes/${a}.json`]=r}let i=await fetch("/api/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:t,assets:{},hadCacheAtApply:fe().length>0})});if(!i.ok){let n=await i.json();throw new Error(`Apply failed: ${n.error||"Unknown error"}`)}cn(),localStorage.setItem("handler_last_applied",Date.now().toString()),console.log("[Config Persistence] \u2705 Applied to disk successfully")}function dn(){cn(),Sr(!1),window.location.reload()}async function kr(){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"}`)}cn(),Sr(!1),window.location.reload()}var rd,ym,sd,ke=Ye(()=>{"use strict";rd="handler_preview_override_mode";if(typeof window!="undefined"){let e=window.localStorage.getItem(rd);window.__enableConfigOverrides=e===null?!0:e==="true"}ym=500;sd={getCurrentConfig(){return window.__editableConfig||null},getChanges(){return window.__configChanges||[]},clearChanges(){window.__configChanges=[]}}});function wm(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 _m(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=wm(s,a);if(o!==null)return o}}return null}async function Nt(e){if(Ls.has(e)&&!Is)return console.log(`[CONFIG] Using cached config for: "${e}"`),Ls.get(e);if(console.log(`[CONFIG] loadConfigFile called with: "${e}", MODE: ${H.toUpperCase()}, CACHE: ${Is?"DISABLED":"ENABLED"}`),H==="publish"){let n=_m(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`),{})}H==="brand"||console.log(`[CONFIG] DEV MODE: Trying nested paths first, then flattened for "${e}"`);let t;H==="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=Is?"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: ${H}):`,a)}return console.warn(`[CONFIG] \u2717 All attempts failed for ${e}; using defaults`),{}})();return Ls.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=H==="publish"||H==="brand"?i.split("/").pop()||i:`configs/${i}`,r=await Nt(n);r.component&&(t.set(r.component,r),console.log(`[CONFIG] \u2713 Schema loaded: ${r.component} ${H==="publish"||H==="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 bt(e){console.log(`[CONFIG] Loading object config: ${e}`);let t=H==="publish"||H==="brand"?`${e}.json`:`configs/objects/${e}.json`;return await Nt(t)}async function Or(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 bt(n);(!r||Object.keys(r).length===0)&&n!==i.instance_id&&(r=await bt(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 bt(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 Pr(){console.log("[CONFIG] Loading engine configs...");let[e,t,i]=await Promise.all([Nt(H==="publish"||H==="brand"?"engine.runtime.json":"configs/engine/engine.runtime.json"),Nt(H==="publish"||H==="brand"?"engine.assets.json":"configs/engine/engine.assets.json"),Nt(H==="publish"||H==="brand"?"engine.splash.json":"configs/engine/engine.splash.json")]);return console.log("[CONFIG] Engine configs loaded:",{runtime:Object.keys(e).length>0?Object.keys(e):"empty",assets:Object.keys(t).length>0?Object.keys(t):"empty",splash:Object.keys(i).length>0?Object.keys(i):"empty"}),{runtime:e,assets:t,splash:i}}async function Os(){return await Nt(H==="publish"||H==="brand"?"game.prompt.json":"configs/engine/game.prompt.json")}async function Rr(e="scene.main"){console.log(`[CONFIG] Loading scene config: ${e}`);let t=H==="publish"||H==="brand"?`${e}.json`:`configs/scenes/${e}.json`;return await Nt(t)}function hi(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 Ft(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 we(e,t,i,n){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(Math.max(e,i),n)}function ld(e,t){if(Array.isArray(e))return{x:we(e[0],t.x,-2e3,2e3),y:we(e[1],t.y,-2e3,2e3)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:we(i,t.x,-2e3,2e3),y:we(n,t.y,-2e3,2e3)}}function Em(e,t){if(Array.isArray(e))return{x:we(e[0],t.x,0,1),y:we(e[1],t.y,0,1)};if(!e||typeof e!="object")return t;let{x:i,y:n}=e;return{x:we(i,t.x,0,1),y:we(n,t.y,0,1)}}function Sm(e){if(Array.isArray(e))return{x:we(e[0],.5,-10,10),y:we(e[1],.5,-10,10)};if(e&&typeof e=="object"){let{x:t,y:i}=e;return{x:we(t,.5,-10,10),y:we(i,.5,-10,10)}}return typeof e=="string"?e:null}async function et(e="scene.main",t){var l,c,d,u,p,f,m,h;console.log("[CONFIG] ===== Starting Object-Centric Config Load =====");let i=await Ir(),n=fe();n.length>0&&console.log(`[CONFIG] Applying ${n.length} active overrides`);let r=await Rr(e);console.log(`[CONFIG] Scene config loaded: ${((l=r.objects)==null?void 0:l.length)||0} objects`);let a=await Pr();console.log("[CONFIG] Loading object configs...");let s=await Or(r);console.log(`[CONFIG] Loaded ${s.size} object configs:`,Array.from(s.keys()));for(let[g,b]of s.entries()){let v=Ft(b,i),y=hi(v,i);y.valid||console.warn(`Object ${g} validation errors:`,y.errors),(c=v.transform)!=null&&c.position&&(v.transform.position=ld(v.transform.position,{x:0,y:0})),(d=v.transform)!=null&&d.offset&&(v.transform.offset=ld(v.transform.offset,{x:0,y:0})),((u=v.transform)==null?void 0:u.anchor)!==void 0&&(v.transform.anchor=Sm(v.transform.anchor)),((p=v.transform)==null?void 0:p.position_ratio)!==void 0&&v.transform.position_ratio!==null&&(v.transform.position_ratio=Em(v.transform.position_ratio,{x:.5,y:.5})),s.set(g,v)}if(t){if(t.objects)for(let[g,b]of t.objects.entries())s.set(g,b);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=Ft(o,i))),n.length>0&&Er()&&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(a.runtime),assets:Object.keys(a.assets),splash:Object.keys((h=a.splash)!=null?h:{})},scene:r.scene_id||"unknown"}),o}function Ps(e){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,v,y,x,w,S,A,E,k,O,_,T,R,B,M,L,P,F;let t={gameplay:{},ui:{},theme:{},assets:{}};for(let[re,j]of e.objects.entries()){let J=((i=j.identity)==null?void 0:i.id)||re;J.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),(J.includes("gun")||J.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)||{}),J.includes("diamond")&&(t.gameplay.diamond=j),J.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=((v=j.effects)==null?void 0:v.melting_particles)||{},t.gameplay.hard_ice=j.hard_ice||{}),J.includes("water")&&(t.gameplay.water_drops=j),J.includes("crack")&&(t.gameplay.crack=j),J.includes("hand")&&(t.gameplay.hand=((y=j.gameplay)==null?void 0:y.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),J.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=((k=(E=j.gameplay)==null?void 0:E.tuning)==null?void 0:k.danger_pulse)||{},t.gameplay.hazard_height=((_=(O=j.gameplay)==null?void 0:O.tuning)==null?void 0:_.hazard_height)||140)}return t.gameplay.timeline=((T=e.engine.runtime)==null?void 0:T.timeline)||{},t.gameplay.drag_surface=((R=e.engine.runtime)==null?void 0:R.drag_surface)||{},t.gameplay.background=((B=e.engine.runtime)==null?void 0:B.background)||{},t.gameplay.ui_styles=((M=e.engine.runtime)==null?void 0:M.ui_styles)||{},t.gameplay.label_pulse=((L=e.engine.runtime)==null?void 0:L.label_pulse)||{},t.ui=((P=e.engine.runtime)==null?void 0:P.ui)||{},t.theme=((F=e.engine.runtime)==null?void 0:F.theme)||{},t.assets=e.engine.assets||{},t}var od,H,Ls,Is,Rs=Ye(()=>{"use strict";ke();od=null,H="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)od=e,H=e.buildMode,console.log("[CONFIG] Loaded inline build settings:",e,"buildMode:",H);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);od=i,H=i.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",i,"buildMode:",H)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",H)}catch(t){console.log("[CONFIG] Failed to load build-settings.json:",t instanceof Error?t.message:String(t))}}console.log("[CONFIG] Final buildMode:",H);Ls=new Map,Is=H==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});function Ms(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 js(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 un,$t,Ds=Ye(()=>{"use strict";un=class{shouldFullReload(t){return t.type==="component"||t.type==="scene"}getAffectedObjects(t){return t.type==="object"&&t.objectId?[t.objectId]:[]}},$t=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 Bs(e){if(typeof window=="undefined")return;let t=typeof zs!="undefined"&&!!zs.hot,i=window.location.search.includes("hot-reload");if(!(t||i))return;let r=null,a=!1,s=null;if(i){s=new $t;let m=window.__configWatcher;m!=null&&m.stop&&m.stop(),window.__configWatcher=s}let o=new Set,l=m=>{var b,v;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=(v=(b=m.scene)==null?void 0:b.objects)!=null?v:[];for(let y of g)y!=null&&y.object_config&&h.add(`configs/objects/${y.object_config}.json`);for(let y of o)h.has(y)||s.unwatch(y);for(let y of h)o.has(y)||s.watch(y,x=>f(x));o=h},c=new Set,d=!1,u=async m=>{let h=await bt(m),g=Ft(h,e.activeConfig.schemas),b=hi(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 et("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&&zs.hot.on("config-change",()=>{f({type:"hmr"})}),i&&(l(e.activeConfig),console.log(`[GAME] Hot-reload watcher enabled (${o.size} files)`))}var zs,cd=Ye(()=>{"use strict";Ds();Rs();zs={}});var dd={};rn(dd,{ConfigWatcher:()=>$t,DefaultReloadStrategy:()=>un,applyDefaults:()=>Ft,diffConfigs:()=>Ms,loadAllObjectConfigs:()=>Or,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Pr,loadGamePromptConfig:()=>Os,loadObjectCentricConfig:()=>et,loadObjectConfig:()=>bt,loadSceneConfig:()=>Rr,rehydrateObject:()=>js,setupHotReload:()=>Bs,toLegacyFormat:()=>Ps,validateObjectConfig:()=>hi});var Mr=Ye(()=>{"use strict";Rs();Ds();cd()});var pn=C(($_,Hs)=>{"use strict";typeof process=="undefined"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Hs.exports={nextTick:Tm}:Hs.exports=process;function Tm(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 pd=C((H_,ud)=>{"use strict";var km={}.toString;ud.exports=Array.isArray||function(e){return km.call(e)=="[object Array]"}});var Us=C((U_,fd)=>{"use strict";fd.exports=require("stream")});var fn=C((qs,gd)=>{"use strict";var Xr=require("buffer"),tt=Xr.Buffer;function hd(e,t){for(var i in e)t[i]=e[i]}tt.from&&tt.alloc&&tt.allocUnsafe&&tt.allocUnsafeSlow?gd.exports=Xr:(hd(Xr,qs),qs.Buffer=mi);function mi(e,t,i){return tt(e,t,i)}hd(tt,mi);mi.from=function(e,t,i){if(typeof e=="number")throw new TypeError("Argument must not be a number");return tt(e,t,i)};mi.alloc=function(e,t,i){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=tt(e);return t!==void 0?typeof i=="string"?n.fill(t,i):n.fill(t):n.fill(0),n};mi.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return tt(e)};mi.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Xr.SlowBuffer(e)}});var bi=C(se=>{"use strict";function Lm(e){return Array.isArray?Array.isArray(e):Zr(e)==="[object Array]"}se.isArray=Lm;function Im(e){return typeof e=="boolean"}se.isBoolean=Im;function Om(e){return e===null}se.isNull=Om;function Pm(e){return e==null}se.isNullOrUndefined=Pm;function Rm(e){return typeof e=="number"}se.isNumber=Rm;function Mm(e){return typeof e=="string"}se.isString=Mm;function jm(e){return typeof e=="symbol"}se.isSymbol=jm;function Dm(e){return e===void 0}se.isUndefined=Dm;function zm(e){return Zr(e)==="[object RegExp]"}se.isRegExp=zm;function Bm(e){return typeof e=="object"&&e!==null}se.isObject=Bm;function Nm(e){return Zr(e)==="[object Date]"}se.isDate=Nm;function Fm(e){return Zr(e)==="[object Error]"||e instanceof Error}se.isError=Fm;function $m(e){return typeof e=="function"}se.isFunction=$m;function Hm(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}se.isPrimitive=Hm;se.isBuffer=require("buffer").Buffer.isBuffer;function Zr(e){return Object.prototype.toString.call(e)}});var md=C((G_,Gs)=>{"use strict";typeof Object.create=="function"?Gs.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Gs.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 vi=C((W_,Ys)=>{"use strict";try{if(Ws=require("util"),typeof Ws.inherits!="function")throw"";Ys.exports=Ws.inherits}catch{Ys.exports=md()}var Ws});var vd=C((Y_,Vs)=>{"use strict";function Um(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var bd=fn().Buffer,hn=require("util");function qm(e,t,i){e.copy(t,i)}Vs.exports=(function(){function e(){Um(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 bd.alloc(0);for(var n=bd.allocUnsafe(i>>>0),r=this.head,a=0;r;)qm(r.data,n,a),a+=r.data.length,r=r.next;return n},e})();hn&&hn.inspect&&hn.inspect.custom&&(Vs.exports.prototype[hn.inspect.custom]=function(){var e=hn.inspect({length:this.length});return this.constructor.name+" "+e})});var Ks=C((V_,yd)=>{"use strict";var Jr=pn();function Gm(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,Jr.nextTick(Qr,this,e)):Jr.nextTick(Qr,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,Jr.nextTick(Qr,i,a)):Jr.nextTick(Qr,i,a):t&&t(a)}),this)}function Wm(){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 Qr(e,t){e.emit("error",t)}yd.exports={destroy:Gm,undestroy:Wm}});var wd=C((K_,xd)=>{"use strict";xd.exports=require("util").deprecate});var Zs=C((X_,Ld)=>{"use strict";var Ut=pn();Ld.exports=X;function Ed(e){var t=this;this.next=null,this.entry=null,this.finish=function(){db(t,e)}}var Ym=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Ut.nextTick,yi;X.WritableState=mn;var Sd=Object.create(bi());Sd.inherits=vi();var Vm={deprecate:wd()},Ad=Us(),ta=fn().Buffer,Km=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Xm(e){return ta.from(e)}function Zm(e){return ta.isBuffer(e)||e instanceof Km}var Cd=Ks();Sd.inherits(X,Ad);function Jm(){}function mn(e,t){yi=yi||qt(),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){ab(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 Ed(this)}mn.prototype.getBuffer=function(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i};(function(){try{Object.defineProperty(mn.prototype,"buffer",{get:Vm.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ea;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ea=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(e){return ea.call(this,e)?!0:this!==X?!1:e&&e._writableState instanceof mn}})):ea=function(e){return e instanceof this};function X(e){if(yi=yi||qt(),!ea.call(X,this)&&!(this instanceof yi))return new X(e);this._writableState=new mn(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)),Ad.call(this)}X.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Qm(e,t){var i=new Error("write after end");e.emit("error",i),Ut.nextTick(t,i)}function eb(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),Ut.nextTick(n,a),r=!1),r}X.prototype.write=function(e,t,i){var n=this._writableState,r=!1,a=!n.objectMode&&Zm(e);return a&&!ta.isBuffer(e)&&(e=Xm(e)),typeof t=="function"&&(i=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof i!="function"&&(i=Jm),n.ended?Qm(this,i):(a||eb(this,n,e,i))&&(n.pendingcb++,r=ib(this,n,a,e,t,i)),r};X.prototype.cork=function(){var e=this._writableState;e.corked++};X.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Td(this,e))};X.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 tb(e,t,i){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=ta.from(t,i)),t}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ib(e,t,i,n,r,a){if(!i){var s=tb(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 Xs(e,t,!1,o,n,r,a);return l}function Xs(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 nb(e,t,i,n,r){--t.pendingcb,i?(Ut.nextTick(r,n),Ut.nextTick(gn,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(r(n),e._writableState.errorEmitted=!0,e.emit("error",n),gn(e,t))}function rb(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function ab(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if(rb(i),t)nb(e,i,n,t,r);else{var a=kd(i);!a&&!i.corked&&!i.bufferProcessing&&i.bufferedRequest&&Td(e,i),n?Ym(_d,e,i,a,r):_d(e,i,a,r)}}function _d(e,t,i,n){i||sb(e,t),t.pendingcb--,n(),gn(e,t)}function sb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Td(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,Xs(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 Ed(t),t.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,c=i.encoding,d=i.callback,u=t.objectMode?1:l.length;if(Xs(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}X.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))};X.prototype._writev=null;X.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||cb(this,n,i)};function kd(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function ob(e,t){e._final(function(i){t.pendingcb--,i&&e.emit("error",i),t.prefinished=!0,e.emit("prefinish"),gn(e,t)})}function lb(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Ut.nextTick(ob,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function gn(e,t){var i=kd(t);return i&&(lb(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),i}function cb(e,t,i){t.ending=!0,gn(e,t),i&&(t.finished?Ut.nextTick(i):e.once("finish",i)),t.ended=!0,e.writable=!1}function db(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(X.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});X.prototype.destroy=Cd.destroy;X.prototype._undestroy=Cd.undestroy;X.prototype._destroy=function(e,t){this.end(),t(e)}});var qt=C((Z_,Rd)=>{"use strict";var Id=pn(),ub=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};Rd.exports=it;var Od=Object.create(bi());Od.inherits=vi();var Pd=eo(),Qs=Zs();Od.inherits(it,Pd);for(Js=ub(Qs.prototype),ia=0;ia<Js.length;ia++)na=Js[ia],it.prototype[na]||(it.prototype[na]=Qs.prototype[na]);var Js,na,ia;function it(e){if(!(this instanceof it))return new it(e);Pd.call(this,e),Qs.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",pb)}Object.defineProperty(it.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function pb(){this.allowHalfOpen||this._writableState.ended||Id.nextTick(fb,this)}function fb(e){e.end()}Object.defineProperty(it.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)}});it.prototype._destroy=function(e,t){this.push(null),this.end(),Id.nextTick(t,e)}});var no=C(jd=>{"use strict";var io=fn().Buffer,Md=io.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 hb(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 gb(e){var t=hb(e);if(typeof t!="string"&&(io.isEncoding===Md||!Md(e)))throw new Error("Unknown encoding: "+e);return t||e}jd.StringDecoder=bn;function bn(e){this.encoding=gb(e);var t;switch(this.encoding){case"utf16le":this.text=wb,this.end=_b,t=4;break;case"utf8":this.fillLast=vb,t=4;break;case"base64":this.text=Eb,this.end=Sb,t=3;break;default:this.write=Ab,this.end=Cb;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=io.allocUnsafe(t)}bn.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||""};bn.prototype.end=xb;bn.prototype.text=yb;bn.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 to(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function mb(e,t,i){var n=t.length-1;if(n<i)return 0;var r=to(t[n]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--n<i||r===-2?0:(r=to(t[n]),r>=0?(r>0&&(e.lastNeed=r-2),r):--n<i||r===-2?0:(r=to(t[n]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function bb(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 vb(e){var t=this.lastTotal-this.lastNeed,i=bb(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 yb(e,t){var i=mb(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 xb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function wb(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 _b(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 Eb(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 Sb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Ab(e){return e.toString(this.encoding)}function Cb(e){return e&&e.length?this.write(e):""}});var eo=C((e1,Yd)=>{"use strict";var wi=pn();Yd.exports=q;var Tb=pd(),vn;q.ReadableState=Hd;var Q_=require("events").EventEmitter,Nd=function(e,t){return e.listeners(t).length},lo=Us(),yn=fn().Buffer,kb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Lb(e){return yn.from(e)}function Ib(e){return yn.isBuffer(e)||e instanceof kb}var Fd=Object.create(bi());Fd.inherits=vi();var ro=require("util"),N=void 0;ro&&ro.debuglog?N=ro.debuglog("stream"):N=function(){};var Ob=vd(),$d=Ks(),xi;Fd.inherits(q,lo);var ao=["error","close","destroy","pause","resume"];function Pb(e,t,i){if(typeof e.prependListener=="function")return e.prependListener(t,i);!e._events||!e._events[t]?e.on(t,i):Tb(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]}function Hd(e,t){vn=vn||qt(),e=e||{};var i=t instanceof vn;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 Ob,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&&(xi||(xi=no().StringDecoder),this.decoder=new xi(e.encoding),this.encoding=e.encoding)}function q(e){if(vn=vn||qt(),!(this instanceof q))return new q(e);this._readableState=new Hd(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),lo.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=$d.destroy;q.prototype._undestroy=$d.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=yn.from(e,t),t=""),n=!0),Ud(this,e,t,!1,n)};q.prototype.unshift=function(e){return Ud(this,e,null,!0,!1)};function Ud(e,t,i,n,r){var a=e._readableState;if(t===null)a.reading=!1,Db(e,a);else{var s;r||(s=Rb(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==yn.prototype&&(t=Lb(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):so(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?so(e,a,t,!1):qd(e,a)):so(e,a,t,!1))):n||(a.reading=!1)}return Mb(a)}function so(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&&ra(e)),qd(e,t)}function Rb(e,t){var i;return!Ib(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(i=new TypeError("Invalid non-string/buffer chunk")),i}function Mb(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 xi||(xi=no().StringDecoder),this._readableState.decoder=new xi(e),this._readableState.encoding=e,this};var Dd=8388608;function jb(e){return e>=Dd?e=Dd:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function zd(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=jb(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}q.prototype.read=function(e){N("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 N("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?oo(this):ra(this),null;if(e=zd(e,t),e===0&&t.ended)return t.length===0&&oo(this),null;var n=t.needReadable;N("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,N("length less than watermark",n)),t.ended||t.reading?(n=!1,N("reading or ended",n)):n&&(N("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=zd(i,t)));var r;return e>0?r=Gd(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&&oo(this)),r!==null&&this.emit("data",r),r};function Db(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,ra(e)}}function ra(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?wi.nextTick(Bd,e):Bd(e))}function Bd(e){N("emit readable"),e.emit("readable"),co(e)}function qd(e,t){t.readingMore||(t.readingMore=!0,wi.nextTick(zb,e,t))}function zb(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(N("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,N("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?wi.nextTick(a):i.once("end",a),e.on("unpipe",s);function s(b,v){N("onunpipe"),b===i&&v&&v.hasUnpiped===!1&&(v.hasUnpiped=!0,d())}function o(){N("onend"),e.end()}var l=Bb(i);e.on("drain",l);var c=!1;function d(){N("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){N("ondata"),u=!1;var v=e.write(b);v===!1&&!u&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&Wd(n.pipes,e)!==-1)&&!c&&(N("false write response, pause",n.awaitDrain),n.awaitDrain++,u=!0),i.pause())}function f(b){N("onerror",b),g(),e.removeListener("error",f),Nd(e,"error")===0&&e.emit("error",b)}Pb(e,"error",f);function m(){e.removeListener("finish",h),g()}e.once("close",m);function h(){N("onfinish"),e.removeListener("close",m),g()}e.once("finish",h);function g(){N("unpipe"),i.unpipe(e)}return e.emit("pipe",i),n.flowing||(N("pipe resume"),i.resume()),e};function Bb(e){return function(){var t=e._readableState;N("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Nd(e,"data")&&(t.flowing=!0,co(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=Wd(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=lo.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&&ra(this):wi.nextTick(Nb,this))}return i};q.prototype.addListener=q.prototype.on;function Nb(e){N("readable nexttick read 0"),e.read(0)}q.prototype.resume=function(){var e=this._readableState;return e.flowing||(N("resume"),e.flowing=!0,Fb(this,e)),this};function Fb(e,t){t.resumeScheduled||(t.resumeScheduled=!0,wi.nextTick($b,e,t))}function $b(e,t){t.reading||(N("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),co(e),t.flowing&&!t.reading&&e.read(0)}q.prototype.pause=function(){return N("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(N("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function co(e){var t=e._readableState;for(N("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(N("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(N("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<ao.length;a++)e.on(ao[a],this.emit.bind(this,ao[a]));return this._read=function(s){N("wrapped _read",s),n&&(n=!1,e.resume())},this};Object.defineProperty(q.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});q._fromList=Gd;function Gd(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=Hb(e,t.buffer,t.decoder),i}function Hb(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?Ub(e,t):qb(e,t),n}function Ub(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 qb(e,t){var i=yn.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 oo(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,wi.nextTick(Gb,t,e))}function Gb(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Wd(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}});var uo=C((t1,Xd)=>{"use strict";Xd.exports=nt;var aa=qt(),Kd=Object.create(bi());Kd.inherits=vi();Kd.inherits(nt,aa);function Wb(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 nt(e){if(!(this instanceof nt))return new nt(e);aa.call(this,e),this._transformState={afterTransform:Wb.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",Yb)}function Yb(){var e=this;typeof this._flush=="function"?this._flush(function(t,i){Vd(e,t,i)}):Vd(this,null,null)}nt.prototype.push=function(e,t){return this._transformState.needTransform=!1,aa.prototype.push.call(this,e,t)};nt.prototype._transform=function(e,t,i){throw new Error("_transform() is not implemented")};nt.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)}};nt.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};nt.prototype._destroy=function(e,t){var i=this;aa.prototype._destroy.call(this,e,function(n){t(n),i.emit("close")})};function Vd(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 eu=C((i1,Qd)=>{"use strict";Qd.exports=xn;var Zd=uo(),Jd=Object.create(bi());Jd.inherits=vi();Jd.inherits(xn,Zd);function xn(e){if(!(this instanceof xn))return new xn(e);Zd.call(this,e)}xn.prototype._transform=function(e,t,i){i(null,e)}});var po=C((ie,sa)=>{"use strict";var Ne=require("stream");process.env.READABLE_STREAM==="disable"&&Ne?(sa.exports=Ne,ie=sa.exports=Ne.Readable,ie.Readable=Ne.Readable,ie.Writable=Ne.Writable,ie.Duplex=Ne.Duplex,ie.Transform=Ne.Transform,ie.PassThrough=Ne.PassThrough,ie.Stream=Ne):(ie=sa.exports=eo(),ie.Stream=Ne||ie,ie.Readable=ie,ie.Writable=Zs(),ie.Duplex=qt(),ie.Transform=uo(),ie.PassThrough=eu())});var rt=C(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{fo=new ArrayBuffer(0);try{he.blob=new Blob([fo],{type:"application/zip"}).size===0}catch{try{tu=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,ho=new tu,ho.append(fo),he.blob=ho.getBlob("application/zip").size===0}catch{he.blob=!1}}}var fo,tu,ho;try{he.nodestream=!!po().Readable}catch{he.nodestream=!1}});var mo=C(go=>{"use strict";var Vb=Y(),Kb=rt(),Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";go.encode=function(e){for(var t=[],i,n,r,a,s,o,l,c=0,d=e.length,u=d,p=Vb.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(Fe.charAt(a)+Fe.charAt(s)+Fe.charAt(o)+Fe.charAt(l));return t.join("")};go.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)===Fe.charAt(64)&&u--,e.charAt(e.length-2)===Fe.charAt(64)&&u--,u%1!==0)throw new Error("Invalid base64 input, bad content length.");var p;for(Kb.uint8array?p=new Uint8Array(u|0):p=new Array(u|0);l<e.length;)r=Fe.indexOf(e.charAt(l++)),a=Fe.indexOf(e.charAt(l++)),s=Fe.indexOf(e.charAt(l++)),o=Fe.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 wn=C((a1,iu)=>{"use strict";iu.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 su=C((s1,au)=>{"use strict";var nu=global.MutationObserver||global.WebKitMutationObserver,_i;process.browser?nu?(bo=0,ru=new nu(_n),vo=global.document.createTextNode(""),ru.observe(vo,{characterData:!0}),_i=function(){vo.data=bo=++bo%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(yo=new global.MessageChannel,yo.port1.onmessage=_n,_i=function(){yo.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?_i=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){_n(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:_i=function(){setTimeout(_n,0)}:_i=function(){process.nextTick(_n)};var bo,ru,vo,yo,xo,En=[];function _n(){xo=!0;for(var e,t,i=En.length;i;){for(t=En,En=[],e=-1;++e<i;)t[e]();i=En.length}xo=!1}au.exports=Xb;function Xb(e){En.push(e)===1&&!xo&&_i()}});var fu=C((o1,pu)=>{"use strict";var ou=su();function Ei(){}var oe={},lu=["REJECTED"],wo=["FULFILLED"],cu=["PENDING"];process.browser||(Sn=["UNHANDLED"]);var Sn;pu.exports=vt;function vt(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=cu,this.queue=[],this.outcome=void 0,process.browser||(this.handled=Sn),e!==Ei&&du(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===wo||typeof t!="function"&&this.state===lu)return this;var i=new this.constructor(Ei);if(process.browser||this.handled===Sn&&(this.handled=null),this.state!==cu){var n=this.state===wo?e:t;_o(i,n,this.outcome)}else this.queue.push(new An(i,e,t));return i};function An(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)}An.prototype.callFulfilled=function(e){oe.resolve(this.promise,e)};An.prototype.otherCallFulfilled=function(e){_o(this.promise,this.onFulfilled,e)};An.prototype.callRejected=function(e){oe.reject(this.promise,e)};An.prototype.otherCallRejected=function(e){_o(this.promise,this.onRejected,e)};function _o(e,t,i){ou(function(){var n;try{n=t(i)}catch(r){return oe.reject(e,r)}n===e?oe.reject(e,new TypeError("Cannot resolve promise with itself")):oe.resolve(e,n)})}oe.resolve=function(e,t){var i=uu(Zb,t);if(i.status==="error")return oe.reject(e,i.value);var n=i.value;if(n)du(e,n);else{e.state=wo,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};oe.reject=function(e,t){e.state=lu,e.outcome=t,process.browser||e.handled===Sn&&ou(function(){e.handled===Sn&&process.emit("unhandledRejection",t,e)});for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callRejected(t);return e};function Zb(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function du(e,t){var i=!1;function n(o){i||(i=!0,oe.reject(e,o))}function r(o){i||(i=!0,oe.resolve(e,o))}function a(){t(r,n)}var s=uu(a);s.status==="error"&&n(s.value)}function uu(e,t){var i={};try{i.value=e(t),i.status="success"}catch(n){i.status="error",i.value=n}return i}vt.resolve=Jb;function Jb(e){return e instanceof this?e:oe.resolve(new this(Ei),e)}vt.reject=Qb;function Qb(e){var t=new this(Ei);return oe.reject(t,e)}vt.all=ev;function ev(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(Ei);++s<i;)l(e[s],s);return o;function l(c,d){t.resolve(c).then(u,function(p){n||(n=!0,oe.reject(o,p))});function u(p){r[d]=p,++a===i&&!n&&(n=!0,oe.resolve(o,r))}}}vt.race=tv;function tv(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(Ei);++r<i;)s(e[r]);return a;function s(o){t.resolve(o).then(function(l){n||(n=!0,oe.resolve(a,l))},function(l){n||(n=!0,oe.reject(a,l))})}}});var Si=C((l1,hu)=>{"use strict";var Eo=null;typeof Promise!="undefined"?Eo=Promise:Eo=fu();hu.exports={Promise:Eo}});var mu=C(gu=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var i=1,n={},r=!1,a=e.document,s;function o(v){typeof v!="function"&&(v=new Function(""+v));for(var y=new Array(arguments.length-1),x=0;x<y.length;x++)y[x]=arguments[x+1];var w={callback:v,args:y};return n[i]=w,s(i),i++}function l(v){delete n[v]}function c(v){var y=v.callback,x=v.args;switch(x.length){case 0:y();break;case 1:y(x[0]);break;case 2:y(x[0],x[1]);break;case 3:y(x[0],x[1],x[2]);break;default:y.apply(t,x);break}}function d(v){if(r)setTimeout(d,0,v);else{var y=n[v];if(y){r=!0;try{c(y)}finally{l(v),r=!1}}}}function u(){s=function(v){process.nextTick(function(){d(v)})}}function p(){if(e.postMessage&&!e.importScripts){var v=!0,y=e.onmessage;return e.onmessage=function(){v=!1},e.postMessage("","*"),e.onmessage=y,v}}function f(){var v="setImmediate$"+Math.random()+"$",y=function(x){x.source===e&&typeof x.data=="string"&&x.data.indexOf(v)===0&&d(+x.data.slice(v.length))};e.addEventListener?e.addEventListener("message",y,!1):e.attachEvent("onmessage",y),s=function(x){e.postMessage(v+x,"*")}}function m(){var v=new MessageChannel;v.port1.onmessage=function(y){var x=y.data;d(x)},s=function(y){v.port2.postMessage(y)}}function h(){var v=a.documentElement;s=function(y){var x=a.createElement("script");x.onreadystatechange=function(){d(y),x.onreadystatechange=null,v.removeChild(x),x=null},v.appendChild(x)}}function g(){s=function(v){setTimeout(d,0,v)}}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"?gu:global:self)});var Y=C(Z=>{"use strict";var yt=rt(),iv=mo(),Ai=wn(),So=Si();mu();function nv(e){var t=null;return yt.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),la(e,t)}Z.newBlob=function(e,t){Z.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 Cn(e){return e}function la(e,t){for(var i=0;i<e.length;++i)t[i]=e.charCodeAt(i)&255;return t}var oa={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 yt.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return yt.nodebuffer&&String.fromCharCode.apply(null,Ai.allocBuffer(1)).length===1}catch{return!1}})()}};function Tn(e){var t=65536,i=Z.getTypeOf(e),n=!0;if(i==="uint8array"?n=oa.applyCanBeUsed.uint8array:i==="nodebuffer"&&(n=oa.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return oa.stringifyByChunk(e,i,t)}catch{t=Math.floor(t/2)}return oa.stringifyByChar(e)}Z.applyFromCharCode=Tn;function ca(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}var xt={};xt.string={string:Cn,array:function(e){return la(e,new Array(e.length))},arraybuffer:function(e){return xt.string.uint8array(e).buffer},uint8array:function(e){return la(e,new Uint8Array(e.length))},nodebuffer:function(e){return la(e,Ai.allocBuffer(e.length))}};xt.array={string:Tn,array:Cn,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Ai.newBufferFrom(e)}};xt.arraybuffer={string:function(e){return Tn(new Uint8Array(e))},array:function(e){return ca(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:Cn,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Ai.newBufferFrom(new Uint8Array(e))}};xt.uint8array={string:Tn,array:function(e){return ca(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:Cn,nodebuffer:function(e){return Ai.newBufferFrom(e)}};xt.nodebuffer={string:Tn,array:function(e){return ca(e,new Array(e.length))},arraybuffer:function(e){return xt.nodebuffer.uint8array(e).buffer},uint8array:function(e){return ca(e,new Uint8Array(e.length))},nodebuffer:Cn};Z.transformTo=function(e,t){if(t||(t=""),!e)return t;Z.checkSupport(e);var i=Z.getTypeOf(t),n=xt[i][e](t);return n};Z.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("/")};Z.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(yt.nodebuffer&&Ai.isBuffer(e))return"nodebuffer";if(yt.uint8array&&e instanceof Uint8Array)return"uint8array";if(yt.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};Z.checkSupport=function(e){var t=yt[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};Z.MAX_VALUE_16BITS=65535;Z.MAX_VALUE_32BITS=-1;Z.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};Z.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})};Z.inherits=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i};Z.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};Z.prepareContent=function(e,t,i,n,r){var a=So.Promise.resolve(t).then(function(s){var o=yt.blob&&(s instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(s))!==-1);return o&&typeof FileReader!="undefined"?new So.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=Z.getTypeOf(s);return o?(o==="arraybuffer"?s=Z.transformTo("uint8array",s):o==="string"&&(r?s=iv.decode(s):i&&n!==!0&&(s=nv(s))),s):So.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var ge=C((u1,vu)=>{"use strict";function bu(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}bu.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}};vu.exports=bu});var Ti=C(wt=>{"use strict";var Ci=Y(),Gt=rt(),rv=wn(),da=ge(),kn=new Array(256);for(at=0;at<256;at++)kn[at]=at>=252?6:at>=248?5:at>=240?4:at>=224?3:at>=192?2:1;var at;kn[254]=kn[254]=1;var av=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(Gt.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},sv=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+kn[e[i]]>t?i:t},ov=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=kn[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),Ci.applyFromCharCode(s)};wt.utf8encode=function(t){return Gt.nodebuffer?rv.newBufferFrom(t,"utf-8"):av(t)};wt.utf8decode=function(t){return Gt.nodebuffer?Ci.transformTo("nodebuffer",t).toString("utf-8"):(t=Ci.transformTo(Gt.uint8array?"uint8array":"array",t),ov(t))};function ua(){da.call(this,"utf-8 decode"),this.leftOver=null}Ci.inherits(ua,da);ua.prototype.processChunk=function(e){var t=Ci.transformTo(Gt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(Gt.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=sv(t),r=t;n!==t.length&&(Gt.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:wt.utf8decode(r),meta:e.meta})};ua.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:wt.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};wt.Utf8DecodeWorker=ua;function Ao(){da.call(this,"utf-8 encode")}Ci.inherits(Ao,da);Ao.prototype.processChunk=function(e){this.push({data:wt.utf8encode(e.data),meta:e.meta})};wt.Utf8EncodeWorker=Ao});var _u=C((f1,wu)=>{"use strict";var yu=ge(),xu=Y();function Co(e){yu.call(this,"ConvertWorker to "+e),this.destType=e}xu.inherits(Co,yu);Co.prototype.processChunk=function(e){this.push({data:xu.transformTo(this.destType,e.data),meta:e.meta})};wu.exports=Co});var Au=C((h1,Su)=>{"use strict";var Eu=po().Readable,lv=Y();lv.inherits(To,Eu);function To(e,t,i){Eu.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)})}To.prototype._read=function(){this._helper.resume()};Su.exports=To});var ko=C((g1,ku)=>{"use strict";var Wt=Y(),cv=_u(),dv=ge(),uv=mo(),pv=rt(),fv=Si(),Cu=null;if(pv.nodestream)try{Cu=Au()}catch{}function hv(e,t,i){switch(e){case"blob":return Wt.newBlob(Wt.transformTo("arraybuffer",t),i);case"base64":return uv.encode(t);default:return Wt.transformTo(e,t)}}function gv(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 mv(e,t){return new fv.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=hv(s,gv(a,r),o);i(l)}catch(c){n(c)}r=[]}).resume()})}function Tu(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,Wt.checkSupport(n),this._worker=e.pipe(new cv(n)),e.lock()}catch(r){this._worker=new dv("error"),this._worker.error(r)}}Tu.prototype={accumulate:function(e){return mv(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(){Wt.delay(t,arguments,i)}),this},resume:function(){return Wt.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(Wt.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new Cu(this,{objectMode:this._outputType!=="nodebuffer"},e)}};ku.exports=Tu});var Lo=C(Le=>{"use strict";Le.base64=!1;Le.binary=!1;Le.dir=!1;Le.createFolders=!0;Le.date=null;Le.compression=null;Le.compressionOptions=null;Le.comment=null;Le.unixPermissions=null;Le.dosPermissions=null});var Io=C((b1,Lu)=>{"use strict";var pa=Y(),fa=ge(),bv=16*1024;function ki(e){fa.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=pa.getTypeOf(i),t.isPaused||t._tickAndRepeat()},function(i){t.error(i)})}pa.inherits(ki,fa);ki.prototype.cleanUp=function(){fa.prototype.cleanUp.call(this),this.data=null};ki.prototype.resume=function(){return fa.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,pa.delay(this._tickAndRepeat,[],this)),!0):!1};ki.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(pa.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};ki.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=bv,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}})};Lu.exports=ki});var ha=C((v1,Ou)=>{"use strict";var vv=Y();function yv(){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 Iu=yv();function xv(e,t,i,n){var r=Iu,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 wv(e,t,i,n){var r=Iu,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}Ou.exports=function(t,i){if(typeof t=="undefined"||!t.length)return 0;var n=vv.getTypeOf(t)!=="string";return n?xv(i|0,t,t.length,0):wv(i|0,t,t.length,0)}});var Po=C((y1,Ru)=>{"use strict";var Pu=ge(),_v=ha(),Ev=Y();function Oo(){Pu.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Ev.inherits(Oo,Pu);Oo.prototype.processChunk=function(e){this.streamInfo.crc32=_v(e.data,this.streamInfo.crc32||0),this.push(e)};Ru.exports=Oo});var ju=C((x1,Mu)=>{"use strict";var Sv=Y(),Ro=ge();function Mo(e){Ro.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Sv.inherits(Mo,Ro);Mo.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Ro.prototype.processChunk.call(this,e)};Mu.exports=Mo});var ga=C((w1,Bu)=>{"use strict";var Du=Si(),zu=Io(),Av=Po(),jo=ju();function Do(e,t,i,n,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=n,this.compressedContent=r}Do.prototype={getContentWorker:function(){var e=new zu(Du.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new jo("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 zu(Du.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Do.createWorkerFrom=function(e,t,i){return e.pipe(new Av).pipe(new jo("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new jo("compressedSize")).withStreamInfo("compression",t)};Bu.exports=Do});var Hu=C((_1,$u)=>{"use strict";var Cv=ko(),Tv=Io(),zo=Ti(),Bo=ga(),Nu=ge(),No=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}};No.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 zo.Utf8EncodeWorker)),!r&&n&&(t=t.pipe(new zo.Utf8DecodeWorker))}catch(a){t=new Nu("error"),t.error(a)}return new Cv(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 Bo&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new zo.Utf8EncodeWorker)),Bo.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof Bo?this._data.getContentWorker():this._data instanceof Nu?this._data:new Tv(this._data)}};var Fu=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],kv=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(ma=0;ma<Fu.length;ma++)No.prototype[Fu[ma]]=kv;var ma;$u.exports=No});var st=C(ce=>{"use strict";var Lv=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function Iv(e,t){return Object.prototype.hasOwnProperty.call(e,t)}ce.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)Iv(i,n)&&(e[n]=i[n])}}return e};ce.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Ov={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}},Pv={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)}};ce.setTyped=function(e){e?(ce.Buf8=Uint8Array,ce.Buf16=Uint16Array,ce.Buf32=Int32Array,ce.assign(ce,Ov)):(ce.Buf8=Array,ce.Buf16=Array,ce.Buf32=Array,ce.assign(ce,Pv))};ce.setTyped(Lv)});var up=C(Oi=>{"use strict";var Rv=st(),Mv=4,Uu=0,qu=1,jv=2;function Ii(e){for(var t=e.length;--t>=0;)e[t]=0}var Dv=0,Xu=1,zv=2,Bv=3,Nv=258,Wo=29,Mn=256,In=Mn+1+Wo,Li=30,Yo=19,Zu=2*In+1,Yt=15,Fo=16,Fv=7,Vo=256,Ju=16,Qu=17,ep=18,qo=[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],ba=[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],$v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],tp=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Hv=512,ot=new Array((In+2)*2);Ii(ot);var Ln=new Array(Li*2);Ii(Ln);var On=new Array(Hv);Ii(On);var Pn=new Array(Nv-Bv+1);Ii(Pn);var Ko=new Array(Wo);Ii(Ko);var va=new Array(Li);Ii(va);function $o(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 ip,np,rp;function Ho(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function ap(e){return e<256?On[e]:On[256+(e>>>7)]}function Rn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function pe(e,t,i){e.bi_valid>Fo-i?(e.bi_buf|=t<<e.bi_valid&65535,Rn(e,e.bi_buf),e.bi_buf=t>>Fo-e.bi_valid,e.bi_valid+=i-Fo):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function $e(e,t,i){pe(e,i[t*2],i[t*2+1])}function sp(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function Uv(e){e.bi_valid===16?(Rn(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 qv(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<=Yt;p++)e.bl_count[p]=0;for(i[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<Zu;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 op(e,t,i){var n=new Array(Yt+1),r=0,a,s;for(a=1;a<=Yt;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]=sp(n[o]++,o))}}function Gv(){var e,t,i,n,r,a=new Array(Yt+1);for(i=0,n=0;n<Wo-1;n++)for(Ko[n]=i,e=0;e<1<<qo[n];e++)Pn[i++]=n;for(Pn[i-1]=n,r=0,n=0;n<16;n++)for(va[n]=r,e=0;e<1<<ba[n];e++)On[r++]=n;for(r>>=7;n<Li;n++)for(va[n]=r<<7,e=0;e<1<<ba[n]-7;e++)On[256+r++]=n;for(t=0;t<=Yt;t++)a[t]=0;for(e=0;e<=143;)ot[e*2+1]=8,e++,a[8]++;for(;e<=255;)ot[e*2+1]=9,e++,a[9]++;for(;e<=279;)ot[e*2+1]=7,e++,a[7]++;for(;e<=287;)ot[e*2+1]=8,e++,a[8]++;for(op(ot,In+1,a),e=0;e<Li;e++)Ln[e*2+1]=5,Ln[e*2]=sp(e,5);ip=new $o(ot,qo,Mn+1,In,Yt),np=new $o(Ln,ba,0,Li,Yt),rp=new $o(new Array(0),$v,0,Yo,Fv)}function lp(e){var t;for(t=0;t<In;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Li;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Yo;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Vo*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function cp(e){e.bi_valid>8?Rn(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 Wv(e,t,i,n){cp(e),n&&(Rn(e,i),Rn(e,~i)),Rv.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function Gu(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 Uo(e,t,i){for(var n=e.heap[i],r=i<<1;r<=e.heap_len&&(r<e.heap_len&&Gu(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Gu(t,n,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r<<=1;e.heap[i]=n}function Wu(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?$e(e,r,t):(s=Pn[r],$e(e,s+Mn+1,t),o=qo[s],o!==0&&(r-=Ko[s],pe(e,r,o)),n--,s=ap(n),$e(e,s,i),o=ba[s],o!==0&&(n-=va[s],pe(e,n,o)));while(a<e.last_lit);$e(e,Vo,t)}function Go(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=Zu,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--)Uo(e,i,s);c=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Uo(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++,Uo(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],qv(e,t),op(i,l,e.bl_count)}function Yu(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[Ju*2]++):o<=10?e.bl_tree[Qu*2]++:e.bl_tree[ep*2]++,o=0,r=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))}function Vu(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 $e(e,a,e.bl_tree);while(--o!==0);else a!==0?(a!==r&&($e(e,a,e.bl_tree),o--),$e(e,Ju,e.bl_tree),pe(e,o-3,2)):o<=10?($e(e,Qu,e.bl_tree),pe(e,o-3,3)):($e(e,ep,e.bl_tree),pe(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 Yv(e){var t;for(Yu(e,e.dyn_ltree,e.l_desc.max_code),Yu(e,e.dyn_dtree,e.d_desc.max_code),Go(e,e.bl_desc),t=Yo-1;t>=3&&e.bl_tree[tp[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Vv(e,t,i,n){var r;for(pe(e,t-257,5),pe(e,i-1,5),pe(e,n-4,4),r=0;r<n;r++)pe(e,e.bl_tree[tp[r]*2+1],3);Vu(e,e.dyn_ltree,t-1),Vu(e,e.dyn_dtree,i-1)}function Kv(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return Uu;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return qu;for(i=32;i<Mn;i++)if(e.dyn_ltree[i*2]!==0)return qu;return Uu}var Ku=!1;function Xv(e){Ku||(Gv(),Ku=!0),e.l_desc=new Ho(e.dyn_ltree,ip),e.d_desc=new Ho(e.dyn_dtree,np),e.bl_desc=new Ho(e.bl_tree,rp),e.bi_buf=0,e.bi_valid=0,lp(e)}function dp(e,t,i,n){pe(e,(Dv<<1)+(n?1:0),3),Wv(e,t,i,!0)}function Zv(e){pe(e,Xu<<1,3),$e(e,Vo,ot),Uv(e)}function Jv(e,t,i,n){var r,a,s=0;e.level>0?(e.strm.data_type===jv&&(e.strm.data_type=Kv(e)),Go(e,e.l_desc),Go(e,e.d_desc),s=Yv(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?dp(e,t,i,n):e.strategy===Mv||a===r?(pe(e,(Xu<<1)+(n?1:0),3),Wu(e,ot,Ln)):(pe(e,(zv<<1)+(n?1:0),3),Vv(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Wu(e,e.dyn_ltree,e.dyn_dtree)),lp(e),n&&cp(e)}function Qv(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[(Pn[i]+Mn+1)*2]++,e.dyn_dtree[ap(t)*2]++),e.last_lit===e.lit_bufsize-1}Oi._tr_init=Xv;Oi._tr_stored_block=dp;Oi._tr_flush_block=Jv;Oi._tr_tally=Qv;Oi._tr_align=Zv});var Xo=C((A1,pp)=>{"use strict";function ey(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}pp.exports=ey});var Zo=C((C1,fp)=>{"use strict";function ty(){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 iy=ty();function ny(e,t,i,n){var r=iy,a=n+i;e^=-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}fp.exports=ny});var ya=C((T1,hp)=>{"use strict";hp.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 Ep=C(qe=>{"use strict";var de=st(),_e=up(),vp=Xo(),_t=Zo(),ry=ya(),Zt=0,ay=1,sy=3,Tt=4,gp=5,Ue=0,mp=1,Ee=-2,oy=-3,Jo=-5,ly=-1,cy=1,xa=2,dy=3,uy=4,py=0,fy=2,Sa=8,hy=9,gy=15,my=8,by=29,vy=256,el=vy+1+by,yy=30,xy=19,wy=2*el+1,_y=15,D=3,At=258,Ie=At+D+1,Ey=32,Aa=42,tl=69,wa=73,_a=91,Ea=103,Vt=113,Dn=666,te=1,zn=2,Kt=3,Mi=4,Sy=3;function Ct(e,t){return e.msg=ry[t],t}function bp(e){return(e<<1)-(e>4?9:0)}function St(e){for(var t=e.length;--t>=0;)e[t]=0}function Et(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(de.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 ne(e,t){_e._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Et(e.strm)}function z(e,t){e.pending_buf[e.pending++]=t}function jn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Ay(e,t,i,n){var r=e.avail_in;return r>n&&(r=n),r===0?0:(e.avail_in-=r,de.arraySet(t,e.input,e.next_in,r,i),e.state.wrap===1?e.adler=vp(e.adler,t,r,i):e.state.wrap===2&&(e.adler=_t(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function yp(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-Ie?e.strstart-(e.w_size-Ie):0,c=e.window,d=e.w_mask,u=e.prev,p=e.strstart+At,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=At-(p-n),n=p-At,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 Xt(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-Ie)){de.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=Ay(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=D)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+D-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<D)););}while(e.lookahead<Ie&&e.strm.avail_in!==0)}function Cy(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Xt(e),e.lookahead===0&&t===Zt)return te;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,ne(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Ie&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=0,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):(e.strstart>e.block_start&&(ne(e,!1),e.strm.avail_out===0),te)}function Qo(e,t){for(var i,n;;){if(e.lookahead<Ie){if(Xt(e),e.lookahead<Ie&&t===Zt)return te;if(e.lookahead===0)break}if(i=0,e.lookahead>=D&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+D-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-Ie&&(e.match_length=yp(e,i)),e.match_length>=D)if(n=_e._tr_tally(e,e.strstart-e.match_start,e.match_length-D),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=D){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+D-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=_e._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=e.strstart<D-1?e.strstart:D-1,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}function Pi(e,t){for(var i,n,r;;){if(e.lookahead<Ie){if(Xt(e),e.lookahead<Ie&&t===Zt)return te;if(e.lookahead===0)break}if(i=0,e.lookahead>=D&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+D-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=D-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Ie&&(e.match_length=yp(e,i),e.match_length<=5&&(e.strategy===cy||e.match_length===D&&e.strstart-e.match_start>4096)&&(e.match_length=D-1)),e.prev_length>=D&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-D,n=_e._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-D),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+D-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=D-1,e.strstart++,n&&(ne(e,!1),e.strm.avail_out===0))return te}else if(e.match_available){if(n=_e._tr_tally(e,0,e.window[e.strstart-1]),n&&ne(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return te}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=_e._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<D-1?e.strstart:D-1,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}function Ty(e,t){for(var i,n,r,a,s=e.window;;){if(e.lookahead<=At){if(Xt(e),e.lookahead<=At&&t===Zt)return te;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=D&&e.strstart>0&&(r=e.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){a=e.strstart+At;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=At-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=D?(i=_e._tr_tally(e,1,e.match_length-D),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=_e._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=0,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}function ky(e,t){for(var i;;){if(e.lookahead===0&&(Xt(e),e.lookahead===0)){if(t===Zt)return te;break}if(e.match_length=0,i=_e._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ne(e,!1),e.strm.avail_out===0))return te}return e.insert=0,t===Tt?(ne(e,!0),e.strm.avail_out===0?Kt:Mi):e.last_lit&&(ne(e,!1),e.strm.avail_out===0)?te:zn}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 Ri;Ri=[new He(0,0,0,0,Cy),new He(4,4,8,4,Qo),new He(4,5,16,8,Qo),new He(4,6,32,32,Qo),new He(4,4,16,16,Pi),new He(8,16,32,32,Pi),new He(8,16,128,128,Pi),new He(8,32,128,256,Pi),new He(32,128,258,1024,Pi),new He(32,258,258,4096,Pi)];function Ly(e){e.window_size=2*e.w_size,St(e.head),e.max_lazy_match=Ri[e.level].max_lazy,e.good_match=Ri[e.level].good_length,e.nice_match=Ri[e.level].nice_length,e.max_chain_length=Ri[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=D-1,e.match_available=0,e.ins_h=0}function Iy(){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=Sa,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 de.Buf16(wy*2),this.dyn_dtree=new de.Buf16((2*yy+1)*2),this.bl_tree=new de.Buf16((2*xy+1)*2),St(this.dyn_ltree),St(this.dyn_dtree),St(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new de.Buf16(_y+1),this.heap=new de.Buf16(2*el+1),St(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new de.Buf16(2*el+1),St(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 xp(e){var t;return!e||!e.state?Ct(e,Ee):(e.total_in=e.total_out=0,e.data_type=fy,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Aa:Vt,e.adler=t.wrap===2?0:1,t.last_flush=Zt,_e._tr_init(t),Ue)}function wp(e){var t=xp(e);return t===Ue&&Ly(e.state),t}function Oy(e,t){return!e||!e.state||e.state.wrap!==2?Ee:(e.state.gzhead=t,Ue)}function _p(e,t,i,n,r,a){if(!e)return Ee;var s=1;if(t===ly&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>hy||i!==Sa||n<8||n>15||t<0||t>9||a<0||a>uy)return Ct(e,Ee);n===8&&(n=9);var o=new Iy;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+D-1)/D),o.window=new de.Buf8(o.w_size*2),o.head=new de.Buf16(o.hash_size),o.prev=new de.Buf16(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new de.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,wp(e)}function Py(e,t){return _p(e,t,Sa,gy,my,py)}function Ry(e,t){var i,n,r,a;if(!e||!e.state||t>gp||t<0)return e?Ct(e,Ee):Ee;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Dn&&t!==Tt)return Ct(e,e.avail_out===0?Jo:Ee);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===Aa)if(n.wrap===2)e.adler=0,z(n,31),z(n,139),z(n,8),n.gzhead?(z(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)),z(n,n.gzhead.time&255),z(n,n.gzhead.time>>8&255),z(n,n.gzhead.time>>16&255),z(n,n.gzhead.time>>24&255),z(n,n.level===9?2:n.strategy>=xa||n.level<2?4:0),z(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(z(n,n.gzhead.extra.length&255),z(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=_t(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=tl):(z(n,0),z(n,0),z(n,0),z(n,0),z(n,0),z(n,n.level===9?2:n.strategy>=xa||n.level<2?4:0),z(n,Sy),n.status=Vt);else{var s=Sa+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=xa||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=Ey),s+=31-s%31,n.status=Vt,jn(n,s),n.strstart!==0&&(jn(n,e.adler>>>16),jn(n,e.adler&65535)),e.adler=1}if(n.status===tl)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=_t(e.adler,n.pending_buf,n.pending-r,r)),Et(e),r=n.pending,n.pending===n.pending_buf_size));)z(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=wa)}else n.status=wa;if(n.status===wa)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),Et(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,z(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.gzindex=0,n.status=_a)}else n.status=_a;if(n.status===_a)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),Et(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,z(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=_t(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.status=Ea)}else n.status=Ea;if(n.status===Ea&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&Et(e),n.pending+2<=n.pending_buf_size&&(z(n,e.adler&255),z(n,e.adler>>8&255),e.adler=0,n.status=Vt)):n.status=Vt),n.pending!==0){if(Et(e),e.avail_out===0)return n.last_flush=-1,Ue}else if(e.avail_in===0&&bp(t)<=bp(i)&&t!==Tt)return Ct(e,Jo);if(n.status===Dn&&e.avail_in!==0)return Ct(e,Jo);if(e.avail_in!==0||n.lookahead!==0||t!==Zt&&n.status!==Dn){var l=n.strategy===xa?ky(n,t):n.strategy===dy?Ty(n,t):Ri[n.level].func(n,t);if((l===Kt||l===Mi)&&(n.status=Dn),l===te||l===Kt)return e.avail_out===0&&(n.last_flush=-1),Ue;if(l===zn&&(t===ay?_e._tr_align(n):t!==gp&&(_e._tr_stored_block(n,0,0,!1),t===sy&&(St(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Et(e),e.avail_out===0))return n.last_flush=-1,Ue}return t!==Tt?Ue:n.wrap<=0?mp:(n.wrap===2?(z(n,e.adler&255),z(n,e.adler>>8&255),z(n,e.adler>>16&255),z(n,e.adler>>24&255),z(n,e.total_in&255),z(n,e.total_in>>8&255),z(n,e.total_in>>16&255),z(n,e.total_in>>24&255)):(jn(n,e.adler>>>16),jn(n,e.adler&65535)),Et(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ue:mp)}function My(e){var t;return!e||!e.state?Ee:(t=e.state.status,t!==Aa&&t!==tl&&t!==wa&&t!==_a&&t!==Ea&&t!==Vt&&t!==Dn?Ct(e,Ee):(e.state=null,t===Vt?Ct(e,oy):Ue))}function jy(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!==Aa||n.lookahead))return Ee;for(s===1&&(e.adler=vp(e.adler,t,i,0)),n.wrap=0,i>=n.w_size&&(s===0&&(St(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new de.Buf8(n.w_size),de.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,Xt(n);n.lookahead>=D;){r=n.strstart,a=n.lookahead-(D-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+D-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=D-1,Xt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=D-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=o,n.wrap=s,Ue}qe.deflateInit=Py;qe.deflateInit2=_p;qe.deflateReset=wp;qe.deflateResetKeep=xp;qe.deflateSetHeader=Oy;qe.deflate=Ry;qe.deflateEnd=My;qe.deflateSetDictionary=jy;qe.deflateInfo="pako deflate (from Nodeca project)"});var il=C(ji=>{"use strict";var Ca=st(),Sp=!0,Ap=!0;try{String.fromCharCode.apply(null,[0])}catch{Sp=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ap=!1}var Bn=new Ca.Buf8(256);for(lt=0;lt<256;lt++)Bn[lt]=lt>=252?6:lt>=248?5:lt>=240?4:lt>=224?3:lt>=192?2:1;var lt;Bn[254]=Bn[254]=1;ji.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 Ca.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 Cp(e,t){if(t<65534&&(e.subarray&&Ap||!e.subarray&&Sp))return String.fromCharCode.apply(null,Ca.shrinkBuf(e,t));for(var i="",n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i}ji.buf2binstring=function(e){return Cp(e,e.length)};ji.binstring2buf=function(e){for(var t=new Ca.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t};ji.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=Bn[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 Cp(o,n)};ji.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+Bn[e[i]]>t?i:t}});var nl=C((I1,Tp)=>{"use strict";function Dy(){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}Tp.exports=Dy});var Op=C($n=>{"use strict";var Nn=Ep(),Fn=st(),al=il(),sl=ya(),zy=nl(),Ip=Object.prototype.toString,By=0,rl=4,Di=0,kp=1,Lp=2,Ny=-1,Fy=0,$y=8;function Jt(e){if(!(this instanceof Jt))return new Jt(e);this.options=Fn.assign({level:Ny,method:$y,chunkSize:16384,windowBits:15,memLevel:8,strategy:Fy,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 zy,this.strm.avail_out=0;var i=Nn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Di)throw new Error(sl[i]);if(t.header&&Nn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=al.string2buf(t.dictionary):Ip.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,i=Nn.deflateSetDictionary(this.strm,n),i!==Di)throw new Error(sl[i]);this._dict_set=!0}}Jt.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?rl:By,typeof e=="string"?i.input=al.string2buf(e):Ip.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 Fn.Buf8(n),i.next_out=0,i.avail_out=n),r=Nn.deflate(i,a),r!==kp&&r!==Di)return this.onEnd(r),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(a===rl||a===Lp))&&(this.options.to==="string"?this.onData(al.buf2binstring(Fn.shrinkBuf(i.output,i.next_out))):this.onData(Fn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&r!==kp);return a===rl?(r=Nn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Di):(a===Lp&&(this.onEnd(Di),i.avail_out=0),!0)};Jt.prototype.onData=function(e){this.chunks.push(e)};Jt.prototype.onEnd=function(e){e===Di&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ol(e,t){var i=new Jt(t);if(i.push(e,!0),i.err)throw i.msg||sl[i.err];return i.result}function Hy(e,t){return t=t||{},t.raw=!0,ol(e,t)}function Uy(e,t){return t=t||{},t.gzip=!0,ol(e,t)}$n.Deflate=Jt;$n.deflate=ol;$n.deflateRaw=Hy;$n.gzip=Uy});var Rp=C((P1,Pp)=>{"use strict";var Ta=30,qy=12;Pp.exports=function(t,i){var n,r,a,s,o,l,c,d,u,p,f,m,h,g,b,v,y,x,w,S,A,E,k,O,_;n=t.state,r=t.next_in,O=t.input,a=r+(t.avail_in-5),s=t.next_out,_=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,v=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;e:do{h<15&&(m+=O[r++]<<h,h+=8,m+=O[r++]<<h,h+=8),x=g[m&v];t:for(;;){if(w=x>>>24,m>>>=w,h-=w,w=x>>>16&255,w===0)_[s++]=x&65535;else if(w&16){S=x&65535,w&=15,w&&(h<w&&(m+=O[r++]<<h,h+=8),S+=m&(1<<w)-1,m>>>=w,h-=w),h<15&&(m+=O[r++]<<h,h+=8,m+=O[r++]<<h,h+=8),x=b[m&y];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+=O[r++]<<h,h+=8,h<w&&(m+=O[r++]<<h,h+=8)),A+=m&(1<<w)-1,A>c){t.msg="invalid distance too far back",n.mode=Ta;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=Ta;break e}if(E=0,k=f,p===0){if(E+=d-w,w<S){S-=w;do _[s++]=f[E++];while(--w);E=s-A,k=_}}else if(p<w){if(E+=d+p-w,w-=p,w<S){S-=w;do _[s++]=f[E++];while(--w);if(E=0,p<S){w=p,S-=w;do _[s++]=f[E++];while(--w);E=s-A,k=_}}}else if(E+=p-w,w<S){S-=w;do _[s++]=f[E++];while(--w);E=s-A,k=_}for(;S>2;)_[s++]=k[E++],_[s++]=k[E++],_[s++]=k[E++],S-=3;S&&(_[s++]=k[E++],S>1&&(_[s++]=k[E++]))}else{E=s-A;do _[s++]=_[E++],_[s++]=_[E++],_[s++]=_[E++],S-=3;while(S>2);S&&(_[s++]=_[E++],S>1&&(_[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=Ta;break e}break}}else if((w&64)===0){x=g[(x&65535)+(m&(1<<w)-1)];continue t}else if(w&32){n.mode=qy;break e}else{t.msg="invalid literal/length code",n.mode=Ta;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 Fp=C((R1,Np)=>{"use strict";var Mp=st(),zi=15,jp=852,Dp=592,zp=0,ll=1,Bp=2,Gy=[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],Wy=[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],Yy=[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],Vy=[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];Np.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,v=0,y=0,x,w,S,A,E,k=null,O=0,_,T=new Mp.Buf16(zi+1),R=new Mp.Buf16(zi+1),B=null,M=0,L,P,F;for(d=0;d<=zi;d++)T[d]=0;for(u=0;u<r;u++)T[i[n+u]]++;for(m=c,f=zi;f>=1&&T[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&&T[p]===0;p++);for(m<p&&(m=p),b=1,d=1;d<=zi;d++)if(b<<=1,b-=T[d],b<0)return-1;if(b>0&&(t===zp||f!==1))return-1;for(R[1]=0,d=1;d<zi;d++)R[d+1]=R[d]+T[d];for(u=0;u<r;u++)i[n+u]!==0&&(o[R[i[n+u]]++]=u);if(t===zp?(k=B=o,_=19):t===ll?(k=Gy,O-=257,B=Wy,M-=257,_=256):(k=Yy,B=Vy,_=-1),y=0,u=0,d=p,E=s,h=m,g=0,S=-1,v=1<<m,A=v-1,t===ll&&v>jp||t===Bp&&v>Dp)return 1;for(;;){L=d-g,o[u]<_?(P=0,F=o[u]):o[u]>_?(P=B[M+o[u]],F=k[O+o[u]]):(P=96,F=0),x=1<<d-g,w=1<<h,p=w;do w-=x,a[E+(y>>g)+w]=L<<24|P<<16|F|0;while(w!==0);for(x=1<<d-1;y&x;)x>>=1;if(x!==0?(y&=x-1,y+=x):y=0,u++,--T[d]===0){if(d===f)break;d=i[n+o[u]]}if(d>m&&(y&A)!==S){for(g===0&&(g=m),E+=p,h=d-g,b=1<<h;h+g<f&&(b-=T[h+g],!(b<=0));)h++,b<<=1;if(v+=1<<h,t===ll&&v>jp||t===Bp&&v>Dp)return 1;S=y&A,a[S]=m<<24|h<<16|E-s|0}}return y!==0&&(a[E+y]=d-g<<24|64<<16|0),l.bits=m,0}});var _f=C(Oe=>{"use strict";var me=st(),hl=Xo(),Ge=Zo(),Ky=Rp(),Hn=Fp(),Xy=0,ff=1,hf=2,$p=4,Zy=5,ka=6,Qt=0,Jy=1,Qy=2,Se=-2,gf=-3,gl=-4,ex=-5,Hp=8,mf=1,Up=2,qp=3,Gp=4,Wp=5,Yp=6,Vp=7,Kp=8,Xp=9,Zp=10,Oa=11,ct=12,cl=13,Jp=14,dl=15,Qp=16,ef=17,tf=18,nf=19,La=20,Ia=21,rf=22,af=23,sf=24,of=25,lf=26,ul=27,cf=28,df=29,G=30,ml=31,tx=32,ix=852,nx=592,rx=15,ax=rx;function uf(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function sx(){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 bf(e){var t;return!e||!e.state?Se:(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(ix),t.distcode=t.distdyn=new me.Buf32(nx),t.sane=1,t.back=-1,Qt)}function vf(e){var t;return!e||!e.state?Se:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,bf(e))}function yf(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))?Se:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,vf(e))}function xf(e,t){var i,n;return e?(n=new sx,e.state=n,n.window=null,i=yf(e,t),i!==Qt&&(e.state=null),i):Se}function ox(e){return xf(e,ax)}var pf=!0,pl,fl;function lx(e){if(pf){var t;for(pl=new me.Buf32(512),fl=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(Hn(ff,e.lens,0,288,pl,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Hn(hf,e.lens,0,32,fl,0,e.work,{bits:5}),pf=!1}e.lencode=pl,e.lenbits=9,e.distcode=fl,e.distbits=5}function wf(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 cx(e,t){var i,n,r,a,s,o,l,c,d,u,p,f,m,h,g=0,b,v,y,x,w,S,A,E,k=new me.Buf8(4),O,_,T=[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 Se;i=e.state,i.mode===ct&&(i.mode=cl),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,E=Qt;e:for(;;)switch(i.mode){case mf:if(i.wrap===0){i.mode=cl;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,k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0),c=0,d=0,i.mode=Up;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=G;break}if((c&15)!==Hp){e.msg="unknown compression method",i.mode=G;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=G;break}i.dmax=1<<A,e.adler=i.check=1,i.mode=c&512?Zp:ct,c=0,d=0;break;case Up:for(;d<16;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(i.flags=c,(i.flags&255)!==Hp){e.msg="unknown compression method",i.mode=G;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=G;break}i.head&&(i.head.text=c>>8&1),i.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0)),c=0,d=0,i.mode=qp;case qp:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.head&&(i.head.time=c),i.flags&512&&(k[0]=c&255,k[1]=c>>>8&255,k[2]=c>>>16&255,k[3]=c>>>24&255,i.check=Ge(i.check,k,4,0)),c=0,d=0,i.mode=Gp;case Gp: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&&(k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0)),c=0,d=0,i.mode=Wp;case Wp: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&&(k[0]=c&255,k[1]=c>>>8&255,i.check=Ge(i.check,k,2,0)),c=0,d=0}else i.head&&(i.head.extra=null);i.mode=Yp;case Yp: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=Ge(i.check,n,f,a)),o-=f,a+=f,i.length-=f),i.length))break e;i.length=0,i.mode=Vp;case Vp: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=Ge(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=Kp;case Kp: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=Ge(i.check,n,f,a)),o-=f,a+=f,A)break e}else i.head&&(i.head.comment=null);i.mode=Xp;case Xp: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=G;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=ct;break;case Zp:for(;d<32;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}e.adler=i.check=uf(c),c=0,d=0,i.mode=Oa;case Oa: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,Qy;e.adler=i.check=1,i.mode=ct;case ct:if(t===Zy||t===ka)break e;case cl:if(i.last){c>>>=d&7,d-=d&7,i.mode=ul;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=Jp;break;case 1:if(lx(i),i.mode=La,t===ka){c>>>=2,d-=2;break e}break;case 2:i.mode=ef;break;case 3:e.msg="invalid block type",i.mode=G}c>>>=2,d-=2;break;case Jp: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=G;break}if(i.length=c&65535,c=0,d=0,i.mode=dl,t===ka)break e;case dl:i.mode=Qp;case Qp: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=ct;break;case ef: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=G;break}i.have=0,i.mode=tf;case tf:for(;i.have<i.ncode;){for(;d<3;){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}i.lens[T[i.have++]]=c&7,c>>>=3,d-=3}for(;i.have<19;)i.lens[T[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,O={bits:i.lenbits},E=Hn(Xy,i.lens,0,19,i.lencode,0,i.work,O),i.lenbits=O.bits,E){e.msg="invalid code lengths set",i.mode=G;break}i.have=0,i.mode=nf;case nf:for(;i.have<i.nlen+i.ndist;){for(;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(y<16)c>>>=b,d-=b,i.lens[i.have++]=y;else{if(y===16){for(_=b+2;d<_;){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=G;break}A=i.lens[i.have-1],f=3+(c&3),c>>>=2,d-=2}else if(y===17){for(_=b+3;d<_;){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(_=b+7;d<_;){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=G;break}for(;f--;)i.lens[i.have++]=A}}if(i.mode===G)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=G;break}if(i.lenbits=9,O={bits:i.lenbits},E=Hn(ff,i.lens,0,i.nlen,i.lencode,0,i.work,O),i.lenbits=O.bits,E){e.msg="invalid literal/lengths set",i.mode=G;break}if(i.distbits=6,i.distcode=i.distdyn,O={bits:i.distbits},E=Hn(hf,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,O),i.distbits=O.bits,E){e.msg="invalid distances set",i.mode=G;break}if(i.mode=La,t===ka)break e;case La:i.mode=Ia;case Ia: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,Ky(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===ct&&(i.back=-1);break}for(i.back=0;g=i.lencode[c&(1<<i.lenbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if(v&&(v&240)===0){for(x=b,w=v,S=y;g=i.lencode[S+((c&(1<<x+w)-1)>>x)],b=g>>>24,v=g>>>16&255,y=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=y,v===0){i.mode=lf;break}if(v&32){i.back=-1,i.mode=ct;break}if(v&64){e.msg="invalid literal/length code",i.mode=G;break}i.extra=v&15,i.mode=rf;case rf:if(i.extra){for(_=i.extra;d<_;){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=af;case af:for(;g=i.distcode[c&(1<<i.distbits)-1],b=g>>>24,v=g>>>16&255,y=g&65535,!(b<=d);){if(o===0)break e;o--,c+=n[a++]<<d,d+=8}if((v&240)===0){for(x=b,w=v,S=y;g=i.distcode[S+((c&(1<<x+w)-1)>>x)],b=g>>>24,v=g>>>16&255,y=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,v&64){e.msg="invalid distance code",i.mode=G;break}i.offset=y,i.extra=v&15,i.mode=sf;case sf:if(i.extra){for(_=i.extra;d<_;){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=G;break}i.mode=of;case of: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=G;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=Ia);break;case lf:if(l===0)break e;r[s++]=i.length,l--,i.mode=Ia;break;case ul: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?Ge(i.check,r,p,s-p):hl(i.check,r,p,s-p)),p=l,(i.flags?c:uf(c))!==i.check){e.msg="incorrect data check",i.mode=G;break}c=0,d=0}i.mode=cf;case cf: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=G;break}c=0,d=0}i.mode=df;case df:E=Jy;break e;case G:E=gf;break e;case ml:return gl;case tx:default:return Se}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<G&&(i.mode<ul||t!==$p))&&wf(e,e.output,e.next_out,p-e.avail_out)?(i.mode=ml,gl):(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?Ge(i.check,r,p,e.next_out-p):hl(i.check,r,p,e.next_out-p)),e.data_type=i.bits+(i.last?64:0)+(i.mode===ct?128:0)+(i.mode===La||i.mode===dl?256:0),(u===0&&p===0||t===$p)&&E===Qt&&(E=ex),E)}function dx(e){if(!e||!e.state)return Se;var t=e.state;return t.window&&(t.window=null),e.state=null,Qt}function ux(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?Se:(i.head=t,t.done=!1,Qt)}function px(e,t){var i=t.length,n,r,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Oa)?Se:n.mode===Oa&&(r=1,r=hl(r,t,i,0),r!==n.check)?gf:(a=wf(e,t,i,i),a?(n.mode=ml,gl):(n.havedict=1,Qt))}Oe.inflateReset=vf;Oe.inflateReset2=yf;Oe.inflateResetKeep=bf;Oe.inflateInit=ox;Oe.inflateInit2=xf;Oe.inflate=cx;Oe.inflateEnd=dx;Oe.inflateGetHeader=ux;Oe.inflateSetDictionary=px;Oe.inflateInfo="pako inflate (from Nodeca project)"});var bl=C((j1,Ef)=>{"use strict";Ef.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 Af=C((D1,Sf)=>{"use strict";function fx(){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}Sf.exports=fx});var Tf=C(qn=>{"use strict";var Bi=_f(),Un=st(),Pa=il(),K=bl(),vl=ya(),hx=nl(),gx=Af(),Cf=Object.prototype.toString;function ei(e){if(!(this instanceof ei))return new ei(e);this.options=Un.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 hx,this.strm.avail_out=0;var i=Bi.inflateInit2(this.strm,t.windowBits);if(i!==K.Z_OK)throw new Error(vl[i]);if(this.header=new gx,Bi.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Pa.string2buf(t.dictionary):Cf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Bi.inflateSetDictionary(this.strm,t.dictionary),i!==K.Z_OK)))throw new Error(vl[i])}ei.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?K.Z_FINISH:K.Z_NO_FLUSH,typeof e=="string"?i.input=Pa.binstring2buf(e):Cf.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),a=Bi.inflate(i,K.Z_NO_FLUSH),a===K.Z_NEED_DICT&&r&&(a=Bi.inflateSetDictionary(this.strm,r)),a===K.Z_BUF_ERROR&&d===!0&&(a=K.Z_OK,d=!1),a!==K.Z_STREAM_END&&a!==K.Z_OK)return this.onEnd(a),this.ended=!0,!1;i.next_out&&(i.avail_out===0||a===K.Z_STREAM_END||i.avail_in===0&&(s===K.Z_FINISH||s===K.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&&Un.arraySet(i.output,i.output,o,l,0),this.onData(c)):this.onData(Un.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!==K.Z_STREAM_END);return a===K.Z_STREAM_END&&(s=K.Z_FINISH),s===K.Z_FINISH?(a=Bi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===K.Z_OK):(s===K.Z_SYNC_FLUSH&&(this.onEnd(K.Z_OK),i.avail_out=0),!0)};ei.prototype.onData=function(e){this.chunks.push(e)};ei.prototype.onEnd=function(e){e===K.Z_OK&&(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 yl(e,t){var i=new ei(t);if(i.push(e,!0),i.err)throw i.msg||vl[i.err];return i.result}function mx(e,t){return t=t||{},t.raw=!0,yl(e,t)}qn.Inflate=ei;qn.inflate=yl;qn.inflateRaw=mx;qn.ungzip=yl});var If=C((B1,Lf)=>{"use strict";var bx=st().assign,vx=Op(),yx=Tf(),xx=bl(),kf={};bx(kf,vx,yx,xx);Lf.exports=kf});var Pf=C(Ma=>{"use strict";var wx=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",_x=If(),Of=Y(),Ra=ge(),Ex=wx?"uint8array":"array";Ma.magic="\b\0";function ti(e,t){Ra.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Of.inherits(ti,Ra);ti.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Of.transformTo(Ex,e.data),!1)};ti.prototype.flush=function(){Ra.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};ti.prototype.cleanUp=function(){Ra.prototype.cleanUp.call(this),this._pako=null};ti.prototype._createPako=function(){this._pako=new _x[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Ma.compressWorker=function(e){return new ti("Deflate",e)};Ma.uncompressWorker=function(){return new ti("Inflate",{})}});var wl=C(xl=>{"use strict";var Rf=ge();xl.STORE={magic:"\0\0",compressWorker:function(){return new Rf("STORE compression")},uncompressWorker:function(){return new Rf("STORE decompression")}};xl.DEFLATE=Pf()});var _l=C(ii=>{"use strict";ii.LOCAL_FILE_HEADER="PK";ii.CENTRAL_FILE_HEADER="PK";ii.CENTRAL_DIRECTORY_END="PK";ii.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";ii.ZIP64_CENTRAL_DIRECTORY_END="PK";ii.DATA_DESCRIPTOR="PK\x07\b"});var zf=C((H1,Df)=>{"use strict";var Ni=Y(),Fi=ge(),El=Ti(),Mf=ha(),ja=_l(),U=function(e,t){var i="",n;for(n=0;n<t;n++)i+=String.fromCharCode(e&255),e=e>>>8;return i},Sx=function(e,t){var i=e;return e||(i=t?16893:33204),(i&65535)<<16},Ax=function(e){return(e||0)&63},jf=function(e,t,i,n,r,a){var s=e.file,o=e.compression,l=a!==El.utf8encode,c=Ni.transformTo("string",a(s.name)),d=Ni.transformTo("string",El.utf8encode(s.name)),u=s.comment,p=Ni.transformTo("string",a(u)),f=Ni.transformTo("string",El.utf8encode(u)),m=d.length!==s.name.length,h=f.length!==u.length,g,b,v="",y="",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 E=0;t&&(E|=8),!l&&(m||h)&&(E|=2048);var k=0,O=0;w&&(k|=16),r==="UNIX"?(O=798,k|=Sx(s.unixPermissions,w)):(O=20,k|=Ax(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&&(y=U(1,1)+U(Mf(c),4)+d,v+="up"+U(y.length,2)+y),h&&(x=U(1,1)+U(Mf(p),4)+f,v+="uc"+U(x.length,2)+x);var _="";_+=`
|
|
2
|
+
\0`,_+=U(E,2),_+=o.magic,_+=U(g,2),_+=U(b,2),_+=U(A.crc32,4),_+=U(A.compressedSize,4),_+=U(A.uncompressedSize,4),_+=U(c.length,2),_+=U(v.length,2);var T=ja.LOCAL_FILE_HEADER+_+c+v,R=ja.CENTRAL_FILE_HEADER+U(O,2)+_+U(p.length,2)+"\0\0\0\0"+U(k,4)+U(n,4)+c+v+p;return{fileRecord:T,dirRecord:R}},Cx=function(e,t,i,n,r){var a="",s=Ni.transformTo("string",r(n));return a=ja.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},Tx=function(e){var t="";return t=ja.DATA_DESCRIPTOR+U(e.crc32,4)+U(e.compressedSize,4)+U(e.uncompressedSize,4),t};function Pe(e,t,i,n){Fi.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(Pe,Fi);Pe.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,Fi.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-n-1))/i:100}}))};Pe.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=jf(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Pe.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=jf(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:Tx(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};Pe.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=Cx(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};Pe.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};Pe.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};Pe.prototype.resume=function(){if(!Fi.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};Pe.prototype.error=function(e){var t=this._sources;if(!Fi.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch{}return!0};Pe.prototype.lock=function(){Fi.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Df.exports=Pe});var Nf=C(Bf=>{"use strict";var kx=wl(),Lx=zf(),Ix=function(e,t){var i=e||t,n=kx[i];if(!n)throw new Error(i+" is not a valid compression method !");return n};Bf.generateWorker=function(e,t,i){var n=new Lx(t.streamFiles,i,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,s){r++;var o=Ix(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 $f=C((q1,Ff)=>{"use strict";var Ox=Y(),Da=ge();function Gn(e,t){Da.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Ox.inherits(Gn,Da);Gn.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()})};Gn.prototype.pause=function(){return Da.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Gn.prototype.resume=function(){return Da.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Ff.exports=Gn});var Zf=C((G1,Xf)=>{"use strict";var Px=Ti(),Wn=Y(),Gf=ge(),Rx=ko(),Wf=Lo(),Hf=ga(),Mx=Hu(),jx=Nf(),Uf=wn(),Dx=$f(),Yf=function(e,t,i){var n=Wn.getTypeOf(t),r,a=Wn.extend(i||{},Wf);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=Vf(e)),a.createFolders&&(r=zx(e))&&Kf.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 Hf&&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 Hf||t instanceof Gf?l=t:Uf.isNode&&Uf.isStream(t)?l=new Dx(e,t):l=Wn.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var c=new Mx(e,l,a);this.files[e]=c},zx=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},Vf=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},Kf=function(e,t){return t=typeof t!="undefined"?t:Wf.createFolders,e=Vf(e),this.files[e]||Yf.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function qf(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var Bx={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(qf(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,Yf.call(this,e,t,i);return this},folder:function(e){if(!e)return this;if(qf(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,i=Kf.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=Wn.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Px.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.");Wn.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=jx.generateWorker(this,i,n)}catch(r){t=new Gf("error"),t.error(r)}return new Rx(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)}};Xf.exports=Bx});var Sl=C((W1,Qf)=>{"use strict";var Nx=Y();function Jf(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}Jf.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 Nx.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))}};Qf.exports=Jf});var Al=C((Y1,th)=>{"use strict";var eh=Sl(),Fx=Y();function $i(e){eh.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}Fx.inherits($i,eh);$i.prototype.byteAt=function(e){return this.data[this.zero+e]};$i.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};$i.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]};$i.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};th.exports=$i});var rh=C((V1,nh)=>{"use strict";var ih=Sl(),$x=Y();function Hi(e){ih.call(this,e)}$x.inherits(Hi,ih);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};nh.exports=Hi});var Tl=C((K1,sh)=>{"use strict";var ah=Al(),Hx=Y();function Cl(e){ah.call(this,e)}Hx.inherits(Cl,ah);Cl.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};sh.exports=Cl});var ch=C((X1,lh)=>{"use strict";var oh=Tl(),Ux=Y();function kl(e){oh.call(this,e)}Ux.inherits(kl,oh);kl.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};lh.exports=kl});var Ll=C((Z1,uh)=>{"use strict";var za=Y(),dh=rt(),qx=Al(),Gx=rh(),Wx=ch(),Yx=Tl();uh.exports=function(e){var t=za.getTypeOf(e);return za.checkSupport(t),t==="string"&&!dh.uint8array?new Gx(e):t==="nodebuffer"?new Wx(e):dh.uint8array?new Yx(za.transformTo("uint8array",e)):new qx(za.transformTo("array",e))}});var gh=C((J1,hh)=>{"use strict";var Il=Ll(),kt=Y(),Vx=ga(),ph=ha(),Ba=Ti(),Na=wl(),Kx=rt(),Xx=0,Zx=3,Jx=function(e){for(var t in Na)if(Object.prototype.hasOwnProperty.call(Na,t)&&Na[t].magic===e)return Na[t];return null};function fh(e,t){this.options=e,this.loadOptions=t}fh.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=Jx(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+kt.pretty(this.compressionMethod)+" unknown (inner file : "+kt.transformTo("string",this.fileName)+")");this.decompressed=new Vx(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===Xx&&(this.dosPermissions=this.externalFileAttributes&63),e===Zx&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Il(this.extraFields[1].value);this.uncompressedSize===kt.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===kt.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===kt.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===kt.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=Kx.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Ba.utf8decode(this.fileName),this.fileCommentStr=Ba.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var i=kt.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var r=kt.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Il(e.value);return t.readInt(1)!==1||ph(this.fileName)!==t.readInt(4)?null:Ba.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Il(e.value);return t.readInt(1)!==1||ph(this.fileComment)!==t.readInt(4)?null:Ba.utf8decode(t.readData(e.length-5))}return null}};hh.exports=fh});var vh=C((Q1,bh)=>{"use strict";var Qx=Ll(),dt=Y(),Re=_l(),ew=gh(),tw=rt();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 ("+dt.pretty(t)+", expected "+dt.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=tw.uint8array?"uint8array":"array",i=dt.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(Re.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(Re.CENTRAL_FILE_HEADER);)e=new ew({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(Re.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,Re.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(Re.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===dt.MAX_VALUE_16BITS||this.diskWithCentralDirStart===dt.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===dt.MAX_VALUE_16BITS||this.centralDirRecords===dt.MAX_VALUE_16BITS||this.centralDirSize===dt.MAX_VALUE_32BITS||this.centralDirOffset===dt.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(Re.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(Re.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,Re.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(Re.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(Re.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,Re.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=Qx(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};bh.exports=mh});var wh=C((eE,xh)=>{"use strict";var Ol=Y(),Fa=Si(),iw=Ti(),nw=vh(),rw=Po(),yh=wn();function aw(e){return new Fa.Promise(function(t,i){var n=e.decompressed.getContentWorker().pipe(new rw);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()})}xh.exports=function(e,t){var i=this;return t=Ol.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:iw.utf8decode}),yh.isNode&&yh.isStream(e)?Fa.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):Ol.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var r=new nw(t);return r.load(n),r}).then(function(r){var a=[Fa.Promise.resolve(r)],s=r.files;if(t.checkCRC32)for(var o=0;o<s.length;o++)a.push(aw(s[o]));return Fa.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=Ol.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 Eh=C((tE,_h)=>{"use strict";function Ae(){if(!(this instanceof Ae))return new Ae;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 Ae;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}Ae.prototype=Zf();Ae.prototype.loadAsync=wh();Ae.support=rt();Ae.defaults=Lo();Ae.version="3.10.1";Ae.loadAsync=function(e,t){return new Ae().loadAsync(e,t)};Ae.external=Si();_h.exports=Ae});var cg={};rn(cg,{AssetEditorModal:()=>rc});var rc,ac=Ye(()=>{"use strict";rc=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 zw={};rn(zw,{ConfigWatcher:()=>$t,DebugPanel:()=>Jn,DefaultReloadStrategy:()=>un,Handler:()=>Me,PreviewShell:()=>Ja,applyConfigOverride:()=>xe,applyConfigOverrides:()=>Bt,applyConfigsToDisk:()=>Tr,applyDefaults:()=>Ft,baseLottie:()=>gs,bootstrap:()=>Cw,clearConfigOverrides:()=>cn,clearConfigOverridesForObject:()=>ad,configOverrideManager:()=>sd,createPreviewShell:()=>lc,deepClone:()=>ue,default:()=>Mt,defaultPreset:()=>jr,deviceGroups:()=>$s,devicePresets:()=>Fs,diffConfigs:()=>Ms,exportConfigsAsJSON:()=>ks,getConfigOverrides:()=>fe,getConfigStateSummary:()=>Cr,getOverrideMode:()=>Er,getPresetById:()=>Ht,getPresetsByCategory:()=>Am,loadAllObjectConfigs:()=>Ir,loadComponentSchemas:()=>Or,loadEngineConfig:()=>Pr,loadGamePromptConfig:()=>Is,loadObjectCentricConfig:()=>et,loadObjectConfig:()=>bt,loadSceneConfig:()=>Rr,rehydrateObject:()=>js,removeConfigOverride:()=>Ar,resetToApplied:()=>dn,resetToOriginal:()=>kr,setBootstrapDependencies:()=>Sw,setOverrideMode:()=>Sr,setupHotReload:()=>Bs,setupLiveEditBridge:()=>Qa,toLegacyFormat:()=>Ps,validateObjectConfig:()=>hi});module.exports=Bg(zw);var ht={};function cr(e,t,i=!1){ht[e]||(ht[e]=[]),ht[e].push({fn:t,once:i})}function us(e,t){if(ht[e]){if(!t){delete ht[e];return}ht[e]=ht[e].filter(i=>i.fn!==t)}}function dr(e,...t){let i=ht[e];if(i)for(let n of[...i])n.fn(...t),n.once&&us(e,n.fn)}function be(e,t){cr(e,t,!0)}var Q=null,Te=[],di=null;function Cc(e){Q=e,Te=[],di!==null&&(clearTimeout(di),di=null)}function Tc(){var e,t,i;return{endpoint:(Q==null?void 0:Q.endpoint)||"",transport:(Q==null?void 0:Q.transport)||"beacon",batchSize:(e=Q==null?void 0:Q.batchSize)!=null?e:10,flushIntervalMs:(t=Q==null?void 0:Q.flushIntervalMs)!=null?t:300,maxQueue:(i=Q==null?void 0:Q.maxQueue)!=null?i:200,debug:!!(Q!=null&&Q.debug)}}async function Sc(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 ps(e,t){let i=Tc();if(t&&i.endpoint){if(Te.push(e),Te.length>i.maxQueue&&(Te=Te.slice(Te.length-i.maxQueue)),Te.length>=i.batchSize){Ac();return}di===null&&(di=window.setTimeout(()=>{di=null,Ac()},i.flushIntervalMs))}}async function Ac(){let e=Tc();if(!e.endpoint||Te.length===0)return;let t=Te.splice(0,e.batchSize);await Sc(e.endpoint,{events:t},e.transport,e.debug),Te.length>0&&await Sc(e.endpoint,{events:Te.splice(0,e.batchSize)},e.transport,e.debug)}var ve=0,Ng=ve++,kc=ve++,Lc=ve++,Oc=ve++,Ic=ve++,Pc=ve++,Rc=ve++,Mc=ve++,jc=ve++,Dc=ve++,zc=ve++,Bc=ve++,V=Ng;function Nc(){return V===kc}function Fc(){return V===Lc}function $c(){return V===Oc}function Hc(){return V===Ic}function ui(){return V===Pc}function pi(){return V===Rc}function Uc(){return V===Mc}function qc(){return V===jc}function Gc(){return V===Dc}function fs(){return V===zc}function hs(){return V===Bc}function Wc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),V=kc;return}catch{}else if(e==="dapi")try{dapi.isReady(),V=Lc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(V=Oc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(V=Ic)}catch{}else if(t==="mintegral")window.gameReady&&(V=Pc);else if(t==="tapjoy")window.TJ_API&&(V=Rc);else if(t==="tiktok")window.openAppStore&&(V=Mc);else if(t==="smadex")try{window.smxTracking&&(V=jc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(V=Dc)}catch{}else t==="vungle"?V=zc:(e==="nucleo"||t==="nucleo")&&(V=Bc)}var ur=ci(require("lottie-web"),1),gs=ur.default;typeof window!="undefined"&&(window.lottie=ur.default,window.__baseLottie=ur.default);var Fg=require("pixi.js");var ms=require("pixi.js");var $g=null;function bs(e){$g=e}pr();vs();var an=require("pixi.js");pr();var Yg=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",_s=Yg;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&&(_s=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${_s}`))}}catch{}var mt=class{static async create(t,i,n){var l,c,d,u,p,f,m;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${_s}`);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 Dt.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 v=await fetch(b);if(v.ok){o=await v.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 Xg=ci(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Xg);fi();var fr=require("pixi.js");fi();var As=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 mt.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 mt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},Zg=new As,Jg=new Proxy(Zg,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});fi();var Jc=require("pixi.js"),Ze={width:400,height:600,designWidth:400,scaleFactor:1},gr={scale:1,position:1},Ts=[];function em(e,t,i,n,r,a,s){Ts.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function tm(){Ts.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Ze.scaleFactor;i(e,Ze.width,Ze.height,n,r,!0,!1)})}function Cs(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Ze.width=e,Ze.height=t,Ze.scaleFactor=Math.min(e/Ze.designWidth,1.15),gr.scale=Ze.scaleFactor,gr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${gr.scale.toFixed(3)}`),tm()}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 im(e,t,i){let n=ln[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function nm(){return ln}var rm={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 hr(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function mr(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:hr(e[0],t.x),y:hr(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:hr(n.x,t.x),y:hr(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=rm[n])!=null?i:t}return t}function Qc(e,t,i,n={}){var f,m,h,g,b,v;let r=mr(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=((v=a.bottom)!=null?v: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 ed(e,t,i,n={}){var h,g,b,v,y,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=((v=r.right)!=null?v:0)+a.x,l=((y=r.top)!=null?y: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=mr(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,Cs(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Cs(window.innerWidth,window.innerHeight),window.updateDebugConfig=im,window.getDebugConfig=nm,window.copyConfig=gm,window.applyConfig=on,window.applyConfigForRatio=mm,window.positionAtBottom=td,window.positionAtTop=om,window.positionAtCenter=lm,window.positionAtLeft=cm,window.positionAtRight=dm,window.positionAtBottomLeft=um,window.positionAtBottomRight=pm,window.positionAtTopLeft=fm,window.positionAtTopRight=hm,window.applyPositionContract=sm,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 br(e,t,i=0){return e*t+i}function vr(e,t,i=0){return e*(1-t)+i}function yr(e,t,i=0){return e*t+i}function xr(e,t,i=0){return e*(1-t)+i}function ye(e,t=0){return e/2+t}function am(e,t){return e*t}function sm(e,t,i,n){var s,o,l,c,d,u,p,f,m,h,g,b,v,y,x,w,S,A,E,k;let r=0,a=0;switch(n.type){case"top":r=ye(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=br(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ye(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=vr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=yr(t,n.percent,(h=(m=n.offset)==null?void 0:m.x)!=null?h:0),a=ye(i,(b=(g=n.offset)==null?void 0:g.y)!=null?b:0);break;case"right":r=xr(t,n.percent,(y=(v=n.offset)==null?void 0:v.x)!=null?y:0),a=ye(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ye(t,(A=(S=n.offset)==null?void 0:S.x)!=null?A:0),a=ye(i,(k=(E=n.offset)==null?void 0:E.y)!=null?k: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 td(e,t,i,n=.2,r=1,a=!0,s=!1){let o=am(i,n),l=vr(i,n/2);Je(e,ye(t),l);let c=a?r*Ze.scaleFactor:r;Qe(e,c),s&&!Ts.find(d=>d.element===e)&&em(e,td,t,i,n,r,a)}function om(e,t,i,n=.1,r=1){Je(e,ye(t),br(i,n)),Qe(e,r)}function lm(e,t,i,n=0,r=0,a=1){Je(e,ye(t,n),ye(i,r)),Qe(e,a)}function cm(e,t,i,n=.1,r=1){Je(e,yr(t,n),ye(i)),Qe(e,r)}function dm(e,t,i,n=.1,r=1){Je(e,xr(t,n),ye(i)),Qe(e,r)}function um(e,t,i,n=.05,r=.05,a=1){Je(e,yr(t,r),vr(i,n)),Qe(e,a)}function pm(e,t,i,n=.05,r=.05,a=1){Je(e,xr(t,r),vr(i,n)),Qe(e,a)}function fm(e,t,i,n=.05,r=.05,a=1){Je(e,yr(t,r),br(i,n)),Qe(e,a)}function hm(e,t,i,n=.05,r=.05,a=1){Je(e,xr(t,r),br(i,n)),Qe(e,a)}function Je(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 Qe(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 zt={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 gm(e){return e&&zt[e]?JSON.parse(JSON.stringify(zt[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 mm(e,t){let i=e/t;i>1.6?(on(zt.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(on(zt.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(on(zt.square),console.log("Applied SQUARE config for ratio:",i)):(on(zt.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=zt,e.resolveAnchorVec2=e.resolveAnchorVec2||mr,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Qc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||ed}Mr();function ee(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var o_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:ee(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:ee(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:ee(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:ee(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:ee(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:ee(360,780)}],l_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:ee(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:ee(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:ee(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:ee(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:ee(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:ee(412,915)}],c_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:ee(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:ee(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:ee(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:ee(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:ee(800,1280)}],Ns=[{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:ee(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:ee(768,1024),mraidScale:.7}];var Fs=[...Ns],$s=[{category:"playable",label:"Playable Ad",devices:Ns}],jr=Ns[0];function Ht(e){return Fs.find(t=>t.id===e)||jr}function Am(e){return Fs.filter(t=>t.category===e)}var Dr=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.filterMode="all"}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 zw={};rn(zw,{ConfigWatcher:()=>$t,DebugPanel:()=>Jn,DefaultReloadStrategy:()=>un,Handler:()=>Me,PreviewShell:()=>Ja,applyConfigOverride:()=>xe,applyConfigOverrides:()=>Bt,applyConfigsToDisk:()=>Tr,applyDefaults:()=>Ft,baseLottie:()=>gs,bootstrap:()=>Cw,clearConfigOverrides:()=>cn,clearConfigOverridesForObject:()=>ad,configOverrideManager:()=>sd,createPreviewShell:()=>lc,deepClone:()=>ue,default:()=>Mt,defaultPreset:()=>jr,deviceGroups:()=>$s,devicePresets:()=>Fs,diffConfigs:()=>Ms,exportConfigsAsJSON:()=>ks,getConfigOverrides:()=>fe,getConfigStateSummary:()=>Cr,getOverrideMode:()=>Er,getPresetById:()=>Ht,getPresetsByCategory:()=>Am,loadAllObjectConfigs:()=>Or,loadComponentSchemas:()=>Ir,loadEngineConfig:()=>Pr,loadGamePromptConfig:()=>Os,loadObjectCentricConfig:()=>et,loadObjectConfig:()=>bt,loadSceneConfig:()=>Rr,rehydrateObject:()=>js,removeConfigOverride:()=>Ar,resetToApplied:()=>dn,resetToOriginal:()=>kr,setBootstrapDependencies:()=>Sw,setOverrideMode:()=>Sr,setupHotReload:()=>Bs,setupLiveEditBridge:()=>Qa,toLegacyFormat:()=>Ps,validateObjectConfig:()=>hi});module.exports=Bg(zw);var ht={};function cr(e,t,i=!1){ht[e]||(ht[e]=[]),ht[e].push({fn:t,once:i})}function us(e,t){if(ht[e]){if(!t){delete ht[e];return}ht[e]=ht[e].filter(i=>i.fn!==t)}}function dr(e,...t){let i=ht[e];if(i)for(let n of[...i])n.fn(...t),n.once&&us(e,n.fn)}function be(e,t){cr(e,t,!0)}var Q=null,Te=[],di=null;function Cc(e){Q=e,Te=[],di!==null&&(clearTimeout(di),di=null)}function Tc(){var e,t,i;return{endpoint:(Q==null?void 0:Q.endpoint)||"",transport:(Q==null?void 0:Q.transport)||"beacon",batchSize:(e=Q==null?void 0:Q.batchSize)!=null?e:10,flushIntervalMs:(t=Q==null?void 0:Q.flushIntervalMs)!=null?t:300,maxQueue:(i=Q==null?void 0:Q.maxQueue)!=null?i:200,debug:!!(Q!=null&&Q.debug)}}async function Sc(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 ps(e,t){let i=Tc();if(t&&i.endpoint){if(Te.push(e),Te.length>i.maxQueue&&(Te=Te.slice(Te.length-i.maxQueue)),Te.length>=i.batchSize){Ac();return}di===null&&(di=window.setTimeout(()=>{di=null,Ac()},i.flushIntervalMs))}}async function Ac(){let e=Tc();if(!e.endpoint||Te.length===0)return;let t=Te.splice(0,e.batchSize);await Sc(e.endpoint,{events:t},e.transport,e.debug),Te.length>0&&await Sc(e.endpoint,{events:Te.splice(0,e.batchSize)},e.transport,e.debug)}var ve=0,Ng=ve++,kc=ve++,Lc=ve++,Ic=ve++,Oc=ve++,Pc=ve++,Rc=ve++,Mc=ve++,jc=ve++,Dc=ve++,zc=ve++,Bc=ve++,V=Ng;function Nc(){return V===kc}function Fc(){return V===Lc}function $c(){return V===Ic}function Hc(){return V===Oc}function ui(){return V===Pc}function pi(){return V===Rc}function Uc(){return V===Mc}function qc(){return V===jc}function Gc(){return V===Dc}function fs(){return V===zc}function hs(){return V===Bc}function Wc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),V=kc;return}catch{}else if(e==="dapi")try{dapi.isReady(),V=Lc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(V=Ic)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(V=Oc)}catch{}else if(t==="mintegral")window.gameReady&&(V=Pc);else if(t==="tapjoy")window.TJ_API&&(V=Rc);else if(t==="tiktok")window.openAppStore&&(V=Mc);else if(t==="smadex")try{window.smxTracking&&(V=jc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(V=Dc)}catch{}else t==="vungle"?V=zc:(e==="nucleo"||t==="nucleo")&&(V=Bc)}var ur=ci(require("lottie-web"),1),gs=ur.default;typeof window!="undefined"&&(window.lottie=ur.default,window.__baseLottie=ur.default);var Fg=require("pixi.js");var ms=require("pixi.js");var $g=null;function bs(e){$g=e}pr();vs();var an=require("pixi.js");pr();var Yg=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",_s=Yg;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&&(_s=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${_s}`))}}catch{}var mt=class{static async create(t,i,n){var l,c,d,u,p,f,m;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${_s}`);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 Dt.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 v=await fetch(b);if(v.ok){o=await v.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 Xg=ci(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Xg);fi();var fr=require("pixi.js");fi();var As=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 mt.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 mt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},Zg=new As,Jg=new Proxy(Zg,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});fi();var Jc=require("pixi.js"),Ze={width:400,height:600,designWidth:400,scaleFactor:1},gr={scale:1,position:1},Ts=[];function em(e,t,i,n,r,a,s){Ts.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function tm(){Ts.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Ze.scaleFactor;i(e,Ze.width,Ze.height,n,r,!0,!1)})}function Cs(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Ze.width=e,Ze.height=t,Ze.scaleFactor=Math.min(e/Ze.designWidth,1.15),gr.scale=Ze.scaleFactor,gr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${gr.scale.toFixed(3)}`),tm()}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 im(e,t,i){let n=ln[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function nm(){return ln}var rm={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 hr(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function mr(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:hr(e[0],t.x),y:hr(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:hr(n.x,t.x),y:hr(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=rm[n])!=null?i:t}return t}function Qc(e,t,i,n={}){var f,m,h,g,b,v;let r=mr(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=((v=a.bottom)!=null?v: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 ed(e,t,i,n={}){var h,g,b,v,y,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=((v=r.right)!=null?v:0)+a.x,l=((y=r.top)!=null?y: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=mr(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,Cs(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Cs(window.innerWidth,window.innerHeight),window.updateDebugConfig=im,window.getDebugConfig=nm,window.copyConfig=gm,window.applyConfig=on,window.applyConfigForRatio=mm,window.positionAtBottom=td,window.positionAtTop=om,window.positionAtCenter=lm,window.positionAtLeft=cm,window.positionAtRight=dm,window.positionAtBottomLeft=um,window.positionAtBottomRight=pm,window.positionAtTopLeft=fm,window.positionAtTopRight=hm,window.applyPositionContract=sm,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 br(e,t,i=0){return e*t+i}function vr(e,t,i=0){return e*(1-t)+i}function yr(e,t,i=0){return e*t+i}function xr(e,t,i=0){return e*(1-t)+i}function ye(e,t=0){return e/2+t}function am(e,t){return e*t}function sm(e,t,i,n){var s,o,l,c,d,u,p,f,m,h,g,b,v,y,x,w,S,A,E,k;let r=0,a=0;switch(n.type){case"top":r=ye(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=br(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ye(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=vr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=yr(t,n.percent,(h=(m=n.offset)==null?void 0:m.x)!=null?h:0),a=ye(i,(b=(g=n.offset)==null?void 0:g.y)!=null?b:0);break;case"right":r=xr(t,n.percent,(y=(v=n.offset)==null?void 0:v.x)!=null?y:0),a=ye(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ye(t,(A=(S=n.offset)==null?void 0:S.x)!=null?A:0),a=ye(i,(k=(E=n.offset)==null?void 0:E.y)!=null?k: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 td(e,t,i,n=.2,r=1,a=!0,s=!1){let o=am(i,n),l=vr(i,n/2);Je(e,ye(t),l);let c=a?r*Ze.scaleFactor:r;Qe(e,c),s&&!Ts.find(d=>d.element===e)&&em(e,td,t,i,n,r,a)}function om(e,t,i,n=.1,r=1){Je(e,ye(t),br(i,n)),Qe(e,r)}function lm(e,t,i,n=0,r=0,a=1){Je(e,ye(t,n),ye(i,r)),Qe(e,a)}function cm(e,t,i,n=.1,r=1){Je(e,yr(t,n),ye(i)),Qe(e,r)}function dm(e,t,i,n=.1,r=1){Je(e,xr(t,n),ye(i)),Qe(e,r)}function um(e,t,i,n=.05,r=.05,a=1){Je(e,yr(t,r),vr(i,n)),Qe(e,a)}function pm(e,t,i,n=.05,r=.05,a=1){Je(e,xr(t,r),vr(i,n)),Qe(e,a)}function fm(e,t,i,n=.05,r=.05,a=1){Je(e,yr(t,r),br(i,n)),Qe(e,a)}function hm(e,t,i,n=.05,r=.05,a=1){Je(e,xr(t,r),br(i,n)),Qe(e,a)}function Je(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 Qe(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 zt={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 gm(e){return e&&zt[e]?JSON.parse(JSON.stringify(zt[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 mm(e,t){let i=e/t;i>1.6?(on(zt.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(on(zt.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(on(zt.square),console.log("Applied SQUARE config for ratio:",i)):(on(zt.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=zt,e.resolveAnchorVec2=e.resolveAnchorVec2||mr,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Qc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||ed}Mr();function ee(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var o_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:ee(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:ee(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:ee(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:ee(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:ee(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:ee(360,780)}],l_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:ee(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:ee(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:ee(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:ee(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:ee(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:ee(412,915)}],c_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:ee(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:ee(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:ee(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:ee(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:ee(800,1280)}],Ns=[{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:ee(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:ee(768,1024),mraidScale:.7}];var Fs=[...Ns],$s=[{category:"playable",label:"Playable Ad",devices:Ns}],jr=Ns[0];function Ht(e){return Fs.find(t=>t.id===e)||jr}function Am(e){return Fs.filter(t=>t.category===e)}var Dr=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.filterMode="all"}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">
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<div class="scene-object-list" data-object-list></div>
|
|
68
68
|
</div>
|
|
69
69
|
</div>
|
|
70
|
-
`}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=Array.from(((o=this.root)==null?void 0:o.querySelectorAll("[data-filter]"))||[]);n.forEach(c=>{c.addEventListener("click",()=>{let d=c.dataset.filter;d&&(this.filterMode=d,n.forEach(u=>u.classList.toggle("active",u.dataset.filter===d)),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)})}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 p;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 f=window.__editableObjectConfigs;f&&typeof f.keys=="function"&&(r=Array.from(f.keys()))}if(!Array.isArray(r)||r.length===0){this.scheduleRetry();return}let a=(((p=this.searchInput)==null?void 0:p.value)||"").trim().toLowerCase(),s=[];r.forEach(f=>{var E,k,
|
|
70
|
+
`}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=Array.from(((o=this.root)==null?void 0:o.querySelectorAll("[data-filter]"))||[]);n.forEach(c=>{c.addEventListener("click",()=>{let d=c.dataset.filter;d&&(this.filterMode=d,n.forEach(u=>u.classList.toggle("active",u.dataset.filter===d)),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)})}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 p;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 f=window.__editableObjectConfigs;f&&typeof f.keys=="function"&&(r=Array.from(f.keys()))}if(!Array.isArray(r)||r.length===0){this.scheduleRetry();return}let a=(((p=this.searchInput)==null?void 0:p.value)||"").trim().toLowerCase(),s=[];r.forEach(f=>{var E,k,O,_;let m=typeof i=="function"?i(f):null;if(!m){let T=window.__editableObjectConfigs;T&&typeof T.get=="function"&&(m=(E=T.get(f))!=null?E:null)}let h=(((k=m==null?void 0:m.identity)==null?void 0:k.category)||"scene").toString(),g=(((O=m==null?void 0:m.identity)==null?void 0:O.id)||f).toString(),b=h.toLowerCase(),v=g.toLowerCase(),y=b.includes("ui")||v.startsWith("ui")||v.includes("label"),x=this.formatDisplayName(g||f),w=((_=m==null?void 0:m.render)==null?void 0:_.visible)===!1||(m==null?void 0:m.enabled)===!1,S=this.getObjectType(m),A={id:f,label:x,category:h,isUi:y,isUnused:w,objectType:S};(!a||A.id.toLowerCase().includes(a)||A.label.toLowerCase().includes(a))&&s.push(A)});let o=s.filter(f=>f.isUi&&!f.isUnused),l=s.filter(f=>!f.isUi&&!f.isUnused),c=s.filter(f=>f.isUnused),d=this.filterMode==="scene"?[]:o,u=this.filterMode==="ui"?[]:l;this.listContainer.innerHTML=`
|
|
71
71
|
${this.renderGroup("UI",d,!1)}
|
|
72
72
|
${this.renderGroup("Scene",u,!1)}
|
|
73
73
|
${c.length>0?this.renderGroup("Unused",c,!0):""}
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
</div>
|
|
244
244
|
</div>
|
|
245
245
|
</div>
|
|
246
|
-
`}initialize(t,i){var g,b,v,y,x,w,S,A,E,k,
|
|
246
|
+
`}initialize(t,i){var g,b,v,y,x,w,S,A,E,k,O,_,T,R,B,M;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 L;return(L=this.options)==null?void 0:L.onHighlightObject(!!n.checked)});let r=(b=this.root)==null?void 0:b.querySelector("#debug-highlight-anchor");r==null||r.addEventListener("change",()=>{var L;return(L=this.options)==null?void 0:L.onHighlightAnchor(!!r.checked)});let a=(v=this.root)==null?void 0:v.querySelector("#debug-nudge-enabled"),s=(y=this.root)==null?void 0:y.querySelector("#debug-nudge-controls");if(a&&s){let L=()=>s.classList.toggle("hidden",!a.checked);a.addEventListener("change",L),L()}Array.from(((x=this.root)==null?void 0:x.querySelectorAll(".debug-arrow-btn"))||[]).forEach(L=>{L.addEventListener("click",()=>{var F,re,j,J;switch(L.dataset.nudge){case"up":(F=this.options)==null||F.onNudge(0,-1);break;case"down":(re=this.options)==null||re.onNudge(0,1);break;case"left":(j=this.options)==null||j.onNudge(-1,0);break;case"right":(J=this.options)==null||J.onNudge(1,0);break;default:break}})});let c=(()=>{var P;let L=window.getEditableEngineConfig;if(typeof L=="function"){let F=L();return(P=F==null?void 0:F.splash)!=null?P:{}}return{}})(),d=(w=this.root)==null?void 0:w.querySelector("#debug-loading-text"),u=(S=this.root)==null?void 0:S.querySelector("#debug-loading-text-scale"),p=(A=this.root)==null?void 0:A.querySelector("#debug-loading-text-scale-value"),f=(E=this.root)==null?void 0:E.querySelector("#debug-splash-on-start"),m=(k=this.root)==null?void 0:k.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 L,P;(P=(L=this.options)==null?void 0:L.onUpdateSplash)==null||P.call(L,{loading_text:d.value})})),u){let L=typeof c.loading_text_scale=="number"?c.loading_text_scale:.6;u.value=L.toString(),p&&(p.textContent=L.toFixed(2)),u.addEventListener("input",()=>{var F,re;let P=Number(u.value);p&&(p.textContent=Number.isFinite(P)?P.toFixed(2):"0.6"),Number.isFinite(P)&&((re=(F=this.options)==null?void 0:F.onUpdateSplash)==null||re.call(F,{loading_text_scale:P}))})}f&&(f.checked=!!c.show_on_start,f.addEventListener("change",()=>{var L,P;(P=(L=this.options)==null?void 0:L.onUpdateSplash)==null||P.call(L,{show_on_start:!!f.checked})})),m==null||m.addEventListener("click",()=>{var L,P;(P=(L=this.options)==null?void 0:L.onShowSplash)==null||P.call(L)}),this.infoEls={instance:(O=this.root)==null?void 0:O.querySelector("#debug-instance-id"),worldX:(_=this.root)==null?void 0:_.querySelector("#debug-world-x"),worldY:(T=this.root)==null?void 0:T.querySelector("#debug-world-y"),anchorX:(R=this.root)==null?void 0:R.querySelector("#debug-config-x"),anchorY:(B=this.root)==null?void 0:B.querySelector("#debug-config-y")};let h=(M=this.root)==null?void 0:M.querySelector("[data-advanced-toggle]");h&&h.addEventListener("click",()=>{let L=h.closest(".debug-collapsible");L==null||L.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`
|
|
247
247
|
<div class="scene-panel library-panel panel-accent-purple" data-panel="library">
|
|
248
248
|
<div class="scene-panel-header" data-panel-handle>
|
|
249
249
|
<div class="panel-title">
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
<span class="inspector-empty-icon">\u{1F3AF}</span>
|
|
458
458
|
<span class="inspector-empty-text">Select an object to inspect</span>
|
|
459
459
|
</div>
|
|
460
|
-
`)}};var Bh=ci(Eh(),1);function Pl(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function Sh(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function Ah(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function $a(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await Pl(r),s=await Ah(a),o=Sh(a);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Lt(e){var t,i;try{let n=await Pl(e),r=await Ah(n),a=Sh(n);return{base64:a.base64,mimeType:a.mimeType,dataUrl:n,width:(t=r==null?void 0:r.width)!=null?t:0,height:(i=r==null?void 0:r.height)!=null?i:0}}catch{return null}}function Ch(e){return Pl(e).then(t=>t).catch(()=>null)}function Rl(e,t){var i;try{let[n,r]=e.split(","),a=n.match(/data:(.*?);base64/),s=(i=a==null?void 0:a[1])!=null?i:"image/png",o=atob(r),l=new Uint8Array(o.length);for(let c=0;c<o.length;c++)l[c]=o.charCodeAt(c);return new File([l],t,{type:s})}catch{return null}}async function Ui(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((u,p)=>{let f=new Image;f.onload=()=>u(f),f.onerror=()=>p(new Error("Failed to load image")),f.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(u=>({r:s[u.offset],g:s[u.offset+1],b:s[u.offset+2]})),c=0;for(let u=0;u<s.length;u+=4){let p=s[u],f=s[u+1],m=s[u+2],h=!1;for(let g of l)if(Math.sqrt(Math.pow(p-g.r,2)+Math.pow(f-g.g,2)+Math.pow(m-g.b,2))<t){h=!0;break}h&&(s[u+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}function Th(e,t){if(!e||!t)return"1:1";let i=e/t;return i>1.3?"16:9":i<.77?"9:16":"1:1"}function ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function le(e){return typeof e=="string"?e:void 0}function kh(e){return e.toLowerCase().endsWith(".png")?e.slice(0,-4):e}function sw(e){var n,r,a;let t=(n=le(e.id))!=null?n:le(e.name);if(t)return t;let i=(r=le(e.file))!=null?r:le(e.asset);return i?kh((a=i.split("/").pop())!=null?a:i):void 0}function ow(e,t,i){var n,r,a;if(typeof t=="string")return{id:e,file:t,role:i};if(ut(t)){let s=(n=le(t.file))!=null?n:le(t.asset);return s?{id:(r=le(t.id))!=null?r:e,file:s,role:(a=le(t.role))!=null?a:i,dataUrl:le(t.dataUrl),layout:t.layout}:null}return null}function Ml(e,t){var i,n,r;if(!e)return[];if(Array.isArray(e)){let a=[];for(let s of e){if(typeof s=="string"){let o=kh((i=s.split("/").pop())!=null?i:s);a.push({id:o,file:s,role:t});continue}if(ut(s)){let o=sw(s),l=(n=le(s.file))!=null?n:le(s.asset);if(!o||!l)continue;a.push({id:o,file:l,role:(r=le(s.role))!=null?r:t,dataUrl:le(s.dataUrl),layout:s.layout})}}return a}if(ut(e)){let a=[];for(let[s,o]of Object.entries(e)){let l=ow(s,o,t);l&&a.push(l)}return a}return[]}function lw(e){var t,i;return(i=(t=le(e.brand_name))!=null?t:le(e.brandName))!=null?i:le(e.name)}function cw(e){if(ut(e.brand_dna)&&ut(e.brand_dna.colors))return e.brand_dna;if(ut(e.colors)){let t={colors:e.colors};return typeof e.style=="string"&&(t.style=e.style),ut(e.fonts)&&(t.fonts=e.fonts),t}}function dw(e){var i;let t=new Map;for(let n of e){let r=t.get(n.id);if(!r){t.set(n.id,n);continue}t.set(n.id,{...r,...n,file:n.file||r.file,role:n.role||r.role,dataUrl:n.dataUrl||r.dataUrl,layout:(i=n.layout)!=null?i:r.layout})}return Array.from(t.values())}function jl(e,t={}){var s,o,l;let i=e.filter(ut),n=(o=(s=i.map(lw).find(Boolean))!=null?s:t.defaultBrandName)!=null?o:"Imported Brand",r=(l=i.map(cw).find(Boolean))!=null?l:{colors:{}},a=[];for(let c of i)"layers"in c&&a.push(...Ml(c.layers,"visual element")),"assets"in c&&a.push(...Ml(c.assets,"visual element")),ut(c.endgame)&&"assets"in c.endgame&&a.push(...Ml(c.endgame.assets,"endgame"));return{version:"1.0",brand_name:n,brand_dna:r,assets:dw(a)}}var Lh=require("@google/genai");async function Ha(e,t,i=[],n={}){var r,a,s,o,l,c,d;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let b=0;b<i.length;b++){let v=i[b];if(!v.base64||!v.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(v.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!v.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${v.mimeType}`)}let u=new Lh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",f=[t];i.length>0&&i.forEach((b,v)=>{f.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${v+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let m=await u.models.generateContent({model:p,contents:f}),h="",g=(s=(a=(r=m.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(g)for(let b of g)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(u){throw console.error("[Gemini] API error:",u),(o=u.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=u.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=u.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(d=u.message)!=null&&d.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):u}}var
|
|
460
|
+
`)}};var Bh=ci(Eh(),1);function Pl(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function Sh(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function Ah(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function $a(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await Pl(r),s=await Ah(a),o=Sh(a);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Lt(e){var t,i;try{let n=await Pl(e),r=await Ah(n),a=Sh(n);return{base64:a.base64,mimeType:a.mimeType,dataUrl:n,width:(t=r==null?void 0:r.width)!=null?t:0,height:(i=r==null?void 0:r.height)!=null?i:0}}catch{return null}}function Ch(e){return Pl(e).then(t=>t).catch(()=>null)}function Rl(e,t){var i;try{let[n,r]=e.split(","),a=n.match(/data:(.*?);base64/),s=(i=a==null?void 0:a[1])!=null?i:"image/png",o=atob(r),l=new Uint8Array(o.length);for(let c=0;c<o.length;c++)l[c]=o.charCodeAt(c);return new File([l],t,{type:s})}catch{return null}}async function Ui(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((u,p)=>{let f=new Image;f.onload=()=>u(f),f.onerror=()=>p(new Error("Failed to load image")),f.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(u=>({r:s[u.offset],g:s[u.offset+1],b:s[u.offset+2]})),c=0;for(let u=0;u<s.length;u+=4){let p=s[u],f=s[u+1],m=s[u+2],h=!1;for(let g of l)if(Math.sqrt(Math.pow(p-g.r,2)+Math.pow(f-g.g,2)+Math.pow(m-g.b,2))<t){h=!0;break}h&&(s[u+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}function Th(e,t){if(!e||!t)return"1:1";let i=e/t;return i>1.3?"16:9":i<.77?"9:16":"1:1"}function ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function le(e){return typeof e=="string"?e:void 0}function kh(e){return e.toLowerCase().endsWith(".png")?e.slice(0,-4):e}function sw(e){var n,r,a;let t=(n=le(e.id))!=null?n:le(e.name);if(t)return t;let i=(r=le(e.file))!=null?r:le(e.asset);return i?kh((a=i.split("/").pop())!=null?a:i):void 0}function ow(e,t,i){var n,r,a;if(typeof t=="string")return{id:e,file:t,role:i};if(ut(t)){let s=(n=le(t.file))!=null?n:le(t.asset);return s?{id:(r=le(t.id))!=null?r:e,file:s,role:(a=le(t.role))!=null?a:i,dataUrl:le(t.dataUrl),layout:t.layout}:null}return null}function Ml(e,t){var i,n,r;if(!e)return[];if(Array.isArray(e)){let a=[];for(let s of e){if(typeof s=="string"){let o=kh((i=s.split("/").pop())!=null?i:s);a.push({id:o,file:s,role:t});continue}if(ut(s)){let o=sw(s),l=(n=le(s.file))!=null?n:le(s.asset);if(!o||!l)continue;a.push({id:o,file:l,role:(r=le(s.role))!=null?r:t,dataUrl:le(s.dataUrl),layout:s.layout})}}return a}if(ut(e)){let a=[];for(let[s,o]of Object.entries(e)){let l=ow(s,o,t);l&&a.push(l)}return a}return[]}function lw(e){var t,i;return(i=(t=le(e.brand_name))!=null?t:le(e.brandName))!=null?i:le(e.name)}function cw(e){if(ut(e.brand_dna)&&ut(e.brand_dna.colors))return e.brand_dna;if(ut(e.colors)){let t={colors:e.colors};return typeof e.style=="string"&&(t.style=e.style),ut(e.fonts)&&(t.fonts=e.fonts),t}}function dw(e){var i;let t=new Map;for(let n of e){let r=t.get(n.id);if(!r){t.set(n.id,n);continue}t.set(n.id,{...r,...n,file:n.file||r.file,role:n.role||r.role,dataUrl:n.dataUrl||r.dataUrl,layout:(i=n.layout)!=null?i:r.layout})}return Array.from(t.values())}function jl(e,t={}){var s,o,l;let i=e.filter(ut),n=(o=(s=i.map(lw).find(Boolean))!=null?s:t.defaultBrandName)!=null?o:"Imported Brand",r=(l=i.map(cw).find(Boolean))!=null?l:{colors:{}},a=[];for(let c of i)"layers"in c&&a.push(...Ml(c.layers,"visual element")),"assets"in c&&a.push(...Ml(c.assets,"visual element")),ut(c.endgame)&&"assets"in c.endgame&&a.push(...Ml(c.endgame.assets,"endgame"));return{version:"1.0",brand_name:n,brand_dna:r,assets:dw(a)}}var Lh=require("@google/genai");async function Ha(e,t,i=[],n={}){var r,a,s,o,l,c,d;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let b=0;b<i.length;b++){let v=i[b];if(!v.base64||!v.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(v.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!v.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${v.mimeType}`)}let u=new Lh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",f=[t];i.length>0&&i.forEach((b,v)=>{f.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${v+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let m=await u.models.generateContent({model:p,contents:f}),h="",g=(s=(a=(r=m.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(g)for(let b of g)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(u){throw console.error("[Gemini] API error:",u),(o=u.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=u.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=u.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(d=u.message)!=null&&d.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):u}}var Ih=require("@google/genai");async function qi(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new Ih.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),a.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,c=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}function Oh(e){let t=e.brandAssets.map(a=>{let s=`- ${a.id}: ${a.role}`;return a.layout&&(s+=` [pos: ${a.layout.x.toFixed(0)},${a.layout.y.toFixed(0)}, size: ${a.layout.w.toFixed(0)}x${a.layout.h.toFixed(0)}, z: ${a.layout.z}, opacity: ${a.layout.opacity}]`),s}).join(`
|
|
461
461
|
`)||"None",i=e.brandDna?`Colors: ${JSON.stringify(e.brandDna.colors)}, Style: ${e.brandDna.style||"not specified"}`:"Not provided",n=e.gameObjects.map(a=>typeof a=="string"?`- id: ${a}`:`- id: ${a.id}${a.category?`, category: ${a.category}`:""}${a.type?`, type: ${a.type}`:""}`).join(`
|
|
462
462
|
`),r="";if(e.brandConfig){let a=e.brandConfig,s=[];a.splash&&s.push(`SPLASH: title="${a.splash.title||""}", subtitle="${a.splash.subtitle||""}", button="${a.splash.button_label||""}"`),a.endgame&&s.push(`ENDGAME: title="${a.endgame.title||""}", subtitle="${a.endgame.subtitle||""}", cta="${a.endgame.cta_label||""}"`),a.tutorial&&s.push(`TUTORIAL: text="${a.tutorial.label_text||""}", helper="${a.tutorial.helper_text||""}"`),s.length>0&&(r=`
|
|
463
463
|
BRAND CONTENT:
|
|
@@ -542,7 +542,7 @@ OUTPUT CONSTRAINTS (MUST FOLLOW):
|
|
|
542
542
|
|
|
543
543
|
OUTPUT:
|
|
544
544
|
Generate the requested asset matching the brand style.${e.needsTransparency?" Background MUST be solid magenta (#FF00FF).":""}
|
|
545
|
-
`.trim()}function Rh(e){return e.map(t=>{if(typeof t=="string"){let i=t,n,r;return i.includes("background")?(n="background",r="background"):i.includes("button")||i.includes("cta")?(n="ui",r="button"):i.includes("logo")?(n="ui",r="logo"):i.includes("title")||i.includes("subtitle")||i.includes("text")?(n="text",r="text"):i.includes("effect")||i.includes("confetti")||i.includes("particle")?(n="effects",r="effect"):i.includes("ui.")||i.includes("splash")||i.includes("endgame")?(n="ui",r="image"):(n="environment",r="interactive"),{id:i,category:n,type:r}}return t})}function Mh(e,t){return!(e.includes("background")&&(e.includes("_1")||e.includes("splash")||e.includes("endgame")||e.includes("main"))||t==="text"||t==="effects"&&e.includes("particle"))}async function jh(e){var s,o;let t=Rh(e.gameObjects),i={gamePrompt:e.gamePrompt,gameObjects:t,brandAssets:e.manifest.assets,brandDna:e.manifest.brand_dna,brandName:e.manifest.brand_name},n=
|
|
545
|
+
`.trim()}function Rh(e){return e.map(t=>{if(typeof t=="string"){let i=t,n,r;return i.includes("background")?(n="background",r="background"):i.includes("button")||i.includes("cta")?(n="ui",r="button"):i.includes("logo")?(n="ui",r="logo"):i.includes("title")||i.includes("subtitle")||i.includes("text")?(n="text",r="text"):i.includes("effect")||i.includes("confetti")||i.includes("particle")?(n="effects",r="effect"):i.includes("ui.")||i.includes("splash")||i.includes("endgame")?(n="ui",r="image"):(n="environment",r="interactive"),{id:i,category:n,type:r}}return t})}function Mh(e,t){return!(e.includes("background")&&(e.includes("_1")||e.includes("splash")||e.includes("endgame")||e.includes("main"))||t==="text"||t==="effects"&&e.includes("particle"))}async function jh(e){var s,o;let t=Rh(e.gameObjects),i={gamePrompt:e.gamePrompt,gameObjects:t,brandAssets:e.manifest.assets,brandDna:e.manifest.brand_dna,brandName:e.manifest.brand_name},n=Oh(i),r=[];if(e.flatDesignDataUrl)try{let l=Dh(e.flatDesignDataUrl);l&&l.base64&&l.mimeType?l.base64.length<100?console.warn("[Pipeline] Flat design data URL appears invalid (too short)"):(r.push(l),console.log("[Pipeline] Added flat design to analysis, size:",l.base64.length)):console.warn("[Pipeline] Failed to parse flat design data URL")}catch(l){console.warn("[Pipeline] Error processing flat design:",l)}console.log("[Pipeline] Running analysis chain with",r.length,"images...");let a;try{a=await Ha(e.apiKey,n,r,{model:"gemini-2.5-flash"}),console.log("[Pipeline] Analysis response received")}catch(l){throw console.error("[Pipeline] Gemini API error:",l),(s=l.message)!=null&&s.includes("Unable to process input image")?new Error("Gemini API unable to process the uploaded images. Please try with different images or ensure they are valid PNG/JPG files under 10MB."):(o=l.message)!=null&&o.includes("image")?new Error("Image processing failed. Please ensure your images are valid and not corrupted."):l}return uw(a,e.gameObjects)}function uw(e,t){try{let i=e,n=e.match(/```(?:json)?\s*([\s\S]*?)```/);if(n)i=n[1].trim();else{let a=e.match(/\{[\s\S]*\}/);a&&(i=a[0])}let r=JSON.parse(i);return r.mappings&&Array.isArray(r.mappings)?{mappingResult:r,rawResponse:e,parsed:!0}:{mappingResult:{mappings:t.map(a=>({game_object:a,action:"KEEP",status:"Analysis response missing mappings[]"}))},rawResponse:e,parsed:!1,parseError:"Missing mappings[] array"}}catch(i){return{mappingResult:{mappings:t.map(n=>({game_object:n,action:"KEEP",status:"Analysis response was not valid JSON"}))},rawResponse:e,parsed:!1,parseError:i!=null&&i.message?String(i.message):"JSON parse failed"}}}async function Dl(e,t,i={}){var r;let n=t.mappings.filter(a=>a.action==="GENERATE");if(n.length===0){console.log("[Pipeline] No assets to generate");return}console.log(`[Pipeline] Generating ${n.length} assets...`);for(let a=0;a<n.length;a++){let s=n[a];(r=i.onProgress)==null||r.call(i,a+1,n.length,s.game_object);try{let o=await pw(e,s);s.output_dataUrl=o,s.status="Generated \u2713"}catch(o){console.error(`[Pipeline] Failed to generate ${s.game_object}:`,o),s.status="Failed \u2717"}}console.log("[Pipeline] Generation chain complete")}async function pw(e,t){if(!t.generation_prompt)throw new Error("No generation prompt provided");let i=[];if(t.reference_asset&&e.manifest){let o=e.manifest.assets.find(l=>l.id===t.reference_asset);if(o){let l=e.assetFiles.get(o.file);if(l){let c=await Lt(l);c&&i.push({base64:c.base64,mimeType:c.mimeType})}}}if(e.flatDesignDataUrl){let o=Dh(e.flatDesignDataUrl);o&&i.push(o)}let n=Mh(t.game_object),r={prompt:t.generation_prompt,hasReference:i.length>0,brandDna:e.manifest.brand_dna,needsTransparency:n},a=Ph(r);console.log(`[Pipeline] Generating asset for ${t.game_object}... (transparency: ${n})`);let s=await qi(e.apiKey,a,i,{aspectRatio:"1:1",model:"gemini-2.5-flash-image"});return n&&await Ui(s)||s}function Dh(e){let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return i&&n?{base64:i,mimeType:n[1]}:null}async function zh(e,t){let i=e.assets,n=[];Array.isArray(i)?n=i:i&&typeof i=="object"?n=Object.entries(i).map(([r,a])=>({id:r,file:String(a),role:"visual element"})):n=[],e.assets=n;for(let r of n){let a=t.get(r.file);if(a){let s=await Lt(a);s&&(r.dataUrl=s.dataUrl)}}}var Ua=class{constructor(){this.root=null;this.currentTab="upload";this.uploadMethod="individual";this.uploadedJsons=new Map;this.normalizedManifest=null;this.flatDesignDataUrl=null;this.assetFiles=new Map;this.zipFile=null;this.mappingResult=null;this.analysisRawResponse=null;this.analysisParsedOk=null;this.analysisParseError=null;this.isAnalyzing=!1;this.isGenerating=!1}get manifest(){return this.normalizedManifest}render(){return`
|
|
546
546
|
<div class="scene-panel brand-vision-panel panel-accent-violet" data-panel="brand-vision">
|
|
547
547
|
<div class="scene-panel-header" data-panel-handle>
|
|
548
548
|
<div class="panel-title">
|
|
@@ -868,7 +868,7 @@ Generate the requested asset matching the brand style.${e.needsTransparency?" Ba
|
|
|
868
868
|
</div>
|
|
869
869
|
</div>
|
|
870
870
|
</div>
|
|
871
|
-
`;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 v,y;let b=(y=(v=this.aiStrengthInput)==null?void 0:v.value)!=null?y:"5";this.aiStrengthValue&&(this.aiStrengthValue.textContent=b)}),(d=this.aiBgToleranceInput)==null||d.addEventListener("input",()=>{var v,y;let b=(y=(v=this.aiBgToleranceInput)==null?void 0:v.value)!=null?y:"30";this.aiBgToleranceValue&&(this.aiBgToleranceValue.textContent=b),this.refreshAiOutputFromRaw()}),(u=this.aiReferenceInput)==null||u.addEventListener("change",()=>{var v,y,x;let b=(x=(y=(v=this.aiReferenceInput)==null?void 0:v.files)==null?void 0:y[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,v,y,x,w,S,A,E,k,I,_,T,R;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=(y=(v=this.aiRemoveBgToggle)==null?void 0:v.checked)!=null?y:!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 B=null,M=(E=this.getSelectedAssetKey())!=null?E:"unknown",L=(k=this.aiUseOutputToggle)!=null&&k.checked&&this.aiOutputDataUrl?"ai-output":"asset-value";if((I=this.aiUseOutputToggle)!=null&&I.checked&&this.aiOutputDataUrl){let je=Rl(this.aiOutputDataUrl,"ai-output.png");if(je){let De=await Lt(je);De&&(B={input:{base64:De.base64,mimeType:De.mimeType},dataUrl:De.dataUrl,width:De.width,height:De.height})}}if(B||(B=await this.getImageDataFromAsset(c)),!B){this.setAiStatus("Unable to load the base image.");return}let P=[B.input],F=!1;if(this.aiReferenceFile){let je=await Lt(this.aiReferenceFile);je?(P.push({base64:je.base64,mimeType:je.mimeType}),F=!0,this.setAiStatus(`Generating with reference: ${this.aiReferenceFile.name}`)):this.setAiStatus("Reference image failed to load, generating without reference.")}let re=Nh(n,{includeReference:F,includeMagenta:a,changeLevel:o}),j=(T=(_=this.aiReferenceFile)==null?void 0:_.name)!=null?T:"none";console.info("[AI] Final prompt:",re),console.info("[AI] Image sources:",{assetKey:M,base:L,reference:j});let J=Th(B.width,B.height);console.info("[AI] CRITICAL: Calling generateImageWithGemini25Flash NOW...");let ae=await qi(t,re,P,{aspectRatio:J,model:i});console.info("[AI] CRITICAL: generateImageWithGemini25Flash returned! Length:",ae==null?void 0:ae.length),this.aiRawOutputDataUrl=ae,await this.refreshAiOutputFromRaw()}catch(B){console.error("[CustomizePanel] AI Generate Error:",B),this.setAiStatus("Generation failed. Check console.")}finally{this.setAiLoading(!1),((R=this.aiStatusEl)==null?void 0:R.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 Ui(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=Rl(this.aiOutputDataUrl,"ai-output.png");if(!r)return;let a=await this.showManualCropModal(r,n,i);if(!a)return;let s=await Ch(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=`
|
|
871
|
+
`;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 v,y;let b=(y=(v=this.aiStrengthInput)==null?void 0:v.value)!=null?y:"5";this.aiStrengthValue&&(this.aiStrengthValue.textContent=b)}),(d=this.aiBgToleranceInput)==null||d.addEventListener("input",()=>{var v,y;let b=(y=(v=this.aiBgToleranceInput)==null?void 0:v.value)!=null?y:"30";this.aiBgToleranceValue&&(this.aiBgToleranceValue.textContent=b),this.refreshAiOutputFromRaw()}),(u=this.aiReferenceInput)==null||u.addEventListener("change",()=>{var v,y,x;let b=(x=(y=(v=this.aiReferenceInput)==null?void 0:v.files)==null?void 0:y[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,v,y,x,w,S,A,E,k,O,_,T,R;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=(y=(v=this.aiRemoveBgToggle)==null?void 0:v.checked)!=null?y:!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 B=null,M=(E=this.getSelectedAssetKey())!=null?E:"unknown",L=(k=this.aiUseOutputToggle)!=null&&k.checked&&this.aiOutputDataUrl?"ai-output":"asset-value";if((O=this.aiUseOutputToggle)!=null&&O.checked&&this.aiOutputDataUrl){let je=Rl(this.aiOutputDataUrl,"ai-output.png");if(je){let De=await Lt(je);De&&(B={input:{base64:De.base64,mimeType:De.mimeType},dataUrl:De.dataUrl,width:De.width,height:De.height})}}if(B||(B=await this.getImageDataFromAsset(c)),!B){this.setAiStatus("Unable to load the base image.");return}let P=[B.input],F=!1;if(this.aiReferenceFile){let je=await Lt(this.aiReferenceFile);je?(P.push({base64:je.base64,mimeType:je.mimeType}),F=!0,this.setAiStatus(`Generating with reference: ${this.aiReferenceFile.name}`)):this.setAiStatus("Reference image failed to load, generating without reference.")}let re=Nh(n,{includeReference:F,includeMagenta:a,changeLevel:o}),j=(T=(_=this.aiReferenceFile)==null?void 0:_.name)!=null?T:"none";console.info("[AI] Final prompt:",re),console.info("[AI] Image sources:",{assetKey:M,base:L,reference:j});let J=Th(B.width,B.height);console.info("[AI] CRITICAL: Calling generateImageWithGemini25Flash NOW...");let ae=await qi(t,re,P,{aspectRatio:J,model:i});console.info("[AI] CRITICAL: generateImageWithGemini25Flash returned! Length:",ae==null?void 0:ae.length),this.aiRawOutputDataUrl=ae,await this.refreshAiOutputFromRaw()}catch(B){console.error("[CustomizePanel] AI Generate Error:",B),this.setAiStatus("Generation failed. Check console.")}finally{this.setAiLoading(!1),((R=this.aiStatusEl)==null?void 0:R.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 Ui(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=Rl(this.aiOutputDataUrl,"ai-output.png");if(!r)return;let a=await this.showManualCropModal(r,n,i);if(!a)return;let s=await Ch(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=`
|
|
872
872
|
<div class="asset-preview-card">
|
|
873
873
|
<div class="asset-preview-header">
|
|
874
874
|
<div class="asset-preview-title">${t}</div>
|
|
@@ -914,10 +914,10 @@ Generate the requested asset matching the brand style.${e.needsTransparency?" Ba
|
|
|
914
914
|
<button class="asset-crop-apply" type="button">Apply Crop</button>
|
|
915
915
|
</div>
|
|
916
916
|
</div>
|
|
917
|
-
`;let v=c.querySelector(".asset-crop-canvas"),y=c.querySelector(".asset-crop-preview"),x=c.querySelector(".asset-crop-zoom"),w=c.querySelector(".asset-crop-zoom-value"),S=c.querySelector(".asset-crop-close"),A=c.querySelector(".asset-crop-cancel"),E=c.querySelector(".asset-crop-apply"),k=c.querySelector(".asset-crop-reset");if(!v||!y||!x||!w){l(null);return}let I=v.getContext("2d"),_=y.getContext("2d");if(!I||!_){l(null);return}let T=s.naturalWidth,R=s.naturalHeight,B=Math.max(v.width/T,v.height/R),M=1,L=0,P=0,F=!1,re=0,j=0,J=0,ae=0,je=()=>{let $=B*M,Rt=Math.max(0,(T*$-v.width)/2),si=Math.max(0,(R*$-v.height)/2);L=Math.min(Rt,Math.max(-Rt,L)),P=Math.min(si,Math.max(-si,P))},De=()=>{let $=B*M;I.clearRect(0,0,v.width,v.height);let Rt=v.width/2-T*$/2+L,si=v.height/2-R*$/2+P;if(I.drawImage(s,Rt,si,T*$,R*$),_.clearRect(0,0,y.width,y.height),o!=null&&o.naturalWidth&&(o!=null&&o.naturalHeight)){let li=Math.max(y.width/o.naturalWidth,y.height/o.naturalHeight),ds=y.width/2-o.naturalWidth*li/2,nn=y.height/2-o.naturalHeight*li/2;_.drawImage(o,ds,nn,o.naturalWidth*li,o.naturalHeight*li)}else _.fillStyle="rgba(255, 255, 255, 0.04)",_.fillRect(0,0,y.width,y.height),_.strokeStyle="rgba(255, 255, 255, 0.08)",_.strokeRect(4,4,y.width-8,y.height-8);let tn=y.width/v.width*(B*M),oi=L*(y.width/v.width),or=P*(y.height/v.height),ls=y.width/2-T*tn/2+oi,cs=y.height/2-R*tn/2+or;_.save(),_.globalAlpha=.7,_.drawImage(s,ls,cs,T*tn,R*tn),_.restore()},_c=()=>{L=0,P=0,je(),De()};x.addEventListener("input",()=>{M=Number(x.value),w.textContent=`${M.toFixed(2)}\xD7`,je(),De()}),v.addEventListener("pointerdown",$=>{F=!0,re=$.clientX,j=$.clientY,J=L,ae=P,v.setPointerCapture($.pointerId)}),v.addEventListener("pointermove",$=>{F&&(L=J+($.clientX-re),P=ae+($.clientY-j),je(),De())}),v.addEventListener("pointerup",$=>{F=!1,v.releasePointerCapture($.pointerId)}),v.addEventListener("pointerleave",()=>{F=!1});let ss=()=>{c.remove()},os=()=>{ss(),l(null)},Og=async()=>{let $=document.createElement("canvas");$.width=i.width,$.height=i.height;let Rt=$.getContext("2d");if(!Rt){ss(),l(null);return}let si=M,oi=Math.max($.width/T,$.height/R)*si,or=$.width/v.width,ls=L*or,cs=P*or,li=$.width/2-T*oi/2+ls,ds=$.height/2-R*oi/2+cs;Rt.drawImage(s,li,ds,T*oi,R*oi);let nn=await new Promise(Ig=>{$.toBlob(Pg=>Ig(Pg),t.type||"image/png")});if(ss(),!nn){l(null);return}l(new File([nn],t.name,{type:nn.type}))};S==null||S.addEventListener("click",os),A==null||A.addEventListener("click",os),k==null||k.addEventListener("click",_c),E==null||E.addEventListener("click",()=>{Og()}),c.addEventListener("click",$=>{$.target===c&&os()}),document.body.appendChild(c),_c()})}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 Yn=require("pixi.js");fi();ke();async function $h(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 Yn.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)Be[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 Hh(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 Yn.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)Be[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 v=((r=b.getDisplayObject)==null?void 0:r.call(b))||b.pixiObject||b;v!=null&&v.texture&&(v.texture=u,console.log("[LIBRARY] \u2705 Reset display object:",g))}}}catch(a){console.error("[LIBRARY] Error resetting asset:",a)}}async function Uh(e,t,i,n){var r,a,s,o,l,c,d,u,p,f,m,h,g,b,v;console.log("[LIBRARY] applySlotAsset:",{objectId:t,assetFilename:i,category:n});try{let y=t.startsWith("json.")?t.replace("json.",""):t;console.log("[LIBRARY] Asset key:",y);let x=Date.now(),w=`/raw/library/${n}/${i}?t=${x}`;console.log("[LIBRARY] Loading texture from:",w);let S=await Yn.Assets.load(w);if(!S){console.error("[LIBRARY] Failed to load texture:",w);return}console.log("[LIBRARY] \u2705 Texture loaded"),Be[y]=S,console.log("[LIBRARY] \u2705 Updated AssetTextures."+y);let A=window.CustomAssets;A!=null&&A[y]&&(A[y].texture=S,console.log("[LIBRARY] \u2705 Updated legacy CustomAssets."+y));let E=window.gameObjectManager;if(console.log("[LIBRARY] gameObjectManager exists?",!!E),E){let I=Array.from(((r=E.keys)==null?void 0:r.call(E))||[]).slice(0,10);console.log("[LIBRARY] Available gameObject keys (first 10):",I);let _=E.get(y);if(console.log("[LIBRARY] gameObject for "+y+"?",!!_),_){let T=((a=_.getDisplayObject)==null?void 0:a.call(_))||_.pixiObject||_.pixi||_,R=(s=T==null?void 0:T.constructor)==null?void 0:s.name;if(console.log("[LIBRARY] displayObject:",T),console.log("[LIBRARY] displayObject type:",R),console.log("[LIBRARY] has texture?",!!(T!=null&&T.texture)),T!=null&&T.texture)T.texture=S,console.log("[LIBRARY] \u2705 Applied to display object:",y);else if(R==="Text"){console.log("[LIBRARY] \u{1F504} Converting Text to Sprite...");let{Sprite:B}=await import("pixi.js"),M=T.parent,L=(l=(o=M==null?void 0:M.getChildIndex)==null?void 0:o.call(M,T))!=null?l:0,P={x:T.x,y:T.y},F={x:(d=(c=T.anchor)==null?void 0:c.x)!=null?d:.5,y:(p=(u=T.anchor)==null?void 0:u.y)!=null?p:.5},re={x:(m=(f=T.scale)==null?void 0:f.x)!=null?m:1,y:(g=(h=T.scale)==null?void 0:h.y)!=null?g:1},j=(b=T.alpha)!=null?b:1,J=(v=T.visible)!=null?v:!0,ae=new B(S);ae.anchor.set(F.x,F.y),ae.position.set(P.x,P.y),ae.scale.set(re.x,re.y),ae.alpha=j,ae.visible=J,M&&(M.removeChild(T),M.addChildAt(ae,L),console.log("[LIBRARY] \u2705 Replaced Text with Sprite in parent")),_.pixiObject&&(_.pixiObject=ae),_.pixi&&(_.pixi=ae),console.log("[LIBRARY] \u2705 Text \u2192 Sprite conversion complete")}else if(T!=null&&T.children){let B=T.children.find(M=>M.texture);B?(B.texture=S,console.log("[LIBRARY] \u2705 Applied to child sprite")):console.warn("[LIBRARY] \u26A0\uFE0F No texture found in displayObject or children")}}}let k=`raw/library/${n}/${i}`;xe({objectId:y,path:"render.asset.path",value:k}),console.log("[LIBRARY] \u2705 Staged config override for:",y,"path:",k)}catch(y){console.error("[LIBRARY] Error applying slot asset:",y)}}async function qh(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 Yn.Assets.load(o);if(!l){console.error("[LIBRARY] Failed to load default texture:",o);return}Be[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))}}xe({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 Xn=require("pixi.js");var zl=require("pixi.js"),Ot=()=>window.debugConfig||{},Gh=()=>window.resolveAnchorVec2||(e=>({x:.5,y:.5})),Wh=()=>window.resolveScreenAnchorPoint||(()=>new zl.Point),Yh=()=>window.resolveScreenRatioPoint||(()=>new zl.Point);function Vh(e){Ga(e)&&(e.objectDebugRaf||(e.objectDebugRaf=window.requestAnimationFrame(()=>Wa(e))))}function Kh(e){e.objectDebugRaf&&(window.cancelAnimationFrame(e.objectDebugRaf),e.objectDebugRaf=null),Kn(e)}function Ga(e){return e.isDebugOpen}function Wa(e){var a,s,o;if(!Ga(e)){e.objectDebugRaf=null;return}e.objectDebugRaf=window.requestAnimationFrame(()=>Wa(e));let t=Bl(e);if(!t){Vn(e,null),Kn(e);return}let i=Nl(e,t);if(!i){Vn(e,null),Kn(e);return}let n=new Xn.Point;(a=i.getGlobalPosition)==null||a.call(i,n);let r=Fl(e,i);Vn(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?ql(e,i):Wl(e),e.highlightAnchor&&r?Gl(e,r):Yl(e)}function Bl(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 Nl(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 Zn(e){let t=e.selectedObjectId;if(!t)return null;let i=window.getEditableObjectConfig;return typeof i!="function"?null:i(t)}function Fl(e,t){var s,o;let i=Zn(e);if(!i)return null;let n=(s=i.transform)!=null?s:{},r=$l(e);if(!r)return null;if(n.position_ratio!=null)return Yh()(r.width,r.height,n.position_ratio);let a=(o=n.anchor)!=null?o:"center";return Wh()(r.width,r.height,a)}function $l(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 Hl(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 Xn.Graphics,e.objectBoundsGfx.zIndex=999999,t.stage.addChild(e.objectBoundsGfx)),e.objectBoundsGfx):null}function Ul(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 Xn.Graphics,e.objectAnchorGfx.zIndex=1e6,t.stage.addChild(e.objectAnchorGfx)),e.objectAnchorGfx):null}function ql(e,t){var r;let i=Hl(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 Gl(e,t){let i=Ul(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 Wl(e){e.objectBoundsGfx&&e.objectBoundsGfx.clear()}function Yl(e){e.objectAnchorGfx&&e.objectAnchorGfx.clear()}function Kn(e){e.objectBoundsGfx&&(e.objectBoundsGfx.destroy(),e.objectBoundsGfx=null),e.objectAnchorGfx&&(e.objectAnchorGfx.destroy(),e.objectAnchorGfx=null)}function Vn(e,t){e.sceneToolsPanel.updateInfo(t?{instanceId:t.instanceId,worldX:t.worldX,worldY:t.worldY,anchorX:t.configX,anchorY:t.configY}:null)}function Xh(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function Zh(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 Vl(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 Va(e){let t=Ot();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 Jh(e){window.location.reload()}function Ka(e){let t=JSON.stringify(Ot(),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 Qh(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(()=>(Mr(),dd)),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),Ya(e,p),(n=e.configViewer)==null||n.style.setProperty("display","block");return}console.log("[PREVIEW] Loaded object config",t,s),Ya(e,s),(r=e.configViewer)==null||r.style.setProperty("display","block");return}catch(a){console.error("[DEBUG] Failed to load object config:",a)}}function Ya(e,t){var u,p,f,m,h,g,b,v,y,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=Vl(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=(y=(b=t.transform)==null?void 0:b.anchor)!=null?y:(v=t.render)==null?void 0:v.anchor)!=null?x:{x:.5,y:.5},d=Gh()(c);a&&(a.value=String(d.x)),s&&(s.value=String(d.y))}function eg(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}:
|
|
917
|
+
`;let v=c.querySelector(".asset-crop-canvas"),y=c.querySelector(".asset-crop-preview"),x=c.querySelector(".asset-crop-zoom"),w=c.querySelector(".asset-crop-zoom-value"),S=c.querySelector(".asset-crop-close"),A=c.querySelector(".asset-crop-cancel"),E=c.querySelector(".asset-crop-apply"),k=c.querySelector(".asset-crop-reset");if(!v||!y||!x||!w){l(null);return}let O=v.getContext("2d"),_=y.getContext("2d");if(!O||!_){l(null);return}let T=s.naturalWidth,R=s.naturalHeight,B=Math.max(v.width/T,v.height/R),M=1,L=0,P=0,F=!1,re=0,j=0,J=0,ae=0,je=()=>{let $=B*M,Rt=Math.max(0,(T*$-v.width)/2),si=Math.max(0,(R*$-v.height)/2);L=Math.min(Rt,Math.max(-Rt,L)),P=Math.min(si,Math.max(-si,P))},De=()=>{let $=B*M;O.clearRect(0,0,v.width,v.height);let Rt=v.width/2-T*$/2+L,si=v.height/2-R*$/2+P;if(O.drawImage(s,Rt,si,T*$,R*$),_.clearRect(0,0,y.width,y.height),o!=null&&o.naturalWidth&&(o!=null&&o.naturalHeight)){let li=Math.max(y.width/o.naturalWidth,y.height/o.naturalHeight),ds=y.width/2-o.naturalWidth*li/2,nn=y.height/2-o.naturalHeight*li/2;_.drawImage(o,ds,nn,o.naturalWidth*li,o.naturalHeight*li)}else _.fillStyle="rgba(255, 255, 255, 0.04)",_.fillRect(0,0,y.width,y.height),_.strokeStyle="rgba(255, 255, 255, 0.08)",_.strokeRect(4,4,y.width-8,y.height-8);let tn=y.width/v.width*(B*M),oi=L*(y.width/v.width),or=P*(y.height/v.height),ls=y.width/2-T*tn/2+oi,cs=y.height/2-R*tn/2+or;_.save(),_.globalAlpha=.7,_.drawImage(s,ls,cs,T*tn,R*tn),_.restore()},_c=()=>{L=0,P=0,je(),De()};x.addEventListener("input",()=>{M=Number(x.value),w.textContent=`${M.toFixed(2)}\xD7`,je(),De()}),v.addEventListener("pointerdown",$=>{F=!0,re=$.clientX,j=$.clientY,J=L,ae=P,v.setPointerCapture($.pointerId)}),v.addEventListener("pointermove",$=>{F&&(L=J+($.clientX-re),P=ae+($.clientY-j),je(),De())}),v.addEventListener("pointerup",$=>{F=!1,v.releasePointerCapture($.pointerId)}),v.addEventListener("pointerleave",()=>{F=!1});let ss=()=>{c.remove()},os=()=>{ss(),l(null)},Ig=async()=>{let $=document.createElement("canvas");$.width=i.width,$.height=i.height;let Rt=$.getContext("2d");if(!Rt){ss(),l(null);return}let si=M,oi=Math.max($.width/T,$.height/R)*si,or=$.width/v.width,ls=L*or,cs=P*or,li=$.width/2-T*oi/2+ls,ds=$.height/2-R*oi/2+cs;Rt.drawImage(s,li,ds,T*oi,R*oi);let nn=await new Promise(Og=>{$.toBlob(Pg=>Og(Pg),t.type||"image/png")});if(ss(),!nn){l(null);return}l(new File([nn],t.name,{type:nn.type}))};S==null||S.addEventListener("click",os),A==null||A.addEventListener("click",os),k==null||k.addEventListener("click",_c),E==null||E.addEventListener("click",()=>{Ig()}),c.addEventListener("click",$=>{$.target===c&&os()}),document.body.appendChild(c),_c()})}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 Yn=require("pixi.js");fi();ke();async function $h(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 Yn.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)Be[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 Hh(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 Yn.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)Be[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 v=((r=b.getDisplayObject)==null?void 0:r.call(b))||b.pixiObject||b;v!=null&&v.texture&&(v.texture=u,console.log("[LIBRARY] \u2705 Reset display object:",g))}}}catch(a){console.error("[LIBRARY] Error resetting asset:",a)}}async function Uh(e,t,i,n){var r,a,s,o,l,c,d,u,p,f,m,h,g,b,v;console.log("[LIBRARY] applySlotAsset:",{objectId:t,assetFilename:i,category:n});try{let y=t.startsWith("json.")?t.replace("json.",""):t;console.log("[LIBRARY] Asset key:",y);let x=Date.now(),w=`/raw/library/${n}/${i}?t=${x}`;console.log("[LIBRARY] Loading texture from:",w);let S=await Yn.Assets.load(w);if(!S){console.error("[LIBRARY] Failed to load texture:",w);return}console.log("[LIBRARY] \u2705 Texture loaded"),Be[y]=S,console.log("[LIBRARY] \u2705 Updated AssetTextures."+y);let A=window.CustomAssets;A!=null&&A[y]&&(A[y].texture=S,console.log("[LIBRARY] \u2705 Updated legacy CustomAssets."+y));let E=window.gameObjectManager;if(console.log("[LIBRARY] gameObjectManager exists?",!!E),E){let O=Array.from(((r=E.keys)==null?void 0:r.call(E))||[]).slice(0,10);console.log("[LIBRARY] Available gameObject keys (first 10):",O);let _=E.get(y);if(console.log("[LIBRARY] gameObject for "+y+"?",!!_),_){let T=((a=_.getDisplayObject)==null?void 0:a.call(_))||_.pixiObject||_.pixi||_,R=(s=T==null?void 0:T.constructor)==null?void 0:s.name;if(console.log("[LIBRARY] displayObject:",T),console.log("[LIBRARY] displayObject type:",R),console.log("[LIBRARY] has texture?",!!(T!=null&&T.texture)),T!=null&&T.texture)T.texture=S,console.log("[LIBRARY] \u2705 Applied to display object:",y);else if(R==="Text"){console.log("[LIBRARY] \u{1F504} Converting Text to Sprite...");let{Sprite:B}=await import("pixi.js"),M=T.parent,L=(l=(o=M==null?void 0:M.getChildIndex)==null?void 0:o.call(M,T))!=null?l:0,P={x:T.x,y:T.y},F={x:(d=(c=T.anchor)==null?void 0:c.x)!=null?d:.5,y:(p=(u=T.anchor)==null?void 0:u.y)!=null?p:.5},re={x:(m=(f=T.scale)==null?void 0:f.x)!=null?m:1,y:(g=(h=T.scale)==null?void 0:h.y)!=null?g:1},j=(b=T.alpha)!=null?b:1,J=(v=T.visible)!=null?v:!0,ae=new B(S);ae.anchor.set(F.x,F.y),ae.position.set(P.x,P.y),ae.scale.set(re.x,re.y),ae.alpha=j,ae.visible=J,M&&(M.removeChild(T),M.addChildAt(ae,L),console.log("[LIBRARY] \u2705 Replaced Text with Sprite in parent")),_.pixiObject&&(_.pixiObject=ae),_.pixi&&(_.pixi=ae),console.log("[LIBRARY] \u2705 Text \u2192 Sprite conversion complete")}else if(T!=null&&T.children){let B=T.children.find(M=>M.texture);B?(B.texture=S,console.log("[LIBRARY] \u2705 Applied to child sprite")):console.warn("[LIBRARY] \u26A0\uFE0F No texture found in displayObject or children")}}}let k=`raw/library/${n}/${i}`;xe({objectId:y,path:"render.asset.path",value:k}),console.log("[LIBRARY] \u2705 Staged config override for:",y,"path:",k)}catch(y){console.error("[LIBRARY] Error applying slot asset:",y)}}async function qh(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 Yn.Assets.load(o);if(!l){console.error("[LIBRARY] Failed to load default texture:",o);return}Be[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))}}xe({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 Xn=require("pixi.js");var zl=require("pixi.js"),It=()=>window.debugConfig||{},Gh=()=>window.resolveAnchorVec2||(e=>({x:.5,y:.5})),Wh=()=>window.resolveScreenAnchorPoint||(()=>new zl.Point),Yh=()=>window.resolveScreenRatioPoint||(()=>new zl.Point);function Vh(e){Ga(e)&&(e.objectDebugRaf||(e.objectDebugRaf=window.requestAnimationFrame(()=>Wa(e))))}function Kh(e){e.objectDebugRaf&&(window.cancelAnimationFrame(e.objectDebugRaf),e.objectDebugRaf=null),Kn(e)}function Ga(e){return e.isDebugOpen}function Wa(e){var a,s,o;if(!Ga(e)){e.objectDebugRaf=null;return}e.objectDebugRaf=window.requestAnimationFrame(()=>Wa(e));let t=Bl(e);if(!t){Vn(e,null),Kn(e);return}let i=Nl(e,t);if(!i){Vn(e,null),Kn(e);return}let n=new Xn.Point;(a=i.getGlobalPosition)==null||a.call(i,n);let r=Fl(e,i);Vn(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?ql(e,i):Wl(e),e.highlightAnchor&&r?Gl(e,r):Yl(e)}function Bl(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 Nl(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 Zn(e){let t=e.selectedObjectId;if(!t)return null;let i=window.getEditableObjectConfig;return typeof i!="function"?null:i(t)}function Fl(e,t){var s,o;let i=Zn(e);if(!i)return null;let n=(s=i.transform)!=null?s:{},r=$l(e);if(!r)return null;if(n.position_ratio!=null)return Yh()(r.width,r.height,n.position_ratio);let a=(o=n.anchor)!=null?o:"center";return Wh()(r.width,r.height,a)}function $l(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 Hl(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 Xn.Graphics,e.objectBoundsGfx.zIndex=999999,t.stage.addChild(e.objectBoundsGfx)),e.objectBoundsGfx):null}function Ul(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 Xn.Graphics,e.objectAnchorGfx.zIndex=1e6,t.stage.addChild(e.objectAnchorGfx)),e.objectAnchorGfx):null}function ql(e,t){var r;let i=Hl(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 Gl(e,t){let i=Ul(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 Wl(e){e.objectBoundsGfx&&e.objectBoundsGfx.clear()}function Yl(e){e.objectAnchorGfx&&e.objectAnchorGfx.clear()}function Kn(e){e.objectBoundsGfx&&(e.objectBoundsGfx.destroy(),e.objectBoundsGfx=null),e.objectAnchorGfx&&(e.objectAnchorGfx.destroy(),e.objectAnchorGfx=null)}function Vn(e,t){e.sceneToolsPanel.updateInfo(t?{instanceId:t.instanceId,worldX:t.worldX,worldY:t.worldY,anchorX:t.configX,anchorY:t.configY}:null)}function Xh(e,t){return t.split(".").reduce((i,n)=>i?i[n]:void 0,e)}function Zh(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 Vl(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 Va(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 Jh(e){window.location.reload()}function Ka(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 Qh(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(()=>(Mr(),dd)),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),Ya(e,p),(n=e.configViewer)==null||n.style.setProperty("display","block");return}console.log("[PREVIEW] Loaded object config",t,s),Ya(e,s),(r=e.configViewer)==null||r.style.setProperty("display","block");return}catch(a){console.error("[DEBUG] Failed to load object config:",a)}}function Ya(e,t){var u,p,f,m,h,g,b,v,y,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=Vl(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=(y=(b=t.transform)==null?void 0:b.anchor)!=null?y:(v=t.render)==null?void 0:v.anchor)!=null?x:{x:.5,y:.5},d=Gh()(c);a&&(a.value=String(d.x)),s&&(s.value=String(d.y))}function eg(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}:
|
|
918
918
|
position: (${i}, ${n})
|
|
919
919
|
scale: ${r}
|
|
920
|
-
anchor: (${a}, ${s})`;navigator.clipboard.writeText(o).then(()=>console.log("[DEBUG] Config values copied to clipboard")).catch(v=>console.error("[DEBUG] Failed to copy config values:",v))}async function Kl(e,t){var u,p,f,m,h,g,b,v,y,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((v=(b=e.container.querySelector("#config-anchor-x"))==null?void 0:b.value)!=null?v:.5),o=Number((x=(y=e.container.querySelector("#config-anchor-y"))==null?void 0:y.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(()=>(ke(),Lr));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=Zn(e);Vl(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 tg(e,t,i){let{applyConfigOverride:n}=await Promise.resolve().then(()=>(ke(),Lr));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 ig(e){e.selectedObjectId&&(e.objectAutoApplyTimer&&window.clearTimeout(e.objectAutoApplyTimer),e.objectAutoApplyTimer=window.setTimeout(()=>{e.objectAutoApplyTimer=null,Kl(e,{silent:!0})},150))}var mw=3e3;function ng(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,v=m.height;s=Math.min(s,b-h),o=Math.min(o,v-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(++mw);let y=e.getBoundingClientRect();(y.left<0||y.top<0||y.right>window.innerWidth||y.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 rg(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 Xl(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 ni(e){if(!e.container)return;let t=e.container.querySelector("#debug-workbench");if(!t)return;Xl(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 Xa(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"),Xl(e,n))})}catch(t){console.warn("[PREVIEW] Failed to load workbench state",t)}}function ag(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",Xl(e,t),ni(e))}function sg(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",()=>Va(e)),(s=t.querySelector("#debug-export"))==null||s.addEventListener("click",()=>Ka(e)),t.querySelectorAll(".workbench-tab").forEach(o=>{o.addEventListener("click",()=>{let l=o.dataset.tab;e.activeTab=l,Zl(e),ni(e)})}),Ql(e,t),Jl(e,t)}function Zl(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 Jl(e,t){Ce(e,t,"debug-scene-scale","engine.scale","#debug-scene-scale-value"),Ce(e,t,"debug-layout-scale","layout.scale_multiplier","#debug-layout-scale-value"),Ce(e,t,"debug-layout-offset-x","layout.position_offset.x","#debug-layout-offset-x-value"),Ce(e,t,"debug-layout-offset-y","layout.position_offset.y","#debug-layout-offset-y-value"),Ce(e,t,"debug-rect-thickness","layout.debug_rect_thickness","#debug-rect-thickness-value"),Ce(e,t,"debug-engine-scale","engine.scale","#debug-engine-scale-value"),Ce(e,t,"debug-background-scale","engine.background_scale","#debug-background-scale-value"),Ce(e,t,"debug-label-pulse-speed","engine.label_pulse_speed","#debug-label-pulse-speed-value"),Ce(e,t,"debug-label-pulse-intensity","engine.label_pulse_intensity","#debug-label-pulse-intensity-value"),Ce(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=Ot();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=Ot();s.layout&&(s.layout.debug_rect_color=Number.isFinite(a)?a:16711680)})}function og(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"),ng(t,i,e.debugOverlay),i.addEventListener("pointerup",()=>{setTimeout(()=>{ni(e),ag(e,t)},10)})),t&&n&&rg(t,n,()=>ni(e)),Xa(e)}function Ql(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 Ce(e,t,i,n,r){let a=t.querySelector(`#${i}`),s=t.querySelector(r);if(!a||!s)return;let o=Xh(Ot(),n);typeof o=="number"&&(a.value=String(o),s.textContent=String(o)),a.addEventListener("input",()=>{let l=Number(a.value);s.textContent=String(l),Zh(Ot(),n,l)})}ke();var Za=class{constructor(){this.container=null}initialize(t){this.container=t,window.addEventListener("config:changed",()=>{this.refreshPanel()}),this.refreshPanel()}render(){let t=Cr(),{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`
|
|
920
|
+
anchor: (${a}, ${s})`;navigator.clipboard.writeText(o).then(()=>console.log("[DEBUG] Config values copied to clipboard")).catch(v=>console.error("[DEBUG] Failed to copy config values:",v))}async function Kl(e,t){var u,p,f,m,h,g,b,v,y,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((v=(b=e.container.querySelector("#config-anchor-x"))==null?void 0:b.value)!=null?v:.5),o=Number((x=(y=e.container.querySelector("#config-anchor-y"))==null?void 0:y.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(()=>(ke(),Lr));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=Zn(e);Vl(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 tg(e,t,i){let{applyConfigOverride:n}=await Promise.resolve().then(()=>(ke(),Lr));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 ig(e){e.selectedObjectId&&(e.objectAutoApplyTimer&&window.clearTimeout(e.objectAutoApplyTimer),e.objectAutoApplyTimer=window.setTimeout(()=>{e.objectAutoApplyTimer=null,Kl(e,{silent:!0})},150))}var mw=3e3;function ng(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,v=m.height;s=Math.min(s,b-h),o=Math.min(o,v-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(++mw);let y=e.getBoundingClientRect();(y.left<0||y.top<0||y.right>window.innerWidth||y.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 rg(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 Xl(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 ni(e){if(!e.container)return;let t=e.container.querySelector("#debug-workbench");if(!t)return;Xl(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 Xa(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"),Xl(e,n))})}catch(t){console.warn("[PREVIEW] Failed to load workbench state",t)}}function ag(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",Xl(e,t),ni(e))}function sg(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",()=>Va(e)),(s=t.querySelector("#debug-export"))==null||s.addEventListener("click",()=>Ka(e)),t.querySelectorAll(".workbench-tab").forEach(o=>{o.addEventListener("click",()=>{let l=o.dataset.tab;e.activeTab=l,Zl(e),ni(e)})}),Ql(e,t),Jl(e,t)}function Zl(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 Jl(e,t){Ce(e,t,"debug-scene-scale","engine.scale","#debug-scene-scale-value"),Ce(e,t,"debug-layout-scale","layout.scale_multiplier","#debug-layout-scale-value"),Ce(e,t,"debug-layout-offset-x","layout.position_offset.x","#debug-layout-offset-x-value"),Ce(e,t,"debug-layout-offset-y","layout.position_offset.y","#debug-layout-offset-y-value"),Ce(e,t,"debug-rect-thickness","layout.debug_rect_thickness","#debug-rect-thickness-value"),Ce(e,t,"debug-engine-scale","engine.scale","#debug-engine-scale-value"),Ce(e,t,"debug-background-scale","engine.background_scale","#debug-background-scale-value"),Ce(e,t,"debug-label-pulse-speed","engine.label_pulse_speed","#debug-label-pulse-speed-value"),Ce(e,t,"debug-label-pulse-intensity","engine.label_pulse_intensity","#debug-label-pulse-intensity-value"),Ce(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 og(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"),ng(t,i,e.debugOverlay),i.addEventListener("pointerup",()=>{setTimeout(()=>{ni(e),ag(e,t)},10)})),t&&n&&rg(t,n,()=>ni(e)),Xa(e)}function Ql(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 Ce(e,t,i,n,r){let a=t.querySelector(`#${i}`),s=t.querySelector(r);if(!a||!s)return;let o=Xh(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),Zh(It(),n,l)})}ke();var Za=class{constructor(){this.container=null}initialize(t){this.container=t,window.addEventListener("config:changed",()=>{this.refreshPanel()}),this.refreshPanel()}render(){let t=Cr(),{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`
|
|
921
921
|
<div class="config-persistence-panel">
|
|
922
922
|
<div class="persistence-status-bar ${i?"has-changes":"no-changes"}">
|
|
923
923
|
${i?`
|
|
@@ -1341,7 +1341,7 @@ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
1341
1341
|
<div class="console-messages" id="console-messages"></div>
|
|
1342
1342
|
</div>
|
|
1343
1343
|
</div>
|
|
1344
|
-
`,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 lc(e={}){let t=new Ja(e);return typeof window!="undefined"&&(window.__previewShell=t),t.mount(),t}ke();function dg(e){try{if(e&&typeof e.keys=="function")return Array.from(e.keys())}catch{}return[]}function ug(e){var t;return e?((t=e.getDisplayObject)==null?void 0:t.call(e))||e.pixiObject||e:null}function ww(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 pg(e,t){var a,s,o,l,c;if(!e||!t)return;let i=t.transform||{};ww(e,t);let n=i.offset||i.position;n&&typeof n.x=="number"&&typeof n.y=="number"&&((a=e.position)!=null&&a.set?e.position.set(n.x,n.y):(typeof e.x=="number"&&(e.x=n.x),typeof e.y=="number"&&(e.y=n.y))),typeof i.scale=="number"&&((s=e.scale)!=null&&s.set?e.scale.set(i.scale):e.scale&&(e.scale.x=i.scale,e.scale.y=i.scale));let r=(l=i.anchor)!=null?l:(o=t.render)==null?void 0:o.anchor;r&&((c=e.anchor)!=null&&c.set)&&typeof r.x=="number"&&typeof r.y=="number"&&e.anchor.set(r.x,r.y)}function fg(e){if(typeof window=="undefined")return;let t=e==null?void 0:e.objects,i=dg(t);window.__editableObjectConfigs=t;let n=new Map;i.forEach(r=>n.set(r,[r])),window.__editableObjectInstances=n,window.refreshEditableConfigIndex=()=>fg(window.__editableConfig),window.getEditableObjectList=()=>{var r;return dg((r=window.__editableConfig)==null?void 0:r.objects)},window.getEditableObjectConfig=r=>{var a,s,o,l;return(l=(o=(s=(a=window.__editableConfig)==null?void 0:a.objects)==null?void 0:s.get)==null?void 0:o.call(s,r))!=null?l:null},window.getEditableEngineConfig=()=>{let r=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!r),!r)return null;if(r.engine&&r.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let a={...r.engine,objects:r.objects,scene:r.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(a.assets||{})),a}return r}}function _w(){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(()=>(fi(),Zc))]),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(v=>v==null?void 0:v.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=fe();Array.isArray(n)&&n.length&&(window.__editableConfig=i,Bt(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=i=>{try{let n=fe();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){if(i.runtime)for(let[r,a]of Object.entries(i.runtime))xe({path:`runtime.${r}`,value:a},{silent:!0,persist:!0});if(i.assets)for(let[r,a]of Object.entries(i.assets))xe({path:`assets.${r}`,value:a},{silent:!0,persist:!0}),typeof a=="string"&&t(r,a);if(i.splash)for(let[r,a]of Object.entries(i.splash))xe({path:`splash.${r}`,value:a},{silent:!0,persist:!0});i.runtime&&Object.assign(n.engine.runtime,i.runtime),i.assets&&Object.assign(n.engine.assets,i.assets),i.splash&&Object.assign(n.engine.splash,i.splash)}}}function Qa(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 mt.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"&&(_w(),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=ug(u);pg(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=ug(l);pg(p,s)}let c=[a];n==null||n(a,s,c)},rebuildIndexes(){let a=t();typeof window!="undefined"&&(window.__editableConfig=a,fg(a))}};return r.rebuildIndexes(),r}ke();var mg=ci(require("lottie-web"),1);bs(gs);typeof window!="undefined"&&!window.lottie&&(window.lottie=mg.default);var Wi=null,Ew=async()=>{if(!Wi){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]);Wi=JSON.parse(n)}else Wi=JSON.parse(t);return Wi}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}Wi=await(await fetch("./handler.config.json")).json()}return Wi},pc,er,bg,Yi,dc,uc;function Sw(e){pc=e.initGame,er=e.CustomAssets,bg=e.updateScreenState,Yi=e.globalResponsiveMultipliers,dc=e.layout,uc=e.clearResponsiveElements}var es="web_embed",Qn="https://example.com",hg={profile_id:es},It=null,We=null,cc={width:0,height:0},Aw=!0,Cw=async()=>{var l,c,d,u;document.title="Handler Pixi Game";let e=await Ew();hg={...e.ids||{},profile_id:es},Qn=e.destination_url||((c=(l=e.export_profiles)==null?void 0:l[es])==null?void 0:c.destination_url)||Qn,Mt.init({ids:hg,profile:es,destinationUrl:Qn});let t=Mt.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),We=lc({onDeviceChange:f=>{console.log(`[PREVIEW] Device switched to ${f.width}x${f.height}, restarting game...`),gg()},onRefresh:gg});let p=We.getGameContainer();p&&(t=p),window.addEventListener("handler-preview:screen",f=>{var v,y,x,w,S,A,E,k,I,_,T;let m=window.gameApp,h=window.gameObjectManager,{width:g,height:b}=f.detail;if(cc.width=g,cc.height=b,bg(g,b),!(!m||!m.renderer)){h&&s(m,h);try{m.renderer.resize(g,b);let R=m.view;R&&(R.style.width="100%",R.style.height="100%",R.style.display="block")}catch(R){console.warn("[SCREEN] Error resizing renderer:",R);return}if(i&&h&&dc)try{let R=(v=window.__mainContainer)!=null?v:m.stage,B=(E=(A=(w=window.__tutorialLabel)!=null?w:(x=(y=h.get("label_1"))==null?void 0:y.getDisplayObject)==null?void 0:x.call(y))!=null?A:(S=h.get("label_1"))==null?void 0:S.pixiObject)!=null?E:h.get("label_1"),M=h.get("background_1"),L=(T=(_=(I=window.__background)!=null?I:(k=M==null?void 0:M.getDisplayObject)==null?void 0:k.call(M))!=null?_:M==null?void 0:M.pixiObject)!=null?T:M;if(R){let P=R===m.stage;dc({mainContainer:R,label:B,background:L,backgroundTexture:(L==null?void 0:L.texture)||null,app:m},i,0,cc,h,{skipMainContainerTransform:P})}}catch(R){console.warn("[SCREEN] Error in layout:",R)}}})}let i=await et("scene.main");window.__editableConfig=i,window.__editableConfigBaseline||(window.__editableConfigBaseline=ue(i),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(u=(d=i.engine.runtime)==null?void 0:d.layout)!=null&&u.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(p=>setTimeout(p,100)),i=await et("scene.main"));let n=await pc(t,i,Qn,We);It=n.app;let r=n.gameObjectManager;window.gameApp=It,window.gameObjectManager=r;try{window.__liveEditBridge=Qa({getConfig:()=>window.__editableConfig,gameObjectManager:r,assets:er})}catch(p){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",p)}We&&We.notifyGameLoaded();let a=window.__debugScale;a&&typeof a=="number"&&(Yi.scale=a,console.log(`[DEBUG] Applied persisted debug scale: ${a}`)),s(It,r);function s(p,f){if(Aw){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${Yi.scale.toFixed(3)}`),p.stage){let h=function(g,b=0){if(!g||!g.children)return;let v=" ".repeat(b);g.children.forEach((y,x)=>{if(y&&y.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(y&&y.scale){let w=y.scale.x||1,S=y.scale.y||1;y.__originalScale||(y.__originalScale={x:w,y:S},console.log(`${v}[RESPONSIVE] Stored original scale for child[${x}]: ${w.toFixed(3)}, ${S.toFixed(3)}`));let A=y.__originalScale.x*Yi.scale,E=y.__originalScale.y*Yi.scale;typeof y.scale.set=="function"?y.scale.set(A,E):(y.scale.x=A,y.scale.y=E),console.log(`${v}[RESPONSIVE] Child[${x}] scale: ${w.toFixed(3)}\u2192${y.scale.x.toFixed(3)} (type: ${y.constructor.name})`),h(y,b+1)}else y&&console.log(`${v}[RESPONSIVE] Child[${x}] has no scale (type: ${y.constructor.name})`)})};var m=h;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),h(p.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 o(p){if(p!==void 0){Yi.scale=p,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${p.toFixed(3)}`);let f=window.gameApp,m=window.gameObjectManager;f&&m?(s(f,m),f.renderer&&(f.renderer.render(f.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!f}) or gameObjectManager (${!!m}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=o,Mt.start()},gg=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(We){We.notifyGameDestroyed();try{uc&&uc()}catch(a){console.warn("Failed to clear responsive elements",a)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let a=We.getGameContainer(),s=window.gameObjectManager;if(s&&typeof s.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),s.clear()),It){try{It.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}It=null}window.gameApp=null,window.gameObjectManager=null,a&&(a.innerHTML="");try{typeof er.resetScene=="function"&&er.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{et("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=ue(o)),pc(a,o,Qn).then(l=>{It=l.app,window.gameApp=It,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=Qa({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:er})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}We&&We.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{Mt.start()}catch{}})})},100)},1e3)}};Mr();ke();var fc="0.3.1",Tw=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"]),Sg={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"},Ag=Math.random().toString(36).slice(2),Xi=null,Vi={...Sg},Cg="web_embed",bc={},ir,hc=!1,tr=!1,rr=!1,Tg=!1,wc=1,is=0,as=!1,pt=!1,Ki="",Zi=Math.floor(window.innerWidth),Ji=Math.floor(window.innerHeight),vc=Zi>Ji,ft=!1,nr=!1,vg=!1,yg=!1,gc=!1,ns=null,ai=null,yc=!1,xc=!1,ts=new Map;function kg(){if(!ai)return null;let e=Date.now()-ai;return!Number.isFinite(e)||e<0?null:e}function mc(e){if(yc)return;let t=kg();t!==null&&(yc=!0,O("session_time",{duration_ms:t,reason:e}))}function xg(){if(Xi)return Xi;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),Xi=e,e}function rs(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Lg(e,t){return{event_name:e,ts:Date.now(),session_id:Ag,deployment_id:Vi.deployment_id,variant_id:Vi.variant_id,export_profile_id:Vi.profile_id,instance_id:Vi.instance_id||"default",env:Cg==="mraid"?"mraid":"web",attribution:ir,payload:t}}function O(e,t){let i=rs(e),n=Lg(i,t);ps(n,!!bc.analytics),dr(i,n),i!==e&&dr(e,n)}function ar(){ns&&(ns(Zi,Ji),ns=null)}function Qi(e){wc=e,O("volume",e)}function en(e){e&&(Tg=!0),!rr&&(rr=!0,O("pause"),Qi(0))}function sr(e){!e&&Tg||rr&&(rr=!1,O("resume"),Qi(wc))}function Pt(e,t){Zi=Math.floor(e||window.innerWidth),Ji=Math.floor(t||window.innerHeight),vc=Zi>Ji,O("resize",{width:Zi,height:Ji})}function kw(){if(Nc())try{let e=mraid.getMaxSize();Pt(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?sr():en()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let i=mraid.getMaxSize();Pt(i.width,i.height)}),mraid.getAudioVolume){let i=mraid.getAudioVolume();Qi(i?1:0)}if(mraid.addEventListener("audioVolumeChange",i=>{i!==null&&Qi(i>0?1:0)}),mraid.addEventListener("error",(i,n)=>{console.warn("mraid error:",i,"action:",n)}),as=!0,mraid.isViewable()&&mraid.getState()!=="hidden")ft=!0,O("boot"),O("view"),O("ready"),pt=!0,ar();else{let i=()=>{ft=!0,O("boot"),O("view"),O("ready"),pt=!0,ar()};mraid.addEventListener("ready",i)}}catch(e){console.warn("MRAID hook skipped",e)}}function Lw(){if(Fc())try{let e=dapi.getScreenSize();Pt(e.width,e.height),dapi.addEventListener("viewableChange",i=>{i.isViewable?sr():en()}),dapi.addEventListener("adResized",i=>{let n=dapi.getScreenSize();Pt(i.width||n.width,i.height||n.height)});let t=dapi.getAudioVolume();if(Qi(t?1:0),dapi.addEventListener("audioVolumeChange",i=>Qi(i?1:0)),as=!0,dapi.isViewable())ft=!0,O("boot"),O("view"),O("ready"),pt=!0,ar();else{let i=()=>{ft=!0,O("boot"),O("view"),O("ready"),pt=!0,ar()};dapi.addEventListener("ready",i)}}catch(e){console.warn("DAPI hook skipped",e)}}function wg(){let e=()=>{ft||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(ft=!0,O("boot"),O("view"),O("ready"),pt=!0,ar(),nr&&(nr=!1,Me.start()))};window.addEventListener("resize",()=>Pt()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(sr(),e()):en()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),as=!0}function Ow(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(vg=!0),!(vg&&t instanceof MouseEvent)&&(is+=1,xc||(xc=!0,O("first_interaction",{count:is})),O("interaction",is))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function _g(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(pi())(a=(r=window.TJ_API)==null?void 0:r.click)==null||a.call(r);else if($c())(o=(s=window.FbPlayableAd)==null?void 0:s.onCTAClick)==null||o.call(s);else if(Gc())(c=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||c.call(l);else if(qc())try{(u=(d=window.smxTracking)==null?void 0:d.redirect)==null||u.call(d)}catch(h){console.warn("Smadex redirect failed",h)}else if(Hc()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(e||Ki||""):e&&window.open(e)}else ui()?(p=window.install)==null||p.call(window):Uc()?(f=window.openAppStore)==null||f.call(window):fs()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):e&&window.open(e)}function Iw(){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),cr("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 Pw(){if(!pi())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Me.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function Eg(){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 Rw(){ui()&&(window.mintGameStart=()=>{sr(!0),Pt()},window.mintGameClose=()=>{en(!0)})}function Mw(){if(!hs())return;let e=window.NUC;!e||!e.trigger||(Me.on("cta_click",()=>{var t,i;return(i=(t=e.trigger).convert)==null?void 0:i.call(t,Ki)}),Me.on("complete",()=>{var t,i;return(i=(t=e.trigger).tryAgain)==null?void 0:i.call(t)}))}var Me={init(e={},t){var i;if(Cg=e.profile||"web_embed",bc=e.consent||{},Vi={...Sg,...e.ids||{}},Xi=e.rootEl||Xi,ir=void 0,Cc((i=e.telemetry)!=null&&i.endpoint?e.telemetry:null),ai=null,yc=!1,xc=!1,ts.clear(),Ki=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(ns=t),O("init"),document.body.oncontextmenu=()=>!1,xg(),Dw(Xi),Wc(),kw(),Lw(),!as){if(document.readyState==="complete")wg();else if(!yg){yg=!0;let n=()=>{wg(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Ow(),Iw(),Pw(),Rw(),Mw(),console.log(`%c @handler/playable-sdk %c v${fc} `,"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;"),ft&&!pt&&(O("boot"),O("view"),O("ready"),nr&&(nr=!1,Me.start()),pt=!0),pt=ft},getRoot(){return xg()},get version(){return fc},get maxWidth(){return Zi},get maxHeight(){return Ji},get isLandscape(){return vc},get isReady(){return pt},get isStarted(){return hc},get isPaused(){return rr},get isFinished(){return tr},get volume(){return wc},get interactions(){return is},on(e,t){cr(rs(e),t)},off(e,t){us(rs(e),t)},start(){var e,t;if(!hc){if(!ft){nr=!0;return}if(hc=!0,ai||(ai=Date.now()),O("start"),Pt(),ui())en(),(e=window.gameReady)==null||e.call(window);else if(pi()){let i=window.TJ_API;(t=i==null?void 0:i.setPlayableBuild)==null||t.call(i,{orientation:vc?"landscape":"portrait",buildID:fc})}}},finish(){var e,t;tr||(tr=!0,O("complete"),mc("complete"),ui()?(e=window.gameEnd)==null||e.call(window):fs()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):pi()&&Eg())},install(e){if(!tr){tr=!0,pi()?(Eg(),setTimeout(()=>Me.install(e),300)):(O("complete"),setTimeout(()=>Me.install(e),0));return}gc||(gc=!0,setTimeout(()=>gc=!1,500),O("cta_click"),O("conversion"),mc("cta"),_g(e||Ki))},emit(e,t){let i=rs(e);if(!Tw.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=Lg(i,t);ps(n,!!bc.analytics),dr(i,n)},gameStart(){Me.start()},gameEnd(){Me.finish()},ctaClick(e,t){O("cta_click",{url:e||Ki,manual:!0}),(t==null?void 0:t.open)!==!1&&_g(e||Ki)},ctaShow(e){O("cta_show",e)},ctaDismiss(e){O("cta_dismiss",e)},getGameTimeMs(){return kg()},endSession(e="manual"){mc(e)},setAttribution(e){ir=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(jw(`${Ag}:${e}`))%t.length,n=t[i];return ir={...ir||{},experiment_id:e},Vi.variant_id=n,O("ab_assign",{experiment_id:e,variant_id:n}),n},levelStart(e,t){ai||(ai=Date.now()),O("level_start",{level_id:e,...t})},levelComplete(e,t){O("level_complete",{level_id:e,...t})},levelFail(e,t){O("level_fail",{level_id:e,...t})},checkpoint(e,t){O("checkpoint",{checkpoint_id:e,...t})},reward(e,t){O("reward",{reward_id:e,...t})},tutorialStart(e,t){O("tutorial_start",{step_id:e,...t})},tutorialComplete(e,t){O("tutorial_complete",{step_id:e,...t})},tutorialSkip(e,t){O("tutorial_skip",{step_id:e,...t})},timerStart(e){e&&ts.set(e,Date.now())},timerEnd(e,t="custom",i){if(!e)return;let n=ts.get(e);if(!n)return;ts.delete(e);let r=Date.now()-n;if(!(!Number.isFinite(r)||r<0)){if(t==="custom"){O("engagement",{action:"timer",key:e,duration_ms:r,...i});return}O(t,{key:e,duration_ms:r,...i})}},fps(e,t){O("fps",{value:e,...t})},memory(e,t){O("memory",{bytes:e,...t})},assetLoadStart(e,t){O("asset_load_start",{asset_id:e,...t})},assetLoadComplete(e,t){O("asset_load_complete",{asset_id:e,...t})},reportError(e,t,i){O("error",{code:e,message:t,...i})},retry(){var e,t,i;if(ui())(e=window.gameRetry)==null||e.call(window);else if(hs()){let n=window.NUC;(i=(t=n==null?void 0:n.trigger)==null?void 0:t.tryAgain)==null||i.call(t)}O("engagement",{action:"retry"})},pause(){en(!0)},resume(){sr(!0)},resize(e,t){Pt(e,t)}},Mt=Me;function jw(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 Dw(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1344
|
+
`,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 lc(e={}){let t=new Ja(e);return typeof window!="undefined"&&(window.__previewShell=t),t.mount(),t}ke();function dg(e){try{if(e&&typeof e.keys=="function")return Array.from(e.keys())}catch{}return[]}function ug(e){var t;return e?((t=e.getDisplayObject)==null?void 0:t.call(e))||e.pixiObject||e:null}function ww(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 pg(e,t){var a,s,o,l,c;if(!e||!t)return;let i=t.transform||{};ww(e,t);let n=i.offset||i.position;n&&typeof n.x=="number"&&typeof n.y=="number"&&((a=e.position)!=null&&a.set?e.position.set(n.x,n.y):(typeof e.x=="number"&&(e.x=n.x),typeof e.y=="number"&&(e.y=n.y))),typeof i.scale=="number"&&((s=e.scale)!=null&&s.set?e.scale.set(i.scale):e.scale&&(e.scale.x=i.scale,e.scale.y=i.scale));let r=(l=i.anchor)!=null?l:(o=t.render)==null?void 0:o.anchor;r&&((c=e.anchor)!=null&&c.set)&&typeof r.x=="number"&&typeof r.y=="number"&&e.anchor.set(r.x,r.y)}function fg(e){if(typeof window=="undefined")return;let t=e==null?void 0:e.objects,i=dg(t);window.__editableObjectConfigs=t;let n=new Map;i.forEach(r=>n.set(r,[r])),window.__editableObjectInstances=n,window.refreshEditableConfigIndex=()=>fg(window.__editableConfig),window.getEditableObjectList=()=>{var r;return dg((r=window.__editableConfig)==null?void 0:r.objects)},window.getEditableObjectConfig=r=>{var a,s,o,l;return(l=(o=(s=(a=window.__editableConfig)==null?void 0:a.objects)==null?void 0:s.get)==null?void 0:o.call(s,r))!=null?l:null},window.getEditableEngineConfig=()=>{let r=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!r),!r)return null;if(r.engine&&r.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let a={...r.engine,objects:r.objects,scene:r.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(a.assets||{})),a}return r}}function _w(){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(()=>(fi(),Zc))]),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(v=>v==null?void 0:v.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=fe();Array.isArray(n)&&n.length&&(window.__editableConfig=i,Bt(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=i=>{try{let n=fe();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){if(i.runtime)for(let[r,a]of Object.entries(i.runtime))xe({path:`runtime.${r}`,value:a},{silent:!0,persist:!0});if(i.assets)for(let[r,a]of Object.entries(i.assets))xe({path:`assets.${r}`,value:a},{silent:!0,persist:!0}),typeof a=="string"&&t(r,a);if(i.splash)for(let[r,a]of Object.entries(i.splash))xe({path:`splash.${r}`,value:a},{silent:!0,persist:!0});i.runtime&&Object.assign(n.engine.runtime,i.runtime),i.assets&&Object.assign(n.engine.assets,i.assets),i.splash&&Object.assign(n.engine.splash,i.splash)}}}function Qa(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 mt.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"&&(_w(),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=ug(u);pg(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=ug(l);pg(p,s)}let c=[a];n==null||n(a,s,c)},rebuildIndexes(){let a=t();typeof window!="undefined"&&(window.__editableConfig=a,fg(a))}};return r.rebuildIndexes(),r}ke();var mg=ci(require("lottie-web"),1);bs(gs);typeof window!="undefined"&&!window.lottie&&(window.lottie=mg.default);var Wi=null,Ew=async()=>{if(!Wi){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]);Wi=JSON.parse(n)}else Wi=JSON.parse(t);return Wi}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}Wi=await(await fetch("./handler.config.json")).json()}return Wi},pc,er,bg,Yi,dc,uc;function Sw(e){pc=e.initGame,er=e.CustomAssets,bg=e.updateScreenState,Yi=e.globalResponsiveMultipliers,dc=e.layout,uc=e.clearResponsiveElements}var es="web_embed",Qn="https://example.com",hg={profile_id:es},Ot=null,We=null,cc={width:0,height:0},Aw=!0,Cw=async()=>{var l,c,d,u;document.title="Handler Pixi Game";let e=await Ew();hg={...e.ids||{},profile_id:es},Qn=e.destination_url||((c=(l=e.export_profiles)==null?void 0:l[es])==null?void 0:c.destination_url)||Qn,Mt.init({ids:hg,profile:es,destinationUrl:Qn});let t=Mt.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),We=lc({onDeviceChange:f=>{console.log(`[PREVIEW] Device switched to ${f.width}x${f.height}, restarting game...`),gg()},onRefresh:gg});let p=We.getGameContainer();p&&(t=p),window.addEventListener("handler-preview:screen",f=>{var v,y,x,w,S,A,E,k,O,_,T;let m=window.gameApp,h=window.gameObjectManager,{width:g,height:b}=f.detail;if(cc.width=g,cc.height=b,bg(g,b),!(!m||!m.renderer)){h&&s(m,h);try{m.renderer.resize(g,b);let R=m.view;R&&(R.style.width="100%",R.style.height="100%",R.style.display="block")}catch(R){console.warn("[SCREEN] Error resizing renderer:",R);return}if(i&&h&&dc)try{let R=(v=window.__mainContainer)!=null?v:m.stage,B=(E=(A=(w=window.__tutorialLabel)!=null?w:(x=(y=h.get("label_1"))==null?void 0:y.getDisplayObject)==null?void 0:x.call(y))!=null?A:(S=h.get("label_1"))==null?void 0:S.pixiObject)!=null?E:h.get("label_1"),M=h.get("background_1"),L=(T=(_=(O=window.__background)!=null?O:(k=M==null?void 0:M.getDisplayObject)==null?void 0:k.call(M))!=null?_:M==null?void 0:M.pixiObject)!=null?T:M;if(R){let P=R===m.stage;dc({mainContainer:R,label:B,background:L,backgroundTexture:(L==null?void 0:L.texture)||null,app:m},i,0,cc,h,{skipMainContainerTransform:P})}}catch(R){console.warn("[SCREEN] Error in layout:",R)}}})}let i=await et("scene.main");window.__editableConfig=i,window.__editableConfigBaseline||(window.__editableConfigBaseline=ue(i),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(u=(d=i.engine.runtime)==null?void 0:d.layout)!=null&&u.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(p=>setTimeout(p,100)),i=await et("scene.main"));let n=await pc(t,i,Qn,We);Ot=n.app;let r=n.gameObjectManager;window.gameApp=Ot,window.gameObjectManager=r;try{window.__liveEditBridge=Qa({getConfig:()=>window.__editableConfig,gameObjectManager:r,assets:er})}catch(p){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",p)}We&&We.notifyGameLoaded();let a=window.__debugScale;a&&typeof a=="number"&&(Yi.scale=a,console.log(`[DEBUG] Applied persisted debug scale: ${a}`)),s(Ot,r);function s(p,f){if(Aw){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${Yi.scale.toFixed(3)}`),p.stage){let h=function(g,b=0){if(!g||!g.children)return;let v=" ".repeat(b);g.children.forEach((y,x)=>{if(y&&y.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(y&&y.scale){let w=y.scale.x||1,S=y.scale.y||1;y.__originalScale||(y.__originalScale={x:w,y:S},console.log(`${v}[RESPONSIVE] Stored original scale for child[${x}]: ${w.toFixed(3)}, ${S.toFixed(3)}`));let A=y.__originalScale.x*Yi.scale,E=y.__originalScale.y*Yi.scale;typeof y.scale.set=="function"?y.scale.set(A,E):(y.scale.x=A,y.scale.y=E),console.log(`${v}[RESPONSIVE] Child[${x}] scale: ${w.toFixed(3)}\u2192${y.scale.x.toFixed(3)} (type: ${y.constructor.name})`),h(y,b+1)}else y&&console.log(`${v}[RESPONSIVE] Child[${x}] has no scale (type: ${y.constructor.name})`)})};var m=h;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),h(p.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 o(p){if(p!==void 0){Yi.scale=p,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${p.toFixed(3)}`);let f=window.gameApp,m=window.gameObjectManager;f&&m?(s(f,m),f.renderer&&(f.renderer.render(f.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!f}) or gameObjectManager (${!!m}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=o,Mt.start()},gg=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(We){We.notifyGameDestroyed();try{uc&&uc()}catch(a){console.warn("Failed to clear responsive elements",a)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let a=We.getGameContainer(),s=window.gameObjectManager;if(s&&typeof s.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),s.clear()),Ot){try{Ot.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}Ot=null}window.gameApp=null,window.gameObjectManager=null,a&&(a.innerHTML="");try{typeof er.resetScene=="function"&&er.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{et("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=ue(o)),pc(a,o,Qn).then(l=>{Ot=l.app,window.gameApp=Ot,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=Qa({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:er})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}We&&We.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{Mt.start()}catch{}})})},100)},1e3)}};Mr();ke();var fc="0.3.1",Tw=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"]),Sg={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"},Ag=Math.random().toString(36).slice(2),Xi=null,Vi={...Sg},Cg="web_embed",bc={},ir,hc=!1,tr=!1,rr=!1,Tg=!1,wc=1,is=0,as=!1,pt=!1,Ki="",Zi=Math.floor(window.innerWidth),Ji=Math.floor(window.innerHeight),vc=Zi>Ji,ft=!1,nr=!1,vg=!1,yg=!1,gc=!1,ns=null,ai=null,yc=!1,xc=!1,ts=new Map;function kg(){if(!ai)return null;let e=Date.now()-ai;return!Number.isFinite(e)||e<0?null:e}function mc(e){if(yc)return;let t=kg();t!==null&&(yc=!0,I("session_time",{duration_ms:t,reason:e}))}function xg(){if(Xi)return Xi;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),Xi=e,e}function rs(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Lg(e,t){return{event_name:e,ts:Date.now(),session_id:Ag,deployment_id:Vi.deployment_id,variant_id:Vi.variant_id,export_profile_id:Vi.profile_id,instance_id:Vi.instance_id||"default",env:Cg==="mraid"?"mraid":"web",attribution:ir,payload:t}}function I(e,t){let i=rs(e),n=Lg(i,t);ps(n,!!bc.analytics),dr(i,n),i!==e&&dr(e,n)}function ar(){ns&&(ns(Zi,Ji),ns=null)}function Qi(e){wc=e,I("volume",e)}function en(e){e&&(Tg=!0),!rr&&(rr=!0,I("pause"),Qi(0))}function sr(e){!e&&Tg||rr&&(rr=!1,I("resume"),Qi(wc))}function Pt(e,t){Zi=Math.floor(e||window.innerWidth),Ji=Math.floor(t||window.innerHeight),vc=Zi>Ji,I("resize",{width:Zi,height:Ji})}function kw(){if(Nc())try{let e=mraid.getMaxSize();Pt(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?sr():en()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let i=mraid.getMaxSize();Pt(i.width,i.height)}),mraid.getAudioVolume){let i=mraid.getAudioVolume();Qi(i?1:0)}if(mraid.addEventListener("audioVolumeChange",i=>{i!==null&&Qi(i>0?1:0)}),mraid.addEventListener("error",(i,n)=>{console.warn("mraid error:",i,"action:",n)}),as=!0,mraid.isViewable()&&mraid.getState()!=="hidden")ft=!0,I("boot"),I("view"),I("ready"),pt=!0,ar();else{let i=()=>{ft=!0,I("boot"),I("view"),I("ready"),pt=!0,ar()};mraid.addEventListener("ready",i)}}catch(e){console.warn("MRAID hook skipped",e)}}function Lw(){if(Fc())try{let e=dapi.getScreenSize();Pt(e.width,e.height),dapi.addEventListener("viewableChange",i=>{i.isViewable?sr():en()}),dapi.addEventListener("adResized",i=>{let n=dapi.getScreenSize();Pt(i.width||n.width,i.height||n.height)});let t=dapi.getAudioVolume();if(Qi(t?1:0),dapi.addEventListener("audioVolumeChange",i=>Qi(i?1:0)),as=!0,dapi.isViewable())ft=!0,I("boot"),I("view"),I("ready"),pt=!0,ar();else{let i=()=>{ft=!0,I("boot"),I("view"),I("ready"),pt=!0,ar()};dapi.addEventListener("ready",i)}}catch(e){console.warn("DAPI hook skipped",e)}}function wg(){let e=()=>{ft||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(ft=!0,I("boot"),I("view"),I("ready"),pt=!0,ar(),nr&&(nr=!1,Me.start()))};window.addEventListener("resize",()=>Pt()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(sr(),e()):en()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),as=!0}function Iw(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(vg=!0),!(vg&&t instanceof MouseEvent)&&(is+=1,xc||(xc=!0,I("first_interaction",{count:is})),I("interaction",is))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function _g(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(pi())(a=(r=window.TJ_API)==null?void 0:r.click)==null||a.call(r);else if($c())(o=(s=window.FbPlayableAd)==null?void 0:s.onCTAClick)==null||o.call(s);else if(Gc())(c=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||c.call(l);else if(qc())try{(u=(d=window.smxTracking)==null?void 0:d.redirect)==null||u.call(d)}catch(h){console.warn("Smadex redirect failed",h)}else if(Hc()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(e||Ki||""):e&&window.open(e)}else ui()?(p=window.install)==null||p.call(window):Uc()?(f=window.openAppStore)==null||f.call(window):fs()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):e&&window.open(e)}function Ow(){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),cr("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 Pw(){if(!pi())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Me.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function Eg(){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 Rw(){ui()&&(window.mintGameStart=()=>{sr(!0),Pt()},window.mintGameClose=()=>{en(!0)})}function Mw(){if(!hs())return;let e=window.NUC;!e||!e.trigger||(Me.on("cta_click",()=>{var t,i;return(i=(t=e.trigger).convert)==null?void 0:i.call(t,Ki)}),Me.on("complete",()=>{var t,i;return(i=(t=e.trigger).tryAgain)==null?void 0:i.call(t)}))}var Me={init(e={},t){var i;if(Cg=e.profile||"web_embed",bc=e.consent||{},Vi={...Sg,...e.ids||{}},Xi=e.rootEl||Xi,ir=void 0,Cc((i=e.telemetry)!=null&&i.endpoint?e.telemetry:null),ai=null,yc=!1,xc=!1,ts.clear(),Ki=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(ns=t),I("init"),document.body.oncontextmenu=()=>!1,xg(),Dw(Xi),Wc(),kw(),Lw(),!as){if(document.readyState==="complete")wg();else if(!yg){yg=!0;let n=()=>{wg(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Iw(),Ow(),Pw(),Rw(),Mw(),console.log(`%c @handler/playable-sdk %c v${fc} `,"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;"),ft&&!pt&&(I("boot"),I("view"),I("ready"),nr&&(nr=!1,Me.start()),pt=!0),pt=ft},getRoot(){return xg()},get version(){return fc},get maxWidth(){return Zi},get maxHeight(){return Ji},get isLandscape(){return vc},get isReady(){return pt},get isStarted(){return hc},get isPaused(){return rr},get isFinished(){return tr},get volume(){return wc},get interactions(){return is},on(e,t){cr(rs(e),t)},off(e,t){us(rs(e),t)},start(){var e,t;if(!hc){if(!ft){nr=!0;return}if(hc=!0,ai||(ai=Date.now()),I("start"),Pt(),ui())en(),(e=window.gameReady)==null||e.call(window);else if(pi()){let i=window.TJ_API;(t=i==null?void 0:i.setPlayableBuild)==null||t.call(i,{orientation:vc?"landscape":"portrait",buildID:fc})}}},finish(){var e,t;tr||(tr=!0,I("complete"),mc("complete"),ui()?(e=window.gameEnd)==null||e.call(window):fs()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):pi()&&Eg())},install(e){if(!tr){tr=!0,pi()?(Eg(),setTimeout(()=>Me.install(e),300)):(I("complete"),setTimeout(()=>Me.install(e),0));return}gc||(gc=!0,setTimeout(()=>gc=!1,500),I("cta_click"),I("conversion"),mc("cta"),_g(e||Ki))},emit(e,t){let i=rs(e);if(!Tw.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=Lg(i,t);ps(n,!!bc.analytics),dr(i,n)},gameStart(){Me.start()},gameEnd(){Me.finish()},ctaClick(e,t){I("cta_click",{url:e||Ki,manual:!0}),(t==null?void 0:t.open)!==!1&&_g(e||Ki)},ctaShow(e){I("cta_show",e)},ctaDismiss(e){I("cta_dismiss",e)},getGameTimeMs(){return kg()},endSession(e="manual"){mc(e)},setAttribution(e){ir=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(jw(`${Ag}:${e}`))%t.length,n=t[i];return ir={...ir||{},experiment_id:e},Vi.variant_id=n,I("ab_assign",{experiment_id:e,variant_id:n}),n},levelStart(e,t){ai||(ai=Date.now()),I("level_start",{level_id:e,...t})},levelComplete(e,t){I("level_complete",{level_id:e,...t})},levelFail(e,t){I("level_fail",{level_id:e,...t})},checkpoint(e,t){I("checkpoint",{checkpoint_id:e,...t})},reward(e,t){I("reward",{reward_id:e,...t})},tutorialStart(e,t){I("tutorial_start",{step_id:e,...t})},tutorialComplete(e,t){I("tutorial_complete",{step_id:e,...t})},tutorialSkip(e,t){I("tutorial_skip",{step_id:e,...t})},timerStart(e){e&&ts.set(e,Date.now())},timerEnd(e,t="custom",i){if(!e)return;let n=ts.get(e);if(!n)return;ts.delete(e);let r=Date.now()-n;if(!(!Number.isFinite(r)||r<0)){if(t==="custom"){I("engagement",{action:"timer",key:e,duration_ms:r,...i});return}I(t,{key:e,duration_ms:r,...i})}},fps(e,t){I("fps",{value:e,...t})},memory(e,t){I("memory",{bytes:e,...t})},assetLoadStart(e,t){I("asset_load_start",{asset_id:e,...t})},assetLoadComplete(e,t){I("asset_load_complete",{asset_id:e,...t})},reportError(e,t,i){I("error",{code:e,message:t,...i})},retry(){var e,t,i;if(ui())(e=window.gameRetry)==null||e.call(window);else if(hs()){let n=window.NUC;(i=(t=n==null?void 0:n.trigger)==null?void 0:t.tryAgain)==null||i.call(t)}I("engagement",{action:"retry"})},pause(){en(!0)},resume(){sr(!0)},resize(e,t){Pt(e,t)}},Mt=Me;function jw(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 Dw(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1345
1345
|
(function(){
|
|
1346
1346
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
1347
1347
|
function unlock(){
|