handler-playable-sdk 0.3.34 → 0.3.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AssetEditorModal-FTOKF3XD.js +1 -0
- package/dist/AssetTextures-HOSCQNZW.js +1 -0
- package/dist/{ConfigOverride-C26KK6X2.js → ConfigOverride-RARXNEZC.js} +1 -1
- package/dist/chunk-OZZRT3XI.js +1626 -0
- package/dist/chunk-ZFQCFKYD.js +1 -0
- package/dist/cli/brand-dna.mjs +1 -1
- package/dist/cli/canva-import.mjs +1 -1
- package/dist/cli/cleanup-assets.mjs +1 -1
- package/dist/cli/fix-scales.mjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/screen-helper.mjs +1 -1
- package/dist/cli/setup-library.mjs +1 -1
- package/dist/cli/student-helper.mjs +1 -1
- package/dist/cli/sync-screens.mjs +1 -1
- package/dist/cli/validate-assets.mjs +1 -1
- package/dist/cli/validate.mjs +1 -1
- package/dist/{config-44AFSRES.js → config-4IWHAC43.js} +1 -1
- package/dist/index.cjs +290 -367
- package/dist/index.css +310 -0
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +35 -36
- package/dist/pixi/index.css +310 -0
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +76 -77
- package/dist/three/index.css +310 -0
- package/dist/three/index.js +1 -1
- package/package.json +2 -1
- package/dist/AssetEditorModal-DBAGQINC.js +0 -1
- package/dist/AssetTextures-CWUQXU5Q.js +0 -1
- package/dist/chunk-PHSE57CN.js +0 -1703
- package/dist/chunk-Q7FPWOA3.js +0 -1
package/dist/three/index.cjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
"use strict";var Dg=Object.create;var Ui=Object.defineProperty;var zg=Object.getOwnPropertyDescriptor;var Fg=Object.getOwnPropertyNames;var Bg=Object.getPrototypeOf,Ng=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 n in t)Ui(e,n,{get:t[n],enumerable:!0})},gc=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Fg(t))!Ng.call(e,r)&&r!==n&&Ui(e,r,{get:()=>t[r],enumerable:!(i=zg(t,r))||i.enumerable});return e};var Ge=(e,t,n)=>(n=e!=null?Dg(Bg(e)):{},gc(t||!e||!e.__esModule?Ui(n,"default",{value:e,enumerable:!0}):n,e)),Hg=e=>gc(Ui({},"__esModule",{value:!0}),e);var We,wa=qe(()=>{"use strict";We=class{static get(t){var n;return(n=this.store.get(t))==null?void 0:n.data}static set(t,n){this.store.set(t,{data:n})}static has(t){return this.store.has(t)}static clear(){this.store.clear()}};We.store=new Map});function Xg(){var e,t;try{let n=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),i=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(n&&!i)}catch{return!1}}async function Kg(){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 Zg(){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 Jg(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${F}`),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(!(F==="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 n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);let i=await n.text();console.log("[AssetLoader] Received JS code, length:",i.length);let r=i.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:",i.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}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 Qg(e=64,t=64,n=16711680){let i=document.createElement("canvas");i.width=e,i.height=t;let r=i.getContext("2d");return r.fillStyle=`#${n.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(i)}function Sa(e,t){Xc.set(e,t)}var Ve,Yc,Vc,Lt,F,Le,ut,Ye,_a,Xc,Rt,Yi=qe(()=>{"use strict";Ve=require("pixi.js");wa();Yc=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Vc=Xg(),Lt=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,F=Vc?"publish":Yc,Le=Lt==null?void 0:Lt.assetsInlined;Lt!=null&&Lt.buildMode&&(F=Lt.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${F}`));ut=Zg();ut!=null&&ut.buildMode&&(F=ut.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${F}`));(ut==null?void 0:ut.assetsInlined)!==void 0&&(Le=ut.assetsInlined);Kg().then(e=>{e!=null&&e.buildMode&&e.buildMode!==F&&(F=e.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${F}`)),(e==null?void 0:e.assetsInlined)!==void 0&&(Le=e.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${Yc}, Runtime: ${Vc?"publish":"dev"}, Effective: ${F}`);Ye={},_a=null;Xc=new Map;Rt=class{static async load(t,n,i,r){let a=`${t}:${n.path}`,s=We.get(a);if(s!==void 0)return s;console.log(`[AssetLoader] Loading asset: ${t}, type: ${n.type}, Effective mode: ${F}`),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 Jg(),d=o[t];if(!d&&r&&(d=o[r],d&&console.log(`[AssetLoader] Found inline data for ${t} using configId: ${r}`)),!d&&n.path){let f=n.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"),F==="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: ${n.path}`);let c=Xc.get(n.type);if(c)try{let f=await c(n.path,d,t,i);return We.set(a,f),f}catch(f){return this.handleFailure(t,n.type,f)}try{let f;switch(n.type){case"image":f=await this.loadImage(n.path,d);break;case"json":f=await this.loadJSON(n.path,d),f=Ea(f);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return We.set(a,f),f}catch(f){return this.handleFailure(t,n.type,f)}}static async loadImage(t,n){let i=F==="publish",r=i&&Le!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${F}, isPublishMode: ${i}, inlineData: ${n?"EXISTS":"MISSING"}`),r){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${t}`);if(typeof n!="string"||!n.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI string, got: ${typeof n}`);try{return await Ve.Assets.load(n)}catch(a){throw console.error("[AssetLoader] Failed to load texture from data URI:",a),a}}if(n&&typeof n=="string"&&n.startsWith("data:"))try{return await Ve.Assets.load(n)}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,n){let i=F==="publish",r=i&&Le!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${F}, isPublishMode: ${i}, inlineData: ${n?"EXISTS":"MISSING"}`),r){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(typeof n=="object"&&n!==null)return n;if(typeof n=="string"&&n.startsWith("data:")){let s=atob(n.split(",")[1]);return JSON.parse(s)}return JSON.parse(n)}if(n){if(typeof n=="object"&&n!==null)return n;if(typeof n=="string"&&n.startsWith("data:")){let s=atob(n.split(",")[1]);return JSON.parse(s)}return JSON.parse(n)}let a=await fetch(t);if(!a.ok)throw new Error(`JSON fetch failed: ${t}`);return a.json()}static handleFailure(t,n,i){if(F==="dev"){let a=n==="image"?Qg():Ea({__placeholder:!0,type:n});return We.set(t+":"+((i==null?void 0:i.path)||"missing"),a),a}throw i}};Sa("image",async(e,t)=>{let n=F==="publish",i=n&&Le!==!1,r=F==="brand",a=n&&Le===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${F}, isPublishMode: ${n}, isBrandMode: ${r}, inlineData: ${t?"EXISTS":"MISSING"}`),i){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 n=F==="publish",i=n&&Le!==!1,r=F==="brand",a=n&&Le===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${F}, isPublishMode: ${n}, isBrandMode: ${r}, inlineData: ${t?"EXISTS":"MISSING"}`),i){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,rm,Vi,qn=qe(()=>{"use strict";Yi();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,n){if(this.config===t&&this.app===n&&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(i=>{this.priorityReadyResolve=i}),this.config=t,this.app=n,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,n=this.app;return this.readyPromise=(async()=>{var s;console.log("[AssetTextures] Loading all assets...");let i=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,n,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{}}};i.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,n={}){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 n.timeoutMs=="number"?n.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,n){this.textures.set(t,n),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())}},rm=new Ca,Vi=new Proxy(rm,{get(e,t){return t in e&&typeof e[t]=="function"?e[t].bind(e):e.get(t)},set(e,t,n){return e.set(t,n),!0}})});var Cm,pt=qe(()=>{"use strict";Cm="handler_preview_override_mode";if(typeof window!="undefined"){let e=window.localStorage.getItem(Cm);window.__enableConfigOverrides=e===null?!0:e==="true"}});var ed,It,x_,Ra=qe(()=>{"use strict";pt();ed=null,It="dev";if(typeof window!="undefined"){let e=window.__BUILD_SETTINGS__;if(e!=null&&e.buildMode)ed=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 n=JSON.parse(t.responseText);ed=n,It=n.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",n,"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);x_=It==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});var Ma=qe(()=>{"use strict"});var nd=qe(()=>{"use strict";Ma();Ra()});var Oa=qe(()=>{"use strict";Ra();Ma();nd()});var Yn=S((P1,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:Dm}:Ia.exports=process;function Dm(e,t,n,i){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,n)});case 4:return process.nextTick(function(){e.call(null,t,n,i)});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 ad=S((j1,rd)=>{"use strict";var zm={}.toString;rd.exports=Array.isArray||function(e){return zm.call(e)=="[object Array]"}});var Pa=S((D1,sd)=>{"use strict";sd.exports=require("stream")});var Vn=S((ja,ld)=>{"use strict";var ir=require("buffer"),Je=ir.Buffer;function od(e,t){for(var n in e)t[n]=e[n]}Je.from&&Je.alloc&&Je.allocUnsafe&&Je.allocUnsafeSlow?ld.exports=ir:(od(ir,ja),ja.Buffer=tn);function tn(e,t,n){return Je(e,t,n)}od(Je,tn);tn.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Je(e,t,n)};tn.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Je(e);return t!==void 0?typeof n=="string"?i.fill(t,n):i.fill(t):i.fill(0),i};tn.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Je(e)};tn.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return ir.SlowBuffer(e)}});var nn=S(K=>{"use strict";function Fm(e){return Array.isArray?Array.isArray(e):rr(e)==="[object Array]"}K.isArray=Fm;function Bm(e){return typeof e=="boolean"}K.isBoolean=Bm;function Nm(e){return e===null}K.isNull=Nm;function Hm(e){return e==null}K.isNullOrUndefined=Hm;function $m(e){return typeof e=="number"}K.isNumber=$m;function Um(e){return typeof e=="string"}K.isString=Um;function qm(e){return typeof e=="symbol"}K.isSymbol=qm;function Gm(e){return e===void 0}K.isUndefined=Gm;function Wm(e){return rr(e)==="[object RegExp]"}K.isRegExp=Wm;function Ym(e){return typeof e=="object"&&e!==null}K.isObject=Ym;function Vm(e){return rr(e)==="[object Date]"}K.isDate=Vm;function Xm(e){return rr(e)==="[object Error]"||e instanceof Error}K.isError=Xm;function Km(e){return typeof e=="function"}K.isFunction=Km;function Zm(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}K.isPrimitive=Zm;K.isBuffer=require("buffer").Buffer.isBuffer;function rr(e){return Object.prototype.toString.call(e)}});var cd=S((F1,Da)=>{"use strict";typeof Object.create=="function"?Da.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Da.exports=function(t,n){if(n){t.super_=n;var i=function(){};i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}}});var rn=S((B1,Fa)=>{"use strict";try{if(za=require("util"),typeof za.inherits!="function")throw"";Fa.exports=za.inherits}catch{Fa.exports=cd()}var za});var ud=S((N1,Ba)=>{"use strict";function Jm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var dd=Vn().Buffer,Xn=require("util");function Qm(e,t,n){e.copy(t,n)}Ba.exports=(function(){function e(){Jm(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(n){var i={data:n,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},e.prototype.unshift=function(n){var i={data:n,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},e.prototype.shift=function(){if(this.length!==0){var n=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,n}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(n){if(this.length===0)return"";for(var i=this.head,r=""+i.data;i=i.next;)r+=n+i.data;return r},e.prototype.concat=function(n){if(this.length===0)return dd.alloc(0);for(var i=dd.allocUnsafe(n>>>0),r=this.head,a=0;r;)Qm(r.data,i,a),a+=r.data.length,r=r.next;return i},e})();Xn&&Xn.inspect&&Xn.inspect.custom&&(Ba.exports.prototype[Xn.inspect.custom]=function(){var e=Xn.inspect({length:this.length});return this.constructor.name+" "+e})});var Na=S((H1,pd)=>{"use strict";var ar=Yn();function eb(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,r=this._writableState&&this._writableState.destroyed;return i||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?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,ar.nextTick(sr,n,a)):ar.nextTick(sr,n,a):t&&t(a)}),this)}function tb(){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)}pd.exports={destroy:eb,undestroy:tb}});var hd=S(($1,fd)=>{"use strict";fd.exports=require("util").deprecate});var $a=S((U1,_d)=>{"use strict";var Pt=Yn();_d.exports=$;function md(e){var t=this;this.next=null,this.entry=null,this.finish=function(){vb(t,e)}}var nb=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Pt.nextTick,an;$.WritableState=Zn;var bd=Object.create(nn());bd.inherits=rn();var ib={deprecate:hd()},yd=Pa(),lr=Vn().Buffer,rb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function ab(e){return lr.from(e)}function sb(e){return lr.isBuffer(e)||e instanceof rb}var vd=Na();bd.inherits($,yd);function ob(){}function Zn(e,t){an=an||jt(),e=e||{};var n=t instanceof an;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,r=e.writableHighWaterMark,a=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:n&&(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){hb(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 md(this)}Zn.prototype.getBuffer=function(){for(var t=this.bufferedRequest,n=[];t;)n.push(t),t=t.next;return n};(function(){try{Object.defineProperty(Zn.prototype,"buffer",{get:ib.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 Zn}})):or=function(e){return e instanceof this};function $(e){if(an=an||jt(),!or.call($,this)&&!(this instanceof an))return new $(e);this._writableState=new Zn(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)),yd.call(this)}$.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function lb(e,t){var n=new Error("write after end");e.emit("error",n),Pt.nextTick(t,n)}function cb(e,t,n,i){var r=!0,a=!1;return n===null?a=new TypeError("May not write null values to stream"):typeof n!="string"&&n!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),Pt.nextTick(i,a),r=!1),r}$.prototype.write=function(e,t,n){var i=this._writableState,r=!1,a=!i.objectMode&&sb(e);return a&&!lr.isBuffer(e)&&(e=ab(e)),typeof t=="function"&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),typeof n!="function"&&(n=ob),i.ended?lb(this,n):(a||cb(this,i,e,n))&&(i.pendingcb++,r=ub(this,i,a,e,t,n)),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&&xd(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 db(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=lr.from(t,n)),t}Object.defineProperty($.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ub(e,t,n,i,r,a){if(!n){var s=db(t,i,r);i!==s&&(n=!0,r="buffer",i=s)}var o=t.objectMode?1:i.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:i,encoding:r,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Ha(e,t,!1,o,i,r,a);return d}function Ha(e,t,n,i,r,a,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,a,t.onwrite),t.sync=!1}function pb(e,t,n,i,r){--t.pendingcb,n?(Pt.nextTick(r,i),Pt.nextTick(Kn,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(r(i),e._writableState.errorEmitted=!0,e.emit("error",i),Kn(e,t))}function fb(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function hb(e,t){var n=e._writableState,i=n.sync,r=n.writecb;if(fb(n),t)pb(e,n,i,t,r);else{var a=wd(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&xd(e,n),i?nb(gd,e,n,a,r):gd(e,n,a,r)}}function gd(e,t,n,i){n||gb(e,t),t.pendingcb--,i(),Kn(e,t)}function gb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function xd(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,r=new Array(i),a=t.corkedRequestsFree;a.entry=n;for(var s=0,o=!0;n;)r[s]=n,n.isBuf||(o=!1),n=n.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 md(t),t.bufferedRequestCount=0}else{for(;n;){var d=n.chunk,l=n.encoding,c=n.callback,f=t.objectMode?1:d.length;if(Ha(e,t,!1,f,d,l,c),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}$.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))};$.prototype._writev=null;$.prototype.end=function(e,t,n){var i=this._writableState;typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||yb(this,i,n)};function wd(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function mb(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),Kn(e,t)})}function bb(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Pt.nextTick(mb,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Kn(e,t){var n=wd(t);return n&&(bb(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),n}function yb(e,t,n){t.ending=!0,Kn(e,t),n&&(t.finished?Pt.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function vb(e,t,n){var i=e.entry;for(e.entry=null;i;){var r=i.callback;t.pendingcb--,r(n),i=i.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=vd.destroy;$.prototype._undestroy=vd.undestroy;$.prototype._destroy=function(e,t){this.end(),t(e)}});var jt=S((q1,Cd)=>{"use strict";var Ed=Yn(),xb=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};Cd.exports=Qe;var Sd=Object.create(nn());Sd.inherits=rn();var Ad=Ga(),qa=$a();Sd.inherits(Qe,Ad);for(Ua=xb(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);Ad.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",wb)}Object.defineProperty(Qe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function wb(){this.allowHalfOpen||this._writableState.ended||Ed.nextTick(_b,this)}function _b(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(),Ed.nextTick(t,e)}});var Va=S(kd=>{"use strict";var Ya=Vn().Buffer,Td=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 Eb(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 Sb(e){var t=Eb(e);if(typeof t!="string"&&(Ya.isEncoding===Td||!Td(e)))throw new Error("Unknown encoding: "+e);return t||e}kd.StringDecoder=Jn;function Jn(e){this.encoding=Sb(e);var t;switch(this.encoding){case"utf16le":this.text=Rb,this.end=Mb,t=4;break;case"utf8":this.fillLast=Tb,t=4;break;case"base64":this.text=Ob,this.end=Ib,t=3;break;default:this.write=Pb,this.end=jb;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ya.allocUnsafe(t)}Jn.prototype.write=function(e){if(e.length===0)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""};Jn.prototype.end=Lb;Jn.prototype.text=kb;Jn.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 Ab(e,t,n){var i=t.length-1;if(i<n)return 0;var r=Wa(t[i]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--i<n||r===-2?0:(r=Wa(t[i]),r>=0?(r>0&&(e.lastNeed=r-2),r):--i<n||r===-2?0:(r=Wa(t[i]),r>=0?(r>0&&(r===2?r=0:e.lastNeed=r-3),r):0))}function Cb(e,t,n){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 Tb(e){var t=this.lastTotal-this.lastNeed,n=Cb(this,e,t);if(n!==void 0)return n;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 kb(e,t){var n=Ab(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function Lb(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function Rb(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function Mb(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function Ob(e,t){var n=(e.length-t)%3;return n===0?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,n===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-n))}function Ib(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Pb(e){return e.toString(this.encoding)}function jb(e){return e&&e.length?this.write(e):""}});var Ga=S((Y1,Nd)=>{"use strict";var on=Yn();Nd.exports=j;var Db=ad(),Qn;j.ReadableState=jd;var W1=require("events").EventEmitter,Od=function(e,t){return e.listeners(t).length},Qa=Pa(),ei=Vn().Buffer,zb=(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:{}).Uint8Array||function(){};function Fb(e){return ei.from(e)}function Bb(e){return ei.isBuffer(e)||e instanceof zb}var Id=Object.create(nn());Id.inherits=rn();var Xa=require("util"),O=void 0;Xa&&Xa.debuglog?O=Xa.debuglog("stream"):O=function(){};var Nb=ud(),Pd=Na(),sn;Id.inherits(j,Qa);var Ka=["error","close","destroy","pause","resume"];function Hb(e,t,n){if(typeof e.prependListener=="function")return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):Db(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function jd(e,t){Qn=Qn||jt(),e=e||{};var n=t instanceof Qn;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,r=e.readableHighWaterMark,a=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:n&&(r||r===0)?this.highWaterMark=r:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new Nb,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&&(sn||(sn=Va().StringDecoder),this.decoder=new sn(e.encoding),this.encoding=e.encoding)}function j(e){if(Qn=Qn||jt(),!(this instanceof j))return new j(e);this._readableState=new jd(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(j.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});j.prototype.destroy=Pd.destroy;j.prototype._undestroy=Pd.undestroy;j.prototype._destroy=function(e,t){this.push(null),t(e)};j.prototype.push=function(e,t){var n=this._readableState,i;return n.objectMode?i=!0:typeof e=="string"&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=ei.from(e,t),t=""),i=!0),Dd(this,e,t,!1,i)};j.prototype.unshift=function(e){return Dd(this,e,null,!0,!1)};function Dd(e,t,n,i,r){var a=e._readableState;if(t===null)a.reading=!1,Gb(e,a);else{var s;r||(s=$b(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==ei.prototype&&(t=Fb(t)),i?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&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?Za(e,a,t,!1):zd(e,a)):Za(e,a,t,!1))):i||(a.reading=!1)}return Ub(a)}function Za(e,t,n,i){t.flowing&&t.length===0&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&ur(e)),zd(e,t)}function $b(e,t){var n;return!Bb(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(n=new TypeError("Invalid non-string/buffer chunk")),n}function Ub(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}j.prototype.isPaused=function(){return this._readableState.flowing===!1};j.prototype.setEncoding=function(e){return sn||(sn=Va().StringDecoder),this._readableState.decoder=new sn(e),this._readableState.encoding=e,this};var Ld=8388608;function qb(e){return e>=Ld?e=Ld:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Rd(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=qb(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}j.prototype.read=function(e){O("read",e),e=parseInt(e,10);var t=this._readableState,n=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=Rd(e,t),e===0&&t.ended)return t.length===0&&Ja(this),null;var i=t.needReadable;O("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,O("length less than watermark",i)),t.ended||t.reading?(i=!1,O("reading or ended",i)):i&&(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=Rd(n,t)));var r;return e>0?r=Fd(e,t):r=null,r===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Ja(this)),r!==null&&this.emit("data",r),r};function Gb(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.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?on.nextTick(Md,e):Md(e))}function Md(e){O("emit readable"),e.emit("readable"),es(e)}function zd(e,t){t.readingMore||(t.readingMore=!0,on.nextTick(Wb,e,t))}function Wb(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(O("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}j.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};j.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,O("pipe count=%d opts=%j",i.pipesCount,t);var r=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=r?o:w;i.endEmitted?on.nextTick(a):n.once("end",a),e.on("unpipe",s);function s(y,m){O("onunpipe"),y===n&&m&&m.hasUnpiped===!1&&(m.hasUnpiped=!0,c())}function o(){O("onend"),e.end()}var d=Yb(n);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),n.removeListener("end",o),n.removeListener("end",w),n.removeListener("data",p),l=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&d()}var f=!1;n.on("data",p);function p(y){O("ondata"),f=!1;var m=e.write(y);m===!1&&!f&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&Bd(i.pipes,e)!==-1)&&!l&&(O("false write response, pause",i.awaitDrain),i.awaitDrain++,f=!0),n.pause())}function u(y){O("onerror",y),w(),e.removeListener("error",u),Od(e,"error")===0&&e.emit("error",y)}Hb(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"),n.unpipe(e)}return e.emit("pipe",n),i.flowing||(O("pipe resume"),n.resume()),e};function Yb(e){return function(){var t=e._readableState;O("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Od(e,"data")&&(t.flowing=!0,es(e))}}j.prototype.unpipe=function(e){var t=this._readableState,n={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,n),this);if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<r;a++)i[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,n),this)};j.prototype.on=function(e,t){var n=Qa.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var i=this._readableState;!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&ur(this):on.nextTick(Vb,this))}return n};j.prototype.addListener=j.prototype.on;function Vb(e){O("readable nexttick read 0"),e.read(0)}j.prototype.resume=function(){var e=this._readableState;return e.flowing||(O("resume"),e.flowing=!0,Xb(this,e)),this};function Xb(e,t){t.resumeScheduled||(t.resumeScheduled=!0,on.nextTick(Kb,e,t))}function Kb(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)}j.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;);}j.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;e.on("end",function(){if(O("wrapped end"),n.decoder&&!n.ended){var s=n.decoder.end();s&&s.length&&t.push(s)}t.push(null)}),e.on("data",function(s){if(O("wrapped data"),n.decoder&&(s=n.decoder.write(s)),!(n.objectMode&&s==null)&&!(!n.objectMode&&(!s||!s.length))){var o=t.push(s);o||(i=!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),i&&(i=!1,e.resume())},this};Object.defineProperty(j.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});j._fromList=Fd;function Fd(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(t.decoder?n=t.buffer.join(""):t.buffer.length===1?n=t.buffer.head.data:n=t.buffer.concat(t.length),t.buffer.clear()):n=Zb(e,t.buffer,t.decoder),n}function Zb(e,t,n){var i;return e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?i=t.shift():i=n?Jb(e,t):Qb(e,t),i}function Jb(e,t){var n=t.head,i=1,r=n.data;for(e-=r.length;n=n.next;){var a=n.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?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(s));break}++i}return t.length-=i,r}function Qb(e,t){var n=ei.allocUnsafe(e),i=t.head,r=1;for(i.data.copy(n),e-=i.data.length;i=i.next;){var a=i.data,s=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,s),e-=s,e===0){s===a.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(s));break}++r}return t.length-=r,n}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,on.nextTick(ey,t,e))}function ey(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Bd(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}});var ts=S((V1,Ud)=>{"use strict";Ud.exports=et;var pr=jt(),$d=Object.create(nn());$d.inherits=rn();$d.inherits(et,pr);function ty(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,t!=null&&this.push(t),i(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:ty.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",ny)}function ny(){var e=this;typeof this._flush=="function"?this._flush(function(t,n){Hd(e,t,n)}):Hd(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,n){throw new Error("_transform() is not implemented")};et.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.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 n=this;pr.prototype._destroy.call(this,e,function(i){t(i),n.emit("close")})};function Hd(e,t,n){if(t)return e.emit("error",t);if(n!=null&&e.push(n),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 Yd=S((X1,Wd)=>{"use strict";Wd.exports=ti;var qd=ts(),Gd=Object.create(nn());Gd.inherits=rn();Gd.inherits(ti,qd);function ti(e){if(!(this instanceof ti))return new ti(e);qd.call(this,e)}ti.prototype._transform=function(e,t,n){n(null,e)}});var ns=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=jt(),Y.Transform=ts(),Y.PassThrough=Yd())});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{is=new ArrayBuffer(0);try{ae.blob=new Blob([is],{type:"application/zip"}).size===0}catch{try{Vd=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,rs=new Vd,rs.append(is),ae.blob=rs.getBlob("application/zip").size===0}catch{ae.blob=!1}}}var is,Vd,rs;try{ae.nodestream=!!ns().Readable}catch{ae.nodestream=!1}});var ss=S(as=>{"use strict";var iy=B(),ry=tt(),Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";as.encode=function(e){for(var t=[],n,i,r,a,s,o,d,l=0,c=e.length,f=c,p=iy.getTypeOf(e)!=="string";l<e.length;)f=c-l,p?(n=e[l++],i=l<c?e[l++]:0,r=l<c?e[l++]:0):(n=e.charCodeAt(l++),i=l<c?e.charCodeAt(l++):0,r=l<c?e.charCodeAt(l++):0),a=n>>2,s=(n&3)<<4|i>>4,o=f>1?(i&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,n,i,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(ry.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,n=(a&15)<<4|s>>2,i=(s&3)<<6|o,p[l++]=t,s!==64&&(p[l++]=n),o!==64&&(p[l++]=i);return p}});var ni=S((J1,Xd)=>{"use strict";Xd.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 Qd=S((Q1,Jd)=>{"use strict";var Kd=global.MutationObserver||global.WebKitMutationObserver,ln;process.browser?Kd?(os=0,Zd=new Kd(ii),ls=global.document.createTextNode(""),Zd.observe(ls,{characterData:!0}),ln=function(){ls.data=os=++os%2}):!global.setImmediate&&typeof global.MessageChannel!="undefined"?(cs=new global.MessageChannel,cs.port1.onmessage=ii,ln=function(){cs.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?ln=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){ii(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:ln=function(){setTimeout(ii,0)}:ln=function(){process.nextTick(ii)};var os,Zd,ls,cs,ds,ri=[];function ii(){ds=!0;for(var e,t,n=ri.length;n;){for(t=ri,ri=[],e=-1;++e<n;)t[e]();n=ri.length}ds=!1}Jd.exports=ay;function ay(e){ri.push(e)===1&&!ds&&ln()}});var su=S((eE,au)=>{"use strict";var eu=Qd();function cn(){}var Z={},tu=["REJECTED"],us=["FULFILLED"],nu=["PENDING"];process.browser||(ai=["UNHANDLED"]);var ai;au.exports=ft;function ft(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=nu,this.queue=[],this.outcome=void 0,process.browser||(this.handled=ai),e!==cn&&iu(this,e)}ft.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(n,i);function n(r){function a(){return r}return t.resolve(e()).then(a)}function i(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===tu)return this;var n=new this.constructor(cn);if(process.browser||this.handled===ai&&(this.handled=null),this.state!==nu){var i=this.state===us?e:t;ps(n,i,this.outcome)}else this.queue.push(new si(n,e,t));return n};function si(e,t,n){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof n=="function"&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}si.prototype.callFulfilled=function(e){Z.resolve(this.promise,e)};si.prototype.otherCallFulfilled=function(e){ps(this.promise,this.onFulfilled,e)};si.prototype.callRejected=function(e){Z.reject(this.promise,e)};si.prototype.otherCallRejected=function(e){ps(this.promise,this.onRejected,e)};function ps(e,t,n){eu(function(){var i;try{i=t(n)}catch(r){return Z.reject(e,r)}i===e?Z.reject(e,new TypeError("Cannot resolve promise with itself")):Z.resolve(e,i)})}Z.resolve=function(e,t){var n=ru(sy,t);if(n.status==="error")return Z.reject(e,n.value);var i=n.value;if(i)iu(e,i);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=tu,e.outcome=t,process.browser||e.handled===ai&&eu(function(){e.handled===ai&&process.emit("unhandledRejection",t,e)});for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e};function sy(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 n=!1;function i(o){n||(n=!0,Z.reject(e,o))}function r(o){n||(n=!0,Z.resolve(e,o))}function a(){t(r,i)}var s=ru(a);s.status==="error"&&i(s.value)}function ru(e,t){var n={};try{n.value=e(t),n.status="success"}catch(i){n.status="error",n.value=i}return n}ft.resolve=oy;function oy(e){return e instanceof this?e:Z.resolve(new this(cn),e)}ft.reject=ly;function ly(e){var t=new this(cn);return Z.reject(t,e)}ft.all=cy;function cy(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var r=new Array(n),a=0,s=-1,o=new this(cn);++s<n;)d(e[s],s);return o;function d(l,c){t.resolve(l).then(f,function(p){i||(i=!0,Z.reject(o,p))});function f(p){r[c]=p,++a===n&&!i&&(i=!0,Z.resolve(o,r))}}}ft.race=dy;function dy(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var r=-1,a=new this(cn);++r<n;)s(e[r]);return a;function s(o){t.resolve(o).then(function(d){i||(i=!0,Z.resolve(a,d))},function(d){i||(i=!0,Z.reject(a,d))})}}});var dn=S((tE,ou)=>{"use strict";var fs=null;typeof Promise!="undefined"?fs=Promise:fs=su();ou.exports={Promise:fs}});var cu=S(lu=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var n=1,i={},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 i[n]=x,s(n),n++}function d(m){delete i[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=i[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"?lu:global:self)});var B=S(U=>{"use strict";var ht=tt(),uy=ss(),un=ni(),hs=dn();cu();function py(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 n=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,i=new n;return i.append(e),i.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function oi(e){return e}function gr(e,t){for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)&255;return t}var hr={stringifyByChunk:function(e,t,n){var i=[],r=0,a=e.length;if(a<=n)return String.fromCharCode.apply(null,e);for(;r<a;)t==="array"||t==="nodebuffer"?i.push(String.fromCharCode.apply(null,e.slice(r,Math.min(r+n,a)))):i.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+n,a)))),r+=n;return i.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);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,un.allocBuffer(1)).length===1}catch{return!1}})()}};function li(e){var t=65536,n=U.getTypeOf(e),i=!0;if(n==="uint8array"?i=hr.applyCanBeUsed.uint8array:n==="nodebuffer"&&(i=hr.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return hr.stringifyByChunk(e,n,t)}catch{t=Math.floor(t/2)}return hr.stringifyByChar(e)}U.applyFromCharCode=li;function mr(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}var gt={};gt.string={string:oi,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,un.allocBuffer(e.length))}};gt.array={string:li,array:oi,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return un.newBufferFrom(e)}};gt.arraybuffer={string:function(e){return li(new Uint8Array(e))},array:function(e){return mr(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:oi,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return un.newBufferFrom(new Uint8Array(e))}};gt.uint8array={string:li,array:function(e){return mr(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:oi,nodebuffer:function(e){return un.newBufferFrom(e)}};gt.nodebuffer={string:li,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:oi};U.transformTo=function(e,t){if(t||(t=""),!e)return t;U.checkSupport(e);var n=U.getTypeOf(t),i=gt[n][e](t);return i};U.resolve=function(e){for(var t=e.split("/"),n=[],i=0;i<t.length;i++){var r=t[i];r==="."||r===""&&i!==0&&i!==t.length-1||(r===".."?n.pop():n.push(r))}return n.join("/")};U.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(ht.nodebuffer&&un.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="",n,i;for(i=0;i<(e||"").length;i++)n=e.charCodeAt(i),t+="\\x"+(n<16?"0":"")+n.toString(16).toUpperCase();return t};U.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})};U.inherits=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n};U.extend=function(){var e={},t,n;for(t=0;t<arguments.length;t++)for(n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&typeof e[n]=="undefined"&&(e[n]=arguments[t][n]);return e};U.prepareContent=function(e,t,n,i,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=uy.decode(s):n&&i!==!0&&(s=py(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((rE,uu)=>{"use strict";function du(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}du.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 n=0;n<this._listeners[e].length;n++)this._listeners[e][n].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(n){t.processChunk(n)}),e.on("end",function(){t.end()}),e.on("error",function(n){t.error(n)}),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}};uu.exports=du});var fn=S(mt=>{"use strict";var pn=B(),Dt=tt(),fy=ni(),br=se(),ci=new Array(256);for(nt=0;nt<256;nt++)ci[nt]=nt>=252?6:nt>=248?5:nt>=240?4:nt>=224?3:nt>=192?2:1;var nt;ci[254]=ci[254]=1;var hy=function(e){var t,n,i,r,a,s=e.length,o=0;for(r=0;r<s;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<s&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(Dt.uint8array?t=new Uint8Array(o):t=new Array(o),a=0,r=0;a<o;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<s&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t},gy=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+ci[e[n]]>t?n:t},my=function(e){var t,n,i,r,a=e.length,s=new Array(a*2);for(n=0,t=0;t<a;){if(i=e[t++],i<128){s[n++]=i;continue}if(r=ci[i],r>4){s[n++]=65533,t+=r-1;continue}for(i&=r===2?31:r===3?15:7;r>1&&t<a;)i=i<<6|e[t++]&63,r--;if(r>1){s[n++]=65533;continue}i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|i&1023)}return s.length!==n&&(s.subarray?s=s.subarray(0,n):s.length=n),pn.applyFromCharCode(s)};mt.utf8encode=function(t){return Dt.nodebuffer?fy.newBufferFrom(t,"utf-8"):hy(t)};mt.utf8decode=function(t){return Dt.nodebuffer?pn.transformTo("nodebuffer",t).toString("utf-8"):(t=pn.transformTo(Dt.uint8array?"uint8array":"array",t),my(t))};function yr(){br.call(this,"utf-8 decode"),this.leftOver=null}pn.inherits(yr,br);yr.prototype.processChunk=function(e){var t=pn.transformTo(Dt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(Dt.uint8array){var n=t;t=new Uint8Array(n.length+this.leftOver.length),t.set(this.leftOver,0),t.set(n,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=gy(t),r=t;i!==t.length&&(Dt.uint8array?(r=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(r=t.slice(0,i),this.leftOver=t.slice(i,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")}pn.inherits(gs,br);gs.prototype.processChunk=function(e){this.push({data:mt.utf8encode(e.data),meta:e.meta})};mt.Utf8EncodeWorker=gs});var gu=S((sE,hu)=>{"use strict";var pu=se(),fu=B();function ms(e){pu.call(this,"ConvertWorker to "+e),this.destType=e}fu.inherits(ms,pu);ms.prototype.processChunk=function(e){this.push({data:fu.transformTo(this.destType,e.data),meta:e.meta})};hu.exports=ms});var yu=S((oE,bu)=>{"use strict";var mu=ns().Readable,by=B();by.inherits(bs,mu);function bs(e,t,n){mu.call(this,t),this._helper=e;var i=this;e.on("data",function(r,a){i.push(r)||i._helper.pause(),n&&n(a)}).on("error",function(r){i.emit("error",r)}).on("end",function(){i.push(null)})}bs.prototype._read=function(){this._helper.resume()};bu.exports=bs});var ys=S((lE,wu)=>{"use strict";var zt=B(),yy=gu(),vy=se(),xy=ss(),wy=tt(),_y=dn(),vu=null;if(wy.nodestream)try{vu=yu()}catch{}function Ey(e,t,n){switch(e){case"blob":return zt.newBlob(zt.transformTo("arraybuffer",t),n);case"base64":return xy.encode(t);default:return zt.transformTo(e,t)}}function Sy(e,t){var n,i=0,r=null,a=0;for(n=0;n<t.length;n++)a+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(a),n=0;n<t.length;n++)r.set(t[n],i),i+=t[n].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function Ay(e,t){return new _y.Promise(function(n,i){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=[],i(d)}).on("end",function(){try{var d=Ey(s,Sy(a,r),o);n(d)}catch(l){i(l)}r=[]}).resume()})}function xu(e,t,n){var i=t;switch(t){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string";break}try{this._internalType=i,this._outputType=t,this._mimeType=n,zt.checkSupport(i),this._worker=e.pipe(new yy(i)),e.lock()}catch(r){this._worker=new vy("error"),this._worker.error(r)}}xu.prototype={accumulate:function(e){return Ay(this,e)},on:function(e,t){var n=this;return e==="data"?this._worker.on(e,function(i){t.call(n,i.data,i.meta)}):this._worker.on(e,function(){zt.delay(t,arguments,n)}),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 vu(this,{objectMode:this._outputType!=="nodebuffer"},e)}};wu.exports=xu});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((dE,_u)=>{"use strict";var vr=B(),xr=se(),Cy=16*1024;function hn(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(n){t.dataIsReady=!0,t.data=n,t.max=n&&n.length||0,t.type=vr.getTypeOf(n),t.isPaused||t._tickAndRepeat()},function(n){t.error(n)})}vr.inherits(hn,xr);hn.prototype.cleanUp=function(){xr.prototype.cleanUp.call(this),this.data=null};hn.prototype.resume=function(){return xr.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,vr.delay(this._tickAndRepeat,[],this)),!0):!1};hn.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(vr.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};hn.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Cy,t=null,n=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,n);break;case"uint8array":t=this.data.subarray(this.index,n);break;case"array":case"nodebuffer":t=this.data.slice(this.index,n);break}return this.index=n,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};_u.exports=hn});var wr=S((uE,Su)=>{"use strict";var Ty=B();function ky(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var Eu=ky();function Ly(e,t,n,i){var r=Eu,a=i+n;e=e^-1;for(var s=i;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}function Ry(e,t,n,i){var r=Eu,a=i+n;e=e^-1;for(var s=i;s<a;s++)e=e>>>8^r[(e^t.charCodeAt(s))&255];return e^-1}Su.exports=function(t,n){if(typeof t=="undefined"||!t.length)return 0;var i=Ty.getTypeOf(t)!=="string";return i?Ly(n|0,t,t.length,0):Ry(n|0,t,t.length,0)}});var _s=S((pE,Cu)=>{"use strict";var Au=se(),My=wr(),Oy=B();function ws(){Au.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Oy.inherits(ws,Au);ws.prototype.processChunk=function(e){this.streamInfo.crc32=My(e.data,this.streamInfo.crc32||0),this.push(e)};Cu.exports=ws});var ku=S((fE,Tu)=>{"use strict";var Iy=B(),Es=se();function Ss(e){Es.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Iy.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)};Tu.exports=Ss});var _r=S((hE,Mu)=>{"use strict";var Lu=dn(),Ru=xs(),Py=_s(),As=ku();function Cs(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}Cs.prototype={getContentWorker:function(){var e=new Ru(Lu.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 Ru(Lu.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,n){return e.pipe(new Py).pipe(new As("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new As("compressedSize")).withStreamInfo("compression",t)};Mu.exports=Cs});var ju=S((gE,Pu)=>{"use strict";var jy=ys(),Dy=xs(),Ts=fn(),ks=_r(),Ou=se(),Ls=function(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}};Ls.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");n=e.toLowerCase();var i=n==="string"||n==="text";(n==="binarystring"||n==="text")&&(n="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!i&&(t=t.pipe(new Ts.Utf8EncodeWorker)),!r&&i&&(t=t.pipe(new Ts.Utf8DecodeWorker))}catch(a){t=new Ou("error"),t.error(a)}return new jy(t,n,"")},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 n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new Ts.Utf8EncodeWorker)),ks.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof ks?this._data.getContentWorker():this._data instanceof Ou?this._data:new Dy(this._data)}};var Iu=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],zy=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(Er=0;Er<Iu.length;Er++)Ls.prototype[Iu[Er]]=zy;var Er;Pu.exports=Ls});var it=S(J=>{"use strict";var Fy=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function By(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 n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var i in n)By(n,i)&&(e[i]=n[i])}}return e};J.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Ny={arraySet:function(e,t,n,i,r){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+i),r);return}for(var a=0;a<i;a++)e[r+a]=t[n+a]},flattenChunks:function(e){var t,n,i,r,a,s;for(i=0,t=0,n=e.length;t<n;t++)i+=e[t].length;for(s=new Uint8Array(i),r=0,t=0,n=e.length;t<n;t++)a=e[t],s.set(a,r),r+=a.length;return s}},Hy={arraySet:function(e,t,n,i,r){for(var a=0;a<i;a++)e[r+a]=t[n+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,Ny)):(J.Buf8=Array,J.Buf16=Array,J.Buf32=Array,J.assign(J,Hy))};J.setTyped(Fy)});var rp=S(bn=>{"use strict";var $y=it(),Uy=4,Du=0,zu=1,qy=2;function mn(e){for(var t=e.length;--t>=0;)e[t]=0}var Gy=0,Uu=1,Wy=2,Yy=3,Vy=258,Ds=29,gi=256,ui=gi+1+Ds,gn=30,zs=19,qu=2*ui+1,Ft=15,Rs=16,Xy=7,Fs=256,Gu=16,Wu=17,Yu=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],Ky=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Vu=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Zy=512,rt=new Array((ui+2)*2);mn(rt);var di=new Array(gn*2);mn(di);var pi=new Array(Zy);mn(pi);var fi=new Array(Vy-Yy+1);mn(fi);var Bs=new Array(Ds);mn(Bs);var Ar=new Array(gn);mn(Ar);function Ms(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}var Xu,Ku,Zu;function Os(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Ju(e){return e<256?pi[e]:pi[256+(e>>>7)]}function hi(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function ne(e,t,n){e.bi_valid>Rs-n?(e.bi_buf|=t<<e.bi_valid&65535,hi(e,e.bi_buf),e.bi_buf=t>>Rs-e.bi_valid,e.bi_valid+=n-Rs):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function Oe(e,t,n){ne(e,n[t*2],n[t*2+1])}function Qu(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function Jy(e){e.bi_valid===16?(hi(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 Qy(e,t){var n=t.dyn_tree,i=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<=Ft;p++)e.bl_count[p]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<qu;l++)c=e.heap[l],p=n[n[c*2+1]*2+1]+1,p>d&&(p=d,h++),n[c*2+1]=p,!(c>i)&&(e.bl_count[p]++,u=0,c>=o&&(u=s[c-o]),v=n[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>i)&&(n[f*2+1]!==p&&(e.opt_len+=(p-n[f*2+1])*n[f*2],n[f*2+1]=p),c--)}}function ep(e,t,n){var i=new Array(Ft+1),r=0,a,s;for(a=1;a<=Ft;a++)i[a]=r=r+n[a-1]<<1;for(s=0;s<=t;s++){var o=e[s*2+1];o!==0&&(e[s*2]=Qu(i[o]++,o))}}function ev(){var e,t,n,i,r,a=new Array(Ft+1);for(n=0,i=0;i<Ds-1;i++)for(Bs[i]=n,e=0;e<1<<Ps[i];e++)fi[n++]=i;for(fi[n-1]=i,r=0,i=0;i<16;i++)for(Ar[i]=r,e=0;e<1<<Sr[i];e++)pi[r++]=i;for(r>>=7;i<gn;i++)for(Ar[i]=r<<7,e=0;e<1<<Sr[i]-7;e++)pi[256+r++]=i;for(t=0;t<=Ft;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(ep(rt,ui+1,a),e=0;e<gn;e++)di[e*2+1]=5,di[e*2]=Qu(e,5);Xu=new Ms(rt,Ps,gi+1,ui,Ft),Ku=new Ms(di,Sr,0,gn,Ft),Zu=new Ms(new Array(0),Ky,0,zs,Xy)}function tp(e){var t;for(t=0;t<ui;t++)e.dyn_ltree[t*2]=0;for(t=0;t<gn;t++)e.dyn_dtree[t*2]=0;for(t=0;t<zs;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Fs*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function np(e){e.bi_valid>8?hi(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 tv(e,t,n,i){np(e),i&&(hi(e,n),hi(e,~n)),$y.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}function Fu(e,t,n,i){var r=t*2,a=n*2;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[n]}function Is(e,t,n){for(var i=e.heap[n],r=n<<1;r<=e.heap_len&&(r<e.heap_len&&Fu(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Fu(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i}function Bu(e,t,n){var i,r,a=0,s,o;if(e.last_lit!==0)do i=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++,i===0?Oe(e,r,t):(s=fi[r],Oe(e,s+gi+1,t),o=Ps[s],o!==0&&(r-=Bs[s],ne(e,r,o)),i--,s=Ju(i),Oe(e,s,n),o=Sr[s],o!==0&&(i-=Ar[s],ne(e,i,o)));while(a<e.last_lit);Oe(e,Fs,t)}function js(e,t){var n=t.dyn_tree,i=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=qu,s=0;s<a;s++)n[s*2]!==0?(e.heap[++e.heap_len]=d=s,e.depth[s]=0):n[s*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=d<2?++d:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=i[l*2+1]);for(t.max_code=d,s=e.heap_len>>1;s>=1;s--)Is(e,n,s);l=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Is(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,n[l*2]=n[s*2]+n[o*2],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,n[s*2+1]=n[o*2+1]=l,e.heap[1]=l++,Is(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Qy(e,t),ep(n,d,e.bl_count)}function Nu(e,t,n){var i,r=-1,a,s=t[1],o=0,d=7,l=4;for(s===0&&(d=138,l=3),t[(n+1)*2+1]=65535,i=0;i<=n;i++)a=s,s=t[(i+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[Gu*2]++):o<=10?e.bl_tree[Wu*2]++:e.bl_tree[Yu*2]++,o=0,r=a,s===0?(d=138,l=3):a===s?(d=6,l=3):(d=7,l=4))}function Hu(e,t,n){var i,r=-1,a,s=t[1],o=0,d=7,l=4;for(s===0&&(d=138,l=3),i=0;i<=n;i++)if(a=s,s=t[(i+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,Gu,e.bl_tree),ne(e,o-3,2)):o<=10?(Oe(e,Wu,e.bl_tree),ne(e,o-3,3)):(Oe(e,Yu,e.bl_tree),ne(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 nv(e){var t;for(Nu(e,e.dyn_ltree,e.l_desc.max_code),Nu(e,e.dyn_dtree,e.d_desc.max_code),js(e,e.bl_desc),t=zs-1;t>=3&&e.bl_tree[Vu[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function iv(e,t,n,i){var r;for(ne(e,t-257,5),ne(e,n-1,5),ne(e,i-4,4),r=0;r<i;r++)ne(e,e.bl_tree[Vu[r]*2+1],3);Hu(e,e.dyn_ltree,t-1),Hu(e,e.dyn_dtree,n-1)}function rv(e){var t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Du;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return zu;for(n=32;n<gi;n++)if(e.dyn_ltree[n*2]!==0)return zu;return Du}var $u=!1;function av(e){$u||(ev(),$u=!0),e.l_desc=new Os(e.dyn_ltree,Xu),e.d_desc=new Os(e.dyn_dtree,Ku),e.bl_desc=new Os(e.bl_tree,Zu),e.bi_buf=0,e.bi_valid=0,tp(e)}function ip(e,t,n,i){ne(e,(Gy<<1)+(i?1:0),3),tv(e,t,n,!0)}function sv(e){ne(e,Uu<<1,3),Oe(e,Fs,rt),Jy(e)}function ov(e,t,n,i){var r,a,s=0;e.level>0?(e.strm.data_type===qy&&(e.strm.data_type=rv(e)),js(e,e.l_desc),js(e,e.d_desc),s=nv(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=n+5,n+4<=r&&t!==-1?ip(e,t,n,i):e.strategy===Uy||a===r?(ne(e,(Uu<<1)+(i?1:0),3),Bu(e,rt,di)):(ne(e,(Wy<<1)+(i?1:0),3),iv(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Bu(e,e.dyn_ltree,e.dyn_dtree)),tp(e),i&&np(e)}function lv(e,t,n){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]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(fi[n]+gi+1)*2]++,e.dyn_dtree[Ju(t)*2]++),e.last_lit===e.lit_bufsize-1}bn._tr_init=av;bn._tr_stored_block=ip;bn._tr_flush_block=ov;bn._tr_tally=lv;bn._tr_align=sv});var Ns=S((yE,ap)=>{"use strict";function cv(e,t,n,i){for(var r=e&65535|0,a=e>>>16&65535|0,s=0;n!==0;){s=n>2e3?2e3:n,n-=s;do r=r+t[i++]|0,a=a+r|0;while(--s);r%=65521,a%=65521}return r|a<<16|0}ap.exports=cv});var Hs=S((vE,sp)=>{"use strict";function dv(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var uv=dv();function pv(e,t,n,i){var r=uv,a=i+n;e^=-1;for(var s=i;s<a;s++)e=e>>>8^r[(e^t[s])&255];return e^-1}sp.exports=pv});var Cr=S((xE,op)=>{"use strict";op.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var mp=S(je=>{"use strict";var Q=it(),me=rp(),up=Ns(),bt=Hs(),fv=Cr(),$t=0,hv=1,gv=3,_t=4,lp=5,Pe=0,cp=1,be=-2,mv=-3,$s=-5,bv=-1,yv=1,Tr=2,vv=3,xv=4,wv=0,_v=2,Mr=8,Ev=9,Sv=15,Av=8,Cv=29,Tv=256,qs=Tv+1+Cv,kv=30,Lv=19,Rv=2*qs+1,Mv=15,R=3,xt=258,Ee=xt+R+1,Ov=32,Or=42,Gs=69,kr=73,Lr=91,Rr=103,Bt=113,bi=666,W=1,yi=2,Nt=3,xn=4,Iv=3;function wt(e,t){return e.msg=fv[t],t}function dp(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,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(Q.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,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 mi(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Pv(e,t,n,i){var r=e.avail_in;return r>i&&(r=i),r===0?0:(e.avail_in-=r,Q.arraySet(t,e.input,e.next_in,r,n),e.state.wrap===1?e.adler=up(e.adler,t,r,n):e.state.wrap===2&&(e.adler=bt(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)}function pp(e,t){var n=e.max_chain_length,i=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[i+s-1],v=l[i+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(r=t,!(l[r+s]!==v||l[r+s-1]!==u||l[r]!==l[i]||l[++r]!==l[i+1])){i+=2,r++;do;while(l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&i<p);if(a=xt-(p-i),i=p-xt,a>s){if(e.match_start=t,s=a,a>=o)break;u=l[i+s-1],v=l[i+s]}}while((t=f[t&c])>d&&--n!==0);return s<=e.lookahead?s:e.lookahead}function Ht(e){var t=e.w_size,n,i,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,i=e.hash_size,n=i;do r=e.head[--n],e.head[n]=r>=t?r-t:0;while(--i);i=t,n=i;do r=e.prev[--n],e.prev[n]=r>=t?r-t:0;while(--i);a+=t}if(e.strm.avail_in===0)break;if(i=Pv(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=i,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 jv(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=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 i=e.block_start+n;if((e.strstart===0||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,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:xn):(e.strstart>e.block_start&&(V(e,!1),e.strm.avail_out===0),W)}function Us(e,t){for(var n,i;;){if(e.lookahead<Ee){if(Ht(e),e.lookahead<Ee&&t===$t)return W;if(e.lookahead===0)break}if(n=0,e.lookahead>=R&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Ee&&(e.match_length=pp(e,n)),e.match_length>=R)if(i=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,n=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 i=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(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:xn):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yi}function yn(e,t){for(var n,i,r;;){if(e.lookahead<Ee){if(Ht(e),e.lookahead<Ee&&t===$t)return W;if(e.lookahead===0)break}if(n=0,e.lookahead>=R&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+R-1])&e.hash_mask,n=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,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Ee&&(e.match_length=pp(e,n),e.match_length<=5&&(e.strategy===yv||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,i=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,n=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++,i&&(V(e,!1),e.strm.avail_out===0))return W}else if(e.match_available){if(i=me._tr_tally(e,0,e.window[e.strstart-1]),i&&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&&(i=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:xn):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yi}function Dv(e,t){for(var n,i,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,i=s[r],i===s[++r]&&i===s[++r]&&i===s[++r])){a=e.strstart+xt;do;while(i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===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?(n=me._tr_tally(e,1,e.match_length-R),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(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:xn):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yi}function zv(e,t){for(var n;;){if(e.lookahead===0&&(Ht(e),e.lookahead===0)){if(t===$t)return W;break}if(e.match_length=0,n=me._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(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:xn):e.last_lit&&(V(e,!1),e.strm.avail_out===0)?W:yi}function Ie(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}var vn;vn=[new Ie(0,0,0,0,jv),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,yn),new Ie(8,16,32,32,yn),new Ie(8,16,128,128,yn),new Ie(8,32,128,256,yn),new Ie(32,128,258,1024,yn),new Ie(32,258,258,4096,yn)];function Fv(e){e.window_size=2*e.w_size,vt(e.head),e.max_lazy_match=vn[e.level].max_lazy,e.good_match=vn[e.level].good_length,e.nice_match=vn[e.level].nice_length,e.max_chain_length=vn[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 Bv(){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(Rv*2),this.dyn_dtree=new Q.Buf16((2*kv+1)*2),this.bl_tree=new Q.Buf16((2*Lv+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(Mv+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 fp(e){var t;return!e||!e.state?wt(e,be):(e.total_in=e.total_out=0,e.data_type=_v,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Or:Bt,e.adler=t.wrap===2?0:1,t.last_flush=$t,me._tr_init(t),Pe)}function hp(e){var t=fp(e);return t===Pe&&Fv(e.state),t}function Nv(e,t){return!e||!e.state||e.state.wrap!==2?be:(e.state.gzhead=t,Pe)}function gp(e,t,n,i,r,a){if(!e)return be;var s=1;if(t===bv&&(t=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),r<1||r>Ev||n!==Mr||i<8||i>15||t<0||t>9||a<0||a>xv)return wt(e,be);i===8&&(i=9);var o=new Bv;return e.state=o,o.strm=e,o.wrap=s,o.gzhead=null,o.w_bits=i,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=n,hp(e)}function Hv(e,t){return gp(e,t,Mr,Sv,Av,wv)}function $v(e,t){var n,i,r,a;if(!e||!e.state||t>lp||t<0)return e?wt(e,be):be;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===bi&&t!==_t)return wt(e,e.avail_out===0?$s:be);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===Or)if(i.wrap===2)e.adler=0,M(i,31),M(i,139),M(i,8),i.gzhead?(M(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),M(i,i.gzhead.time&255),M(i,i.gzhead.time>>8&255),M(i,i.gzhead.time>>16&255),M(i,i.gzhead.time>>24&255),M(i,i.level===9?2:i.strategy>=Tr||i.level<2?4:0),M(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(M(i,i.gzhead.extra.length&255),M(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=bt(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Gs):(M(i,0),M(i,0),M(i,0),M(i,0),M(i,0),M(i,i.level===9?2:i.strategy>=Tr||i.level<2?4:0),M(i,Iv),i.status=Bt);else{var s=Mr+(i.w_bits-8<<4)<<8,o=-1;i.strategy>=Tr||i.level<2?o=0:i.level<6?o=1:i.level===6?o=2:o=3,s|=o<<6,i.strstart!==0&&(s|=Ov),s+=31-s%31,i.status=Bt,mi(i,s),i.strstart!==0&&(mi(i,e.adler>>>16),mi(i,e.adler&65535)),e.adler=1}if(i.status===Gs)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=bt(e.adler,i.pending_buf,i.pending-r,r)),yt(e),r=i.pending,i.pending===i.pending_buf_size));)M(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(e.adler=bt(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=kr)}else i.status=kr;if(i.status===kr)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=bt(e.adler,i.pending_buf,i.pending-r,r)),yt(e),r=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.name.length?a=i.gzhead.name.charCodeAt(i.gzindex++)&255:a=0,M(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=bt(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.gzindex=0,i.status=Lr)}else i.status=Lr;if(i.status===Lr)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(e.adler=bt(e.adler,i.pending_buf,i.pending-r,r)),yt(e),r=i.pending,i.pending===i.pending_buf_size)){a=1;break}i.gzindex<i.gzhead.comment.length?a=i.gzhead.comment.charCodeAt(i.gzindex++)&255:a=0,M(i,a)}while(a!==0);i.gzhead.hcrc&&i.pending>r&&(e.adler=bt(e.adler,i.pending_buf,i.pending-r,r)),a===0&&(i.status=Rr)}else i.status=Rr;if(i.status===Rr&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&yt(e),i.pending+2<=i.pending_buf_size&&(M(i,e.adler&255),M(i,e.adler>>8&255),e.adler=0,i.status=Bt)):i.status=Bt),i.pending!==0){if(yt(e),e.avail_out===0)return i.last_flush=-1,Pe}else if(e.avail_in===0&&dp(t)<=dp(n)&&t!==_t)return wt(e,$s);if(i.status===bi&&e.avail_in!==0)return wt(e,$s);if(e.avail_in!==0||i.lookahead!==0||t!==$t&&i.status!==bi){var d=i.strategy===Tr?zv(i,t):i.strategy===vv?Dv(i,t):vn[i.level].func(i,t);if((d===Nt||d===xn)&&(i.status=bi),d===W||d===Nt)return e.avail_out===0&&(i.last_flush=-1),Pe;if(d===yi&&(t===hv?me._tr_align(i):t!==lp&&(me._tr_stored_block(i,0,0,!1),t===gv&&(vt(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),yt(e),e.avail_out===0))return i.last_flush=-1,Pe}return t!==_t?Pe:i.wrap<=0?cp:(i.wrap===2?(M(i,e.adler&255),M(i,e.adler>>8&255),M(i,e.adler>>16&255),M(i,e.adler>>24&255),M(i,e.total_in&255),M(i,e.total_in>>8&255),M(i,e.total_in>>16&255),M(i,e.total_in>>24&255)):(mi(i,e.adler>>>16),mi(i,e.adler&65535)),yt(e),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?Pe:cp)}function Uv(e){var t;return!e||!e.state?be:(t=e.state.status,t!==Or&&t!==Gs&&t!==kr&&t!==Lr&&t!==Rr&&t!==Bt&&t!==bi?wt(e,be):(e.state=null,t===Bt?wt(e,mv):Pe))}function qv(e,t){var n=t.length,i,r,a,s,o,d,l,c;if(!e||!e.state||(i=e.state,s=i.wrap,s===2||s===1&&i.status!==Or||i.lookahead))return be;for(s===1&&(e.adler=up(e.adler,t,n,0)),i.wrap=0,n>=i.w_size&&(s===0&&(vt(i.head),i.strstart=0,i.block_start=0,i.insert=0),c=new Q.Buf8(i.w_size),Q.arraySet(c,t,n-i.w_size,i.w_size,0),t=c,n=i.w_size),o=e.avail_in,d=e.next_in,l=e.input,e.avail_in=n,e.next_in=0,e.input=t,Ht(i);i.lookahead>=R;){r=i.strstart,a=i.lookahead-(R-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+R-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++;while(--a);i.strstart=r,i.lookahead=R-1,Ht(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=R-1,i.match_available=0,e.next_in=d,e.input=l,e.avail_in=o,i.wrap=s,Pe}je.deflateInit=Hv;je.deflateInit2=gp;je.deflateReset=hp;je.deflateResetKeep=fp;je.deflateSetHeader=Nv;je.deflate=$v;je.deflateEnd=Uv;je.deflateSetDictionary=qv;je.deflateInfo="pako deflate (from Nodeca project)"});var Ws=S(wn=>{"use strict";var Ir=it(),bp=!0,yp=!0;try{String.fromCharCode.apply(null,[0])}catch{bp=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{yp=!1}var vi=new Ir.Buf8(256);for(at=0;at<256;at++)vi[at]=at>=252?6:at>=248?5:at>=240?4:at>=224?3:at>=192?2:1;var at;vi[254]=vi[254]=1;wn.string2buf=function(e){var t,n,i,r,a,s=e.length,o=0;for(r=0;r<s;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<s&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Ir.Buf8(o),a=0,r=0;a<o;r++)n=e.charCodeAt(r),(n&64512)===55296&&r+1<s&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[a++]=n:n<2048?(t[a++]=192|n>>>6,t[a++]=128|n&63):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|n&63):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|n&63);return t};function vp(e,t){if(t<65534&&(e.subarray&&yp||!e.subarray&&bp))return String.fromCharCode.apply(null,Ir.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}wn.buf2binstring=function(e){return vp(e,e.length)};wn.binstring2buf=function(e){for(var t=new Ir.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t};wn.buf2string=function(e,t){var n,i,r,a,s=t||e.length,o=new Array(s*2);for(i=0,n=0;n<s;){if(r=e[n++],r<128){o[i++]=r;continue}if(a=vi[r],a>4){o[i++]=65533,n+=a-1;continue}for(r&=a===2?31:a===3?15:7;a>1&&n<s;)r=r<<6|e[n++]&63,a--;if(a>1){o[i++]=65533;continue}r<65536?o[i++]=r:(r-=65536,o[i++]=55296|r>>10&1023,o[i++]=56320|r&1023)}return vp(o,i)};wn.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+vi[e[n]]>t?n:t}});var Ys=S((EE,xp)=>{"use strict";function Gv(){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}xp.exports=Gv});var Sp=S(_i=>{"use strict";var xi=mp(),wi=it(),Xs=Ws(),Ks=Cr(),Wv=Ys(),Ep=Object.prototype.toString,Yv=0,Vs=4,_n=0,wp=1,_p=2,Vv=-1,Xv=0,Kv=8;function Ut(e){if(!(this instanceof Ut))return new Ut(e);this.options=wi.assign({level:Vv,method:Kv,chunkSize:16384,windowBits:15,memLevel:8,strategy:Xv,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 Wv,this.strm.avail_out=0;var n=xi.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==_n)throw new Error(Ks[n]);if(t.header&&xi.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(typeof t.dictionary=="string"?i=Xs.string2buf(t.dictionary):Ep.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,n=xi.deflateSetDictionary(this.strm,i),n!==_n)throw new Error(Ks[n]);this._dict_set=!0}}Ut.prototype.push=function(e,t){var n=this.strm,i=this.options.chunkSize,r,a;if(this.ended)return!1;a=t===~~t?t:t===!0?Vs:Yv,typeof e=="string"?n.input=Xs.string2buf(e):Ep.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new wi.Buf8(i),n.next_out=0,n.avail_out=i),r=xi.deflate(n,a),r!==wp&&r!==_n)return this.onEnd(r),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===Vs||a===_p))&&(this.options.to==="string"?this.onData(Xs.buf2binstring(wi.shrinkBuf(n.output,n.next_out))):this.onData(wi.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&r!==wp);return a===Vs?(r=xi.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===_n):(a===_p&&(this.onEnd(_n),n.avail_out=0),!0)};Ut.prototype.onData=function(e){this.chunks.push(e)};Ut.prototype.onEnd=function(e){e===_n&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=wi.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Zs(e,t){var n=new Ut(t);if(n.push(e,!0),n.err)throw n.msg||Ks[n.err];return n.result}function Zv(e,t){return t=t||{},t.raw=!0,Zs(e,t)}function Jv(e,t){return t=t||{},t.gzip=!0,Zs(e,t)}_i.Deflate=Ut;_i.deflate=Zs;_i.deflateRaw=Zv;_i.gzip=Jv});var Cp=S((AE,Ap)=>{"use strict";var Pr=30,Qv=12;Ap.exports=function(t,n){var i,r,a,s,o,d,l,c,f,p,u,v,h,w,y,m,b,g,x,E,A,C,T,L,_;i=t.state,r=t.next_in,L=t.input,a=r+(t.avail_in-5),s=t.next_out,_=t.output,o=s-(n-t.avail_out),d=s+(t.avail_out-257),l=i.dmax,c=i.wsize,f=i.whave,p=i.wnext,u=i.window,v=i.hold,h=i.bits,w=i.lencode,y=i.distcode,m=(1<<i.lenbits)-1,b=(1<<i.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];n: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",i.mode=Pr;break e}if(v>>>=x,h-=x,x=s-o,A>x){if(x=A-x,x>f&&i.sane){t.msg="invalid distance too far back",i.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 n}else{t.msg="invalid distance code",i.mode=Pr;break e}break}}else if((x&64)===0){g=w[(g&65535)+(v&(1<<x)-1)];continue t}else if(x&32){i.mode=Qv;break e}else{t.msg="invalid literal/length code",i.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),i.hold=v,i.bits=h}});var Ip=S((CE,Op)=>{"use strict";var Tp=it(),En=15,kp=852,Lp=592,Rp=0,Js=1,Mp=2,ex=[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],tx=[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],nx=[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],ix=[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];Op.exports=function(t,n,i,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 Tp.Buf16(En+1),z=new Tp.Buf16(En+1),le=null,te=0,ie,xe,Ne;for(c=0;c<=En;c++)I[c]=0;for(f=0;f<r;f++)I[n[i+f]]++;for(v=l,u=En;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<=En;c++)if(y<<=1,y-=I[c],y<0)return-1;if(y>0&&(t===Rp||u!==1))return-1;for(z[1]=0,c=1;c<En;c++)z[c+1]=z[c]+I[c];for(f=0;f<r;f++)n[i+f]!==0&&(o[z[n[i+f]]++]=f);if(t===Rp?(T=le=o,_=19):t===Js?(T=ex,L-=257,le=tx,te-=257,_=256):(T=nx,le=ix,_=-1),b=0,f=0,c=p,C=s,h=v,w=0,E=-1,m=1<<v,A=m-1,t===Js&&m>kp||t===Mp&&m>Lp)return 1;for(;;){ie=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]=ie<<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=n[i+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>kp||t===Mp&&m>Lp)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 gf=S(Se=>{"use strict";var oe=it(),ro=Ns(),De=Hs(),rx=Cp(),Ei=Ip(),ax=0,sf=1,of=2,Pp=4,sx=5,jr=6,qt=0,ox=1,lx=2,ye=-2,lf=-3,ao=-4,cx=-5,jp=8,cf=1,Dp=2,zp=3,Fp=4,Bp=5,Np=6,Hp=7,$p=8,Up=9,qp=10,Fr=11,st=12,Qs=13,Gp=14,eo=15,Wp=16,Yp=17,Vp=18,Xp=19,Dr=20,zr=21,Kp=22,Zp=23,Jp=24,Qp=25,ef=26,to=27,tf=28,nf=29,D=30,so=31,dx=32,ux=852,px=592,fx=15,hx=fx;function rf(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function gx(){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 df(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=cf,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(ux),t.distcode=t.distdyn=new oe.Buf32(px),t.sane=1,t.back=-1,qt)}function uf(e){var t;return!e||!e.state?ye:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,df(e))}function pf(e,t){var n,i;return!e||!e.state||(i=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?ye:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,uf(e))}function ff(e,t){var n,i;return e?(i=new gx,e.state=i,i.window=null,n=pf(e,t),n!==qt&&(e.state=null),n):ye}function mx(e){return ff(e,hx)}var af=!0,no,io;function bx(e){if(af){var t;for(no=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(Ei(sf,e.lens,0,288,no,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ei(of,e.lens,0,32,io,0,e.work,{bits:5}),af=!1}e.lencode=no,e.lenbits=9,e.distcode=io,e.distbits=5}function hf(e,t,n,i){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)),i>=a.wsize?(oe.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),oe.arraySet(a.window,t,n-i,r,a.wnext),i-=r,i?(oe.arraySet(a.window,t,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0}function yx(e,t){var n,i,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;n=e.state,n.mode===st&&(n.mode=Qs),s=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,i=e.input,o=e.avail_in,l=n.hold,c=n.bits,f=o,p=d,C=qt;e:for(;;)switch(n.mode){case cf:if(n.wrap===0){n.mode=Qs;break}for(;c<16;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(n.wrap&2&&l===35615){n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=De(n.check,T,2,0),l=0,c=0,n.mode=Dp;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",n.mode=D;break}if((l&15)!==jp){e.msg="unknown compression method",n.mode=D;break}if(l>>>=4,c-=4,A=(l&15)+8,n.wbits===0)n.wbits=A;else if(A>n.wbits){e.msg="invalid window size",n.mode=D;break}n.dmax=1<<A,e.adler=n.check=1,n.mode=l&512?qp:st,l=0,c=0;break;case Dp:for(;c<16;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(n.flags=l,(n.flags&255)!==jp){e.msg="unknown compression method",n.mode=D;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=D;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,n.check=De(n.check,T,2,0)),l=0,c=0,n.mode=zp;case zp:for(;c<32;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}n.head&&(n.head.time=l),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=De(n.check,T,4,0)),l=0,c=0,n.mode=Fp;case Fp:for(;c<16;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,n.check=De(n.check,T,2,0)),l=0,c=0,n.mode=Bp;case Bp:if(n.flags&1024){for(;c<16;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&(T[0]=l&255,T[1]=l>>>8&255,n.check=De(n.check,T,2,0)),l=0,c=0}else n.head&&(n.head.extra=null);n.mode=Np;case Np:if(n.flags&1024&&(u=n.length,u>o&&(u=o),u&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),oe.arraySet(n.head.extra,i,a,u,A)),n.flags&512&&(n.check=De(n.check,i,u,a)),o-=u,a+=u,n.length-=u),n.length))break e;n.length=0,n.mode=Hp;case Hp:if(n.flags&2048){if(o===0)break e;u=0;do A=i[a+u++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&u<o);if(n.flags&512&&(n.check=De(n.check,i,u,a)),o-=u,a+=u,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=$p;case $p:if(n.flags&4096){if(o===0)break e;u=0;do A=i[a+u++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&u<o);if(n.flags&512&&(n.check=De(n.check,i,u,a)),o-=u,a+=u,A)break e}else n.head&&(n.head.comment=null);n.mode=Up;case Up:if(n.flags&512){for(;c<16;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(l!==(n.check&65535)){e.msg="header crc mismatch",n.mode=D;break}l=0,c=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=st;break;case qp:for(;c<32;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}e.adler=n.check=rf(l),l=0,c=0,n.mode=Fr;case Fr:if(n.havedict===0)return e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,n.hold=l,n.bits=c,lx;e.adler=n.check=1,n.mode=st;case st:if(t===sx||t===jr)break e;case Qs:if(n.last){l>>>=c&7,c-=c&7,n.mode=to;break}for(;c<3;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}switch(n.last=l&1,l>>>=1,c-=1,l&3){case 0:n.mode=Gp;break;case 1:if(bx(n),n.mode=Dr,t===jr){l>>>=2,c-=2;break e}break;case 2:n.mode=Yp;break;case 3:e.msg="invalid block type",n.mode=D}l>>>=2,c-=2;break;case Gp:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",n.mode=D;break}if(n.length=l&65535,l=0,c=0,n.mode=eo,t===jr)break e;case eo:n.mode=Wp;case Wp:if(u=n.length,u){if(u>o&&(u=o),u>d&&(u=d),u===0)break e;oe.arraySet(r,i,a,u,s),o-=u,a+=u,d-=u,s+=u,n.length-=u;break}n.mode=st;break;case Yp:for(;c<14;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(n.nlen=(l&31)+257,l>>>=5,c-=5,n.ndist=(l&31)+1,l>>>=5,c-=5,n.ncode=(l&15)+4,l>>>=4,c-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=D;break}n.have=0,n.mode=Vp;case Vp:for(;n.have<n.ncode;){for(;c<3;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}n.lens[I[n.have++]]=l&7,l>>>=3,c-=3}for(;n.have<19;)n.lens[I[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},C=Ei(ax,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,C){e.msg="invalid code lengths set",n.mode=D;break}n.have=0,n.mode=Xp;case Xp:for(;n.have<n.nlen+n.ndist;){for(;w=n.lencode[l&(1<<n.lenbits)-1],y=w>>>24,m=w>>>16&255,b=w&65535,!(y<=c);){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(b<16)l>>>=y,c-=y,n.lens[n.have++]=b;else{if(b===16){for(_=y+2;c<_;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(l>>>=y,c-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=D;break}A=n.lens[n.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+=i[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+=i[a++]<<c,c+=8}l>>>=y,c-=y,A=0,u=11+(l&127),l>>>=7,c-=7}if(n.have+u>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=D;break}for(;u--;)n.lens[n.have++]=A}}if(n.mode===D)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=D;break}if(n.lenbits=9,L={bits:n.lenbits},C=Ei(sf,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,C){e.msg="invalid literal/lengths set",n.mode=D;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},C=Ei(of,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,C){e.msg="invalid distances set",n.mode=D;break}if(n.mode=Dr,t===jr)break e;case Dr:n.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,n.hold=l,n.bits=c,rx(e,p),s=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,i=e.input,o=e.avail_in,l=n.hold,c=n.bits,n.mode===st&&(n.back=-1);break}for(n.back=0;w=n.lencode[l&(1<<n.lenbits)-1],y=w>>>24,m=w>>>16&255,b=w&65535,!(y<=c);){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(m&&(m&240)===0){for(g=y,x=m,E=b;w=n.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+=i[a++]<<c,c+=8}l>>>=g,c-=g,n.back+=g}if(l>>>=y,c-=y,n.back+=y,n.length=b,m===0){n.mode=ef;break}if(m&32){n.back=-1,n.mode=st;break}if(m&64){e.msg="invalid literal/length code",n.mode=D;break}n.extra=m&15,n.mode=Kp;case Kp:if(n.extra){for(_=n.extra;c<_;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,c-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Zp;case Zp:for(;w=n.distcode[l&(1<<n.distbits)-1],y=w>>>24,m=w>>>16&255,b=w&65535,!(y<=c);){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if((m&240)===0){for(g=y,x=m,E=b;w=n.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+=i[a++]<<c,c+=8}l>>>=g,c-=g,n.back+=g}if(l>>>=y,c-=y,n.back+=y,m&64){e.msg="invalid distance code",n.mode=D;break}n.offset=b,n.extra=m&15,n.mode=Jp;case Jp:if(n.extra){for(_=n.extra;c<_;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=D;break}n.mode=Qp;case Qp:if(d===0)break e;if(u=p-d,n.offset>u){if(u=n.offset-u,u>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=D;break}u>n.wnext?(u-=n.wnext,v=n.wsize-u):v=n.wnext-u,u>n.length&&(u=n.length),h=n.window}else h=r,v=s-n.offset,u=n.length;u>d&&(u=d),d-=u,n.length-=u;do r[s++]=h[v++];while(--u);n.length===0&&(n.mode=zr);break;case ef:if(d===0)break e;r[s++]=n.length,d--,n.mode=zr;break;case to:if(n.wrap){for(;c<32;){if(o===0)break e;o--,l|=i[a++]<<c,c+=8}if(p-=d,e.total_out+=p,n.total+=p,p&&(e.adler=n.check=n.flags?De(n.check,r,p,s-p):ro(n.check,r,p,s-p)),p=d,(n.flags?l:rf(l))!==n.check){e.msg="incorrect data check",n.mode=D;break}l=0,c=0}n.mode=tf;case tf:if(n.wrap&&n.flags){for(;c<32;){if(o===0)break e;o--,l+=i[a++]<<c,c+=8}if(l!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=D;break}l=0,c=0}n.mode=nf;case nf:C=ox;break e;case D:C=lf;break e;case so:return ao;case dx:default:return ye}return e.next_out=s,e.avail_out=d,e.next_in=a,e.avail_in=o,n.hold=l,n.bits=c,(n.wsize||p!==e.avail_out&&n.mode<D&&(n.mode<to||t!==Pp))&&hf(e,e.output,e.next_out,p-e.avail_out)?(n.mode=so,ao):(f-=e.avail_in,p-=e.avail_out,e.total_in+=f,e.total_out+=p,n.total+=p,n.wrap&&p&&(e.adler=n.check=n.flags?De(n.check,r,p,e.next_out-p):ro(n.check,r,p,e.next_out-p)),e.data_type=n.bits+(n.last?64:0)+(n.mode===st?128:0)+(n.mode===Dr||n.mode===eo?256:0),(f===0&&p===0||t===Pp)&&C===qt&&(C=cx),C)}function vx(e){if(!e||!e.state)return ye;var t=e.state;return t.window&&(t.window=null),e.state=null,qt}function xx(e,t){var n;return!e||!e.state||(n=e.state,(n.wrap&2)===0)?ye:(n.head=t,t.done=!1,qt)}function wx(e,t){var n=t.length,i,r,a;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==Fr)?ye:i.mode===Fr&&(r=1,r=ro(r,t,n,0),r!==i.check)?lf:(a=hf(e,t,n,n),a?(i.mode=so,ao):(i.havedict=1,qt))}Se.inflateReset=uf;Se.inflateReset2=pf;Se.inflateResetKeep=df;Se.inflateInit=mx;Se.inflateInit2=ff;Se.inflate=yx;Se.inflateEnd=vx;Se.inflateGetHeader=xx;Se.inflateSetDictionary=wx;Se.inflateInfo="pako inflate (from Nodeca project)"});var oo=S((kE,mf)=>{"use strict";mf.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 yf=S((LE,bf)=>{"use strict";function _x(){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}bf.exports=_x});var xf=S(Ai=>{"use strict";var Sn=gf(),Si=it(),Br=Ws(),H=oo(),lo=Cr(),Ex=Ys(),Sx=yf(),vf=Object.prototype.toString;function Gt(e){if(!(this instanceof Gt))return new Gt(e);this.options=Si.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 Ex,this.strm.avail_out=0;var n=Sn.inflateInit2(this.strm,t.windowBits);if(n!==H.Z_OK)throw new Error(lo[n]);if(this.header=new Sx,Sn.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Br.string2buf(t.dictionary):vf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Sn.inflateSetDictionary(this.strm,t.dictionary),n!==H.Z_OK)))throw new Error(lo[n])}Gt.prototype.push=function(e,t){var n=this.strm,i=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"?n.input=Br.binstring2buf(e):vf.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Si.Buf8(i),n.next_out=0,n.avail_out=i),a=Sn.inflate(n,H.Z_NO_FLUSH),a===H.Z_NEED_DICT&&r&&(a=Sn.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;n.next_out&&(n.avail_out===0||a===H.Z_STREAM_END||n.avail_in===0&&(s===H.Z_FINISH||s===H.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Br.utf8border(n.output,n.next_out),d=n.next_out-o,l=Br.buf2string(n.output,o),n.next_out=d,n.avail_out=i-d,d&&Si.arraySet(n.output,n.output,o,d,0),this.onData(l)):this.onData(Si.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(c=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==H.Z_STREAM_END);return a===H.Z_STREAM_END&&(s=H.Z_FINISH),s===H.Z_FINISH?(a=Sn.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===H.Z_OK):(s===H.Z_SYNC_FLUSH&&(this.onEnd(H.Z_OK),n.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=Si.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function co(e,t){var n=new Gt(t);if(n.push(e,!0),n.err)throw n.msg||lo[n.err];return n.result}function Ax(e,t){return t=t||{},t.raw=!0,co(e,t)}Ai.Inflate=Gt;Ai.inflate=co;Ai.inflateRaw=Ax;Ai.ungzip=co});var Ef=S((ME,_f)=>{"use strict";var Cx=it().assign,Tx=Sp(),kx=xf(),Lx=oo(),wf={};Cx(wf,Tx,kx,Lx);_f.exports=wf});var Af=S(Hr=>{"use strict";var Rx=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",Mx=Ef(),Sf=B(),Nr=se(),Ox=Rx?"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={}}Sf.inherits(Wt,Nr);Wt.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(Sf.transformTo(Ox,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 Mx[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 Cf=se();uo.STORE={magic:"\0\0",compressWorker:function(){return new Cf("STORE compression")},uncompressWorker:function(){return new Cf("STORE decompression")}};uo.DEFLATE=Af()});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 Rf=S((jE,Lf)=>{"use strict";var An=B(),Cn=se(),ho=fn(),Tf=wr(),$r=fo(),P=function(e,t){var n="",i;for(i=0;i<t;i++)n+=String.fromCharCode(e&255),e=e>>>8;return n},Ix=function(e,t){var n=e;return e||(n=t?16893:33204),(n&65535)<<16},Px=function(e){return(e||0)&63},kf=function(e,t,n,i,r,a){var s=e.file,o=e.compression,d=a!==ho.utf8encode,l=An.transformTo("string",a(s.name)),c=An.transformTo("string",ho.utf8encode(s.name)),f=s.comment,p=An.transformTo("string",a(f)),u=An.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||n)&&(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|=Ix(s.unixPermissions,x)):(L=20,T|=Px(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(Tf(l),4)+c,m+="up"+P(b.length,2)+b),h&&(g=P(1,1)+P(Tf(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(i,4)+l+m+p;return{fileRecord:I,dirRecord:z}},jx=function(e,t,n,i,r){var a="",s=An.transformTo("string",r(i));return a=$r.CENTRAL_DIRECTORY_END+"\0\0\0\0"+P(e,2)+P(e,2)+P(t,4)+P(n,4)+P(s.length,2)+s,a},Dx=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,n,i){Cn.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}An.inherits(Ae,Cn);Ae.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,Cn.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n: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 n=kf(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Ae.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=kf(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:Dx(e),meta:{percent:100}});else for(this.push({data:n.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 n=this.bytesWritten-e,i=jx(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:i,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(n){t.processChunk(n)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(n){t.error(n)}),this};Ae.prototype.resume=function(){if(!Cn.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(!Cn.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch{}return!0};Ae.prototype.lock=function(){Cn.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Lf.exports=Ae});var Of=S(Mf=>{"use strict";var zx=po(),Fx=Rf(),Bx=function(e,t){var n=e||t,i=zx[n];if(!i)throw new Error(n+" is not a valid compression method !");return i};Mf.generateWorker=function(e,t,n){var i=new Fx(t.streamFiles,n,t.platform,t.encodeFileName),r=0;try{e.forEach(function(a,s){r++;var o=Bx(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(i)}),i.entriesCount=r}catch(a){i.error(a)}return i}});var Pf=S((zE,If)=>{"use strict";var Nx=B(),Ur=se();function Ci(e,t){Ur.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Nx.inherits(Ci,Ur);Ci.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(n){t.push({data:n,meta:{percent:0}})}).on("error",function(n){t.isPaused?this.generatedError=n:t.error(n)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};Ci.prototype.pause=function(){return Ur.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Ci.prototype.resume=function(){return Ur.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};If.exports=Ci});var qf=S((FE,Uf)=>{"use strict";var Hx=fn(),Ti=B(),Ff=se(),$x=ys(),Bf=vs(),jf=_r(),Ux=ju(),qx=Of(),Df=ni(),Gx=Pf(),Nf=function(e,t,n){var i=Ti.getTypeOf(t),r,a=Ti.extend(n||{},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=Hf(e)),a.createFolders&&(r=Wx(e))&&$f.call(this,r,!0);var s=i==="string"&&a.binary===!1&&a.base64===!1;(!n||typeof n.binary=="undefined")&&(a.binary=!s);var o=t instanceof jf&&t.uncompressedSize===0;(o||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var d=null;t instanceof jf||t instanceof Ff?d=t:Df.isNode&&Df.isStream(t)?d=new Gx(e,t):d=Ti.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var l=new Ux(e,d,a);this.files[e]=l},Wx=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},Hf=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},$f=function(e,t){return t=typeof t!="undefined"?t:Bf.createFolders,e=Hf(e),this.files[e]||Nf.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function zf(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var Yx={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,i;for(t in this.files)i=this.files[t],n=t.slice(this.root.length,t.length),n&&t.slice(0,this.root.length)===this.root&&e(n,i)},filter:function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(i)}),t},file:function(e,t,n){if(arguments.length===1)if(zf(e)){var i=e;return this.filter(function(a,s){return!s.dir&&i.test(a)})}else{var r=this.files[this.root+e];return r&&!r.dir?r:null}else e=this.root+e,Nf.call(this,e,t,n);return this},folder:function(e){if(!e)return this;if(zf(e))return this.filter(function(r,a){return a.dir&&e.test(r)});var t=this.root+e,n=$f.call(this,t),i=this.clone();return i.root=n.name,i},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 n=this.filter(function(r,a){return a.name.slice(0,e.length)===e}),i=0;i<n.length;i++)delete this.files[n[i].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,n={};try{if(n=Ti.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:Hx.utf8encode}),n.type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),n.type==="binarystring"&&(n.type="string"),!n.type)throw new Error("No output type specified.");Ti.checkSupport(n.type),(n.platform==="darwin"||n.platform==="freebsd"||n.platform==="linux"||n.platform==="sunos")&&(n.platform="UNIX"),n.platform==="win32"&&(n.platform="DOS");var i=n.comment||this.comment||"";t=qx.generateWorker(this,n,i)}catch(r){t=new Ff("error"),t.error(r)}return new $x(t,n.type||"string",n.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)}};Uf.exports=Yx});var go=S((BE,Wf)=>{"use strict";var Vx=B();function Gf(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}Gf.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,n;for(this.checkOffset(e),n=this.index+e-1;n>=this.index;n--)t=(t<<8)+this.byteAt(n);return this.index+=e,t},readString:function(e){return Vx.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))}};Wf.exports=Gf});var mo=S((NE,Vf)=>{"use strict";var Yf=go(),Xx=B();function Tn(e){Yf.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}Xx.inherits(Tn,Yf);Tn.prototype.byteAt=function(e){return this.data[this.zero+e]};Tn.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===n&&this.data[a+2]===i&&this.data[a+3]===r)return a-this.zero;return-1};Tn.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2),r=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&n===a[1]&&i===a[2]&&r===a[3]};Tn.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};Vf.exports=Tn});var Zf=S((HE,Kf)=>{"use strict";var Xf=go(),Kx=B();function kn(e){Xf.call(this,e)}Kx.inherits(kn,Xf);kn.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};kn.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};kn.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};kn.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};Kf.exports=kn});var yo=S(($E,Qf)=>{"use strict";var Jf=mo(),Zx=B();function bo(e){Jf.call(this,e)}Zx.inherits(bo,Jf);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};Qf.exports=bo});var nh=S((UE,th)=>{"use strict";var eh=yo(),Jx=B();function vo(e){eh.call(this,e)}Jx.inherits(vo,eh);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};th.exports=vo});var xo=S((qE,rh)=>{"use strict";var qr=B(),ih=tt(),Qx=mo(),e0=Zf(),t0=nh(),n0=yo();rh.exports=function(e){var t=qr.getTypeOf(e);return qr.checkSupport(t),t==="string"&&!ih.uint8array?new e0(e):t==="nodebuffer"?new t0(e):ih.uint8array?new n0(qr.transformTo("uint8array",e)):new Qx(qr.transformTo("array",e))}});var lh=S((GE,oh)=>{"use strict";var wo=xo(),Et=B(),i0=_r(),ah=wr(),Gr=fn(),Wr=po(),r0=tt(),a0=0,s0=3,o0=function(e){for(var t in Wr)if(Object.prototype.hasOwnProperty.call(Wr,t)&&Wr[t].magic===e)return Wr[t];return null};function sh(e,t){this.options=e,this.loadOptions=t}sh.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),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=o0(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 i0(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===a0&&(this.dosPermissions=this.externalFileAttributes&63),e===s0&&(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,n,i,r;for(this.extraFields||(this.extraFields={});e.index+4<t;)n=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[n]={id:n,length:i,value:r};e.setIndex(t)},handleUTF8:function(){var e=r0.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 n=Et.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var i=this.findExtraFieldUnicodeComment();if(i!==null)this.fileCommentStr=i;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||ah(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||ah(this.fileComment)!==t.readInt(4)?null:Gr.utf8decode(t.readData(e.length-5))}return null}};oh.exports=sh});var uh=S((WE,dh)=>{"use strict";var l0=xo(),ot=B(),Ce=fo(),c0=lh(),d0=tt();function ch(e){this.files=[],this.loadOptions=e}ch.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 n=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4),r=i===t;return this.reader.setIndex(n),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=d0.uint8array?"uint8array":"array",n=ot.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},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,n,i,r;t<e;)n=this.reader.readInt(2),i=this.reader.readInt(4),r=this.reader.readData(i),this.zip64ExtensibleData[n]={id:n,length:i,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 c0({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 n=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 i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=n-i;if(r>0)this.isSignature(n,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=l0(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};dh.exports=ch});var hh=S((YE,fh)=>{"use strict";var _o=B(),Yr=dn(),u0=fn(),p0=uh(),f0=_s(),ph=ni();function h0(e){return new Yr.Promise(function(t,n){var i=e.decompressed.getContentWorker().pipe(new f0);i.on("error",function(r){n(r)}).on("end",function(){i.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}fh.exports=function(e,t){var n=this;return t=_o.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:u0.utf8decode}),ph.isNode&&ph.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(i){var r=new p0(t);return r.load(i),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(h0(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);n.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||(n.file(c).unsafeOriginalName=l)}return a.zipComment.length&&(n.comment=a.zipComment),n})}});var mh=S((VE,gh)=>{"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=qf();ve.prototype.loadAsync=hh();ve.support=tt();ve.defaults=vs();ve.version="3.10.1";ve.loadAsync=function(e,t){return new ve().loadAsync(e,t)};ve.external=dn();gh.exports=ve});var _h={};hc(_h,{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,n,i,r){this.currentObjectId=t,this.currentPath=n,this.currentAsset=i,this.onApplyCallback=r,this.createModal(t,i),document.body.appendChild(this.modal),this.attachModalListeners()}createModal(t,n){let i=document.createElement("div");i.className="asset-editor-modal",i.innerHTML=`
|
|
1
|
+
"use strict";var mr=Object.create;var ft=Object.defineProperty;var br=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var vr=Object.getPrototypeOf,xr=Object.prototype.hasOwnProperty;var X=(t,e)=>()=>(t&&(e=t(t=0)),e);var ra=(t,e)=>{for(var n in e)ft(t,n,{get:e[n],enumerable:!0})},oa=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of yr(e))!xr.call(t,a)&&a!==n&&ft(t,a,{get:()=>e[a],enumerable:!(i=br(e,a))||i.enumerable});return t};var ae=(t,e,n)=>(n=t!=null?mr(vr(t)):{},oa(e||!t||!t.__esModule?ft(n,"default",{value:t,enumerable:!0}):n,t)),wr=t=>oa(ft({},"__esModule",{value:!0}),t);var se,nn=X(()=>{"use strict";se=class{static get(e){var n;return(n=this.store.get(e))==null?void 0:n.data}static set(e,n){this.store.set(e,{data:n})}static has(e){return this.store.has(e)}static clear(){this.store.clear()}};se.store=new Map});function Mr(){var t,e;try{let n=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((e=(t=document.querySelector("script"))==null?void 0:t.textContent)==null?void 0:e.includes("inline-assets.js"))||window.INLINE_ASSETS),i=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(n&&!i)}catch{return!1}}async function Pr(){try{if(typeof window!="undefined"){let t=await fetch("./build-settings.json");if(t.ok){let e=await t.json();return console.log("[AssetLoader] Loaded build settings:",e),e}}}catch{}return null}function kr(){try{if(typeof window!="undefined"){let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",e),e}}}catch{}return null}async function Rr(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${C}`),Object.keys(re).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(re)),re;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),re={...window.INLINE_ASSETS},re;if(!(C==="publish"&&J!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),re;if(!an){let e=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",e),an=(async()=>{try{try{let s=await import(e+"?t="+Date.now());if(s.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(s.INLINE_ASSETS)),s.INLINE_ASSETS}catch(s){console.warn("[AssetLoader] ES module import failed, trying text parse:",s)}let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);let i=await n.text();console.log("[AssetLoader] Received JS code, length:",i.length);let a=i.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(a)try{let s=a[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let r=new Function("return "+s)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(r)),r}catch(s){return console.warn("[AssetLoader] Failed to parse inline assets:",s),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",i.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}return re=await an,console.log("[AssetLoader] Final inline assets cache:",Object.keys(re)),re}function sn(t){return t===null||typeof t!="object"||(Object.freeze(t),Object.values(t).forEach(e=>sn(e))),t}function Or(t=64,e=64,n=16711680){let i=document.createElement("canvas");i.width=t,i.height=e;let a=i.getContext("2d");return a.fillStyle=`#${n.toString(16).padStart(6,"0")}`,a.fillRect(0,0,t,e),a.strokeStyle="#000",a.strokeRect(0,0,t,e),a.fillStyle="#fff",a.font="10px sans-serif",a.textAlign="center",a.fillText("MISSING",t/2,e/2),oe.Texture.from(i)}function rn(t,e){Fa.set(t,e)}var oe,za,Na,Ee,C,J,he,re,an,Fa,Se,vt=X(()=>{"use strict";oe=require("pixi.js");nn();za=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Na=Mr(),Ee=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,C=Na?"publish":za,J=Ee==null?void 0:Ee.assetsInlined;Ee!=null&&Ee.buildMode&&(C=Ee.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${C}`));he=kr();he!=null&&he.buildMode&&(C=he.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${C}`));(he==null?void 0:he.assetsInlined)!==void 0&&(J=he.assetsInlined);Pr().then(t=>{t!=null&&t.buildMode&&t.buildMode!==C&&(C=t.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${C}`)),(t==null?void 0:t.assetsInlined)!==void 0&&(J=t.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${za}, Runtime: ${Na?"publish":"dev"}, Effective: ${C}`);re={},an=null;Fa=new Map;Se=class{static async load(e,n,i,a){let s=`${e}:${n.path}`,r=se.get(s);if(r!==void 0)return r;console.log(`[AssetLoader] Loading asset: ${e}, type: ${n.type}, Effective mode: ${C}`),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 Rr(),l=o[e];if(!l&&a&&(l=o[a],l&&console.log(`[AssetLoader] Found inline data for ${e} using configId: ${a}`)),!l&&n.path){let c=n.path.split("/");if(c.length>=2){let g=c[c.length-1].split(".")[0];o[g]&&(l=o[g],console.log(`[AssetLoader] Found inline data for ${e} using assetName: ${g}`))}}if(console.log("[AssetLoader] Inline data for",e,":",l?"FOUND":"NOT FOUND"),C==="publish"&&J!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!l))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${e}, path: ${n.path}`);let p=Fa.get(n.type);if(p)try{let c=await p(n.path,l,e,i);return se.set(s,c),c}catch(c){return this.handleFailure(e,n.type,c)}try{let c;switch(n.type){case"image":c=await this.loadImage(n.path,l);break;case"json":c=await this.loadJSON(n.path,l),c=sn(c);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return se.set(s,c),c}catch(c){return this.handleFailure(e,n.type,c)}}static async loadImage(e,n){let i=C==="publish",a=i&&J!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${C}, isPublishMode: ${i}, inlineData: ${n?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${e}`);if(typeof n!="string"||!n.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI string, got: ${typeof n}`);try{return await oe.Assets.load(n)}catch(s){throw console.error("[AssetLoader] Failed to load texture from data URI:",s),s}}if(n&&typeof n=="string"&&n.startsWith("data:"))try{return await oe.Assets.load(n)}catch(s){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",s),await oe.Assets.load(e)}return await oe.Assets.load(e)}static async loadJSON(e,n){let i=C==="publish",a=i&&J!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${C}, isPublishMode: ${i}, inlineData: ${n?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(typeof n=="object"&&n!==null)return n;if(typeof n=="string"&&n.startsWith("data:")){let r=atob(n.split(",")[1]);return JSON.parse(r)}return JSON.parse(n)}if(n){if(typeof n=="object"&&n!==null)return n;if(typeof n=="string"&&n.startsWith("data:")){let r=atob(n.split(",")[1]);return JSON.parse(r)}return JSON.parse(n)}let s=await fetch(e);if(!s.ok)throw new Error(`JSON fetch failed: ${e}`);return s.json()}static handleFailure(e,n,i){if(C==="dev"){let s=n==="image"?Or():sn({__placeholder:!0,type:n});return se.set(e+":"+((i==null?void 0:i.path)||"missing"),s),s}throw i}};rn("image",async(t,e)=>{let n=C==="publish",i=n&&J!==!1,a=C==="brand",s=n&&J===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${C}, isPublishMode: ${n}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),i){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(typeof e!="string"||!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI string, got: ${typeof e}`);return oe.Assets.load(e)}let r=t;return(a||s)&&t&&!t.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(r=t,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${t}" as-is`)):(r=`assets/${t}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${t}" -> "${r}"`))),oe.Assets.load(e||r)});rn("json",async(t,e)=>{let n=C==="publish",i=n&&J!==!1,a=C==="brand",s=n&&J===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${C}, isPublishMode: ${n}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),i){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);return typeof e=="object"&&e!==null?e:typeof e=="string"&&e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}let r=t;if((a||s)&&t&&!t.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(r=t,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${t}" as-is`)):(r=`assets/${t}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${t}" -> "${r}"`))),e)return typeof e=="object"&&e!==null?e:typeof e=="string"&&e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let o=await fetch(r);if(!o.ok)throw new Error(`JSON fetch failed: ${t}`);return o.json()})});var ln,Hr,xt,Xe=X(()=>{"use strict";vt();ln=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(e,n){if(this.config===e&&this.app===n&&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(i=>{this.priorityReadyResolve=i}),this.config=e,this.app=n,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 e=this.config,n=this.app;return this.readyPromise=(async()=>{var r;console.log("[AssetTextures] Loading all assets...");let i=new Set(["background_loading_1"]),a=[],s=[];for(let[o,l]of e.objects.entries()){let d=(r=l.render)==null?void 0:r.asset;if(!d)continue;let p=async()=>{var c;try{let g=(c=l.identity)==null?void 0:c.id;console.log(`[AssetTextures] Loading ${d.type}: ${o} (${g})`);let u=await Se.load(o,d,n,g);this.textures.set(o,u),console.log(`[AssetTextures] \u2713 Loaded: ${o}`)}catch(g){console.error(`[AssetTextures] \u2717 Failed to load: ${o}`,g)}finally{this.attempted.add(o);try{for(let g of Array.from(this.waiters))g()}catch{}}};i.has(o)?a.push(p()):s.push(p())}a.length>0&&(console.log("[AssetTextures] Phase 1: Loading priority assets (loading screen)..."),await Promise.all(a),console.log("[AssetTextures] Phase 1: Priority assets ready")),this.priorityReadyResolve&&this.priorityReadyResolve(),console.log("[AssetTextures] Phase 2: Loading remaining assets..."),await Promise.all(s),console.log("[AssetTextures] All textures loaded:",Array.from(this.textures.keys()))})(),this.readyPromise}async priorityReady(){return this.priorityReadyPromise?this.priorityReadyPromise:Promise.resolve()}async waitFor(e,n={}){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 a=Array.from(new Set((e||[]).filter(o=>typeof o=="string"&&o))).filter(o=>{var l,d,p,c;try{let g=(p=(d=(l=this.config)==null?void 0:l.objects)==null?void 0:d.get)==null?void 0:p.call(d,o);return!!((c=g==null?void 0:g.render)!=null&&c.asset)}catch{return!1}});if(a.length===0)return;this.ready().catch(()=>{});let s=()=>a.every(o=>this.textures.has(o)||this.attempted.has(o));if(s())return;let r=typeof n.timeoutMs=="number"?n.timeoutMs:15e3;await new Promise(o=>{let l=!1,d=()=>{l||s()&&(l=!0,this.waiters.delete(d),o())};this.waiters.add(d),d(),r>0&&setTimeout(()=>{l||(l=!0,this.waiters.delete(d),console.warn("[AssetTextures] waitFor timed out; continuing",{ids:a}),o())},r)})}get(e){return this.textures.get(e)}set(e,n){this.textures.set(e,n),console.log(`[AssetTextures] Updated texture: ${e}`)}clear(){this.textures.clear(),this.readyPromise=null,console.log("[AssetTextures] Cleared all textures")}getAllIds(){return Array.from(this.textures.keys())}},Hr=new ln,xt=new Proxy(Hr,{get(t,e){return e in t&&typeof t[e]=="function"?t[e].bind(t):t.get(e)},set(t,e,n){return t.set(e,n),!0}})});var ro,fe=X(()=>{"use strict";ro="handler_preview_override_mode";if(typeof window!="undefined"){let t=window.localStorage.getItem(ro);window.__enableConfigOverrides=t===null?!0:t==="true"}});var Wa,Te,Ec,un=X(()=>{"use strict";fe();Wa=null,Te="dev";if(typeof window!="undefined"){let t=window.__BUILD_SETTINGS__;if(t!=null&&t.buildMode)Wa=t,Te=t.buildMode,console.log("[CONFIG] Loaded inline build settings:",t,"buildMode:",Te);else try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let n=JSON.parse(e.responseText);Wa=n,Te=n.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",n,"buildMode:",Te)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",Te)}catch(e){console.log("[CONFIG] Failed to load build-settings.json:",e instanceof Error?e.message:String(e))}}console.log("[CONFIG] Final buildMode:",Te);Ec=Te==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload")});var gn=X(()=>{"use strict"});var Ya=X(()=>{"use strict";gn();un()});var hn=X(()=>{"use strict";un();gn();Ya()});var es=X(()=>{"use strict"});var ns={};ra(ns,{AssetEditorModal:()=>wn});var wn,En=X(()=>{"use strict";wn=class{constructor(){this.modal=null;this.currentObjectId=null;this.currentPath=null;this.currentAsset="";this.onApplyCallback=null}show(e,n,i,a){this.currentObjectId=e,this.currentPath=n,this.currentAsset=i,this.onApplyCallback=a,this.createModal(e,i),document.body.appendChild(this.modal),this.attachModalListeners()}createModal(e,n){let i=document.createElement("div");i.className="asset-editor-modal",i.innerHTML=`
|
|
3
2
|
<div class="asset-editor-card">
|
|
4
3
|
<div class="asset-editor-header">
|
|
5
4
|
<div>
|
|
6
|
-
<div class="asset-editor-title">Edit Asset: ${
|
|
5
|
+
<div class="asset-editor-title">Edit Asset: ${e}</div>
|
|
7
6
|
<div class="asset-editor-subtitle">Current: ${n||"None"}</div>
|
|
8
7
|
</div>
|
|
9
8
|
<button class="asset-editor-close" data-modal-close>\xD7</button>
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
44
|
</div>
|
|
46
45
|
</div>
|
|
47
|
-
`,this.modal=i}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 i=this.modal.querySelector("[data-ai-generate]");i==null||i.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 n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";t==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,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 V0={};hc(V0,{AspectClass:()=>$o,GameObject:()=>Di,GameObjectManager:()=>na,Renderer:()=>ji,ResponsiveUISystem:()=>zn,Transform:()=>Pi,animateHandClick:()=>Hh,animatePanelEntrance:()=>Nh,createBrushTexture:()=>Vh,createEndGamePanel:()=>Bh,createHandTutorial:()=>$h,createThreeBase:()=>Dh,createTutorialLabel:()=>Uh,getAspectClass:()=>ta,getRegisteredFontIds:()=>Fh,loadAsset:()=>Go,loadCharacterFrames:()=>Yh,registerFont:()=>zh,resolveFont:()=>Fe,resolveFontWeight:()=>Be,updateHandAnimation:()=>qh});module.exports=Hg(V0);var Te=Ge(require("three"),1);var dt={};function qi(e,t,n=!1){dt[e]||(dt[e]=[]),dt[e].push({fn:t,once:n})}function ga(e,t){if(dt[e]){if(!t){delete dt[e];return}dt[e]=dt[e].filter(n=>n.fn!==t)}}function Gi(e,...t){let n=dt[e];if(n)for(let i of[...n])i.fn(...t),i.once&&ga(e,i.fn)}function fe(e,t){qi(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,n;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:(n=q==null?void 0:q.maxQueue)!=null?n:200,debug:!!(q!=null&&q.debug)}}async function mc(e,t,n,i){let r=JSON.stringify(t);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){i&&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}),i&&console.log("[handler.telemetry] fetch",t)}catch(a){i&&console.warn("[handler.telemetry] fetch failed",a)}}function ma(e,t){let n=vc();if(t&&n.endpoint){if(we.push(e),we.length>n.maxQueue&&(we=we.slice(we.length-n.maxQueue)),we.length>=n.batchSize){bc();return}Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,bc()},n.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 $g(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return n=>n;if(t==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(t==="power2.out"||t==="easeOutQuad")return n=>1-(1-n)*(1-n);if(t.startsWith("back.out")){let n=t.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return r=>1+(i+1)*Math.pow(r-1,3)+i*Math.pow(r-1,2)}return n=>1-(1-n)*(1-n)}function Hn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ug(e,t){let n=e==null?void 0:e[t];return typeof n=="number"?n:0}function wc(e,t,n){try{e[t]=n}catch{}}function qg(e){let t=e==null?void 0:e.scale;if(!t)return null;let n=typeof t.x=="number"?t.x:1,i=typeof t.y=="number"?t.y:1;return{x:n,y:i}}function _c(e,t){let n=e==null?void 0:e.scale;if(n)try{typeof n.set=="function"?n.set(t.x,t.y):(typeof n.x=="number"&&(n.x=t.x),typeof n.y=="number"&&(n.y=t.y))}catch{}}function Ec(e,t){let n=qg(e);if(!n)return{from:null,to:null};let i=null,r=null;return typeof t.scale=="number"?(i=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(i=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(i=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),i===null&&r===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:r!=null?r:n.y}}}function Sc(){let e=new Set,t=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),e.size>0&&i()})},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),i()},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=Hn();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=$g(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:Ug(c,E),to:A})}let g=Ec(c,f);return{target:c,startMs:Hn(),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=Hn())},resume:()=>{var h;if(!p.paused)return;let u=(h=p.pauseAtMs)!=null?h:Hn(),v=Hn()-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 Cc={name:"handler-playable-sdk",version:"0.3.34",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",sharp:"^0.34.5"}};var he=0,Wg=he++,Tc=he++,kc=he++,Lc=he++,Rc=he++,Mc=he++,Oc=he++,Ic=he++,Pc=he++,jc=he++,Dc=he++,zc=he++,N=Wg;function Fc(){return N===Tc}function Bc(){return N===kc}function Nc(){return N===Lc}function Hc(){return N===Rc}function Jt(){return N===Mc}function Qt(){return N===Oc}function $c(){return N===Ic}function Uc(){return N===Pc}function qc(){return N===jc}function ba(){return N===Dc}function ya(){return N===zc}function Gc(){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=Tc;return}catch{}else if(e==="dapi")try{dapi.isReady(),N=kc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=Lc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(N=Rc)}catch{}else if(t==="mintegral")window.gameReady&&(N=Mc);else if(t==="tapjoy")window.TJ_API&&(N=Oc);else if(t==="tiktok")window.openAppStore&&(N=Ic);else if(t==="smadex")try{window.smxTracking&&(N=Pc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(N=jc)}catch{}else t==="vungle"?N=Dc:(e==="nucleo"||t==="nucleo")&&(N=zc)}var Wi=Ge(require("lottie-web"),1),Wc=Wi.default;typeof window!="undefined"&&(window.lottie=Wi.default,window.__baseLottie=Wi.default);var Yg=require("pixi.js");var va=require("pixi.js");var Vg=null;function xa(e){Vg=e}Yi();wa();var $n=require("pixi.js");Yi();var em=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Aa=em;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,n,i){var d,l,c,f,p,u,v;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${Aa}`);let r=(d=n==null?void 0:n.render)==null?void 0:d.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new $n.Container;return this.applyTransform(h,n==null?void 0:n.transform),h}let a=(l=n==null?void 0:n.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,i,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 $n.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name),this.applyTransform(o,n==null?void 0:n.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 $n.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,n==null?void 0:n.transform);return o}static applyTransform(t,n){var i,r,a,s;!n||!t||(n.position&&("x"in t&&"y"in t?(t.x=(i=n.position.x)!=null?i:0,t.y=(r=n.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=n.position.x)!=null?a:0,(s=n.position.y)!=null?s:0)),n.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(n.scale):t.scale=n.scale),n.rotation!==void 0&&"rotation"in t&&(t.rotation=n.rotation),n.anchor&&"anchor"in t&&t.anchor&&Array.isArray(n.anchor)&&("set"in t.anchor?t.anchor.set(n.anchor[0],n.anchor[1]):(t.anchor.x=n.anchor[0],t.anchor.y=n.anchor[1])))}};var Un=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 im=Ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=im);qn();var Xi=require("pixi.js");qn();var Ta=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Un}init(t,n){this.registry.init(t),this.app=n}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(n.length===0)return;let i=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 i(n);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await i(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 n=this.registry.get(t);if(n){let i=await Mt.create(t,n,this.app);this.instanceCache.set(t,i)}}get(t){return this.instanceCache.get(t)}},am=new Ta,sm=new Proxy(am,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});qn();var Kc=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},Zi={scale:1,position:1},La=[];function cm(e,t,n,i,r,a,s){La.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,n,i,r,a,s,!1)}function dm(){La.forEach(({element:e,originalScale:t,positionHelper:n,heightPercent:i})=>{let r=t*Xe.scaleFactor;n(e,Xe.width,Xe.height,i,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),Zi.scale=Xe.scaleFactor,Zi.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Zi.scale.toFixed(3)}`),dm()}var Wn={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 um(e,t,n){let i=Wn[e];i&&i[t]!==void 0&&(i[t]=n,console.log(`Updated ${e}.${t} = ${n}`))}function pm(){return Wn}var fm={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 Ki(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Ji(e,t={x:.5,y:.5}){var n;if(Array.isArray(e))return{x:Ki(e[0],t.x),y:Ki(e[1],t.y)};if(e&&typeof e=="object"){let i=e;return{x:Ki(i.x,t.x),y:Ki(i.y,t.y)}}if(typeof e=="string"){let i=e.trim().toLowerCase();return(n=fm[i])!=null?n:t}return t}function Zc(e,t,n,i={}){var u,v,h,w,y,m;let r=Ji(n),a=(u=i.inset)!=null?u:{},s=(v=i.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 Jc(e,t,n,i={}){var h,w,y,m,b,g;let r=(h=i.inset)!=null?h:{},a=(w=i.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=Ji(n,{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,n=()=>{let i=window.innerWidth,r=window.innerHeight;(i!==e||r!==t)&&(e=i,t=r,ka(i,r))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),ka(window.innerWidth,window.innerHeight),window.updateDebugConfig=um,window.getDebugConfig=pm,window.copyConfig=Sm,window.applyConfig=Gn,window.applyConfigForRatio=Am,window.positionAtBottom=Qc,window.positionAtTop=mm,window.positionAtCenter=bm,window.positionAtLeft=ym,window.positionAtRight=vm,window.positionAtBottomLeft=xm,window.positionAtBottomRight=wm,window.positionAtTopLeft=_m,window.positionAtTopRight=Em,window.applyPositionContract=gm,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 Qi(e,t,n=0){return e*t+n}function er(e,t,n=0){return e*(1-t)+n}function tr(e,t,n=0){return e*t+n}function nr(e,t,n=0){return e*(1-t)+n}function ge(e,t=0){return e/2+t}function hm(e,t){return e*t}function gm(e,t,n,i){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(i.type){case"top":r=ge(t,(o=(s=i.offset)==null?void 0:s.x)!=null?o:0),a=Qi(n,i.percent,(l=(d=i.offset)==null?void 0:d.y)!=null?l:0);break;case"bottom":r=ge(t,(f=(c=i.offset)==null?void 0:c.x)!=null?f:0),a=er(n,i.percent,(u=(p=i.offset)==null?void 0:p.y)!=null?u:0);break;case"left":r=tr(t,i.percent,(h=(v=i.offset)==null?void 0:v.x)!=null?h:0),a=ge(n,(y=(w=i.offset)==null?void 0:w.y)!=null?y:0);break;case"right":r=nr(t,i.percent,(b=(m=i.offset)==null?void 0:m.x)!=null?b:0),a=ge(n,(x=(g=i.offset)==null?void 0:g.y)!=null?x:0);break;case"center":r=ge(t,(A=(E=i.offset)==null?void 0:E.x)!=null?A:0),a=ge(n,(T=(C=i.offset)==null?void 0:C.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),i.scale!==void 0&&i.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(i.scale,i.scale):(e.scale.x=i.scale,e.scale.y=i.scale))}function Qc(e,t,n,i=.2,r=1,a=!0,s=!1){let o=hm(n,i),d=er(n,i/2);Ke(e,ge(t),d);let l=a?r*Xe.scaleFactor:r;Ze(e,l),s&&!La.find(c=>c.element===e)&&cm(e,Qc,t,n,i,r,a)}function mm(e,t,n,i=.1,r=1){Ke(e,ge(t),Qi(n,i)),Ze(e,r)}function bm(e,t,n,i=0,r=0,a=1){Ke(e,ge(t,i),ge(n,r)),Ze(e,a)}function ym(e,t,n,i=.1,r=1){Ke(e,tr(t,i),ge(n)),Ze(e,r)}function vm(e,t,n,i=.1,r=1){Ke(e,nr(t,i),ge(n)),Ze(e,r)}function xm(e,t,n,i=.05,r=.05,a=1){Ke(e,tr(t,r),er(n,i)),Ze(e,a)}function wm(e,t,n,i=.05,r=.05,a=1){Ke(e,nr(t,r),er(n,i)),Ze(e,a)}function _m(e,t,n,i=.05,r=.05,a=1){Ke(e,tr(t,r),Qi(n,i)),Ze(e,a)}function Em(e,t,n,i=.05,r=.05,a=1){Ke(e,nr(t,r),Qi(n,i)),Ze(e,a)}function Ke(e,t,n){e&&e.position?typeof e.position.set=="function"?e.position.set(t,n):(e.position.x=t,e.position.y=n):e&&(e.x=t,e.y=n)}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 Sm(e){return e&&Ot[e]?JSON.parse(JSON.stringify(Ot[e])):JSON.parse(JSON.stringify(Wn))}function Gn(e){Object.keys(e).forEach(t=>{let n=t;Wn[n]&&e[n]&&Object.assign(Wn[n],e[n])}),console.log("Config applied:",e)}function Am(e,t){let n=e/t;n>1.6?(Gn(Ot.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Gn(Ot.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Gn(Ot.square),console.log("Applied SQUARE config for ratio:",n)):(Gn(Ot.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let e=window;e.configPresets=Ot,e.resolveAnchorVec2=e.resolveAnchorVec2||Ji,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Zc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||Jc}Oa();function G(e,t){let n=(r,a)=>a===0?r:n(a,r%a),i=n(e,t);return`${e/i}:${t/i}`}var N_=[{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)}],H_=[{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)}],$_=[{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 U_=[...id];var Im=id[0];pt();var y0=Ge(mh(),1);function g0(e){return new Promise((t,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>t(String(i.result||"")),i.readAsDataURL(e)})}function m0(e){var r;let[t,n]=e.split(","),i=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(r=i==null?void 0:i[1])!=null?r:"image/png"}}async function b0(e){return await new Promise(t=>{let n=new Image;n.onload=()=>t({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>t(null),n.src=e})}async function Eo(e){var t,n;try{console.log("[ImageUtils] Fetching image data from URL:",e);let i=await fetch(e);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,e),null;let r=await i.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await g0(r),s=await b0(a),o=m0(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:(n=s==null?void 0:s.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Vr(e,t=30){try{console.log("[ImageUtils] Removing background color...");let n=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}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let r=i.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(n,0,0);let a=r.getImageData(0,0,i.width,i.height),s=a.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.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),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),e}}var bh=require("@google/genai");async function So(e,t,n=[],i={}){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<n.length;y++){let m=n[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 bh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",u=[t];n.length>0&&n.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 ${n.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 yh=require("@google/genai");async function Xr(e,t,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new yh.GoogleGenAI({apiKey:e}),a=[{text:t}];n.length>0&&n.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 v0=require("pixi.js");qn();pt();var xh=require("pixi.js");var x0=require("pixi.js");pt();function T0(e){return new Promise((t,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>t(String(i.result||"")),i.readAsDataURL(e)})}function k0(e){var r;let[t,n]=e.split(","),i=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(r=i==null?void 0:i[1])!=null?r:"image/png"}}function L0(e){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),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 Xo={};ra(Xo,{AspectClass:()=>In,GameObject:()=>ot,GameObjectManager:()=>$t,Renderer:()=>rt,ResponsiveUISystem:()=>Ge,Transform:()=>st,animateHandClick:()=>ws,animatePanelEntrance:()=>xs,createBrushTexture:()=>Ls,createEndGamePanel:()=>vs,createHandTutorial:()=>Es,createThreeBase:()=>ms,createTutorialLabel:()=>Ss,getAspectClass:()=>Dt,getRegisteredFontIds:()=>ys,loadAsset:()=>$n,loadCharacterFrames:()=>_s,registerFont:()=>bs,resolveFont:()=>Q,resolveFontWeight:()=>ee,updateHandAnimation:()=>As});module.exports=wr(Xo);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var P=null,W=[],ke=null;function da(t){P=t,W=[],ke!==null&&(clearTimeout(ke),ke=null)}function pa(){var t,e,n;return{endpoint:(P==null?void 0:P.endpoint)||"",transport:(P==null?void 0:P.transport)||"beacon",batchSize:(t=P==null?void 0:P.batchSize)!=null?t:10,flushIntervalMs:(e=P==null?void 0:P.flushIntervalMs)!=null?e:300,maxQueue:(n=P==null?void 0:P.maxQueue)!=null?n:200,debug:!!(P!=null&&P.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}ke===null&&(ke=window.setTimeout(()=>{ke=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Er(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sr(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Ar(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Ar(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Er(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:Sr(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.3.35",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var G=0,Tr=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,_a=G++,La=G++,Ma=G++,T=Tr;function Pa(){return T===va}function ka(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===_a}function Zt(){return T===La}function Qt(){return T===Ma}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=La:(t==="nucleo"||e==="nucleo")&&(T=Ma)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var _r=require("pixi.js");var en=require("pixi.js");var Lr=null;function tn(t){Lr=t}vt();nn();var Ye=require("pixi.js");vt();var Ir=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",on=Ir;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(on=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${on}`))}}catch{}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${on}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Se.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ye.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o,l;if(!(!n||!e)){if(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0){let d=(l=i==null?void 0:i.identity)==null?void 0:l.category,p=d==="ui"||d==="environment"?.2:1,c=n.scale*p;"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(c):e.scale=c)}n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1]))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var $r=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=$r);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ae.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},zr=new cn,Nr=new Proxy(zr,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Gr(t,e,n,i,a,s,r){pn.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function Ur(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),Ur()}var Ze={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 qr(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Wr(){return Ze}var Vr={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 Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Vr[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((x=s.right)!=null?x:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},s=(x=i.padding)!=null?x:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((f=a.top)!=null?f:0)+s.y,d=((m=a.bottom)!=null?m:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=qr,window.getDebugConfig=Wr,window.copyConfig=ao,window.applyConfig=Je,window.applyConfigForRatio=so,window.positionAtBottom=qa,window.positionAtTop=Xr,window.positionAtCenter=Jr,window.positionAtLeft=Zr,window.positionAtRight=Qr,window.positionAtBottomLeft=eo,window.positionAtBottomRight=to,window.positionAtTopLeft=no,window.positionAtTopRight=io,window.applyPositionContract=Kr,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 Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function _t(t,e,n=0){return t*e+n}function Lt(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Yr(t,e){return t*e}function Kr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,M,R;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),s=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=_t(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),s=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=Lt(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),s=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),s=U(n,(R=(M=i.offset)==null?void 0:M.y)!=null?R:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Yr(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!pn.find(p=>p.element===t)&&Gr(t,qa,e,n,i,a,s)}function Xr(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Jr(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function Zr(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function Qr(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function eo(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Tt(n,i)),de(t,s)}function to(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Tt(n,i)),de(t,s)}function no(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Ct(n,i)),de(t,s)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Ct(n,i)),de(t,s)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={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 ao(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function so(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function k(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:k(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:k(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:k(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:k(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:k(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:k(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:k(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:k(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:k(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:k(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:k(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:k(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:k(800,1280)}],Ka=[{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:k(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:k(768,1024),mraidScale:.7}];var qc=[...Ka];var ho=Ka[0];fe();var xo=ae(require("jszip"),1);function bo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function yo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vo(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await bo(a),r=await vo(s),o=yo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Mt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,s,r,o,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Pt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var wo=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Eo=require("pixi.js");es();fe();function Mo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Po(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ko(t){return`
|
|
48
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
49
48
|
|
|
50
49
|
Provide a concise summary (2-3 sentences) covering:
|
|
@@ -58,12 +57,12 @@ FORMAT:
|
|
|
58
57
|
Summary: [Your summary here]
|
|
59
58
|
Palette: [#RRGGBB, #RRGGBB, ...]
|
|
60
59
|
|
|
61
|
-
${
|
|
60
|
+
${t?`
|
|
62
61
|
ADDITIONAL RULES/NOTES:
|
|
63
|
-
${
|
|
64
|
-
`.trim()}function
|
|
65
|
-
`);for(let
|
|
66
|
-
Palette:`)[0].replace(/^Summary:\s*/i,"").trim()),n={summary:
|
|
62
|
+
${t}`:""}
|
|
63
|
+
`.trim()}function ts(){let t=[],e="",n=null;return{async addSources(i){let a=[];for(let s of i){let r=await Mo(s),o=Po(r),l={id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,name:s.name,base64:o.base64,mimeType:o.mimeType,dataUrl:r};t.push(l),a.push(l)}return a},getSources(){return t.slice()},async analyze(i,a,s){if(t.length===0)throw new Error("No screenshots to analyze.");let r=ko(a),o=t.map(g=>({base64:g.base64,mimeType:g.mimeType})),l=await mn(i,r,o,{model:s}),d=e,p=[],c=l.split(`
|
|
64
|
+
`);for(let g of c)if(g.toLowerCase().startsWith("summary:"))d=g.slice(8).trim();else if(g.toLowerCase().includes("palette:")){let u=g.match(/#[0-9A-Fa-f]{6}/g);u&&u.forEach(b=>{p.includes(b.toUpperCase())||p.push(b.toUpperCase())})}return(!d||d===e)&&(d=l.split(`
|
|
65
|
+
Palette:`)[0].replace(/^Summary:\s*/i,"").trim()),n={summary:d,palette:p.slice(0,10)},n},setSummary(i){e=i,n&&(n={...n,summary:i})},getResult(){return n}}}var _e="handler_api_key_";var je=class{static setKey(e,n,i){try{let a={key:this.encryptKey(n),created:Date.now(),lastUsed:Date.now(),label:i||e},s=`${_e}${e}`;localStorage.setItem(s,JSON.stringify(a))}catch(a){console.error("[ApiKeyStorage] Failed to store API key:",a)}}static getKey(e){try{let n=`${_e}${e}`,i=localStorage.getItem(n);if(!i)return null;let a=JSON.parse(i);return a.lastUsed=Date.now(),localStorage.setItem(n,JSON.stringify(a)),this.decryptKey(a.key)}catch(n){return console.error("[ApiKeyStorage] Failed to retrieve API key:",n),null}}static hasKey(e){let n=`${_e}${e}`;return localStorage.getItem(n)!==null}static removeKey(e){try{let n=`${_e}${e}`;localStorage.removeItem(n)}catch(n){console.error("[ApiKeyStorage] Failed to remove API key:",n)}}static getStoredServices(){let e=[];try{for(let n=0;n<localStorage.length;n++){let i=localStorage.key(n);if(i&&i.startsWith(_e)){let a=i.substring(_e.length),s=localStorage.getItem(i);if(s){let r=JSON.parse(s);e.push({service:a,label:r.label,created:r.created,lastUsed:r.lastUsed})}}}}catch(n){console.error("[ApiKeyStorage] Failed to get stored services:",n)}return e.sort((n,i)=>i.lastUsed-n.lastUsed)}static clearAll(){try{let e=[];for(let n=0;n<localStorage.length;n++){let i=localStorage.key(n);i&&i.startsWith(_e)&&e.push(i)}e.forEach(n=>localStorage.removeItem(n))}catch(e){console.error("[ApiKeyStorage] Failed to clear API keys:",e)}}static encryptKey(e){try{let i="handler_preview_salt_2024"+e;return btoa(i)}catch(n){return console.warn("[ApiKeyStorage] Encryption failed, storing as-is:",n),e}}static decryptKey(e){try{let n=atob(e),i="handler_preview_salt_2024";return n.startsWith(i)?n.substring(i.length):n}catch(n){return console.warn("[ApiKeyStorage] Decryption failed, returning as-is:",n),e}}},bn=()=>je.getKey("gemini"),yn=(t,e)=>je.setKey("gemini",t,e),Ro=()=>je.hasKey("gemini");window.ApiKeyStorage=je;window.getGeminiApiKey=bn;window.setGeminiApiKey=yn;window.hasGeminiApiKey=Ro;var xn=class{constructor(){this.modal=null;this.options=null;this.analyzer=ts();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(e){this.options=e,this.currentPrompt=e.initialPrompt||"",this.generatedImages=[],this.selectedImageIndex=-1,this.isGenerating=!1,this.createModal(),document.body.appendChild(this.modal),setTimeout(()=>{var n,i;(n=this.promptInput)==null||n.focus(),(i=this.promptInput)==null||i.select()},100)}createModal(){var n;let e=document.createElement("div");e.className="ai-modal",e.innerHTML=`
|
|
67
66
|
<div class="ai-modal-card">
|
|
68
67
|
<div class="ai-modal-header">
|
|
69
68
|
<div class="ai-modal-actions">
|
|
@@ -142,27 +141,27 @@ Palette:`)[0].replace(/^Summary:\s*/i,"").trim()),n={summary:l,palette:c.slice(0
|
|
|
142
141
|
<button class="ai-btn primary" data-action="apply" disabled>Apply</button>
|
|
143
142
|
</div>
|
|
144
143
|
</div>
|
|
145
|
-
`,this.modal=
|
|
144
|
+
`,this.modal=e,this.attachEventListeners(),this.updatePromptFromDna()}attachEventListeners(){var i;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]"),(i=this.promptInput)==null||i.addEventListener("input",()=>{var a;this.currentPrompt=((a=this.promptInput)==null?void 0:a.value)||"",this.updateGenerateButton()});let e=this.modal.querySelector('[data-strength="creativity"]'),n=this.modal.querySelector(".ai-strength-value");e==null||e.addEventListener("input",()=>{n.textContent=e.value}),this.modal.addEventListener("click",a=>{var o;let s=a.target;switch(s.dataset.action||((o=s.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",a=>{let s=a.target;if(s.classList.contains("ai-gallery-item")||s.closest(".ai-gallery-item")){let r=s.closest(".ai-gallery-item"),o=parseInt(r.dataset.index||"-1");o>=0&&this.selectImage(o)}}),this.modal.addEventListener("click",a=>{a.target===this.modal&&this.close()}),this.updateGenerateButton()}updateGenerateButton(){if(!this.generateBtn)return;let e=this.currentPrompt.trim().length>0;this.generateBtn.disabled=!e||this.isGenerating}async updatePromptFromDna(){var n;let e=(n=this.modal)==null?void 0:n.querySelector("#ai-use-dna");if(e!=null&&e.checked)try{let i=this.analyzer.getResult();if(i!=null&&i.summary&&this.promptInput){let a=`${this.currentPrompt}
|
|
146
145
|
|
|
147
|
-
Style guidelines: ${i.summary}`;this.promptInput.value=
|
|
146
|
+
Style guidelines: ${i.summary}`;this.promptInput.value=a,this.currentPrompt=a}}catch(i){console.warn("[AiEditorModal] Failed to apply brand DNA:",i)}}async generateImage(){var e,n,i,a;if(!(!this.options||this.isGenerating)){this.isGenerating=!0,this.updateGenerateButton(),(e=this.loadingEl)==null||e.classList.remove("hidden"),(n=this.previewEl)==null||n.classList.add("hidden");try{let s=this.getApiKey();if(!s){alert("Please set your Gemini API key first. You can do this in the AI Creative Suite panel.");return}let r=[];if(this.options.currentValue&&this.options.currentValue.startsWith("data:"))try{let d=await fn(this.options.currentValue);d&&(r=[{base64:d.base64,mimeType:d.mimeType}])}catch(d){console.warn("[AiEditorModal] Failed to load current image:",d)}let o=await Pt(s,this.currentPrompt,r,{aspectRatio:"1:1"}),l=await Mt(o);this.generatedImages.push(l||o),this.selectedImageIndex=this.generatedImages.length-1,this.updateGallery(),this.updatePreview(),this.updateApplyButton()}catch(s){console.error("[AiEditorModal] Generation failed:",s),alert(`Generation failed: ${s instanceof Error?s.message:"Unknown error"}`)}finally{this.isGenerating=!1,(i=this.loadingEl)==null||i.classList.add("hidden"),(a=this.previewEl)==null||a.classList.remove("hidden"),this.updateGenerateButton()}}}updateGallery(){if(!this.galleryEl)return;let e=this.galleryEl.querySelector("[data-gallery-grid]");e&&(e.innerHTML=this.generatedImages.map((n,i)=>`
|
|
148
147
|
<div class="ai-gallery-item ${i===this.selectedImageIndex?"active":""}" data-index="${i}">
|
|
149
148
|
<img class="ai-gallery-thumb" src="${n}" alt="Generated ${i+1}" />
|
|
150
149
|
<div class="ai-gallery-label">#${i+1}</div>
|
|
151
150
|
</div>
|
|
152
|
-
`).join(""))}updatePreview(){if(!this.previewEl||this.selectedImageIndex<0)return;let
|
|
151
|
+
`).join(""))}updatePreview(){if(!this.previewEl||this.selectedImageIndex<0)return;let e=this.generatedImages[this.selectedImageIndex];this.previewEl.innerHTML=`<img src="${e}" alt="Selected image" />`}selectImage(e){e<0||e>=this.generatedImages.length||(this.selectedImageIndex=e,this.updateGallery(),this.updatePreview(),this.updateApplyButton())}toggleGallery(){this.galleryEl&&this.galleryEl.classList.toggle("hidden")}updateApplyButton(){var n;let e=(n=this.modal)==null?void 0:n.querySelector('[data-action="apply"]');e&&(e.disabled=this.selectedImageIndex<0)}applySelectedImage(){var n;if(this.selectedImageIndex<0||!((n=this.options)!=null&&n.onApply))return;let e=this.generatedImages[this.selectedImageIndex];this.options.onApply(e),this.close()}getApiKey(){let e=bn();if(e)return e;try{let n=this.analyzer.getResult();if(n&&n.apiKey)return yn(n.apiKey,"From Brand DNA"),n.apiKey}catch(n){console.warn("[AiEditorModal] Failed to get API key from brand DNA:",n)}return null}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.options=null}},vn=null;window.__openAiEditor=function(t,e,n,i){vn||(vn=new xn),vn.open({objectId:t,initialPrompt:e,currentValue:n,path:i==null?void 0:i.path,onApply:a=>{if(i!=null&&i.path){let s=window.updateManager;if(s)s.updateProperty(t,i.path,a);else{let r=window.getEditableObjectConfig,o=r==null?void 0:r(t);if(o){let l=i.path.split("."),d=o;for(let p=0;p<l.length-1;p++)d[l[p]]||(d[l[p]]={}),d=d[l[p]];d[l[l.length-1]]=a}}}window.dispatchEvent(new CustomEvent("inspector:refresh"))}})};En();var Sn=class{constructor(){this.modal=null;this.options=null}open(e){this.options=e,this.createModal(),document.body.appendChild(this.modal)}createModal(){if(!this.options)return;let{assetPath:e,assetType:n,objectId:i}=this.options,a=i||"Asset Preview",s=document.createElement("div");s.className="asset-preview-modal",s.innerHTML=`
|
|
153
152
|
<div class="asset-preview-card">
|
|
154
153
|
<div class="asset-preview-header">
|
|
155
|
-
<div class="asset-preview-title">${
|
|
154
|
+
<div class="asset-preview-title">${a}</div>
|
|
156
155
|
<button class="asset-preview-close" data-action="close">\xD7</button>
|
|
157
156
|
</div>
|
|
158
157
|
|
|
159
158
|
<div class="asset-preview-meta">
|
|
160
159
|
<div>Type: ${n.toUpperCase()}</div>
|
|
161
|
-
<div>Path: ${
|
|
160
|
+
<div>Path: ${e||"None"}</div>
|
|
162
161
|
</div>
|
|
163
162
|
|
|
164
163
|
<div class="asset-preview-body">
|
|
165
|
-
${this.renderAssetContent(
|
|
164
|
+
${this.renderAssetContent(e,n)}
|
|
166
165
|
</div>
|
|
167
166
|
|
|
168
167
|
<div class="asset-preview-actions">
|
|
@@ -170,13 +169,13 @@ Style guidelines: ${i.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
170
169
|
${n==="image"?'<button class="asset-preview-ai" data-action="edit">\u2728 AI Edit</button>':""}
|
|
171
170
|
</div>
|
|
172
171
|
</div>
|
|
173
|
-
`,this.modal=
|
|
172
|
+
`,this.modal=s,this.attachEventListeners()}renderAssetContent(e,n){if(!e)return'<div class="asset-preview-placeholder">No asset selected</div>';switch(n){case"image":return`<img src="${this.resolveAssetUrl(e)}" alt="Asset preview" style="max-width: 100%; max-height: 400px; object-fit: contain;" />`;case"audio":let a=this.resolveAssetUrl(e);return`
|
|
174
173
|
<audio controls style="width: 100%;">
|
|
175
|
-
<source src="${
|
|
176
|
-
<source src="${
|
|
174
|
+
<source src="${a}" type="audio/mpeg">
|
|
175
|
+
<source src="${a}" type="audio/wav">
|
|
177
176
|
Your browser does not support the audio element.
|
|
178
177
|
</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;">${
|
|
178
|
+
`;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;">${e}</pre>`;default:return`<div class="asset-preview-placeholder">Cannot preview ${n} assets</div>`}}resolveAssetUrl(e){return e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("/")?e:`/raw/${e}`}attachEventListeners(){if(!this.modal)return;this.modal.addEventListener("click",i=>{let a=i.target;(a.dataset.action==="close"||a===this.modal)&&this.close()});let e=this.modal.querySelector('[data-action="change"]');e&&e.addEventListener("click",()=>{this.openAssetEditor()});let n=this.modal.querySelector('[data-action="edit"]');n&&n.addEventListener("click",()=>{this.openAiEditor(),this.close()})}openAssetEditor(){this.options&&Promise.resolve().then(()=>(En(),ns)).then(({AssetEditorModal:e})=>{new e().show(this.options.objectId||"unknown",this.options.propertyPath||"",this.options.assetPath,i=>{var a;(a=this.options)!=null&&a.onChange&&this.options.onChange(i),this.close()})})}openAiEditor(){if(!this.options||this.options.assetType!=="image")return;let e=window.__openAiEditor;typeof e=="function"&&e(this.options.objectId||"asset","Edit this image asset",this.options.assetPath,{path:this.options.propertyPath,onApply:n=>{var i;(i=this.options)!=null&&i.onChange&&this.options.onChange(n)}})}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.options=null}};window.openAssetPreview=function(t){new Sn().open(t)};var An=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(e){this.options=e,this.createModal(),this.loadImage(),document.body.appendChild(this.modal)}createModal(){let e=document.createElement("div");e.className="asset-crop-modal",e.innerHTML=`
|
|
180
179
|
<div class="asset-crop-card">
|
|
181
180
|
<div class="asset-crop-header">
|
|
182
181
|
<div>
|
|
@@ -227,7 +226,7 @@ Style guidelines: ${i.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
227
226
|
<button class="asset-crop-apply primary" data-action="apply">Apply Crop</button>
|
|
228
227
|
</div>
|
|
229
228
|
</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 i;if(!this.image||!this.canvas)return;let t=this.image.width/this.image.height,n=this.canvas.width/this.canvas.height;t>n?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*n,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/n,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(i=this.options)!=null&&i.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(t){if(!this.image)return;let n=this.image.width/this.image.height,i=this.cropX+this.cropWidth/2,r=this.cropY+this.cropHeight/2;t>n?(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,i-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,n=this.canvas.height/this.cropHeight;this.scale=Math.min(t,n)*.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,n=this.panY,i=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,n,i,r),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(t,n,i,r),this.ctx.fillStyle="#ffffff";let a=8;[[t,n],[t+i-a,n],[t,n+r-a],[t+i-a,n+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 n=t.getContext("2d");if(!n)return;let i=150;t.width=i,t.height=i;let r=i/this.cropWidth,a=i/this.cropHeight,s=Math.min(r,a),o=this.cropWidth*s,d=this.cropHeight*s,l=(i-o)/2,c=(i-d)/2;n.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",i=>{let r=parseFloat(i.target.value);this.setZoom(r)});let n=this.modal.querySelector(".asset-crop-aspect-select");n==null||n.addEventListener("change",i=>{let r=i.target.value;this.setAspectRatio(r)}),this.modal.addEventListener("click",i=>{switch(i.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",i=>{i.target===this.modal&&this.close()})}handleMouseDown(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 n=t.clientX-this.dragStartX,i=t.clientY-this.dragStartY;this.panX=this.lastPanX+n,this.panY=this.lastPanY+i,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(t){t.preventDefault();let n=t.deltaY>0?.9:1.1;this.setZoom(this.scale*n)}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 n=t.touches[0].clientX-this.dragStartX,i=t.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+n,this.panY=this.lastPanY+i,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 n;switch(t){case"1:1":n=1;break;case"4:3":n=4/3;break;case"16:9":n=16/9;break;case"3:2":n=3/2;break;default:n=void 0}n&&this.applyAspectRatio(n),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let t=this.modal.querySelector(".asset-crop-zoom-value"),n=this.modal.querySelector(".asset-crop-zoom-slider");t&&(t.textContent=`${this.scale.toFixed(1)}x`),n&&(n.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let t=this.cropWidth*this.scale,n=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-t,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-n,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"),n=t.getContext("2d");if(!n)return;t.width=this.cropWidth,t.height=this.cropHeight,n.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let i=t.toDataURL("image/png");this.options.onCrop(i),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 Eh=Ge(require("lottie-web"),1);xa(Wc);typeof window!="undefined"&&!window.lottie&&(window.lottie=Eh.default);Oa();pt();var Io=Cc.version,O0=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 Rh={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"},Mh=Math.random().toString(36).slice(2),On=null,Rn={...Rh},Oh="web_embed",zo={},Li,Po=!1,ki=!1,Mi=!1,Ih=!1,Ho=1,Zr=0,ea=!1,lt=!1,Mn="",In=Math.floor(window.innerWidth),Pn=Math.floor(window.innerHeight),Fo=In>Pn,ct=!1,Ri=!1,Sh=!1,Ah=!1,jo=!1,Jr=null,Xt=null,Bo=!1,No=!1,Kr=new Map;function Ph(){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=Ph();t!==null&&(Bo=!0,k("session_time",{duration_ms:t,reason:e}))}function Ch(){if(On)return On;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),On=e,e}function Qr(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function jh(e,t){return{event_name:e,ts:Date.now(),session_id:Mh,deployment_id:Rn.deployment_id,variant_id:Rn.variant_id,export_profile_id:Rn.profile_id,instance_id:Rn.instance_id||"default",env:Oh==="mraid"?"mraid":"web",attribution:Li,payload:t}}function k(e,t){let n=Qr(e),i=jh(n,t);ma(i,!!zo.analytics),Gi(n,i),n!==e&&Gi(e,i)}function Oi(){Jr&&(Jr(In,Pn),Jr=null)}function jn(e){Ho=e,k("volume",e)}function Dn(e){e&&(Ih=!0),!Mi&&(Mi=!0,k("pause"),jn(0))}function Ii(e){!e&&Ih||Mi&&(Mi=!1,k("resume"),jn(Ho))}function St(e,t){In=Math.floor(e||window.innerWidth),Pn=Math.floor(t||window.innerHeight),Fo=In>Pn,k("resize",{width:In,height:Pn})}function I0(){if(Fc())try{let e=mraid.getMaxSize();St(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Ii():Dn()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();St(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();jn(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&jn(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),ea=!0,mraid.isViewable()&&mraid.getState()!=="hidden")ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Oi();else{let n=()=>{ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Oi()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function P0(){if(Bc())try{let e=dapi.getScreenSize();St(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Ii():Dn()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();St(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(jn(t?1:0),dapi.addEventListener("audioVolumeChange",n=>jn(n?1:0)),ea=!0,dapi.isViewable())ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Oi();else{let n=()=>{ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Oi()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function Th(){let e=()=>{ct||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(ct=!0,k("boot"),k("view"),k("ready"),lt=!0,Oi(),Ri&&(Ri=!1,ze.start()))};window.addEventListener("resize",()=>St()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Ii(),e()):Dn()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),ea=!0}function j0(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(Sh=!0),!(Sh&&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 kh(e){var i,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{(i=window.ExitApi)==null||i.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(Nc())(o=(s=window.FbPlayableAd)==null?void 0:s.onCTAClick)==null||o.call(s);else if(qc())(l=(d=window.ScPlayableAd)==null?void 0:d.onCTAClick)==null||l.call(d);else if(Uc())try{(f=(c=window.smxTracking)==null?void 0:c.redirect)==null||f.call(c)}catch(h){console.warn("Smadex redirect failed",h)}else if(Hc()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(e||Mn||""):e&&window.open(e)}else Jt()?(p=window.install)==null||p.call(window):$c()?(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 D0(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;fe("view",()=>t(n.mraid_viewable)),fe("start",()=>t(n.game_viewable)),fe("engagement",()=>t(n.engagement));let i=()=>t(n.complete);fe("complete",i),qi("engagement",r=>{var a;((a=r==null?void 0:r.payload)==null?void 0:a.count)>3&&i()}),fe("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;fe("view",()=>t(n.Ad_Load_Start)),fe("start",()=>t(n.Ad_Viewable)),fe("engagement",()=>t(n.First_Engagement)),fe("complete",()=>t(n.Gameplay_Complete)),fe("cta_click",()=>t(n.DSP_Click)),fe("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function z0(){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 Lh(){var t,n,i;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(n=e==null?void 0:e.playableFinished)==null||n.call(e),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function F0(){Jt()&&(window.mintGameStart=()=>{Ii(!0),St()},window.mintGameClose=()=>{Dn(!0)})}function B0(){if(!ya())return;let e=window.NUC;!e||!e.trigger||(ze.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,Mn)}),ze.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var ze={init(e={},t){var n;if(Oh=e.profile||"web_embed",zo=e.consent||{},Rn={...Rh,...e.ids||{}},On=e.rootEl||On,Li=void 0,yc((n=e.telemetry)!=null&&n.endpoint?e.telemetry:null),Xt=null,Bo=!1,No=!1,Kr.clear(),Mn=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,Ch(),H0(On),Gc(),I0(),P0(),!ea){if(document.readyState==="complete")Th();else if(!Ah){Ah=!0;let i=()=>{Th(),window.removeEventListener("load",i),document.removeEventListener("DOMContentLoaded",i)};window.addEventListener("load",i),document.addEventListener("DOMContentLoaded",i)}}j0(),D0(),z0(),F0(),B0(),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"),Ri&&(Ri=!1,ze.start()),lt=!0),lt=ct},getRoot(){return Ch()},get version(){return Io},get maxWidth(){return In},get maxHeight(){return Pn},get isLandscape(){return Fo},get isReady(){return lt},get isStarted(){return Po},get isPaused(){return Mi},get isFinished(){return ki},get volume(){return Ho},get interactions(){return Zr},on(e,t){qi(Qr(e),t)},off(e,t){ga(Qr(e),t)},start(){var e,t;if(!Po){if(!ct){Ri=!0;return}if(Po=!0,Xt||(Xt=Date.now()),k("start"),St(),Jt())Dn(),(e=window.gameReady)==null||e.call(window);else if(Qt()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:Fo?"landscape":"portrait",buildID:Io})}}},finish(){var e,t;ki||(ki=!0,k("complete"),Do("complete"),Jt()?(e=window.gameEnd)==null||e.call(window):ba()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):Qt()&&Lh())},install(e){if(!ki){ki=!0,Qt()?(Lh(),setTimeout(()=>ze.install(e),300)):(k("complete"),setTimeout(()=>ze.install(e),0));return}jo||(jo=!0,setTimeout(()=>jo=!1,500),k("cta_click"),k("conversion"),Do("cta"),kh(e||Mn))},emit(e,t){let n=Qr(e);if(!O0.has(n)&&n!=="resize"&&n!=="volume"&&!n.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=jh(n,t);ma(i,!!zo.analytics),Gi(n,i)},gameStart(){ze.start()},gameEnd(){ze.finish()},ctaClick(e,t){k("cta_click",{url:e||Mn,manual:!0}),(t==null?void 0:t.open)!==!1&&kh(e||Mn)},ctaShow(e){k("cta_show",e)},ctaDismiss(e){k("cta_dismiss",e)},getGameTimeMs(){return Ph()},endSession(e="manual"){Do(e)},setAttribution(e){Li=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 n=Math.abs(N0(`${Mh}:${e}`))%t.length,i=t[n];return Li={...Li||{},experiment_id:e},Rn.variant_id=i,k("ab_assign",{experiment_id:e,variant_id:i}),i},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",n){if(!e)return;let i=Kr.get(e);if(!i)return;Kr.delete(e);let r=Date.now()-i;if(!(!Number.isFinite(r)||r<0)){if(t==="custom"){k("engagement",{action:"timer",key:e,duration_ms:r,...n});return}k(t,{key:e,duration_ms:r,...n})}},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,n){k("error",{code:e,message:t,...n})},retry(){var e,t,n;if(Jt())(e=window.gameRetry)==null||e.call(window);else if(ya()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}k("engagement",{action:"retry"})},pause(){Dn(!0)},resume(){Ii(!0)},resize(e,t){St(e,t)}},en=ze;function N0(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t|0}function H0(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
229
|
+
`,this.modal=e,this.attachEventListeners(),this.initializeCanvas()}initializeCanvas(){this.modal&&(this.canvas=this.modal.querySelector(".asset-crop-canvas"),this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.canvas.width=400,this.canvas.height=300))}loadImage(){this.options&&(this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=()=>{this.initializeCrop(),this.render()},this.image.src=this.options.imageSrc)}initializeCrop(){var i;if(!this.image||!this.canvas)return;let e=this.image.width/this.image.height,n=this.canvas.width/this.canvas.height;e>n?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*n,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/n,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(i=this.options)!=null&&i.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(e){if(!this.image)return;let n=this.image.width/this.image.height,i=this.cropX+this.cropWidth/2,a=this.cropY+this.cropHeight/2;e>n?(this.cropWidth=Math.min(this.image.width,this.cropHeight*e),this.cropHeight=this.cropWidth/e):(this.cropHeight=Math.min(this.image.height,this.cropWidth/e),this.cropWidth=this.cropHeight*e),this.cropX=Math.max(0,Math.min(this.image.width-this.cropWidth,i-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,a-this.cropHeight/2))}fitToCanvas(){if(!this.image||!this.canvas)return;let e=this.canvas.width/this.cropWidth,n=this.canvas.height/this.cropHeight;this.scale=Math.min(e,n)*.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 e=this.panX,n=this.panY,i=this.cropWidth*this.scale,a=this.cropHeight*this.scale;this.ctx.fillStyle="rgba(0, 0, 0, 0.5)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.clearRect(e,n,i,a),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(e,n,i,a),this.ctx.fillStyle="#ffffff";let s=8;[[e,n],[e+i-s,n],[e,n+a-s],[e+i-s,n+a-s]].forEach(([o,l])=>{var d;(d=this.ctx)==null||d.fillRect(o,l,s,s)})}updatePreview(){if(!this.modal||!this.image)return;let e=this.modal.querySelector(".asset-crop-preview-canvas");if(!e)return;let n=e.getContext("2d");if(!n)return;let i=150;e.width=i,e.height=i;let a=i/this.cropWidth,s=i/this.cropHeight,r=Math.min(a,s),o=this.cropWidth*r,l=this.cropHeight*r,d=(i-o)/2,p=(i-l)/2;n.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,d,p,o,l)}attachEventListeners(){if(!this.modal||!this.canvas)return;this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this));let e=this.modal.querySelector(".asset-crop-zoom-slider");e==null||e.addEventListener("input",i=>{let a=parseFloat(i.target.value);this.setZoom(a)});let n=this.modal.querySelector(".asset-crop-aspect-select");n==null||n.addEventListener("change",i=>{let a=i.target.value;this.setAspectRatio(a)}),this.modal.addEventListener("click",i=>{switch(i.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",i=>{i.target===this.modal&&this.close()})}handleMouseDown(e){this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.lastPanX=this.panX,this.lastPanY=this.panY,this.canvas.style.cursor="grabbing"}handleMouseMove(e){if(!this.isDragging)return;let n=e.clientX-this.dragStartX,i=e.clientY-this.dragStartY;this.panX=this.lastPanX+n,this.panY=this.lastPanY+i,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(e){e.preventDefault();let n=e.deltaY>0?.9:1.1;this.setZoom(this.scale*n)}handleTouchStart(e){e.touches.length===1&&(this.isDragging=!0,this.dragStartX=e.touches[0].clientX,this.dragStartY=e.touches[0].clientY,this.lastPanX=this.panX,this.lastPanY=this.panY)}handleTouchMove(e){if(!this.isDragging||e.touches.length!==1)return;e.preventDefault();let n=e.touches[0].clientX-this.dragStartX,i=e.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+n,this.panY=this.lastPanY+i,this.constrainPan(),this.render()}handleTouchEnd(){this.isDragging=!1}setZoom(e){this.scale=Math.max(.1,Math.min(3,e)),this.updateZoomUI(),this.constrainPan(),this.render()}setAspectRatio(e){let n;switch(e){case"1:1":n=1;break;case"4:3":n=4/3;break;case"16:9":n=16/9;break;case"3:2":n=3/2;break;default:n=void 0}n&&this.applyAspectRatio(n),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let e=this.modal.querySelector(".asset-crop-zoom-value"),n=this.modal.querySelector(".asset-crop-zoom-slider");e&&(e.textContent=`${this.scale.toFixed(1)}x`),n&&(n.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let e=this.cropWidth*this.scale,n=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-e,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-n,Math.min(0,this.panY))}reset(){this.initializeCrop(),this.render()}applyCrop(){var a;if(!this.image||!((a=this.options)!=null&&a.onCrop))return;let e=document.createElement("canvas"),n=e.getContext("2d");if(!n)return;e.width=this.cropWidth,e.height=this.cropHeight,n.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let i=e.toDataURL("image/png");this.options.onCrop(i),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal);let e=this.options;this.modal=null,this.canvas=null,this.ctx=null,this.image=null,this.options=null,e!=null&&e.onCancel&&e.onCancel()}};window.openAssetCrop=function(t){new An().open(t)};fe();fe();var is=ae(require("lottie-web"),1);tn(Ha);typeof window!="undefined"&&!window.lottie&&(window.lottie=is.default);hn();fe();var Cn=ya.version,Io=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"]);ba();var ds={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"},ps=Math.random().toString(36).slice(2),He=null,De={...ds},us="web_embed",Mn={},et,Tn=!1,Qe=!1,nt=!1,gs=!1,On=1,Rt=0,jt=!1,pe=!1,$e="",ze=Math.floor(window.innerWidth),Ne=Math.floor(window.innerHeight),Pn=ze>Ne,ue=!1,tt=!1,as=!1,ss=!1,_n=!1,Ot=null,Le=null,kn=!1,Rn=!1,kt=new Map;function hs(){if(!Le)return null;let t=Date.now()-Le;return!Number.isFinite(t)||t<0?null:t}function Ln(t){if(kn)return;let e=hs();e!==null&&(kn=!0,w("session_time",{duration_ms:e,reason:t}))}function rs(){if(He)return He;let t=document.createElement("div");return t.id="handler-root",t.setAttribute("data-handler-root","true"),document.body.appendChild(t),He=t,t}function It(t){switch(t){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return t}}function fs(t,e){return{event_name:t,ts:Date.now(),session_id:ps,deployment_id:De.deployment_id,variant_id:De.variant_id,export_profile_id:De.profile_id,instance_id:De.instance_id||"default",env:us==="mraid"?"mraid":"web",attribution:et,payload:e}}function w(t,e){let n=It(t),i=fs(n,e);Jt(i,!!Mn.analytics),bt(n,i),n!==t&&bt(t,i)}function it(){Ot&&(Ot(ze,Ne),Ot=null)}function Fe(t){On=t,w("volume",t)}function Be(t){t&&(gs=!0),!nt&&(nt=!0,w("pause"),Fe(0))}function at(t){!t&&gs||nt&&(nt=!1,w("resume"),Fe(On))}function me(t,e){ze=Math.floor(t||window.innerWidth),Ne=Math.floor(e||window.innerHeight),Pn=ze>Ne,w("resize",{width:ze,height:Ne})}function jo(){if(Pa())try{let t=mraid.getMaxSize();me(t.width,t.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?at():Be()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();me(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();Fe(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&Fe(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),jt=!0,mraid.isViewable()&&mraid.getState()!=="hidden")ue=!0,w("boot"),w("view"),w("ready"),pe=!0,it();else{let n=()=>{ue=!0,w("boot"),w("view"),w("ready"),pe=!0,it()};mraid.addEventListener("ready",n)}}catch(t){console.warn("MRAID hook skipped",t)}}function Do(){if(ka())try{let t=dapi.getScreenSize();me(t.width,t.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?at():Be()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();me(n.width||i.width,n.height||i.height)});let e=dapi.getAudioVolume();if(Fe(e?1:0),dapi.addEventListener("audioVolumeChange",n=>Fe(n?1:0)),jt=!0,dapi.isViewable())ue=!0,w("boot"),w("view"),w("ready"),pe=!0,it();else{let n=()=>{ue=!0,w("boot"),w("view"),w("ready"),pe=!0,it()};dapi.addEventListener("ready",n)}}catch(t){console.warn("DAPI hook skipped",t)}}function os(){let t=()=>{ue||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(ue=!0,w("boot"),w("view"),w("ready"),pe=!0,it(),tt&&(tt=!1,Z.start()))};window.addEventListener("resize",()=>me()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(at(),t()):Be()}),document.readyState==="complete"||document.readyState==="interactive"?t():window.addEventListener("load",t),jt=!0}function $o(){let t=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(as=!0),!(as&&e instanceof MouseEvent)&&(Rt+=1,Rn||(Rn=!0,w("first_interaction",{count:Rt})),w("interaction",Rt))};document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)}function ls(t){var i,a,s,r,o,l,d,p,c,g,u,b;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(t||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(Oe())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(Ra())(o=(r=window.FbPlayableAd)==null?void 0:r.onCTAClick)==null||o.call(r);else if(Da())(d=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||d.call(l);else if(ja())try{(c=(p=window.smxTracking)==null?void 0:p.redirect)==null||c.call(p)}catch(h){console.warn("Smadex redirect failed",h)}else if(Oa()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(t||$e||""):t&&window.open(t)}else Re()?(g=window.install)==null||g.call(window):Ia()?(u=window.openAppStore)==null||u.call(window):Zt()?(b=parent==null?void 0:parent.postMessage)==null||b.call(parent,"download","*"):t&&window.open(t)}function Ho(){let t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=n=>{if(!n)return;let i=new Image;i.src=n};if(t==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;B("view",()=>e(n.mraid_viewable)),B("start",()=>e(n.game_viewable)),B("engagement",()=>e(n.engagement));let i=()=>e(n.complete);B("complete",i),mt("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),B("cta_click",()=>e(n.click))}else if(t==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;B("view",()=>e(n.Ad_Load_Start)),B("start",()=>e(n.Ad_Viewable)),B("engagement",()=>e(n.First_Engagement)),B("complete",()=>e(n.Gameplay_Complete)),B("cta_click",()=>e(n.DSP_Click)),B("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>e(n[`Spent_${i}_Seconds`]),i*1e3))})}}function zo(){if(!Oe())return;let t=window.TJ_API;t&&t.setPlayableAPI&&t.setPlayableAPI({skipAd:()=>{try{Z.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function cs(){var e,n,i;let t=window.TJ_API;(e=t==null?void 0:t.objectiveComplete)==null||e.call(t),(n=t==null?void 0:t.playableFinished)==null||n.call(t),(i=t==null?void 0:t.gameplayFinished)==null||i.call(t)}function No(){Re()&&(window.mintGameStart=()=>{at(!0),me()},window.mintGameClose=()=>{Be(!0)})}function Fo(){if(!Qt())return;let t=window.NUC;!t||!t.trigger||(Z.on("cta_click",()=>{var e,n;return(n=(e=t.trigger).convert)==null?void 0:n.call(e,$e)}),Z.on("complete",()=>{var e,n;return(n=(e=t.trigger).tryAgain)==null?void 0:n.call(e)}))}var Z={init(t={},e){var n;if(us=t.profile||"web_embed",Mn=t.consent||{},De={...ds,...t.ids||{}},He=t.rootEl||He,et=void 0,da((n=t.telemetry)!=null&&n.endpoint?t.telemetry:null),Le=null,kn=!1,Rn=!1,kt.clear(),$e=t.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(Ot=e),w("init"),document.body.oncontextmenu=()=>!1,rs(),Go(He),$a(),jo(),Do(),!jt){if(document.readyState==="complete")os();else if(!ss){ss=!0;let i=()=>{os(),window.removeEventListener("load",i),document.removeEventListener("DOMContentLoaded",i)};window.addEventListener("load",i),document.addEventListener("DOMContentLoaded",i)}}$o(),Ho(),zo(),No(),Fo(),console.log(`%c @handler/playable-sdk %c v${Cn} `,"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;"),ue&&!pe&&(w("boot"),w("view"),w("ready"),tt&&(tt=!1,Z.start()),pe=!0),pe=ue},getRoot(){return rs()},get version(){return Cn},get maxWidth(){return ze},get maxHeight(){return Ne},get isLandscape(){return Pn},get isReady(){return pe},get isStarted(){return Tn},get isPaused(){return nt},get isFinished(){return Qe},get volume(){return On},get interactions(){return Rt},on(t,e){mt(It(t),e)},off(t,e){Xt(It(t),e)},start(){var t,e;if(!Tn){if(!ue){tt=!0;return}if(Tn=!0,Le||(Le=Date.now()),w("start"),me(),Re())Be(),(t=window.gameReady)==null||t.call(window);else if(Oe()){let n=window.TJ_API;(e=n==null?void 0:n.setPlayableBuild)==null||e.call(n,{orientation:Pn?"landscape":"portrait",buildID:Cn})}}},finish(){var t,e;Qe||(Qe=!0,w("complete"),Ln("complete"),Re()?(t=window.gameEnd)==null||t.call(window):Zt()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):Oe()&&cs())},install(t){if(!Qe){Qe=!0,Oe()?(cs(),setTimeout(()=>Z.install(t),300)):(w("complete"),setTimeout(()=>Z.install(t),0));return}_n||(_n=!0,setTimeout(()=>_n=!1,500),w("cta_click"),w("conversion"),Ln("cta"),ls(t||$e))},emit(t,e){let n=It(t);if(!Io.has(n)&&n!=="resize"&&n!=="volume"&&!n.startsWith("custom."))throw new Error(`Event ${t} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=fs(n,e);Jt(i,!!Mn.analytics),bt(n,i)},gameStart(){Z.start()},gameEnd(){Z.finish()},ctaClick(t,e){w("cta_click",{url:t||$e,manual:!0}),(e==null?void 0:e.open)!==!1&&ls(t||$e)},ctaShow(t){w("cta_show",t)},ctaDismiss(t){w("cta_dismiss",t)},getGameTimeMs(){return hs()},endSession(t="manual"){Ln(t)},setAttribution(t){et=t},abTest(t,e){if(!t)throw new Error("abTest requires experimentId");if(!Array.isArray(e)||e.length<2)throw new Error("abTest requires at least 2 variants");let n=Math.abs(Bo(`${ps}:${t}`))%e.length,i=e[n];return et={...et||{},experiment_id:t},De.variant_id=i,w("ab_assign",{experiment_id:t,variant_id:i}),i},levelStart(t,e){Le||(Le=Date.now()),w("level_start",{level_id:t,...e})},levelComplete(t,e){w("level_complete",{level_id:t,...e})},levelFail(t,e){w("level_fail",{level_id:t,...e})},checkpoint(t,e){w("checkpoint",{checkpoint_id:t,...e})},reward(t,e){w("reward",{reward_id:t,...e})},tutorialStart(t,e){w("tutorial_start",{step_id:t,...e})},tutorialComplete(t,e){w("tutorial_complete",{step_id:t,...e})},tutorialSkip(t,e){w("tutorial_skip",{step_id:t,...e})},timerStart(t){t&&kt.set(t,Date.now())},timerEnd(t,e="custom",n){if(!t)return;let i=kt.get(t);if(!i)return;kt.delete(t);let a=Date.now()-i;if(!(!Number.isFinite(a)||a<0)){if(e==="custom"){w("engagement",{action:"timer",key:t,duration_ms:a,...n});return}w(e,{key:t,duration_ms:a,...n})}},fps(t,e){w("fps",{value:t,...e})},memory(t,e){w("memory",{bytes:t,...e})},assetLoadStart(t,e){w("asset_load_start",{asset_id:t,...e})},assetLoadComplete(t,e){w("asset_load_complete",{asset_id:t,...e})},reportError(t,e,n){w("error",{code:t,message:e,...n})},retry(){var t,e,n;if(Re())(t=window.gameRetry)==null||t.call(window);else if(Qt()){let i=window.NUC;(n=(e=i==null?void 0:i.trigger)==null?void 0:e.tryAgain)==null||n.call(e)}w("engagement",{action:"retry"})},pause(){Be(!0)},resume(){at(!0)},resize(t,e){me(t,e)}},Ie=Z;function Bo(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e|0}function Go(t){let e=document.createElement("script");e.type="text/javascript",e.textContent=`
|
|
231
230
|
(function(){
|
|
232
231
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
233
232
|
function unlock(){
|
|
@@ -243,7 +242,7 @@ Style guidelines: ${i.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
243
242
|
}
|
|
244
243
|
events.forEach(function(e){ document.addEventListener(e, unlock, false); });
|
|
245
244
|
})();
|
|
246
|
-
`,
|
|
245
|
+
`,t.appendChild(e)}var In=(i=>(i[i.PHONE_TALL=0]="PHONE_TALL",i[i.TABLET=1]="TABLET",i[i.LANDSCAPE=2]="LANDSCAPE",i))(In||{});function Dt(t,e){let n=t/e;return n<=.62?0:n<=.85?1:2}var Ge=class{constructor(e,n){this.root=e,this.stage=n,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 e=this.stage.getBoundingClientRect(),n=Dt(e.width,e.height);n===0?this.uiFrame.style.maxWidth="420px":n===1?this.uiFrame.style.maxWidth="520px":this.uiFrame.style.maxWidth="640px"}getAspectClass(){let e=this.stage.getBoundingClientRect();return Dt(e.width,e.height)}};async function ms(t,e={}){let n=()=>{let f=t.getBoundingClientRect(),m=Math.floor(f.width),E=Math.floor(f.height);return(m<=0||!isFinite(m)||m!==m)&&(m=t.clientWidth||window.innerWidth||320),(E<=0||!isFinite(E)||E!==E)&&(E=t.clientHeight||window.innerHeight||480),(m<=0||!isFinite(m)||m!==m)&&(m=320),(E<=0||!isFinite(E)||E!==E)&&(E=480),console.log("[THREE-BASE] getSize result:",{width:m,height:E,boundingRect:{width:f.width,height:f.height},clientSize:{width:t.clientWidth,height:t.clientHeight},styleWidth:t.style.width,styleHeight:t.style.height,note:"Using boundingRect as primary source (actual rendered size)"}),{width:m,height:E}},i=t.style.width&&!t.style.width.includes("%"),a=t.style.height&&!t.style.height.includes("%");t.style.position||(t.style.position="relative"),t.style.display||(t.style.display="block"),t.style.width=t.style.width||"100%",t.style.height=t.style.height||"100%",t.style.minWidth="100%",t.style.minHeight="100%",t.style.maxWidth="100%",t.style.maxHeight="100%",t.style.boxSizing="border-box",t.style.overflow="hidden",t.style.margin="0",t.style.padding="0",t.style.border="none";let s=e.background||"linear-gradient(160deg, #0d1020, #0f1c2f)";t.style.setProperty("background",s,"important"),t.style.setProperty("background-size","cover","important"),t.style.setProperty("background-position","center","important"),t.style.setProperty("background-repeat","no-repeat","important");let r=document.createElement("div");r.style.cssText=`
|
|
247
246
|
position: absolute !important;
|
|
248
247
|
inset: 0 !important;
|
|
249
248
|
width: 100% !important;
|
|
@@ -253,7 +252,7 @@ Style guidelines: ${i.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
253
252
|
max-width: 100% !important;
|
|
254
253
|
max-height: 100% !important;
|
|
255
254
|
display: block !important;
|
|
256
|
-
background: ${
|
|
255
|
+
background: ${s} !important;
|
|
257
256
|
background-size: cover !important;
|
|
258
257
|
background-position: center !important;
|
|
259
258
|
background-repeat: no-repeat !important;
|
|
@@ -264,17 +263,17 @@ Style guidelines: ${i.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
264
263
|
padding: 0 !important;
|
|
265
264
|
border: none !important;
|
|
266
265
|
overflow: hidden !important;
|
|
267
|
-
`,
|
|
266
|
+
`,t.appendChild(r);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(";")),r.appendChild(o);let l=new V.Scene,{width:d,height:p}=n(),c=new V.AmbientLight(16777215,.6);l.add(c);let g=new V.DirectionalLight(16777215,.8);g.position.set(5,5,5),g.castShadow=!1,l.add(g);let u=new V.DirectionalLight(16777215,.3);u.position.set(-5,0,5),l.add(u);let b=new V.PerspectiveCamera(55,d/p,.1,100);b.position.set(0,0,3.2),b.lookAt(0,0,0),b.updateMatrixWorld();let h=new V.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});h.setPixelRatio(window.devicePixelRatio||1),h.setSize(d,p),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=f=>{var L;let m=t.getBoundingClientRect(),E=window.getComputedStyle(t);console.log("[THREE-BASE] applySize called:",{providedSize:f,rootRect:{width:m.width,height:m.height},clientSize:{width:t.clientWidth,height:t.clientHeight},styleSize:{width:t.style.width,height:t.style.height},computedStyle:{width:E.width,height:E.height,transform:E.transform,scale:E.scale},rendererCurrentSize:{width:h.domElement.width,height:h.domElement.height},rendererStyleSize:{width:h.domElement.style.width,height:h.domElement.style.height},stackTrace:(L=new Error().stack)==null?void 0:L.split(`
|
|
268
267
|
`).slice(1,4).join(`
|
|
269
|
-
`)});let
|
|
268
|
+
`)});let S=m.width,A=m.height;if((S<=0||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid boundingRect.width, using clientWidth fallback",{boundingRectWidth:m.width,clientWidth:t.clientWidth}),S=t.clientWidth||window.innerWidth||320),(A<=0||!isFinite(A))&&(console.warn("[THREE-BASE] Invalid boundingRect.height, using clientHeight fallback",{boundingRectHeight:m.height,clientHeight:t.clientHeight}),A=t.clientHeight||window.innerHeight||480),typeof(f==null?void 0:f.width)=="number"&&f.width>0){let j=Math.abs(f.width-m.width),O=m.width*.1;j>O?console.warn("[THREE-BASE] Provided width ignored (too different from container):",{provided:f.width,container:m.width,difference:j,tolerance:O,willUse:"container size (boundingRect)"}):(S=f.width,console.log("[THREE-BASE] Using provided width (within tolerance):",{provided:f.width,container:m.width}))}if(typeof(f==null?void 0:f.height)=="number"&&f.height>0){let j=Math.abs(f.height-m.height),O=m.height*.1;j>O?console.warn("[THREE-BASE] Provided height ignored (too different from container):",{provided:f.height,container:m.height,difference:j,tolerance:O,willUse:"container size (boundingRect)"}):(A=f.height,console.log("[THREE-BASE] Using provided height (within tolerance):",{provided:f.height,container:m.height}))}(S<=0||A<=0||!isFinite(S)||!isFinite(A))&&(console.warn("[THREE-BASE] Invalid size in applySize, using fallback",{newWidth:S,newHeight:A,size:f,rootRect:m}),S=m.width||t.clientWidth||320,A=m.height||t.clientHeight||480);let M=Math.floor(S),R=Math.floor(A);console.log("[THREE-BASE] applySize setting renderer size:",{finalWidth:M,finalHeight:R,aspectRatio:M/R,beforeRendererSize:{width:h.domElement.width,height:h.domElement.height},beforeRendererStyle:{width:h.domElement.style.width,height:h.domElement.style.height}}),h.setSize(M,R),h.setPixelRatio(window.devicePixelRatio||1),b.aspect=M/R,b.updateProjectionMatrix();let _=t.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:_.width,height:_.height},cameraAspect:b.aspect,matches:{width:Math.abs(h.domElement.width-_.width)<1,height:Math.abs(h.domElement.height-_.height)<1},sizeDifference:{width:h.domElement.width-_.width,height:h.domElement.height-_.height}})};requestAnimationFrame(()=>{requestAnimationFrame(()=>{x()})});let v=!1;Ie.on("pause",()=>{v=!0,document.querySelectorAll("audio").forEach(m=>m.pause())}),Ie.on("resume",()=>{v=!1,document.querySelectorAll("audio").forEach(m=>{m.currentTime>0&&!m.ended&&m.play().catch(()=>{})})});let y=new Ge(t,r);return Ie.on("resize",({payload:f})=>{console.log("[THREE-BASE] Handler resize event received:",{payload:f,timestamp:Date.now(),rootRect:t.getBoundingClientRect()}),x({width:f==null?void 0:f.width,height:f==null?void 0:f.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:t.getBoundingClientRect()}),x(),y.updateLayout()}),{scene:l,camera:b,renderer:h,uiSystem:y,applySize:x}}var D=ae(require("three"),1),st=class{constructor(e){var n,i;this.position=(e==null?void 0:e.position)||{x:0,y:0},this.scale=(n=e==null?void 0:e.scale)!=null?n:1,this.rotation=(i=e==null?void 0:e.rotation)!=null?i:0}update(e){e.position!==void 0&&(this.position={...e.position}),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation)}syncToThree(e){let n=e.position.z,i=n===0||!isFinite(n)?.5:n;e.position.set(this.position.x,this.position.y,i),e.scale.set(this.scale,this.scale,this.scale),e.rotation.z=this.rotation}},rt=class{constructor(e){var n,i,a,s;this.z_index=(n=e==null?void 0:e.z_index)!=null?n:0,this.alpha=(i=e==null?void 0:e.alpha)!=null?i:1,this.visible=(a=e==null?void 0:e.visible)!=null?a:!0,this.tint=(s=e==null?void 0:e.tint)!=null?s:null}update(e){e.z_index!==void 0&&(this.z_index=e.z_index),e.alpha!==void 0&&(this.alpha=e.alpha),e.visible!==void 0&&(this.visible=e.visible),e.tint!==void 0&&(this.tint=e.tint)}syncToThree(e){if(e.renderOrder=this.z_index,e.visible=this.visible,e instanceof D.Mesh&&e.material&&(Array.isArray(e.material)?e.material.forEach(n=>{n instanceof D.Material&&(n.opacity=this.alpha,n.transparent=this.alpha<1)}):e.material instanceof D.Material&&(e.material.opacity=this.alpha,e.material.transparent=this.alpha<1)),this.tint!==null&&e instanceof D.Mesh&&e.material){let n=typeof this.tint=="string"?new D.Color(this.tint):new D.Color(this.tint);Array.isArray(e.material)?e.material.forEach(i=>{(i instanceof D.MeshBasicMaterial||i instanceof D.MeshStandardMaterial)&&i.color.copy(n)}):(e.material instanceof D.MeshBasicMaterial||e.material instanceof D.MeshStandardMaterial)&&e.material.color.copy(n)}}},ot=class{constructor(e,n,i,a){this.instanceId=e,this.objectConfig=n,this.threeObject=i,this._config=a,this.transform=new st(a.transform),this.renderer=new rt(a.render),this.sync()}sync(){this.transform.syncToThree(this.threeObject),this.renderer.syncToThree(this.threeObject)}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}getComponent(e){return this._config[e]}getPosition(){return{...this.transform.position}}setPosition(e,n){this.transform.position={x:e,y:n},this.transform.syncToThree(this.threeObject)}getAlpha(){return this.renderer.alpha}setAlpha(e){this.renderer.alpha=e,this.renderer.syncToThree(this.threeObject)}getVisible(){return this.renderer.visible}setVisible(e){this.renderer.visible=e,this.renderer.syncToThree(this.threeObject)}},$t=class{constructor(e){this.objects=new Map;this.config=e}create(e,n){let i=this.config.objects.get(e);if(!i)throw new Error(`Object config not found: ${e}`);let a=new ot(e,i.object_config||e,n,i);return this.objects.set(e,a),a}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[n,i]of this.objects.entries()){let a=e.objects.get(n);a&&i.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var Ht={"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 Q(t){let e=Ht[t];return e?e.family:(console.warn(`Font ID "${t}" not found in registry, using fallback`),"Arial, sans-serif")}function ee(t){var n;let e=Ht[t];return e&&(n=e.weight)!=null?n:"400"}function bs(t,e){Ht[t]=e}function ys(){return Object.keys(Ht)}var Ue=ae(require("three"),1);function Me(t){return{element:t,get alpha(){return parseFloat(t.style.opacity||"1")},set alpha(e){t.style.opacity=e.toString()},get visible(){return t.style.display!=="none"},set visible(e){t.style.display=e?"":"none"},position:{set(e,n){t.style.left=`${e}px`,t.style.top=`${n}px`},get x(){return parseFloat(t.style.left||"0")},get y(){return parseFloat(t.style.top||"0")}},scale:{set(e,n){t.style.transform=`scale(${e})`},get x(){let e=t.style.transform.match(/scale\(([^)]+)\)/);return e?parseFloat(e[1]):1}}}}function vs(t,e,n,i){var Qn,ei,ti,ni,ii,ai,si,ri,oi,li,ci,di,pi,ui,gi,hi,fi,mi,bi,yi,vi,xi,wi,Ei,Si,Ai,Ci,Ti,_i,Li,Mi,Pi,ki,Ri,Oi,Ii,ji,Di,$i,Hi,zi,Ni,Fi,Bi,Gi,Ui,qi,Wi,Vi,Yi,Ki,Xi,Ji,Zi,Qi,ea,ta,na,ia,aa,sa;let a=t.objects.get("ui_endgame_1"),s=t.objects.get("ui_endgame_logo_1"),r=t.objects.get("ui_endgame_title_1"),o=t.objects.get("ui_endgame_subtitle_1"),l=t.objects.get("ui_endgame_footer_1"),d=t.objects.get("ui_endgame_cta_1"),p=t.objects.get("ui_endgame_cta_hint_1"),c=t.objects.get("ui_endgame_hand_1"),g=t.engine.runtime||{},u=((Qn=a==null?void 0:a.gameplay)==null?void 0:Qn.tuning)||{},b=(a==null?void 0:a.render)||{},h=i.getBoundingClientRect(),x=h.width>0?h.width*.9:320,v=h.height>0?h.height*.85:400,y=Math.min((ei=u.panel_width)!=null?ei:320,x),f=Math.min((ti=u.panel_height)!=null?ti:400,v),m=(ni=u.panel_padding)!=null?ni:32,E=(ii=u.panel_radius)!=null?ii:24,S=b.background_color||u.panel_bg_color||"#1a0a0a",A=b.background_alpha!==void 0&&b.background_alpha!==null?b.background_alpha:(ai=u.panel_bg_alpha)!=null?ai:.98,M=b.border_color||u.panel_border_color||"#ffffff",R=(si=u.panel_border_width)!=null?si:2,_=(ri=u.panel_border_alpha)!=null?ri:.3,L=document.createElement("div");L.style.cssText=`
|
|
270
269
|
position: absolute;
|
|
271
|
-
width: ${
|
|
272
|
-
height: ${
|
|
273
|
-
background: ${
|
|
270
|
+
width: ${y}px;
|
|
271
|
+
height: ${f}px;
|
|
272
|
+
background: ${S};
|
|
274
273
|
opacity: ${A};
|
|
275
|
-
border: ${
|
|
276
|
-
border-opacity: ${
|
|
277
|
-
border-radius: ${
|
|
274
|
+
border: ${R}px solid ${M};
|
|
275
|
+
border-opacity: ${_};
|
|
276
|
+
border-radius: ${E}px;
|
|
278
277
|
display: block;
|
|
279
278
|
transform: translate(-50%, -50%);
|
|
280
279
|
opacity: 0;
|
|
@@ -284,80 +283,80 @@ Style guidelines: ${i.summary}`;this.promptInput.value=r,this.currentPrompt=r}}c
|
|
|
284
283
|
top: 50%;
|
|
285
284
|
z-index: 1000;
|
|
286
285
|
box-sizing: border-box;
|
|
287
|
-
padding: ${
|
|
288
|
-
`,i.appendChild(
|
|
289
|
-
font-family: ${
|
|
290
|
-
font-size: ${
|
|
291
|
-
font-weight: ${
|
|
292
|
-
color: ${
|
|
286
|
+
padding: ${m}px;
|
|
287
|
+
`,i.appendChild(L);let j=Me(L);j.element=L;let O=((oi=s==null?void 0:s.gameplay)==null?void 0:oi.tuning)||{},be=(s==null?void 0:s.transform)||{},q=(li=O.logo_size)!=null?li:56,Y=(ci=be.scale)!=null?ci:1,Pe=(pi=(di=be.offset)==null?void 0:di.y)!=null?pi:-130,lt=(ui=O.logo_alpha)!=null?ui:1,Ms=new Ue.SpriteMaterial({map:n||void 0,transparent:!0,alphaTest:.1}),K=new Ue.Sprite(Ms);K.position.set(0,Pe,0),K.material.opacity=0;let ct=0,dt=0;if(n){let $=n.image;ct=($==null?void 0:$.width)||100,dt=($==null?void 0:$.height)||100}if(ct>0&&dt>0){let $=ct/dt,Yt,Kt;$>1?(Yt=q,Kt=q/$):(Kt=q,Yt=q*$);let hr=Yt/ct*Y,fr=Kt/dt*Y;K.scale.set(hr,fr,1)}else{let $=q/100*Y;K.scale.set($,$,1)}K.targetAlpha=lt,K.baseScaleX=K.scale.x,K.baseScaleY=K.scale.y;let H=r==null?void 0:r.ui,te=((gi=r==null?void 0:r.gameplay)==null?void 0:gi.tuning)||{},Ps=(H==null?void 0:H.text)||"MISSION ACCOMPLISHED",Hn=(H==null?void 0:H.font)||"brand.heading",Nt=(H==null?void 0:H.fontSize)||24,ks=(hi=H==null?void 0:H.letterSpacing)!=null?hi:1,pt=(fi=r==null?void 0:r.render)==null?void 0:fi.tint,Rs=typeof pt=="string"?pt:pt?`#${pt.toString(16).padStart(6,"0")}`:"#00FF88",Os=y-m*2-30,Is=te.font_weight_override?te.font_weight_override:ee(Hn),ye=document.createElement("div");ye.textContent=Ps,ye.style.cssText=`
|
|
288
|
+
font-family: ${Q(Hn)};
|
|
289
|
+
font-size: ${Nt}px;
|
|
290
|
+
font-weight: ${Is};
|
|
291
|
+
color: ${Rs};
|
|
293
292
|
text-align: center;
|
|
294
|
-
letter-spacing: ${
|
|
295
|
-
-webkit-text-stroke: ${(
|
|
296
|
-
text-shadow: ${(
|
|
293
|
+
letter-spacing: ${ks}px;
|
|
294
|
+
-webkit-text-stroke: ${(mi=te.stroke_width)!=null?mi:2}px ${te.stroke_color||"#000000"};
|
|
295
|
+
text-shadow: ${(bi=te.shadow_distance)!=null?bi:4}px ${(yi=te.shadow_distance)!=null?yi:4}px ${(vi=te.shadow_blur)!=null?vi:8}px rgba(0,0,0,${(xi=te.shadow_alpha)!=null?xi:.9});
|
|
297
296
|
opacity: 0;
|
|
298
297
|
position: absolute;
|
|
299
298
|
transform: translate(-50%, -50%);
|
|
300
299
|
white-space: nowrap;
|
|
301
|
-
max-width: ${
|
|
302
|
-
`;let
|
|
303
|
-
font-family: ${
|
|
304
|
-
font-size: ${
|
|
305
|
-
font-weight: ${
|
|
306
|
-
color: ${
|
|
300
|
+
max-width: ${Os}px;
|
|
301
|
+
`;let zn=m+30,js=((wi=u.title_offset_y)!=null?wi:zn+Nt/2)+((Ei=te.animation_start_y_offset)!=null?Ei:-20);ye.style.top=`${js}px`,ye.style.left="50%";let Nn=Me(ye);Nn.element=ye,L.appendChild(ye);let z=o==null?void 0:o.ui,Fn=((Si=o==null?void 0:o.gameplay)==null?void 0:Si.tuning)||{},Ds=(z==null?void 0:z.text)||"RESCUE COMPLETE",Bn=(z==null?void 0:z.font)||"brand.body",Ft=(z==null?void 0:z.fontSize)||11,$s=(Ai=z==null?void 0:z.letterSpacing)!=null?Ai:.5,ut=(Ci=o==null?void 0:o.render)==null?void 0:Ci.tint,Hs=typeof ut=="string"?ut:ut?`#${ut.toString(16).padStart(6,"0")}`:"#B0B0B0",ve=document.createElement("div");ve.textContent=Ds,ve.style.cssText=`
|
|
302
|
+
font-family: ${Q(Bn)};
|
|
303
|
+
font-size: ${Ft}px;
|
|
304
|
+
font-weight: ${ee(Bn)};
|
|
305
|
+
color: ${Hs};
|
|
307
306
|
text-align: center;
|
|
308
|
-
letter-spacing: ${
|
|
307
|
+
letter-spacing: ${$s}px;
|
|
309
308
|
opacity: 0;
|
|
310
309
|
position: absolute;
|
|
311
310
|
transform: translate(-50%, -50%);
|
|
312
311
|
white-space: nowrap;
|
|
313
|
-
`;let
|
|
314
|
-
font-family: ${
|
|
315
|
-
font-size: ${
|
|
316
|
-
font-weight: ${
|
|
317
|
-
color: ${
|
|
312
|
+
`;let Gn=zn+Nt+15,zs=((Ti=u.subtitle_offset_y)!=null?Ti:Gn+Ft/2)+((_i=Fn.animation_start_y_offset)!=null?_i:-10);ve.style.top=`${zs}px`,ve.style.left="50%";let Bt=Me(ve);Bt.element=ve,Bt.animationStartYOffset=(Li=Fn.animation_start_y_offset)!=null?Li:-10,L.appendChild(ve);let ne=l==null?void 0:l.ui,Un=((Mi=l==null?void 0:l.gameplay)==null?void 0:Mi.tuning)||{},Ns=(ne==null?void 0:ne.text)||((Pi=g.ui)==null?void 0:Pi.cta_hint)||"Continue the adventure!",qn=(ne==null?void 0:ne.font)||"brand.body",Wn=(ne==null?void 0:ne.fontSize)||16,gt=(ki=l==null?void 0:l.render)==null?void 0:ki.tint,Fs=typeof gt=="string"?gt:gt?`#${gt.toString(16).padStart(6,"0")}`:"#FFFFFF",Bs=(Ri=Un.max_width)!=null?Ri:y-m*2,Gs=(Oi=Un.line_height)!=null?Oi:1.4,xe=document.createElement("div");xe.textContent=Ns,xe.style.cssText=`
|
|
313
|
+
font-family: ${Q(qn)};
|
|
314
|
+
font-size: ${Wn}px;
|
|
315
|
+
font-weight: ${ee(qn)};
|
|
316
|
+
color: ${Fs};
|
|
318
317
|
text-align: center;
|
|
319
318
|
opacity: 0;
|
|
320
319
|
position: absolute;
|
|
321
320
|
transform: translate(-50%, -50%);
|
|
322
|
-
max-width: ${
|
|
323
|
-
line-height: ${
|
|
321
|
+
max-width: ${Bs}px;
|
|
322
|
+
line-height: ${Gs};
|
|
324
323
|
word-wrap: break-word;
|
|
325
|
-
`;let
|
|
326
|
-
width: ${
|
|
327
|
-
height: ${
|
|
328
|
-
background: ${
|
|
329
|
-
opacity: ${
|
|
330
|
-
border: ${
|
|
331
|
-
border-radius: ${
|
|
324
|
+
`;let Us=Gn+Ft+30,qs=(Ii=u.footer_offset_y)!=null?Ii:Us+Wn/2;xe.style.top=`${qs}px`,xe.style.left="50%";let Gt=Me(xe);Gt.element=xe;let Ws=((ji=l==null?void 0:l.render)==null?void 0:ji.alpha)!==void 0&&((Di=l==null?void 0:l.render)==null?void 0:Di.alpha)!==null?l.render.alpha:1;Gt.targetAlpha=Ws,L.appendChild(xe);let ie=(($i=d==null?void 0:d.gameplay)==null?void 0:$i.tuning)||{},N=d==null?void 0:d.ui,Vs=(Hi=ie.button_width)!=null?Hi:260,Vn=(zi=ie.button_height)!=null?zi:56,Ys=(Ni=ie.button_radius)!=null?Ni:16,Ks=ie.button_bg_color||((Fi=g.theme)==null?void 0:Fi.cta_background)||"#ffb43b",Xs=(Bi=ie.button_bg_alpha)!=null?Bi:1,Js=ie.button_border_color||"#ffffff",Zs=(Gi=ie.button_border_width)!=null?Gi:2,Qo=(Ui=ie.button_border_alpha)!=null?Ui:.2,Ut=(qi=u.cta_offset_y)!=null?qi:f*.7,I=document.createElement("button");I.style.cssText=`
|
|
325
|
+
width: ${Vs}px;
|
|
326
|
+
height: ${Vn}px;
|
|
327
|
+
background: ${Ks};
|
|
328
|
+
opacity: ${Xs};
|
|
329
|
+
border: ${Zs}px solid ${Js};
|
|
330
|
+
border-radius: ${Ys}px;
|
|
332
331
|
cursor: pointer;
|
|
333
332
|
opacity: 0;
|
|
334
333
|
position: absolute;
|
|
335
334
|
transform: translate(-50%, -50%);
|
|
336
335
|
box-shadow: inset 0 0 1px rgba(0,0,0,0.15);
|
|
337
|
-
`,
|
|
338
|
-
font-family: ${
|
|
339
|
-
font-size: ${
|
|
340
|
-
font-weight: ${
|
|
341
|
-
color: ${
|
|
336
|
+
`,I.style.top=`${Ut}px`,I.style.left="50%";let qt=Me(I);qt.element=I,qt.addEventListener=I.addEventListener.bind(I),L.appendChild(I);let Qs=(N==null?void 0:N.text)||((Wi=g.ui)==null?void 0:Wi.cta_label_end)||"DOWNLOAD",Yn=(N==null?void 0:N.font)||"brand.heading",er=(N==null?void 0:N.fontSize)||20,tr=ie.button_text_color||((Vi=g.theme)==null?void 0:Vi.cta_text)||"#1a0a0a";I.textContent=Qs,I.style.fontFamily=Q(Yn),I.style.fontSize=`${er}px`,I.style.fontWeight=String(ee(Yn)),I.style.color=tr,I.style.letterSpacing=`${(Yi=N==null?void 0:N.letterSpacing)!=null?Yi:1}px`;let Kn=Me(I);Kn.element=I;let F=p==null?void 0:p.ui,Xn=((Ki=p==null?void 0:p.gameplay)==null?void 0:Ki.tuning)||{},nr=(F==null?void 0:F.text)||"Play the full game",Jn=(F==null?void 0:F.font)||"brand.body",ir=(F==null?void 0:F.fontSize)||11,ar=(Xi=F==null?void 0:F.letterSpacing)!=null?Xi:0,ht=(Ji=p==null?void 0:p.render)==null?void 0:Ji.tint,sr=typeof ht=="string"?ht:ht?`#${ht.toString(16).padStart(6,"0")}`:"#CCCCCC",we=document.createElement("div");we.textContent=nr,we.style.cssText=`
|
|
337
|
+
font-family: ${Q(Jn)};
|
|
338
|
+
font-size: ${ir}px;
|
|
339
|
+
font-weight: ${ee(Jn)};
|
|
340
|
+
color: ${sr};
|
|
342
341
|
text-align: center;
|
|
343
|
-
letter-spacing: ${
|
|
342
|
+
letter-spacing: ${ar}px;
|
|
344
343
|
opacity: 0;
|
|
345
344
|
position: absolute;
|
|
346
345
|
transform: translate(-50%, -50%);
|
|
347
346
|
white-space: nowrap;
|
|
348
|
-
`;let
|
|
349
|
-
font-family: ${
|
|
350
|
-
font-size: ${
|
|
351
|
-
font-weight: ${
|
|
352
|
-
color: ${
|
|
353
|
-
text-align: ${
|
|
354
|
-
letter-spacing: ${
|
|
355
|
-
text-shadow: ${(
|
|
356
|
-
-webkit-text-stroke: ${
|
|
357
|
-
opacity: ${(
|
|
347
|
+
`;let rr=Ut+Vn/2+20,or=f-m-10,lr=Math.min(rr+((Zi=Xn.animation_start_y_offset)!=null?Zi:5),or);we.style.top=`${lr}px`,we.style.left="50%";let Wt=Me(we);Wt.element=we,Wt.animationStartYOffset=(Qi=Xn.animation_start_y_offset)!=null?Qi:5,L.appendChild(we);let Vt=((ea=c==null?void 0:c.gameplay)==null?void 0:ea.tuning)||{},cr=(ta=Vt.hand_offset_x)!=null?ta:50,dr=(na=Vt.hand_offset_y)!=null?na:50,pr=(aa=(ia=c==null?void 0:c.transform)==null?void 0:ia.scale)!=null?aa:.1875,ur=(sa=Vt.hand_scale_multiplier)!=null?sa:2.5,gr=new Ue.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),We=new Ue.Sprite(gr),Zn=pr*ur*100;return We.scale.set(Zn,Zn,1),We.position.set(cr,Ut+dr,0),We.material.opacity=0,We.visible=!1,{panel:j,logo:K,title:Nn,subtitle:Bt,footer:Gt,ctaButton:qt,ctaText:Kn,ctaHint:Wt,hand:We}}function xs(t,e,n){var S,A,M,R,_,L,j,O;let i=e.objects.get("ui_endgame_1"),a=((S=i==null?void 0:i.gameplay)==null?void 0:S.tuning)||{},s=(A=a.animation_duration_ms)!=null?A:800,r=(M=a.fade_in_duration_ms)!=null?M:600,o=(R=a.scale_animation_intensity)!=null?R:.1,l=(_=a.logo_animation_delay_ms)!=null?_:100,d=(L=a.title_animation_delay_ms)!=null?L:200,p=(j=a.footer_animation_delay_ms)!=null?j:300,c=(O=a.cta_animation_delay_ms)!=null?O:400,{panel:g,logo:u,title:b,subtitle:h,footer:x,ctaButton:v,ctaText:y,ctaHint:f}=t;g.visible=!0,g.element.style.visibility="visible";let m=Date.now(),E=()=>{let be=Date.now()-m,q=Math.min(be/r,1),Y=1-Math.pow(1-q,3);g.alpha=Y,g.element.style.opacity=Y.toString();let Pe=1+o*(1-Y);g.element.style.transform=`translate(-50%, -50%) scale(${Pe})`,q<1?requestAnimationFrame(E):(setTimeout(()=>Uo(u,s,e),l),setTimeout(()=>{qo(b,s),setTimeout(()=>Wo(h,s),50)},d),setTimeout(()=>Vo(x,s),p),setTimeout(()=>{Yo(v,y,s),setTimeout(()=>Ko(f,s),50),n&&n()},c))};E()}function Uo(t,e,n){var g,u,b,h,x;let i=n==null?void 0:n.objects.get("ui_endgame_logo_1"),s=(u=(((g=i==null?void 0:i.gameplay)==null?void 0:g.tuning)||{}).animation_start_scale)!=null?u:1.2,r=Date.now(),o=t.material.opacity,l=(b=t.targetAlpha)!=null?b:1,d=(h=t.baseScaleX)!=null?h:t.scale.x,p=(x=t.baseScaleY)!=null?x:t.scale.y,c=()=>{let v=Date.now()-r,y=Math.min(v/e,1),f=1-Math.pow(1-y,2);t.material.opacity=o+(l-o)*f;let m=s+(1-s)*f;t.scale.set(d*m,p*m,1),y<1&&requestAnimationFrame(c)};c()}function qo(t,e){let n=Date.now(),i=parseFloat(t.element.style.opacity||"0"),a=parseFloat(t.element.style.top||"0"),s=()=>{let r=Date.now()-n,o=Math.min(r/e,1),l=1-Math.pow(1-o,2);t.element.style.opacity=(i+(1-i)*l).toString(),t.element.style.top=`${a-20*(1-l)}px`,o<1&&requestAnimationFrame(s)};s()}function Wo(t,e){var o;let n=Date.now(),i=parseFloat(t.element.style.opacity||"0"),a=parseFloat(t.element.style.top||"0"),s=a-((o=t.animationStartYOffset)!=null?o:-10),r=()=>{let l=Date.now()-n,d=Math.min(l/e,1),p=1-Math.pow(1-d,2);t.element.style.opacity=(i+(1-i)*p).toString(),t.element.style.top=`${a+(s-a)*p}px`,d<1&&requestAnimationFrame(r)};r()}function Vo(t,e){var r;let n=Date.now(),i=parseFloat(t.element.style.opacity||"0"),a=(r=t.targetAlpha)!=null?r:1,s=()=>{let o=Date.now()-n,l=Math.min(o/e,1),d=1-Math.pow(1-l,2);t.element.style.opacity=(i+(a-i)*d).toString(),l<1&&requestAnimationFrame(s)};s()}function Yo(t,e,n){let i=Date.now(),a=parseFloat(t.element.style.opacity||"0"),s=()=>{let r=Date.now()-i,o=Math.min(r/n,1),l=1-Math.pow(1-o,2);t.element.style.opacity=(a+(1-a)*l).toString(),e.element.style.opacity=(a+(1-a)*l).toString(),t.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-l)})`,o<1&&requestAnimationFrame(s)};s()}function Ko(t,e){var o;let n=Date.now(),i=parseFloat(t.element.style.opacity||"0"),a=parseFloat(t.element.style.top||"0"),s=a-((o=t.animationStartYOffset)!=null?o:5),r=()=>{let l=Date.now()-n,d=Math.min(l/e,1),p=1-Math.pow(1-d,2);t.element.style.opacity=(i+(1-i)*p).toString(),t.element.style.top=`${a+(s-a)*p}px`,d<1&&requestAnimationFrame(r)};r()}function ws(t,e,n,i){var p,c,g,u;let a=n.objects.get("ui_endgame_hand_1"),s=((p=a==null?void 0:a.gameplay)==null?void 0:p.tuning)||{},r=(c=s.click_animation_duration_ms)!=null?c:600,o=(g=s.click_delay_ms)!=null?g:2e3,l=(u=s.click_repeat_delay_ms)!=null?u:3e3,d=()=>{var A,M;t.visible=!0,t.material.opacity=1;let b=t.position.x,h=t.position.y,x=(A=s.hand_offset_x)!=null?A:50,v=(M=s.hand_offset_y)!=null?M:50,y=e.element.getBoundingClientRect(),f=x,m=v,E=Date.now(),S=()=>{var Y,Pe,lt;let R=Date.now()-E,_=Math.min(R/r,1),L=_<.5?2*_*_:1-Math.pow(-2*_+2,2)/2;t.position.set(b+(f-b)*L,h+(m-h)*L,0);let j=(Pe=(Y=a==null?void 0:a.transform)==null?void 0:Y.scale)!=null?Pe:.1875,O=(lt=s.hand_scale_multiplier)!=null?lt:2.5,be=j*O*100,q=be+be*.2*Math.sin(_*Math.PI);t.scale.set(q,q,1),_<1?requestAnimationFrame(S):(e.element.style.transform="translate(-50%, -50%) scale(0.95)",setTimeout(()=>{e.element.style.transform="translate(-50%, -50%) scale(1)",i()},100),setTimeout(()=>{t.material.opacity=0,setTimeout(()=>{t.position.set(b,h,0),d()},l)},500))};S()};setTimeout(d,o)}var zt=ae(require("three"),1);function Es(t,e,n){var u,b,h,x,v,y,f;let i=e.objects.get("hand_tutorial_1"),a=((u=i==null?void 0:i.gameplay)==null?void 0:u.tuning)||{},s=(i==null?void 0:i.render)||{},r=(i==null?void 0:i.transform)||{},o=new zt.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),l=new zt.Sprite(o),d=r.position||{},p=(b=d==null?void 0:d.z)!=null?b:0;l.position.set(n.x+((h=d==null?void 0:d.x)!=null?h:0),n.y+((x=d==null?void 0:d.y)!=null?x:0),p),l.material.opacity=s.alpha!==void 0&&s.alpha!==null?s.alpha:0,l.visible=s.visible!==void 0&&s.visible!==null?s.visible:!1;let c=(v=a.hand_scale_multiplier)!=null?v:2.5,g=(y=r.scale)!=null?y:.1875;return l.scale.set(g*c*100,g*c*100,1),l.renderOrder=(f=s.z_index)!=null?f:99999,l}function Ss(t){var b,h,x,v,y,f,m,E,S;let e=t.objects.get("ui_tutorial_1"),n=e==null?void 0:e.ui,i=(e==null?void 0:e.render)||{},a=((b=t.engine.runtime)==null?void 0:b.ui_styles)||{},s=((h=t.engine.runtime)==null?void 0:h.ui)||{},r=(n==null?void 0:n.text)||s.tutorial_label||s.label_text||"CLEAN!",o=(n==null?void 0:n.font)||"brand.warning",l=(n==null?void 0:n.fontSize)||a.label_font_size||52,d=(v=n==null?void 0:n.letterSpacing)!=null?v:(x=a.label_letter_spacing)!=null?x:-1,p=(n==null?void 0:n.align)||"center",c=i.tint,g=typeof c=="string"?c:c?`#${c.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",u=document.createElement("div");return u.textContent=r,u.style.cssText=`
|
|
348
|
+
font-family: ${Q(o)};
|
|
349
|
+
font-size: ${l}px;
|
|
350
|
+
font-weight: ${ee(o)};
|
|
351
|
+
color: ${g};
|
|
352
|
+
text-align: ${p};
|
|
353
|
+
letter-spacing: ${d}px;
|
|
354
|
+
text-shadow: ${(y=a.label_shadow_distance)!=null?y:2}px ${(f=a.label_shadow_distance)!=null?f:2}px ${(m=a.label_shadow_blur)!=null?m:4}px rgba(0,0,0,${(E=a.label_shadow_alpha)!=null?E:.8});
|
|
355
|
+
-webkit-text-stroke: ${a.label_stroke||"#8B0000"} 2px;
|
|
356
|
+
opacity: ${(S=i.alpha)!=null?S:0};
|
|
358
357
|
visibility: ${i.visible!==!1?"visible":"hidden"};
|
|
359
358
|
pointer-events: none;
|
|
360
359
|
position: absolute;
|
|
361
360
|
transform: translate(-50%, -50%);
|
|
362
361
|
white-space: nowrap;
|
|
363
|
-
`,u}function
|
|
362
|
+
`,u}function As(t,e,n,i,a){var l,d,p,c,g,u,b;let s=a.objects.get("hand_tutorial_1"),r=((l=s==null?void 0:s.gameplay)==null?void 0:l.tuning)||{},o=(s==null?void 0:s.transform)||{};if(!i){let h=(d=r.animation_duration)!=null?d:1.5,x=n%h/h,v=x<.5?2*x*x:-1+(4-2*x)*x,y=(p=r.x_offset)!=null?p:0,f=(c=r.y_offset)!=null?c:0,m=(g=r.animation_range)!=null?g:40,E=m*.7,S=m,A=e.x+y+E,M=e.y+f+S,R=A+E,_=M+S;t.position.set(A+(R-A)*v,M+(_-M)*v,0);let L=(u=o.scale)!=null?u:.1875,j=(b=r.hand_scale_multiplier)!=null?b:2.5,O=L*j*100;t.scale.set(O,O,1)}}var qe=ae(require("three"),1),Cs=new qe.TextureLoader,jn=null,Dn=null;async function Ts(){if(jn)return jn;if(!Dn){let n=(()=>{if(typeof window!="undefined")try{return new URL("inline-assets.js",window.location.href).href}catch{return"./inline-assets.js"}return"./inline-assets.js"})();Dn=fetch(n).then(i=>{if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.text()}).then(i=>{let a=i.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(a)return new Function("return "+a[1])();throw new Error("INLINE_ASSETS export not found")}).then(i=>i?i.INLINE_ASSETS?i.INLINE_ASSETS:(console.warn("[assets] Module does not have INLINE_ASSETS export. Module keys:",Object.keys(i)),{}):(console.warn("[assets] Module import returned undefined"),{})).catch(i=>(console.warn("[assets] Failed to load inline-assets.js:",i),{}))}let t=await Dn;return jn=t||{},t||{}}async function $n(t,e,n=16777215,i=!1){try{let s=(await Ts())[t];return await Cs.loadAsync(s||t)}catch{console.warn(`Asset missing: ${t}. Using placeholder.`);let s=document.createElement("canvas");s.width=64,s.height=64;let r=s.getContext("2d");return r&&(r.fillStyle=`#${n.toString(16).padStart(6,"0")}`,i?r.fillRect(0,0,30,60):(r.beginPath(),r.arc(32,32,30,0,Math.PI*2),r.fill(),r.fillRect(27,32,10,40))),new qe.CanvasTexture(s)}}async function _s(t,e,n){var h,x;let a=(await Ts())[t]||t,s;try{s=await Cs.loadAsync(a),console.log("[character] loaded sheet",{path:t,sourceUsed:a})}catch(v){let m=((n.gameplay.character_sheet||{}).fallback_color||"#ff00ff").replace("#","");s=await $n(t,e,parseInt(m,16),!0),console.warn("[character] fallback loadAsset used",{path:t,err:v})}if(!s)return[];let r=n.gameplay.character_sheet||{},o=(h=r.cols)!=null?h:3,l=(x=r.rows)!=null?x:2,d=s.image,p=(d==null?void 0:d.width)||0,c=(d==null?void 0:d.height)||0,g=p/o,u=c/l;if(!Number.isFinite(g)||!Number.isFinite(u)||g<=0||u<=0)return[s];let b=[];for(let v=0;v<l;v++)for(let y=0;y<o;y++){let f=document.createElement("canvas");f.width=g,f.height=u;let m=f.getContext("2d");m&&d&&m.drawImage(d,y*g,v*u,g,u,0,0,g,u),b.push(new qe.CanvasTexture(f))}return b.length>2&&b.push(...b.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:b.length}),b}function Ls(t,e){var c,g,u,b;let n=e.gameplay.brush||{},i=e.theme.brush_color||"#ffffff",a=(c=n.radius)!=null?c:20,s=(g=n.inner_radius)!=null?g:15,r=(u=n.alpha)!=null?u:.8,o=(b=n.inner_alpha)!=null?b:.3,l=n.inner_color||"#ffffff",d=document.createElement("canvas");d.width=a*2,d.height=a*2;let p=d.getContext("2d");return p&&(p.clearRect(0,0,d.width,d.height),p.beginPath(),p.arc(a,a,a,0,Math.PI*2),p.fillStyle=i,p.globalAlpha=r,p.fill(),p.beginPath(),p.arc(a,a,s,0,Math.PI*2),p.fillStyle=l,p.globalAlpha=o,p.fill()),new qe.CanvasTexture(d)}0&&(module.exports={AspectClass,GameObject,GameObjectManager,Renderer,ResponsiveUISystem,Transform,animateHandClick,animatePanelEntrance,createBrushTexture,createEndGamePanel,createHandTutorial,createThreeBase,createTutorialLabel,getAspectClass,getRegisteredFontIds,loadAsset,loadCharacterFrames,registerFont,resolveFont,resolveFontWeight,updateHandAnimation});
|