handler-playable-sdk 0.3.11 → 0.3.13

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.
@@ -1,5 +1,5 @@
1
- "use strict";var kg=Object.create;var $n=Object.defineProperty;var Lg=Object.getOwnPropertyDescriptor;var Rg=Object.getOwnPropertyNames;var Mg=Object.getPrototypeOf,Og=Object.prototype.hasOwnProperty;var qe=(e,t)=>()=>(e&&(t=e(e=0)),t);var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fc=(e,t)=>{for(var i in t)$n(e,i,{get:t[i],enumerable:!0})},hc=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Rg(t))!Og.call(e,r)&&r!==i&&$n(e,r,{get:()=>t[r],enumerable:!(n=Lg(t,r))||n.enumerable});return e};var Ge=(e,t,i)=>(i=e!=null?kg(Mg(e)):{},hc(t||!e||!e.__esModule?$n(i,"default",{value:e,enumerable:!0}):i,e)),Ig=e=>hc($n({},"__esModule",{value:!0}),e);var We,xa=qe(()=>{"use strict";We=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()}};We.store=new Map});function zg(){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 Bg(){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 Fg(){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 Ng(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${B}`),Object.keys(Ye).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Ye)),Ye;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Ye={...window.INLINE_ASSETS},Ye;if(!(B==="publish"&&Le!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Ye;if(!wa){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),wa=(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 Ye=await wa,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Ye)),Ye}function _a(e){return e===null||typeof e!="object"||(Object.freeze(e),Object.values(e).forEach(t=>_a(t))),e}function Hg(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),Ve.Texture.from(n)}function Ea(e,t){Hc.set(e,t)}var Ve,Fc,Nc,Lt,B,Le,ut,Ye,wa,Hc,Rt,Wn=qe(()=>{"use strict";Ve=require("pixi.js");xa();Fc=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Nc=zg(),Lt=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,B=Nc?"publish":Fc,Le=Lt==null?void 0:Lt.assetsInlined;Lt!=null&&Lt.buildMode&&(B=Lt.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${B}`));ut=Fg();ut!=null&&ut.buildMode&&(B=ut.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${B}`));(ut==null?void 0:ut.assetsInlined)!==void 0&&(Le=ut.assetsInlined);Bg().then(e=>{e!=null&&e.buildMode&&e.buildMode!==B&&(B=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${B}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(Le=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${Fc}, Runtime: ${Nc?"publish":"dev"}, Effective: ${B}`);Ye={},wa=null;Hc=new Map;Rt=class{static async load(t,i,n,r){let a=`${t}:${i.path}`,s=We.get(a);if(s!==void 0)return s;console.log(`[AssetLoader] Loading asset: ${t}, type: ${i.type}, Effective mode: ${B}`),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 Ng(),d=o[t];if(!d&&r&&(d=o[r],d&&console.log(`[AssetLoader] Found inline data for ${t} using configId: ${r}`)),!d&&i.path){let f=i.path.split("/");if(f.length>=2){let u=f[f.length-1].split(".")[0];o[u]&&(d=o[u],console.log(`[AssetLoader] Found inline data for ${t} using assetName: ${u}`))}}if(console.log("[AssetLoader] Inline data for",t,":",d?"FOUND":"NOT FOUND"),B==="publish"&&Le!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!d))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${t}, path: ${i.path}`);let c=Hc.get(i.type);if(c)try{let f=await c(i.path,d,t,n);return We.set(a,f),f}catch(f){return this.handleFailure(t,i.type,f)}try{let f;switch(i.type){case"image":f=await this.loadImage(i.path,d);break;case"json":f=await this.loadJSON(i.path,d),f=_a(f);break;default:throw new Error(`Unknown asset type: ${i.type}`)}return We.set(a,f),f}catch(f){return this.handleFailure(t,i.type,f)}}static async loadImage(t,i){let n=B==="publish",r=n&&Le!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${B}, 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 Ve.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 Ve.Assets.load(i)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await Ve.Assets.load(t)}return await Ve.Assets.load(t)}static async loadJSON(t,i){let n=B==="publish",r=n&&Le!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${B}, 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(B==="dev"){let a=i==="image"?Hg():_a({__placeholder:!0,type:i});return We.set(t+":"+((n==null?void 0:n.path)||"missing"),a),a}throw n}};Ea("image",async(e,t)=>{let i=B==="publish",n=i&&Le!==!1,r=B==="brand",a=i&&Le===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${B}, 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 Ve.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}"`))),Ve.Assets.load(t||s)});Ea("json",async(e,t)=>{let i=B==="publish",n=i&&Le!==!1,r=B==="brand",a=i&&Le===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${B}, 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 Aa,Wg,Yn,$i=qe(()=>{"use strict";Wn();Aa=class{constructor(){this.textures=new Map;this.readyPromise=null;this.priorityReadyPromise=null;this.priorityReadyResolve=null;this.config=null;this.app=null;this.attempted=new Set;this.waiters=new Set}init(t,i){if(this.config===t&&this.app===i&&this.priorityReadyPromise){console.log("[AssetTextures] init called with same config/app; keeping existing state");return}this.textures.clear(),this.readyPromise=null,this.priorityReadyPromise=null,this.priorityReadyResolve=null,this.attempted.clear(),this.waiters.clear(),this.priorityReadyPromise=new Promise(n=>{this.priorityReadyResolve=n}),this.config=t,this.app=i,console.log("[AssetTextures] Initialized with config, cleared previous textures")}async ready(){if(this.readyPromise){await this.readyPromise;return}if(!this.config)throw new Error("[AssetTextures] Must call init() before ready() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before ready() - app is null");let t=this.config,i=this.app;return this.readyPromise=(async()=>{var s;console.log("[AssetTextures] Loading all assets...");let n=new Set(["background_loading_1"]),r=[],a=[];for(let[o,d]of t.objects.entries()){let l=(s=d.render)==null?void 0:s.asset;if(!l)continue;let c=async()=>{var f;try{let u=(f=d.identity)==null?void 0:f.id;console.log(`[AssetTextures] Loading ${l.type}: ${o} (${u})`);let p=await Rt.load(o,l,i,u);this.textures.set(o,p),console.log(`[AssetTextures] \u2713 Loaded: ${o}`)}catch(u){console.error(`[AssetTextures] \u2717 Failed to load: ${o}`,u)}finally{this.attempted.add(o);try{for(let u of Array.from(this.waiters))u()}catch{}}};n.has(o)?r.push(c()):a.push(c())}r.length>0&&(console.log("[AssetTextures] Phase 1: Loading priority assets (loading screen)..."),await Promise.all(r),console.log("[AssetTextures] Phase 1: Priority assets ready")),this.priorityReadyResolve&&this.priorityReadyResolve(),console.log("[AssetTextures] Phase 2: Loading remaining assets..."),await Promise.all(a),console.log("[AssetTextures] All textures loaded:",Array.from(this.textures.keys()))})(),this.readyPromise}async priorityReady(){return this.priorityReadyPromise?this.priorityReadyPromise:Promise.resolve()}async waitFor(t,i={}){if(!this.config)throw new Error("[AssetTextures] Must call init() before waitFor() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before waitFor() - app is null");let r=Array.from(new Set((t||[]).filter(o=>typeof o=="string"&&o))).filter(o=>{var d,l,c,f;try{let u=(c=(l=(d=this.config)==null?void 0:d.objects)==null?void 0:l.get)==null?void 0:c.call(l,o);return!!((f=u==null?void 0:u.render)!=null&&f.asset)}catch{return!1}});if(r.length===0)return;this.ready().catch(()=>{});let a=()=>r.every(o=>this.textures.has(o)||this.attempted.has(o));if(a())return;let s=typeof i.timeoutMs=="number"?i.timeoutMs:15e3;await new Promise(o=>{let d=!1,l=()=>{d||a()&&(d=!0,this.waiters.delete(l),o())};this.waiters.add(l),l(),s>0&&setTimeout(()=>{d||(d=!0,this.waiters.delete(l),console.warn("[AssetTextures] waitFor timed out; continuing",{ids:r}),o())},s)})}get(t){return this.textures.get(t)}set(t,i){this.textures.set(t,i),console.log(`[AssetTextures] Updated texture: ${t}`)}clear(){this.textures.clear(),this.readyPromise=null,console.log("[AssetTextures] Cleared all textures")}getAllIds(){return Array.from(this.textures.keys())}},Wg=new Aa,Yn=new Proxy(Wg,{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 hm,pt=qe(()=>{"use strict";hm="handler_preview_override_mode";if(typeof window!="undefined"){let e=window.localStorage.getItem(hm);window.__enableConfigOverrides=e===null?!0:e==="true"}});var Wc,It,n_,La=qe(()=>{"use strict";pt();Wc=null,It="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)Wc=e,It=e.buildMode,console.log("[CONFIG] Loaded inline build settings:",e,"buildMode:",It);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);Wc=i,It=i.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",i,"buildMode:",It)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",It)}catch(t){console.log("[CONFIG] Failed to load build-settings.json:",t instanceof Error?t.message:String(t))}}console.log("[CONFIG] Final buildMode:",It);n_=It==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});var Ra=qe(()=>{"use strict"});var Vc=qe(()=>{"use strict";Ra();La()});var Ma=qe(()=>{"use strict";La();Ra();Vc()});var Gi=E((h1,Oa)=>{"use strict";typeof process=="undefined"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Oa.exports={nextTick:Sm}:Oa.exports=process;function Sm(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 Zc=E((g1,Kc)=>{"use strict";var Am={}.toString;Kc.exports=Array.isArray||function(e){return Am.call(e)=="[object Array]"}});var Ia=E((m1,Jc)=>{"use strict";Jc.exports=require("stream")});var Wi=E((Pa,ed)=>{"use strict";var ir=require("buffer"),Je=ir.Buffer;function Qc(e,t){for(var i in e)t[i]=e[i]}Je.from&&Je.alloc&&Je.allocUnsafe&&Je.allocUnsafeSlow?ed.exports=ir:(Qc(ir,Pa),Pa.Buffer=ti);function ti(e,t,i){return Je(e,t,i)}Qc(Je,ti);ti.from=function(e,t,i){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Je(e,t,i)};ti.alloc=function(e,t,i){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Je(e);return t!==void 0?typeof i=="string"?n.fill(t,i):n.fill(t):n.fill(0),n};ti.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Je(e)};ti.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return ir.SlowBuffer(e)}});var ii=E(K=>{"use strict";function Cm(e){return Array.isArray?Array.isArray(e):nr(e)==="[object Array]"}K.isArray=Cm;function Tm(e){return typeof e=="boolean"}K.isBoolean=Tm;function km(e){return e===null}K.isNull=km;function Lm(e){return e==null}K.isNullOrUndefined=Lm;function Rm(e){return typeof e=="number"}K.isNumber=Rm;function Mm(e){return typeof e=="string"}K.isString=Mm;function Om(e){return typeof e=="symbol"}K.isSymbol=Om;function Im(e){return e===void 0}K.isUndefined=Im;function Pm(e){return nr(e)==="[object RegExp]"}K.isRegExp=Pm;function Dm(e){return typeof e=="object"&&e!==null}K.isObject=Dm;function jm(e){return nr(e)==="[object Date]"}K.isDate=jm;function zm(e){return nr(e)==="[object Error]"||e instanceof Error}K.isError=zm;function Bm(e){return typeof e=="function"}K.isFunction=Bm;function Fm(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}K.isPrimitive=Fm;K.isBuffer=require("buffer").Buffer.isBuffer;function nr(e){return Object.prototype.toString.call(e)}});var td=E((y1,Da)=>{"use strict";typeof Object.create=="function"?Da.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Da.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 ni=E((v1,za)=>{"use strict";try{if(ja=require("util"),typeof ja.inherits!="function")throw"";za.exports=ja.inherits}catch{za.exports=td()}var ja});var nd=E((x1,Ba)=>{"use strict";function Nm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var id=Wi().Buffer,Yi=require("util");function Hm(e,t,i){e.copy(t,i)}Ba.exports=(function(){function e(){Nm(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 id.alloc(0);for(var n=id.allocUnsafe(i>>>0),r=this.head,a=0;r;)Hm(r.data,n,a),a+=r.data.length,r=r.next;return n},e})();Yi&&Yi.inspect&&Yi.inspect.custom&&(Ba.exports.prototype[Yi.inspect.custom]=function(){var e=Yi.inspect({length:this.length});return this.constructor.name+" "+e})});var Fa=E((w1,rd)=>{"use strict";var rr=Gi();function $m(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,rr.nextTick(ar,this,e)):rr.nextTick(ar,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,rr.nextTick(ar,i,a)):rr.nextTick(ar,i,a):t&&t(a)}),this)}function Um(){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 ar(e,t){e.emit("error",t)}rd.exports={destroy:$m,undestroy:Um}});var sd=E((_1,ad)=>{"use strict";ad.exports=require("util").deprecate});var Ha=E((E1,hd)=>{"use strict";var Pt=Gi();hd.exports=$;function ld(e){var t=this;this.next=null,this.entry=null,this.finish=function(){ob(t,e)}}var qm=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Pt.nextTick,ri;$.WritableState=Xi;var cd=Object.create(ii());cd.inherits=ni();var Gm={deprecate:sd()},dd=Ia(),or=Wi().Buffer,Wm=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Ym(e){return or.from(e)}function Vm(e){return or.isBuffer(e)||e instanceof Wm}var ud=Fa();cd.inherits($,dd);function Xm(){}function Xi(e,t){ri=ri||Dt(),e=e||{};var i=t instanceof ri;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){ib(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 ld(this)}Xi.prototype.getBuffer=function(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i};(function(){try{Object.defineProperty(Xi.prototype,"buffer",{get:Gm.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var sr;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(sr=Function.prototype[Symbol.hasInstance],Object.defineProperty($,Symbol.hasInstance,{value:function(e){return sr.call(this,e)?!0:this!==$?!1:e&&e._writableState instanceof Xi}})):sr=function(e){return e instanceof this};function $(e){if(ri=ri||Dt(),!sr.call($,this)&&!(this instanceof ri))return new $(e);this._writableState=new Xi(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)),dd.call(this)}$.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Km(e,t){var i=new Error("write after end");e.emit("error",i),Pt.nextTick(t,i)}function Zm(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),Pt.nextTick(n,a),r=!1),r}$.prototype.write=function(e,t,i){var n=this._writableState,r=!1,a=!n.objectMode&&Vm(e);return a&&!or.isBuffer(e)&&(e=Ym(e)),typeof t=="function"&&(i=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof i!="function"&&(i=Xm),n.ended?Km(this,i):(a||Zm(this,n,e,i))&&(n.pendingcb++,r=Qm(this,n,a,e,t,i)),r};$.prototype.cork=function(){var e=this._writableState;e.corked++};$.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&pd(this,e))};$.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 Jm(e,t,i){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=or.from(t,i)),t}Object.defineProperty($.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Qm(e,t,i,n,r,a){if(!i){var s=Jm(t,n,r);n!==s&&(i=!0,r="buffer",n=s)}var o=t.objectMode?1:n.length;t.length+=o;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Na(e,t,!1,o,n,r,a);return d}function Na(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 eb(e,t,i,n,r){--t.pendingcb,i?(Pt.nextTick(r,n),Pt.nextTick(Vi,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(r(n),e._writableState.errorEmitted=!0,e.emit("error",n),Vi(e,t))}function tb(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function ib(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if(tb(i),t)eb(e,i,n,t,r);else{var a=fd(i);!a&&!i.corked&&!i.bufferProcessing&&i.bufferedRequest&&pd(e,i),n?qm(od,e,i,a,r):od(e,i,a,r)}}function od(e,t,i,n){i||nb(e,t),t.pendingcb--,n(),Vi(e,t)}function nb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function pd(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,Na(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 ld(t),t.bufferedRequestCount=0}else{for(;i;){var d=i.chunk,l=i.encoding,c=i.callback,f=t.objectMode?1:d.length;if(Na(e,t,!1,f,d,l,c),i=i.next,t.bufferedRequestCount--,t.writing)break}i===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=i,t.bufferProcessing=!1}$.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))};$.prototype._writev=null;$.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||sb(this,n,i)};function fd(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function rb(e,t){e._final(function(i){t.pendingcb--,i&&e.emit("error",i),t.prefinished=!0,e.emit("prefinish"),Vi(e,t)})}function ab(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Pt.nextTick(rb,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Vi(e,t){var i=fd(t);return i&&(ab(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),i}function sb(e,t,i){t.ending=!0,Vi(e,t),i&&(t.finished?Pt.nextTick(i):e.once("finish",i)),t.ended=!0,e.writable=!1}function ob(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($.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});$.prototype.destroy=ud.destroy;$.prototype._undestroy=ud.undestroy;$.prototype._destroy=function(e,t){this.end(),t(e)}});var Dt=E((S1,yd)=>{"use strict";var gd=Gi(),lb=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};yd.exports=Qe;var md=Object.create(ii());md.inherits=ni();var bd=qa(),Ua=Ha();md.inherits(Qe,bd);for($a=lb(Ua.prototype),lr=0;lr<$a.length;lr++)cr=$a[lr],Qe.prototype[cr]||(Qe.prototype[cr]=Ua.prototype[cr]);var $a,cr,lr;function Qe(e){if(!(this instanceof Qe))return new Qe(e);bd.call(this,e),Ua.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",cb)}Object.defineProperty(Qe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function cb(){this.allowHalfOpen||this._writableState.ended||gd.nextTick(db,this)}function db(e){e.end()}Object.defineProperty(Qe.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)}});Qe.prototype._destroy=function(e,t){this.push(null),this.end(),gd.nextTick(t,e)}});var Ya=E(xd=>{"use strict";var Wa=Wi().Buffer,vd=Wa.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 ub(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 pb(e){var t=ub(e);if(typeof t!="string"&&(Wa.isEncoding===vd||!vd(e)))throw new Error("Unknown encoding: "+e);return t||e}xd.StringDecoder=Ki;function Ki(e){this.encoding=pb(e);var t;switch(this.encoding){case"utf16le":this.text=yb,this.end=vb,t=4;break;case"utf8":this.fillLast=gb,t=4;break;case"base64":this.text=xb,this.end=wb,t=3;break;default:this.write=_b,this.end=Eb;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Wa.allocUnsafe(t)}Ki.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||""};Ki.prototype.end=bb;Ki.prototype.text=mb;Ki.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 Ga(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function fb(e,t,i){var n=t.length-1;if(n<i)return 0;var r=Ga(t[n]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--n<i||r===-2?0:(r=Ga(t[n]),r>=0?(r>0&&(e.lastNeed=r-2),r):--n<i||r===-2?0:(r=Ga(t[n]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function hb(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 gb(e){var t=this.lastTotal-this.lastNeed,i=hb(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 mb(e,t){var i=fb(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 bb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function yb(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 vb(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 xb(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 wb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function _b(e){return e.toString(this.encoding)}function Eb(e){return e&&e.length?this.write(e):""}});var qa=E((T1,Od)=>{"use strict";var si=Gi();Od.exports=D;var Sb=Zc(),Zi;D.ReadableState=Td;var C1=require("events").EventEmitter,Sd=function(e,t){return e.listeners(t).length},Ja=Ia(),Ji=Wi().Buffer,Ab=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Cb(e){return Ji.from(e)}function Tb(e){return Ji.isBuffer(e)||e instanceof Ab}var Ad=Object.create(ii());Ad.inherits=ni();var Va=require("util"),O=void 0;Va&&Va.debuglog?O=Va.debuglog("stream"):O=function(){};var kb=nd(),Cd=Fa(),ai;Ad.inherits(D,Ja);var Xa=["error","close","destroy","pause","resume"];function Lb(e,t,i){if(typeof e.prependListener=="function")return e.prependListener(t,i);!e._events||!e._events[t]?e.on(t,i):Sb(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]}function Td(e,t){Zi=Zi||Dt(),e=e||{};var i=t instanceof Zi;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 kb,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&&(ai||(ai=Ya().StringDecoder),this.decoder=new ai(e.encoding),this.encoding=e.encoding)}function D(e){if(Zi=Zi||Dt(),!(this instanceof D))return new D(e);this._readableState=new Td(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),Ja.call(this)}Object.defineProperty(D.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});D.prototype.destroy=Cd.destroy;D.prototype._undestroy=Cd.undestroy;D.prototype._destroy=function(e,t){this.push(null),t(e)};D.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=Ji.from(e,t),t=""),n=!0),kd(this,e,t,!1,n)};D.prototype.unshift=function(e){return kd(this,e,null,!0,!1)};function kd(e,t,i,n,r){var a=e._readableState;if(t===null)a.reading=!1,Ib(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)!==Ji.prototype&&(t=Cb(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):Ka(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?Ka(e,a,t,!1):Ld(e,a)):Ka(e,a,t,!1))):n||(a.reading=!1)}return Mb(a)}function Ka(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&&dr(e)),Ld(e,t)}function Rb(e,t){var i;return!Tb(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)}D.prototype.isPaused=function(){return this._readableState.flowing===!1};D.prototype.setEncoding=function(e){return ai||(ai=Ya().StringDecoder),this._readableState.decoder=new ai(e),this._readableState.encoding=e,this};var wd=8388608;function Ob(e){return e>=wd?e=wd:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function _d(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=Ob(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}D.prototype.read=function(e){O("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 O("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?Za(this):dr(this),null;if(e=_d(e,t),e===0&&t.ended)return t.length===0&&Za(this),null;var n=t.needReadable;O("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,O("length less than watermark",n)),t.ended||t.reading?(n=!1,O("reading or ended",n)):n&&(O("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_d(i,t)));var r;return e>0?r=Rd(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&&Za(this)),r!==null&&this.emit("data",r),r};function Ib(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,dr(e)}}function dr(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?si.nextTick(Ed,e):Ed(e))}function Ed(e){O("emit readable"),e.emit("readable"),Qa(e)}function Ld(e,t){t.readingMore||(t.readingMore=!0,si.nextTick(Pb,e,t))}function Pb(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(O("maybeReadMore read 0"),e.read(0),i!==t.length);)i=t.length;t.readingMore=!1}D.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};D.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,O("pipe count=%d opts=%j",n.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?o:x;n.endEmitted?si.nextTick(a):i.once("end",a),e.on("unpipe",s);function s(m,y){O("onunpipe"),m===i&&y&&y.hasUnpiped===!1&&(y.hasUnpiped=!0,c())}function o(){O("onend"),e.end()}var d=Db(i);e.on("drain",d);var l=!1;function c(){O("cleanup"),e.removeListener("close",v),e.removeListener("finish",h),e.removeListener("drain",d),e.removeListener("error",p),e.removeListener("unpipe",s),i.removeListener("end",o),i.removeListener("end",x),i.removeListener("data",u),l=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&d()}var f=!1;i.on("data",u);function u(m){O("ondata"),f=!1;var y=e.write(m);y===!1&&!f&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&Md(n.pipes,e)!==-1)&&!l&&(O("false write response, pause",n.awaitDrain),n.awaitDrain++,f=!0),i.pause())}function p(m){O("onerror",m),x(),e.removeListener("error",p),Sd(e,"error")===0&&e.emit("error",m)}Lb(e,"error",p);function v(){e.removeListener("finish",h),x()}e.once("close",v);function h(){O("onfinish"),e.removeListener("close",v),x()}e.once("finish",h);function x(){O("unpipe"),i.unpipe(e)}return e.emit("pipe",i),n.flowing||(O("pipe resume"),i.resume()),e};function Db(e){return function(){var t=e._readableState;O("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Sd(e,"data")&&(t.flowing=!0,Qa(e))}}D.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=Md(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)};D.prototype.on=function(e,t){var i=Ja.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&&dr(this):si.nextTick(jb,this))}return i};D.prototype.addListener=D.prototype.on;function jb(e){O("readable nexttick read 0"),e.read(0)}D.prototype.resume=function(){var e=this._readableState;return e.flowing||(O("resume"),e.flowing=!0,zb(this,e)),this};function zb(e,t){t.resumeScheduled||(t.resumeScheduled=!0,si.nextTick(Bb,e,t))}function Bb(e,t){t.reading||(O("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),Qa(e),t.flowing&&!t.reading&&e.read(0)}D.prototype.pause=function(){return O("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(O("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function Qa(e){var t=e._readableState;for(O("flow",t.flowing);t.flowing&&e.read()!==null;);}D.prototype.wrap=function(e){var t=this,i=this._readableState,n=!1;e.on("end",function(){if(O("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(O("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<Xa.length;a++)e.on(Xa[a],this.emit.bind(this,Xa[a]));return this._read=function(s){O("wrapped _read",s),n&&(n=!1,e.resume())},this};Object.defineProperty(D.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});D._fromList=Rd;function Rd(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=Fb(e,t.buffer,t.decoder),i}function Fb(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?Nb(e,t):Hb(e,t),n}function Nb(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 Hb(e,t){var i=Ji.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 Za(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,si.nextTick($b,t,e))}function $b(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Md(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}});var es=E((k1,Dd)=>{"use strict";Dd.exports=et;var ur=Dt(),Pd=Object.create(ii());Pd.inherits=ni();Pd.inherits(et,ur);function Ub(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 et(e){if(!(this instanceof et))return new et(e);ur.call(this,e),this._transformState={afterTransform:Ub.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",qb)}function qb(){var e=this;typeof this._flush=="function"?this._flush(function(t,i){Id(e,t,i)}):Id(this,null,null)}et.prototype.push=function(e,t){return this._transformState.needTransform=!1,ur.prototype.push.call(this,e,t)};et.prototype._transform=function(e,t,i){throw new Error("_transform() is not implemented")};et.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)}};et.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};et.prototype._destroy=function(e,t){var i=this;ur.prototype._destroy.call(this,e,function(n){t(n),i.emit("close")})};function Id(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 Fd=E((L1,Bd)=>{"use strict";Bd.exports=Qi;var jd=es(),zd=Object.create(ii());zd.inherits=ni();zd.inherits(Qi,jd);function Qi(e){if(!(this instanceof Qi))return new Qi(e);jd.call(this,e)}Qi.prototype._transform=function(e,t,i){i(null,e)}});var ts=E((Y,pr)=>{"use strict";var Re=require("stream");process.env.READABLE_STREAM==="disable"&&Re?(pr.exports=Re,Y=pr.exports=Re.Readable,Y.Readable=Re.Readable,Y.Writable=Re.Writable,Y.Duplex=Re.Duplex,Y.Transform=Re.Transform,Y.PassThrough=Re.PassThrough,Y.Stream=Re):(Y=pr.exports=qa(),Y.Stream=Re||Y,Y.Readable=Y,Y.Writable=Ha(),Y.Duplex=Dt(),Y.Transform=es(),Y.PassThrough=Fd())});var tt=E(ae=>{"use strict";ae.base64=!0;ae.array=!0;ae.string=!0;ae.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined";ae.nodebuffer=typeof Buffer!="undefined";ae.uint8array=typeof Uint8Array!="undefined";if(typeof ArrayBuffer=="undefined")ae.blob=!1;else{is=new ArrayBuffer(0);try{ae.blob=new Blob([is],{type:"application/zip"}).size===0}catch{try{Nd=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,ns=new Nd,ns.append(is),ae.blob=ns.getBlob("application/zip").size===0}catch{ae.blob=!1}}}var is,Nd,ns;try{ae.nodestream=!!ts().Readable}catch{ae.nodestream=!1}});var as=E(rs=>{"use strict";var Gb=F(),Wb=tt(),Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";rs.encode=function(e){for(var t=[],i,n,r,a,s,o,d,l=0,c=e.length,f=c,u=Gb.getTypeOf(e)!=="string";l<e.length;)f=c-l,u?(i=e[l++],n=l<c?e[l++]:0,r=l<c?e[l++]:0):(i=e.charCodeAt(l++),n=l<c?e.charCodeAt(l++):0,r=l<c?e.charCodeAt(l++):0),a=i>>2,s=(i&3)<<4|n>>4,o=f>1?(n&15)<<2|r>>6:64,d=f>2?r&63:64,t.push(Me.charAt(a)+Me.charAt(s)+Me.charAt(o)+Me.charAt(d));return t.join("")};rs.decode=function(e){var t,i,n,r,a,s,o,d=0,l=0,c="data:";if(e.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var f=e.length*3/4;if(e.charAt(e.length-1)===Me.charAt(64)&&f--,e.charAt(e.length-2)===Me.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var u;for(Wb.uint8array?u=new Uint8Array(f|0):u=new Array(f|0);d<e.length;)r=Me.indexOf(e.charAt(d++)),a=Me.indexOf(e.charAt(d++)),s=Me.indexOf(e.charAt(d++)),o=Me.indexOf(e.charAt(d++)),t=r<<2|a>>4,i=(a&15)<<4|s>>2,n=(s&3)<<6|o,u[l++]=t,s!==64&&(u[l++]=i),o!==64&&(u[l++]=n);return u}});var en=E((O1,Hd)=>{"use strict";Hd.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 Gd=E((I1,qd)=>{"use strict";var $d=global.MutationObserver||global.WebKitMutationObserver,oi;process.browser?$d?(ss=0,Ud=new $d(tn),os=global.document.createTextNode(""),Ud.observe(os,{characterData:!0}),oi=function(){os.data=ss=++ss%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(ls=new global.MessageChannel,ls.port1.onmessage=tn,oi=function(){ls.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?oi=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){tn(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:oi=function(){setTimeout(tn,0)}:oi=function(){process.nextTick(tn)};var ss,Ud,os,ls,cs,nn=[];function tn(){cs=!0;for(var e,t,i=nn.length;i;){for(t=nn,nn=[],e=-1;++e<i;)t[e]();i=nn.length}cs=!1}qd.exports=Yb;function Yb(e){nn.push(e)===1&&!cs&&oi()}});var Jd=E((P1,Zd)=>{"use strict";var Wd=Gd();function li(){}var Z={},Yd=["REJECTED"],ds=["FULFILLED"],Vd=["PENDING"];process.browser||(rn=["UNHANDLED"]);var rn;Zd.exports=ft;function ft(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=Vd,this.queue=[],this.outcome=void 0,process.browser||(this.handled=rn),e!==li&&Xd(this,e)}ft.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)}};ft.prototype.catch=function(e){return this.then(null,e)};ft.prototype.then=function(e,t){if(typeof e!="function"&&this.state===ds||typeof t!="function"&&this.state===Yd)return this;var i=new this.constructor(li);if(process.browser||this.handled===rn&&(this.handled=null),this.state!==Vd){var n=this.state===ds?e:t;us(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){Z.resolve(this.promise,e)};an.prototype.otherCallFulfilled=function(e){us(this.promise,this.onFulfilled,e)};an.prototype.callRejected=function(e){Z.reject(this.promise,e)};an.prototype.otherCallRejected=function(e){us(this.promise,this.onRejected,e)};function us(e,t,i){Wd(function(){var n;try{n=t(i)}catch(r){return Z.reject(e,r)}n===e?Z.reject(e,new TypeError("Cannot resolve promise with itself")):Z.resolve(e,n)})}Z.resolve=function(e,t){var i=Kd(Vb,t);if(i.status==="error")return Z.reject(e,i.value);var n=i.value;if(n)Xd(e,n);else{e.state=ds,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};Z.reject=function(e,t){e.state=Yd,e.outcome=t,process.browser||e.handled===rn&&Wd(function(){e.handled===rn&&process.emit("unhandledRejection",t,e)});for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callRejected(t);return e};function Vb(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function Xd(e,t){var i=!1;function n(o){i||(i=!0,Z.reject(e,o))}function r(o){i||(i=!0,Z.resolve(e,o))}function a(){t(r,n)}var s=Kd(a);s.status==="error"&&n(s.value)}function Kd(e,t){var i={};try{i.value=e(t),i.status="success"}catch(n){i.status="error",i.value=n}return i}ft.resolve=Xb;function Xb(e){return e instanceof this?e:Z.resolve(new this(li),e)}ft.reject=Kb;function Kb(e){var t=new this(li);return Z.reject(t,e)}ft.all=Zb;function Zb(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(li);++s<i;)d(e[s],s);return o;function d(l,c){t.resolve(l).then(f,function(u){n||(n=!0,Z.reject(o,u))});function f(u){r[c]=u,++a===i&&!n&&(n=!0,Z.resolve(o,r))}}}ft.race=Jb;function Jb(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(li);++r<i;)s(e[r]);return a;function s(o){t.resolve(o).then(function(d){n||(n=!0,Z.resolve(a,d))},function(d){n||(n=!0,Z.reject(a,d))})}}});var ci=E((D1,Qd)=>{"use strict";var ps=null;typeof Promise!="undefined"?ps=Promise:ps=Jd();Qd.exports={Promise:ps}});var tu=E(eu=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var i=1,n={},r=!1,a=e.document,s;function o(y){typeof y!="function"&&(y=new Function(""+y));for(var b=new Array(arguments.length-1),g=0;g<b.length;g++)b[g]=arguments[g+1];var w={callback:y,args:b};return n[i]=w,s(i),i++}function d(y){delete n[y]}function l(y){var b=y.callback,g=y.args;switch(g.length){case 0:b();break;case 1:b(g[0]);break;case 2:b(g[0],g[1]);break;case 3:b(g[0],g[1],g[2]);break;default:b.apply(t,g);break}}function c(y){if(r)setTimeout(c,0,y);else{var b=n[y];if(b){r=!0;try{l(b)}finally{d(y),r=!1}}}}function f(){s=function(y){process.nextTick(function(){c(y)})}}function u(){if(e.postMessage&&!e.importScripts){var y=!0,b=e.onmessage;return e.onmessage=function(){y=!1},e.postMessage("","*"),e.onmessage=b,y}}function p(){var y="setImmediate$"+Math.random()+"$",b=function(g){g.source===e&&typeof g.data=="string"&&g.data.indexOf(y)===0&&c(+g.data.slice(y.length))};e.addEventListener?e.addEventListener("message",b,!1):e.attachEvent("onmessage",b),s=function(g){e.postMessage(y+g,"*")}}function v(){var y=new MessageChannel;y.port1.onmessage=function(b){var g=b.data;c(g)},s=function(b){y.port2.postMessage(b)}}function h(){var y=a.documentElement;s=function(b){var g=a.createElement("script");g.onreadystatechange=function(){c(b),g.onreadystatechange=null,y.removeChild(g),g=null},y.appendChild(g)}}function x(){s=function(y){setTimeout(c,0,y)}}var m=Object.getPrototypeOf&&Object.getPrototypeOf(e);m=m&&m.setTimeout?m:e,{}.toString.call(e.process)==="[object process]"?f():u()?p():e.MessageChannel?v():a&&"onreadystatechange"in a.createElement("script")?h():x(),m.setImmediate=o,m.clearImmediate=d})(typeof self=="undefined"?typeof global=="undefined"?eu:global:self)});var F=E(U=>{"use strict";var ht=tt(),Qb=as(),di=en(),fs=ci();tu();function ey(e){var t=null;return ht.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),hr(e,t)}U.newBlob=function(e,t){U.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 sn(e){return e}function hr(e,t){for(var i=0;i<e.length;++i)t[i]=e.charCodeAt(i)&255;return t}var fr={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 ht.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return ht.nodebuffer&&String.fromCharCode.apply(null,di.allocBuffer(1)).length===1}catch{return!1}})()}};function on(e){var t=65536,i=U.getTypeOf(e),n=!0;if(i==="uint8array"?n=fr.applyCanBeUsed.uint8array:i==="nodebuffer"&&(n=fr.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return fr.stringifyByChunk(e,i,t)}catch{t=Math.floor(t/2)}return fr.stringifyByChar(e)}U.applyFromCharCode=on;function gr(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}var gt={};gt.string={string:sn,array:function(e){return hr(e,new Array(e.length))},arraybuffer:function(e){return gt.string.uint8array(e).buffer},uint8array:function(e){return hr(e,new Uint8Array(e.length))},nodebuffer:function(e){return hr(e,di.allocBuffer(e.length))}};gt.array={string:on,array:sn,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return di.newBufferFrom(e)}};gt.arraybuffer={string:function(e){return on(new Uint8Array(e))},array:function(e){return gr(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:sn,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return di.newBufferFrom(new Uint8Array(e))}};gt.uint8array={string:on,array:function(e){return gr(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:sn,nodebuffer:function(e){return di.newBufferFrom(e)}};gt.nodebuffer={string:on,array:function(e){return gr(e,new Array(e.length))},arraybuffer:function(e){return gt.nodebuffer.uint8array(e).buffer},uint8array:function(e){return gr(e,new Uint8Array(e.length))},nodebuffer:sn};U.transformTo=function(e,t){if(t||(t=""),!e)return t;U.checkSupport(e);var i=U.getTypeOf(t),n=gt[i][e](t);return n};U.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("/")};U.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(ht.nodebuffer&&di.isBuffer(e))return"nodebuffer";if(ht.uint8array&&e instanceof Uint8Array)return"uint8array";if(ht.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};U.checkSupport=function(e){var t=ht[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};U.MAX_VALUE_16BITS=65535;U.MAX_VALUE_32BITS=-1;U.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};U.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})};U.inherits=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i};U.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};U.prepareContent=function(e,t,i,n,r){var a=fs.Promise.resolve(t).then(function(s){var o=ht.blob&&(s instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(s))!==-1);return o&&typeof FileReader!="undefined"?new fs.Promise(function(d,l){var c=new FileReader;c.onload=function(f){d(f.target.result)},c.onerror=function(f){l(f.target.error)},c.readAsArrayBuffer(s)}):s});return a.then(function(s){var o=U.getTypeOf(s);return o?(o==="arraybuffer"?s=U.transformTo("uint8array",s):o==="string"&&(r?s=Qb.decode(s):i&&n!==!0&&(s=ey(s))),s):fs.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var se=E((B1,nu)=>{"use strict";function iu(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}iu.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}};nu.exports=iu});var pi=E(mt=>{"use strict";var ui=F(),jt=tt(),ty=en(),mr=se(),ln=new Array(256);for(it=0;it<256;it++)ln[it]=it>=252?6:it>=248?5:it>=240?4:it>=224?3:it>=192?2:1;var it;ln[254]=ln[254]=1;var iy=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(jt.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},ny=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+ln[e[i]]>t?i:t},ry=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=ln[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),ui.applyFromCharCode(s)};mt.utf8encode=function(t){return jt.nodebuffer?ty.newBufferFrom(t,"utf-8"):iy(t)};mt.utf8decode=function(t){return jt.nodebuffer?ui.transformTo("nodebuffer",t).toString("utf-8"):(t=ui.transformTo(jt.uint8array?"uint8array":"array",t),ry(t))};function br(){mr.call(this,"utf-8 decode"),this.leftOver=null}ui.inherits(br,mr);br.prototype.processChunk=function(e){var t=ui.transformTo(jt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(jt.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=ny(t),r=t;n!==t.length&&(jt.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:mt.utf8decode(r),meta:e.meta})};br.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:mt.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};mt.Utf8DecodeWorker=br;function hs(){mr.call(this,"utf-8 encode")}ui.inherits(hs,mr);hs.prototype.processChunk=function(e){this.push({data:mt.utf8encode(e.data),meta:e.meta})};mt.Utf8EncodeWorker=hs});var ou=E((N1,su)=>{"use strict";var ru=se(),au=F();function gs(e){ru.call(this,"ConvertWorker to "+e),this.destType=e}au.inherits(gs,ru);gs.prototype.processChunk=function(e){this.push({data:au.transformTo(this.destType,e.data),meta:e.meta})};su.exports=gs});var du=E((H1,cu)=>{"use strict";var lu=ts().Readable,ay=F();ay.inherits(ms,lu);function ms(e,t,i){lu.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)})}ms.prototype._read=function(){this._helper.resume()};cu.exports=ms});var bs=E(($1,fu)=>{"use strict";var zt=F(),sy=ou(),oy=se(),ly=as(),cy=tt(),dy=ci(),uu=null;if(cy.nodestream)try{uu=du()}catch{}function uy(e,t,i){switch(e){case"blob":return zt.newBlob(zt.transformTo("arraybuffer",t),i);case"base64":return ly.encode(t);default:return zt.transformTo(e,t)}}function py(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 fy(e,t){return new dy.Promise(function(i,n){var r=[],a=e._internalType,s=e._outputType,o=e._mimeType;e.on("data",function(d,l){r.push(d),t&&t(l)}).on("error",function(d){r=[],n(d)}).on("end",function(){try{var d=uy(s,py(a,r),o);i(d)}catch(l){n(l)}r=[]}).resume()})}function pu(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,zt.checkSupport(n),this._worker=e.pipe(new sy(n)),e.lock()}catch(r){this._worker=new oy("error"),this._worker.error(r)}}pu.prototype={accumulate:function(e){return fy(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(){zt.delay(t,arguments,i)}),this},resume:function(){return zt.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(zt.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new uu(this,{objectMode:this._outputType!=="nodebuffer"},e)}};fu.exports=pu});var ys=E(_e=>{"use strict";_e.base64=!1;_e.binary=!1;_e.dir=!1;_e.createFolders=!0;_e.date=null;_e.compression=null;_e.compressionOptions=null;_e.comment=null;_e.unixPermissions=null;_e.dosPermissions=null});var vs=E((q1,hu)=>{"use strict";var yr=F(),vr=se(),hy=16*1024;function fi(e){vr.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=yr.getTypeOf(i),t.isPaused||t._tickAndRepeat()},function(i){t.error(i)})}yr.inherits(fi,vr);fi.prototype.cleanUp=function(){vr.prototype.cleanUp.call(this),this.data=null};fi.prototype.resume=function(){return vr.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,yr.delay(this._tickAndRepeat,[],this)),!0):!1};fi.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(yr.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};fi.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=hy,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}})};hu.exports=fi});var xr=E((G1,mu)=>{"use strict";var gy=F();function my(){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 gu=my();function by(e,t,i,n){var r=gu,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 yy(e,t,i,n){var r=gu,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}mu.exports=function(t,i){if(typeof t=="undefined"||!t.length)return 0;var n=gy.getTypeOf(t)!=="string";return n?by(i|0,t,t.length,0):yy(i|0,t,t.length,0)}});var ws=E((W1,yu)=>{"use strict";var bu=se(),vy=xr(),xy=F();function xs(){bu.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}xy.inherits(xs,bu);xs.prototype.processChunk=function(e){this.streamInfo.crc32=vy(e.data,this.streamInfo.crc32||0),this.push(e)};yu.exports=xs});var xu=E((Y1,vu)=>{"use strict";var wy=F(),_s=se();function Es(e){_s.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}wy.inherits(Es,_s);Es.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}_s.prototype.processChunk.call(this,e)};vu.exports=Es});var wr=E((V1,Eu)=>{"use strict";var wu=ci(),_u=vs(),_y=ws(),Ss=xu();function As(e,t,i,n,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=n,this.compressedContent=r}As.prototype={getContentWorker:function(){var e=new _u(wu.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Ss("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 _u(wu.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};As.createWorkerFrom=function(e,t,i){return e.pipe(new _y).pipe(new Ss("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new Ss("compressedSize")).withStreamInfo("compression",t)};Eu.exports=As});var Tu=E((X1,Cu)=>{"use strict";var Ey=bs(),Sy=vs(),Cs=pi(),Ts=wr(),Su=se(),ks=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}};ks.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 Cs.Utf8EncodeWorker)),!r&&n&&(t=t.pipe(new Cs.Utf8DecodeWorker))}catch(a){t=new Su("error"),t.error(a)}return new Ey(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 Ts&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new Cs.Utf8EncodeWorker)),Ts.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof Ts?this._data.getContentWorker():this._data instanceof Su?this._data:new Sy(this._data)}};var Au=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],Ay=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(_r=0;_r<Au.length;_r++)ks.prototype[Au[_r]]=Ay;var _r;Cu.exports=ks});var nt=E(J=>{"use strict";var Cy=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function Ty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}J.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)Ty(i,n)&&(e[n]=i[n])}}return e};J.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var ky={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}},Ly={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)}};J.setTyped=function(e){e?(J.Buf8=Uint8Array,J.Buf16=Uint16Array,J.Buf32=Int32Array,J.assign(J,ky)):(J.Buf8=Array,J.Buf16=Array,J.Buf32=Array,J.assign(J,Ly))};J.setTyped(Cy)});var Ku=E(mi=>{"use strict";var Ry=nt(),My=4,ku=0,Lu=1,Oy=2;function gi(e){for(var t=e.length;--t>=0;)e[t]=0}var Iy=0,Du=1,Py=2,Dy=3,jy=258,Ds=29,hn=256,dn=hn+1+Ds,hi=30,js=19,ju=2*dn+1,Bt=15,Ls=16,zy=7,zs=256,zu=16,Bu=17,Fu=18,Is=[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],Er=[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],By=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Nu=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Fy=512,rt=new Array((dn+2)*2);gi(rt);var cn=new Array(hi*2);gi(cn);var un=new Array(Fy);gi(un);var pn=new Array(jy-Dy+1);gi(pn);var Bs=new Array(Ds);gi(Bs);var Sr=new Array(hi);gi(Sr);function Rs(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 Hu,$u,Uu;function Ms(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function qu(e){return e<256?un[e]:un[256+(e>>>7)]}function fn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function ie(e,t,i){e.bi_valid>Ls-i?(e.bi_buf|=t<<e.bi_valid&65535,fn(e,e.bi_buf),e.bi_buf=t>>Ls-e.bi_valid,e.bi_valid+=i-Ls):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Oe(e,t,i){ie(e,i[t*2],i[t*2+1])}function Gu(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function Ny(e){e.bi_valid===16?(fn(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 Hy(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,d=t.stat_desc.max_length,l,c,f,u,p,v,h=0;for(u=0;u<=Bt;u++)e.bl_count[u]=0;for(i[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<ju;l++)c=e.heap[l],u=i[i[c*2+1]*2+1]+1,u>d&&(u=d,h++),i[c*2+1]=u,!(c>n)&&(e.bl_count[u]++,p=0,c>=o&&(p=s[c-o]),v=i[c*2],e.opt_len+=v*(u+p),a&&(e.static_len+=v*(r[c*2+1]+p)));if(h!==0){do{for(u=d-1;e.bl_count[u]===0;)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[d]--,h-=2}while(h>0);for(u=d;u!==0;u--)for(c=e.bl_count[u];c!==0;)f=e.heap[--l],!(f>n)&&(i[f*2+1]!==u&&(e.opt_len+=(u-i[f*2+1])*i[f*2],i[f*2+1]=u),c--)}}function Wu(e,t,i){var n=new Array(Bt+1),r=0,a,s;for(a=1;a<=Bt;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]=Gu(n[o]++,o))}}function $y(){var e,t,i,n,r,a=new Array(Bt+1);for(i=0,n=0;n<Ds-1;n++)for(Bs[n]=i,e=0;e<1<<Is[n];e++)pn[i++]=n;for(pn[i-1]=n,r=0,n=0;n<16;n++)for(Sr[n]=r,e=0;e<1<<Er[n];e++)un[r++]=n;for(r>>=7;n<hi;n++)for(Sr[n]=r<<7,e=0;e<1<<Er[n]-7;e++)un[256+r++]=n;for(t=0;t<=Bt;t++)a[t]=0;for(e=0;e<=143;)rt[e*2+1]=8,e++,a[8]++;for(;e<=255;)rt[e*2+1]=9,e++,a[9]++;for(;e<=279;)rt[e*2+1]=7,e++,a[7]++;for(;e<=287;)rt[e*2+1]=8,e++,a[8]++;for(Wu(rt,dn+1,a),e=0;e<hi;e++)cn[e*2+1]=5,cn[e*2]=Gu(e,5);Hu=new Rs(rt,Is,hn+1,dn,Bt),$u=new Rs(cn,Er,0,hi,Bt),Uu=new Rs(new Array(0),By,0,js,zy)}function Yu(e){var t;for(t=0;t<dn;t++)e.dyn_ltree[t*2]=0;for(t=0;t<hi;t++)e.dyn_dtree[t*2]=0;for(t=0;t<js;t++)e.bl_tree[t*2]=0;e.dyn_ltree[zs*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Vu(e){e.bi_valid>8?fn(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 Uy(e,t,i,n){Vu(e),n&&(fn(e,i),fn(e,~i)),Ry.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function Ru(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 Os(e,t,i){for(var n=e.heap[i],r=i<<1;r<=e.heap_len&&(r<e.heap_len&&Ru(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Ru(t,n,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r<<=1;e.heap[i]=n}function Mu(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?Oe(e,r,t):(s=pn[r],Oe(e,s+hn+1,t),o=Is[s],o!==0&&(r-=Bs[s],ie(e,r,o)),n--,s=qu(n),Oe(e,s,i),o=Er[s],o!==0&&(n-=Sr[s],ie(e,n,o)));while(a<e.last_lit);Oe(e,zs,t)}function Ps(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,d=-1,l;for(e.heap_len=0,e.heap_max=ju,s=0;s<a;s++)i[s*2]!==0?(e.heap[++e.heap_len]=d=s,e.depth[s]=0):i[s*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=d<2?++d:0,i[l*2]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=n[l*2+1]);for(t.max_code=d,s=e.heap_len>>1;s>=1;s--)Os(e,i,s);l=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Os(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,i[l*2]=i[s*2]+i[o*2],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,i[s*2+1]=i[o*2+1]=l,e.heap[1]=l++,Os(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Hy(e,t),Wu(i,d,e.bl_count)}function Ou(e,t,i){var n,r=-1,a,s=t[1],o=0,d=7,l=4;for(s===0&&(d=138,l=3),t[(i+1)*2+1]=65535,n=0;n<=i;n++)a=s,s=t[(n+1)*2+1],!(++o<d&&a===s)&&(o<l?e.bl_tree[a*2]+=o:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[zu*2]++):o<=10?e.bl_tree[Bu*2]++:e.bl_tree[Fu*2]++,o=0,r=a,s===0?(d=138,l=3):a===s?(d=6,l=3):(d=7,l=4))}function Iu(e,t,i){var n,r=-1,a,s=t[1],o=0,d=7,l=4;for(s===0&&(d=138,l=3),n=0;n<=i;n++)if(a=s,s=t[(n+1)*2+1],!(++o<d&&a===s)){if(o<l)do Oe(e,a,e.bl_tree);while(--o!==0);else a!==0?(a!==r&&(Oe(e,a,e.bl_tree),o--),Oe(e,zu,e.bl_tree),ie(e,o-3,2)):o<=10?(Oe(e,Bu,e.bl_tree),ie(e,o-3,3)):(Oe(e,Fu,e.bl_tree),ie(e,o-11,7));o=0,r=a,s===0?(d=138,l=3):a===s?(d=6,l=3):(d=7,l=4)}}function qy(e){var t;for(Ou(e,e.dyn_ltree,e.l_desc.max_code),Ou(e,e.dyn_dtree,e.d_desc.max_code),Ps(e,e.bl_desc),t=js-1;t>=3&&e.bl_tree[Nu[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Gy(e,t,i,n){var r;for(ie(e,t-257,5),ie(e,i-1,5),ie(e,n-4,4),r=0;r<n;r++)ie(e,e.bl_tree[Nu[r]*2+1],3);Iu(e,e.dyn_ltree,t-1),Iu(e,e.dyn_dtree,i-1)}function Wy(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return ku;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return Lu;for(i=32;i<hn;i++)if(e.dyn_ltree[i*2]!==0)return Lu;return ku}var Pu=!1;function Yy(e){Pu||($y(),Pu=!0),e.l_desc=new Ms(e.dyn_ltree,Hu),e.d_desc=new Ms(e.dyn_dtree,$u),e.bl_desc=new Ms(e.bl_tree,Uu),e.bi_buf=0,e.bi_valid=0,Yu(e)}function Xu(e,t,i,n){ie(e,(Iy<<1)+(n?1:0),3),Uy(e,t,i,!0)}function Vy(e){ie(e,Du<<1,3),Oe(e,zs,rt),Ny(e)}function Xy(e,t,i,n){var r,a,s=0;e.level>0?(e.strm.data_type===Oy&&(e.strm.data_type=Wy(e)),Ps(e,e.l_desc),Ps(e,e.d_desc),s=qy(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?Xu(e,t,i,n):e.strategy===My||a===r?(ie(e,(Du<<1)+(n?1:0),3),Mu(e,rt,cn)):(ie(e,(Py<<1)+(n?1:0),3),Gy(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Mu(e,e.dyn_ltree,e.dyn_dtree)),Yu(e),n&&Vu(e)}function Ky(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]+hn+1)*2]++,e.dyn_dtree[qu(t)*2]++),e.last_lit===e.lit_bufsize-1}mi._tr_init=Yy;mi._tr_stored_block=Xu;mi._tr_flush_block=Xy;mi._tr_tally=Ky;mi._tr_align=Vy});var Fs=E((J1,Zu)=>{"use strict";function Zy(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}Zu.exports=Zy});var Ns=E((Q1,Ju)=>{"use strict";function Jy(){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 Qy=Jy();function ev(e,t,i,n){var r=Qy,a=n+i;e^=-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}Ju.exports=ev});var Ar=E((eE,Qu)=>{"use strict";Qu.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 lp=E(De=>{"use strict";var Q=nt(),me=Ku(),np=Fs(),bt=Ns(),tv=Ar(),$t=0,iv=1,nv=3,_t=4,ep=5,Pe=0,tp=1,be=-2,rv=-3,Hs=-5,av=-1,sv=1,Cr=2,ov=3,lv=4,cv=0,dv=2,Rr=8,uv=9,pv=15,fv=8,hv=29,gv=256,Us=gv+1+hv,mv=30,bv=19,yv=2*Us+1,vv=15,R=3,xt=258,Ee=xt+R+1,xv=32,Mr=42,qs=69,Tr=73,kr=91,Lr=103,Ft=113,mn=666,W=1,bn=2,Nt=3,vi=4,wv=3;function wt(e,t){return e.msg=tv[t],t}function ip(e){return(e<<1)-(e>4?9:0)}function vt(e){for(var t=e.length;--t>=0;)e[t]=0}function yt(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(Q.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 V(e,t){me._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,yt(e.strm)}function M(e,t){e.pending_buf[e.pending++]=t}function gn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function _v(e,t,i,n){var r=e.avail_in;return r>n&&(r=n),r===0?0:(e.avail_in-=r,Q.arraySet(t,e.input,e.next_in,r,i),e.state.wrap===1?e.adler=np(e.adler,t,r,i):e.state.wrap===2&&(e.adler=bt(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function rp(e,t){var i=e.max_chain_length,n=e.strstart,r,a,s=e.prev_length,o=e.nice_match,d=e.strstart>e.w_size-Ee?e.strstart-(e.w_size-Ee):0,l=e.window,c=e.w_mask,f=e.prev,u=e.strstart+xt,p=l[n+s-1],v=l[n+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(r=t,!(l[r+s]!==v||l[r+s-1]!==p||l[r]!==l[n]||l[++r]!==l[n+1])){n+=2,r++;do;while(l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&n<u);if(a=xt-(u-n),n=u-xt,a>s){if(e.match_start=t,s=a,a>=o)break;p=l[n+s-1],v=l[n+s]}}while((t=f[t&c])>d&&--i!==0);return s<=e.lookahead?s:e.lookahead}function Ht(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-Ee)){Q.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=_v(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=R)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+R-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<R)););}while(e.lookahead<Ee&&e.strm.avail_in!==0)}function Ev(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Ht(e),e.lookahead===0&&t===$t)return W;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,V(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Ee&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=0,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):(e.strstart>e.block_start&&(V(e,!1),e.strm.avail_out===0),W)}function $s(e,t){for(var i,n;;){if(e.lookahead<Ee){if(Ht(e),e.lookahead<Ee&&t===$t)return W;if(e.lookahead===0)break}if(i=0,e.lookahead>=R&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-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-Ee&&(e.match_length=rp(e,i)),e.match_length>=R)if(n=me._tr_tally(e,e.strstart-e.match_start,e.match_length-R),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=R){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-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=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=e.strstart<R-1?e.strstart:R-1,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:bn}function bi(e,t){for(var i,n,r;;){if(e.lookahead<Ee){if(Ht(e),e.lookahead<Ee&&t===$t)return W;if(e.lookahead===0)break}if(i=0,e.lookahead>=R&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-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=R-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Ee&&(e.match_length=rp(e,i),e.match_length<=5&&(e.strategy===sv||e.match_length===R&&e.strstart-e.match_start>4096)&&(e.match_length=R-1)),e.prev_length>=R&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-R,n=me._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-R),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+R-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=R-1,e.strstart++,n&&(V(e,!1),e.strm.avail_out===0))return W}else if(e.match_available){if(n=me._tr_tally(e,0,e.window[e.strstart-1]),n&&V(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return W}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=me._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<R-1?e.strstart:R-1,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:bn}function Sv(e,t){for(var i,n,r,a,s=e.window;;){if(e.lookahead<=xt){if(Ht(e),e.lookahead<=xt&&t===$t)return W;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=R&&e.strstart>0&&(r=e.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){a=e.strstart+xt;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=xt-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=R?(i=me._tr_tally(e,1,e.match_length-R),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=0,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:bn}function Av(e,t){for(var i;;){if(e.lookahead===0&&(Ht(e),e.lookahead===0)){if(t===$t)return W;break}if(e.match_length=0,i=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=0,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:bn}function Ie(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 yi;yi=[new Ie(0,0,0,0,Ev),new Ie(4,4,8,4,$s),new Ie(4,5,16,8,$s),new Ie(4,6,32,32,$s),new Ie(4,4,16,16,bi),new Ie(8,16,32,32,bi),new Ie(8,16,128,128,bi),new Ie(8,32,128,256,bi),new Ie(32,128,258,1024,bi),new Ie(32,258,258,4096,bi)];function Cv(e){e.window_size=2*e.w_size,vt(e.head),e.max_lazy_match=yi[e.level].max_lazy,e.good_match=yi[e.level].good_length,e.nice_match=yi[e.level].nice_length,e.max_chain_length=yi[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=R-1,e.match_available=0,e.ins_h=0}function Tv(){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=Rr,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 Q.Buf16(yv*2),this.dyn_dtree=new Q.Buf16((2*mv+1)*2),this.bl_tree=new Q.Buf16((2*bv+1)*2),vt(this.dyn_ltree),vt(this.dyn_dtree),vt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Q.Buf16(vv+1),this.heap=new Q.Buf16(2*Us+1),vt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Q.Buf16(2*Us+1),vt(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 ap(e){var t;return!e||!e.state?wt(e,be):(e.total_in=e.total_out=0,e.data_type=dv,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Mr:Ft,e.adler=t.wrap===2?0:1,t.last_flush=$t,me._tr_init(t),Pe)}function sp(e){var t=ap(e);return t===Pe&&Cv(e.state),t}function kv(e,t){return!e||!e.state||e.state.wrap!==2?be:(e.state.gzhead=t,Pe)}function op(e,t,i,n,r,a){if(!e)return be;var s=1;if(t===av&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>uv||i!==Rr||n<8||n>15||t<0||t>9||a<0||a>lv)return wt(e,be);n===8&&(n=9);var o=new Tv;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+R-1)/R),o.window=new Q.Buf8(o.w_size*2),o.head=new Q.Buf16(o.hash_size),o.prev=new Q.Buf16(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Q.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,sp(e)}function Lv(e,t){return op(e,t,Rr,pv,fv,cv)}function Rv(e,t){var i,n,r,a;if(!e||!e.state||t>ep||t<0)return e?wt(e,be):be;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===mn&&t!==_t)return wt(e,e.avail_out===0?Hs:be);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===Mr)if(n.wrap===2)e.adler=0,M(n,31),M(n,139),M(n,8),n.gzhead?(M(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)),M(n,n.gzhead.time&255),M(n,n.gzhead.time>>8&255),M(n,n.gzhead.time>>16&255),M(n,n.gzhead.time>>24&255),M(n,n.level===9?2:n.strategy>=Cr||n.level<2?4:0),M(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(M(n,n.gzhead.extra.length&255),M(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=bt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=qs):(M(n,0),M(n,0),M(n,0),M(n,0),M(n,0),M(n,n.level===9?2:n.strategy>=Cr||n.level<2?4:0),M(n,wv),n.status=Ft);else{var s=Rr+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=Cr||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=xv),s+=31-s%31,n.status=Ft,gn(n,s),n.strstart!==0&&(gn(n,e.adler>>>16),gn(n,e.adler&65535)),e.adler=1}if(n.status===qs)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=bt(e.adler,n.pending_buf,n.pending-r,r)),yt(e),r=n.pending,n.pending===n.pending_buf_size));)M(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Tr)}else n.status=Tr;if(n.status===Tr)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),yt(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,M(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.gzindex=0,n.status=kr)}else n.status=kr;if(n.status===kr)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),yt(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,M(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.status=Lr)}else n.status=Lr;if(n.status===Lr&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&yt(e),n.pending+2<=n.pending_buf_size&&(M(n,e.adler&255),M(n,e.adler>>8&255),e.adler=0,n.status=Ft)):n.status=Ft),n.pending!==0){if(yt(e),e.avail_out===0)return n.last_flush=-1,Pe}else if(e.avail_in===0&&ip(t)<=ip(i)&&t!==_t)return wt(e,Hs);if(n.status===mn&&e.avail_in!==0)return wt(e,Hs);if(e.avail_in!==0||n.lookahead!==0||t!==$t&&n.status!==mn){var d=n.strategy===Cr?Av(n,t):n.strategy===ov?Sv(n,t):yi[n.level].func(n,t);if((d===Nt||d===vi)&&(n.status=mn),d===W||d===Nt)return e.avail_out===0&&(n.last_flush=-1),Pe;if(d===bn&&(t===iv?me._tr_align(n):t!==ep&&(me._tr_stored_block(n,0,0,!1),t===nv&&(vt(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),yt(e),e.avail_out===0))return n.last_flush=-1,Pe}return t!==_t?Pe:n.wrap<=0?tp:(n.wrap===2?(M(n,e.adler&255),M(n,e.adler>>8&255),M(n,e.adler>>16&255),M(n,e.adler>>24&255),M(n,e.total_in&255),M(n,e.total_in>>8&255),M(n,e.total_in>>16&255),M(n,e.total_in>>24&255)):(gn(n,e.adler>>>16),gn(n,e.adler&65535)),yt(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Pe:tp)}function Mv(e){var t;return!e||!e.state?be:(t=e.state.status,t!==Mr&&t!==qs&&t!==Tr&&t!==kr&&t!==Lr&&t!==Ft&&t!==mn?wt(e,be):(e.state=null,t===Ft?wt(e,rv):Pe))}function Ov(e,t){var i=t.length,n,r,a,s,o,d,l,c;if(!e||!e.state||(n=e.state,s=n.wrap,s===2||s===1&&n.status!==Mr||n.lookahead))return be;for(s===1&&(e.adler=np(e.adler,t,i,0)),n.wrap=0,i>=n.w_size&&(s===0&&(vt(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new Q.Buf8(n.w_size),Q.arraySet(c,t,i-n.w_size,n.w_size,0),t=c,i=n.w_size),o=e.avail_in,d=e.next_in,l=e.input,e.avail_in=i,e.next_in=0,e.input=t,Ht(n);n.lookahead>=R;){r=n.strstart,a=n.lookahead-(R-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+R-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=R-1,Ht(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=R-1,n.match_available=0,e.next_in=d,e.input=l,e.avail_in=o,n.wrap=s,Pe}De.deflateInit=Lv;De.deflateInit2=op;De.deflateReset=sp;De.deflateResetKeep=ap;De.deflateSetHeader=kv;De.deflate=Rv;De.deflateEnd=Mv;De.deflateSetDictionary=Ov;De.deflateInfo="pako deflate (from Nodeca project)"});var Gs=E(xi=>{"use strict";var Or=nt(),cp=!0,dp=!0;try{String.fromCharCode.apply(null,[0])}catch{cp=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{dp=!1}var yn=new Or.Buf8(256);for(at=0;at<256;at++)yn[at]=at>=252?6:at>=248?5:at>=240?4:at>=224?3:at>=192?2:1;var at;yn[254]=yn[254]=1;xi.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 Or.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 up(e,t){if(t<65534&&(e.subarray&&dp||!e.subarray&&cp))return String.fromCharCode.apply(null,Or.shrinkBuf(e,t));for(var i="",n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i}xi.buf2binstring=function(e){return up(e,e.length)};xi.binstring2buf=function(e){for(var t=new Or.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t};xi.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=yn[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 up(o,n)};xi.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+yn[e[i]]>t?i:t}});var Ws=E((nE,pp)=>{"use strict";function Iv(){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}pp.exports=Iv});var mp=E(wn=>{"use strict";var vn=lp(),xn=nt(),Vs=Gs(),Xs=Ar(),Pv=Ws(),gp=Object.prototype.toString,Dv=0,Ys=4,wi=0,fp=1,hp=2,jv=-1,zv=0,Bv=8;function Ut(e){if(!(this instanceof Ut))return new Ut(e);this.options=xn.assign({level:jv,method:Bv,chunkSize:16384,windowBits:15,memLevel:8,strategy:zv,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 Pv,this.strm.avail_out=0;var i=vn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==wi)throw new Error(Xs[i]);if(t.header&&vn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=Vs.string2buf(t.dictionary):gp.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,i=vn.deflateSetDictionary(this.strm,n),i!==wi)throw new Error(Xs[i]);this._dict_set=!0}}Ut.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?Ys:Dv,typeof e=="string"?i.input=Vs.string2buf(e):gp.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 xn.Buf8(n),i.next_out=0,i.avail_out=n),r=vn.deflate(i,a),r!==fp&&r!==wi)return this.onEnd(r),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(a===Ys||a===hp))&&(this.options.to==="string"?this.onData(Vs.buf2binstring(xn.shrinkBuf(i.output,i.next_out))):this.onData(xn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&r!==fp);return a===Ys?(r=vn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===wi):(a===hp&&(this.onEnd(wi),i.avail_out=0),!0)};Ut.prototype.onData=function(e){this.chunks.push(e)};Ut.prototype.onEnd=function(e){e===wi&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=xn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Ks(e,t){var i=new Ut(t);if(i.push(e,!0),i.err)throw i.msg||Xs[i.err];return i.result}function Fv(e,t){return t=t||{},t.raw=!0,Ks(e,t)}function Nv(e,t){return t=t||{},t.gzip=!0,Ks(e,t)}wn.Deflate=Ut;wn.deflate=Ks;wn.deflateRaw=Fv;wn.gzip=Nv});var yp=E((aE,bp)=>{"use strict";var Ir=30,Hv=12;bp.exports=function(t,i){var n,r,a,s,o,d,l,c,f,u,p,v,h,x,m,y,b,g,w,C,S,A,T,L,_;n=t.state,r=t.next_in,L=t.input,a=r+(t.avail_in-5),s=t.next_out,_=t.output,o=s-(i-t.avail_out),d=s+(t.avail_out-257),l=n.dmax,c=n.wsize,f=n.whave,u=n.wnext,p=n.window,v=n.hold,h=n.bits,x=n.lencode,m=n.distcode,y=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{h<15&&(v+=L[r++]<<h,h+=8,v+=L[r++]<<h,h+=8),g=x[v&y];t:for(;;){if(w=g>>>24,v>>>=w,h-=w,w=g>>>16&255,w===0)_[s++]=g&65535;else if(w&16){C=g&65535,w&=15,w&&(h<w&&(v+=L[r++]<<h,h+=8),C+=v&(1<<w)-1,v>>>=w,h-=w),h<15&&(v+=L[r++]<<h,h+=8,v+=L[r++]<<h,h+=8),g=m[v&b];i:for(;;){if(w=g>>>24,v>>>=w,h-=w,w=g>>>16&255,w&16){if(S=g&65535,w&=15,h<w&&(v+=L[r++]<<h,h+=8,h<w&&(v+=L[r++]<<h,h+=8)),S+=v&(1<<w)-1,S>l){t.msg="invalid distance too far back",n.mode=Ir;break e}if(v>>>=w,h-=w,w=s-o,S>w){if(w=S-w,w>f&&n.sane){t.msg="invalid distance too far back",n.mode=Ir;break e}if(A=0,T=p,u===0){if(A+=c-w,w<C){C-=w;do _[s++]=p[A++];while(--w);A=s-S,T=_}}else if(u<w){if(A+=c+u-w,w-=u,w<C){C-=w;do _[s++]=p[A++];while(--w);if(A=0,u<C){w=u,C-=w;do _[s++]=p[A++];while(--w);A=s-S,T=_}}}else if(A+=u-w,w<C){C-=w;do _[s++]=p[A++];while(--w);A=s-S,T=_}for(;C>2;)_[s++]=T[A++],_[s++]=T[A++],_[s++]=T[A++],C-=3;C&&(_[s++]=T[A++],C>1&&(_[s++]=T[A++]))}else{A=s-S;do _[s++]=_[A++],_[s++]=_[A++],_[s++]=_[A++],C-=3;while(C>2);C&&(_[s++]=_[A++],C>1&&(_[s++]=_[A++]))}}else if((w&64)===0){g=m[(g&65535)+(v&(1<<w)-1)];continue i}else{t.msg="invalid distance code",n.mode=Ir;break e}break}}else if((w&64)===0){g=x[(g&65535)+(v&(1<<w)-1)];continue t}else if(w&32){n.mode=Hv;break e}else{t.msg="invalid literal/length code",n.mode=Ir;break e}break}}while(r<a&&s<d);C=h>>3,r-=C,h-=C<<3,v&=(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<d?257+(d-s):257-(s-d),n.hold=v,n.bits=h}});var Ap=E((sE,Sp)=>{"use strict";var vp=nt(),_i=15,xp=852,wp=592,_p=0,Zs=1,Ep=2,$v=[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],Uv=[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],qv=[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],Gv=[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];Sp.exports=function(t,i,n,r,a,s,o,d){var l=d.bits,c=0,f=0,u=0,p=0,v=0,h=0,x=0,m=0,y=0,b=0,g,w,C,S,A,T=null,L=0,_,I=new vp.Buf16(_i+1),z=new vp.Buf16(_i+1),le=null,te=0,ne,xe,Ne;for(c=0;c<=_i;c++)I[c]=0;for(f=0;f<r;f++)I[i[n+f]]++;for(v=l,p=_i;p>=1&&I[p]===0;p--);if(v>p&&(v=p),p===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,d.bits=1,0;for(u=1;u<p&&I[u]===0;u++);for(v<u&&(v=u),m=1,c=1;c<=_i;c++)if(m<<=1,m-=I[c],m<0)return-1;if(m>0&&(t===_p||p!==1))return-1;for(z[1]=0,c=1;c<_i;c++)z[c+1]=z[c]+I[c];for(f=0;f<r;f++)i[n+f]!==0&&(o[z[i[n+f]]++]=f);if(t===_p?(T=le=o,_=19):t===Zs?(T=$v,L-=257,le=Uv,te-=257,_=256):(T=qv,le=Gv,_=-1),b=0,f=0,c=u,A=s,h=v,x=0,C=-1,y=1<<v,S=y-1,t===Zs&&y>xp||t===Ep&&y>wp)return 1;for(;;){ne=c-x,o[f]<_?(xe=0,Ne=o[f]):o[f]>_?(xe=le[te+o[f]],Ne=T[L+o[f]]):(xe=96,Ne=0),g=1<<c-x,w=1<<h,u=w;do w-=g,a[A+(b>>x)+w]=ne<<24|xe<<16|Ne|0;while(w!==0);for(g=1<<c-1;b&g;)g>>=1;if(g!==0?(b&=g-1,b+=g):b=0,f++,--I[c]===0){if(c===p)break;c=i[n+o[f]]}if(c>v&&(b&S)!==C){for(x===0&&(x=v),A+=u,h=c-x,m=1<<h;h+x<p&&(m-=I[h+x],!(m<=0));)h++,m<<=1;if(y+=1<<h,t===Zs&&y>xp||t===Ep&&y>wp)return 1;C=b&S,a[C]=v<<24|h<<16|A-s|0}}return b!==0&&(a[A+b]=c-x<<24|64<<16|0),d.bits=v,0}});var of=E(Se=>{"use strict";var oe=nt(),no=Fs(),je=Ns(),Wv=yp(),_n=Ap(),Yv=0,Zp=1,Jp=2,Cp=4,Vv=5,Pr=6,qt=0,Xv=1,Kv=2,ye=-2,Qp=-3,ro=-4,Zv=-5,Tp=8,ef=1,kp=2,Lp=3,Rp=4,Mp=5,Op=6,Ip=7,Pp=8,Dp=9,jp=10,zr=11,st=12,Js=13,zp=14,Qs=15,Bp=16,Fp=17,Np=18,Hp=19,Dr=20,jr=21,$p=22,Up=23,qp=24,Gp=25,Wp=26,eo=27,Yp=28,Vp=29,j=30,ao=31,Jv=32,Qv=852,ex=592,tx=15,ix=tx;function Xp(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function nx(){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 oe.Buf16(320),this.work=new oe.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function tf(e){var t;return!e||!e.state?ye:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=ef,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new oe.Buf32(Qv),t.distcode=t.distdyn=new oe.Buf32(ex),t.sane=1,t.back=-1,qt)}function nf(e){var t;return!e||!e.state?ye:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,tf(e))}function rf(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))?ye:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,nf(e))}function af(e,t){var i,n;return e?(n=new nx,e.state=n,n.window=null,i=rf(e,t),i!==qt&&(e.state=null),i):ye}function rx(e){return af(e,ix)}var Kp=!0,to,io;function ax(e){if(Kp){var t;for(to=new oe.Buf32(512),io=new oe.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(_n(Zp,e.lens,0,288,to,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;_n(Jp,e.lens,0,32,io,0,e.work,{bits:5}),Kp=!1}e.lencode=to,e.lenbits=9,e.distcode=io,e.distbits=5}function sf(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 oe.Buf8(a.wsize)),n>=a.wsize?(oe.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),oe.arraySet(a.window,t,i-n,r,a.wnext),n-=r,n?(oe.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 sx(e,t){var i,n,r,a,s,o,d,l,c,f,u,p,v,h,x=0,m,y,b,g,w,C,S,A,T=new oe.Buf8(4),L,_,I=[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 ye;i=e.state,i.mode===st&&(i.mode=Js),s=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,l=i.hold,c=i.bits,f=o,u=d,A=qt;e:for(;;)switch(i.mode){case ef:if(i.wrap===0){i.mode=Js;break}for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(i.wrap&2&&l===35615){i.check=0,T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0),l=0,c=0,i.mode=kp;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",i.mode=j;break}if((l&15)!==Tp){e.msg="unknown compression method",i.mode=j;break}if(l>>>=4,c-=4,S=(l&15)+8,i.wbits===0)i.wbits=S;else if(S>i.wbits){e.msg="invalid window size",i.mode=j;break}i.dmax=1<<S,e.adler=i.check=1,i.mode=l&512?jp:st,l=0,c=0;break;case kp:for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(i.flags=l,(i.flags&255)!==Tp){e.msg="unknown compression method",i.mode=j;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=j;break}i.head&&(i.head.text=l>>8&1),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0)),l=0,c=0,i.mode=Lp;case Lp:for(;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.head&&(i.head.time=l),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,i.check=je(i.check,T,4,0)),l=0,c=0,i.mode=Rp;case Rp:for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.head&&(i.head.xflags=l&255,i.head.os=l>>8),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0)),l=0,c=0,i.mode=Mp;case Mp:if(i.flags&1024){for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.length=l,i.head&&(i.head.extra_len=l),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0)),l=0,c=0}else i.head&&(i.head.extra=null);i.mode=Op;case Op:if(i.flags&1024&&(p=i.length,p>o&&(p=o),p&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),oe.arraySet(i.head.extra,n,a,p,S)),i.flags&512&&(i.check=je(i.check,n,p,a)),o-=p,a+=p,i.length-=p),i.length))break e;i.length=0,i.mode=Ip;case Ip:if(i.flags&2048){if(o===0)break e;p=0;do S=n[a+p++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S));while(S&&p<o);if(i.flags&512&&(i.check=je(i.check,n,p,a)),o-=p,a+=p,S)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=Pp;case Pp:if(i.flags&4096){if(o===0)break e;p=0;do S=n[a+p++],i.head&&S&&i.length<65536&&(i.head.comment+=String.fromCharCode(S));while(S&&p<o);if(i.flags&512&&(i.check=je(i.check,n,p,a)),o-=p,a+=p,S)break e}else i.head&&(i.head.comment=null);i.mode=Dp;case Dp:if(i.flags&512){for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(l!==(i.check&65535)){e.msg="header crc mismatch",i.mode=j;break}l=0,c=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=st;break;case jp:for(;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}e.adler=i.check=Xp(l),l=0,c=0,i.mode=zr;case zr:if(i.havedict===0)return e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,i.hold=l,i.bits=c,Kv;e.adler=i.check=1,i.mode=st;case st:if(t===Vv||t===Pr)break e;case Js:if(i.last){l>>>=c&7,c-=c&7,i.mode=eo;break}for(;c<3;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}switch(i.last=l&1,l>>>=1,c-=1,l&3){case 0:i.mode=zp;break;case 1:if(ax(i),i.mode=Dr,t===Pr){l>>>=2,c-=2;break e}break;case 2:i.mode=Fp;break;case 3:e.msg="invalid block type",i.mode=j}l>>>=2,c-=2;break;case zp:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",i.mode=j;break}if(i.length=l&65535,l=0,c=0,i.mode=Qs,t===Pr)break e;case Qs:i.mode=Bp;case Bp:if(p=i.length,p){if(p>o&&(p=o),p>d&&(p=d),p===0)break e;oe.arraySet(r,n,a,p,s),o-=p,a+=p,d-=p,s+=p,i.length-=p;break}i.mode=st;break;case Fp:for(;c<14;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(i.nlen=(l&31)+257,l>>>=5,c-=5,i.ndist=(l&31)+1,l>>>=5,c-=5,i.ncode=(l&15)+4,l>>>=4,c-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=j;break}i.have=0,i.mode=Np;case Np:for(;i.have<i.ncode;){for(;c<3;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.lens[I[i.have++]]=l&7,l>>>=3,c-=3}for(;i.have<19;)i.lens[I[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,L={bits:i.lenbits},A=_n(Yv,i.lens,0,19,i.lencode,0,i.work,L),i.lenbits=L.bits,A){e.msg="invalid code lengths set",i.mode=j;break}i.have=0,i.mode=Hp;case Hp:for(;i.have<i.nlen+i.ndist;){for(;x=i.lencode[l&(1<<i.lenbits)-1],m=x>>>24,y=x>>>16&255,b=x&65535,!(m<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(b<16)l>>>=m,c-=m,i.lens[i.have++]=b;else{if(b===16){for(_=m+2;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(l>>>=m,c-=m,i.have===0){e.msg="invalid bit length repeat",i.mode=j;break}S=i.lens[i.have-1],p=3+(l&3),l>>>=2,c-=2}else if(b===17){for(_=m+3;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=m,c-=m,S=0,p=3+(l&7),l>>>=3,c-=3}else{for(_=m+7;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=m,c-=m,S=0,p=11+(l&127),l>>>=7,c-=7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=j;break}for(;p--;)i.lens[i.have++]=S}}if(i.mode===j)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=j;break}if(i.lenbits=9,L={bits:i.lenbits},A=_n(Zp,i.lens,0,i.nlen,i.lencode,0,i.work,L),i.lenbits=L.bits,A){e.msg="invalid literal/lengths set",i.mode=j;break}if(i.distbits=6,i.distcode=i.distdyn,L={bits:i.distbits},A=_n(Jp,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,L),i.distbits=L.bits,A){e.msg="invalid distances set",i.mode=j;break}if(i.mode=Dr,t===Pr)break e;case Dr:i.mode=jr;case jr:if(o>=6&&d>=258){e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,i.hold=l,i.bits=c,Wv(e,u),s=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,l=i.hold,c=i.bits,i.mode===st&&(i.back=-1);break}for(i.back=0;x=i.lencode[l&(1<<i.lenbits)-1],m=x>>>24,y=x>>>16&255,b=x&65535,!(m<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(y&&(y&240)===0){for(g=m,w=y,C=b;x=i.lencode[C+((l&(1<<g+w)-1)>>g)],m=x>>>24,y=x>>>16&255,b=x&65535,!(g+m<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=g,c-=g,i.back+=g}if(l>>>=m,c-=m,i.back+=m,i.length=b,y===0){i.mode=Wp;break}if(y&32){i.back=-1,i.mode=st;break}if(y&64){e.msg="invalid literal/length code",i.mode=j;break}i.extra=y&15,i.mode=$p;case $p:if(i.extra){for(_=i.extra;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=Up;case Up:for(;x=i.distcode[l&(1<<i.distbits)-1],m=x>>>24,y=x>>>16&255,b=x&65535,!(m<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if((y&240)===0){for(g=m,w=y,C=b;x=i.distcode[C+((l&(1<<g+w)-1)>>g)],m=x>>>24,y=x>>>16&255,b=x&65535,!(g+m<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=g,c-=g,i.back+=g}if(l>>>=m,c-=m,i.back+=m,y&64){e.msg="invalid distance code",i.mode=j;break}i.offset=b,i.extra=y&15,i.mode=qp;case qp:if(i.extra){for(_=i.extra;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=j;break}i.mode=Gp;case Gp:if(d===0)break e;if(p=u-d,i.offset>p){if(p=i.offset-p,p>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=j;break}p>i.wnext?(p-=i.wnext,v=i.wsize-p):v=i.wnext-p,p>i.length&&(p=i.length),h=i.window}else h=r,v=s-i.offset,p=i.length;p>d&&(p=d),d-=p,i.length-=p;do r[s++]=h[v++];while(--p);i.length===0&&(i.mode=jr);break;case Wp:if(d===0)break e;r[s++]=i.length,d--,i.mode=jr;break;case eo:if(i.wrap){for(;c<32;){if(o===0)break e;o--,l|=n[a++]<<c,c+=8}if(u-=d,e.total_out+=u,i.total+=u,u&&(e.adler=i.check=i.flags?je(i.check,r,u,s-u):no(i.check,r,u,s-u)),u=d,(i.flags?l:Xp(l))!==i.check){e.msg="incorrect data check",i.mode=j;break}l=0,c=0}i.mode=Yp;case Yp:if(i.wrap&&i.flags){for(;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(l!==(i.total&4294967295)){e.msg="incorrect length check",i.mode=j;break}l=0,c=0}i.mode=Vp;case Vp:A=Xv;break e;case j:A=Qp;break e;case ao:return ro;case Jv:default:return ye}return e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,i.hold=l,i.bits=c,(i.wsize||u!==e.avail_out&&i.mode<j&&(i.mode<eo||t!==Cp))&&sf(e,e.output,e.next_out,u-e.avail_out)?(i.mode=ao,ro):(f-=e.avail_in,u-=e.avail_out,e.total_in+=f,e.total_out+=u,i.total+=u,i.wrap&&u&&(e.adler=i.check=i.flags?je(i.check,r,u,e.next_out-u):no(i.check,r,u,e.next_out-u)),e.data_type=i.bits+(i.last?64:0)+(i.mode===st?128:0)+(i.mode===Dr||i.mode===Qs?256:0),(f===0&&u===0||t===Cp)&&A===qt&&(A=Zv),A)}function ox(e){if(!e||!e.state)return ye;var t=e.state;return t.window&&(t.window=null),e.state=null,qt}function lx(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?ye:(i.head=t,t.done=!1,qt)}function cx(e,t){var i=t.length,n,r,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==zr)?ye:n.mode===zr&&(r=1,r=no(r,t,i,0),r!==n.check)?Qp:(a=sf(e,t,i,i),a?(n.mode=ao,ro):(n.havedict=1,qt))}Se.inflateReset=nf;Se.inflateReset2=rf;Se.inflateResetKeep=tf;Se.inflateInit=rx;Se.inflateInit2=af;Se.inflate=sx;Se.inflateEnd=ox;Se.inflateGetHeader=lx;Se.inflateSetDictionary=cx;Se.inflateInfo="pako inflate (from Nodeca project)"});var so=E((lE,lf)=>{"use strict";lf.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 df=E((cE,cf)=>{"use strict";function dx(){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}cf.exports=dx});var pf=E(Sn=>{"use strict";var Ei=of(),En=nt(),Br=Gs(),H=so(),oo=Ar(),ux=Ws(),px=df(),uf=Object.prototype.toString;function Gt(e){if(!(this instanceof Gt))return new Gt(e);this.options=En.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 ux,this.strm.avail_out=0;var i=Ei.inflateInit2(this.strm,t.windowBits);if(i!==H.Z_OK)throw new Error(oo[i]);if(this.header=new px,Ei.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Br.string2buf(t.dictionary):uf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Ei.inflateSetDictionary(this.strm,t.dictionary),i!==H.Z_OK)))throw new Error(oo[i])}Gt.prototype.push=function(e,t){var i=this.strm,n=this.options.chunkSize,r=this.options.dictionary,a,s,o,d,l,c=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?H.Z_FINISH:H.Z_NO_FLUSH,typeof e=="string"?i.input=Br.binstring2buf(e):uf.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 En.Buf8(n),i.next_out=0,i.avail_out=n),a=Ei.inflate(i,H.Z_NO_FLUSH),a===H.Z_NEED_DICT&&r&&(a=Ei.inflateSetDictionary(this.strm,r)),a===H.Z_BUF_ERROR&&c===!0&&(a=H.Z_OK,c=!1),a!==H.Z_STREAM_END&&a!==H.Z_OK)return this.onEnd(a),this.ended=!0,!1;i.next_out&&(i.avail_out===0||a===H.Z_STREAM_END||i.avail_in===0&&(s===H.Z_FINISH||s===H.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Br.utf8border(i.output,i.next_out),d=i.next_out-o,l=Br.buf2string(i.output,o),i.next_out=d,i.avail_out=n-d,d&&En.arraySet(i.output,i.output,o,d,0),this.onData(l)):this.onData(En.shrinkBuf(i.output,i.next_out))),i.avail_in===0&&i.avail_out===0&&(c=!0)}while((i.avail_in>0||i.avail_out===0)&&a!==H.Z_STREAM_END);return a===H.Z_STREAM_END&&(s=H.Z_FINISH),s===H.Z_FINISH?(a=Ei.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===H.Z_OK):(s===H.Z_SYNC_FLUSH&&(this.onEnd(H.Z_OK),i.avail_out=0),!0)};Gt.prototype.onData=function(e){this.chunks.push(e)};Gt.prototype.onEnd=function(e){e===H.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=En.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function lo(e,t){var i=new Gt(t);if(i.push(e,!0),i.err)throw i.msg||oo[i.err];return i.result}function fx(e,t){return t=t||{},t.raw=!0,lo(e,t)}Sn.Inflate=Gt;Sn.inflate=lo;Sn.inflateRaw=fx;Sn.ungzip=lo});var gf=E((uE,hf)=>{"use strict";var hx=nt().assign,gx=mp(),mx=pf(),bx=so(),ff={};hx(ff,gx,mx,bx);hf.exports=ff});var bf=E(Nr=>{"use strict";var yx=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",vx=gf(),mf=F(),Fr=se(),xx=yx?"uint8array":"array";Nr.magic="\b\0";function Wt(e,t){Fr.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}mf.inherits(Wt,Fr);Wt.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(mf.transformTo(xx,e.data),!1)};Wt.prototype.flush=function(){Fr.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};Wt.prototype.cleanUp=function(){Fr.prototype.cleanUp.call(this),this._pako=null};Wt.prototype._createPako=function(){this._pako=new vx[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Nr.compressWorker=function(e){return new Wt("Deflate",e)};Nr.uncompressWorker=function(){return new Wt("Inflate",{})}});var uo=E(co=>{"use strict";var yf=se();co.STORE={magic:"\0\0",compressWorker:function(){return new yf("STORE compression")},uncompressWorker:function(){return new yf("STORE decompression")}};co.DEFLATE=bf()});var po=E(Yt=>{"use strict";Yt.LOCAL_FILE_HEADER="PK";Yt.CENTRAL_FILE_HEADER="PK";Yt.CENTRAL_DIRECTORY_END="PK";Yt.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";Yt.ZIP64_CENTRAL_DIRECTORY_END="PK";Yt.DATA_DESCRIPTOR="PK\x07\b"});var _f=E((gE,wf)=>{"use strict";var Si=F(),Ai=se(),fo=pi(),vf=xr(),Hr=po(),P=function(e,t){var i="",n;for(n=0;n<t;n++)i+=String.fromCharCode(e&255),e=e>>>8;return i},wx=function(e,t){var i=e;return e||(i=t?16893:33204),(i&65535)<<16},_x=function(e){return(e||0)&63},xf=function(e,t,i,n,r,a){var s=e.file,o=e.compression,d=a!==fo.utf8encode,l=Si.transformTo("string",a(s.name)),c=Si.transformTo("string",fo.utf8encode(s.name)),f=s.comment,u=Si.transformTo("string",a(f)),p=Si.transformTo("string",fo.utf8encode(f)),v=c.length!==s.name.length,h=p.length!==f.length,x,m,y="",b="",g="",w=s.dir,C=s.date,S={crc32:0,compressedSize:0,uncompressedSize:0};(!t||i)&&(S.crc32=e.crc32,S.compressedSize=e.compressedSize,S.uncompressedSize=e.uncompressedSize);var A=0;t&&(A|=8),!d&&(v||h)&&(A|=2048);var T=0,L=0;w&&(T|=16),r==="UNIX"?(L=798,T|=wx(s.unixPermissions,w)):(L=20,T|=_x(s.dosPermissions,w)),x=C.getUTCHours(),x=x<<6,x=x|C.getUTCMinutes(),x=x<<5,x=x|C.getUTCSeconds()/2,m=C.getUTCFullYear()-1980,m=m<<4,m=m|C.getUTCMonth()+1,m=m<<5,m=m|C.getUTCDate(),v&&(b=P(1,1)+P(vf(l),4)+c,y+="up"+P(b.length,2)+b),h&&(g=P(1,1)+P(vf(u),4)+p,y+="uc"+P(g.length,2)+g);var _="";_+=`
2
- \0`,_+=P(A,2),_+=o.magic,_+=P(x,2),_+=P(m,2),_+=P(S.crc32,4),_+=P(S.compressedSize,4),_+=P(S.uncompressedSize,4),_+=P(l.length,2),_+=P(y.length,2);var I=Hr.LOCAL_FILE_HEADER+_+l+y,z=Hr.CENTRAL_FILE_HEADER+P(L,2)+_+P(u.length,2)+"\0\0\0\0"+P(T,4)+P(n,4)+l+y+u;return{fileRecord:I,dirRecord:z}},Ex=function(e,t,i,n,r){var a="",s=Si.transformTo("string",r(n));return a=Hr.CENTRAL_DIRECTORY_END+"\0\0\0\0"+P(e,2)+P(e,2)+P(t,4)+P(i,4)+P(s.length,2)+s,a},Sx=function(e){var t="";return t=Hr.DATA_DESCRIPTOR+P(e.crc32,4)+P(e.compressedSize,4)+P(e.uncompressedSize,4),t};function Ae(e,t,i,n){Ai.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=[]}Si.inherits(Ae,Ai);Ae.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,Ai.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-n-1))/i:100}}))};Ae.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=xf(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Ae.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=xf(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:Sx(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};Ae.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=Ex(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};Ae.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};Ae.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};Ae.prototype.resume=function(){if(!Ai.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};Ae.prototype.error=function(e){var t=this._sources;if(!Ai.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch{}return!0};Ae.prototype.lock=function(){Ai.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};wf.exports=Ae});var Sf=E(Ef=>{"use strict";var Ax=uo(),Cx=_f(),Tx=function(e,t){var i=e||t,n=Ax[i];if(!n)throw new Error(i+" is not a valid compression method !");return n};Ef.generateWorker=function(e,t,i){var n=new Cx(t.streamFiles,i,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,s){r++;var o=Tx(s.options.compression,t.compression),d=s.options.compressionOptions||t.compressionOptions||{},l=s.dir,c=s.date;s._compressWorker(o,d).withStreamInfo("file",{name:a,dir:l,date:c,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(n)}),n.entriesCount=r}catch(a){n.error(a)}return n}});var Cf=E((bE,Af)=>{"use strict";var kx=F(),$r=se();function An(e,t){$r.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}kx.inherits(An,$r);An.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()})};An.prototype.pause=function(){return $r.prototype.pause.call(this)?(this._stream.pause(),!0):!1};An.prototype.resume=function(){return $r.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Af.exports=An});var jf=E((yE,Df)=>{"use strict";var Lx=pi(),Cn=F(),Rf=se(),Rx=bs(),Mf=ys(),Tf=wr(),Mx=Tu(),Ox=Sf(),kf=en(),Ix=Cf(),Of=function(e,t,i){var n=Cn.getTypeOf(t),r,a=Cn.extend(i||{},Mf);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=If(e)),a.createFolders&&(r=Px(e))&&Pf.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 Tf&&t.uncompressedSize===0;(o||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var d=null;t instanceof Tf||t instanceof Rf?d=t:kf.isNode&&kf.isStream(t)?d=new Ix(e,t):d=Cn.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var l=new Mx(e,d,a);this.files[e]=l},Px=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},If=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},Pf=function(e,t){return t=typeof t!="undefined"?t:Mf.createFolders,e=If(e),this.files[e]||Of.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function Lf(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var Dx={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(Lf(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,Of.call(this,e,t,i);return this},folder:function(e){if(!e)return this;if(Lf(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,i=Pf.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=Cn.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Lx.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.");Cn.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=Ox.generateWorker(this,i,n)}catch(r){t=new Rf("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)}};Df.exports=Dx});var ho=E((vE,Bf)=>{"use strict";var jx=F();function zf(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}zf.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 jx.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))}};Bf.exports=zf});var go=E((xE,Nf)=>{"use strict";var Ff=ho(),zx=F();function Ci(e){Ff.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}zx.inherits(Ci,Ff);Ci.prototype.byteAt=function(e){return this.data[this.zero+e]};Ci.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};Ci.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]};Ci.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};Nf.exports=Ci});var Uf=E((wE,$f)=>{"use strict";var Hf=ho(),Bx=F();function Ti(e){Hf.call(this,e)}Bx.inherits(Ti,Hf);Ti.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};Ti.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};Ti.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};Ti.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};$f.exports=Ti});var bo=E((_E,Gf)=>{"use strict";var qf=go(),Fx=F();function mo(e){qf.call(this,e)}Fx.inherits(mo,qf);mo.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};Gf.exports=mo});var Vf=E((EE,Yf)=>{"use strict";var Wf=bo(),Nx=F();function yo(e){Wf.call(this,e)}Nx.inherits(yo,Wf);yo.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};Yf.exports=yo});var vo=E((SE,Kf)=>{"use strict";var Ur=F(),Xf=tt(),Hx=go(),$x=Uf(),Ux=Vf(),qx=bo();Kf.exports=function(e){var t=Ur.getTypeOf(e);return Ur.checkSupport(t),t==="string"&&!Xf.uint8array?new $x(e):t==="nodebuffer"?new Ux(e):Xf.uint8array?new qx(Ur.transformTo("uint8array",e)):new Hx(Ur.transformTo("array",e))}});var eh=E((AE,Qf)=>{"use strict";var xo=vo(),Et=F(),Gx=wr(),Zf=xr(),qr=pi(),Gr=uo(),Wx=tt(),Yx=0,Vx=3,Xx=function(e){for(var t in Gr)if(Object.prototype.hasOwnProperty.call(Gr,t)&&Gr[t].magic===e)return Gr[t];return null};function Jf(e,t){this.options=e,this.loadOptions=t}Jf.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=Xx(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+Et.pretty(this.compressionMethod)+" unknown (inner file : "+Et.transformTo("string",this.fileName)+")");this.decompressed=new Gx(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===Yx&&(this.dosPermissions=this.externalFileAttributes&63),e===Vx&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=xo(this.extraFields[1].value);this.uncompressedSize===Et.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Et.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Et.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Et.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=Wx.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=qr.utf8decode(this.fileName),this.fileCommentStr=qr.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var i=Et.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var r=Et.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=xo(e.value);return t.readInt(1)!==1||Zf(this.fileName)!==t.readInt(4)?null:qr.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=xo(e.value);return t.readInt(1)!==1||Zf(this.fileComment)!==t.readInt(4)?null:qr.utf8decode(t.readData(e.length-5))}return null}};Qf.exports=Jf});var nh=E((CE,ih)=>{"use strict";var Kx=vo(),ot=F(),Ce=po(),Zx=eh(),Jx=tt();function th(e){this.files=[],this.loadOptions=e}th.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 ("+ot.pretty(t)+", expected "+ot.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=Jx.uint8array?"uint8array":"array",i=ot.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(Ce.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(Ce.CENTRAL_FILE_HEADER);)e=new Zx({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(Ce.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,Ce.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(Ce.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===ot.MAX_VALUE_16BITS||this.diskWithCentralDirStart===ot.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===ot.MAX_VALUE_16BITS||this.centralDirRecords===ot.MAX_VALUE_16BITS||this.centralDirSize===ot.MAX_VALUE_32BITS||this.centralDirOffset===ot.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(Ce.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(Ce.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,Ce.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(Ce.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(Ce.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,Ce.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=Kx(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};ih.exports=th});var sh=E((TE,ah)=>{"use strict";var wo=F(),Wr=ci(),Qx=pi(),e0=nh(),t0=ws(),rh=en();function i0(e){return new Wr.Promise(function(t,i){var n=e.decompressed.getContentWorker().pipe(new t0);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()})}ah.exports=function(e,t){var i=this;return t=wo.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:Qx.utf8decode}),rh.isNode&&rh.isStream(e)?Wr.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):wo.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var r=new e0(t);return r.load(n),r}).then(function(r){var a=[Wr.Promise.resolve(r)],s=r.files;if(t.checkCRC32)for(var o=0;o<s.length;o++)a.push(i0(s[o]));return Wr.Promise.all(a)}).then(function(r){for(var a=r.shift(),s=a.files,o=0;o<s.length;o++){var d=s[o],l=d.fileNameStr,c=wo.resolve(d.fileNameStr);i.file(c,d.decompressed,{binary:!0,optimizedBinaryString:!0,date:d.date,dir:d.dir,comment:d.fileCommentStr.length?d.fileCommentStr:null,unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions,createFolders:t.createFolders}),d.dir||(i.file(c).unsafeOriginalName=l)}return a.zipComment.length&&(i.comment=a.zipComment),i})}});var lh=E((kE,oh)=>{"use strict";function ve(){if(!(this instanceof ve))return new ve;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 ve;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}ve.prototype=jf();ve.prototype.loadAsync=sh();ve.support=tt();ve.defaults=ys();ve.version="3.10.1";ve.loadAsync=function(e,t){return new ve().loadAsync(e,t)};ve.external=ci();oh.exports=ve});var hh={};fc(hh,{AssetEditorModal:()=>ko});var ko,Lo=qe(()=>{"use strict";ko=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 Dg=Object.create;var Un=Object.defineProperty;var jg=Object.getOwnPropertyDescriptor;var zg=Object.getOwnPropertyNames;var Bg=Object.getPrototypeOf,Fg=Object.prototype.hasOwnProperty;var qe=(e,t)=>()=>(e&&(t=e(e=0)),t);var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hc=(e,t)=>{for(var i in t)Un(e,i,{get:t[i],enumerable:!0})},gc=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of zg(t))!Fg.call(e,r)&&r!==i&&Un(e,r,{get:()=>t[r],enumerable:!(n=jg(t,r))||n.enumerable});return e};var Ge=(e,t,i)=>(i=e!=null?Dg(Bg(e)):{},gc(t||!e||!e.__esModule?Un(i,"default",{value:e,enumerable:!0}):i,e)),Ng=e=>gc(Un({},"__esModule",{value:!0}),e);var We,wa=qe(()=>{"use strict";We=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()}};We.store=new Map});function Yg(){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 Vg(){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 Xg(){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 Kg(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${B}`),Object.keys(Ye).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Ye)),Ye;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Ye={...window.INLINE_ASSETS},Ye;if(!(B==="publish"&&Le!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Ye;if(!_a){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),_a=(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 Ye=await _a,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Ye)),Ye}function Ea(e){return e===null||typeof e!="object"||(Object.freeze(e),Object.values(e).forEach(t=>Ea(t))),e}function Zg(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),Ve.Texture.from(n)}function Sa(e,t){Vc.set(e,t)}var Ve,Wc,Yc,Lt,B,Le,ut,Ye,_a,Vc,Rt,Yn=qe(()=>{"use strict";Ve=require("pixi.js");wa();Wc=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Yc=Yg(),Lt=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,B=Yc?"publish":Wc,Le=Lt==null?void 0:Lt.assetsInlined;Lt!=null&&Lt.buildMode&&(B=Lt.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${B}`));ut=Xg();ut!=null&&ut.buildMode&&(B=ut.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${B}`));(ut==null?void 0:ut.assetsInlined)!==void 0&&(Le=ut.assetsInlined);Vg().then(e=>{e!=null&&e.buildMode&&e.buildMode!==B&&(B=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${B}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(Le=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${Wc}, Runtime: ${Yc?"publish":"dev"}, Effective: ${B}`);Ye={},_a=null;Vc=new Map;Rt=class{static async load(t,i,n,r){let a=`${t}:${i.path}`,s=We.get(a);if(s!==void 0)return s;console.log(`[AssetLoader] Loading asset: ${t}, type: ${i.type}, Effective mode: ${B}`),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 Kg(),d=o[t];if(!d&&r&&(d=o[r],d&&console.log(`[AssetLoader] Found inline data for ${t} using configId: ${r}`)),!d&&i.path){let f=i.path.split("/");if(f.length>=2){let p=f[f.length-1].split(".")[0];o[p]&&(d=o[p],console.log(`[AssetLoader] Found inline data for ${t} using assetName: ${p}`))}}if(console.log("[AssetLoader] Inline data for",t,":",d?"FOUND":"NOT FOUND"),B==="publish"&&Le!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!d))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${t}, path: ${i.path}`);let c=Vc.get(i.type);if(c)try{let f=await c(i.path,d,t,n);return We.set(a,f),f}catch(f){return this.handleFailure(t,i.type,f)}try{let f;switch(i.type){case"image":f=await this.loadImage(i.path,d);break;case"json":f=await this.loadJSON(i.path,d),f=Ea(f);break;default:throw new Error(`Unknown asset type: ${i.type}`)}return We.set(a,f),f}catch(f){return this.handleFailure(t,i.type,f)}}static async loadImage(t,i){let n=B==="publish",r=n&&Le!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${B}, 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 Ve.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 Ve.Assets.load(i)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await Ve.Assets.load(t)}return await Ve.Assets.load(t)}static async loadJSON(t,i){let n=B==="publish",r=n&&Le!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${B}, 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(B==="dev"){let a=i==="image"?Zg():Ea({__placeholder:!0,type:i});return We.set(t+":"+((n==null?void 0:n.path)||"missing"),a),a}throw n}};Sa("image",async(e,t)=>{let i=B==="publish",n=i&&Le!==!1,r=B==="brand",a=i&&Le===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${B}, 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 Ve.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}"`))),Ve.Assets.load(t||s)});Sa("json",async(e,t)=>{let i=B==="publish",n=i&&Le!==!1,r=B==="brand",a=i&&Le===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${B}, 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 Ca,im,Vn,Ui=qe(()=>{"use strict";Yn();Ca=class{constructor(){this.textures=new Map;this.readyPromise=null;this.priorityReadyPromise=null;this.priorityReadyResolve=null;this.config=null;this.app=null;this.attempted=new Set;this.waiters=new Set}init(t,i){if(this.config===t&&this.app===i&&this.priorityReadyPromise){console.log("[AssetTextures] init called with same config/app; keeping existing state");return}this.textures.clear(),this.readyPromise=null,this.priorityReadyPromise=null,this.priorityReadyResolve=null,this.attempted.clear(),this.waiters.clear(),this.priorityReadyPromise=new Promise(n=>{this.priorityReadyResolve=n}),this.config=t,this.app=i,console.log("[AssetTextures] Initialized with config, cleared previous textures")}async ready(){if(this.readyPromise){await this.readyPromise;return}if(!this.config)throw new Error("[AssetTextures] Must call init() before ready() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before ready() - app is null");let t=this.config,i=this.app;return this.readyPromise=(async()=>{var s;console.log("[AssetTextures] Loading all assets...");let n=new Set(["background_loading_1"]),r=[],a=[];for(let[o,d]of t.objects.entries()){let l=(s=d.render)==null?void 0:s.asset;if(!l)continue;let c=async()=>{var f;try{let p=(f=d.identity)==null?void 0:f.id;console.log(`[AssetTextures] Loading ${l.type}: ${o} (${p})`);let u=await Rt.load(o,l,i,p);this.textures.set(o,u),console.log(`[AssetTextures] \u2713 Loaded: ${o}`)}catch(p){console.error(`[AssetTextures] \u2717 Failed to load: ${o}`,p)}finally{this.attempted.add(o);try{for(let p of Array.from(this.waiters))p()}catch{}}};n.has(o)?r.push(c()):a.push(c())}r.length>0&&(console.log("[AssetTextures] Phase 1: Loading priority assets (loading screen)..."),await Promise.all(r),console.log("[AssetTextures] Phase 1: Priority assets ready")),this.priorityReadyResolve&&this.priorityReadyResolve(),console.log("[AssetTextures] Phase 2: Loading remaining assets..."),await Promise.all(a),console.log("[AssetTextures] All textures loaded:",Array.from(this.textures.keys()))})(),this.readyPromise}async priorityReady(){return this.priorityReadyPromise?this.priorityReadyPromise:Promise.resolve()}async waitFor(t,i={}){if(!this.config)throw new Error("[AssetTextures] Must call init() before waitFor() - config is null");if(!this.app)throw new Error("[AssetTextures] Must call init() before waitFor() - app is null");let r=Array.from(new Set((t||[]).filter(o=>typeof o=="string"&&o))).filter(o=>{var d,l,c,f;try{let p=(c=(l=(d=this.config)==null?void 0:d.objects)==null?void 0:l.get)==null?void 0:c.call(l,o);return!!((f=p==null?void 0:p.render)!=null&&f.asset)}catch{return!1}});if(r.length===0)return;this.ready().catch(()=>{});let a=()=>r.every(o=>this.textures.has(o)||this.attempted.has(o));if(a())return;let s=typeof i.timeoutMs=="number"?i.timeoutMs:15e3;await new Promise(o=>{let d=!1,l=()=>{d||a()&&(d=!0,this.waiters.delete(l),o())};this.waiters.add(l),l(),s>0&&setTimeout(()=>{d||(d=!0,this.waiters.delete(l),console.warn("[AssetTextures] waitFor timed out; continuing",{ids:r}),o())},s)})}get(t){return this.textures.get(t)}set(t,i){this.textures.set(t,i),console.log(`[AssetTextures] Updated texture: ${t}`)}clear(){this.textures.clear(),this.readyPromise=null,console.log("[AssetTextures] Cleared all textures")}getAllIds(){return Array.from(this.textures.keys())}},im=new Ca,Vn=new Proxy(im,{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 Sm,pt=qe(()=>{"use strict";Sm="handler_preview_override_mode";if(typeof window!="undefined"){let e=window.localStorage.getItem(Sm);window.__enableConfigOverrides=e===null?!0:e==="true"}});var Qc,It,m_,Ra=qe(()=>{"use strict";pt();Qc=null,It="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)Qc=e,It=e.buildMode,console.log("[CONFIG] Loaded inline build settings:",e,"buildMode:",It);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);Qc=i,It=i.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",i,"buildMode:",It)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",It)}catch(t){console.log("[CONFIG] Failed to load build-settings.json:",t instanceof Error?t.message:String(t))}}console.log("[CONFIG] Final buildMode:",It);m_=It==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});var Ma=qe(()=>{"use strict"});var td=qe(()=>{"use strict";Ma();Ra()});var Oa=qe(()=>{"use strict";Ra();Ma();td()});var Wi=S((T1,Ia)=>{"use strict";typeof process=="undefined"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Ia.exports={nextTick:Pm}:Ia.exports=process;function Pm(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 rd=S((k1,nd)=>{"use strict";var Dm={}.toString;nd.exports=Array.isArray||function(e){return Dm.call(e)=="[object Array]"}});var Pa=S((L1,ad)=>{"use strict";ad.exports=require("stream")});var Yi=S((Da,od)=>{"use strict";var nr=require("buffer"),Je=nr.Buffer;function sd(e,t){for(var i in e)t[i]=e[i]}Je.from&&Je.alloc&&Je.allocUnsafe&&Je.allocUnsafeSlow?od.exports=nr:(sd(nr,Da),Da.Buffer=ti);function ti(e,t,i){return Je(e,t,i)}sd(Je,ti);ti.from=function(e,t,i){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Je(e,t,i)};ti.alloc=function(e,t,i){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Je(e);return t!==void 0?typeof i=="string"?n.fill(t,i):n.fill(t):n.fill(0),n};ti.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Je(e)};ti.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return nr.SlowBuffer(e)}});var ii=S(K=>{"use strict";function jm(e){return Array.isArray?Array.isArray(e):rr(e)==="[object Array]"}K.isArray=jm;function zm(e){return typeof e=="boolean"}K.isBoolean=zm;function Bm(e){return e===null}K.isNull=Bm;function Fm(e){return e==null}K.isNullOrUndefined=Fm;function Nm(e){return typeof e=="number"}K.isNumber=Nm;function Hm(e){return typeof e=="string"}K.isString=Hm;function $m(e){return typeof e=="symbol"}K.isSymbol=$m;function Um(e){return e===void 0}K.isUndefined=Um;function qm(e){return rr(e)==="[object RegExp]"}K.isRegExp=qm;function Gm(e){return typeof e=="object"&&e!==null}K.isObject=Gm;function Wm(e){return rr(e)==="[object Date]"}K.isDate=Wm;function Ym(e){return rr(e)==="[object Error]"||e instanceof Error}K.isError=Ym;function Vm(e){return typeof e=="function"}K.isFunction=Vm;function Xm(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}K.isPrimitive=Xm;K.isBuffer=require("buffer").Buffer.isBuffer;function rr(e){return Object.prototype.toString.call(e)}});var ld=S((M1,ja)=>{"use strict";typeof Object.create=="function"?ja.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:ja.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 ni=S((O1,Ba)=>{"use strict";try{if(za=require("util"),typeof za.inherits!="function")throw"";Ba.exports=za.inherits}catch{Ba.exports=ld()}var za});var dd=S((I1,Fa)=>{"use strict";function Km(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var cd=Yi().Buffer,Vi=require("util");function Zm(e,t,i){e.copy(t,i)}Fa.exports=(function(){function e(){Km(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 cd.alloc(0);for(var n=cd.allocUnsafe(i>>>0),r=this.head,a=0;r;)Zm(r.data,n,a),a+=r.data.length,r=r.next;return n},e})();Vi&&Vi.inspect&&Vi.inspect.custom&&(Fa.exports.prototype[Vi.inspect.custom]=function(){var e=Vi.inspect({length:this.length});return this.constructor.name+" "+e})});var Na=S((P1,ud)=>{"use strict";var ar=Wi();function Jm(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,ar.nextTick(sr,this,e)):ar.nextTick(sr,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,ar.nextTick(sr,i,a)):ar.nextTick(sr,i,a):t&&t(a)}),this)}function Qm(){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 sr(e,t){e.emit("error",t)}ud.exports={destroy:Jm,undestroy:Qm}});var fd=S((D1,pd)=>{"use strict";pd.exports=require("util").deprecate});var $a=S((j1,wd)=>{"use strict";var Pt=Wi();wd.exports=$;function gd(e){var t=this;this.next=null,this.entry=null,this.finish=function(){bb(t,e)}}var eb=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Pt.nextTick,ri;$.WritableState=Ki;var md=Object.create(ii());md.inherits=ni();var tb={deprecate:fd()},bd=Pa(),lr=Yi().Buffer,ib=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function nb(e){return lr.from(e)}function rb(e){return lr.isBuffer(e)||e instanceof ib}var yd=Na();md.inherits($,bd);function ab(){}function Ki(e,t){ri=ri||Dt(),e=e||{};var i=t instanceof ri;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){pb(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 gd(this)}Ki.prototype.getBuffer=function(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i};(function(){try{Object.defineProperty(Ki.prototype,"buffer",{get:tb.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var or;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(or=Function.prototype[Symbol.hasInstance],Object.defineProperty($,Symbol.hasInstance,{value:function(e){return or.call(this,e)?!0:this!==$?!1:e&&e._writableState instanceof Ki}})):or=function(e){return e instanceof this};function $(e){if(ri=ri||Dt(),!or.call($,this)&&!(this instanceof ri))return new $(e);this._writableState=new Ki(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)),bd.call(this)}$.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function sb(e,t){var i=new Error("write after end");e.emit("error",i),Pt.nextTick(t,i)}function ob(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),Pt.nextTick(n,a),r=!1),r}$.prototype.write=function(e,t,i){var n=this._writableState,r=!1,a=!n.objectMode&&rb(e);return a&&!lr.isBuffer(e)&&(e=nb(e)),typeof t=="function"&&(i=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof i!="function"&&(i=ab),n.ended?sb(this,i):(a||ob(this,n,e,i))&&(n.pendingcb++,r=cb(this,n,a,e,t,i)),r};$.prototype.cork=function(){var e=this._writableState;e.corked++};$.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&vd(this,e))};$.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 lb(e,t,i){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=lr.from(t,i)),t}Object.defineProperty($.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function cb(e,t,i,n,r,a){if(!i){var s=lb(t,n,r);n!==s&&(i=!0,r="buffer",n=s)}var o=t.objectMode?1:n.length;t.length+=o;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Ha(e,t,!1,o,n,r,a);return d}function Ha(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 db(e,t,i,n,r){--t.pendingcb,i?(Pt.nextTick(r,n),Pt.nextTick(Xi,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(r(n),e._writableState.errorEmitted=!0,e.emit("error",n),Xi(e,t))}function ub(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function pb(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if(ub(i),t)db(e,i,n,t,r);else{var a=xd(i);!a&&!i.corked&&!i.bufferProcessing&&i.bufferedRequest&&vd(e,i),n?eb(hd,e,i,a,r):hd(e,i,a,r)}}function hd(e,t,i,n){i||fb(e,t),t.pendingcb--,n(),Xi(e,t)}function fb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function vd(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,Ha(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 gd(t),t.bufferedRequestCount=0}else{for(;i;){var d=i.chunk,l=i.encoding,c=i.callback,f=t.objectMode?1:d.length;if(Ha(e,t,!1,f,d,l,c),i=i.next,t.bufferedRequestCount--,t.writing)break}i===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=i,t.bufferProcessing=!1}$.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))};$.prototype._writev=null;$.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||mb(this,n,i)};function xd(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function hb(e,t){e._final(function(i){t.pendingcb--,i&&e.emit("error",i),t.prefinished=!0,e.emit("prefinish"),Xi(e,t)})}function gb(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Pt.nextTick(hb,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Xi(e,t){var i=xd(t);return i&&(gb(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),i}function mb(e,t,i){t.ending=!0,Xi(e,t),i&&(t.finished?Pt.nextTick(i):e.once("finish",i)),t.ended=!0,e.writable=!1}function bb(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($.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});$.prototype.destroy=yd.destroy;$.prototype._undestroy=yd.undestroy;$.prototype._destroy=function(e,t){this.end(),t(e)}});var Dt=S((z1,Ad)=>{"use strict";var _d=Wi(),yb=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};Ad.exports=Qe;var Ed=Object.create(ii());Ed.inherits=ni();var Sd=Ga(),qa=$a();Ed.inherits(Qe,Sd);for(Ua=yb(qa.prototype),cr=0;cr<Ua.length;cr++)dr=Ua[cr],Qe.prototype[dr]||(Qe.prototype[dr]=qa.prototype[dr]);var Ua,dr,cr;function Qe(e){if(!(this instanceof Qe))return new Qe(e);Sd.call(this,e),qa.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",vb)}Object.defineProperty(Qe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function vb(){this.allowHalfOpen||this._writableState.ended||_d.nextTick(xb,this)}function xb(e){e.end()}Object.defineProperty(Qe.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)}});Qe.prototype._destroy=function(e,t){this.push(null),this.end(),_d.nextTick(t,e)}});var Va=S(Td=>{"use strict";var Ya=Yi().Buffer,Cd=Ya.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 wb(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 _b(e){var t=wb(e);if(typeof t!="string"&&(Ya.isEncoding===Cd||!Cd(e)))throw new Error("Unknown encoding: "+e);return t||e}Td.StringDecoder=Zi;function Zi(e){this.encoding=_b(e);var t;switch(this.encoding){case"utf16le":this.text=kb,this.end=Lb,t=4;break;case"utf8":this.fillLast=Ab,t=4;break;case"base64":this.text=Rb,this.end=Mb,t=3;break;default:this.write=Ob,this.end=Ib;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ya.allocUnsafe(t)}Zi.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||""};Zi.prototype.end=Tb;Zi.prototype.text=Cb;Zi.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 Wa(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function Eb(e,t,i){var n=t.length-1;if(n<i)return 0;var r=Wa(t[n]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--n<i||r===-2?0:(r=Wa(t[n]),r>=0?(r>0&&(e.lastNeed=r-2),r):--n<i||r===-2?0:(r=Wa(t[n]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function Sb(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 Ab(e){var t=this.lastTotal-this.lastNeed,i=Sb(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 Cb(e,t){var i=Eb(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 Tb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function kb(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 Lb(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 Rb(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 Mb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Ob(e){return e.toString(this.encoding)}function Ib(e){return e&&e.length?this.write(e):""}});var Ga=S((N1,Fd)=>{"use strict";var si=Wi();Fd.exports=D;var Pb=rd(),Ji;D.ReadableState=Pd;var F1=require("events").EventEmitter,Md=function(e,t){return e.listeners(t).length},Qa=Pa(),Qi=Yi().Buffer,Db=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function jb(e){return Qi.from(e)}function zb(e){return Qi.isBuffer(e)||e instanceof Db}var Od=Object.create(ii());Od.inherits=ni();var Xa=require("util"),O=void 0;Xa&&Xa.debuglog?O=Xa.debuglog("stream"):O=function(){};var Bb=dd(),Id=Na(),ai;Od.inherits(D,Qa);var Ka=["error","close","destroy","pause","resume"];function Fb(e,t,i){if(typeof e.prependListener=="function")return e.prependListener(t,i);!e._events||!e._events[t]?e.on(t,i):Pb(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]}function Pd(e,t){Ji=Ji||Dt(),e=e||{};var i=t instanceof Ji;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 Bb,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&&(ai||(ai=Va().StringDecoder),this.decoder=new ai(e.encoding),this.encoding=e.encoding)}function D(e){if(Ji=Ji||Dt(),!(this instanceof D))return new D(e);this._readableState=new Pd(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),Qa.call(this)}Object.defineProperty(D.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});D.prototype.destroy=Id.destroy;D.prototype._undestroy=Id.undestroy;D.prototype._destroy=function(e,t){this.push(null),t(e)};D.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=Qi.from(e,t),t=""),n=!0),Dd(this,e,t,!1,n)};D.prototype.unshift=function(e){return Dd(this,e,null,!0,!1)};function Dd(e,t,i,n,r){var a=e._readableState;if(t===null)a.reading=!1,Ub(e,a);else{var s;r||(s=Nb(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==Qi.prototype&&(t=jb(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):Za(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?Za(e,a,t,!1):jd(e,a)):Za(e,a,t,!1))):n||(a.reading=!1)}return Hb(a)}function Za(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&&ur(e)),jd(e,t)}function Nb(e,t){var i;return!zb(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(i=new TypeError("Invalid non-string/buffer chunk")),i}function Hb(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}D.prototype.isPaused=function(){return this._readableState.flowing===!1};D.prototype.setEncoding=function(e){return ai||(ai=Va().StringDecoder),this._readableState.decoder=new ai(e),this._readableState.encoding=e,this};var kd=8388608;function $b(e){return e>=kd?e=kd:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Ld(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=$b(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}D.prototype.read=function(e){O("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 O("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?Ja(this):ur(this),null;if(e=Ld(e,t),e===0&&t.ended)return t.length===0&&Ja(this),null;var n=t.needReadable;O("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,O("length less than watermark",n)),t.ended||t.reading?(n=!1,O("reading or ended",n)):n&&(O("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Ld(i,t)));var r;return e>0?r=zd(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&&Ja(this)),r!==null&&this.emit("data",r),r};function Ub(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,ur(e)}}function ur(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?si.nextTick(Rd,e):Rd(e))}function Rd(e){O("emit readable"),e.emit("readable"),es(e)}function jd(e,t){t.readingMore||(t.readingMore=!0,si.nextTick(qb,e,t))}function qb(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(O("maybeReadMore read 0"),e.read(0),i!==t.length);)i=t.length;t.readingMore=!1}D.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};D.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,O("pipe count=%d opts=%j",n.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?o:w;n.endEmitted?si.nextTick(a):i.once("end",a),e.on("unpipe",s);function s(y,m){O("onunpipe"),y===i&&m&&m.hasUnpiped===!1&&(m.hasUnpiped=!0,c())}function o(){O("onend"),e.end()}var d=Gb(i);e.on("drain",d);var l=!1;function c(){O("cleanup"),e.removeListener("close",v),e.removeListener("finish",h),e.removeListener("drain",d),e.removeListener("error",u),e.removeListener("unpipe",s),i.removeListener("end",o),i.removeListener("end",w),i.removeListener("data",p),l=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&d()}var f=!1;i.on("data",p);function p(y){O("ondata"),f=!1;var m=e.write(y);m===!1&&!f&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&Bd(n.pipes,e)!==-1)&&!l&&(O("false write response, pause",n.awaitDrain),n.awaitDrain++,f=!0),i.pause())}function u(y){O("onerror",y),w(),e.removeListener("error",u),Md(e,"error")===0&&e.emit("error",y)}Fb(e,"error",u);function v(){e.removeListener("finish",h),w()}e.once("close",v);function h(){O("onfinish"),e.removeListener("close",v),w()}e.once("finish",h);function w(){O("unpipe"),i.unpipe(e)}return e.emit("pipe",i),n.flowing||(O("pipe resume"),i.resume()),e};function Gb(e){return function(){var t=e._readableState;O("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Md(e,"data")&&(t.flowing=!0,es(e))}}D.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=Bd(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)};D.prototype.on=function(e,t){var i=Qa.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&&ur(this):si.nextTick(Wb,this))}return i};D.prototype.addListener=D.prototype.on;function Wb(e){O("readable nexttick read 0"),e.read(0)}D.prototype.resume=function(){var e=this._readableState;return e.flowing||(O("resume"),e.flowing=!0,Yb(this,e)),this};function Yb(e,t){t.resumeScheduled||(t.resumeScheduled=!0,si.nextTick(Vb,e,t))}function Vb(e,t){t.reading||(O("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),es(e),t.flowing&&!t.reading&&e.read(0)}D.prototype.pause=function(){return O("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(O("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function es(e){var t=e._readableState;for(O("flow",t.flowing);t.flowing&&e.read()!==null;);}D.prototype.wrap=function(e){var t=this,i=this._readableState,n=!1;e.on("end",function(){if(O("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(O("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<Ka.length;a++)e.on(Ka[a],this.emit.bind(this,Ka[a]));return this._read=function(s){O("wrapped _read",s),n&&(n=!1,e.resume())},this};Object.defineProperty(D.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});D._fromList=zd;function zd(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=Xb(e,t.buffer,t.decoder),i}function Xb(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?Kb(e,t):Zb(e,t),n}function Kb(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 Zb(e,t){var i=Qi.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 Ja(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,si.nextTick(Jb,t,e))}function Jb(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Bd(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}});var ts=S((H1,$d)=>{"use strict";$d.exports=et;var pr=Dt(),Hd=Object.create(ii());Hd.inherits=ni();Hd.inherits(et,pr);function Qb(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 et(e){if(!(this instanceof et))return new et(e);pr.call(this,e),this._transformState={afterTransform:Qb.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",ey)}function ey(){var e=this;typeof this._flush=="function"?this._flush(function(t,i){Nd(e,t,i)}):Nd(this,null,null)}et.prototype.push=function(e,t){return this._transformState.needTransform=!1,pr.prototype.push.call(this,e,t)};et.prototype._transform=function(e,t,i){throw new Error("_transform() is not implemented")};et.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)}};et.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};et.prototype._destroy=function(e,t){var i=this;pr.prototype._destroy.call(this,e,function(n){t(n),i.emit("close")})};function Nd(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 Wd=S(($1,Gd)=>{"use strict";Gd.exports=en;var Ud=ts(),qd=Object.create(ii());qd.inherits=ni();qd.inherits(en,Ud);function en(e){if(!(this instanceof en))return new en(e);Ud.call(this,e)}en.prototype._transform=function(e,t,i){i(null,e)}});var is=S((Y,fr)=>{"use strict";var Re=require("stream");process.env.READABLE_STREAM==="disable"&&Re?(fr.exports=Re,Y=fr.exports=Re.Readable,Y.Readable=Re.Readable,Y.Writable=Re.Writable,Y.Duplex=Re.Duplex,Y.Transform=Re.Transform,Y.PassThrough=Re.PassThrough,Y.Stream=Re):(Y=fr.exports=Ga(),Y.Stream=Re||Y,Y.Readable=Y,Y.Writable=$a(),Y.Duplex=Dt(),Y.Transform=ts(),Y.PassThrough=Wd())});var tt=S(ae=>{"use strict";ae.base64=!0;ae.array=!0;ae.string=!0;ae.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined";ae.nodebuffer=typeof Buffer!="undefined";ae.uint8array=typeof Uint8Array!="undefined";if(typeof ArrayBuffer=="undefined")ae.blob=!1;else{ns=new ArrayBuffer(0);try{ae.blob=new Blob([ns],{type:"application/zip"}).size===0}catch{try{Yd=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,rs=new Yd,rs.append(ns),ae.blob=rs.getBlob("application/zip").size===0}catch{ae.blob=!1}}}var ns,Yd,rs;try{ae.nodestream=!!is().Readable}catch{ae.nodestream=!1}});var ss=S(as=>{"use strict";var ty=F(),iy=tt(),Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";as.encode=function(e){for(var t=[],i,n,r,a,s,o,d,l=0,c=e.length,f=c,p=ty.getTypeOf(e)!=="string";l<e.length;)f=c-l,p?(i=e[l++],n=l<c?e[l++]:0,r=l<c?e[l++]:0):(i=e.charCodeAt(l++),n=l<c?e.charCodeAt(l++):0,r=l<c?e.charCodeAt(l++):0),a=i>>2,s=(i&3)<<4|n>>4,o=f>1?(n&15)<<2|r>>6:64,d=f>2?r&63:64,t.push(Me.charAt(a)+Me.charAt(s)+Me.charAt(o)+Me.charAt(d));return t.join("")};as.decode=function(e){var t,i,n,r,a,s,o,d=0,l=0,c="data:";if(e.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var f=e.length*3/4;if(e.charAt(e.length-1)===Me.charAt(64)&&f--,e.charAt(e.length-2)===Me.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var p;for(iy.uint8array?p=new Uint8Array(f|0):p=new Array(f|0);d<e.length;)r=Me.indexOf(e.charAt(d++)),a=Me.indexOf(e.charAt(d++)),s=Me.indexOf(e.charAt(d++)),o=Me.indexOf(e.charAt(d++)),t=r<<2|a>>4,i=(a&15)<<4|s>>2,n=(s&3)<<6|o,p[l++]=t,s!==64&&(p[l++]=i),o!==64&&(p[l++]=n);return p}});var tn=S((G1,Vd)=>{"use strict";Vd.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 Jd=S((W1,Zd)=>{"use strict";var Xd=global.MutationObserver||global.WebKitMutationObserver,oi;process.browser?Xd?(os=0,Kd=new Xd(nn),ls=global.document.createTextNode(""),Kd.observe(ls,{characterData:!0}),oi=function(){ls.data=os=++os%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(cs=new global.MessageChannel,cs.port1.onmessage=nn,oi=function(){cs.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?oi=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){nn(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:oi=function(){setTimeout(nn,0)}:oi=function(){process.nextTick(nn)};var os,Kd,ls,cs,ds,rn=[];function nn(){ds=!0;for(var e,t,i=rn.length;i;){for(t=rn,rn=[],e=-1;++e<i;)t[e]();i=rn.length}ds=!1}Zd.exports=ny;function ny(e){rn.push(e)===1&&!ds&&oi()}});var au=S((Y1,ru)=>{"use strict";var Qd=Jd();function li(){}var Z={},eu=["REJECTED"],us=["FULFILLED"],tu=["PENDING"];process.browser||(an=["UNHANDLED"]);var an;ru.exports=ft;function ft(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=tu,this.queue=[],this.outcome=void 0,process.browser||(this.handled=an),e!==li&&iu(this,e)}ft.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)}};ft.prototype.catch=function(e){return this.then(null,e)};ft.prototype.then=function(e,t){if(typeof e!="function"&&this.state===us||typeof t!="function"&&this.state===eu)return this;var i=new this.constructor(li);if(process.browser||this.handled===an&&(this.handled=null),this.state!==tu){var n=this.state===us?e:t;ps(i,n,this.outcome)}else this.queue.push(new sn(i,e,t));return i};function sn(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)}sn.prototype.callFulfilled=function(e){Z.resolve(this.promise,e)};sn.prototype.otherCallFulfilled=function(e){ps(this.promise,this.onFulfilled,e)};sn.prototype.callRejected=function(e){Z.reject(this.promise,e)};sn.prototype.otherCallRejected=function(e){ps(this.promise,this.onRejected,e)};function ps(e,t,i){Qd(function(){var n;try{n=t(i)}catch(r){return Z.reject(e,r)}n===e?Z.reject(e,new TypeError("Cannot resolve promise with itself")):Z.resolve(e,n)})}Z.resolve=function(e,t){var i=nu(ry,t);if(i.status==="error")return Z.reject(e,i.value);var n=i.value;if(n)iu(e,n);else{e.state=us,e.outcome=t;for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callFulfilled(t)}return e};Z.reject=function(e,t){e.state=eu,e.outcome=t,process.browser||e.handled===an&&Qd(function(){e.handled===an&&process.emit("unhandledRejection",t,e)});for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callRejected(t);return e};function ry(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function iu(e,t){var i=!1;function n(o){i||(i=!0,Z.reject(e,o))}function r(o){i||(i=!0,Z.resolve(e,o))}function a(){t(r,n)}var s=nu(a);s.status==="error"&&n(s.value)}function nu(e,t){var i={};try{i.value=e(t),i.status="success"}catch(n){i.status="error",i.value=n}return i}ft.resolve=ay;function ay(e){return e instanceof this?e:Z.resolve(new this(li),e)}ft.reject=sy;function sy(e){var t=new this(li);return Z.reject(t,e)}ft.all=oy;function oy(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(li);++s<i;)d(e[s],s);return o;function d(l,c){t.resolve(l).then(f,function(p){n||(n=!0,Z.reject(o,p))});function f(p){r[c]=p,++a===i&&!n&&(n=!0,Z.resolve(o,r))}}}ft.race=ly;function ly(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(li);++r<i;)s(e[r]);return a;function s(o){t.resolve(o).then(function(d){n||(n=!0,Z.resolve(a,d))},function(d){n||(n=!0,Z.reject(a,d))})}}});var ci=S((V1,su)=>{"use strict";var fs=null;typeof Promise!="undefined"?fs=Promise:fs=au();su.exports={Promise:fs}});var lu=S(ou=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var i=1,n={},r=!1,a=e.document,s;function o(m){typeof m!="function"&&(m=new Function(""+m));for(var b=new Array(arguments.length-1),g=0;g<b.length;g++)b[g]=arguments[g+1];var x={callback:m,args:b};return n[i]=x,s(i),i++}function d(m){delete n[m]}function l(m){var b=m.callback,g=m.args;switch(g.length){case 0:b();break;case 1:b(g[0]);break;case 2:b(g[0],g[1]);break;case 3:b(g[0],g[1],g[2]);break;default:b.apply(t,g);break}}function c(m){if(r)setTimeout(c,0,m);else{var b=n[m];if(b){r=!0;try{l(b)}finally{d(m),r=!1}}}}function f(){s=function(m){process.nextTick(function(){c(m)})}}function p(){if(e.postMessage&&!e.importScripts){var m=!0,b=e.onmessage;return e.onmessage=function(){m=!1},e.postMessage("","*"),e.onmessage=b,m}}function u(){var m="setImmediate$"+Math.random()+"$",b=function(g){g.source===e&&typeof g.data=="string"&&g.data.indexOf(m)===0&&c(+g.data.slice(m.length))};e.addEventListener?e.addEventListener("message",b,!1):e.attachEvent("onmessage",b),s=function(g){e.postMessage(m+g,"*")}}function v(){var m=new MessageChannel;m.port1.onmessage=function(b){var g=b.data;c(g)},s=function(b){m.port2.postMessage(b)}}function h(){var m=a.documentElement;s=function(b){var g=a.createElement("script");g.onreadystatechange=function(){c(b),g.onreadystatechange=null,m.removeChild(g),g=null},m.appendChild(g)}}function w(){s=function(m){setTimeout(c,0,m)}}var y=Object.getPrototypeOf&&Object.getPrototypeOf(e);y=y&&y.setTimeout?y:e,{}.toString.call(e.process)==="[object process]"?f():p()?u():e.MessageChannel?v():a&&"onreadystatechange"in a.createElement("script")?h():w(),y.setImmediate=o,y.clearImmediate=d})(typeof self=="undefined"?typeof global=="undefined"?ou:global:self)});var F=S(U=>{"use strict";var ht=tt(),cy=ss(),di=tn(),hs=ci();lu();function dy(e){var t=null;return ht.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),gr(e,t)}U.newBlob=function(e,t){U.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 on(e){return e}function gr(e,t){for(var i=0;i<e.length;++i)t[i]=e.charCodeAt(i)&255;return t}var hr={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 ht.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return ht.nodebuffer&&String.fromCharCode.apply(null,di.allocBuffer(1)).length===1}catch{return!1}})()}};function ln(e){var t=65536,i=U.getTypeOf(e),n=!0;if(i==="uint8array"?n=hr.applyCanBeUsed.uint8array:i==="nodebuffer"&&(n=hr.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return hr.stringifyByChunk(e,i,t)}catch{t=Math.floor(t/2)}return hr.stringifyByChar(e)}U.applyFromCharCode=ln;function mr(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}var gt={};gt.string={string:on,array:function(e){return gr(e,new Array(e.length))},arraybuffer:function(e){return gt.string.uint8array(e).buffer},uint8array:function(e){return gr(e,new Uint8Array(e.length))},nodebuffer:function(e){return gr(e,di.allocBuffer(e.length))}};gt.array={string:ln,array:on,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return di.newBufferFrom(e)}};gt.arraybuffer={string:function(e){return ln(new Uint8Array(e))},array:function(e){return mr(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:on,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return di.newBufferFrom(new Uint8Array(e))}};gt.uint8array={string:ln,array:function(e){return mr(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:on,nodebuffer:function(e){return di.newBufferFrom(e)}};gt.nodebuffer={string:ln,array:function(e){return mr(e,new Array(e.length))},arraybuffer:function(e){return gt.nodebuffer.uint8array(e).buffer},uint8array:function(e){return mr(e,new Uint8Array(e.length))},nodebuffer:on};U.transformTo=function(e,t){if(t||(t=""),!e)return t;U.checkSupport(e);var i=U.getTypeOf(t),n=gt[i][e](t);return n};U.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("/")};U.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(ht.nodebuffer&&di.isBuffer(e))return"nodebuffer";if(ht.uint8array&&e instanceof Uint8Array)return"uint8array";if(ht.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};U.checkSupport=function(e){var t=ht[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};U.MAX_VALUE_16BITS=65535;U.MAX_VALUE_32BITS=-1;U.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};U.delay=function(e,t,i){setImmediate(function(){e.apply(i||null,t||[])})};U.inherits=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i};U.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};U.prepareContent=function(e,t,i,n,r){var a=hs.Promise.resolve(t).then(function(s){var o=ht.blob&&(s instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(s))!==-1);return o&&typeof FileReader!="undefined"?new hs.Promise(function(d,l){var c=new FileReader;c.onload=function(f){d(f.target.result)},c.onerror=function(f){l(f.target.error)},c.readAsArrayBuffer(s)}):s});return a.then(function(s){var o=U.getTypeOf(s);return o?(o==="arraybuffer"?s=U.transformTo("uint8array",s):o==="string"&&(r?s=cy.decode(s):i&&n!==!0&&(s=dy(s))),s):hs.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var se=S((Z1,du)=>{"use strict";function cu(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}cu.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}};du.exports=cu});var pi=S(mt=>{"use strict";var ui=F(),jt=tt(),uy=tn(),br=se(),cn=new Array(256);for(it=0;it<256;it++)cn[it]=it>=252?6:it>=248?5:it>=240?4:it>=224?3:it>=192?2:1;var it;cn[254]=cn[254]=1;var py=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(jt.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},fy=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+cn[e[i]]>t?i:t},hy=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=cn[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),ui.applyFromCharCode(s)};mt.utf8encode=function(t){return jt.nodebuffer?uy.newBufferFrom(t,"utf-8"):py(t)};mt.utf8decode=function(t){return jt.nodebuffer?ui.transformTo("nodebuffer",t).toString("utf-8"):(t=ui.transformTo(jt.uint8array?"uint8array":"array",t),hy(t))};function yr(){br.call(this,"utf-8 decode"),this.leftOver=null}ui.inherits(yr,br);yr.prototype.processChunk=function(e){var t=ui.transformTo(jt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(jt.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=fy(t),r=t;n!==t.length&&(jt.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:mt.utf8decode(r),meta:e.meta})};yr.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:mt.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};mt.Utf8DecodeWorker=yr;function gs(){br.call(this,"utf-8 encode")}ui.inherits(gs,br);gs.prototype.processChunk=function(e){this.push({data:mt.utf8encode(e.data),meta:e.meta})};mt.Utf8EncodeWorker=gs});var hu=S((Q1,fu)=>{"use strict";var uu=se(),pu=F();function ms(e){uu.call(this,"ConvertWorker to "+e),this.destType=e}pu.inherits(ms,uu);ms.prototype.processChunk=function(e){this.push({data:pu.transformTo(this.destType,e.data),meta:e.meta})};fu.exports=ms});var bu=S((eE,mu)=>{"use strict";var gu=is().Readable,gy=F();gy.inherits(bs,gu);function bs(e,t,i){gu.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)})}bs.prototype._read=function(){this._helper.resume()};mu.exports=bs});var ys=S((tE,xu)=>{"use strict";var zt=F(),my=hu(),by=se(),yy=ss(),vy=tt(),xy=ci(),yu=null;if(vy.nodestream)try{yu=bu()}catch{}function wy(e,t,i){switch(e){case"blob":return zt.newBlob(zt.transformTo("arraybuffer",t),i);case"base64":return yy.encode(t);default:return zt.transformTo(e,t)}}function _y(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 Ey(e,t){return new xy.Promise(function(i,n){var r=[],a=e._internalType,s=e._outputType,o=e._mimeType;e.on("data",function(d,l){r.push(d),t&&t(l)}).on("error",function(d){r=[],n(d)}).on("end",function(){try{var d=wy(s,_y(a,r),o);i(d)}catch(l){n(l)}r=[]}).resume()})}function vu(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,zt.checkSupport(n),this._worker=e.pipe(new my(n)),e.lock()}catch(r){this._worker=new by("error"),this._worker.error(r)}}vu.prototype={accumulate:function(e){return Ey(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(){zt.delay(t,arguments,i)}),this},resume:function(){return zt.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(zt.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new yu(this,{objectMode:this._outputType!=="nodebuffer"},e)}};xu.exports=vu});var vs=S(_e=>{"use strict";_e.base64=!1;_e.binary=!1;_e.dir=!1;_e.createFolders=!0;_e.date=null;_e.compression=null;_e.compressionOptions=null;_e.comment=null;_e.unixPermissions=null;_e.dosPermissions=null});var xs=S((nE,wu)=>{"use strict";var vr=F(),xr=se(),Sy=16*1024;function fi(e){xr.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=vr.getTypeOf(i),t.isPaused||t._tickAndRepeat()},function(i){t.error(i)})}vr.inherits(fi,xr);fi.prototype.cleanUp=function(){xr.prototype.cleanUp.call(this),this.data=null};fi.prototype.resume=function(){return xr.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,vr.delay(this._tickAndRepeat,[],this)),!0):!1};fi.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(vr.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};fi.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Sy,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}})};wu.exports=fi});var wr=S((rE,Eu)=>{"use strict";var Ay=F();function Cy(){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 _u=Cy();function Ty(e,t,i,n){var r=_u,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 ky(e,t,i,n){var r=_u,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}Eu.exports=function(t,i){if(typeof t=="undefined"||!t.length)return 0;var n=Ay.getTypeOf(t)!=="string";return n?Ty(i|0,t,t.length,0):ky(i|0,t,t.length,0)}});var _s=S((aE,Au)=>{"use strict";var Su=se(),Ly=wr(),Ry=F();function ws(){Su.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Ry.inherits(ws,Su);ws.prototype.processChunk=function(e){this.streamInfo.crc32=Ly(e.data,this.streamInfo.crc32||0),this.push(e)};Au.exports=ws});var Tu=S((sE,Cu)=>{"use strict";var My=F(),Es=se();function Ss(e){Es.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}My.inherits(Ss,Es);Ss.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Es.prototype.processChunk.call(this,e)};Cu.exports=Ss});var _r=S((oE,Ru)=>{"use strict";var ku=ci(),Lu=xs(),Oy=_s(),As=Tu();function Cs(e,t,i,n,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=n,this.compressedContent=r}Cs.prototype={getContentWorker:function(){var e=new Lu(ku.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new As("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 Lu(ku.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Cs.createWorkerFrom=function(e,t,i){return e.pipe(new Oy).pipe(new As("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new As("compressedSize")).withStreamInfo("compression",t)};Ru.exports=Cs});var Pu=S((lE,Iu)=>{"use strict";var Iy=ys(),Py=xs(),Ts=pi(),ks=_r(),Mu=se(),Ls=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}};Ls.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 Ts.Utf8EncodeWorker)),!r&&n&&(t=t.pipe(new Ts.Utf8DecodeWorker))}catch(a){t=new Mu("error"),t.error(a)}return new Iy(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 ks&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new Ts.Utf8EncodeWorker)),ks.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof ks?this._data.getContentWorker():this._data instanceof Mu?this._data:new Py(this._data)}};var Ou=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],Dy=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(Er=0;Er<Ou.length;Er++)Ls.prototype[Ou[Er]]=Dy;var Er;Iu.exports=Ls});var nt=S(J=>{"use strict";var jy=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function zy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}J.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if(typeof i!="object")throw new TypeError(i+"must be non-object");for(var n in i)zy(i,n)&&(e[n]=i[n])}}return e};J.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var By={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}},Fy={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)}};J.setTyped=function(e){e?(J.Buf8=Uint8Array,J.Buf16=Uint16Array,J.Buf32=Int32Array,J.assign(J,By)):(J.Buf8=Array,J.Buf16=Array,J.Buf32=Array,J.assign(J,Fy))};J.setTyped(jy)});var np=S(mi=>{"use strict";var Ny=nt(),Hy=4,Du=0,ju=1,$y=2;function gi(e){for(var t=e.length;--t>=0;)e[t]=0}var Uy=0,$u=1,qy=2,Gy=3,Wy=258,js=29,gn=256,un=gn+1+js,hi=30,zs=19,Uu=2*un+1,Bt=15,Rs=16,Yy=7,Bs=256,qu=16,Gu=17,Wu=18,Ps=[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],Sr=[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],Vy=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Yu=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Xy=512,rt=new Array((un+2)*2);gi(rt);var dn=new Array(hi*2);gi(dn);var pn=new Array(Xy);gi(pn);var fn=new Array(Wy-Gy+1);gi(fn);var Fs=new Array(js);gi(Fs);var Ar=new Array(hi);gi(Ar);function Ms(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 Vu,Xu,Ku;function Os(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Zu(e){return e<256?pn[e]:pn[256+(e>>>7)]}function hn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function ie(e,t,i){e.bi_valid>Rs-i?(e.bi_buf|=t<<e.bi_valid&65535,hn(e,e.bi_buf),e.bi_buf=t>>Rs-e.bi_valid,e.bi_valid+=i-Rs):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Oe(e,t,i){ie(e,i[t*2],i[t*2+1])}function Ju(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function Ky(e){e.bi_valid===16?(hn(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 Zy(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,d=t.stat_desc.max_length,l,c,f,p,u,v,h=0;for(p=0;p<=Bt;p++)e.bl_count[p]=0;for(i[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<Uu;l++)c=e.heap[l],p=i[i[c*2+1]*2+1]+1,p>d&&(p=d,h++),i[c*2+1]=p,!(c>n)&&(e.bl_count[p]++,u=0,c>=o&&(u=s[c-o]),v=i[c*2],e.opt_len+=v*(p+u),a&&(e.static_len+=v*(r[c*2+1]+u)));if(h!==0){do{for(p=d-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[d]--,h-=2}while(h>0);for(p=d;p!==0;p--)for(c=e.bl_count[p];c!==0;)f=e.heap[--l],!(f>n)&&(i[f*2+1]!==p&&(e.opt_len+=(p-i[f*2+1])*i[f*2],i[f*2+1]=p),c--)}}function Qu(e,t,i){var n=new Array(Bt+1),r=0,a,s;for(a=1;a<=Bt;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]=Ju(n[o]++,o))}}function Jy(){var e,t,i,n,r,a=new Array(Bt+1);for(i=0,n=0;n<js-1;n++)for(Fs[n]=i,e=0;e<1<<Ps[n];e++)fn[i++]=n;for(fn[i-1]=n,r=0,n=0;n<16;n++)for(Ar[n]=r,e=0;e<1<<Sr[n];e++)pn[r++]=n;for(r>>=7;n<hi;n++)for(Ar[n]=r<<7,e=0;e<1<<Sr[n]-7;e++)pn[256+r++]=n;for(t=0;t<=Bt;t++)a[t]=0;for(e=0;e<=143;)rt[e*2+1]=8,e++,a[8]++;for(;e<=255;)rt[e*2+1]=9,e++,a[9]++;for(;e<=279;)rt[e*2+1]=7,e++,a[7]++;for(;e<=287;)rt[e*2+1]=8,e++,a[8]++;for(Qu(rt,un+1,a),e=0;e<hi;e++)dn[e*2+1]=5,dn[e*2]=Ju(e,5);Vu=new Ms(rt,Ps,gn+1,un,Bt),Xu=new Ms(dn,Sr,0,hi,Bt),Ku=new Ms(new Array(0),Vy,0,zs,Yy)}function ep(e){var t;for(t=0;t<un;t++)e.dyn_ltree[t*2]=0;for(t=0;t<hi;t++)e.dyn_dtree[t*2]=0;for(t=0;t<zs;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Bs*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function tp(e){e.bi_valid>8?hn(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 Qy(e,t,i,n){tp(e),n&&(hn(e,i),hn(e,~i)),Ny.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function zu(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 Is(e,t,i){for(var n=e.heap[i],r=i<<1;r<=e.heap_len&&(r<e.heap_len&&zu(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!zu(t,n,e.heap[r],e.depth));)e.heap[i]=e.heap[r],i=r,r<<=1;e.heap[i]=n}function Bu(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?Oe(e,r,t):(s=fn[r],Oe(e,s+gn+1,t),o=Ps[s],o!==0&&(r-=Fs[s],ie(e,r,o)),n--,s=Zu(n),Oe(e,s,i),o=Sr[s],o!==0&&(n-=Ar[s],ie(e,n,o)));while(a<e.last_lit);Oe(e,Bs,t)}function Ds(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,d=-1,l;for(e.heap_len=0,e.heap_max=Uu,s=0;s<a;s++)i[s*2]!==0?(e.heap[++e.heap_len]=d=s,e.depth[s]=0):i[s*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=d<2?++d:0,i[l*2]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=n[l*2+1]);for(t.max_code=d,s=e.heap_len>>1;s>=1;s--)Is(e,i,s);l=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Is(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,i[l*2]=i[s*2]+i[o*2],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,i[s*2+1]=i[o*2+1]=l,e.heap[1]=l++,Is(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Zy(e,t),Qu(i,d,e.bl_count)}function Fu(e,t,i){var n,r=-1,a,s=t[1],o=0,d=7,l=4;for(s===0&&(d=138,l=3),t[(i+1)*2+1]=65535,n=0;n<=i;n++)a=s,s=t[(n+1)*2+1],!(++o<d&&a===s)&&(o<l?e.bl_tree[a*2]+=o:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[qu*2]++):o<=10?e.bl_tree[Gu*2]++:e.bl_tree[Wu*2]++,o=0,r=a,s===0?(d=138,l=3):a===s?(d=6,l=3):(d=7,l=4))}function Nu(e,t,i){var n,r=-1,a,s=t[1],o=0,d=7,l=4;for(s===0&&(d=138,l=3),n=0;n<=i;n++)if(a=s,s=t[(n+1)*2+1],!(++o<d&&a===s)){if(o<l)do Oe(e,a,e.bl_tree);while(--o!==0);else a!==0?(a!==r&&(Oe(e,a,e.bl_tree),o--),Oe(e,qu,e.bl_tree),ie(e,o-3,2)):o<=10?(Oe(e,Gu,e.bl_tree),ie(e,o-3,3)):(Oe(e,Wu,e.bl_tree),ie(e,o-11,7));o=0,r=a,s===0?(d=138,l=3):a===s?(d=6,l=3):(d=7,l=4)}}function ev(e){var t;for(Fu(e,e.dyn_ltree,e.l_desc.max_code),Fu(e,e.dyn_dtree,e.d_desc.max_code),Ds(e,e.bl_desc),t=zs-1;t>=3&&e.bl_tree[Yu[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function tv(e,t,i,n){var r;for(ie(e,t-257,5),ie(e,i-1,5),ie(e,n-4,4),r=0;r<n;r++)ie(e,e.bl_tree[Yu[r]*2+1],3);Nu(e,e.dyn_ltree,t-1),Nu(e,e.dyn_dtree,i-1)}function iv(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return Du;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return ju;for(i=32;i<gn;i++)if(e.dyn_ltree[i*2]!==0)return ju;return Du}var Hu=!1;function nv(e){Hu||(Jy(),Hu=!0),e.l_desc=new Os(e.dyn_ltree,Vu),e.d_desc=new Os(e.dyn_dtree,Xu),e.bl_desc=new Os(e.bl_tree,Ku),e.bi_buf=0,e.bi_valid=0,ep(e)}function ip(e,t,i,n){ie(e,(Uy<<1)+(n?1:0),3),Qy(e,t,i,!0)}function rv(e){ie(e,$u<<1,3),Oe(e,Bs,rt),Ky(e)}function av(e,t,i,n){var r,a,s=0;e.level>0?(e.strm.data_type===$y&&(e.strm.data_type=iv(e)),Ds(e,e.l_desc),Ds(e,e.d_desc),s=ev(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?ip(e,t,i,n):e.strategy===Hy||a===r?(ie(e,($u<<1)+(n?1:0),3),Bu(e,rt,dn)):(ie(e,(qy<<1)+(n?1:0),3),tv(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Bu(e,e.dyn_ltree,e.dyn_dtree)),ep(e),n&&tp(e)}function sv(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[(fn[i]+gn+1)*2]++,e.dyn_dtree[Zu(t)*2]++),e.last_lit===e.lit_bufsize-1}mi._tr_init=nv;mi._tr_stored_block=ip;mi._tr_flush_block=av;mi._tr_tally=sv;mi._tr_align=rv});var Ns=S((uE,rp)=>{"use strict";function ov(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}rp.exports=ov});var Hs=S((pE,ap)=>{"use strict";function lv(){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 cv=lv();function dv(e,t,i,n){var r=cv,a=n+i;e^=-1;for(var s=n;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}ap.exports=dv});var Cr=S((fE,sp)=>{"use strict";sp.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 gp=S(De=>{"use strict";var Q=nt(),me=np(),dp=Ns(),bt=Hs(),uv=Cr(),$t=0,pv=1,fv=3,_t=4,op=5,Pe=0,lp=1,be=-2,hv=-3,$s=-5,gv=-1,mv=1,Tr=2,bv=3,yv=4,vv=0,xv=2,Mr=8,wv=9,_v=15,Ev=8,Sv=29,Av=256,qs=Av+1+Sv,Cv=30,Tv=19,kv=2*qs+1,Lv=15,R=3,xt=258,Ee=xt+R+1,Rv=32,Or=42,Gs=69,kr=73,Lr=91,Rr=103,Ft=113,bn=666,W=1,yn=2,Nt=3,vi=4,Mv=3;function wt(e,t){return e.msg=uv[t],t}function cp(e){return(e<<1)-(e>4?9:0)}function vt(e){for(var t=e.length;--t>=0;)e[t]=0}function yt(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(Q.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 V(e,t){me._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,yt(e.strm)}function M(e,t){e.pending_buf[e.pending++]=t}function mn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Ov(e,t,i,n){var r=e.avail_in;return r>n&&(r=n),r===0?0:(e.avail_in-=r,Q.arraySet(t,e.input,e.next_in,r,i),e.state.wrap===1?e.adler=dp(e.adler,t,r,i):e.state.wrap===2&&(e.adler=bt(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function up(e,t){var i=e.max_chain_length,n=e.strstart,r,a,s=e.prev_length,o=e.nice_match,d=e.strstart>e.w_size-Ee?e.strstart-(e.w_size-Ee):0,l=e.window,c=e.w_mask,f=e.prev,p=e.strstart+xt,u=l[n+s-1],v=l[n+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(r=t,!(l[r+s]!==v||l[r+s-1]!==u||l[r]!==l[n]||l[++r]!==l[n+1])){n+=2,r++;do;while(l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&n<p);if(a=xt-(p-n),n=p-xt,a>s){if(e.match_start=t,s=a,a>=o)break;u=l[n+s-1],v=l[n+s]}}while((t=f[t&c])>d&&--i!==0);return s<=e.lookahead?s:e.lookahead}function Ht(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-Ee)){Q.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=Ov(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=R)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+R-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<R)););}while(e.lookahead<Ee&&e.strm.avail_in!==0)}function Iv(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Ht(e),e.lookahead===0&&t===$t)return W;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,V(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Ee&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=0,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):(e.strstart>e.block_start&&(V(e,!1),e.strm.avail_out===0),W)}function Us(e,t){for(var i,n;;){if(e.lookahead<Ee){if(Ht(e),e.lookahead<Ee&&t===$t)return W;if(e.lookahead===0)break}if(i=0,e.lookahead>=R&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-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-Ee&&(e.match_length=up(e,i)),e.match_length>=R)if(n=me._tr_tally(e,e.strstart-e.match_start,e.match_length-R),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=R){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-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=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=e.strstart<R-1?e.strstart:R-1,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yn}function bi(e,t){for(var i,n,r;;){if(e.lookahead<Ee){if(Ht(e),e.lookahead<Ee&&t===$t)return W;if(e.lookahead===0)break}if(i=0,e.lookahead>=R&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-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=R-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Ee&&(e.match_length=up(e,i),e.match_length<=5&&(e.strategy===mv||e.match_length===R&&e.strstart-e.match_start>4096)&&(e.match_length=R-1)),e.prev_length>=R&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-R,n=me._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-R),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+R-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=R-1,e.strstart++,n&&(V(e,!1),e.strm.avail_out===0))return W}else if(e.match_available){if(n=me._tr_tally(e,0,e.window[e.strstart-1]),n&&V(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return W}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=me._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<R-1?e.strstart:R-1,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yn}function Pv(e,t){for(var i,n,r,a,s=e.window;;){if(e.lookahead<=xt){if(Ht(e),e.lookahead<=xt&&t===$t)return W;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=R&&e.strstart>0&&(r=e.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){a=e.strstart+xt;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=xt-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=R?(i=me._tr_tally(e,1,e.match_length-R),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=0,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yn}function Dv(e,t){for(var i;;){if(e.lookahead===0&&(Ht(e),e.lookahead===0)){if(t===$t)return W;break}if(e.match_length=0,i=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(V(e,!1),e.strm.avail_out===0))return W}return e.insert=0,t===_t?(V(e,!0),e.strm.avail_out===0?Nt:vi):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yn}function Ie(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 yi;yi=[new Ie(0,0,0,0,Iv),new Ie(4,4,8,4,Us),new Ie(4,5,16,8,Us),new Ie(4,6,32,32,Us),new Ie(4,4,16,16,bi),new Ie(8,16,32,32,bi),new Ie(8,16,128,128,bi),new Ie(8,32,128,256,bi),new Ie(32,128,258,1024,bi),new Ie(32,258,258,4096,bi)];function jv(e){e.window_size=2*e.w_size,vt(e.head),e.max_lazy_match=yi[e.level].max_lazy,e.good_match=yi[e.level].good_length,e.nice_match=yi[e.level].nice_length,e.max_chain_length=yi[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=R-1,e.match_available=0,e.ins_h=0}function zv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Mr,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 Q.Buf16(kv*2),this.dyn_dtree=new Q.Buf16((2*Cv+1)*2),this.bl_tree=new Q.Buf16((2*Tv+1)*2),vt(this.dyn_ltree),vt(this.dyn_dtree),vt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Q.Buf16(Lv+1),this.heap=new Q.Buf16(2*qs+1),vt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Q.Buf16(2*qs+1),vt(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 pp(e){var t;return!e||!e.state?wt(e,be):(e.total_in=e.total_out=0,e.data_type=xv,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Or:Ft,e.adler=t.wrap===2?0:1,t.last_flush=$t,me._tr_init(t),Pe)}function fp(e){var t=pp(e);return t===Pe&&jv(e.state),t}function Bv(e,t){return!e||!e.state||e.state.wrap!==2?be:(e.state.gzhead=t,Pe)}function hp(e,t,i,n,r,a){if(!e)return be;var s=1;if(t===gv&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>wv||i!==Mr||n<8||n>15||t<0||t>9||a<0||a>yv)return wt(e,be);n===8&&(n=9);var o=new zv;return e.state=o,o.strm=e,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+R-1)/R),o.window=new Q.Buf8(o.w_size*2),o.head=new Q.Buf16(o.hash_size),o.prev=new Q.Buf16(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Q.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,fp(e)}function Fv(e,t){return hp(e,t,Mr,_v,Ev,vv)}function Nv(e,t){var i,n,r,a;if(!e||!e.state||t>op||t<0)return e?wt(e,be):be;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===bn&&t!==_t)return wt(e,e.avail_out===0?$s:be);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===Or)if(n.wrap===2)e.adler=0,M(n,31),M(n,139),M(n,8),n.gzhead?(M(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)),M(n,n.gzhead.time&255),M(n,n.gzhead.time>>8&255),M(n,n.gzhead.time>>16&255),M(n,n.gzhead.time>>24&255),M(n,n.level===9?2:n.strategy>=Tr||n.level<2?4:0),M(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(M(n,n.gzhead.extra.length&255),M(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=bt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Gs):(M(n,0),M(n,0),M(n,0),M(n,0),M(n,0),M(n,n.level===9?2:n.strategy>=Tr||n.level<2?4:0),M(n,Mv),n.status=Ft);else{var s=Mr+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=Tr||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=Rv),s+=31-s%31,n.status=Ft,mn(n,s),n.strstart!==0&&(mn(n,e.adler>>>16),mn(n,e.adler&65535)),e.adler=1}if(n.status===Gs)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=bt(e.adler,n.pending_buf,n.pending-r,r)),yt(e),r=n.pending,n.pending===n.pending_buf_size));)M(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=kr)}else n.status=kr;if(n.status===kr)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),yt(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,M(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.gzindex=0,n.status=Lr)}else n.status=Lr;if(n.status===Lr)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),yt(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,M(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>r&&(e.adler=bt(e.adler,n.pending_buf,n.pending-r,r)),a===0&&(n.status=Rr)}else n.status=Rr;if(n.status===Rr&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&yt(e),n.pending+2<=n.pending_buf_size&&(M(n,e.adler&255),M(n,e.adler>>8&255),e.adler=0,n.status=Ft)):n.status=Ft),n.pending!==0){if(yt(e),e.avail_out===0)return n.last_flush=-1,Pe}else if(e.avail_in===0&&cp(t)<=cp(i)&&t!==_t)return wt(e,$s);if(n.status===bn&&e.avail_in!==0)return wt(e,$s);if(e.avail_in!==0||n.lookahead!==0||t!==$t&&n.status!==bn){var d=n.strategy===Tr?Dv(n,t):n.strategy===bv?Pv(n,t):yi[n.level].func(n,t);if((d===Nt||d===vi)&&(n.status=bn),d===W||d===Nt)return e.avail_out===0&&(n.last_flush=-1),Pe;if(d===yn&&(t===pv?me._tr_align(n):t!==op&&(me._tr_stored_block(n,0,0,!1),t===fv&&(vt(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),yt(e),e.avail_out===0))return n.last_flush=-1,Pe}return t!==_t?Pe:n.wrap<=0?lp:(n.wrap===2?(M(n,e.adler&255),M(n,e.adler>>8&255),M(n,e.adler>>16&255),M(n,e.adler>>24&255),M(n,e.total_in&255),M(n,e.total_in>>8&255),M(n,e.total_in>>16&255),M(n,e.total_in>>24&255)):(mn(n,e.adler>>>16),mn(n,e.adler&65535)),yt(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Pe:lp)}function Hv(e){var t;return!e||!e.state?be:(t=e.state.status,t!==Or&&t!==Gs&&t!==kr&&t!==Lr&&t!==Rr&&t!==Ft&&t!==bn?wt(e,be):(e.state=null,t===Ft?wt(e,hv):Pe))}function $v(e,t){var i=t.length,n,r,a,s,o,d,l,c;if(!e||!e.state||(n=e.state,s=n.wrap,s===2||s===1&&n.status!==Or||n.lookahead))return be;for(s===1&&(e.adler=dp(e.adler,t,i,0)),n.wrap=0,i>=n.w_size&&(s===0&&(vt(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new Q.Buf8(n.w_size),Q.arraySet(c,t,i-n.w_size,n.w_size,0),t=c,i=n.w_size),o=e.avail_in,d=e.next_in,l=e.input,e.avail_in=i,e.next_in=0,e.input=t,Ht(n);n.lookahead>=R;){r=n.strstart,a=n.lookahead-(R-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+R-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=R-1,Ht(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=R-1,n.match_available=0,e.next_in=d,e.input=l,e.avail_in=o,n.wrap=s,Pe}De.deflateInit=Fv;De.deflateInit2=hp;De.deflateReset=fp;De.deflateResetKeep=pp;De.deflateSetHeader=Bv;De.deflate=Nv;De.deflateEnd=Hv;De.deflateSetDictionary=$v;De.deflateInfo="pako deflate (from Nodeca project)"});var Ws=S(xi=>{"use strict";var Ir=nt(),mp=!0,bp=!0;try{String.fromCharCode.apply(null,[0])}catch{mp=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{bp=!1}var vn=new Ir.Buf8(256);for(at=0;at<256;at++)vn[at]=at>=252?6:at>=248?5:at>=240?4:at>=224?3:at>=192?2:1;var at;vn[254]=vn[254]=1;xi.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 Ir.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 yp(e,t){if(t<65534&&(e.subarray&&bp||!e.subarray&&mp))return String.fromCharCode.apply(null,Ir.shrinkBuf(e,t));for(var i="",n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i}xi.buf2binstring=function(e){return yp(e,e.length)};xi.binstring2buf=function(e){for(var t=new Ir.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t};xi.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=vn[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 yp(o,n)};xi.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+vn[e[i]]>t?i:t}});var Ys=S((mE,vp)=>{"use strict";function Uv(){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}vp.exports=Uv});var Ep=S(_n=>{"use strict";var xn=gp(),wn=nt(),Xs=Ws(),Ks=Cr(),qv=Ys(),_p=Object.prototype.toString,Gv=0,Vs=4,wi=0,xp=1,wp=2,Wv=-1,Yv=0,Vv=8;function Ut(e){if(!(this instanceof Ut))return new Ut(e);this.options=wn.assign({level:Wv,method:Vv,chunkSize:16384,windowBits:15,memLevel:8,strategy:Yv,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 qv,this.strm.avail_out=0;var i=xn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==wi)throw new Error(Ks[i]);if(t.header&&xn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=Xs.string2buf(t.dictionary):_p.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,i=xn.deflateSetDictionary(this.strm,n),i!==wi)throw new Error(Ks[i]);this._dict_set=!0}}Ut.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?Vs:Gv,typeof e=="string"?i.input=Xs.string2buf(e):_p.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new wn.Buf8(n),i.next_out=0,i.avail_out=n),r=xn.deflate(i,a),r!==xp&&r!==wi)return this.onEnd(r),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(a===Vs||a===wp))&&(this.options.to==="string"?this.onData(Xs.buf2binstring(wn.shrinkBuf(i.output,i.next_out))):this.onData(wn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&r!==xp);return a===Vs?(r=xn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===wi):(a===wp&&(this.onEnd(wi),i.avail_out=0),!0)};Ut.prototype.onData=function(e){this.chunks.push(e)};Ut.prototype.onEnd=function(e){e===wi&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=wn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Zs(e,t){var i=new Ut(t);if(i.push(e,!0),i.err)throw i.msg||Ks[i.err];return i.result}function Xv(e,t){return t=t||{},t.raw=!0,Zs(e,t)}function Kv(e,t){return t=t||{},t.gzip=!0,Zs(e,t)}_n.Deflate=Ut;_n.deflate=Zs;_n.deflateRaw=Xv;_n.gzip=Kv});var Ap=S((yE,Sp)=>{"use strict";var Pr=30,Zv=12;Sp.exports=function(t,i){var n,r,a,s,o,d,l,c,f,p,u,v,h,w,y,m,b,g,x,E,A,C,T,L,_;n=t.state,r=t.next_in,L=t.input,a=r+(t.avail_in-5),s=t.next_out,_=t.output,o=s-(i-t.avail_out),d=s+(t.avail_out-257),l=n.dmax,c=n.wsize,f=n.whave,p=n.wnext,u=n.window,v=n.hold,h=n.bits,w=n.lencode,y=n.distcode,m=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{h<15&&(v+=L[r++]<<h,h+=8,v+=L[r++]<<h,h+=8),g=w[v&m];t:for(;;){if(x=g>>>24,v>>>=x,h-=x,x=g>>>16&255,x===0)_[s++]=g&65535;else if(x&16){E=g&65535,x&=15,x&&(h<x&&(v+=L[r++]<<h,h+=8),E+=v&(1<<x)-1,v>>>=x,h-=x),h<15&&(v+=L[r++]<<h,h+=8,v+=L[r++]<<h,h+=8),g=y[v&b];i:for(;;){if(x=g>>>24,v>>>=x,h-=x,x=g>>>16&255,x&16){if(A=g&65535,x&=15,h<x&&(v+=L[r++]<<h,h+=8,h<x&&(v+=L[r++]<<h,h+=8)),A+=v&(1<<x)-1,A>l){t.msg="invalid distance too far back",n.mode=Pr;break e}if(v>>>=x,h-=x,x=s-o,A>x){if(x=A-x,x>f&&n.sane){t.msg="invalid distance too far back",n.mode=Pr;break e}if(C=0,T=u,p===0){if(C+=c-x,x<E){E-=x;do _[s++]=u[C++];while(--x);C=s-A,T=_}}else if(p<x){if(C+=c+p-x,x-=p,x<E){E-=x;do _[s++]=u[C++];while(--x);if(C=0,p<E){x=p,E-=x;do _[s++]=u[C++];while(--x);C=s-A,T=_}}}else if(C+=p-x,x<E){E-=x;do _[s++]=u[C++];while(--x);C=s-A,T=_}for(;E>2;)_[s++]=T[C++],_[s++]=T[C++],_[s++]=T[C++],E-=3;E&&(_[s++]=T[C++],E>1&&(_[s++]=T[C++]))}else{C=s-A;do _[s++]=_[C++],_[s++]=_[C++],_[s++]=_[C++],E-=3;while(E>2);E&&(_[s++]=_[C++],E>1&&(_[s++]=_[C++]))}}else if((x&64)===0){g=y[(g&65535)+(v&(1<<x)-1)];continue i}else{t.msg="invalid distance code",n.mode=Pr;break e}break}}else if((x&64)===0){g=w[(g&65535)+(v&(1<<x)-1)];continue t}else if(x&32){n.mode=Zv;break e}else{t.msg="invalid literal/length code",n.mode=Pr;break e}break}}while(r<a&&s<d);E=h>>3,r-=E,h-=E<<3,v&=(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<d?257+(d-s):257-(s-d),n.hold=v,n.bits=h}});var Op=S((vE,Mp)=>{"use strict";var Cp=nt(),_i=15,Tp=852,kp=592,Lp=0,Js=1,Rp=2,Jv=[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],Qv=[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],ex=[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],tx=[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];Mp.exports=function(t,i,n,r,a,s,o,d){var l=d.bits,c=0,f=0,p=0,u=0,v=0,h=0,w=0,y=0,m=0,b=0,g,x,E,A,C,T=null,L=0,_,I=new Cp.Buf16(_i+1),z=new Cp.Buf16(_i+1),le=null,te=0,ne,xe,Ne;for(c=0;c<=_i;c++)I[c]=0;for(f=0;f<r;f++)I[i[n+f]]++;for(v=l,u=_i;u>=1&&I[u]===0;u--);if(v>u&&(v=u),u===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,d.bits=1,0;for(p=1;p<u&&I[p]===0;p++);for(v<p&&(v=p),y=1,c=1;c<=_i;c++)if(y<<=1,y-=I[c],y<0)return-1;if(y>0&&(t===Lp||u!==1))return-1;for(z[1]=0,c=1;c<_i;c++)z[c+1]=z[c]+I[c];for(f=0;f<r;f++)i[n+f]!==0&&(o[z[i[n+f]]++]=f);if(t===Lp?(T=le=o,_=19):t===Js?(T=Jv,L-=257,le=Qv,te-=257,_=256):(T=ex,le=tx,_=-1),b=0,f=0,c=p,C=s,h=v,w=0,E=-1,m=1<<v,A=m-1,t===Js&&m>Tp||t===Rp&&m>kp)return 1;for(;;){ne=c-w,o[f]<_?(xe=0,Ne=o[f]):o[f]>_?(xe=le[te+o[f]],Ne=T[L+o[f]]):(xe=96,Ne=0),g=1<<c-w,x=1<<h,p=x;do x-=g,a[C+(b>>w)+x]=ne<<24|xe<<16|Ne|0;while(x!==0);for(g=1<<c-1;b&g;)g>>=1;if(g!==0?(b&=g-1,b+=g):b=0,f++,--I[c]===0){if(c===u)break;c=i[n+o[f]]}if(c>v&&(b&A)!==E){for(w===0&&(w=v),C+=p,h=c-w,y=1<<h;h+w<u&&(y-=I[h+w],!(y<=0));)h++,y<<=1;if(m+=1<<h,t===Js&&m>Tp||t===Rp&&m>kp)return 1;E=b&A,a[E]=v<<24|h<<16|C-s|0}}return b!==0&&(a[C+b]=c-w<<24|64<<16|0),d.bits=v,0}});var hf=S(Se=>{"use strict";var oe=nt(),ro=Ns(),je=Hs(),ix=Ap(),En=Op(),nx=0,af=1,sf=2,Ip=4,rx=5,Dr=6,qt=0,ax=1,sx=2,ye=-2,of=-3,ao=-4,ox=-5,Pp=8,lf=1,Dp=2,jp=3,zp=4,Bp=5,Fp=6,Np=7,Hp=8,$p=9,Up=10,Br=11,st=12,Qs=13,qp=14,eo=15,Gp=16,Wp=17,Yp=18,Vp=19,jr=20,zr=21,Xp=22,Kp=23,Zp=24,Jp=25,Qp=26,to=27,ef=28,tf=29,j=30,so=31,lx=32,cx=852,dx=592,ux=15,px=ux;function nf(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function fx(){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 oe.Buf16(320),this.work=new oe.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function cf(e){var t;return!e||!e.state?ye:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=lf,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new oe.Buf32(cx),t.distcode=t.distdyn=new oe.Buf32(dx),t.sane=1,t.back=-1,qt)}function df(e){var t;return!e||!e.state?ye:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,cf(e))}function uf(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))?ye:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,df(e))}function pf(e,t){var i,n;return e?(n=new fx,e.state=n,n.window=null,i=uf(e,t),i!==qt&&(e.state=null),i):ye}function hx(e){return pf(e,px)}var rf=!0,io,no;function gx(e){if(rf){var t;for(io=new oe.Buf32(512),no=new oe.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(En(af,e.lens,0,288,io,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;En(sf,e.lens,0,32,no,0,e.work,{bits:5}),rf=!1}e.lencode=io,e.lenbits=9,e.distcode=no,e.distbits=5}function ff(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 oe.Buf8(a.wsize)),n>=a.wsize?(oe.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),oe.arraySet(a.window,t,i-n,r,a.wnext),n-=r,n?(oe.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 mx(e,t){var i,n,r,a,s,o,d,l,c,f,p,u,v,h,w=0,y,m,b,g,x,E,A,C,T=new oe.Buf8(4),L,_,I=[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 ye;i=e.state,i.mode===st&&(i.mode=Qs),s=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,l=i.hold,c=i.bits,f=o,p=d,C=qt;e:for(;;)switch(i.mode){case lf:if(i.wrap===0){i.mode=Qs;break}for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(i.wrap&2&&l===35615){i.check=0,T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0),l=0,c=0,i.mode=Dp;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",i.mode=j;break}if((l&15)!==Pp){e.msg="unknown compression method",i.mode=j;break}if(l>>>=4,c-=4,A=(l&15)+8,i.wbits===0)i.wbits=A;else if(A>i.wbits){e.msg="invalid window size",i.mode=j;break}i.dmax=1<<A,e.adler=i.check=1,i.mode=l&512?Up:st,l=0,c=0;break;case Dp:for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(i.flags=l,(i.flags&255)!==Pp){e.msg="unknown compression method",i.mode=j;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=j;break}i.head&&(i.head.text=l>>8&1),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0)),l=0,c=0,i.mode=jp;case jp:for(;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.head&&(i.head.time=l),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,i.check=je(i.check,T,4,0)),l=0,c=0,i.mode=zp;case zp:for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.head&&(i.head.xflags=l&255,i.head.os=l>>8),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0)),l=0,c=0,i.mode=Bp;case Bp:if(i.flags&1024){for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.length=l,i.head&&(i.head.extra_len=l),i.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,i.check=je(i.check,T,2,0)),l=0,c=0}else i.head&&(i.head.extra=null);i.mode=Fp;case Fp:if(i.flags&1024&&(u=i.length,u>o&&(u=o),u&&(i.head&&(A=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),oe.arraySet(i.head.extra,n,a,u,A)),i.flags&512&&(i.check=je(i.check,n,u,a)),o-=u,a+=u,i.length-=u),i.length))break e;i.length=0,i.mode=Np;case Np:if(i.flags&2048){if(o===0)break e;u=0;do A=n[a+u++],i.head&&A&&i.length<65536&&(i.head.name+=String.fromCharCode(A));while(A&&u<o);if(i.flags&512&&(i.check=je(i.check,n,u,a)),o-=u,a+=u,A)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=Hp;case Hp:if(i.flags&4096){if(o===0)break e;u=0;do A=n[a+u++],i.head&&A&&i.length<65536&&(i.head.comment+=String.fromCharCode(A));while(A&&u<o);if(i.flags&512&&(i.check=je(i.check,n,u,a)),o-=u,a+=u,A)break e}else i.head&&(i.head.comment=null);i.mode=$p;case $p:if(i.flags&512){for(;c<16;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(l!==(i.check&65535)){e.msg="header crc mismatch",i.mode=j;break}l=0,c=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=st;break;case Up:for(;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}e.adler=i.check=nf(l),l=0,c=0,i.mode=Br;case Br:if(i.havedict===0)return e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,i.hold=l,i.bits=c,sx;e.adler=i.check=1,i.mode=st;case st:if(t===rx||t===Dr)break e;case Qs:if(i.last){l>>>=c&7,c-=c&7,i.mode=to;break}for(;c<3;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}switch(i.last=l&1,l>>>=1,c-=1,l&3){case 0:i.mode=qp;break;case 1:if(gx(i),i.mode=jr,t===Dr){l>>>=2,c-=2;break e}break;case 2:i.mode=Wp;break;case 3:e.msg="invalid block type",i.mode=j}l>>>=2,c-=2;break;case qp:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",i.mode=j;break}if(i.length=l&65535,l=0,c=0,i.mode=eo,t===Dr)break e;case eo:i.mode=Gp;case Gp:if(u=i.length,u){if(u>o&&(u=o),u>d&&(u=d),u===0)break e;oe.arraySet(r,n,a,u,s),o-=u,a+=u,d-=u,s+=u,i.length-=u;break}i.mode=st;break;case Wp:for(;c<14;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(i.nlen=(l&31)+257,l>>>=5,c-=5,i.ndist=(l&31)+1,l>>>=5,c-=5,i.ncode=(l&15)+4,l>>>=4,c-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=j;break}i.have=0,i.mode=Yp;case Yp:for(;i.have<i.ncode;){for(;c<3;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.lens[I[i.have++]]=l&7,l>>>=3,c-=3}for(;i.have<19;)i.lens[I[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,L={bits:i.lenbits},C=En(nx,i.lens,0,19,i.lencode,0,i.work,L),i.lenbits=L.bits,C){e.msg="invalid code lengths set",i.mode=j;break}i.have=0,i.mode=Vp;case Vp:for(;i.have<i.nlen+i.ndist;){for(;w=i.lencode[l&(1<<i.lenbits)-1],y=w>>>24,m=w>>>16&255,b=w&65535,!(y<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(b<16)l>>>=y,c-=y,i.lens[i.have++]=b;else{if(b===16){for(_=y+2;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(l>>>=y,c-=y,i.have===0){e.msg="invalid bit length repeat",i.mode=j;break}A=i.lens[i.have-1],u=3+(l&3),l>>>=2,c-=2}else if(b===17){for(_=y+3;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=y,c-=y,A=0,u=3+(l&7),l>>>=3,c-=3}else{for(_=y+7;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=y,c-=y,A=0,u=11+(l&127),l>>>=7,c-=7}if(i.have+u>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=j;break}for(;u--;)i.lens[i.have++]=A}}if(i.mode===j)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=j;break}if(i.lenbits=9,L={bits:i.lenbits},C=En(af,i.lens,0,i.nlen,i.lencode,0,i.work,L),i.lenbits=L.bits,C){e.msg="invalid literal/lengths set",i.mode=j;break}if(i.distbits=6,i.distcode=i.distdyn,L={bits:i.distbits},C=En(sf,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,L),i.distbits=L.bits,C){e.msg="invalid distances set",i.mode=j;break}if(i.mode=jr,t===Dr)break e;case jr:i.mode=zr;case zr:if(o>=6&&d>=258){e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,i.hold=l,i.bits=c,ix(e,p),s=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,n=e.input,o=e.avail_in,l=i.hold,c=i.bits,i.mode===st&&(i.back=-1);break}for(i.back=0;w=i.lencode[l&(1<<i.lenbits)-1],y=w>>>24,m=w>>>16&255,b=w&65535,!(y<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(m&&(m&240)===0){for(g=y,x=m,E=b;w=i.lencode[E+((l&(1<<g+x)-1)>>g)],y=w>>>24,m=w>>>16&255,b=w&65535,!(g+y<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=g,c-=g,i.back+=g}if(l>>>=y,c-=y,i.back+=y,i.length=b,m===0){i.mode=Qp;break}if(m&32){i.back=-1,i.mode=st;break}if(m&64){e.msg="invalid literal/length code",i.mode=j;break}i.extra=m&15,i.mode=Xp;case Xp:if(i.extra){for(_=i.extra;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=Kp;case Kp:for(;w=i.distcode[l&(1<<i.distbits)-1],y=w>>>24,m=w>>>16&255,b=w&65535,!(y<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if((m&240)===0){for(g=y,x=m,E=b;w=i.distcode[E+((l&(1<<g+x)-1)>>g)],y=w>>>24,m=w>>>16&255,b=w&65535,!(g+y<=c);){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}l>>>=g,c-=g,i.back+=g}if(l>>>=y,c-=y,i.back+=y,m&64){e.msg="invalid distance code",i.mode=j;break}i.offset=b,i.extra=m&15,i.mode=Zp;case Zp:if(i.extra){for(_=i.extra;c<_;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=j;break}i.mode=Jp;case Jp:if(d===0)break e;if(u=p-d,i.offset>u){if(u=i.offset-u,u>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=j;break}u>i.wnext?(u-=i.wnext,v=i.wsize-u):v=i.wnext-u,u>i.length&&(u=i.length),h=i.window}else h=r,v=s-i.offset,u=i.length;u>d&&(u=d),d-=u,i.length-=u;do r[s++]=h[v++];while(--u);i.length===0&&(i.mode=zr);break;case Qp:if(d===0)break e;r[s++]=i.length,d--,i.mode=zr;break;case to:if(i.wrap){for(;c<32;){if(o===0)break e;o--,l|=n[a++]<<c,c+=8}if(p-=d,e.total_out+=p,i.total+=p,p&&(e.adler=i.check=i.flags?je(i.check,r,p,s-p):ro(i.check,r,p,s-p)),p=d,(i.flags?l:nf(l))!==i.check){e.msg="incorrect data check",i.mode=j;break}l=0,c=0}i.mode=ef;case ef:if(i.wrap&&i.flags){for(;c<32;){if(o===0)break e;o--,l+=n[a++]<<c,c+=8}if(l!==(i.total&4294967295)){e.msg="incorrect length check",i.mode=j;break}l=0,c=0}i.mode=tf;case tf:C=ax;break e;case j:C=of;break e;case so:return ao;case lx:default:return ye}return e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,i.hold=l,i.bits=c,(i.wsize||p!==e.avail_out&&i.mode<j&&(i.mode<to||t!==Ip))&&ff(e,e.output,e.next_out,p-e.avail_out)?(i.mode=so,ao):(f-=e.avail_in,p-=e.avail_out,e.total_in+=f,e.total_out+=p,i.total+=p,i.wrap&&p&&(e.adler=i.check=i.flags?je(i.check,r,p,e.next_out-p):ro(i.check,r,p,e.next_out-p)),e.data_type=i.bits+(i.last?64:0)+(i.mode===st?128:0)+(i.mode===jr||i.mode===eo?256:0),(f===0&&p===0||t===Ip)&&C===qt&&(C=ox),C)}function bx(e){if(!e||!e.state)return ye;var t=e.state;return t.window&&(t.window=null),e.state=null,qt}function yx(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?ye:(i.head=t,t.done=!1,qt)}function vx(e,t){var i=t.length,n,r,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Br)?ye:n.mode===Br&&(r=1,r=ro(r,t,i,0),r!==n.check)?of:(a=ff(e,t,i,i),a?(n.mode=so,ao):(n.havedict=1,qt))}Se.inflateReset=df;Se.inflateReset2=uf;Se.inflateResetKeep=cf;Se.inflateInit=hx;Se.inflateInit2=pf;Se.inflate=mx;Se.inflateEnd=bx;Se.inflateGetHeader=yx;Se.inflateSetDictionary=vx;Se.inflateInfo="pako inflate (from Nodeca project)"});var oo=S((wE,gf)=>{"use strict";gf.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 bf=S((_E,mf)=>{"use strict";function xx(){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}mf.exports=xx});var vf=S(An=>{"use strict";var Ei=hf(),Sn=nt(),Fr=Ws(),H=oo(),lo=Cr(),wx=Ys(),_x=bf(),yf=Object.prototype.toString;function Gt(e){if(!(this instanceof Gt))return new Gt(e);this.options=Sn.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 wx,this.strm.avail_out=0;var i=Ei.inflateInit2(this.strm,t.windowBits);if(i!==H.Z_OK)throw new Error(lo[i]);if(this.header=new _x,Ei.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Fr.string2buf(t.dictionary):yf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Ei.inflateSetDictionary(this.strm,t.dictionary),i!==H.Z_OK)))throw new Error(lo[i])}Gt.prototype.push=function(e,t){var i=this.strm,n=this.options.chunkSize,r=this.options.dictionary,a,s,o,d,l,c=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?H.Z_FINISH:H.Z_NO_FLUSH,typeof e=="string"?i.input=Fr.binstring2buf(e):yf.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 Sn.Buf8(n),i.next_out=0,i.avail_out=n),a=Ei.inflate(i,H.Z_NO_FLUSH),a===H.Z_NEED_DICT&&r&&(a=Ei.inflateSetDictionary(this.strm,r)),a===H.Z_BUF_ERROR&&c===!0&&(a=H.Z_OK,c=!1),a!==H.Z_STREAM_END&&a!==H.Z_OK)return this.onEnd(a),this.ended=!0,!1;i.next_out&&(i.avail_out===0||a===H.Z_STREAM_END||i.avail_in===0&&(s===H.Z_FINISH||s===H.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Fr.utf8border(i.output,i.next_out),d=i.next_out-o,l=Fr.buf2string(i.output,o),i.next_out=d,i.avail_out=n-d,d&&Sn.arraySet(i.output,i.output,o,d,0),this.onData(l)):this.onData(Sn.shrinkBuf(i.output,i.next_out))),i.avail_in===0&&i.avail_out===0&&(c=!0)}while((i.avail_in>0||i.avail_out===0)&&a!==H.Z_STREAM_END);return a===H.Z_STREAM_END&&(s=H.Z_FINISH),s===H.Z_FINISH?(a=Ei.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===H.Z_OK):(s===H.Z_SYNC_FLUSH&&(this.onEnd(H.Z_OK),i.avail_out=0),!0)};Gt.prototype.onData=function(e){this.chunks.push(e)};Gt.prototype.onEnd=function(e){e===H.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Sn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function co(e,t){var i=new Gt(t);if(i.push(e,!0),i.err)throw i.msg||lo[i.err];return i.result}function Ex(e,t){return t=t||{},t.raw=!0,co(e,t)}An.Inflate=Gt;An.inflate=co;An.inflateRaw=Ex;An.ungzip=co});var _f=S((SE,wf)=>{"use strict";var Sx=nt().assign,Ax=Ep(),Cx=vf(),Tx=oo(),xf={};Sx(xf,Ax,Cx,Tx);wf.exports=xf});var Sf=S(Hr=>{"use strict";var kx=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",Lx=_f(),Ef=F(),Nr=se(),Rx=kx?"uint8array":"array";Hr.magic="\b\0";function Wt(e,t){Nr.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}Ef.inherits(Wt,Nr);Wt.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Ef.transformTo(Rx,e.data),!1)};Wt.prototype.flush=function(){Nr.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};Wt.prototype.cleanUp=function(){Nr.prototype.cleanUp.call(this),this._pako=null};Wt.prototype._createPako=function(){this._pako=new Lx[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Hr.compressWorker=function(e){return new Wt("Deflate",e)};Hr.uncompressWorker=function(){return new Wt("Inflate",{})}});var po=S(uo=>{"use strict";var Af=se();uo.STORE={magic:"\0\0",compressWorker:function(){return new Af("STORE compression")},uncompressWorker:function(){return new Af("STORE decompression")}};uo.DEFLATE=Sf()});var fo=S(Yt=>{"use strict";Yt.LOCAL_FILE_HEADER="PK";Yt.CENTRAL_FILE_HEADER="PK";Yt.CENTRAL_DIRECTORY_END="PK";Yt.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";Yt.ZIP64_CENTRAL_DIRECTORY_END="PK";Yt.DATA_DESCRIPTOR="PK\x07\b"});var Lf=S((kE,kf)=>{"use strict";var Si=F(),Ai=se(),ho=pi(),Cf=wr(),$r=fo(),P=function(e,t){var i="",n;for(n=0;n<t;n++)i+=String.fromCharCode(e&255),e=e>>>8;return i},Mx=function(e,t){var i=e;return e||(i=t?16893:33204),(i&65535)<<16},Ox=function(e){return(e||0)&63},Tf=function(e,t,i,n,r,a){var s=e.file,o=e.compression,d=a!==ho.utf8encode,l=Si.transformTo("string",a(s.name)),c=Si.transformTo("string",ho.utf8encode(s.name)),f=s.comment,p=Si.transformTo("string",a(f)),u=Si.transformTo("string",ho.utf8encode(f)),v=c.length!==s.name.length,h=u.length!==f.length,w,y,m="",b="",g="",x=s.dir,E=s.date,A={crc32:0,compressedSize:0,uncompressedSize:0};(!t||i)&&(A.crc32=e.crc32,A.compressedSize=e.compressedSize,A.uncompressedSize=e.uncompressedSize);var C=0;t&&(C|=8),!d&&(v||h)&&(C|=2048);var T=0,L=0;x&&(T|=16),r==="UNIX"?(L=798,T|=Mx(s.unixPermissions,x)):(L=20,T|=Ox(s.dosPermissions,x)),w=E.getUTCHours(),w=w<<6,w=w|E.getUTCMinutes(),w=w<<5,w=w|E.getUTCSeconds()/2,y=E.getUTCFullYear()-1980,y=y<<4,y=y|E.getUTCMonth()+1,y=y<<5,y=y|E.getUTCDate(),v&&(b=P(1,1)+P(Cf(l),4)+c,m+="up"+P(b.length,2)+b),h&&(g=P(1,1)+P(Cf(p),4)+u,m+="uc"+P(g.length,2)+g);var _="";_+=`
2
+ \0`,_+=P(C,2),_+=o.magic,_+=P(w,2),_+=P(y,2),_+=P(A.crc32,4),_+=P(A.compressedSize,4),_+=P(A.uncompressedSize,4),_+=P(l.length,2),_+=P(m.length,2);var I=$r.LOCAL_FILE_HEADER+_+l+m,z=$r.CENTRAL_FILE_HEADER+P(L,2)+_+P(p.length,2)+"\0\0\0\0"+P(T,4)+P(n,4)+l+m+p;return{fileRecord:I,dirRecord:z}},Ix=function(e,t,i,n,r){var a="",s=Si.transformTo("string",r(n));return a=$r.CENTRAL_DIRECTORY_END+"\0\0\0\0"+P(e,2)+P(e,2)+P(t,4)+P(i,4)+P(s.length,2)+s,a},Px=function(e){var t="";return t=$r.DATA_DESCRIPTOR+P(e.crc32,4)+P(e.compressedSize,4)+P(e.uncompressedSize,4),t};function Ae(e,t,i,n){Ai.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=[]}Si.inherits(Ae,Ai);Ae.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,Ai.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-n-1))/i:100}}))};Ae.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=Tf(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Ae.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=Tf(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:Px(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};Ae.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=Ix(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};Ae.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};Ae.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};Ae.prototype.resume=function(){if(!Ai.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};Ae.prototype.error=function(e){var t=this._sources;if(!Ai.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch{}return!0};Ae.prototype.lock=function(){Ai.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};kf.exports=Ae});var Mf=S(Rf=>{"use strict";var Dx=po(),jx=Lf(),zx=function(e,t){var i=e||t,n=Dx[i];if(!n)throw new Error(i+" is not a valid compression method !");return n};Rf.generateWorker=function(e,t,i){var n=new jx(t.streamFiles,i,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,s){r++;var o=zx(s.options.compression,t.compression),d=s.options.compressionOptions||t.compressionOptions||{},l=s.dir,c=s.date;s._compressWorker(o,d).withStreamInfo("file",{name:a,dir:l,date:c,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(n)}),n.entriesCount=r}catch(a){n.error(a)}return n}});var If=S((RE,Of)=>{"use strict";var Bx=F(),Ur=se();function Cn(e,t){Ur.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Bx.inherits(Cn,Ur);Cn.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()})};Cn.prototype.pause=function(){return Ur.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Cn.prototype.resume=function(){return Ur.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Of.exports=Cn});var Uf=S((ME,$f)=>{"use strict";var Fx=pi(),Tn=F(),zf=se(),Nx=ys(),Bf=vs(),Pf=_r(),Hx=Pu(),$x=Mf(),Df=tn(),Ux=If(),Ff=function(e,t,i){var n=Tn.getTypeOf(t),r,a=Tn.extend(i||{},Bf);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=Nf(e)),a.createFolders&&(r=qx(e))&&Hf.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 Pf&&t.uncompressedSize===0;(o||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var d=null;t instanceof Pf||t instanceof zf?d=t:Df.isNode&&Df.isStream(t)?d=new Ux(e,t):d=Tn.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var l=new Hx(e,d,a);this.files[e]=l},qx=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},Nf=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},Hf=function(e,t){return t=typeof t!="undefined"?t:Bf.createFolders,e=Nf(e),this.files[e]||Ff.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function jf(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var Gx={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(jf(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,Ff.call(this,e,t,i);return this},folder:function(e){if(!e)return this;if(jf(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,i=Hf.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=Tn.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Fx.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.");Tn.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=$x.generateWorker(this,i,n)}catch(r){t=new zf("error"),t.error(r)}return new Nx(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)}};$f.exports=Gx});var go=S((OE,Gf)=>{"use strict";var Wx=F();function qf(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}qf.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 Wx.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))}};Gf.exports=qf});var mo=S((IE,Yf)=>{"use strict";var Wf=go(),Yx=F();function Ci(e){Wf.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}Yx.inherits(Ci,Wf);Ci.prototype.byteAt=function(e){return this.data[this.zero+e]};Ci.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};Ci.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]};Ci.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};Yf.exports=Ci});var Kf=S((PE,Xf)=>{"use strict";var Vf=go(),Vx=F();function Ti(e){Vf.call(this,e)}Vx.inherits(Ti,Vf);Ti.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};Ti.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};Ti.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};Ti.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};Xf.exports=Ti});var yo=S((DE,Jf)=>{"use strict";var Zf=mo(),Xx=F();function bo(e){Zf.call(this,e)}Xx.inherits(bo,Zf);bo.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};Jf.exports=bo});var th=S((jE,eh)=>{"use strict";var Qf=yo(),Kx=F();function vo(e){Qf.call(this,e)}Kx.inherits(vo,Qf);vo.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};eh.exports=vo});var xo=S((zE,nh)=>{"use strict";var qr=F(),ih=tt(),Zx=mo(),Jx=Kf(),Qx=th(),ew=yo();nh.exports=function(e){var t=qr.getTypeOf(e);return qr.checkSupport(t),t==="string"&&!ih.uint8array?new Jx(e):t==="nodebuffer"?new Qx(e):ih.uint8array?new ew(qr.transformTo("uint8array",e)):new Zx(qr.transformTo("array",e))}});var oh=S((BE,sh)=>{"use strict";var wo=xo(),Et=F(),tw=_r(),rh=wr(),Gr=pi(),Wr=po(),iw=tt(),nw=0,rw=3,aw=function(e){for(var t in Wr)if(Object.prototype.hasOwnProperty.call(Wr,t)&&Wr[t].magic===e)return Wr[t];return null};function ah(e,t){this.options=e,this.loadOptions=t}ah.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=aw(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+Et.pretty(this.compressionMethod)+" unknown (inner file : "+Et.transformTo("string",this.fileName)+")");this.decompressed=new tw(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===nw&&(this.dosPermissions=this.externalFileAttributes&63),e===rw&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=wo(this.extraFields[1].value);this.uncompressedSize===Et.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Et.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Et.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Et.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=iw.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Gr.utf8decode(this.fileName),this.fileCommentStr=Gr.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var i=Et.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var r=Et.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=wo(e.value);return t.readInt(1)!==1||rh(this.fileName)!==t.readInt(4)?null:Gr.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=wo(e.value);return t.readInt(1)!==1||rh(this.fileComment)!==t.readInt(4)?null:Gr.utf8decode(t.readData(e.length-5))}return null}};sh.exports=ah});var dh=S((FE,ch)=>{"use strict";var sw=xo(),ot=F(),Ce=fo(),ow=oh(),lw=tt();function lh(e){this.files=[],this.loadOptions=e}lh.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 ("+ot.pretty(t)+", expected "+ot.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=lw.uint8array?"uint8array":"array",i=ot.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(Ce.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(Ce.CENTRAL_FILE_HEADER);)e=new ow({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(Ce.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,Ce.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(Ce.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===ot.MAX_VALUE_16BITS||this.diskWithCentralDirStart===ot.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===ot.MAX_VALUE_16BITS||this.centralDirRecords===ot.MAX_VALUE_16BITS||this.centralDirSize===ot.MAX_VALUE_32BITS||this.centralDirOffset===ot.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(Ce.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(Ce.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,Ce.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(Ce.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(Ce.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,Ce.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=sw(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};ch.exports=lh});var fh=S((NE,ph)=>{"use strict";var _o=F(),Yr=ci(),cw=pi(),dw=dh(),uw=_s(),uh=tn();function pw(e){return new Yr.Promise(function(t,i){var n=e.decompressed.getContentWorker().pipe(new uw);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()})}ph.exports=function(e,t){var i=this;return t=_o.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:cw.utf8decode}),uh.isNode&&uh.isStream(e)?Yr.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):_o.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var r=new dw(t);return r.load(n),r}).then(function(r){var a=[Yr.Promise.resolve(r)],s=r.files;if(t.checkCRC32)for(var o=0;o<s.length;o++)a.push(pw(s[o]));return Yr.Promise.all(a)}).then(function(r){for(var a=r.shift(),s=a.files,o=0;o<s.length;o++){var d=s[o],l=d.fileNameStr,c=_o.resolve(d.fileNameStr);i.file(c,d.decompressed,{binary:!0,optimizedBinaryString:!0,date:d.date,dir:d.dir,comment:d.fileCommentStr.length?d.fileCommentStr:null,unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions,createFolders:t.createFolders}),d.dir||(i.file(c).unsafeOriginalName=l)}return a.zipComment.length&&(i.comment=a.zipComment),i})}});var gh=S((HE,hh)=>{"use strict";function ve(){if(!(this instanceof ve))return new ve;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 ve;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}ve.prototype=Uf();ve.prototype.loadAsync=fh();ve.support=tt();ve.defaults=vs();ve.version="3.10.1";ve.loadAsync=function(e,t){return new ve().loadAsync(e,t)};ve.external=ci();hh.exports=ve});var wh={};hc(wh,{AssetEditorModal:()=>Lo});var Lo,Ro=qe(()=>{"use strict";Lo=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 l=o.target.dataset.tab;l&&this.switchTab(l)})});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 D0={};fc(D0,{AspectClass:()=>Ho,GameObject:()=>Dn,GameObjectManager:()=>ta,Renderer:()=>Pn,ResponsiveUISystem:()=>ji,Transform:()=>In,animateHandClick:()=>Ih,animatePanelEntrance:()=>Oh,createBrushTexture:()=>Nh,createEndGamePanel:()=>Mh,createHandTutorial:()=>Ph,createThreeBase:()=>kh,createTutorialLabel:()=>Dh,getAspectClass:()=>ea,getRegisteredFontIds:()=>Rh,loadAsset:()=>qo,loadCharacterFrames:()=>Fh,registerFont:()=>Lh,resolveFont:()=>Be,resolveFontWeight:()=>Fe,updateHandAnimation:()=>jh});module.exports=Ig(D0);var Te=Ge(require("three"),1);var dt={};function Un(e,t,i=!1){dt[e]||(dt[e]=[]),dt[e].push({fn:t,once:i})}function ha(e,t){if(dt[e]){if(!t){delete dt[e];return}dt[e]=dt[e].filter(i=>i.fn!==t)}}function qn(e,...t){let i=dt[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ha(e,n.fn)}function fe(e,t){Un(e,t,!0)}var q=null,we=[],Zt=null;function bc(e){q=e,we=[],Zt!==null&&(clearTimeout(Zt),Zt=null)}function yc(){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 gc(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 ga(e,t){let i=yc();if(t&&i.endpoint){if(we.push(e),we.length>i.maxQueue&&(we=we.slice(we.length-i.maxQueue)),we.length>=i.batchSize){mc();return}Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,mc()},i.flushIntervalMs))}}async function mc(){let e=yc();if(!e.endpoint||we.length===0)return;let t=we.splice(0,e.batchSize);await gc(e.endpoint,{events:t},e.transport,e.debug),we.length>0&&await gc(e.endpoint,{events:we.splice(0,e.batchSize)},e.transport,e.debug)}var he=0,Pg=he++,vc=he++,xc=he++,wc=he++,_c=he++,Ec=he++,Sc=he++,Ac=he++,Cc=he++,Tc=he++,kc=he++,Lc=he++,N=Pg;function Rc(){return N===vc}function Mc(){return N===xc}function Oc(){return N===wc}function Ic(){return N===_c}function Jt(){return N===Ec}function Qt(){return N===Sc}function Pc(){return N===Ac}function Dc(){return N===Cc}function jc(){return N===Tc}function ma(){return N===kc}function ba(){return N===Lc}function zc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),N=vc;return}catch{}else if(e==="dapi")try{dapi.isReady(),N=xc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=wc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(N=_c)}catch{}else if(t==="mintegral")window.gameReady&&(N=Ec);else if(t==="tapjoy")window.TJ_API&&(N=Sc);else if(t==="tiktok")window.openAppStore&&(N=Ac);else if(t==="smadex")try{window.smxTracking&&(N=Cc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(N=Tc)}catch{}else t==="vungle"?N=kc:(e==="nucleo"||t==="nucleo")&&(N=Lc)}var Gn=Ge(require("lottie-web"),1),Bc=Gn.default;typeof window!="undefined"&&(window.lottie=Gn.default,window.__baseLottie=Gn.default);var Dg=require("pixi.js");var ya=require("pixi.js");var jg=null;function va(e){jg=e}Wn();xa();var Ni=require("pixi.js");Wn();var $g=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Sa=$g;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&&(Sa=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Sa}`))}}catch{}var Mt=class{static async create(t,i,n){var d,l,c,f,u,p,v;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${Sa}`);let r=(d=i==null?void 0:i.render)==null?void 0:d.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new Ni.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(l=i==null?void 0:i.identity)==null?void 0:l.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Rt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new Ni.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.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:",(u=s==null?void 0:s.constructor)==null?void 0:u.name,s),s&&(((p=s.constructor)==null?void 0:p.name)==="Container"||s instanceof Ni.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}`],x=!1;for(let m of h)try{let y=await fetch(m);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",m,"type:",(v=o==null?void 0:o.constructor)==null?void 0:v.name),x=!0;break}}catch{continue}x||(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 Hi=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 Gg=Ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Gg);$i();var Vn=require("pixi.js");$i();var Ca=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Hi}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 d=await Mt.create(a,s,this.app);this.instanceCache.set(a,d),console.log("[Assets] Loaded object:",a,(o=d==null?void 0:d.constructor)==null?void 0:o.name)}catch(d){console.error("[Assets] Failed to load object:",a,d)}})))};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)}},Yg=new Ca,Vg=new Proxy(Yg,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});$i();var $c=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},Kn={scale:1,position:1},ka=[];function Zg(e,t,i,n,r,a,s){ka.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function Jg(){ka.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function Ta(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),Kn.scale=Xe.scaleFactor,Kn.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Kn.scale.toFixed(3)}`),Jg()}var qi={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 Qg(e,t,i){let n=qi[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function em(){return qi}var tm={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 Xn(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Zn(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:Xn(e[0],t.x),y:Xn(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:Xn(n.x,t.x),y:Xn(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=tm[n])!=null?i:t}return t}function Uc(e,t,i,n={}){var p,v,h,x,m,y;let r=Zn(i),a=(p=n.inset)!=null?p:{},s=(v=n.padding)!=null?v:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,d=((x=a.right)!=null?x:0)+s.x,l=((m=a.top)!=null?m:0)+s.y,c=((y=a.bottom)!=null?y:0)+s.y,f=Math.max(0,e-o-d),u=Math.max(0,t-l-c);return{x:o+f*r.x,y:l+u*r.y}}function qc(e,t,i,n={}){var h,x,m,y,b,g;let r=(h=n.inset)!=null?h:{},a=(x=n.padding)!=null?x:{x:0,y:0},s=((m=r.left)!=null?m:0)+a.x,o=((y=r.right)!=null?y:0)+a.x,d=((b=r.top)!=null?b:0)+a.y,l=((g=r.bottom)!=null?g:0)+a.y,c=Math.max(0,e-s-o),f=Math.max(0,t-d-l),u=Zn(i,{x:.5,y:.5}),p=Math.min(Math.max(u.x,0),1),v=Math.min(Math.max(u.y,0),1);return{x:s+c*p,y:d+f*v}}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,Ta(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Ta(window.innerWidth,window.innerHeight),window.updateDebugConfig=Qg,window.getDebugConfig=em,window.copyConfig=pm,window.applyConfig=Ui,window.applyConfigForRatio=fm,window.positionAtBottom=Gc,window.positionAtTop=rm,window.positionAtCenter=am,window.positionAtLeft=sm,window.positionAtRight=om,window.positionAtBottomLeft=lm,window.positionAtBottomRight=cm,window.positionAtTopLeft=dm,window.positionAtTopRight=um,window.applyPositionContract=nm,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 Jn(e,t,i=0){return e*t+i}function Qn(e,t,i=0){return e*(1-t)+i}function er(e,t,i=0){return e*t+i}function tr(e,t,i=0){return e*(1-t)+i}function ge(e,t=0){return e/2+t}function im(e,t){return e*t}function nm(e,t,i,n){var s,o,d,l,c,f,u,p,v,h,x,m,y,b,g,w,C,S,A,T;let r=0,a=0;switch(n.type){case"top":r=ge(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=Jn(i,n.percent,(l=(d=n.offset)==null?void 0:d.y)!=null?l:0);break;case"bottom":r=ge(t,(f=(c=n.offset)==null?void 0:c.x)!=null?f:0),a=Qn(i,n.percent,(p=(u=n.offset)==null?void 0:u.y)!=null?p:0);break;case"left":r=er(t,n.percent,(h=(v=n.offset)==null?void 0:v.x)!=null?h:0),a=ge(i,(m=(x=n.offset)==null?void 0:x.y)!=null?m:0);break;case"right":r=tr(t,n.percent,(b=(y=n.offset)==null?void 0:y.x)!=null?b:0),a=ge(i,(w=(g=n.offset)==null?void 0:g.y)!=null?w:0);break;case"center":r=ge(t,(S=(C=n.offset)==null?void 0:C.x)!=null?S:0),a=ge(i,(T=(A=n.offset)==null?void 0:A.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function Gc(e,t,i,n=.2,r=1,a=!0,s=!1){let o=im(i,n),d=Qn(i,n/2);Ke(e,ge(t),d);let l=a?r*Xe.scaleFactor:r;Ze(e,l),s&&!ka.find(c=>c.element===e)&&Zg(e,Gc,t,i,n,r,a)}function rm(e,t,i,n=.1,r=1){Ke(e,ge(t),Jn(i,n)),Ze(e,r)}function am(e,t,i,n=0,r=0,a=1){Ke(e,ge(t,n),ge(i,r)),Ze(e,a)}function sm(e,t,i,n=.1,r=1){Ke(e,er(t,n),ge(i)),Ze(e,r)}function om(e,t,i,n=.1,r=1){Ke(e,tr(t,n),ge(i)),Ze(e,r)}function lm(e,t,i,n=.05,r=.05,a=1){Ke(e,er(t,r),Qn(i,n)),Ze(e,a)}function cm(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),Qn(i,n)),Ze(e,a)}function dm(e,t,i,n=.05,r=.05,a=1){Ke(e,er(t,r),Jn(i,n)),Ze(e,a)}function um(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),Jn(i,n)),Ze(e,a)}function Ke(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 Ze(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 Ot={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function pm(e){return e&&Ot[e]?JSON.parse(JSON.stringify(Ot[e])):JSON.parse(JSON.stringify(qi))}function Ui(e){Object.keys(e).forEach(t=>{let i=t;qi[i]&&e[i]&&Object.assign(qi[i],e[i])}),console.log("Config applied:",e)}function fm(e,t){let i=e/t;i>1.6?(Ui(Ot.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(Ui(Ot.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(Ui(Ot.square),console.log("Applied SQUARE config for ratio:",i)):(Ui(Ot.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Ot,e.resolveAnchorVec2=e.resolveAnchorVec2||Zn,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Uc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||qc}Ma();function G(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var E_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],S_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],A_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],Xc=[{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:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var C_=[...Xc];var wm=Xc[0];pt();var s0=Ge(lh(),1);function n0(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 r0(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 a0(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 _o(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 n0(r),s=await a0(a),o=r0(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 Yr(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,u)=>{let p=new Image;p.onload=()=>f(p),p.onerror=()=>u(new Error("Failed to load image")),p.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,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let u=s[f],p=s[f+1],v=s[f+2],h=!1;for(let x of d)if(Math.sqrt(Math.pow(u-x.r,2)+Math.pow(p-x.g,2)+Math.pow(v-x.b,2))<t){h=!0;break}h&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} 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}}var ch=require("@google/genai");async function Eo(e,t,i=[],n={}){var r,a,s,o,d,l,c;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 m=0;m<i.length;m++){let y=i[m];if(!y.base64||!y.mimeType)throw new Error(`Image ${m+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${m+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${m+1} has invalid MIME type: ${y.mimeType}`)}let f=new ch.GoogleGenAI({apiKey:e}),u="gemini-2.5-flash",p=[t];i.length>0&&i.forEach((m,y)=>{p.push({inlineData:{data:m.base64,mimeType:m.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${m.mimeType}, size: ${Math.round(m.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:u,contents:p}),h="",x=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(x)for(let m of x)m.text&&(h+=m.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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."):(d=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var dh=require("@google/genai");async function Vr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new dh.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),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 d=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}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}}var o0=require("pixi.js");$i();pt();var ph=require("pixi.js");var l0=require("pixi.js");pt();function g0(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 m0(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"}}function b0(e){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 l=o.target.dataset.tab;l&&this.switchTab(l)})});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 Gw={};hc(Gw,{AspectClass:()=>$o,GameObject:()=>jn,GameObjectManager:()=>ia,Renderer:()=>Dn,ResponsiveUISystem:()=>ji,Transform:()=>Pn,animateHandClick:()=>Nh,animatePanelEntrance:()=>Fh,createBrushTexture:()=>Yh,createEndGamePanel:()=>Bh,createHandTutorial:()=>Hh,createThreeBase:()=>Dh,createTutorialLabel:()=>$h,getAspectClass:()=>ta,getRegisteredFontIds:()=>zh,loadAsset:()=>Go,loadCharacterFrames:()=>Wh,registerFont:()=>jh,resolveFont:()=>Be,resolveFontWeight:()=>Fe,updateHandAnimation:()=>Uh});module.exports=Ng(Gw);var Te=Ge(require("three"),1);var dt={};function qn(e,t,i=!1){dt[e]||(dt[e]=[]),dt[e].push({fn:t,once:i})}function ga(e,t){if(dt[e]){if(!t){delete dt[e];return}dt[e]=dt[e].filter(i=>i.fn!==t)}}function Gn(e,...t){let i=dt[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ga(e,n.fn)}function fe(e,t){qn(e,t,!0)}var q=null,we=[],Zt=null;function yc(e){q=e,we=[],Zt!==null&&(clearTimeout(Zt),Zt=null)}function vc(){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 mc(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 ma(e,t){let i=vc();if(t&&i.endpoint){if(we.push(e),we.length>i.maxQueue&&(we=we.slice(we.length-i.maxQueue)),we.length>=i.batchSize){bc();return}Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,bc()},i.flushIntervalMs))}}async function bc(){let e=vc();if(!e.endpoint||we.length===0)return;let t=we.splice(0,e.batchSize);await mc(e.endpoint,{events:t},e.transport,e.debug),we.length>0&&await mc(e.endpoint,{events:we.splice(0,e.batchSize)},e.transport,e.debug)}function xc(e){return Math.max(0,Math.min(1,e))}function Hg(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function Ni(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function $g(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function wc(e,t,i){try{e[t]=i}catch{}}function Ug(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function _c(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Ec(e,t){let i=Ug(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function Sc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=c=>{var p;e.add(c);let f=(p=t.get(c.target))!=null?p:new Set;f.add(c),t.set(c.target,f),n()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,p;let c=Ni();for(let u of Array.from(e)){if(u.killed||u.paused)continue;let v=c-u.startMs-u.delayMs;if(v<0)continue;let h=u.durationMs>0?v/u.durationMs:1,w=xc(h),y=u.repeat>=0?u.repeat+1:1,m=u.repeat>0?Math.min(Math.floor(h),y-1):0;if(u.repeat>0&&h>=1){let x=h-m;w=xc(x)}let b=u.ease(w);u.yoyo&&m%2===1&&(b=1-b);for(let x of u.props)wc(u.target,x.key,x.from+(x.to-x.from)*b);u.scaleFrom&&u.scaleTo&&_c(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*b,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*b});try{(f=u.onUpdate)==null||f.call(u)}catch{}if(h>=y){s(u);try{(p=u.onComplete)==null||p.call(u)}catch{}}}},d=(c,f,p)=>{var x;let u=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),h=Hg(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,y=f.yoyo===!0,m=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),b=[];for(let E of Object.keys(f)){if(m.has(E))continue;let A=f[E];typeof A=="number"&&b.push({key:E,from:$g(c,E),to:A})}let g=Ec(c,f);return{target:c,startMs:Ni(),delayMs:v,durationMs:u,ease:h,props:b,scaleFrom:g.from,scaleTo:g.to,repeat:w,yoyo:y,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let p=d(c,f);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ni())},resume:()=>{var h;if(!p.paused)return;let u=(h=p.pauseAtMs)!=null?h:Ni(),v=Ni()-u;p.startMs+=v,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(c,f,p){return l.set(c,f),l.to(c,p)},set(c,f){if(!c||!f)return;for(let u of Object.keys(f)){let v=f[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof v=="number"&&wc(c,u,v)}let p=Ec(c,f);p.to&&_c(c,p.to)},killTweensOf(c){let f=t.get(c);if(f)for(let p of Array.from(f))s(p)},timeline(c={}){let f=[],p=0,u=!1,v=[],h=m=>{if(typeof m=="number")return Math.max(0,m*1e3);let b=typeof m=="string"?m.trim():"";return b.startsWith("+=")?p+Math.max(0,Number(b.slice(2))*1e3||0):b?Math.max(0,Number(b)*1e3||0):p},w=m=>{f.push(m);let b=Math.max(0,(typeof m.vars.duration=="number"?m.vars.duration:.5)*1e3);p=Math.max(p,m.atMs+b)},y={to(m,b,g){return w({kind:"to",target:m,vars:b,atMs:h(g)}),y},fromTo(m,b,g,x){return w({kind:"fromTo",target:m,vars:g,from:b,atMs:h(x)}),y},play(){var m,b;if(u)return y;u=!0,v=[];for(let g of f)g.kind==="fromTo"&&l.set(g.target,(m=g.from)!=null?m:{}),v.push(l.to(g.target,{...g.vars,delay:g.atMs/1e3+((b=g.vars.delay)!=null?b:0)}));return y},pause(){for(let m of v)m.pause();return y},kill(){for(let m of v)m.kill();v=[],u=!1}};return c.paused||y.play(),y}};return l}function Ac(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=Sc()}catch{}}var he=0,qg=he++,Cc=he++,Tc=he++,kc=he++,Lc=he++,Rc=he++,Mc=he++,Oc=he++,Ic=he++,Pc=he++,Dc=he++,jc=he++,N=qg;function zc(){return N===Cc}function Bc(){return N===Tc}function Fc(){return N===kc}function Nc(){return N===Lc}function Jt(){return N===Rc}function Qt(){return N===Mc}function Hc(){return N===Oc}function $c(){return N===Ic}function Uc(){return N===Pc}function ba(){return N===Dc}function ya(){return N===jc}function qc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),N=Cc;return}catch{}else if(e==="dapi")try{dapi.isReady(),N=Tc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=kc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(N=Lc)}catch{}else if(t==="mintegral")window.gameReady&&(N=Rc);else if(t==="tapjoy")window.TJ_API&&(N=Mc);else if(t==="tiktok")window.openAppStore&&(N=Oc);else if(t==="smadex")try{window.smxTracking&&(N=Ic)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(N=Pc)}catch{}else t==="vungle"?N=Dc:(e==="nucleo"||t==="nucleo")&&(N=jc)}var Wn=Ge(require("lottie-web"),1),Gc=Wn.default;typeof window!="undefined"&&(window.lottie=Wn.default,window.__baseLottie=Wn.default);var Gg=require("pixi.js");var va=require("pixi.js");var Wg=null;function xa(e){Wg=e}Yn();wa();var Hi=require("pixi.js");Yn();var Jg=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Aa=Jg;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&&(Aa=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Aa}`))}}catch{}var Mt=class{static async create(t,i,n){var d,l,c,f,p,u,v;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${Aa}`);let r=(d=i==null?void 0:i.render)==null?void 0:d.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new Hi.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(l=i==null?void 0:i.identity)==null?void 0:l.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Rt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new Hi.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.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&&(((u=s.constructor)==null?void 0:u.name)==="Container"||s instanceof Hi.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}`],w=!1;for(let y of h)try{let m=await fetch(y);if(m.ok){o=await m.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",y,"type:",(v=o==null?void 0:o.constructor)==null?void 0:v.name),w=!0;break}}catch{continue}w||(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 $i=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 tm=Ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=tm);Ui();var Xn=require("pixi.js");Ui();var Ta=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new $i}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 d=await Mt.create(a,s,this.app);this.instanceCache.set(a,d),console.log("[Assets] Loaded object:",a,(o=d==null?void 0:d.constructor)==null?void 0:o.name)}catch(d){console.error("[Assets] Failed to load object:",a,d)}})))};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)}},nm=new Ta,rm=new Proxy(nm,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});Ui();var Xc=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},Zn={scale:1,position:1},La=[];function om(e,t,i,n,r,a,s){La.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function lm(){La.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Xe.scaleFactor;i(e,Xe.width,Xe.height,n,r,!0,!1)})}function ka(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),Zn.scale=Xe.scaleFactor,Zn.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Zn.scale.toFixed(3)}`),lm()}var Gi={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 cm(e,t,i){let n=Gi[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function dm(){return Gi}var um={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 Kn(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Jn(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:Kn(e[0],t.x),y:Kn(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:Kn(n.x,t.x),y:Kn(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=um[n])!=null?i:t}return t}function Kc(e,t,i,n={}){var u,v,h,w,y,m;let r=Jn(i),a=(u=n.inset)!=null?u:{},s=(v=n.padding)!=null?v:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,d=((w=a.right)!=null?w:0)+s.x,l=((y=a.top)!=null?y:0)+s.y,c=((m=a.bottom)!=null?m:0)+s.y,f=Math.max(0,e-o-d),p=Math.max(0,t-l-c);return{x:o+f*r.x,y:l+p*r.y}}function Zc(e,t,i,n={}){var h,w,y,m,b,g;let r=(h=n.inset)!=null?h:{},a=(w=n.padding)!=null?w:{x:0,y:0},s=((y=r.left)!=null?y:0)+a.x,o=((m=r.right)!=null?m:0)+a.x,d=((b=r.top)!=null?b:0)+a.y,l=((g=r.bottom)!=null?g:0)+a.y,c=Math.max(0,e-s-o),f=Math.max(0,t-d-l),p=Jn(i,{x:.5,y:.5}),u=Math.min(Math.max(p.x,0),1),v=Math.min(Math.max(p.y,0),1);return{x:s+c*u,y:d+f*v}}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,ka(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),ka(window.innerWidth,window.innerHeight),window.updateDebugConfig=cm,window.getDebugConfig=dm,window.copyConfig=_m,window.applyConfig=qi,window.applyConfigForRatio=Em,window.positionAtBottom=Jc,window.positionAtTop=hm,window.positionAtCenter=gm,window.positionAtLeft=mm,window.positionAtRight=bm,window.positionAtBottomLeft=ym,window.positionAtBottomRight=vm,window.positionAtTopLeft=xm,window.positionAtTopRight=wm,window.applyPositionContract=fm,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 Qn(e,t,i=0){return e*t+i}function er(e,t,i=0){return e*(1-t)+i}function tr(e,t,i=0){return e*t+i}function ir(e,t,i=0){return e*(1-t)+i}function ge(e,t=0){return e/2+t}function pm(e,t){return e*t}function fm(e,t,i,n){var s,o,d,l,c,f,p,u,v,h,w,y,m,b,g,x,E,A,C,T;let r=0,a=0;switch(n.type){case"top":r=ge(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=Qn(i,n.percent,(l=(d=n.offset)==null?void 0:d.y)!=null?l:0);break;case"bottom":r=ge(t,(f=(c=n.offset)==null?void 0:c.x)!=null?f:0),a=er(i,n.percent,(u=(p=n.offset)==null?void 0:p.y)!=null?u:0);break;case"left":r=tr(t,n.percent,(h=(v=n.offset)==null?void 0:v.x)!=null?h:0),a=ge(i,(y=(w=n.offset)==null?void 0:w.y)!=null?y:0);break;case"right":r=ir(t,n.percent,(b=(m=n.offset)==null?void 0:m.x)!=null?b:0),a=ge(i,(x=(g=n.offset)==null?void 0:g.y)!=null?x:0);break;case"center":r=ge(t,(A=(E=n.offset)==null?void 0:E.x)!=null?A:0),a=ge(i,(T=(C=n.offset)==null?void 0:C.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function Jc(e,t,i,n=.2,r=1,a=!0,s=!1){let o=pm(i,n),d=er(i,n/2);Ke(e,ge(t),d);let l=a?r*Xe.scaleFactor:r;Ze(e,l),s&&!La.find(c=>c.element===e)&&om(e,Jc,t,i,n,r,a)}function hm(e,t,i,n=.1,r=1){Ke(e,ge(t),Qn(i,n)),Ze(e,r)}function gm(e,t,i,n=0,r=0,a=1){Ke(e,ge(t,n),ge(i,r)),Ze(e,a)}function mm(e,t,i,n=.1,r=1){Ke(e,tr(t,n),ge(i)),Ze(e,r)}function bm(e,t,i,n=.1,r=1){Ke(e,ir(t,n),ge(i)),Ze(e,r)}function ym(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),er(i,n)),Ze(e,a)}function vm(e,t,i,n=.05,r=.05,a=1){Ke(e,ir(t,r),er(i,n)),Ze(e,a)}function xm(e,t,i,n=.05,r=.05,a=1){Ke(e,tr(t,r),Qn(i,n)),Ze(e,a)}function wm(e,t,i,n=.05,r=.05,a=1){Ke(e,ir(t,r),Qn(i,n)),Ze(e,a)}function Ke(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 Ze(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 Ot={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 _m(e){return e&&Ot[e]?JSON.parse(JSON.stringify(Ot[e])):JSON.parse(JSON.stringify(Gi))}function qi(e){Object.keys(e).forEach(t=>{let i=t;Gi[i]&&e[i]&&Object.assign(Gi[i],e[i])}),console.log("Config applied:",e)}function Em(e,t){let i=e/t;i>1.6?(qi(Ot.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(qi(Ot.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(qi(Ot.square),console.log("Applied SQUARE config for ratio:",i)):(qi(Ot.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Ot,e.resolveAnchorVec2=e.resolveAnchorVec2||Jn,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Kc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||Zc}Oa();function G(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var j_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],z_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],B_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],id=[{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:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var F_=[...id];var Mm=id[0];pt();var mw=Ge(gh(),1);function fw(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 hw(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 gw(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 Eo(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 fw(r),s=await gw(a),o=hw(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 Vr(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,p)=>{let u=new Image;u.onload=()=>f(u),u.onerror=()=>p(new Error("Failed to load image")),u.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,d=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let p=s[f],u=s[f+1],v=s[f+2],h=!1;for(let w of d)if(Math.sqrt(Math.pow(p-w.r,2)+Math.pow(u-w.g,2)+Math.pow(v-w.b,2))<t){h=!0;break}h&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} 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}}var mh=require("@google/genai");async function So(e,t,i=[],n={}){var r,a,s,o,d,l,c;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 y=0;y<i.length;y++){let m=i[y];if(!m.base64||!m.mimeType)throw new Error(`Image ${y+1} is missing required data`);if(m.base64.length<1e3&&console.warn(`Image ${y+1} data appears very small, may be corrupted`),!m.mimeType.startsWith("image/"))throw new Error(`Image ${y+1} has invalid MIME type: ${m.mimeType}`)}let f=new mh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",u=[t];i.length>0&&i.forEach((y,m)=>{u.push({inlineData:{data:y.base64,mimeType:y.mimeType}}),console.log(`[Gemini] Added image ${m+1}: ${y.mimeType}, size: ${Math.round(y.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:p,contents:u}),h="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let y of w)y.text&&(h+=y.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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."):(d=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var bh=require("@google/genai");async function Xr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new bh.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),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 d=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}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}}var bw=require("pixi.js");Ui();pt();var vh=require("pixi.js");var yw=require("pixi.js");pt();function Aw(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 Cw(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"}}function Tw(e){return`
48
48
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
49
49
 
50
50
  Provide a concise summary (2-3 sentences) covering:
@@ -61,9 +61,9 @@ Palette: [#RRGGBB, #RRGGBB, ...]
61
61
  ${e?`
62
62
  ADDITIONAL RULES/NOTES:
63
63
  ${e}`:""}
64
- `.trim()}function fh(){let e=[],t="",i=null;return{async addSources(n){let r=[];for(let a of n){let s=await g0(a),o=m0(s),d={id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,name:a.name,base64:o.base64,mimeType:o.mimeType,dataUrl:s};e.push(d),r.push(d)}return r},getSources(){return e.slice()},async analyze(n,r,a){if(e.length===0)throw new Error("No screenshots to analyze.");let s=b0(r),o=e.map(u=>({base64:u.base64,mimeType:u.mimeType})),d=await Eo(n,s,o,{model:a}),l=t,c=[],f=d.split(`
65
- `);for(let u of f)if(u.toLowerCase().startsWith("summary:"))l=u.slice(8).trim();else if(u.toLowerCase().includes("palette:")){let p=u.match(/#[0-9A-Fa-f]{6}/g);p&&p.forEach(v=>{c.includes(v.toUpperCase())||c.push(v.toUpperCase())})}return(!l||l===t)&&(l=d.split(`
66
- Palette:`)[0].replace(/^Summary:\s*/i,"").trim()),i={summary:l,palette:c.slice(0,10)},i},setSummary(n){t=n,i&&(i={...i,summary:n})},getResult(){return i}}}var Vt="handler_api_key_";var ki=class{static setKey(t,i,n){try{let r={key:this.encryptKey(i),created:Date.now(),lastUsed:Date.now(),label:n||t},a=`${Vt}${t}`;localStorage.setItem(a,JSON.stringify(r))}catch(r){console.error("[ApiKeyStorage] Failed to store API key:",r)}}static getKey(t){try{let i=`${Vt}${t}`,n=localStorage.getItem(i);if(!n)return null;let r=JSON.parse(n);return r.lastUsed=Date.now(),localStorage.setItem(i,JSON.stringify(r)),this.decryptKey(r.key)}catch(i){return console.error("[ApiKeyStorage] Failed to retrieve API key:",i),null}}static hasKey(t){let i=`${Vt}${t}`;return localStorage.getItem(i)!==null}static removeKey(t){try{let i=`${Vt}${t}`;localStorage.removeItem(i)}catch(i){console.error("[ApiKeyStorage] Failed to remove API key:",i)}}static getStoredServices(){let t=[];try{for(let i=0;i<localStorage.length;i++){let n=localStorage.key(i);if(n&&n.startsWith(Vt)){let r=n.substring(Vt.length),a=localStorage.getItem(n);if(a){let s=JSON.parse(a);t.push({service:r,label:s.label,created:s.created,lastUsed:s.lastUsed})}}}}catch(i){console.error("[ApiKeyStorage] Failed to get stored services:",i)}return t.sort((i,n)=>n.lastUsed-i.lastUsed)}static clearAll(){try{let t=[];for(let i=0;i<localStorage.length;i++){let n=localStorage.key(i);n&&n.startsWith(Vt)&&t.push(n)}t.forEach(i=>localStorage.removeItem(i))}catch(t){console.error("[ApiKeyStorage] Failed to clear API keys:",t)}}static encryptKey(t){try{let n="handler_preview_salt_2024"+t;return btoa(n)}catch(i){return console.warn("[ApiKeyStorage] Encryption failed, storing as-is:",i),t}}static decryptKey(t){try{let i=atob(t),n="handler_preview_salt_2024";return i.startsWith(n)?i.substring(n.length):i}catch(i){return console.warn("[ApiKeyStorage] Decryption failed, returning as-is:",i),t}}},So=()=>ki.getKey("gemini"),Ao=(e,t)=>ki.setKey("gemini",e,t),y0=()=>ki.hasKey("gemini");window.ApiKeyStorage=ki;window.getGeminiApiKey=So;window.setGeminiApiKey=Ao;window.hasGeminiApiKey=y0;var To=class{constructor(){this.modal=null;this.options=null;this.analyzer=fh();this.currentPrompt="";this.isGenerating=!1;this.generatedImages=[];this.selectedImageIndex=-1;this.promptInput=null;this.generateBtn=null;this.loadingEl=null;this.galleryEl=null;this.previewEl=null}open(t){this.options=t,this.currentPrompt=t.initialPrompt||"",this.generatedImages=[],this.selectedImageIndex=-1,this.isGenerating=!1,this.createModal(),document.body.appendChild(this.modal),setTimeout(()=>{var i,n;(i=this.promptInput)==null||i.focus(),(n=this.promptInput)==null||n.select()},100)}createModal(){var i;let t=document.createElement("div");t.className="ai-modal",t.innerHTML=`
64
+ `.trim()}function xh(){let e=[],t="",i=null;return{async addSources(n){let r=[];for(let a of n){let s=await Aw(a),o=Cw(s),d={id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,name:a.name,base64:o.base64,mimeType:o.mimeType,dataUrl:s};e.push(d),r.push(d)}return r},getSources(){return e.slice()},async analyze(n,r,a){if(e.length===0)throw new Error("No screenshots to analyze.");let s=Tw(r),o=e.map(p=>({base64:p.base64,mimeType:p.mimeType})),d=await So(n,s,o,{model:a}),l=t,c=[],f=d.split(`
65
+ `);for(let p of f)if(p.toLowerCase().startsWith("summary:"))l=p.slice(8).trim();else if(p.toLowerCase().includes("palette:")){let u=p.match(/#[0-9A-Fa-f]{6}/g);u&&u.forEach(v=>{c.includes(v.toUpperCase())||c.push(v.toUpperCase())})}return(!l||l===t)&&(l=d.split(`
66
+ Palette:`)[0].replace(/^Summary:\s*/i,"").trim()),i={summary:l,palette:c.slice(0,10)},i},setSummary(n){t=n,i&&(i={...i,summary:n})},getResult(){return i}}}var Vt="handler_api_key_";var ki=class{static setKey(t,i,n){try{let r={key:this.encryptKey(i),created:Date.now(),lastUsed:Date.now(),label:n||t},a=`${Vt}${t}`;localStorage.setItem(a,JSON.stringify(r))}catch(r){console.error("[ApiKeyStorage] Failed to store API key:",r)}}static getKey(t){try{let i=`${Vt}${t}`,n=localStorage.getItem(i);if(!n)return null;let r=JSON.parse(n);return r.lastUsed=Date.now(),localStorage.setItem(i,JSON.stringify(r)),this.decryptKey(r.key)}catch(i){return console.error("[ApiKeyStorage] Failed to retrieve API key:",i),null}}static hasKey(t){let i=`${Vt}${t}`;return localStorage.getItem(i)!==null}static removeKey(t){try{let i=`${Vt}${t}`;localStorage.removeItem(i)}catch(i){console.error("[ApiKeyStorage] Failed to remove API key:",i)}}static getStoredServices(){let t=[];try{for(let i=0;i<localStorage.length;i++){let n=localStorage.key(i);if(n&&n.startsWith(Vt)){let r=n.substring(Vt.length),a=localStorage.getItem(n);if(a){let s=JSON.parse(a);t.push({service:r,label:s.label,created:s.created,lastUsed:s.lastUsed})}}}}catch(i){console.error("[ApiKeyStorage] Failed to get stored services:",i)}return t.sort((i,n)=>n.lastUsed-i.lastUsed)}static clearAll(){try{let t=[];for(let i=0;i<localStorage.length;i++){let n=localStorage.key(i);n&&n.startsWith(Vt)&&t.push(n)}t.forEach(i=>localStorage.removeItem(i))}catch(t){console.error("[ApiKeyStorage] Failed to clear API keys:",t)}}static encryptKey(t){try{let n="handler_preview_salt_2024"+t;return btoa(n)}catch(i){return console.warn("[ApiKeyStorage] Encryption failed, storing as-is:",i),t}}static decryptKey(t){try{let i=atob(t),n="handler_preview_salt_2024";return i.startsWith(n)?i.substring(n.length):i}catch(i){return console.warn("[ApiKeyStorage] Decryption failed, returning as-is:",i),t}}},Ao=()=>ki.getKey("gemini"),Co=(e,t)=>ki.setKey("gemini",e,t),kw=()=>ki.hasKey("gemini");window.ApiKeyStorage=ki;window.getGeminiApiKey=Ao;window.setGeminiApiKey=Co;window.hasGeminiApiKey=kw;var ko=class{constructor(){this.modal=null;this.options=null;this.analyzer=xh();this.currentPrompt="";this.isGenerating=!1;this.generatedImages=[];this.selectedImageIndex=-1;this.promptInput=null;this.generateBtn=null;this.loadingEl=null;this.galleryEl=null;this.previewEl=null}open(t){this.options=t,this.currentPrompt=t.initialPrompt||"",this.generatedImages=[],this.selectedImageIndex=-1,this.isGenerating=!1,this.createModal(),document.body.appendChild(this.modal),setTimeout(()=>{var i,n;(i=this.promptInput)==null||i.focus(),(n=this.promptInput)==null||n.select()},100)}createModal(){var i;let t=document.createElement("div");t.className="ai-modal",t.innerHTML=`
67
67
  <div class="ai-modal-card">
68
68
  <div class="ai-modal-header">
69
69
  <div class="ai-modal-actions">
@@ -144,12 +144,12 @@ Palette:`)[0].replace(/^Summary:\s*/i,"").trim()),i={summary:l,palette:c.slice(0
144
144
  </div>
145
145
  `,this.modal=t,this.attachEventListeners(),this.updatePromptFromDna()}attachEventListeners(){var n;if(!this.modal)return;this.promptInput=this.modal.querySelector(".ai-textarea"),this.generateBtn=this.modal.querySelector('[data-action="generate"]'),this.loadingEl=this.modal.querySelector("[data-loading]"),this.galleryEl=this.modal.querySelector("[data-gallery]"),this.previewEl=this.modal.querySelector("[data-preview]"),(n=this.promptInput)==null||n.addEventListener("input",()=>{var r;this.currentPrompt=((r=this.promptInput)==null?void 0:r.value)||"",this.updateGenerateButton()});let t=this.modal.querySelector('[data-strength="creativity"]'),i=this.modal.querySelector(".ai-strength-value");t==null||t.addEventListener("input",()=>{i.textContent=t.value}),this.modal.addEventListener("click",r=>{var o;let a=r.target;switch(a.dataset.action||((o=a.closest("[data-action]"))==null?void 0:o.getAttribute("data-action"))){case"generate":this.generateImage();break;case"apply":this.applySelectedImage();break;case"gallery":this.toggleGallery();break;case"close":case"cancel":this.close();break}}),this.modal.addEventListener("click",r=>{let a=r.target;if(a.classList.contains("ai-gallery-item")||a.closest(".ai-gallery-item")){let s=a.closest(".ai-gallery-item"),o=parseInt(s.dataset.index||"-1");o>=0&&this.selectImage(o)}}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()}),this.updateGenerateButton()}updateGenerateButton(){if(!this.generateBtn)return;let t=this.currentPrompt.trim().length>0;this.generateBtn.disabled=!t||this.isGenerating}async updatePromptFromDna(){var i;let t=(i=this.modal)==null?void 0:i.querySelector("#ai-use-dna");if(t!=null&&t.checked)try{let n=this.analyzer.getResult();if(n!=null&&n.summary&&this.promptInput){let r=`${this.currentPrompt}
146
146
 
147
- Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}catch(n){console.warn("[AiEditorModal] Failed to apply brand DNA:",n)}}async generateImage(){var t,i,n,r;if(!(!this.options||this.isGenerating)){this.isGenerating=!0,this.updateGenerateButton(),(t=this.loadingEl)==null||t.classList.remove("hidden"),(i=this.previewEl)==null||i.classList.add("hidden");try{let a=this.getApiKey();if(!a){alert("Please set your Gemini API key first. You can do this in the AI Creative Suite panel.");return}let s=[];if(this.options.currentValue&&this.options.currentValue.startsWith("data:"))try{let l=await _o(this.options.currentValue);l&&(s=[{base64:l.base64,mimeType:l.mimeType}])}catch(l){console.warn("[AiEditorModal] Failed to load current image:",l)}let o=await Vr(a,this.currentPrompt,s,{aspectRatio:"1:1"}),d=await Yr(o);this.generatedImages.push(d||o),this.selectedImageIndex=this.generatedImages.length-1,this.updateGallery(),this.updatePreview(),this.updateApplyButton()}catch(a){console.error("[AiEditorModal] Generation failed:",a),alert(`Generation failed: ${a instanceof Error?a.message:"Unknown error"}`)}finally{this.isGenerating=!1,(n=this.loadingEl)==null||n.classList.add("hidden"),(r=this.previewEl)==null||r.classList.remove("hidden"),this.updateGenerateButton()}}}updateGallery(){if(!this.galleryEl)return;let t=this.galleryEl.querySelector("[data-gallery-grid]");t&&(t.innerHTML=this.generatedImages.map((i,n)=>`
147
+ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}catch(n){console.warn("[AiEditorModal] Failed to apply brand DNA:",n)}}async generateImage(){var t,i,n,r;if(!(!this.options||this.isGenerating)){this.isGenerating=!0,this.updateGenerateButton(),(t=this.loadingEl)==null||t.classList.remove("hidden"),(i=this.previewEl)==null||i.classList.add("hidden");try{let a=this.getApiKey();if(!a){alert("Please set your Gemini API key first. You can do this in the AI Creative Suite panel.");return}let s=[];if(this.options.currentValue&&this.options.currentValue.startsWith("data:"))try{let l=await Eo(this.options.currentValue);l&&(s=[{base64:l.base64,mimeType:l.mimeType}])}catch(l){console.warn("[AiEditorModal] Failed to load current image:",l)}let o=await Xr(a,this.currentPrompt,s,{aspectRatio:"1:1"}),d=await Vr(o);this.generatedImages.push(d||o),this.selectedImageIndex=this.generatedImages.length-1,this.updateGallery(),this.updatePreview(),this.updateApplyButton()}catch(a){console.error("[AiEditorModal] Generation failed:",a),alert(`Generation failed: ${a instanceof Error?a.message:"Unknown error"}`)}finally{this.isGenerating=!1,(n=this.loadingEl)==null||n.classList.add("hidden"),(r=this.previewEl)==null||r.classList.remove("hidden"),this.updateGenerateButton()}}}updateGallery(){if(!this.galleryEl)return;let t=this.galleryEl.querySelector("[data-gallery-grid]");t&&(t.innerHTML=this.generatedImages.map((i,n)=>`
148
148
  <div class="ai-gallery-item ${n===this.selectedImageIndex?"active":""}" data-index="${n}">
149
149
  <img class="ai-gallery-thumb" src="${i}" alt="Generated ${n+1}" />
150
150
  <div class="ai-gallery-label">#${n+1}</div>
151
151
  </div>
152
- `).join(""))}updatePreview(){if(!this.previewEl||this.selectedImageIndex<0)return;let t=this.generatedImages[this.selectedImageIndex];this.previewEl.innerHTML=`<img src="${t}" alt="Selected image" />`}selectImage(t){t<0||t>=this.generatedImages.length||(this.selectedImageIndex=t,this.updateGallery(),this.updatePreview(),this.updateApplyButton())}toggleGallery(){this.galleryEl&&this.galleryEl.classList.toggle("hidden")}updateApplyButton(){var i;let t=(i=this.modal)==null?void 0:i.querySelector('[data-action="apply"]');t&&(t.disabled=this.selectedImageIndex<0)}applySelectedImage(){var i;if(this.selectedImageIndex<0||!((i=this.options)!=null&&i.onApply))return;let t=this.generatedImages[this.selectedImageIndex];this.options.onApply(t),this.close()}getApiKey(){let t=So();if(t)return t;try{let i=this.analyzer.getResult();if(i&&i.apiKey)return Ao(i.apiKey,"From Brand DNA"),i.apiKey}catch(i){console.warn("[AiEditorModal] Failed to get API key from brand DNA:",i)}return null}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.options=null}},Co=null;window.__openAiEditor=function(e,t,i,n){Co||(Co=new To),Co.open({objectId:e,initialPrompt:t,currentValue:i,path:n==null?void 0:n.path,onApply:r=>{if(n!=null&&n.path){let a=window.updateManager;if(a)a.updateProperty(e,n.path,r);else{let s=window.getEditableObjectConfig,o=s==null?void 0:s(e);if(o){let d=n.path.split("."),l=o;for(let c=0;c<d.length-1;c++)l[d[c]]||(l[d[c]]={}),l=l[d[c]];l[d[d.length-1]]=r}}}window.dispatchEvent(new CustomEvent("inspector:refresh"))}})};Lo();var Ro=class{constructor(){this.modal=null;this.options=null}open(t){this.options=t,this.createModal(),document.body.appendChild(this.modal)}createModal(){if(!this.options)return;let{assetPath:t,assetType:i,objectId:n}=this.options,r=n||"Asset Preview",a=document.createElement("div");a.className="asset-preview-modal",a.innerHTML=`
152
+ `).join(""))}updatePreview(){if(!this.previewEl||this.selectedImageIndex<0)return;let t=this.generatedImages[this.selectedImageIndex];this.previewEl.innerHTML=`<img src="${t}" alt="Selected image" />`}selectImage(t){t<0||t>=this.generatedImages.length||(this.selectedImageIndex=t,this.updateGallery(),this.updatePreview(),this.updateApplyButton())}toggleGallery(){this.galleryEl&&this.galleryEl.classList.toggle("hidden")}updateApplyButton(){var i;let t=(i=this.modal)==null?void 0:i.querySelector('[data-action="apply"]');t&&(t.disabled=this.selectedImageIndex<0)}applySelectedImage(){var i;if(this.selectedImageIndex<0||!((i=this.options)!=null&&i.onApply))return;let t=this.generatedImages[this.selectedImageIndex];this.options.onApply(t),this.close()}getApiKey(){let t=Ao();if(t)return t;try{let i=this.analyzer.getResult();if(i&&i.apiKey)return Co(i.apiKey,"From Brand DNA"),i.apiKey}catch(i){console.warn("[AiEditorModal] Failed to get API key from brand DNA:",i)}return null}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.options=null}},To=null;window.__openAiEditor=function(e,t,i,n){To||(To=new ko),To.open({objectId:e,initialPrompt:t,currentValue:i,path:n==null?void 0:n.path,onApply:r=>{if(n!=null&&n.path){let a=window.updateManager;if(a)a.updateProperty(e,n.path,r);else{let s=window.getEditableObjectConfig,o=s==null?void 0:s(e);if(o){let d=n.path.split("."),l=o;for(let c=0;c<d.length-1;c++)l[d[c]]||(l[d[c]]={}),l=l[d[c]];l[d[d.length-1]]=r}}}window.dispatchEvent(new CustomEvent("inspector:refresh"))}})};Ro();var Mo=class{constructor(){this.modal=null;this.options=null}open(t){this.options=t,this.createModal(),document.body.appendChild(this.modal)}createModal(){if(!this.options)return;let{assetPath:t,assetType:i,objectId:n}=this.options,r=n||"Asset Preview",a=document.createElement("div");a.className="asset-preview-modal",a.innerHTML=`
153
153
  <div class="asset-preview-card">
154
154
  <div class="asset-preview-header">
155
155
  <div class="asset-preview-title">${r}</div>
@@ -176,7 +176,7 @@ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
176
176
  <source src="${r}" type="audio/wav">
177
177
  Your browser does not support the audio element.
178
178
  </audio>
179
- `;case"text":return`<pre style="background: rgba(0,0,0,0.2); padding: 16px; border-radius: 8px; max-height: 300px; overflow-y: auto; white-space: pre-wrap;">${t}</pre>`;default:return`<div class="asset-preview-placeholder">Cannot preview ${i} assets</div>`}}resolveAssetUrl(t){return t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("/")?t:`/raw/${t}`}attachEventListeners(){if(!this.modal)return;this.modal.addEventListener("click",n=>{let r=n.target;(r.dataset.action==="close"||r===this.modal)&&this.close()});let t=this.modal.querySelector('[data-action="change"]');t&&t.addEventListener("click",()=>{this.openAssetEditor()});let i=this.modal.querySelector('[data-action="edit"]');i&&i.addEventListener("click",()=>{this.openAiEditor(),this.close()})}openAssetEditor(){this.options&&Promise.resolve().then(()=>(Lo(),hh)).then(({AssetEditorModal:t})=>{new t().show(this.options.objectId||"unknown",this.options.propertyPath||"",this.options.assetPath,n=>{var r;(r=this.options)!=null&&r.onChange&&this.options.onChange(n),this.close()})})}openAiEditor(){if(!this.options||this.options.assetType!=="image")return;let t=window.__openAiEditor;typeof t=="function"&&t(this.options.objectId||"asset","Edit this image asset",this.options.assetPath,{path:this.options.propertyPath,onApply:i=>{var n;(n=this.options)!=null&&n.onChange&&this.options.onChange(i)}})}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.options=null}};window.openAssetPreview=function(e){new Ro().open(e)};var Mo=class{constructor(){this.modal=null;this.canvas=null;this.ctx=null;this.image=null;this.options=null;this.cropX=0;this.cropY=0;this.cropWidth=100;this.cropHeight=100;this.scale=1;this.panX=0;this.panY=0;this.isDragging=!1;this.dragStartX=0;this.dragStartY=0;this.lastPanX=0;this.lastPanY=0}open(t){this.options=t,this.createModal(),this.loadImage(),document.body.appendChild(this.modal)}createModal(){let t=document.createElement("div");t.className="asset-crop-modal",t.innerHTML=`
179
+ `;case"text":return`<pre style="background: rgba(0,0,0,0.2); padding: 16px; border-radius: 8px; max-height: 300px; overflow-y: auto; white-space: pre-wrap;">${t}</pre>`;default:return`<div class="asset-preview-placeholder">Cannot preview ${i} assets</div>`}}resolveAssetUrl(t){return t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("/")?t:`/raw/${t}`}attachEventListeners(){if(!this.modal)return;this.modal.addEventListener("click",n=>{let r=n.target;(r.dataset.action==="close"||r===this.modal)&&this.close()});let t=this.modal.querySelector('[data-action="change"]');t&&t.addEventListener("click",()=>{this.openAssetEditor()});let i=this.modal.querySelector('[data-action="edit"]');i&&i.addEventListener("click",()=>{this.openAiEditor(),this.close()})}openAssetEditor(){this.options&&Promise.resolve().then(()=>(Ro(),wh)).then(({AssetEditorModal:t})=>{new t().show(this.options.objectId||"unknown",this.options.propertyPath||"",this.options.assetPath,n=>{var r;(r=this.options)!=null&&r.onChange&&this.options.onChange(n),this.close()})})}openAiEditor(){if(!this.options||this.options.assetType!=="image")return;let t=window.__openAiEditor;typeof t=="function"&&t(this.options.objectId||"asset","Edit this image asset",this.options.assetPath,{path:this.options.propertyPath,onApply:i=>{var n;(n=this.options)!=null&&n.onChange&&this.options.onChange(i)}})}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.options=null}};window.openAssetPreview=function(e){new Mo().open(e)};var Oo=class{constructor(){this.modal=null;this.canvas=null;this.ctx=null;this.image=null;this.options=null;this.cropX=0;this.cropY=0;this.cropWidth=100;this.cropHeight=100;this.scale=1;this.panX=0;this.panY=0;this.isDragging=!1;this.dragStartX=0;this.dragStartY=0;this.lastPanX=0;this.lastPanY=0}open(t){this.options=t,this.createModal(),this.loadImage(),document.body.appendChild(this.modal)}createModal(){let t=document.createElement("div");t.className="asset-crop-modal",t.innerHTML=`
180
180
  <div class="asset-crop-card">
181
181
  <div class="asset-crop-header">
182
182
  <div>
@@ -227,7 +227,7 @@ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
227
227
  <button class="asset-crop-apply primary" data-action="apply">Apply Crop</button>
228
228
  </div>
229
229
  </div>
230
- `,this.modal=t,this.attachEventListeners(),this.initializeCanvas()}initializeCanvas(){this.modal&&(this.canvas=this.modal.querySelector(".asset-crop-canvas"),this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.canvas.width=400,this.canvas.height=300))}loadImage(){this.options&&(this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=()=>{this.initializeCrop(),this.render()},this.image.src=this.options.imageSrc)}initializeCrop(){var n;if(!this.image||!this.canvas)return;let t=this.image.width/this.image.height,i=this.canvas.width/this.canvas.height;t>i?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*i,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/i,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(n=this.options)!=null&&n.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(t){if(!this.image)return;let i=this.image.width/this.image.height,n=this.cropX+this.cropWidth/2,r=this.cropY+this.cropHeight/2;t>i?(this.cropWidth=Math.min(this.image.width,this.cropHeight*t),this.cropHeight=this.cropWidth/t):(this.cropHeight=Math.min(this.image.height,this.cropWidth/t),this.cropWidth=this.cropHeight*t),this.cropX=Math.max(0,Math.min(this.image.width-this.cropWidth,n-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,r-this.cropHeight/2))}fitToCanvas(){if(!this.image||!this.canvas)return;let t=this.canvas.width/this.cropWidth,i=this.canvas.height/this.cropHeight;this.scale=Math.min(t,i)*.9,this.panX=(this.canvas.width-this.cropWidth*this.scale)/2,this.panY=(this.canvas.height-this.cropHeight*this.scale)/2}render(){!this.ctx||!this.image||!this.canvas||(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.save(),this.ctx.translate(this.panX,this.panY),this.ctx.scale(this.scale,this.scale),this.ctx.drawImage(this.image,-this.cropX,-this.cropY,this.image.width,this.image.height),this.ctx.restore(),this.drawCropOverlay(),this.updatePreview())}drawCropOverlay(){if(!this.ctx||!this.canvas)return;let t=this.panX,i=this.panY,n=this.cropWidth*this.scale,r=this.cropHeight*this.scale;this.ctx.fillStyle="rgba(0, 0, 0, 0.5)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.clearRect(t,i,n,r),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(t,i,n,r),this.ctx.fillStyle="#ffffff";let a=8;[[t,i],[t+n-a,i],[t,i+r-a],[t+n-a,i+r-a]].forEach(([o,d])=>{var l;(l=this.ctx)==null||l.fillRect(o,d,a,a)})}updatePreview(){if(!this.modal||!this.image)return;let t=this.modal.querySelector(".asset-crop-preview-canvas");if(!t)return;let i=t.getContext("2d");if(!i)return;let n=150;t.width=n,t.height=n;let r=n/this.cropWidth,a=n/this.cropHeight,s=Math.min(r,a),o=this.cropWidth*s,d=this.cropHeight*s,l=(n-o)/2,c=(n-d)/2;i.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,l,c,o,d)}attachEventListeners(){if(!this.modal||!this.canvas)return;this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this));let t=this.modal.querySelector(".asset-crop-zoom-slider");t==null||t.addEventListener("input",n=>{let r=parseFloat(n.target.value);this.setZoom(r)});let i=this.modal.querySelector(".asset-crop-aspect-select");i==null||i.addEventListener("change",n=>{let r=n.target.value;this.setAspectRatio(r)}),this.modal.addEventListener("click",n=>{switch(n.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",n=>{n.target===this.modal&&this.close()})}handleMouseDown(t){this.isDragging=!0,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.lastPanX=this.panX,this.lastPanY=this.panY,this.canvas.style.cursor="grabbing"}handleMouseMove(t){if(!this.isDragging)return;let i=t.clientX-this.dragStartX,n=t.clientY-this.dragStartY;this.panX=this.lastPanX+i,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(t){t.preventDefault();let i=t.deltaY>0?.9:1.1;this.setZoom(this.scale*i)}handleTouchStart(t){t.touches.length===1&&(this.isDragging=!0,this.dragStartX=t.touches[0].clientX,this.dragStartY=t.touches[0].clientY,this.lastPanX=this.panX,this.lastPanY=this.panY)}handleTouchMove(t){if(!this.isDragging||t.touches.length!==1)return;t.preventDefault();let i=t.touches[0].clientX-this.dragStartX,n=t.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+i,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleTouchEnd(){this.isDragging=!1}setZoom(t){this.scale=Math.max(.1,Math.min(3,t)),this.updateZoomUI(),this.constrainPan(),this.render()}setAspectRatio(t){let i;switch(t){case"1:1":i=1;break;case"4:3":i=4/3;break;case"16:9":i=16/9;break;case"3:2":i=3/2;break;default:i=void 0}i&&this.applyAspectRatio(i),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let t=this.modal.querySelector(".asset-crop-zoom-value"),i=this.modal.querySelector(".asset-crop-zoom-slider");t&&(t.textContent=`${this.scale.toFixed(1)}x`),i&&(i.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let t=this.cropWidth*this.scale,i=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-t,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-i,Math.min(0,this.panY))}reset(){this.initializeCrop(),this.render()}applyCrop(){var r;if(!this.image||!((r=this.options)!=null&&r.onCrop))return;let t=document.createElement("canvas"),i=t.getContext("2d");if(!i)return;t.width=this.cropWidth,t.height=this.cropHeight,i.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let n=t.toDataURL("image/png");this.options.onCrop(n),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal);let t=this.options;this.modal=null,this.canvas=null,this.ctx=null,this.image=null,this.options=null,t!=null&&t.onCancel&&t.onCancel()}};window.openAssetCrop=function(e){new Mo().open(e)};pt();pt();var gh=Ge(require("lottie-web"),1);va(Bc);typeof window!="undefined"&&!window.lottie&&(window.lottie=gh.default);Ma();pt();var Oo="0.3.1",v0=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"]),_h={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"},Eh=Math.random().toString(36).slice(2),Mi=null,Li={..._h},Sh="web_embed",jo={},kn,Io=!1,Tn=!1,Rn=!1,Ah=!1,No=1,Kr=0,Qr=!1,lt=!1,Ri="",Oi=Math.floor(window.innerWidth),Ii=Math.floor(window.innerHeight),zo=Oi>Ii,ct=!1,Ln=!1,mh=!1,bh=!1,Po=!1,Zr=null,Xt=null,Bo=!1,Fo=!1,Xr=new Map;function Ch(){if(!Xt)return null;let e=Date.now()-Xt;return!Number.isFinite(e)||e<0?null:e}function Do(e){if(Bo)return;let t=Ch();t!==null&&(Bo=!0,k("session_time",{duration_ms:t,reason:e}))}function yh(){if(Mi)return Mi;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),Mi=e,e}function Jr(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Th(e,t){return{event_name:e,ts:Date.now(),session_id:Eh,deployment_id:Li.deployment_id,variant_id:Li.variant_id,export_profile_id:Li.profile_id,instance_id:Li.instance_id||"default",env:Sh==="mraid"?"mraid":"web",attribution:kn,payload:t}}function k(e,t){let i=Jr(e),n=Th(i,t);ga(n,!!jo.analytics),qn(i,n),i!==e&&qn(e,n)}function Mn(){Zr&&(Zr(Oi,Ii),Zr=null)}function Pi(e){No=e,k("volume",e)}function Di(e){e&&(Ah=!0),!Rn&&(Rn=!0,k("pause"),Pi(0))}function On(e){!e&&Ah||Rn&&(Rn=!1,k("resume"),Pi(No))}function St(e,t){Oi=Math.floor(e||window.innerWidth),Ii=Math.floor(t||window.innerHeight),zo=Oi>Ii,k("resize",{width:Oi,height:Ii})}function x0(){if(Rc())try{let e=mraid.getMaxSize();St(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?On():Di()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let i=mraid.getMaxSize();St(i.width,i.height)}),mraid.getAudioVolume){let i=mraid.getAudioVolume();Pi(i?1:0)}if(mraid.addEventListener("audioVolumeChange",i=>{i!==null&&Pi(i>0?1:0)}),mraid.addEventListener("error",(i,n)=>{console.warn("mraid error:",i,"action:",n)}),Qr=!0,mraid.isViewable()&&mraid.getState()!=="hidden")ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Mn();else{let i=()=>{ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Mn()};mraid.addEventListener("ready",i)}}catch(e){console.warn("MRAID hook skipped",e)}}function w0(){if(Mc())try{let e=dapi.getScreenSize();St(e.width,e.height),dapi.addEventListener("viewableChange",i=>{i.isViewable?On():Di()}),dapi.addEventListener("adResized",i=>{let n=dapi.getScreenSize();St(i.width||n.width,i.height||n.height)});let t=dapi.getAudioVolume();if(Pi(t?1:0),dapi.addEventListener("audioVolumeChange",i=>Pi(i?1:0)),Qr=!0,dapi.isViewable())ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Mn();else{let i=()=>{ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Mn()};dapi.addEventListener("ready",i)}}catch(e){console.warn("DAPI hook skipped",e)}}function vh(){let e=()=>{ct||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Mn(),Ln&&(Ln=!1,ze.start()))};window.addEventListener("resize",()=>St()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(On(),e()):Di()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),Qr=!0}function _0(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(mh=!0),!(mh&&t instanceof MouseEvent)&&(Kr+=1,Fo||(Fo=!0,k("first_interaction",{count:Kr})),k("interaction",Kr))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function xh(e){var n,r,a,s,o,d,l,c,f,u,p,v;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(Qt())(a=(r=window.TJ_API)==null?void 0:r.click)==null||a.call(r);else if(Oc())(o=(s=window.FbPlayableAd)==null?void 0:s.onCTAClick)==null||o.call(s);else if(jc())(l=(d=window.ScPlayableAd)==null?void 0:d.onCTAClick)==null||l.call(d);else if(Dc())try{(f=(c=window.smxTracking)==null?void 0:c.redirect)==null||f.call(c)}catch(h){console.warn("Smadex redirect failed",h)}else if(Ic()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(e||Ri||""):e&&window.open(e)}else Jt()?(u=window.install)==null||u.call(window):Pc()?(p=window.openAppStore)==null||p.call(window):ma()?(v=parent==null?void 0:parent.postMessage)==null||v.call(parent,"download","*"):e&&window.open(e)}function E0(){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;fe("view",()=>t(i.mraid_viewable)),fe("start",()=>t(i.game_viewable)),fe("engagement",()=>t(i.engagement));let n=()=>t(i.complete);fe("complete",n),Un("engagement",r=>{var a;((a=r==null?void 0:r.payload)==null?void 0:a.count)>3&&n()}),fe("cta_click",()=>t(i.click))}else if(e==="inmobi"){let i=window.INMOBI_DSPMACROS;if(!i)return;fe("view",()=>t(i.Ad_Load_Start)),fe("start",()=>t(i.Ad_Viewable)),fe("engagement",()=>t(i.First_Engagement)),fe("complete",()=>t(i.Gameplay_Complete)),fe("cta_click",()=>t(i.DSP_Click)),fe("start",()=>{[5,10,15,20,25,30].forEach(n=>setTimeout(()=>t(i[`Spent_${n}_Seconds`]),n*1e3))})}}function S0(){if(!Qt())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{ze.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function wh(){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 A0(){Jt()&&(window.mintGameStart=()=>{On(!0),St()},window.mintGameClose=()=>{Di(!0)})}function C0(){if(!ba())return;let e=window.NUC;!e||!e.trigger||(ze.on("cta_click",()=>{var t,i;return(i=(t=e.trigger).convert)==null?void 0:i.call(t,Ri)}),ze.on("complete",()=>{var t,i;return(i=(t=e.trigger).tryAgain)==null?void 0:i.call(t)}))}var ze={init(e={},t){var i;if(Sh=e.profile||"web_embed",jo=e.consent||{},Li={..._h,...e.ids||{}},Mi=e.rootEl||Mi,kn=void 0,bc((i=e.telemetry)!=null&&i.endpoint?e.telemetry:null),Xt=null,Bo=!1,Fo=!1,Xr.clear(),Ri=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(Zr=t),k("init"),document.body.oncontextmenu=()=>!1,yh(),k0(Mi),zc(),x0(),w0(),!Qr){if(document.readyState==="complete")vh();else if(!bh){bh=!0;let n=()=>{vh(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}_0(),E0(),S0(),A0(),C0(),console.log(`%c @handler/playable-sdk %c v${Oo} `,"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;"),ct&&!lt&&(k("boot"),k("view"),k("ready"),Ln&&(Ln=!1,ze.start()),lt=!0),lt=ct},getRoot(){return yh()},get version(){return Oo},get maxWidth(){return Oi},get maxHeight(){return Ii},get isLandscape(){return zo},get isReady(){return lt},get isStarted(){return Io},get isPaused(){return Rn},get isFinished(){return Tn},get volume(){return No},get interactions(){return Kr},on(e,t){Un(Jr(e),t)},off(e,t){ha(Jr(e),t)},start(){var e,t;if(!Io){if(!ct){Ln=!0;return}if(Io=!0,Xt||(Xt=Date.now()),k("start"),St(),Jt())Di(),(e=window.gameReady)==null||e.call(window);else if(Qt()){let i=window.TJ_API;(t=i==null?void 0:i.setPlayableBuild)==null||t.call(i,{orientation:zo?"landscape":"portrait",buildID:Oo})}}},finish(){var e,t;Tn||(Tn=!0,k("complete"),Do("complete"),Jt()?(e=window.gameEnd)==null||e.call(window):ma()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):Qt()&&wh())},install(e){if(!Tn){Tn=!0,Qt()?(wh(),setTimeout(()=>ze.install(e),300)):(k("complete"),setTimeout(()=>ze.install(e),0));return}Po||(Po=!0,setTimeout(()=>Po=!1,500),k("cta_click"),k("conversion"),Do("cta"),xh(e||Ri))},emit(e,t){let i=Jr(e);if(!v0.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=Th(i,t);ga(n,!!jo.analytics),qn(i,n)},gameStart(){ze.start()},gameEnd(){ze.finish()},ctaClick(e,t){k("cta_click",{url:e||Ri,manual:!0}),(t==null?void 0:t.open)!==!1&&xh(e||Ri)},ctaShow(e){k("cta_show",e)},ctaDismiss(e){k("cta_dismiss",e)},getGameTimeMs(){return Ch()},endSession(e="manual"){Do(e)},setAttribution(e){kn=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(T0(`${Eh}:${e}`))%t.length,n=t[i];return kn={...kn||{},experiment_id:e},Li.variant_id=n,k("ab_assign",{experiment_id:e,variant_id:n}),n},levelStart(e,t){Xt||(Xt=Date.now()),k("level_start",{level_id:e,...t})},levelComplete(e,t){k("level_complete",{level_id:e,...t})},levelFail(e,t){k("level_fail",{level_id:e,...t})},checkpoint(e,t){k("checkpoint",{checkpoint_id:e,...t})},reward(e,t){k("reward",{reward_id:e,...t})},tutorialStart(e,t){k("tutorial_start",{step_id:e,...t})},tutorialComplete(e,t){k("tutorial_complete",{step_id:e,...t})},tutorialSkip(e,t){k("tutorial_skip",{step_id:e,...t})},timerStart(e){e&&Xr.set(e,Date.now())},timerEnd(e,t="custom",i){if(!e)return;let n=Xr.get(e);if(!n)return;Xr.delete(e);let r=Date.now()-n;if(!(!Number.isFinite(r)||r<0)){if(t==="custom"){k("engagement",{action:"timer",key:e,duration_ms:r,...i});return}k(t,{key:e,duration_ms:r,...i})}},fps(e,t){k("fps",{value:e,...t})},memory(e,t){k("memory",{bytes:e,...t})},assetLoadStart(e,t){k("asset_load_start",{asset_id:e,...t})},assetLoadComplete(e,t){k("asset_load_complete",{asset_id:e,...t})},reportError(e,t,i){k("error",{code:e,message:t,...i})},retry(){var e,t,i;if(Jt())(e=window.gameRetry)==null||e.call(window);else if(ba()){let n=window.NUC;(i=(t=n==null?void 0:n.trigger)==null?void 0:t.tryAgain)==null||i.call(t)}k("engagement",{action:"retry"})},pause(){Di(!0)},resume(){On(!0)},resize(e,t){St(e,t)}},ei=ze;function T0(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 k0(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
230
+ `,this.modal=t,this.attachEventListeners(),this.initializeCanvas()}initializeCanvas(){this.modal&&(this.canvas=this.modal.querySelector(".asset-crop-canvas"),this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.canvas.width=400,this.canvas.height=300))}loadImage(){this.options&&(this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=()=>{this.initializeCrop(),this.render()},this.image.src=this.options.imageSrc)}initializeCrop(){var n;if(!this.image||!this.canvas)return;let t=this.image.width/this.image.height,i=this.canvas.width/this.canvas.height;t>i?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*i,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/i,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(n=this.options)!=null&&n.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(t){if(!this.image)return;let i=this.image.width/this.image.height,n=this.cropX+this.cropWidth/2,r=this.cropY+this.cropHeight/2;t>i?(this.cropWidth=Math.min(this.image.width,this.cropHeight*t),this.cropHeight=this.cropWidth/t):(this.cropHeight=Math.min(this.image.height,this.cropWidth/t),this.cropWidth=this.cropHeight*t),this.cropX=Math.max(0,Math.min(this.image.width-this.cropWidth,n-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,r-this.cropHeight/2))}fitToCanvas(){if(!this.image||!this.canvas)return;let t=this.canvas.width/this.cropWidth,i=this.canvas.height/this.cropHeight;this.scale=Math.min(t,i)*.9,this.panX=(this.canvas.width-this.cropWidth*this.scale)/2,this.panY=(this.canvas.height-this.cropHeight*this.scale)/2}render(){!this.ctx||!this.image||!this.canvas||(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.save(),this.ctx.translate(this.panX,this.panY),this.ctx.scale(this.scale,this.scale),this.ctx.drawImage(this.image,-this.cropX,-this.cropY,this.image.width,this.image.height),this.ctx.restore(),this.drawCropOverlay(),this.updatePreview())}drawCropOverlay(){if(!this.ctx||!this.canvas)return;let t=this.panX,i=this.panY,n=this.cropWidth*this.scale,r=this.cropHeight*this.scale;this.ctx.fillStyle="rgba(0, 0, 0, 0.5)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.clearRect(t,i,n,r),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(t,i,n,r),this.ctx.fillStyle="#ffffff";let a=8;[[t,i],[t+n-a,i],[t,i+r-a],[t+n-a,i+r-a]].forEach(([o,d])=>{var l;(l=this.ctx)==null||l.fillRect(o,d,a,a)})}updatePreview(){if(!this.modal||!this.image)return;let t=this.modal.querySelector(".asset-crop-preview-canvas");if(!t)return;let i=t.getContext("2d");if(!i)return;let n=150;t.width=n,t.height=n;let r=n/this.cropWidth,a=n/this.cropHeight,s=Math.min(r,a),o=this.cropWidth*s,d=this.cropHeight*s,l=(n-o)/2,c=(n-d)/2;i.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,l,c,o,d)}attachEventListeners(){if(!this.modal||!this.canvas)return;this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this));let t=this.modal.querySelector(".asset-crop-zoom-slider");t==null||t.addEventListener("input",n=>{let r=parseFloat(n.target.value);this.setZoom(r)});let i=this.modal.querySelector(".asset-crop-aspect-select");i==null||i.addEventListener("change",n=>{let r=n.target.value;this.setAspectRatio(r)}),this.modal.addEventListener("click",n=>{switch(n.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",n=>{n.target===this.modal&&this.close()})}handleMouseDown(t){this.isDragging=!0,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.lastPanX=this.panX,this.lastPanY=this.panY,this.canvas.style.cursor="grabbing"}handleMouseMove(t){if(!this.isDragging)return;let i=t.clientX-this.dragStartX,n=t.clientY-this.dragStartY;this.panX=this.lastPanX+i,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(t){t.preventDefault();let i=t.deltaY>0?.9:1.1;this.setZoom(this.scale*i)}handleTouchStart(t){t.touches.length===1&&(this.isDragging=!0,this.dragStartX=t.touches[0].clientX,this.dragStartY=t.touches[0].clientY,this.lastPanX=this.panX,this.lastPanY=this.panY)}handleTouchMove(t){if(!this.isDragging||t.touches.length!==1)return;t.preventDefault();let i=t.touches[0].clientX-this.dragStartX,n=t.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+i,this.panY=this.lastPanY+n,this.constrainPan(),this.render()}handleTouchEnd(){this.isDragging=!1}setZoom(t){this.scale=Math.max(.1,Math.min(3,t)),this.updateZoomUI(),this.constrainPan(),this.render()}setAspectRatio(t){let i;switch(t){case"1:1":i=1;break;case"4:3":i=4/3;break;case"16:9":i=16/9;break;case"3:2":i=3/2;break;default:i=void 0}i&&this.applyAspectRatio(i),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let t=this.modal.querySelector(".asset-crop-zoom-value"),i=this.modal.querySelector(".asset-crop-zoom-slider");t&&(t.textContent=`${this.scale.toFixed(1)}x`),i&&(i.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let t=this.cropWidth*this.scale,i=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-t,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-i,Math.min(0,this.panY))}reset(){this.initializeCrop(),this.render()}applyCrop(){var r;if(!this.image||!((r=this.options)!=null&&r.onCrop))return;let t=document.createElement("canvas"),i=t.getContext("2d");if(!i)return;t.width=this.cropWidth,t.height=this.cropHeight,i.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let n=t.toDataURL("image/png");this.options.onCrop(n),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal);let t=this.options;this.modal=null,this.canvas=null,this.ctx=null,this.image=null,this.options=null,t!=null&&t.onCancel&&t.onCancel()}};window.openAssetCrop=function(e){new Oo().open(e)};pt();pt();var _h=Ge(require("lottie-web"),1);xa(Gc);typeof window!="undefined"&&!window.lottie&&(window.lottie=_h.default);Oa();pt();var Io="0.3.12",Lw=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"]);Ac();var Lh={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"},Rh=Math.random().toString(36).slice(2),Mi=null,Li={...Lh},Mh="web_embed",zo={},Ln,Po=!1,kn=!1,Mn=!1,Oh=!1,Ho=1,Zr=0,ea=!1,lt=!1,Ri="",Oi=Math.floor(window.innerWidth),Ii=Math.floor(window.innerHeight),Bo=Oi>Ii,ct=!1,Rn=!1,Eh=!1,Sh=!1,Do=!1,Jr=null,Xt=null,Fo=!1,No=!1,Kr=new Map;function Ih(){if(!Xt)return null;let e=Date.now()-Xt;return!Number.isFinite(e)||e<0?null:e}function jo(e){if(Fo)return;let t=Ih();t!==null&&(Fo=!0,k("session_time",{duration_ms:t,reason:e}))}function Ah(){if(Mi)return Mi;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),Mi=e,e}function Qr(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Ph(e,t){return{event_name:e,ts:Date.now(),session_id:Rh,deployment_id:Li.deployment_id,variant_id:Li.variant_id,export_profile_id:Li.profile_id,instance_id:Li.instance_id||"default",env:Mh==="mraid"?"mraid":"web",attribution:Ln,payload:t}}function k(e,t){let i=Qr(e),n=Ph(i,t);ma(n,!!zo.analytics),Gn(i,n),i!==e&&Gn(e,n)}function On(){Jr&&(Jr(Oi,Ii),Jr=null)}function Pi(e){Ho=e,k("volume",e)}function Di(e){e&&(Oh=!0),!Mn&&(Mn=!0,k("pause"),Pi(0))}function In(e){!e&&Oh||Mn&&(Mn=!1,k("resume"),Pi(Ho))}function St(e,t){Oi=Math.floor(e||window.innerWidth),Ii=Math.floor(t||window.innerHeight),Bo=Oi>Ii,k("resize",{width:Oi,height:Ii})}function Rw(){if(zc())try{let e=mraid.getMaxSize();St(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?In():Di()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let i=mraid.getMaxSize();St(i.width,i.height)}),mraid.getAudioVolume){let i=mraid.getAudioVolume();Pi(i?1:0)}if(mraid.addEventListener("audioVolumeChange",i=>{i!==null&&Pi(i>0?1:0)}),mraid.addEventListener("error",(i,n)=>{console.warn("mraid error:",i,"action:",n)}),ea=!0,mraid.isViewable()&&mraid.getState()!=="hidden")ct=!0,k("boot"),k("view"),k("ready"),lt=!0,On();else{let i=()=>{ct=!0,k("boot"),k("view"),k("ready"),lt=!0,On()};mraid.addEventListener("ready",i)}}catch(e){console.warn("MRAID hook skipped",e)}}function Mw(){if(Bc())try{let e=dapi.getScreenSize();St(e.width,e.height),dapi.addEventListener("viewableChange",i=>{i.isViewable?In():Di()}),dapi.addEventListener("adResized",i=>{let n=dapi.getScreenSize();St(i.width||n.width,i.height||n.height)});let t=dapi.getAudioVolume();if(Pi(t?1:0),dapi.addEventListener("audioVolumeChange",i=>Pi(i?1:0)),ea=!0,dapi.isViewable())ct=!0,k("boot"),k("view"),k("ready"),lt=!0,On();else{let i=()=>{ct=!0,k("boot"),k("view"),k("ready"),lt=!0,On()};dapi.addEventListener("ready",i)}}catch(e){console.warn("DAPI hook skipped",e)}}function Ch(){let e=()=>{ct||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(ct=!0,k("boot"),k("view"),k("ready"),lt=!0,On(),Rn&&(Rn=!1,ze.start()))};window.addEventListener("resize",()=>St()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(In(),e()):Di()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),ea=!0}function Ow(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(Eh=!0),!(Eh&&t instanceof MouseEvent)&&(Zr+=1,No||(No=!0,k("first_interaction",{count:Zr})),k("interaction",Zr))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function Th(e){var n,r,a,s,o,d,l,c,f,p,u,v;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(Qt())(a=(r=window.TJ_API)==null?void 0:r.click)==null||a.call(r);else if(Fc())(o=(s=window.FbPlayableAd)==null?void 0:s.onCTAClick)==null||o.call(s);else if(Uc())(l=(d=window.ScPlayableAd)==null?void 0:d.onCTAClick)==null||l.call(d);else if($c())try{(f=(c=window.smxTracking)==null?void 0:c.redirect)==null||f.call(c)}catch(h){console.warn("Smadex redirect failed",h)}else if(Nc()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(e||Ri||""):e&&window.open(e)}else Jt()?(p=window.install)==null||p.call(window):Hc()?(u=window.openAppStore)==null||u.call(window):ba()?(v=parent==null?void 0:parent.postMessage)==null||v.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;fe("view",()=>t(i.mraid_viewable)),fe("start",()=>t(i.game_viewable)),fe("engagement",()=>t(i.engagement));let n=()=>t(i.complete);fe("complete",n),qn("engagement",r=>{var a;((a=r==null?void 0:r.payload)==null?void 0:a.count)>3&&n()}),fe("cta_click",()=>t(i.click))}else if(e==="inmobi"){let i=window.INMOBI_DSPMACROS;if(!i)return;fe("view",()=>t(i.Ad_Load_Start)),fe("start",()=>t(i.Ad_Viewable)),fe("engagement",()=>t(i.First_Engagement)),fe("complete",()=>t(i.Gameplay_Complete)),fe("cta_click",()=>t(i.DSP_Click)),fe("start",()=>{[5,10,15,20,25,30].forEach(n=>setTimeout(()=>t(i[`Spent_${n}_Seconds`]),n*1e3))})}}function Pw(){if(!Qt())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{ze.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function kh(){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 Dw(){Jt()&&(window.mintGameStart=()=>{In(!0),St()},window.mintGameClose=()=>{Di(!0)})}function jw(){if(!ya())return;let e=window.NUC;!e||!e.trigger||(ze.on("cta_click",()=>{var t,i;return(i=(t=e.trigger).convert)==null?void 0:i.call(t,Ri)}),ze.on("complete",()=>{var t,i;return(i=(t=e.trigger).tryAgain)==null?void 0:i.call(t)}))}var ze={init(e={},t){var i;if(Mh=e.profile||"web_embed",zo=e.consent||{},Li={...Lh,...e.ids||{}},Mi=e.rootEl||Mi,Ln=void 0,yc((i=e.telemetry)!=null&&i.endpoint?e.telemetry:null),Xt=null,Fo=!1,No=!1,Kr.clear(),Ri=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(Jr=t),k("init"),document.body.oncontextmenu=()=>!1,Ah(),Bw(Mi),qc(),Rw(),Mw(),!ea){if(document.readyState==="complete")Ch();else if(!Sh){Sh=!0;let n=()=>{Ch(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Ow(),Iw(),Pw(),Dw(),jw(),console.log(`%c @handler/playable-sdk %c v${Io} `,"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;"),ct&&!lt&&(k("boot"),k("view"),k("ready"),Rn&&(Rn=!1,ze.start()),lt=!0),lt=ct},getRoot(){return Ah()},get version(){return Io},get maxWidth(){return Oi},get maxHeight(){return Ii},get isLandscape(){return Bo},get isReady(){return lt},get isStarted(){return Po},get isPaused(){return Mn},get isFinished(){return kn},get volume(){return Ho},get interactions(){return Zr},on(e,t){qn(Qr(e),t)},off(e,t){ga(Qr(e),t)},start(){var e,t;if(!Po){if(!ct){Rn=!0;return}if(Po=!0,Xt||(Xt=Date.now()),k("start"),St(),Jt())Di(),(e=window.gameReady)==null||e.call(window);else if(Qt()){let i=window.TJ_API;(t=i==null?void 0:i.setPlayableBuild)==null||t.call(i,{orientation:Bo?"landscape":"portrait",buildID:Io})}}},finish(){var e,t;kn||(kn=!0,k("complete"),jo("complete"),Jt()?(e=window.gameEnd)==null||e.call(window):ba()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):Qt()&&kh())},install(e){if(!kn){kn=!0,Qt()?(kh(),setTimeout(()=>ze.install(e),300)):(k("complete"),setTimeout(()=>ze.install(e),0));return}Do||(Do=!0,setTimeout(()=>Do=!1,500),k("cta_click"),k("conversion"),jo("cta"),Th(e||Ri))},emit(e,t){let i=Qr(e);if(!Lw.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=Ph(i,t);ma(n,!!zo.analytics),Gn(i,n)},gameStart(){ze.start()},gameEnd(){ze.finish()},ctaClick(e,t){k("cta_click",{url:e||Ri,manual:!0}),(t==null?void 0:t.open)!==!1&&Th(e||Ri)},ctaShow(e){k("cta_show",e)},ctaDismiss(e){k("cta_dismiss",e)},getGameTimeMs(){return Ih()},endSession(e="manual"){jo(e)},setAttribution(e){Ln=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(zw(`${Rh}:${e}`))%t.length,n=t[i];return Ln={...Ln||{},experiment_id:e},Li.variant_id=n,k("ab_assign",{experiment_id:e,variant_id:n}),n},levelStart(e,t){Xt||(Xt=Date.now()),k("level_start",{level_id:e,...t})},levelComplete(e,t){k("level_complete",{level_id:e,...t})},levelFail(e,t){k("level_fail",{level_id:e,...t})},checkpoint(e,t){k("checkpoint",{checkpoint_id:e,...t})},reward(e,t){k("reward",{reward_id:e,...t})},tutorialStart(e,t){k("tutorial_start",{step_id:e,...t})},tutorialComplete(e,t){k("tutorial_complete",{step_id:e,...t})},tutorialSkip(e,t){k("tutorial_skip",{step_id:e,...t})},timerStart(e){e&&Kr.set(e,Date.now())},timerEnd(e,t="custom",i){if(!e)return;let n=Kr.get(e);if(!n)return;Kr.delete(e);let r=Date.now()-n;if(!(!Number.isFinite(r)||r<0)){if(t==="custom"){k("engagement",{action:"timer",key:e,duration_ms:r,...i});return}k(t,{key:e,duration_ms:r,...i})}},fps(e,t){k("fps",{value:e,...t})},memory(e,t){k("memory",{bytes:e,...t})},assetLoadStart(e,t){k("asset_load_start",{asset_id:e,...t})},assetLoadComplete(e,t){k("asset_load_complete",{asset_id:e,...t})},reportError(e,t,i){k("error",{code:e,message:t,...i})},retry(){var e,t,i;if(Jt())(e=window.gameRetry)==null||e.call(window);else if(ya()){let n=window.NUC;(i=(t=n==null?void 0:n.trigger)==null?void 0:t.tryAgain)==null||i.call(t)}k("engagement",{action:"retry"})},pause(){Di(!0)},resume(){In(!0)},resize(e,t){St(e,t)}},ei=ze;function zw(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 Bw(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
231
231
  (function(){
232
232
  var events = ['touchstart','touchend','mousedown','keydown'];
233
233
  function unlock(){
@@ -243,7 +243,7 @@ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
243
243
  }
244
244
  events.forEach(function(e){ document.addEventListener(e, unlock, false); });
245
245
  })();
246
- `,e.appendChild(t)}var Ho=(n=>(n[n.PHONE_TALL=0]="PHONE_TALL",n[n.TABLET=1]="TABLET",n[n.LANDSCAPE=2]="LANDSCAPE",n))(Ho||{});function ea(e,t){let i=e/t;return i<=.62?0:i<=.85?1:2}var ji=class{constructor(t,i){this.root=t,this.stage=i,this.uiFrame=document.createElement("div"),this.uiFrame.style.position="absolute",this.uiFrame.style.top="0",this.uiFrame.style.bottom="0",this.uiFrame.style.left="50%",this.uiFrame.style.transform="translateX(-50%)",this.uiFrame.style.width="100%",this.uiFrame.style.maxWidth="420px",this.uiFrame.style.pointerEvents="none",this.stage.appendChild(this.uiFrame),this.uiContainer=document.createElement("div"),this.uiContainer.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","justify-content:flex-start","gap:12px","pointer-events:none","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),this.uiFrame.appendChild(this.uiContainer),this.updateLayout()}getUIFrame(){return this.uiFrame}getUIContainer(){return this.uiContainer}updateLayout(){let t=this.stage.getBoundingClientRect(),i=ea(t.width,t.height);i===0?this.uiFrame.style.maxWidth="420px":i===1?this.uiFrame.style.maxWidth="520px":this.uiFrame.style.maxWidth="640px"}getAspectClass(){let t=this.stage.getBoundingClientRect();return ea(t.width,t.height)}};async function kh(e,t={}){let i=()=>{let b=e.getBoundingClientRect(),g=Math.floor(b.width),w=Math.floor(b.height);return(g<=0||!isFinite(g)||g!==g)&&(g=e.clientWidth||window.innerWidth||320),(w<=0||!isFinite(w)||w!==w)&&(w=e.clientHeight||window.innerHeight||480),(g<=0||!isFinite(g)||g!==g)&&(g=320),(w<=0||!isFinite(w)||w!==w)&&(w=480),console.log("[THREE-BASE] getSize result:",{width:g,height:w,boundingRect:{width:b.width,height:b.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleWidth:e.style.width,styleHeight:e.style.height,note:"Using boundingRect as primary source (actual rendered size)"}),{width:g,height:w}},n=e.style.width&&!e.style.width.includes("%"),r=e.style.height&&!e.style.height.includes("%");e.style.position||(e.style.position="relative"),e.style.display||(e.style.display="block"),e.style.width=e.style.width||"100%",e.style.height=e.style.height||"100%",e.style.minWidth="100%",e.style.minHeight="100%",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.boxSizing="border-box",e.style.overflow="hidden",e.style.margin="0",e.style.padding="0",e.style.border="none";let a=t.background||"linear-gradient(160deg, #0d1020, #0f1c2f)";e.style.setProperty("background",a,"important"),e.style.setProperty("background-size","cover","important"),e.style.setProperty("background-position","center","important"),e.style.setProperty("background-repeat","no-repeat","important");let s=document.createElement("div");s.style.cssText=`
246
+ `,e.appendChild(t)}var $o=(n=>(n[n.PHONE_TALL=0]="PHONE_TALL",n[n.TABLET=1]="TABLET",n[n.LANDSCAPE=2]="LANDSCAPE",n))($o||{});function ta(e,t){let i=e/t;return i<=.62?0:i<=.85?1:2}var ji=class{constructor(t,i){this.root=t,this.stage=i,this.uiFrame=document.createElement("div"),this.uiFrame.style.position="absolute",this.uiFrame.style.top="0",this.uiFrame.style.bottom="0",this.uiFrame.style.left="50%",this.uiFrame.style.transform="translateX(-50%)",this.uiFrame.style.width="100%",this.uiFrame.style.maxWidth="420px",this.uiFrame.style.pointerEvents="none",this.stage.appendChild(this.uiFrame),this.uiContainer=document.createElement("div"),this.uiContainer.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","justify-content:flex-start","gap:12px","pointer-events:none","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),this.uiFrame.appendChild(this.uiContainer),this.updateLayout()}getUIFrame(){return this.uiFrame}getUIContainer(){return this.uiContainer}updateLayout(){let t=this.stage.getBoundingClientRect(),i=ta(t.width,t.height);i===0?this.uiFrame.style.maxWidth="420px":i===1?this.uiFrame.style.maxWidth="520px":this.uiFrame.style.maxWidth="640px"}getAspectClass(){let t=this.stage.getBoundingClientRect();return ta(t.width,t.height)}};async function Dh(e,t={}){let i=()=>{let b=e.getBoundingClientRect(),g=Math.floor(b.width),x=Math.floor(b.height);return(g<=0||!isFinite(g)||g!==g)&&(g=e.clientWidth||window.innerWidth||320),(x<=0||!isFinite(x)||x!==x)&&(x=e.clientHeight||window.innerHeight||480),(g<=0||!isFinite(g)||g!==g)&&(g=320),(x<=0||!isFinite(x)||x!==x)&&(x=480),console.log("[THREE-BASE] getSize result:",{width:g,height:x,boundingRect:{width:b.width,height:b.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleWidth:e.style.width,styleHeight:e.style.height,note:"Using boundingRect as primary source (actual rendered size)"}),{width:g,height:x}},n=e.style.width&&!e.style.width.includes("%"),r=e.style.height&&!e.style.height.includes("%");e.style.position||(e.style.position="relative"),e.style.display||(e.style.display="block"),e.style.width=e.style.width||"100%",e.style.height=e.style.height||"100%",e.style.minWidth="100%",e.style.minHeight="100%",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.boxSizing="border-box",e.style.overflow="hidden",e.style.margin="0",e.style.padding="0",e.style.border="none";let a=t.background||"linear-gradient(160deg, #0d1020, #0f1c2f)";e.style.setProperty("background",a,"important"),e.style.setProperty("background-size","cover","important"),e.style.setProperty("background-position","center","important"),e.style.setProperty("background-repeat","no-repeat","important");let s=document.createElement("div");s.style.cssText=`
247
247
  position: absolute !important;
248
248
  inset: 0 !important;
249
249
  width: 100% !important;
@@ -264,17 +264,17 @@ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
264
264
  padding: 0 !important;
265
265
  border: none !important;
266
266
  overflow: hidden !important;
267
- `,e.appendChild(s);let o=document.createElement("div");o.setAttribute("style",["position:absolute","inset:0","width:100%","height:100%","min-width:100%","min-height:100%","max-width:100%","max-height:100%","pointer-events:auto","box-sizing:border-box","margin:0","padding:0","overflow:hidden"].join(";")),s.appendChild(o);let d=new Te.Scene,{width:l,height:c}=i(),f=new Te.AmbientLight(16777215,.6);d.add(f);let u=new Te.DirectionalLight(16777215,.8);u.position.set(5,5,5),u.castShadow=!1,d.add(u);let p=new Te.DirectionalLight(16777215,.3);p.position.set(-5,0,5),d.add(p);let v=new Te.PerspectiveCamera(55,l/c,.1,100);v.position.set(0,0,3.2),v.lookAt(0,0,0),v.updateMatrixWorld();let h=new Te.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});h.setPixelRatio(window.devicePixelRatio||1),h.setSize(l,c),h.setClearColor(0,0),h.domElement.style.position="absolute",h.domElement.style.top="0",h.domElement.style.left="0",h.domElement.style.right="0",h.domElement.style.bottom="0",h.domElement.style.width="100%",h.domElement.style.height="100%",h.domElement.style.minWidth="100%",h.domElement.style.minHeight="100%",h.domElement.style.maxWidth="100%",h.domElement.style.maxHeight="100%",h.domElement.style.display="block",h.domElement.style.pointerEvents="auto",h.domElement.style.margin="0",h.domElement.style.padding="0",h.domElement.style.boxSizing="border-box",o.appendChild(h.domElement);let x=b=>{var _;let g=e.getBoundingClientRect(),w=window.getComputedStyle(e);console.log("[THREE-BASE] applySize called:",{providedSize:b,rootRect:{width:g.width,height:g.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleSize:{width:e.style.width,height:e.style.height},computedStyle:{width:w.width,height:w.height,transform:w.transform,scale:w.scale},rendererCurrentSize:{width:h.domElement.width,height:h.domElement.height},rendererStyleSize:{width:h.domElement.style.width,height:h.domElement.style.height},stackTrace:(_=new Error().stack)==null?void 0:_.split(`
267
+ `,e.appendChild(s);let o=document.createElement("div");o.setAttribute("style",["position:absolute","inset:0","width:100%","height:100%","min-width:100%","min-height:100%","max-width:100%","max-height:100%","pointer-events:auto","box-sizing:border-box","margin:0","padding:0","overflow:hidden"].join(";")),s.appendChild(o);let d=new Te.Scene,{width:l,height:c}=i(),f=new Te.AmbientLight(16777215,.6);d.add(f);let p=new Te.DirectionalLight(16777215,.8);p.position.set(5,5,5),p.castShadow=!1,d.add(p);let u=new Te.DirectionalLight(16777215,.3);u.position.set(-5,0,5),d.add(u);let v=new Te.PerspectiveCamera(55,l/c,.1,100);v.position.set(0,0,3.2),v.lookAt(0,0,0),v.updateMatrixWorld();let h=new Te.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});h.setPixelRatio(window.devicePixelRatio||1),h.setSize(l,c),h.setClearColor(0,0),h.domElement.style.position="absolute",h.domElement.style.top="0",h.domElement.style.left="0",h.domElement.style.right="0",h.domElement.style.bottom="0",h.domElement.style.width="100%",h.domElement.style.height="100%",h.domElement.style.minWidth="100%",h.domElement.style.minHeight="100%",h.domElement.style.maxWidth="100%",h.domElement.style.maxHeight="100%",h.domElement.style.display="block",h.domElement.style.pointerEvents="auto",h.domElement.style.margin="0",h.domElement.style.padding="0",h.domElement.style.boxSizing="border-box",o.appendChild(h.domElement);let w=b=>{var _;let g=e.getBoundingClientRect(),x=window.getComputedStyle(e);console.log("[THREE-BASE] applySize called:",{providedSize:b,rootRect:{width:g.width,height:g.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleSize:{width:e.style.width,height:e.style.height},computedStyle:{width:x.width,height:x.height,transform:x.transform,scale:x.scale},rendererCurrentSize:{width:h.domElement.width,height:h.domElement.height},rendererStyleSize:{width:h.domElement.style.width,height:h.domElement.style.height},stackTrace:(_=new Error().stack)==null?void 0:_.split(`
268
268
  `).slice(1,4).join(`
269
- `)});let C=g.width,S=g.height;if((C<=0||!isFinite(C))&&(console.warn("[THREE-BASE] Invalid boundingRect.width, using clientWidth fallback",{boundingRectWidth:g.width,clientWidth:e.clientWidth}),C=e.clientWidth||window.innerWidth||320),(S<=0||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid boundingRect.height, using clientHeight fallback",{boundingRectHeight:g.height,clientHeight:e.clientHeight}),S=e.clientHeight||window.innerHeight||480),typeof(b==null?void 0:b.width)=="number"&&b.width>0){let I=Math.abs(b.width-g.width),z=g.width*.1;I>z?console.warn("[THREE-BASE] Provided width ignored (too different from container):",{provided:b.width,container:g.width,difference:I,tolerance:z,willUse:"container size (boundingRect)"}):(C=b.width,console.log("[THREE-BASE] Using provided width (within tolerance):",{provided:b.width,container:g.width}))}if(typeof(b==null?void 0:b.height)=="number"&&b.height>0){let I=Math.abs(b.height-g.height),z=g.height*.1;I>z?console.warn("[THREE-BASE] Provided height ignored (too different from container):",{provided:b.height,container:g.height,difference:I,tolerance:z,willUse:"container size (boundingRect)"}):(S=b.height,console.log("[THREE-BASE] Using provided height (within tolerance):",{provided:b.height,container:g.height}))}(C<=0||S<=0||!isFinite(C)||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid size in applySize, using fallback",{newWidth:C,newHeight:S,size:b,rootRect:g}),C=g.width||e.clientWidth||320,S=g.height||e.clientHeight||480);let A=Math.floor(C),T=Math.floor(S);console.log("[THREE-BASE] applySize setting renderer size:",{finalWidth:A,finalHeight:T,aspectRatio:A/T,beforeRendererSize:{width:h.domElement.width,height:h.domElement.height},beforeRendererStyle:{width:h.domElement.style.width,height:h.domElement.style.height}}),h.setSize(A,T),h.setPixelRatio(window.devicePixelRatio||1),v.aspect=A/T,v.updateProjectionMatrix();let L=e.getBoundingClientRect();console.log("[THREE-BASE] applySize after setting:",{rendererSize:{width:h.domElement.width,height:h.domElement.height},rendererStyle:{width:h.domElement.style.width,height:h.domElement.style.height},containerRect:{width:L.width,height:L.height},cameraAspect:v.aspect,matches:{width:Math.abs(h.domElement.width-L.width)<1,height:Math.abs(h.domElement.height-L.height)<1},sizeDifference:{width:h.domElement.width-L.width,height:h.domElement.height-L.height}})};requestAnimationFrame(()=>{requestAnimationFrame(()=>{x()})});let m=!1;ei.on("pause",()=>{m=!0,document.querySelectorAll("audio").forEach(g=>g.pause())}),ei.on("resume",()=>{m=!1,document.querySelectorAll("audio").forEach(g=>{g.currentTime>0&&!g.ended&&g.play().catch(()=>{})})});let y=new ji(e,s);return ei.on("resize",({payload:b})=>{console.log("[THREE-BASE] Handler resize event received:",{payload:b,timestamp:Date.now(),rootRect:e.getBoundingClientRect()}),x({width:b==null?void 0:b.width,height:b==null?void 0:b.height}),y.updateLayout()}),window.addEventListener("resize",()=>{console.log("[THREE-BASE] Window resize event received:",{timestamp:Date.now(),windowSize:{width:window.innerWidth,height:window.innerHeight},rootRect:e.getBoundingClientRect()}),x(),y.updateLayout()}),{scene:d,camera:v,renderer:h,uiSystem:y,applySize:x}}var ee=Ge(require("three"),1),In=class{constructor(t){var i,n;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(i=t==null?void 0:t.scale)!=null?i:1,this.rotation=(n=t==null?void 0:t.rotation)!=null?n:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToThree(t){let i=t.position.z,n=i===0||!isFinite(i)?.5:i;t.position.set(this.position.x,this.position.y,n),t.scale.set(this.scale,this.scale,this.scale),t.rotation.z=this.rotation}},Pn=class{constructor(t){var i,n,r,a;this.z_index=(i=t==null?void 0:t.z_index)!=null?i:0,this.alpha=(n=t==null?void 0:t.alpha)!=null?n:1,this.visible=(r=t==null?void 0:t.visible)!=null?r:!0,this.tint=(a=t==null?void 0:t.tint)!=null?a:null}update(t){t.z_index!==void 0&&(this.z_index=t.z_index),t.alpha!==void 0&&(this.alpha=t.alpha),t.visible!==void 0&&(this.visible=t.visible),t.tint!==void 0&&(this.tint=t.tint)}syncToThree(t){if(t.renderOrder=this.z_index,t.visible=this.visible,t instanceof ee.Mesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(i=>{i instanceof ee.Material&&(i.opacity=this.alpha,i.transparent=this.alpha<1)}):t.material instanceof ee.Material&&(t.material.opacity=this.alpha,t.material.transparent=this.alpha<1)),this.tint!==null&&t instanceof ee.Mesh&&t.material){let i=typeof this.tint=="string"?new ee.Color(this.tint):new ee.Color(this.tint);Array.isArray(t.material)?t.material.forEach(n=>{(n instanceof ee.MeshBasicMaterial||n instanceof ee.MeshStandardMaterial)&&n.color.copy(i)}):(t.material instanceof ee.MeshBasicMaterial||t.material instanceof ee.MeshStandardMaterial)&&t.material.color.copy(i)}}},Dn=class{constructor(t,i,n,r){this.instanceId=t,this.objectConfig=i,this.threeObject=n,this._config=r,this.transform=new In(r.transform),this.renderer=new Pn(r.render),this.sync()}sync(){this.transform.syncToThree(this.threeObject),this.renderer.syncToThree(this.threeObject)}updateConfig(t){this._config=t,t.transform&&this.transform.update(t.transform),t.render&&this.renderer.update(t.render),this.sync()}getComponent(t){return this._config[t]}getPosition(){return{...this.transform.position}}setPosition(t,i){this.transform.position={x:t,y:i},this.transform.syncToThree(this.threeObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToThree(this.threeObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToThree(this.threeObject)}},ta=class{constructor(t){this.objects=new Map;this.config=t}create(t,i){let n=this.config.objects.get(t);if(!n)throw new Error(`Object config not found: ${t}`);let r=new Dn(t,n.object_config||t,i,n);return this.objects.set(t,r),r}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[i,n]of this.objects.entries()){let r=t.objects.get(i);r&&n.updateConfig(r)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var ia={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function Be(e){let t=ia[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function Fe(e){var i;let t=ia[e];return t&&(i=t.weight)!=null?i:"400"}function Lh(e,t){ia[e]=t}function Rh(){return Object.keys(ia)}var zi=Ge(require("three"),1);function Kt(e){return{element:e,get alpha(){return parseFloat(e.style.opacity||"1")},set alpha(t){e.style.opacity=t.toString()},get visible(){return e.style.display!=="none"},set visible(t){e.style.display=t?"":"none"},position:{set(t,i){e.style.left=`${t}px`,e.style.top=`${i}px`},get x(){return parseFloat(e.style.left||"0")},get y(){return parseFloat(e.style.top||"0")}},scale:{set(t,i){e.style.transform=`scale(${t})`},get x(){let t=e.style.transform.match(/scale\(([^)]+)\)/);return t?parseFloat(t[1]):1}}}}function Mh(e,t,i,n){var sl,ol,ll,cl,dl,ul,pl,fl,hl,gl,ml,bl,yl,vl,xl,wl,_l,El,Sl,Al,Cl,Tl,kl,Ll,Rl,Ml,Ol,Il,Pl,Dl,jl,zl,Bl,Fl,Nl,Hl,$l,Ul,ql,Gl,Wl,Yl,Vl,Xl,Kl,Zl,Jl,Ql,ec,tc,ic,nc,rc,ac,sc,oc,lc,cc,dc,uc,pc;let r=e.objects.get("ui_endgame_1"),a=e.objects.get("ui_endgame_logo_1"),s=e.objects.get("ui_endgame_title_1"),o=e.objects.get("ui_endgame_subtitle_1"),d=e.objects.get("ui_endgame_footer_1"),l=e.objects.get("ui_endgame_cta_1"),c=e.objects.get("ui_endgame_cta_hint_1"),f=e.objects.get("ui_endgame_hand_1"),u=e.engine.runtime||{},p=((sl=r==null?void 0:r.gameplay)==null?void 0:sl.tuning)||{},v=(r==null?void 0:r.render)||{},h=n.getBoundingClientRect(),x=h.width>0?h.width*.9:320,m=h.height>0?h.height*.85:400,y=Math.min((ol=p.panel_width)!=null?ol:320,x),b=Math.min((ll=p.panel_height)!=null?ll:400,m),g=(cl=p.panel_padding)!=null?cl:32,w=(dl=p.panel_radius)!=null?dl:24,C=v.background_color||p.panel_bg_color||"#1a0a0a",S=v.background_alpha!==void 0&&v.background_alpha!==null?v.background_alpha:(ul=p.panel_bg_alpha)!=null?ul:.98,A=v.border_color||p.panel_border_color||"#ffffff",T=(pl=p.panel_border_width)!=null?pl:2,L=(fl=p.panel_border_alpha)!=null?fl:.3,_=document.createElement("div");_.style.cssText=`
269
+ `)});let E=g.width,A=g.height;if((E<=0||!isFinite(E))&&(console.warn("[THREE-BASE] Invalid boundingRect.width, using clientWidth fallback",{boundingRectWidth:g.width,clientWidth:e.clientWidth}),E=e.clientWidth||window.innerWidth||320),(A<=0||!isFinite(A))&&(console.warn("[THREE-BASE] Invalid boundingRect.height, using clientHeight fallback",{boundingRectHeight:g.height,clientHeight:e.clientHeight}),A=e.clientHeight||window.innerHeight||480),typeof(b==null?void 0:b.width)=="number"&&b.width>0){let I=Math.abs(b.width-g.width),z=g.width*.1;I>z?console.warn("[THREE-BASE] Provided width ignored (too different from container):",{provided:b.width,container:g.width,difference:I,tolerance:z,willUse:"container size (boundingRect)"}):(E=b.width,console.log("[THREE-BASE] Using provided width (within tolerance):",{provided:b.width,container:g.width}))}if(typeof(b==null?void 0:b.height)=="number"&&b.height>0){let I=Math.abs(b.height-g.height),z=g.height*.1;I>z?console.warn("[THREE-BASE] Provided height ignored (too different from container):",{provided:b.height,container:g.height,difference:I,tolerance:z,willUse:"container size (boundingRect)"}):(A=b.height,console.log("[THREE-BASE] Using provided height (within tolerance):",{provided:b.height,container:g.height}))}(E<=0||A<=0||!isFinite(E)||!isFinite(A))&&(console.warn("[THREE-BASE] Invalid size in applySize, using fallback",{newWidth:E,newHeight:A,size:b,rootRect:g}),E=g.width||e.clientWidth||320,A=g.height||e.clientHeight||480);let C=Math.floor(E),T=Math.floor(A);console.log("[THREE-BASE] applySize setting renderer size:",{finalWidth:C,finalHeight:T,aspectRatio:C/T,beforeRendererSize:{width:h.domElement.width,height:h.domElement.height},beforeRendererStyle:{width:h.domElement.style.width,height:h.domElement.style.height}}),h.setSize(C,T),h.setPixelRatio(window.devicePixelRatio||1),v.aspect=C/T,v.updateProjectionMatrix();let L=e.getBoundingClientRect();console.log("[THREE-BASE] applySize after setting:",{rendererSize:{width:h.domElement.width,height:h.domElement.height},rendererStyle:{width:h.domElement.style.width,height:h.domElement.style.height},containerRect:{width:L.width,height:L.height},cameraAspect:v.aspect,matches:{width:Math.abs(h.domElement.width-L.width)<1,height:Math.abs(h.domElement.height-L.height)<1},sizeDifference:{width:h.domElement.width-L.width,height:h.domElement.height-L.height}})};requestAnimationFrame(()=>{requestAnimationFrame(()=>{w()})});let y=!1;ei.on("pause",()=>{y=!0,document.querySelectorAll("audio").forEach(g=>g.pause())}),ei.on("resume",()=>{y=!1,document.querySelectorAll("audio").forEach(g=>{g.currentTime>0&&!g.ended&&g.play().catch(()=>{})})});let m=new ji(e,s);return ei.on("resize",({payload:b})=>{console.log("[THREE-BASE] Handler resize event received:",{payload:b,timestamp:Date.now(),rootRect:e.getBoundingClientRect()}),w({width:b==null?void 0:b.width,height:b==null?void 0:b.height}),m.updateLayout()}),window.addEventListener("resize",()=>{console.log("[THREE-BASE] Window resize event received:",{timestamp:Date.now(),windowSize:{width:window.innerWidth,height:window.innerHeight},rootRect:e.getBoundingClientRect()}),w(),m.updateLayout()}),{scene:d,camera:v,renderer:h,uiSystem:m,applySize:w}}var ee=Ge(require("three"),1),Pn=class{constructor(t){var i,n;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(i=t==null?void 0:t.scale)!=null?i:1,this.rotation=(n=t==null?void 0:t.rotation)!=null?n:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToThree(t){let i=t.position.z,n=i===0||!isFinite(i)?.5:i;t.position.set(this.position.x,this.position.y,n),t.scale.set(this.scale,this.scale,this.scale),t.rotation.z=this.rotation}},Dn=class{constructor(t){var i,n,r,a;this.z_index=(i=t==null?void 0:t.z_index)!=null?i:0,this.alpha=(n=t==null?void 0:t.alpha)!=null?n:1,this.visible=(r=t==null?void 0:t.visible)!=null?r:!0,this.tint=(a=t==null?void 0:t.tint)!=null?a:null}update(t){t.z_index!==void 0&&(this.z_index=t.z_index),t.alpha!==void 0&&(this.alpha=t.alpha),t.visible!==void 0&&(this.visible=t.visible),t.tint!==void 0&&(this.tint=t.tint)}syncToThree(t){if(t.renderOrder=this.z_index,t.visible=this.visible,t instanceof ee.Mesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(i=>{i instanceof ee.Material&&(i.opacity=this.alpha,i.transparent=this.alpha<1)}):t.material instanceof ee.Material&&(t.material.opacity=this.alpha,t.material.transparent=this.alpha<1)),this.tint!==null&&t instanceof ee.Mesh&&t.material){let i=typeof this.tint=="string"?new ee.Color(this.tint):new ee.Color(this.tint);Array.isArray(t.material)?t.material.forEach(n=>{(n instanceof ee.MeshBasicMaterial||n instanceof ee.MeshStandardMaterial)&&n.color.copy(i)}):(t.material instanceof ee.MeshBasicMaterial||t.material instanceof ee.MeshStandardMaterial)&&t.material.color.copy(i)}}},jn=class{constructor(t,i,n,r){this.instanceId=t,this.objectConfig=i,this.threeObject=n,this._config=r,this.transform=new Pn(r.transform),this.renderer=new Dn(r.render),this.sync()}sync(){this.transform.syncToThree(this.threeObject),this.renderer.syncToThree(this.threeObject)}updateConfig(t){this._config=t,t.transform&&this.transform.update(t.transform),t.render&&this.renderer.update(t.render),this.sync()}getComponent(t){return this._config[t]}getPosition(){return{...this.transform.position}}setPosition(t,i){this.transform.position={x:t,y:i},this.transform.syncToThree(this.threeObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToThree(this.threeObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToThree(this.threeObject)}},ia=class{constructor(t){this.objects=new Map;this.config=t}create(t,i){let n=this.config.objects.get(t);if(!n)throw new Error(`Object config not found: ${t}`);let r=new jn(t,n.object_config||t,i,n);return this.objects.set(t,r),r}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[i,n]of this.objects.entries()){let r=t.objects.get(i);r&&n.updateConfig(r)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var na={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function Be(e){let t=na[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function Fe(e){var i;let t=na[e];return t&&(i=t.weight)!=null?i:"400"}function jh(e,t){na[e]=t}function zh(){return Object.keys(na)}var zi=Ge(require("three"),1);function Kt(e){return{element:e,get alpha(){return parseFloat(e.style.opacity||"1")},set alpha(t){e.style.opacity=t.toString()},get visible(){return e.style.display!=="none"},set visible(t){e.style.display=t?"":"none"},position:{set(t,i){e.style.left=`${t}px`,e.style.top=`${i}px`},get x(){return parseFloat(e.style.left||"0")},get y(){return parseFloat(e.style.top||"0")}},scale:{set(t,i){e.style.transform=`scale(${t})`},get x(){let t=e.style.transform.match(/scale\(([^)]+)\)/);return t?parseFloat(t[1]):1}}}}function Bh(e,t,i,n){var ol,ll,cl,dl,ul,pl,fl,hl,gl,ml,bl,yl,vl,xl,wl,_l,El,Sl,Al,Cl,Tl,kl,Ll,Rl,Ml,Ol,Il,Pl,Dl,jl,zl,Bl,Fl,Nl,Hl,$l,Ul,ql,Gl,Wl,Yl,Vl,Xl,Kl,Zl,Jl,Ql,ec,tc,ic,nc,rc,ac,sc,oc,lc,cc,dc,uc,pc,fc;let r=e.objects.get("ui_endgame_1"),a=e.objects.get("ui_endgame_logo_1"),s=e.objects.get("ui_endgame_title_1"),o=e.objects.get("ui_endgame_subtitle_1"),d=e.objects.get("ui_endgame_footer_1"),l=e.objects.get("ui_endgame_cta_1"),c=e.objects.get("ui_endgame_cta_hint_1"),f=e.objects.get("ui_endgame_hand_1"),p=e.engine.runtime||{},u=((ol=r==null?void 0:r.gameplay)==null?void 0:ol.tuning)||{},v=(r==null?void 0:r.render)||{},h=n.getBoundingClientRect(),w=h.width>0?h.width*.9:320,y=h.height>0?h.height*.85:400,m=Math.min((ll=u.panel_width)!=null?ll:320,w),b=Math.min((cl=u.panel_height)!=null?cl:400,y),g=(dl=u.panel_padding)!=null?dl:32,x=(ul=u.panel_radius)!=null?ul:24,E=v.background_color||u.panel_bg_color||"#1a0a0a",A=v.background_alpha!==void 0&&v.background_alpha!==null?v.background_alpha:(pl=u.panel_bg_alpha)!=null?pl:.98,C=v.border_color||u.panel_border_color||"#ffffff",T=(fl=u.panel_border_width)!=null?fl:2,L=(hl=u.panel_border_alpha)!=null?hl:.3,_=document.createElement("div");_.style.cssText=`
270
270
  position: absolute;
271
- width: ${y}px;
271
+ width: ${m}px;
272
272
  height: ${b}px;
273
- background: ${C};
274
- opacity: ${S};
275
- border: ${T}px solid ${A};
273
+ background: ${E};
274
+ opacity: ${A};
275
+ border: ${T}px solid ${C};
276
276
  border-opacity: ${L};
277
- border-radius: ${w}px;
277
+ border-radius: ${x}px;
278
278
  display: block;
279
279
  transform: translate(-50%, -50%);
280
280
  opacity: 0;
@@ -285,79 +285,79 @@ Style guidelines: ${n.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
285
285
  z-index: 1000;
286
286
  box-sizing: border-box;
287
287
  padding: ${g}px;
288
- `,n.appendChild(_);let I=Kt(_);I.element=_;let z=((hl=a==null?void 0:a.gameplay)==null?void 0:hl.tuning)||{},le=(a==null?void 0:a.transform)||{},te=(gl=z.logo_size)!=null?gl:56,ne=(ml=le.scale)!=null?ml:1,xe=(yl=(bl=le.offset)==null?void 0:bl.y)!=null?yl:-130,Ne=(vl=z.logo_alpha)!=null?vl:1,Hh=new zi.SpriteMaterial({map:i||void 0,transparent:!0,alphaTest:.1}),ke=new zi.Sprite(Hh);ke.position.set(0,xe,0),ke.material.opacity=0;let jn=0,zn=0;if(i){let re=i.image;jn=(re==null?void 0:re.width)||100,zn=(re==null?void 0:re.height)||100}if(jn>0&&zn>0){let re=jn/zn,pa,fa;re>1?(pa=te,fa=te/re):(fa=te,pa=te*re);let Cg=pa/jn*ne,Tg=fa/zn*ne;ke.scale.set(Cg,Tg,1)}else{let re=te/100*ne;ke.scale.set(re,re,1)}ke.targetAlpha=Ne,ke.baseScaleX=ke.scale.x,ke.baseScaleY=ke.scale.y;let ce=s==null?void 0:s.ui,He=((xl=s==null?void 0:s.gameplay)==null?void 0:xl.tuning)||{},$h=(ce==null?void 0:ce.text)||"MISSION ACCOMPLISHED",Go=(ce==null?void 0:ce.font)||"brand.heading",ra=(ce==null?void 0:ce.fontSize)||24,Uh=(wl=ce==null?void 0:ce.letterSpacing)!=null?wl:1,Bn=(_l=s==null?void 0:s.render)==null?void 0:_l.tint,qh=typeof Bn=="string"?Bn:Bn?`#${Bn.toString(16).padStart(6,"0")}`:"#00FF88",Gh=y-g*2-30,Wh=He.font_weight_override?He.font_weight_override:Fe(Go),At=document.createElement("div");At.textContent=$h,At.style.cssText=`
289
- font-family: ${Be(Go)};
290
- font-size: ${ra}px;
291
- font-weight: ${Wh};
292
- color: ${qh};
288
+ `,n.appendChild(_);let I=Kt(_);I.element=_;let z=((gl=a==null?void 0:a.gameplay)==null?void 0:gl.tuning)||{},le=(a==null?void 0:a.transform)||{},te=(ml=z.logo_size)!=null?ml:56,ne=(bl=le.scale)!=null?bl:1,xe=(vl=(yl=le.offset)==null?void 0:yl.y)!=null?vl:-130,Ne=(xl=z.logo_alpha)!=null?xl:1,Vh=new zi.SpriteMaterial({map:i||void 0,transparent:!0,alphaTest:.1}),ke=new zi.Sprite(Vh);ke.position.set(0,xe,0),ke.material.opacity=0;let zn=0,Bn=0;if(i){let re=i.image;zn=(re==null?void 0:re.width)||100,Bn=(re==null?void 0:re.height)||100}if(zn>0&&Bn>0){let re=zn/Bn,fa,ha;re>1?(fa=te,ha=te/re):(ha=te,fa=te*re);let Ig=fa/zn*ne,Pg=ha/Bn*ne;ke.scale.set(Ig,Pg,1)}else{let re=te/100*ne;ke.scale.set(re,re,1)}ke.targetAlpha=Ne,ke.baseScaleX=ke.scale.x,ke.baseScaleY=ke.scale.y;let ce=s==null?void 0:s.ui,He=((wl=s==null?void 0:s.gameplay)==null?void 0:wl.tuning)||{},Xh=(ce==null?void 0:ce.text)||"MISSION ACCOMPLISHED",Wo=(ce==null?void 0:ce.font)||"brand.heading",aa=(ce==null?void 0:ce.fontSize)||24,Kh=(_l=ce==null?void 0:ce.letterSpacing)!=null?_l:1,Fn=(El=s==null?void 0:s.render)==null?void 0:El.tint,Zh=typeof Fn=="string"?Fn:Fn?`#${Fn.toString(16).padStart(6,"0")}`:"#00FF88",Jh=m-g*2-30,Qh=He.font_weight_override?He.font_weight_override:Fe(Wo),At=document.createElement("div");At.textContent=Xh,At.style.cssText=`
289
+ font-family: ${Be(Wo)};
290
+ font-size: ${aa}px;
291
+ font-weight: ${Qh};
292
+ color: ${Zh};
293
293
  text-align: center;
294
- letter-spacing: ${Uh}px;
295
- -webkit-text-stroke: ${(El=He.stroke_width)!=null?El:2}px ${He.stroke_color||"#000000"};
296
- text-shadow: ${(Sl=He.shadow_distance)!=null?Sl:4}px ${(Al=He.shadow_distance)!=null?Al:4}px ${(Cl=He.shadow_blur)!=null?Cl:8}px rgba(0,0,0,${(Tl=He.shadow_alpha)!=null?Tl:.9});
294
+ letter-spacing: ${Kh}px;
295
+ -webkit-text-stroke: ${(Sl=He.stroke_width)!=null?Sl:2}px ${He.stroke_color||"#000000"};
296
+ text-shadow: ${(Al=He.shadow_distance)!=null?Al:4}px ${(Cl=He.shadow_distance)!=null?Cl:4}px ${(Tl=He.shadow_blur)!=null?Tl:8}px rgba(0,0,0,${(kl=He.shadow_alpha)!=null?kl:.9});
297
297
  opacity: 0;
298
298
  position: absolute;
299
299
  transform: translate(-50%, -50%);
300
300
  white-space: nowrap;
301
- max-width: ${Gh}px;
302
- `;let Wo=g+30,Yh=((kl=p.title_offset_y)!=null?kl:Wo+ra/2)+((Ll=He.animation_start_y_offset)!=null?Ll:-20);At.style.top=`${Yh}px`,At.style.left="50%";let Yo=Kt(At);Yo.element=At,_.appendChild(At);let de=o==null?void 0:o.ui,Vo=((Rl=o==null?void 0:o.gameplay)==null?void 0:Rl.tuning)||{},Vh=(de==null?void 0:de.text)||"RESCUE COMPLETE",Xo=(de==null?void 0:de.font)||"brand.body",aa=(de==null?void 0:de.fontSize)||11,Xh=(Ml=de==null?void 0:de.letterSpacing)!=null?Ml:.5,Fn=(Ol=o==null?void 0:o.render)==null?void 0:Ol.tint,Kh=typeof Fn=="string"?Fn:Fn?`#${Fn.toString(16).padStart(6,"0")}`:"#B0B0B0",Ct=document.createElement("div");Ct.textContent=Vh,Ct.style.cssText=`
303
- font-family: ${Be(Xo)};
304
- font-size: ${aa}px;
305
- font-weight: ${Fe(Xo)};
306
- color: ${Kh};
301
+ max-width: ${Jh}px;
302
+ `;let Yo=g+30,eg=((Ll=u.title_offset_y)!=null?Ll:Yo+aa/2)+((Rl=He.animation_start_y_offset)!=null?Rl:-20);At.style.top=`${eg}px`,At.style.left="50%";let Vo=Kt(At);Vo.element=At,_.appendChild(At);let de=o==null?void 0:o.ui,Xo=((Ml=o==null?void 0:o.gameplay)==null?void 0:Ml.tuning)||{},tg=(de==null?void 0:de.text)||"RESCUE COMPLETE",Ko=(de==null?void 0:de.font)||"brand.body",sa=(de==null?void 0:de.fontSize)||11,ig=(Ol=de==null?void 0:de.letterSpacing)!=null?Ol:.5,Nn=(Il=o==null?void 0:o.render)==null?void 0:Il.tint,ng=typeof Nn=="string"?Nn:Nn?`#${Nn.toString(16).padStart(6,"0")}`:"#B0B0B0",Ct=document.createElement("div");Ct.textContent=tg,Ct.style.cssText=`
303
+ font-family: ${Be(Ko)};
304
+ font-size: ${sa}px;
305
+ font-weight: ${Fe(Ko)};
306
+ color: ${ng};
307
307
  text-align: center;
308
- letter-spacing: ${Xh}px;
308
+ letter-spacing: ${ig}px;
309
309
  opacity: 0;
310
310
  position: absolute;
311
311
  transform: translate(-50%, -50%);
312
312
  white-space: nowrap;
313
- `;let Ko=Wo+ra+15,Zh=((Il=p.subtitle_offset_y)!=null?Il:Ko+aa/2)+((Pl=Vo.animation_start_y_offset)!=null?Pl:-10);Ct.style.top=`${Zh}px`,Ct.style.left="50%";let sa=Kt(Ct);sa.element=Ct,sa.animationStartYOffset=(Dl=Vo.animation_start_y_offset)!=null?Dl:-10,_.appendChild(Ct);let $e=d==null?void 0:d.ui,Zo=((jl=d==null?void 0:d.gameplay)==null?void 0:jl.tuning)||{},Jh=($e==null?void 0:$e.text)||((zl=u.ui)==null?void 0:zl.cta_hint)||"Continue the adventure!",Jo=($e==null?void 0:$e.font)||"brand.body",Qo=($e==null?void 0:$e.fontSize)||16,Nn=(Bl=d==null?void 0:d.render)==null?void 0:Bl.tint,Qh=typeof Nn=="string"?Nn:Nn?`#${Nn.toString(16).padStart(6,"0")}`:"#FFFFFF",eg=(Fl=Zo.max_width)!=null?Fl:y-g*2,tg=(Nl=Zo.line_height)!=null?Nl:1.4,Tt=document.createElement("div");Tt.textContent=Jh,Tt.style.cssText=`
314
- font-family: ${Be(Jo)};
315
- font-size: ${Qo}px;
316
- font-weight: ${Fe(Jo)};
317
- color: ${Qh};
313
+ `;let Zo=Yo+aa+15,rg=((Pl=u.subtitle_offset_y)!=null?Pl:Zo+sa/2)+((Dl=Xo.animation_start_y_offset)!=null?Dl:-10);Ct.style.top=`${rg}px`,Ct.style.left="50%";let oa=Kt(Ct);oa.element=Ct,oa.animationStartYOffset=(jl=Xo.animation_start_y_offset)!=null?jl:-10,_.appendChild(Ct);let $e=d==null?void 0:d.ui,Jo=((zl=d==null?void 0:d.gameplay)==null?void 0:zl.tuning)||{},ag=($e==null?void 0:$e.text)||((Bl=p.ui)==null?void 0:Bl.cta_hint)||"Continue the adventure!",Qo=($e==null?void 0:$e.font)||"brand.body",el=($e==null?void 0:$e.fontSize)||16,Hn=(Fl=d==null?void 0:d.render)==null?void 0:Fl.tint,sg=typeof Hn=="string"?Hn:Hn?`#${Hn.toString(16).padStart(6,"0")}`:"#FFFFFF",og=(Nl=Jo.max_width)!=null?Nl:m-g*2,lg=(Hl=Jo.line_height)!=null?Hl:1.4,Tt=document.createElement("div");Tt.textContent=ag,Tt.style.cssText=`
314
+ font-family: ${Be(Qo)};
315
+ font-size: ${el}px;
316
+ font-weight: ${Fe(Qo)};
317
+ color: ${sg};
318
318
  text-align: center;
319
319
  opacity: 0;
320
320
  position: absolute;
321
321
  transform: translate(-50%, -50%);
322
- max-width: ${eg}px;
323
- line-height: ${tg};
322
+ max-width: ${og}px;
323
+ line-height: ${lg};
324
324
  word-wrap: break-word;
325
- `;let ig=Ko+aa+30,ng=(Hl=p.footer_offset_y)!=null?Hl:ig+Qo/2;Tt.style.top=`${ng}px`,Tt.style.left="50%";let oa=Kt(Tt);oa.element=Tt;let rg=(($l=d==null?void 0:d.render)==null?void 0:$l.alpha)!==void 0&&((Ul=d==null?void 0:d.render)==null?void 0:Ul.alpha)!==null?d.render.alpha:1;oa.targetAlpha=rg,_.appendChild(Tt);let Ue=((ql=l==null?void 0:l.gameplay)==null?void 0:ql.tuning)||{},ue=l==null?void 0:l.ui,ag=(Gl=Ue.button_width)!=null?Gl:260,el=(Wl=Ue.button_height)!=null?Wl:56,sg=(Yl=Ue.button_radius)!=null?Yl:16,og=Ue.button_bg_color||((Vl=u.theme)==null?void 0:Vl.cta_background)||"#ffb43b",lg=(Xl=Ue.button_bg_alpha)!=null?Xl:1,cg=Ue.button_border_color||"#ffffff",dg=(Kl=Ue.button_border_width)!=null?Kl:2,B0=(Zl=Ue.button_border_alpha)!=null?Zl:.2,la=(Jl=p.cta_offset_y)!=null?Jl:b*.7,X=document.createElement("button");X.style.cssText=`
326
- width: ${ag}px;
327
- height: ${el}px;
328
- background: ${og};
329
- opacity: ${lg};
330
- border: ${dg}px solid ${cg};
331
- border-radius: ${sg}px;
325
+ `;let cg=Zo+sa+30,dg=($l=u.footer_offset_y)!=null?$l:cg+el/2;Tt.style.top=`${dg}px`,Tt.style.left="50%";let la=Kt(Tt);la.element=Tt;let ug=((Ul=d==null?void 0:d.render)==null?void 0:Ul.alpha)!==void 0&&((ql=d==null?void 0:d.render)==null?void 0:ql.alpha)!==null?d.render.alpha:1;la.targetAlpha=ug,_.appendChild(Tt);let Ue=((Gl=l==null?void 0:l.gameplay)==null?void 0:Gl.tuning)||{},ue=l==null?void 0:l.ui,pg=(Wl=Ue.button_width)!=null?Wl:260,tl=(Yl=Ue.button_height)!=null?Yl:56,fg=(Vl=Ue.button_radius)!=null?Vl:16,hg=Ue.button_bg_color||((Xl=p.theme)==null?void 0:Xl.cta_background)||"#ffb43b",gg=(Kl=Ue.button_bg_alpha)!=null?Kl:1,mg=Ue.button_border_color||"#ffffff",bg=(Zl=Ue.button_border_width)!=null?Zl:2,Vw=(Jl=Ue.button_border_alpha)!=null?Jl:.2,ca=(Ql=u.cta_offset_y)!=null?Ql:b*.7,X=document.createElement("button");X.style.cssText=`
326
+ width: ${pg}px;
327
+ height: ${tl}px;
328
+ background: ${hg};
329
+ opacity: ${gg};
330
+ border: ${bg}px solid ${mg};
331
+ border-radius: ${fg}px;
332
332
  cursor: pointer;
333
333
  opacity: 0;
334
334
  position: absolute;
335
335
  transform: translate(-50%, -50%);
336
336
  box-shadow: inset 0 0 1px rgba(0,0,0,0.15);
337
- `,X.style.top=`${la}px`,X.style.left="50%";let ca=Kt(X);ca.element=X,ca.addEventListener=X.addEventListener.bind(X),_.appendChild(X);let ug=(ue==null?void 0:ue.text)||((Ql=u.ui)==null?void 0:Ql.cta_label_end)||"DOWNLOAD",tl=(ue==null?void 0:ue.font)||"brand.heading",pg=(ue==null?void 0:ue.fontSize)||20,fg=Ue.button_text_color||((ec=u.theme)==null?void 0:ec.cta_text)||"#1a0a0a";X.textContent=ug,X.style.fontFamily=Be(tl),X.style.fontSize=`${pg}px`,X.style.fontWeight=String(Fe(tl)),X.style.color=fg,X.style.letterSpacing=`${(tc=ue==null?void 0:ue.letterSpacing)!=null?tc:1}px`;let il=Kt(X);il.element=X;let pe=c==null?void 0:c.ui,nl=((ic=c==null?void 0:c.gameplay)==null?void 0:ic.tuning)||{},hg=(pe==null?void 0:pe.text)||"Play the full game",rl=(pe==null?void 0:pe.font)||"brand.body",gg=(pe==null?void 0:pe.fontSize)||11,mg=(nc=pe==null?void 0:pe.letterSpacing)!=null?nc:0,Hn=(rc=c==null?void 0:c.render)==null?void 0:rc.tint,bg=typeof Hn=="string"?Hn:Hn?`#${Hn.toString(16).padStart(6,"0")}`:"#CCCCCC",kt=document.createElement("div");kt.textContent=hg,kt.style.cssText=`
338
- font-family: ${Be(rl)};
339
- font-size: ${gg}px;
340
- font-weight: ${Fe(rl)};
341
- color: ${bg};
337
+ `,X.style.top=`${ca}px`,X.style.left="50%";let da=Kt(X);da.element=X,da.addEventListener=X.addEventListener.bind(X),_.appendChild(X);let yg=(ue==null?void 0:ue.text)||((ec=p.ui)==null?void 0:ec.cta_label_end)||"DOWNLOAD",il=(ue==null?void 0:ue.font)||"brand.heading",vg=(ue==null?void 0:ue.fontSize)||20,xg=Ue.button_text_color||((tc=p.theme)==null?void 0:tc.cta_text)||"#1a0a0a";X.textContent=yg,X.style.fontFamily=Be(il),X.style.fontSize=`${vg}px`,X.style.fontWeight=String(Fe(il)),X.style.color=xg,X.style.letterSpacing=`${(ic=ue==null?void 0:ue.letterSpacing)!=null?ic:1}px`;let nl=Kt(X);nl.element=X;let pe=c==null?void 0:c.ui,rl=((nc=c==null?void 0:c.gameplay)==null?void 0:nc.tuning)||{},wg=(pe==null?void 0:pe.text)||"Play the full game",al=(pe==null?void 0:pe.font)||"brand.body",_g=(pe==null?void 0:pe.fontSize)||11,Eg=(rc=pe==null?void 0:pe.letterSpacing)!=null?rc:0,$n=(ac=c==null?void 0:c.render)==null?void 0:ac.tint,Sg=typeof $n=="string"?$n:$n?`#${$n.toString(16).padStart(6,"0")}`:"#CCCCCC",kt=document.createElement("div");kt.textContent=wg,kt.style.cssText=`
338
+ font-family: ${Be(al)};
339
+ font-size: ${_g}px;
340
+ font-weight: ${Fe(al)};
341
+ color: ${Sg};
342
342
  text-align: center;
343
- letter-spacing: ${mg}px;
343
+ letter-spacing: ${Eg}px;
344
344
  opacity: 0;
345
345
  position: absolute;
346
346
  transform: translate(-50%, -50%);
347
347
  white-space: nowrap;
348
- `;let yg=la+el/2+20,vg=b-g-10,xg=Math.min(yg+((ac=nl.animation_start_y_offset)!=null?ac:5),vg);kt.style.top=`${xg}px`,kt.style.left="50%";let da=Kt(kt);da.element=kt,da.animationStartYOffset=(sc=nl.animation_start_y_offset)!=null?sc:5,_.appendChild(kt);let ua=((oc=f==null?void 0:f.gameplay)==null?void 0:oc.tuning)||{},wg=(lc=ua.hand_offset_x)!=null?lc:50,_g=(cc=ua.hand_offset_y)!=null?cc:50,Eg=(uc=(dc=f==null?void 0:f.transform)==null?void 0:dc.scale)!=null?uc:.1875,Sg=(pc=ua.hand_scale_multiplier)!=null?pc:2.5,Ag=new zi.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),Fi=new zi.Sprite(Ag),al=Eg*Sg*100;return Fi.scale.set(al,al,1),Fi.position.set(wg,la+_g,0),Fi.material.opacity=0,Fi.visible=!1,{panel:I,logo:ke,title:Yo,subtitle:sa,footer:oa,ctaButton:ca,ctaText:il,ctaHint:da,hand:Fi}}function Oh(e,t,i){var C,S,A,T,L,_,I,z;let n=t.objects.get("ui_endgame_1"),r=((C=n==null?void 0:n.gameplay)==null?void 0:C.tuning)||{},a=(S=r.animation_duration_ms)!=null?S:800,s=(A=r.fade_in_duration_ms)!=null?A:600,o=(T=r.scale_animation_intensity)!=null?T:.1,d=(L=r.logo_animation_delay_ms)!=null?L:100,l=(_=r.title_animation_delay_ms)!=null?_:200,c=(I=r.footer_animation_delay_ms)!=null?I:300,f=(z=r.cta_animation_delay_ms)!=null?z:400,{panel:u,logo:p,title:v,subtitle:h,footer:x,ctaButton:m,ctaText:y,ctaHint:b}=e;u.visible=!0,u.element.style.visibility="visible";let g=Date.now(),w=()=>{let le=Date.now()-g,te=Math.min(le/s,1),ne=1-Math.pow(1-te,3);u.alpha=ne,u.element.style.opacity=ne.toString();let xe=1+o*(1-ne);u.element.style.transform=`translate(-50%, -50%) scale(${xe})`,te<1?requestAnimationFrame(w):(setTimeout(()=>L0(p,a,t),d),setTimeout(()=>{R0(v,a),setTimeout(()=>M0(h,a),50)},l),setTimeout(()=>O0(x,a),c),setTimeout(()=>{I0(m,y,a),setTimeout(()=>P0(b,a),50),i&&i()},f))};w()}function L0(e,t,i){var u,p,v,h,x;let n=i==null?void 0:i.objects.get("ui_endgame_logo_1"),a=(p=(((u=n==null?void 0:n.gameplay)==null?void 0:u.tuning)||{}).animation_start_scale)!=null?p:1.2,s=Date.now(),o=e.material.opacity,d=(v=e.targetAlpha)!=null?v:1,l=(h=e.baseScaleX)!=null?h:e.scale.x,c=(x=e.baseScaleY)!=null?x:e.scale.y,f=()=>{let m=Date.now()-s,y=Math.min(m/t,1),b=1-Math.pow(1-y,2);e.material.opacity=o+(d-o)*b;let g=a+(1-a)*b;e.scale.set(l*g,c*g,1),y<1&&requestAnimationFrame(f)};f()}function R0(e,t){let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=parseFloat(e.element.style.top||"0"),a=()=>{let s=Date.now()-i,o=Math.min(s/t,1),d=1-Math.pow(1-o,2);e.element.style.opacity=(n+(1-n)*d).toString(),e.element.style.top=`${r-20*(1-d)}px`,o<1&&requestAnimationFrame(a)};a()}function M0(e,t){var o;let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=parseFloat(e.element.style.top||"0"),a=r-((o=e.animationStartYOffset)!=null?o:-10),s=()=>{let d=Date.now()-i,l=Math.min(d/t,1),c=1-Math.pow(1-l,2);e.element.style.opacity=(n+(1-n)*c).toString(),e.element.style.top=`${r+(a-r)*c}px`,l<1&&requestAnimationFrame(s)};s()}function O0(e,t){var s;let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=(s=e.targetAlpha)!=null?s:1,a=()=>{let o=Date.now()-i,d=Math.min(o/t,1),l=1-Math.pow(1-d,2);e.element.style.opacity=(n+(r-n)*l).toString(),d<1&&requestAnimationFrame(a)};a()}function I0(e,t,i){let n=Date.now(),r=parseFloat(e.element.style.opacity||"0"),a=()=>{let s=Date.now()-n,o=Math.min(s/i,1),d=1-Math.pow(1-o,2);e.element.style.opacity=(r+(1-r)*d).toString(),t.element.style.opacity=(r+(1-r)*d).toString(),e.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-d)})`,o<1&&requestAnimationFrame(a)};a()}function P0(e,t){var o;let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=parseFloat(e.element.style.top||"0"),a=r-((o=e.animationStartYOffset)!=null?o:5),s=()=>{let d=Date.now()-i,l=Math.min(d/t,1),c=1-Math.pow(1-l,2);e.element.style.opacity=(n+(1-n)*c).toString(),e.element.style.top=`${r+(a-r)*c}px`,l<1&&requestAnimationFrame(s)};s()}function Ih(e,t,i,n){var c,f,u,p;let r=i.objects.get("ui_endgame_hand_1"),a=((c=r==null?void 0:r.gameplay)==null?void 0:c.tuning)||{},s=(f=a.click_animation_duration_ms)!=null?f:600,o=(u=a.click_delay_ms)!=null?u:2e3,d=(p=a.click_repeat_delay_ms)!=null?p:3e3,l=()=>{var S,A;e.visible=!0,e.material.opacity=1;let v=e.position.x,h=e.position.y,x=(S=a.hand_offset_x)!=null?S:50,m=(A=a.hand_offset_y)!=null?A:50,y=t.element.getBoundingClientRect(),b=x,g=m,w=Date.now(),C=()=>{var ne,xe,Ne;let T=Date.now()-w,L=Math.min(T/s,1),_=L<.5?2*L*L:1-Math.pow(-2*L+2,2)/2;e.position.set(v+(b-v)*_,h+(g-h)*_,0);let I=(xe=(ne=r==null?void 0:r.transform)==null?void 0:ne.scale)!=null?xe:.1875,z=(Ne=a.hand_scale_multiplier)!=null?Ne:2.5,le=I*z*100,te=le+le*.2*Math.sin(L*Math.PI);e.scale.set(te,te,1),L<1?requestAnimationFrame(C):(t.element.style.transform="translate(-50%, -50%) scale(0.95)",setTimeout(()=>{t.element.style.transform="translate(-50%, -50%) scale(1)",n()},100),setTimeout(()=>{e.material.opacity=0,setTimeout(()=>{e.position.set(v,h,0),l()},d)},500))};C()};setTimeout(l,o)}var na=Ge(require("three"),1);function Ph(e,t,i){var p,v,h,x,m,y,b;let n=t.objects.get("hand_tutorial_1"),r=((p=n==null?void 0:n.gameplay)==null?void 0:p.tuning)||{},a=(n==null?void 0:n.render)||{},s=(n==null?void 0:n.transform)||{},o=new na.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),d=new na.Sprite(o),l=s.position||{},c=(v=l==null?void 0:l.z)!=null?v:0;d.position.set(i.x+((h=l==null?void 0:l.x)!=null?h:0),i.y+((x=l==null?void 0:l.y)!=null?x:0),c),d.material.opacity=a.alpha!==void 0&&a.alpha!==null?a.alpha:0,d.visible=a.visible!==void 0&&a.visible!==null?a.visible:!1;let f=(m=r.hand_scale_multiplier)!=null?m:2.5,u=(y=s.scale)!=null?y:.1875;return d.scale.set(u*f*100,u*f*100,1),d.renderOrder=(b=a.z_index)!=null?b:99999,d}function Dh(e){var v,h,x,m,y,b,g,w,C;let t=e.objects.get("ui_tutorial_1"),i=t==null?void 0:t.ui,n=(t==null?void 0:t.render)||{},r=((v=e.engine.runtime)==null?void 0:v.ui_styles)||{},a=((h=e.engine.runtime)==null?void 0:h.ui)||{},s=(i==null?void 0:i.text)||a.tutorial_label||a.label_text||"CLEAN!",o=(i==null?void 0:i.font)||"brand.warning",d=(i==null?void 0:i.fontSize)||r.label_font_size||52,l=(m=i==null?void 0:i.letterSpacing)!=null?m:(x=r.label_letter_spacing)!=null?x:-1,c=(i==null?void 0:i.align)||"center",f=n.tint,u=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:r.label_fill||"#FFF1C1",p=document.createElement("div");return p.textContent=s,p.style.cssText=`
348
+ `;let Ag=ca+tl/2+20,Cg=b-g-10,Tg=Math.min(Ag+((sc=rl.animation_start_y_offset)!=null?sc:5),Cg);kt.style.top=`${Tg}px`,kt.style.left="50%";let ua=Kt(kt);ua.element=kt,ua.animationStartYOffset=(oc=rl.animation_start_y_offset)!=null?oc:5,_.appendChild(kt);let pa=((lc=f==null?void 0:f.gameplay)==null?void 0:lc.tuning)||{},kg=(cc=pa.hand_offset_x)!=null?cc:50,Lg=(dc=pa.hand_offset_y)!=null?dc:50,Rg=(pc=(uc=f==null?void 0:f.transform)==null?void 0:uc.scale)!=null?pc:.1875,Mg=(fc=pa.hand_scale_multiplier)!=null?fc:2.5,Og=new zi.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),Fi=new zi.Sprite(Og),sl=Rg*Mg*100;return Fi.scale.set(sl,sl,1),Fi.position.set(kg,ca+Lg,0),Fi.material.opacity=0,Fi.visible=!1,{panel:I,logo:ke,title:Vo,subtitle:oa,footer:la,ctaButton:da,ctaText:nl,ctaHint:ua,hand:Fi}}function Fh(e,t,i){var E,A,C,T,L,_,I,z;let n=t.objects.get("ui_endgame_1"),r=((E=n==null?void 0:n.gameplay)==null?void 0:E.tuning)||{},a=(A=r.animation_duration_ms)!=null?A:800,s=(C=r.fade_in_duration_ms)!=null?C:600,o=(T=r.scale_animation_intensity)!=null?T:.1,d=(L=r.logo_animation_delay_ms)!=null?L:100,l=(_=r.title_animation_delay_ms)!=null?_:200,c=(I=r.footer_animation_delay_ms)!=null?I:300,f=(z=r.cta_animation_delay_ms)!=null?z:400,{panel:p,logo:u,title:v,subtitle:h,footer:w,ctaButton:y,ctaText:m,ctaHint:b}=e;p.visible=!0,p.element.style.visibility="visible";let g=Date.now(),x=()=>{let le=Date.now()-g,te=Math.min(le/s,1),ne=1-Math.pow(1-te,3);p.alpha=ne,p.element.style.opacity=ne.toString();let xe=1+o*(1-ne);p.element.style.transform=`translate(-50%, -50%) scale(${xe})`,te<1?requestAnimationFrame(x):(setTimeout(()=>Fw(u,a,t),d),setTimeout(()=>{Nw(v,a),setTimeout(()=>Hw(h,a),50)},l),setTimeout(()=>$w(w,a),c),setTimeout(()=>{Uw(y,m,a),setTimeout(()=>qw(b,a),50),i&&i()},f))};x()}function Fw(e,t,i){var p,u,v,h,w;let n=i==null?void 0:i.objects.get("ui_endgame_logo_1"),a=(u=(((p=n==null?void 0:n.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?u:1.2,s=Date.now(),o=e.material.opacity,d=(v=e.targetAlpha)!=null?v:1,l=(h=e.baseScaleX)!=null?h:e.scale.x,c=(w=e.baseScaleY)!=null?w:e.scale.y,f=()=>{let y=Date.now()-s,m=Math.min(y/t,1),b=1-Math.pow(1-m,2);e.material.opacity=o+(d-o)*b;let g=a+(1-a)*b;e.scale.set(l*g,c*g,1),m<1&&requestAnimationFrame(f)};f()}function Nw(e,t){let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=parseFloat(e.element.style.top||"0"),a=()=>{let s=Date.now()-i,o=Math.min(s/t,1),d=1-Math.pow(1-o,2);e.element.style.opacity=(n+(1-n)*d).toString(),e.element.style.top=`${r-20*(1-d)}px`,o<1&&requestAnimationFrame(a)};a()}function Hw(e,t){var o;let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=parseFloat(e.element.style.top||"0"),a=r-((o=e.animationStartYOffset)!=null?o:-10),s=()=>{let d=Date.now()-i,l=Math.min(d/t,1),c=1-Math.pow(1-l,2);e.element.style.opacity=(n+(1-n)*c).toString(),e.element.style.top=`${r+(a-r)*c}px`,l<1&&requestAnimationFrame(s)};s()}function $w(e,t){var s;let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=(s=e.targetAlpha)!=null?s:1,a=()=>{let o=Date.now()-i,d=Math.min(o/t,1),l=1-Math.pow(1-d,2);e.element.style.opacity=(n+(r-n)*l).toString(),d<1&&requestAnimationFrame(a)};a()}function Uw(e,t,i){let n=Date.now(),r=parseFloat(e.element.style.opacity||"0"),a=()=>{let s=Date.now()-n,o=Math.min(s/i,1),d=1-Math.pow(1-o,2);e.element.style.opacity=(r+(1-r)*d).toString(),t.element.style.opacity=(r+(1-r)*d).toString(),e.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-d)})`,o<1&&requestAnimationFrame(a)};a()}function qw(e,t){var o;let i=Date.now(),n=parseFloat(e.element.style.opacity||"0"),r=parseFloat(e.element.style.top||"0"),a=r-((o=e.animationStartYOffset)!=null?o:5),s=()=>{let d=Date.now()-i,l=Math.min(d/t,1),c=1-Math.pow(1-l,2);e.element.style.opacity=(n+(1-n)*c).toString(),e.element.style.top=`${r+(a-r)*c}px`,l<1&&requestAnimationFrame(s)};s()}function Nh(e,t,i,n){var c,f,p,u;let r=i.objects.get("ui_endgame_hand_1"),a=((c=r==null?void 0:r.gameplay)==null?void 0:c.tuning)||{},s=(f=a.click_animation_duration_ms)!=null?f:600,o=(p=a.click_delay_ms)!=null?p:2e3,d=(u=a.click_repeat_delay_ms)!=null?u:3e3,l=()=>{var A,C;e.visible=!0,e.material.opacity=1;let v=e.position.x,h=e.position.y,w=(A=a.hand_offset_x)!=null?A:50,y=(C=a.hand_offset_y)!=null?C:50,m=t.element.getBoundingClientRect(),b=w,g=y,x=Date.now(),E=()=>{var ne,xe,Ne;let T=Date.now()-x,L=Math.min(T/s,1),_=L<.5?2*L*L:1-Math.pow(-2*L+2,2)/2;e.position.set(v+(b-v)*_,h+(g-h)*_,0);let I=(xe=(ne=r==null?void 0:r.transform)==null?void 0:ne.scale)!=null?xe:.1875,z=(Ne=a.hand_scale_multiplier)!=null?Ne:2.5,le=I*z*100,te=le+le*.2*Math.sin(L*Math.PI);e.scale.set(te,te,1),L<1?requestAnimationFrame(E):(t.element.style.transform="translate(-50%, -50%) scale(0.95)",setTimeout(()=>{t.element.style.transform="translate(-50%, -50%) scale(1)",n()},100),setTimeout(()=>{e.material.opacity=0,setTimeout(()=>{e.position.set(v,h,0),l()},d)},500))};E()};setTimeout(l,o)}var ra=Ge(require("three"),1);function Hh(e,t,i){var u,v,h,w,y,m,b;let n=t.objects.get("hand_tutorial_1"),r=((u=n==null?void 0:n.gameplay)==null?void 0:u.tuning)||{},a=(n==null?void 0:n.render)||{},s=(n==null?void 0:n.transform)||{},o=new ra.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),d=new ra.Sprite(o),l=s.position||{},c=(v=l==null?void 0:l.z)!=null?v:0;d.position.set(i.x+((h=l==null?void 0:l.x)!=null?h:0),i.y+((w=l==null?void 0:l.y)!=null?w:0),c),d.material.opacity=a.alpha!==void 0&&a.alpha!==null?a.alpha:0,d.visible=a.visible!==void 0&&a.visible!==null?a.visible:!1;let f=(y=r.hand_scale_multiplier)!=null?y:2.5,p=(m=s.scale)!=null?m:.1875;return d.scale.set(p*f*100,p*f*100,1),d.renderOrder=(b=a.z_index)!=null?b:99999,d}function $h(e){var v,h,w,y,m,b,g,x,E;let t=e.objects.get("ui_tutorial_1"),i=t==null?void 0:t.ui,n=(t==null?void 0:t.render)||{},r=((v=e.engine.runtime)==null?void 0:v.ui_styles)||{},a=((h=e.engine.runtime)==null?void 0:h.ui)||{},s=(i==null?void 0:i.text)||a.tutorial_label||a.label_text||"CLEAN!",o=(i==null?void 0:i.font)||"brand.warning",d=(i==null?void 0:i.fontSize)||r.label_font_size||52,l=(y=i==null?void 0:i.letterSpacing)!=null?y:(w=r.label_letter_spacing)!=null?w:-1,c=(i==null?void 0:i.align)||"center",f=n.tint,p=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:r.label_fill||"#FFF1C1",u=document.createElement("div");return u.textContent=s,u.style.cssText=`
349
349
  font-family: ${Be(o)};
350
350
  font-size: ${d}px;
351
351
  font-weight: ${Fe(o)};
352
- color: ${u};
352
+ color: ${p};
353
353
  text-align: ${c};
354
354
  letter-spacing: ${l}px;
355
- text-shadow: ${(y=r.label_shadow_distance)!=null?y:2}px ${(b=r.label_shadow_distance)!=null?b:2}px ${(g=r.label_shadow_blur)!=null?g:4}px rgba(0,0,0,${(w=r.label_shadow_alpha)!=null?w:.8});
355
+ text-shadow: ${(m=r.label_shadow_distance)!=null?m:2}px ${(b=r.label_shadow_distance)!=null?b:2}px ${(g=r.label_shadow_blur)!=null?g:4}px rgba(0,0,0,${(x=r.label_shadow_alpha)!=null?x:.8});
356
356
  -webkit-text-stroke: ${r.label_stroke||"#8B0000"} 2px;
357
- opacity: ${(C=n.alpha)!=null?C:0};
357
+ opacity: ${(E=n.alpha)!=null?E:0};
358
358
  visibility: ${n.visible!==!1?"visible":"hidden"};
359
359
  pointer-events: none;
360
360
  position: absolute;
361
361
  transform: translate(-50%, -50%);
362
362
  white-space: nowrap;
363
- `,p}function jh(e,t,i,n,r){var d,l,c,f,u,p,v;let a=r.objects.get("hand_tutorial_1"),s=((d=a==null?void 0:a.gameplay)==null?void 0:d.tuning)||{},o=(a==null?void 0:a.transform)||{};if(!n){let h=(l=s.animation_duration)!=null?l:1.5,x=i%h/h,m=x<.5?2*x*x:-1+(4-2*x)*x,y=(c=s.x_offset)!=null?c:0,b=(f=s.y_offset)!=null?f:0,g=(u=s.animation_range)!=null?u:40,w=g*.7,C=g,S=t.x+y+w,A=t.y+b+C,T=S+w,L=A+C;e.position.set(S+(T-S)*m,A+(L-A)*m,0);let _=(p=o.scale)!=null?p:.1875,I=(v=s.hand_scale_multiplier)!=null?v:2.5,z=_*I*100;e.scale.set(z,z,1)}}var Bi=Ge(require("three"),1),zh=new Bi.TextureLoader,$o=null,Uo=null;async function Bh(){if($o)return $o;if(!Uo){let i=(()=>{if(typeof window!="undefined")try{return new URL("inline-assets.js",window.location.href).href}catch{return"./inline-assets.js"}return"./inline-assets.js"})();Uo=fetch(i).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.text()}).then(n=>{let r=n.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(r)return new Function("return "+r[1])();throw new Error("INLINE_ASSETS export not found")}).then(n=>n?n.INLINE_ASSETS?n.INLINE_ASSETS:(console.warn("[assets] Module does not have INLINE_ASSETS export. Module keys:",Object.keys(n)),{}):(console.warn("[assets] Module import returned undefined"),{})).catch(n=>(console.warn("[assets] Failed to load inline-assets.js:",n),{}))}let e=await Uo;return $o=e||{},e||{}}async function qo(e,t,i=16777215,n=!1){try{let a=(await Bh())[e];return await zh.loadAsync(a||e)}catch{console.warn(`Asset missing: ${e}. Using placeholder.`);let a=document.createElement("canvas");a.width=64,a.height=64;let s=a.getContext("2d");return s&&(s.fillStyle=`#${i.toString(16).padStart(6,"0")}`,n?s.fillRect(0,0,30,60):(s.beginPath(),s.arc(32,32,30,0,Math.PI*2),s.fill(),s.fillRect(27,32,10,40))),new Bi.CanvasTexture(a)}}async function Fh(e,t,i){var h,x;let r=(await Bh())[e]||e,a;try{a=await zh.loadAsync(r),console.log("[character] loaded sheet",{path:e,sourceUsed:r})}catch(m){let g=((i.gameplay.character_sheet||{}).fallback_color||"#ff00ff").replace("#","");a=await qo(e,t,parseInt(g,16),!0),console.warn("[character] fallback loadAsset used",{path:e,err:m})}if(!a)return[];let s=i.gameplay.character_sheet||{},o=(h=s.cols)!=null?h:3,d=(x=s.rows)!=null?x:2,l=a.image,c=(l==null?void 0:l.width)||0,f=(l==null?void 0:l.height)||0,u=c/o,p=f/d;if(!Number.isFinite(u)||!Number.isFinite(p)||u<=0||p<=0)return[a];let v=[];for(let m=0;m<d;m++)for(let y=0;y<o;y++){let b=document.createElement("canvas");b.width=u,b.height=p;let g=b.getContext("2d");g&&l&&g.drawImage(l,y*u,m*p,u,p,0,0,u,p),v.push(new Bi.CanvasTexture(b))}return v.length>2&&v.push(...v.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:v.length}),v}function Nh(e,t){var f,u,p,v;let i=t.gameplay.brush||{},n=t.theme.brush_color||"#ffffff",r=(f=i.radius)!=null?f:20,a=(u=i.inner_radius)!=null?u:15,s=(p=i.alpha)!=null?p:.8,o=(v=i.inner_alpha)!=null?v:.3,d=i.inner_color||"#ffffff",l=document.createElement("canvas");l.width=r*2,l.height=r*2;let c=l.getContext("2d");return c&&(c.clearRect(0,0,l.width,l.height),c.beginPath(),c.arc(r,r,r,0,Math.PI*2),c.fillStyle=n,c.globalAlpha=s,c.fill(),c.beginPath(),c.arc(r,r,a,0,Math.PI*2),c.fillStyle=d,c.globalAlpha=o,c.fill()),new Bi.CanvasTexture(l)}0&&(module.exports={AspectClass,GameObject,GameObjectManager,Renderer,ResponsiveUISystem,Transform,animateHandClick,animatePanelEntrance,createBrushTexture,createEndGamePanel,createHandTutorial,createThreeBase,createTutorialLabel,getAspectClass,getRegisteredFontIds,loadAsset,loadCharacterFrames,registerFont,resolveFont,resolveFontWeight,updateHandAnimation});
363
+ `,u}function Uh(e,t,i,n,r){var d,l,c,f,p,u,v;let a=r.objects.get("hand_tutorial_1"),s=((d=a==null?void 0:a.gameplay)==null?void 0:d.tuning)||{},o=(a==null?void 0:a.transform)||{};if(!n){let h=(l=s.animation_duration)!=null?l:1.5,w=i%h/h,y=w<.5?2*w*w:-1+(4-2*w)*w,m=(c=s.x_offset)!=null?c:0,b=(f=s.y_offset)!=null?f:0,g=(p=s.animation_range)!=null?p:40,x=g*.7,E=g,A=t.x+m+x,C=t.y+b+E,T=A+x,L=C+E;e.position.set(A+(T-A)*y,C+(L-C)*y,0);let _=(u=o.scale)!=null?u:.1875,I=(v=s.hand_scale_multiplier)!=null?v:2.5,z=_*I*100;e.scale.set(z,z,1)}}var Bi=Ge(require("three"),1),qh=new Bi.TextureLoader,Uo=null,qo=null;async function Gh(){if(Uo)return Uo;if(!qo){let i=(()=>{if(typeof window!="undefined")try{return new URL("inline-assets.js",window.location.href).href}catch{return"./inline-assets.js"}return"./inline-assets.js"})();qo=fetch(i).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.text()}).then(n=>{let r=n.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(r)return new Function("return "+r[1])();throw new Error("INLINE_ASSETS export not found")}).then(n=>n?n.INLINE_ASSETS?n.INLINE_ASSETS:(console.warn("[assets] Module does not have INLINE_ASSETS export. Module keys:",Object.keys(n)),{}):(console.warn("[assets] Module import returned undefined"),{})).catch(n=>(console.warn("[assets] Failed to load inline-assets.js:",n),{}))}let e=await qo;return Uo=e||{},e||{}}async function Go(e,t,i=16777215,n=!1){try{let a=(await Gh())[e];return await qh.loadAsync(a||e)}catch{console.warn(`Asset missing: ${e}. Using placeholder.`);let a=document.createElement("canvas");a.width=64,a.height=64;let s=a.getContext("2d");return s&&(s.fillStyle=`#${i.toString(16).padStart(6,"0")}`,n?s.fillRect(0,0,30,60):(s.beginPath(),s.arc(32,32,30,0,Math.PI*2),s.fill(),s.fillRect(27,32,10,40))),new Bi.CanvasTexture(a)}}async function Wh(e,t,i){var h,w;let r=(await Gh())[e]||e,a;try{a=await qh.loadAsync(r),console.log("[character] loaded sheet",{path:e,sourceUsed:r})}catch(y){let g=((i.gameplay.character_sheet||{}).fallback_color||"#ff00ff").replace("#","");a=await Go(e,t,parseInt(g,16),!0),console.warn("[character] fallback loadAsset used",{path:e,err:y})}if(!a)return[];let s=i.gameplay.character_sheet||{},o=(h=s.cols)!=null?h:3,d=(w=s.rows)!=null?w:2,l=a.image,c=(l==null?void 0:l.width)||0,f=(l==null?void 0:l.height)||0,p=c/o,u=f/d;if(!Number.isFinite(p)||!Number.isFinite(u)||p<=0||u<=0)return[a];let v=[];for(let y=0;y<d;y++)for(let m=0;m<o;m++){let b=document.createElement("canvas");b.width=p,b.height=u;let g=b.getContext("2d");g&&l&&g.drawImage(l,m*p,y*u,p,u,0,0,p,u),v.push(new Bi.CanvasTexture(b))}return v.length>2&&v.push(...v.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:v.length}),v}function Yh(e,t){var f,p,u,v;let i=t.gameplay.brush||{},n=t.theme.brush_color||"#ffffff",r=(f=i.radius)!=null?f:20,a=(p=i.inner_radius)!=null?p:15,s=(u=i.alpha)!=null?u:.8,o=(v=i.inner_alpha)!=null?v:.3,d=i.inner_color||"#ffffff",l=document.createElement("canvas");l.width=r*2,l.height=r*2;let c=l.getContext("2d");return c&&(c.clearRect(0,0,l.width,l.height),c.beginPath(),c.arc(r,r,r,0,Math.PI*2),c.fillStyle=n,c.globalAlpha=s,c.fill(),c.beginPath(),c.arc(r,r,a,0,Math.PI*2),c.fillStyle=d,c.globalAlpha=o,c.fill()),new Bi.CanvasTexture(l)}0&&(module.exports={AspectClass,GameObject,GameObjectManager,Renderer,ResponsiveUISystem,Transform,animateHandClick,animatePanelEntrance,createBrushTexture,createEndGamePanel,createHandTutorial,createThreeBase,createTutorialLabel,getAspectClass,getRegisteredFontIds,loadAsset,loadCharacterFrames,registerFont,resolveFont,resolveFontWeight,updateHandAnimation});