@thorvg/lottie-player
Version:
A web lottie player using ThorVG as a renderer
1 lines • 99.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["lottie-player"]={})}(this,function(e){"use strict";var t="undefined"!=typeof document?document.currentScript:null;const r=globalThis,n=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;let o=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&a.set(t,e))}return e}toString(){return this.cssText}};const s=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:c,defineProperty:d,getOwnPropertyDescriptor:l,getOwnPropertyNames:u,getOwnPropertySymbols:h,getPrototypeOf:f}=Object,p=globalThis,m=p.trustedTypes,v=m?m.emptyScript:"",g=p.reactiveElementPolyfillSupport,w=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},b=(e,t)=>!c(e,t),_={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:b};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let $=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&d(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){const{get:n,set:i}=l(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:n,set(t){const a=n?.call(this);i?.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(w("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(w("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(w("properties"))){const e=this.properties,t=[...u(e),...h(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(s(e))}else void 0!==e&&t.push(s(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(n)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const n of t){const t=document.createElement("style"),i=r.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:y).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){const r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=n;const a=i.fromAttribute(t,e.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(e,t,r,n=!1,i){if(void 0!==e){const a=this.constructor;if(!1===n&&(i=this[e]),r??=a.getPropertyOptions(e),!((r.hasChanged??b)(i,t)||r.useDefault&&r.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:n,wrapped:i},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===n&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,r]of e){const{wrapped:e}=r,n=this[t];!0!==e||this._$AL.has(t)||void 0===n||this.C(t,void 0,r,n)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[w("elementProperties")]=new Map,$[w("finalized")]=new Map,g?.({ReactiveElement:$}),(p.reactiveElementVersions??=[]).push("2.1.2");const E={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:b},x=(e=E,t,r)=>{const{kind:n,metadata:i}=r;let a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),"setter"===n&&((e=Object.create(e)).wrapped=!0),a.set(r.name,e),"accessor"===n){const{name:n}=r;return{set(r){const i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e,!0,r)},init(t){return void 0!==t&&this.C(n,void 0,e,t),t}}}if("setter"===n){const{name:n}=r;return function(r){const i=this[n];t.call(this,r),this.requestUpdate(n,i,e,!0,r)}}throw Error("Unsupported decorator location: "+n)};function A(e){return(t,r)=>"object"==typeof r?x(e,t,r):((e,t,r)=>{const n=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}const S=globalThis,T=e=>e,k=S.trustedTypes,P=k?k.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,O="?"+R,U=`<${O}>`,L=document,B=()=>L.createComment(""),F=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,M="[ \t\n\f\r]",G=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,N=/>/g,V=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,z=/"/g,W=/^(?:script|style|textarea|title)$/i,q=(e,...t)=>({_$litType$:1,strings:e,values:t}),H=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),J=new WeakMap,K=L.createTreeWalker(L,129);function Q(e,t){if(!D(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(t):t}const Y=(e,t)=>{const r=e.length-1,n=[];let i,a=2===t?"<svg>":3===t?"<math>":"",o=G;for(let t=0;t<r;t++){const r=e[t];let s,c,d=-1,l=0;for(;l<r.length&&(o.lastIndex=l,c=o.exec(r),null!==c);)l=o.lastIndex,o===G?"!--"===c[1]?o=I:void 0!==c[1]?o=N:void 0!==c[2]?(W.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=V):void 0!==c[3]&&(o=V):o===V?">"===c[0]?(o=i??G,d=-1):void 0===c[1]?d=-2:(d=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?V:'"'===c[3]?z:j):o===z||o===j?o=V:o===I||o===N?o=G:(o=V,i=void 0);const u=o===V&&e[t+1].startsWith("/>")?" ":"";a+=o===G?r+U:d>=0?(n.push(s),r.slice(0,d)+C+r.slice(d)+R+u):r+R+(-2===d?t:u)}return[Q(e,a+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),n]};class Z{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let i=0,a=0;const o=e.length-1,s=this.parts,[c,d]=Y(e,t);if(this.el=Z.createElement(c,r),K.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=K.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(C)){const t=d[a++],r=n.getAttribute(e).split(R),o=/([.?@])?(.*)/.exec(t);s.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?ie:"?"===o[1]?ae:"@"===o[1]?oe:ne}),n.removeAttribute(e)}else e.startsWith(R)&&(s.push({type:6,index:i}),n.removeAttribute(e));if(W.test(n.tagName)){const e=n.textContent.split(R),t=e.length-1;if(t>0){n.textContent=k?k.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],B()),K.nextNode(),s.push({type:2,index:++i});n.append(e[t],B())}}}else if(8===n.nodeType)if(n.data===O)s.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(R,e+1));)s.push({type:7,index:i}),e+=R.length-1}i++}}static createElement(e,t){const r=L.createElement("template");return r.innerHTML=e,r}}function ee(e,t,r=e,n){if(t===H)return t;let i=void 0!==n?r._$Co?.[n]:r._$Cl;const a=F(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0!==n?(r._$Co??=[])[n]=i:r._$Cl=i),void 0!==i&&(t=ee(e,i._$AS(e,t.values),i,n)),t}class te{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??L).importNode(t,!0);K.currentNode=n;let i=K.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new re(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new se(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=K.nextNode(),a++)}return K.currentNode=L,n}p(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class re{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ee(this,e,t),F(e)?e===X||null==e||""===e?(this._$AH!==X&&this._$AR(),this._$AH=X):e!==this._$AH&&e!==H&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>D(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==X&&F(this._$AH)?this._$AA.nextSibling.data=e:this.T(L.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Z.createElement(Q(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{const e=new te(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=J.get(e.strings);return void 0===t&&J.set(e.strings,t=new Z(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,n=0;for(const i of e)n===t.length?t.push(r=new re(this.O(B()),this.O(B()),this,this.options)):r=t[n],r._$AI(i),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=T(e).nextSibling;T(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ne{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=X}_$AI(e,t=this,r,n){const i=this.strings;let a=!1;if(void 0===i)e=ee(this,e,t,0),a=!F(e)||e!==this._$AH&&e!==H,a&&(this._$AH=e);else{const n=e;let o,s;for(e=i[0],o=0;o<i.length-1;o++)s=ee(this,n[r+o],t,o),s===H&&(s=this._$AH[o]),a||=!F(s)||s!==this._$AH[o],s===X?e=X:e!==X&&(e+=(s??"")+i[o+1]),this._$AH[o]=s}a&&!n&&this.j(e)}j(e){e===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ie extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===X?void 0:e}}class ae extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==X)}}class oe extends ne{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=ee(this,e,t,0)??X)===H)return;const r=this._$AH,n=e===X&&r!==X||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==X&&(r===X||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class se{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){ee(this,e)}}const ce=S.litHtmlPolyfillSupport;ce?.(Z,re),(S.litHtmlVersions??=[]).push("3.3.2");const de=globalThis;class le extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{const n=r?.renderBefore??t;let i=n._$litPart$;if(void 0===i){const e=r?.renderBefore??null;n._$litPart$=i=new re(t.insertBefore(B(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return H}}le._$litElement$=!0,le.finalized=!0,de.litElementHydrateSupport?.({LitElement:le});const ue=de.litElementPolyfillSupport;function he(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}ue?.({LitElement:le}),(de.litElementVersions??=[]).push("4.2.2");let fe=null,pe=!1;var me=function(e){return e.SW="sw",e.WG="wg",e.GL="gl",e}({}),ve=function(e){return e.JSON="json",e.LOT="lot",e.JPG="jpg",e.PNG="png",e.SVG="svg",e}({});const ge=async(e,t)=>{const r=new TextEncoder;let n=e;switch(typeof n){case"object":return n instanceof ArrayBuffer?new Uint8Array(n):(n=JSON.stringify(n),r.encode(n));case"string":{if("json"===t||"lot"===t)return n=await(async e=>{try{e=JSON.parse(e)}catch(t){const r=await(async e=>{if("string"!=typeof e)throw new Error("The url value must be a string");try{const t=new URL(e),r=await fetch(t.toString());return await r.json()}catch(e){throw new Error("An error occurred while trying to load the Lottie file from URL")}})(e);e=JSON.stringify(r)}return e})(n),r.encode(n);const e=await(async e=>(await fetch(e)).arrayBuffer())(n);return new Uint8Array(e)}default:throw new Error("Invalid src type")}},we=e=>new Promise(t=>setTimeout(t,e));let ye="idle";class be extends le{src;wasmUrl;fileType="json";speed=1;autoPlay=!1;count;loop=!1;direction=1;mode="normal";intermission=1;totalFrame=0;currentFrame=0;currentState="loading";get size(){return Float32Array.from(this.TVG?.size()||[0,0])}get dpr(){return!1===this.config?.enableDevicePixelRatio?1:1+.75*(window.devicePixelRatio-1)}TVG=null;canvas;config;_imageData;_beginTime=Date.now();_counter=1;_timer;_observer;_observable=!1;_assetResolverCallback;_assetResolverData;async _init(){if(pe)for(;!fe;)await we(100);if(fe||(pe=!0,fe=await async function(e={}){var r,n=e,i=!!globalThis.window,a=!!globalThis.WorkerGlobalScope,o=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(o){const{createRequire:e}=await Promise.resolve().then(function(){return xe});var s=e("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("lottie-player.js",document.baseURI).href)}var c,d,l=(e,t)=>{throw t},u="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("lottie-player.js",document.baseURI).href,h="";if(o){var f=s("fs");u.startsWith("file:")&&(h=s("path").dirname(s("url").fileURLToPath(u))+"/"),d=e=>(e=O(e)?new URL(e):e,f.readFileSync(e)),c=async e=>(e=O(e)?new URL(e):e,f.readFileSync(e,void 0)),process.argv.slice(2),l=(e,t)=>{throw process.exitCode=e,t}}else if(i||a){try{h=new URL(".",u).href}catch{}a&&(d=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),c=async e=>{if(O(e))return new Promise((t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r(n.status)},n.onerror=r,n.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw Error(t.status+" : "+t.url)}}var p,m,v,g,w,y,b,_,$,E,x,A,S,T,k,P=function(){}.bind(),C=function(){}.bind(),R=!1,O=e=>e.startsWith("file://"),U=!1;function L(){var e=Mn.buffer;w=new Int8Array(e),b=new Int16Array(e),y=new Uint8Array(e),_=new Uint16Array(e),$=new Int32Array(e),E=new Uint32Array(e),x=new Float32Array(e),A=new Float64Array(e),S=new BigInt64Array(e),T=new BigUint64Array(e)}function B(e){throw n.onAbort?.(e),C(e="Aborted("+e+")"),R=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),g?.(e),e}class F{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var D=e=>{for(;0<e.length;)e.shift()(n)},M=[],G=[],I=()=>{var e=n.preRun.shift();G.push(e)},N=!0,V=new TextDecoder,j=(e,t,r,n)=>{if(r=t+r,n)return r;for(;e[t]&&!(t>=r);)++t;return t},z=(e,t,r)=>e?V.decode(y.subarray(e,j(y,e,t,r))):"",W=()=>{var e=$[+je>>2];return je+=4,e},q=(e,t)=>{for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},H=e=>{var t="/"===e.charAt(0),r="/"===e.slice(-1);return(e=q(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},X=e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&=t.slice(0,-1),e+t):"."},J=e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],K=e=>{(K=(()=>{if(o){var e=s("crypto");return t=>e.randomFillSync(t)}return e=>crypto.getRandomValues(e)})())(e)},Q=(...e)=>{for(var t="",r=!1,n=e.length-1;-1<=n&&!r;n--){if("string"!=typeof(r=0<=n?e[n]:Ve.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";t=r+"/"+t,r="/"===r.charAt(0)}return t=q(t.split("/").filter(e=>!!e),!r).join("/"),(r?"/":"")+t||"."},Y=(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;0<=r&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=Q(e).slice(1),t=Q(t).slice(1),e=r(e.split("/")),t=r(t.split("/"));for(var n=Math.min(e.length,t.length),i=n,a=0;a<n;a++)if(e[a]!==t[a]){i=a;break}for(n=[],a=i;a<e.length;a++)n.push("..");return(n=n.concat(t.slice(i))).join("/")},Z=e=>{var t=j(e,0);return V.decode(e.buffer?e.subarray(0,t):new Uint8Array(e.slice(0,t)))},ee=[],te=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);127>=n?t++:2047>=n?t+=2:55296<=n&&57343>=n?(t+=4,++r):t+=3}return t},re=(e,t,r,n)=>{if(!(0<n))return 0;var i=r;n=r+n-1;for(var a=0;a<e.length;++a){var o=e.codePointAt(a);if(127>=o){if(r>=n)break;t[r++]=o}else if(2047>=o){if(r+1>=n)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(65535>=o){if(r+2>=n)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=n)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o,a++}}return t[r]=0,r-i},ne=e=>{var t=Array(te(e)+1);return e=re(e,t,0,t.length),t.length=e,t},ie=[];function ae(e,t){ie[e]={input:[],output:[],Vc:t},we(e,oe)}var oe={open(e){var t=ie[e.node.rdev];if(!t)throw new Ve.cc(43);e.tty=t,e.seekable=!1},close(e){e.tty.Vc.fsync(e.tty)},fsync(e){e.tty.Vc.fsync(e.tty)},read(e,t,r,n){if(!e.tty||!e.tty.Vc.$d)throw new Ve.cc(60);for(var i=0,a=0;a<n;a++){try{var o=e.tty.Vc.$d(e.tty)}catch(e){throw new Ve.cc(29)}if(void 0===o&&0===i)throw new Ve.cc(6);if(null==o)break;i++,t[r+a]=o}return i&&(e.node.atime=Date.now()),i},write(e,t,r,n){if(!e.tty||!e.tty.Vc.Pd)throw new Ve.cc(60);try{for(var i=0;i<n;i++)e.tty.Vc.Pd(e.tty,t[r+i])}catch(e){throw new Ve.cc(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),i}},se={$d(){e:{if(!ee.length){var e=null;if(o){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=f.readSync(n,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}0<r&&(e=t.slice(0,r).toString("utf-8"))}else globalThis.window?.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e){e=null;break e}ee=ne(e)}e=ee.shift()}return e},Pd(e,t){null===t||10===t?(P(Z(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(P(Z(e.output)),e.output=[])},Ge:()=>({$e:25856,bf:5,Ze:191,af:35387,Ye:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),He:()=>0,Ie:()=>[24,80]},ce={Pd(e,t){null===t||10===t?(C(Z(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(C(Z(e.output)),e.output=[])}},de={Sc:null,rc:()=>de.createNode(null,"/",16895,0),createNode(e,t,r,n){if(24576==(61440&r)||Ve.isFIFO(r))throw new Ve.cc(63);return de.Sc||(de.Sc={dir:{node:{Pc:de.fc.Pc,Rc:de.fc.Rc,lookup:de.fc.lookup,Tc:de.fc.Tc,rename:de.fc.rename,unlink:de.fc.unlink,rmdir:de.fc.rmdir,readdir:de.fc.readdir,symlink:de.fc.symlink},stream:{Ic:de.hc.Ic}},file:{node:{Pc:de.fc.Pc,Rc:de.fc.Rc},stream:{Ic:de.hc.Ic,read:de.hc.read,write:de.hc.write,gd:de.hc.gd,od:de.hc.od}},link:{node:{Pc:de.fc.Pc,Rc:de.fc.Rc,readlink:de.fc.readlink},stream:{}},Sd:{node:{Pc:de.fc.Pc,Rc:de.fc.Rc},stream:Ve.te}}),ye((r=Ve.createNode(e,t,r,n)).mode)?(r.fc=de.Sc.dir.node,r.hc=de.Sc.dir.stream,r.oc={}):Ve.isFile(r.mode)?(r.fc=de.Sc.file.node,r.hc=de.Sc.file.stream,r.Dc=0,r.oc=null):40960==(61440&r.mode)?(r.fc=de.Sc.link.node,r.hc=de.Sc.link.stream):8192==(61440&r.mode)&&(r.fc=de.Sc.Sd.node,r.hc=de.Sc.Sd.stream),r.atime=r.mtime=r.ctime=Date.now(),e&&(e.oc[t]=r,e.atime=e.mtime=e.ctime=r.atime),r},pf:e=>e.oc?e.oc.subarray?e.oc.subarray(0,e.Dc):new Uint8Array(e.oc):new Uint8Array(0),fc:{Pc(e){var t={};return t.dev=8192==(61440&e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=ye(e.mode)?4096:Ve.isFile(e.mode)?e.Dc:40960==(61440&e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},Rc(e,t){for(var r of["mode","atime","mtime","ctime"])null!=t[r]&&(e[r]=t[r]);void 0!==t.size&&e.Dc!=(t=t.size)&&(0==t?(e.oc=null,e.Dc=0):(r=e.oc,e.oc=new Uint8Array(t),r&&e.oc.set(r.subarray(0,Math.min(t,e.Dc))),e.Dc=t))},lookup(){throw de.Fd||(de.Fd=new Ve.cc(44),de.Fd.stack="<generic error, no stack>"),de.Fd},Tc:(e,t,r,n)=>de.createNode(e,t,r,n),rename(e,t,r){try{var n=be(t,r)}catch(e){}if(n){if(ye(e.mode))for(var i in n.oc)throw new Ve.cc(55);_e(n)}delete e.parent.oc[e.name],t.oc[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.oc[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r,n=be(e,t);for(r in n.oc)throw new Ve.cc(55);delete e.oc[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.oc)],symlink:(e,t,r)=>((e=de.createNode(e,t,41471,0)).link=r,e),readlink(e){if(40960!=(61440&e.mode))throw new Ve.cc(28);return e.link}},hc:{read(e,t,r,n,i){var a=e.node.oc;if(i>=e.node.Dc)return 0;if(8<(e=Math.min(e.node.Dc-i,n))&&a.subarray)t.set(a.subarray(i,i+e),r);else for(n=0;n<e;n++)t[r+n]=a[i+n];return e},write(e,t,r,n,i,a){if(t.buffer===w.buffer&&(a=!1),!n)return 0;if((e=e.node).mtime=e.ctime=Date.now(),t.subarray&&(!e.oc||e.oc.subarray)){if(a)return e.oc=t.subarray(r,r+n),e.Dc=n;if(0===e.Dc&&0===i)return e.oc=t.slice(r,r+n),e.Dc=n;if(i+n<=e.Dc)return e.oc.set(t.subarray(r,r+n),i),n}var o=e.oc?e.oc.length:0;if(o>=(a=i+n)||(a=Math.max(a,o*(1048576>o?2:1.125)>>>0),0!=o&&(a=Math.max(a,256)),o=e.oc,e.oc=new Uint8Array(a),0<e.Dc&&e.oc.set(o.subarray(0,e.Dc),0)),e.oc.subarray&&t.subarray)e.oc.set(t.subarray(r,r+n),i);else for(a=0;a<n;a++)e.oc[i+a]=t[r+a];return e.Dc=Math.max(e.Dc,i+n),n},Ic(e,t,r){if(1===r?t+=e.position:2===r&&Ve.isFile(e.node.mode)&&(t+=e.node.Dc),0>t)throw new Ve.cc(28);return t},gd(e,t,r,n,i){if(!Ve.isFile(e.node.mode))throw new Ve.cc(43);if(e=e.node.oc,2&i||!e||e.buffer!==w.buffer){if(n=!0,B(),!(i=void 0))throw new Ve.cc(48);e&&((0<r||r+t<e.length)&&(e=e.subarray?e.subarray(r,r+t):Array.prototype.slice.call(e,r,r+t)),w.set(e,i))}else n=!1,i=e.byteOffset;return{pc:i,Ue:n}},od:(e,t,r,n)=>(de.hc.write(e,t,0,n,r,!1),0)}},le=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},ue=0,he=null,fe=()=>{if(ue--,n.monitorRunDependencies?.(ue),0==ue&&he){var e=he;he=null,e()}},pe=()=>{ue++,n.monitorRunDependencies?.(ue)},me=[],ve=async(e,t,r,n,i,a,o,s)=>{var d=t?Q(H(e+"/"+t)):e;pe();try{var l=r;"string"==typeof r&&(l=await(async e=>(e=await c(e),new Uint8Array(e)))(r)),l=await(async(e,t)=>{for(var r of("undefined"!=typeof Browser&&ge(),me))if(r.canHandle(t))return r.handle(e,t);return e})(l,d),s?.(),a||$e(e,t,l,n,i,o)}finally{fe()}};function ge(){var e,t,r;Ve.Id=!0,e??=n.stdin,t??=n.stdout,r??=n.stderr,e?Ve.Xc("/dev","stdin",e):Ve.symlink("/dev/tty","/dev/stdin"),t?Ve.Xc("/dev","stdout",null,t):Ve.symlink("/dev/tty","/dev/stdout"),r?Ve.Xc("/dev","stderr",null,r):Ve.symlink("/dev/tty1","/dev/stderr"),Ve.open("/dev/stdin",0),Ve.open("/dev/stdout",1),Ve.open("/dev/stderr",1)}function we(e,t){Ve.Wd[e]={hc:t}}function ye(e){return 16384==(61440&e)}function be(e,t){var r=ye(e.mode)?(r=Pe(e,"x"))?r:e.fc.lookup?0:2:54;if(r)throw new Ve.cc(r);for(r=Ve.Uc[Se(e.id,t)];r;r=r.bd)if(r.parent.id===e.id&&r.name===t)return r;return Ve.lookup(e,t)}function _e(e){var t=Se(e.parent.id,e.name);if(Ve.Uc[t]===e)Ve.Uc[t]=e.bd;else for(t=Ve.Uc[t];t;){if(t.bd===e){t.bd=e.bd;break}t=t.bd}}function $e(e,t,r,n,i,a){var o=t;if(e&&(e="string"==typeof e?e:Ae(e),o=t?H(e+"/"+t):e),e=le(n,i),o=Ve.create(o,e),r){if("string"==typeof r){for(t=Array(r.length),n=0,i=r.length;n<i;++n)t[n]=r.charCodeAt(n);r=t}Ve.chmod(o,146|e),t=Ve.open(o,577),Ve.write(t,r,0,r.length,0,a),Ve.close(t),Ve.chmod(o,e)}}function Ee(e,t={}){if(!e)throw new Ve.cc(44);t.vd??(t.vd=!0),"/"===e.charAt(0)||(e=Ve.cwd()+"/"+e);var r=0;e:for(;40>r;r++){e=e.split("/").filter(e=>!!e);for(var n=Ve.root,i="/",a=0;a<e.length;a++){var o=a===e.length-1;if(o&&t.parent)break;if("."!==e[a])if(".."===e[a]){if(i=X(i),Ve.Ld(n)){e=i+"/"+e.slice(a+1).join("/"),r--;continue e}n=n.parent}else{i=H(i+"/"+e[a]);try{n=be(n,e[a])}catch(e){if(44===e?.Nc&&o&&t.Le)return{path:i};throw e}if(!n.Qc||o&&!t.vd||(n=n.Qc.root),40960==(61440&n.mode)&&(!o||t.Oc)){if(!n.fc.readlink)throw new Ve.cc(52);"/"===(n=n.fc.readlink(n)).charAt(0)||(n=X(i)+"/"+n),e=n+"/"+e.slice(a+1).join("/");continue e}}}return{path:i,node:n}}throw new Ve.cc(32)}function Ae(e){for(var t;;){if(Ve.Ld(e))return e=e.rc.ee,t?"/"!==e[e.length-1]?`${e}/${t}`:e+t:e;t=t?`${e.name}/${t}`:e.name,e=e.parent}}function Se(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Ve.Uc.length}function Te(e){var t=Se(e.parent.id,e.name);e.bd=Ve.Uc[t],Ve.Uc[t]=e}function ke(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t}function Pe(e,t){return Ve.be?0:!t.includes("r")||292&e.mode?t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0:2}function Ce(e,t){if(!ye(e.mode))return 54;try{return be(e,t),20}catch(e){}return Pe(e,"wx")}function Re(e,t,r){try{var n=be(e,t)}catch(e){return e.Nc}if(e=Pe(e,"wx"))return e;if(r){if(!ye(n.mode))return 54;if(Ve.Ld(n)||Ae(n)===Ve.cwd())return 10}else if(ye(n.mode))return 31;return 0}function Oe(e,t){if(!e)throw new Ve.cc(t);return e}function Ue(e){if(!(e=Ve.De(e)))throw new Ve.cc(8);return e}function Le(e,t=-1){if(e=Object.assign(new Ve.qe,e),-1==t)e:{for(t=0;t<=Ve.se;t++)if(!Ve.streams[t])break e;throw new Ve.cc(33)}return e.fd=t,Ve.streams[t]=e}function Be(e,t,r){var n=e?.hc.Rc;e=n?e:t,n??=t.fc.Rc,Oe(n,63),n(e,r)}function Fe(e){var t=[];for(e=[e];e.length;){var r=e.pop();t.push(r),e.push(...r.nd)}return t}function De(e){var t={Xe:4096,lf:4096,blocks:1e6,We:5e5,Ve:5e5,files:Ve.Od,jf:Ve.Od-1,mf:42,flags:2,vf:255};return e.fc.ke&&Object.assign(t,e.fc.ke(e.rc.Me.root)),t}function Me(e,t,r){return void 0===r&&(r=t,t=438),Ve.Tc(e,8192|t,r)}function Ge(e,t,r,n){Be(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),Yd:n})}function Ie(e,t,r){if(ye(t.mode))throw new Ve.cc(31);if(!Ve.isFile(t.mode))throw new Ve.cc(28);var n=Pe(t,"w");if(n)throw new Ve.cc(n);Be(e,t,{size:r,timestamp:Date.now()})}function Ne(e){if(!(e.Je||e.Ke||e.link||e.oc))if(globalThis.XMLHttpRequest)B("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.oc=d(e.url)}catch(e){throw new Ve.cc(29)}}var Ve={root:null,nd:[],Wd:{},streams:[],Od:1,Uc:null,Td:"/",Id:!1,be:!0,ze:null,Bd:0,je:{},cc:class{name="ErrnoError";constructor(e){this.Nc=e}},qe:class{Jc={};node=null;get object(){return this.node}set object(e){this.node=e}get flags(){return this.Jc.flags}set flags(e){this.Jc.flags=e}get position(){return this.Jc.position}set position(e){this.Jc.position=e}},pe:class{fc={};hc={};Qc=null;constructor(e,t,r,n){e||=this,this.parent=e,this.rc=e.rc,this.id=Ve.Od++,this.name=t,this.mode=r,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return!(365&~this.mode)}set read(e){e?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(e){e?this.mode|=146:this.mode&=-147}get Ke(){return ye(this.mode)}get Je(){return 8192==(61440&this.mode)}},createNode:(e,t,r,n)=>(Te(e=new Ve.pe(e,t,r,n)),e),Ld:e=>e===e.parent,isFile:e=>32768==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),se:4096,De:e=>Ve.streams[e],te:{open(e){e.hc=Ve.Be(e.node.rdev).hc,e.hc.open?.(e)},Ic(){throw new Ve.cc(70)}},Md:e=>e>>8,rf:e=>255&e,ad:(e,t)=>e<<8|t,Be:e=>Ve.Wd[e],le(e,t){function r(e){return Ve.Bd--,t(e)}function n(e){if(e){if(!n.xe)return n.xe=!0,r(e)}else++o>=a.length&&r(null)}"function"==typeof e&&(t=e,e=!1),Ve.Bd++,1<Ve.Bd&&C(`warning: ${Ve.Bd} FS.syncfs operations in flight at once, probably just doing extra work`);var i,a=Fe(Ve.root.rc),o=0;for(i of a)i.type.le?i.type.le(i,e,n):n(null)},rc(e,t,r){var n="/"===r;if(n&&Ve.root)throw new Ve.cc(10);if(!n&&r){var i=Ee(r,{vd:!1});if(r=i.path,(i=i.node).Qc)throw new Ve.cc(10);if(!ye(i.mode))throw new Ve.cc(54)}return(e=e.rc(t={type:e,Me:t,ee:r,nd:[]})).rc=t,t.root=e,n?Ve.root=e:i&&(i.Qc=t,i.rc&&i.rc.nd.push(t)),e},Gf(e){if(!(e=Ee(e,{vd:!1})).node.Qc)throw new Ve.cc(28);var t=(e=e.node).Qc,r=Fe(t);for([,i]of Object.entries(Ve.Uc))for(;i;){var n=i.bd;r.includes(i.rc)&&_e(i);var i=n}e.Qc=null,e.rc.nd.splice(e.rc.nd.indexOf(t),1)},lookup:(e,t)=>e.fc.lookup(e,t),Tc(e,t,r){var n=Ee(e,{parent:!0}).node;if(!(e=J(e)))throw new Ve.cc(28);if("."===e||".."===e)throw new Ve.cc(20);var i=Ce(n,e);if(i)throw new Ve.cc(i);if(!n.fc.Tc)throw new Ve.cc(63);return n.fc.Tc(n,e,t,r)},ke:e=>De(Ee(e,{Oc:!0}).node),Cf:e=>De(e.node),create:(e,t=438)=>Ve.Tc(e,4095&t|32768,0),mkdir:(e,t=511)=>Ve.Tc(e,1023&t|16384,0),tf(e,t){var r,n=e.split("/"),i="";for(r of n)if(r){(i||"/"===e.charAt(0))&&(i+="/"),i+=r;try{Ve.mkdir(i,t)}catch(e){if(20!=e.Nc)throw e}}},symlink(e,t){if(!Q(e))throw new Ve.cc(44);var r=Ee(t,{parent:!0}).node;if(!r)throw new Ve.cc(44);var n=Ce(r,t=J(t));if(n)throw new Ve.cc(n);if(!r.fc.symlink)throw new Ve.cc(63);return r.fc.symlink(r,t,e)},rename(e,t){var r=X(e),n=X(t),i=J(e),a=J(t),o=Ee(e,{parent:!0}),s=o.node;if(o=(o=Ee(t,{parent:!0})).node,!s||!o)throw new Ve.cc(44);if(s.rc!==o.rc)throw new Ve.cc(75);var c=be(s,i);if("."!==(e=Y(e,n)).charAt(0))throw new Ve.cc(28);if("."!==(e=Y(t,r)).charAt(0))throw new Ve.cc(55);try{var d=be(o,a)}catch(e){}if(c!==d){if(i=Re(s,i,t=ye(c.mode)))throw new Ve.cc(i);if(i=d?Re(o,a,t):Ce(o,a))throw new Ve.cc(i);if(!s.fc.rename)throw new Ve.cc(63);if(c.Qc||d&&d.Qc)throw new Ve.cc(10);if(o!==s&&(i=Pe(s,"w")))throw new Ve.cc(i);_e(c);try{s.fc.rename(c,o,a),c.parent=o}catch(e){throw e}finally{Te(c)}}},rmdir(e){var t=Ee(e,{parent:!0}).node,r=be(t,e=J(e)),n=Re(t,e,!0);if(n)throw new Ve.cc(n);if(!t.fc.rmdir)throw new Ve.cc(63);if(r.Qc)throw new Ve.cc(10);t.fc.rmdir(t,e),_e(r)},readdir:e=>Oe((e=Ee(e,{Oc:!0}).node).fc.readdir,54)(e),unlink(e){var t=Ee(e,{parent:!0}).node;if(!t)throw new Ve.cc(44);var r=be(t,e=J(e)),n=Re(t,e,!1);if(n)throw new Ve.cc(n);if(!t.fc.unlink)throw new Ve.cc(63);if(r.Qc)throw new Ve.cc(10);t.fc.unlink(t,e),_e(r)},readlink(e){if(!(e=Ee(e).node))throw new Ve.cc(44);if(!e.fc.readlink)throw new Ve.cc(28);return e.fc.readlink(e)},stat:(e,t)=>Oe((e=Ee(e,{Oc:!t}).node).fc.Pc,63)(e),fstat(e){var t=Ue(e);e=t.node;var r=t.hc.Pc;return t=r?t:e,r??=e.fc.Pc,Oe(r,63),r(t)},lstat:e=>Ve.stat(e,!0),chmod(e,t,r){Ge(null,e="string"==typeof e?Ee(e,{Oc:!r}).node:e,t,r)},lchmod(e,t){Ve.chmod(e,t,!0)},fchmod(e,t){Ge(e=Ue(e),e.node,t,!1)},chown(e,t,r,n){Be(null,e="string"==typeof e?Ee(e,{Oc:!n}).node:e,{timestamp:Date.now(),Yd:n})},lchown(e,t,r){Ve.chown(e,t,r,!0)},fchown(e){Be(e=Ue(e),e.node,{timestamp:Date.now(),Yd:!1})},truncate(e,t){if(0>t)throw new Ve.cc(28);Ie(null,e="string"==typeof e?Ee(e,{Oc:!0}).node:e,t)},nf(e,t){if(e=Ue(e),0>t||!(2097155&e.flags))throw new Ve.cc(28);Ie(e,e.node,t)},Hf(e,t,r){Oe((e=Ee(e,{Oc:!0}).node).fc.Rc,63)(e,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new Ve.cc(44);if("string"==typeof t){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===i)throw Error(`Unknown file open mode: ${t}`);t=i}if(r=64&t?4095&r|32768:0,"object"==typeof e)i=e;else{var a=e.endsWith("/");i=(e=Ee(e,{Oc:!(131072&t),Le:!0})).node,e=e.path}var o=!1;if(64&t)if(i){if(128&t)throw new Ve.cc(20)}else{if(a)throw new Ve.cc(31);i=Ve.Tc(e,511|r,0),o=!0}if(!i)throw new Ve.cc(44);if(8192==(61440&i.mode)&&(t&=-513),65536&t&&!ye(i.mode))throw new Ve.cc(54);if(!o&&(a=i?40960==(61440&i.mode)?32:ye(i.mode)&&("r"!==ke(t)||576&t)?31:Pe(i,ke(t)):44))throw new Ve.cc(a);return 512&t&&!o&&Ve.truncate(i,0),t&=-131713,(a=Le({node:i,path:Ae(i),flags:t,seekable:!0,position:0,hc:i.hc,Te:[],error:!1})).hc.open&&a.hc.open(a),o&&Ve.chmod(i,511&r),!n.logReadFiles||1&t||e in Ve.je||(Ve.je[e]=1),a},close(e){if(null===e.fd)throw new Ve.cc(8);e.Hd&&(e.Hd=null);try{e.hc.close&&e.hc.close(e)}catch(e){throw e}finally{Ve.streams[e.fd]=null}e.fd=null},Ic(e,t,r){if(null===e.fd)throw new Ve.cc(8);if(!e.seekable||!e.hc.Ic)throw new Ve.cc(70);if(0!=r&&1!=r&&2!=r)throw new Ve.cc(28);return e.position=e.hc.Ic(e,t,r),e.Te=[],e.position},read(e,t,r,n,i){if(0>n||0>i)throw new Ve.cc(28);if(null===e.fd)throw new Ve.cc(8);if(1==(2097155&e.flags))throw new Ve.cc(8);if(ye(e.node.mode))throw new Ve.cc(31);if(!e.hc.read)throw new Ve.cc(28);var a=void 0!==i;if(a){if(!e.seekable)throw new Ve.cc(70)}else i=e.position;return t=e.hc.read(e,t,r,n,i),a||(e.position+=t),t},write(e,t,r,n,i,a){if(0>n||0>i)throw new Ve.cc(28);if(null===e.fd)throw new Ve.cc(8);if(!(2097155&e.flags))throw new Ve.cc(8);if(ye(e.node.mode))throw new Ve.cc(31);if(!e.hc.write)throw new Ve.cc(28);e.seekable&&1024&e.flags&&Ve.Ic(e,0,2);var o=void 0!==i;if(o){if(!e.seekable)throw new Ve.cc(70)}else i=e.position;return t=e.hc.write(e,t,r,n,i,a),o||(e.position+=t),t},gd(e,t,r,n,i){if(2&n&&!(2&i)&&2!=(2097155&e.flags))throw new Ve.cc(2);if(1==(2097155&e.flags))throw new Ve.cc(2);if(!e.hc.gd)throw new Ve.cc(43);if(!t)throw new Ve.cc(28);return e.hc.gd(e,t,r,n,i)},od:(e,t,r,n,i)=>e.hc.od?e.hc.od(e,t,r,n,i):0,Jd(e,t,r){if(!e.hc.Jd)throw new Ve.cc(59);return e.hc.Jd(e,t,r)},readFile(e,t={}){t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding&&B(`Invalid encoding type "${t.encoding}"`);var r=Ve.open(e,t.flags);e=Ve.stat(e).size;var n=new Uint8Array(e);return Ve.read(r,n,0,e,0),"utf8"===t.encoding&&(n=Z(n)),Ve.close(r),n},writeFile(e,t,r={}){r.flags=r.flags||577,e=Ve.open(e,r.flags,r.mode),"string"==typeof t&&(t=new Uint8Array(ne(t))),ArrayBuffer.isView(t)?Ve.write(e,t,0,t.byteLength,void 0,r.cf):B("Unsupported data type"),Ve.close(e)},cwd:()=>Ve.Td,chdir(e){if(null===(e=Ee(e,{Oc:!0})).node)throw new Ve.cc(44);if(!ye(e.node.mode))throw new Ve.cc(54);var t=Pe(e.node,"x");if(t)throw new Ve.cc(t);Ve.Td=e.path},zf(){for(var e of(Ve.Id=!1,Ve.streams))e&&Ve.close(e)},kf(e,t){try{var r=Ee(e,{Oc:!t});e=r.path}catch(e){}var n=!1,i=null;try{r=Ee(e,{parent:!0}),J(e),r=Ee(e,{Oc:!t}),n=!0,i=r.node}catch(e){}return n?i:null},Xc(e,t,r,n){var i;return e=((e,t)=>H(e+"/"+t))("string"==typeof e?e:Ae(e),t),t=le(!!r,!!n),(i=Ve.Xc).Md??(i.Md=64),we(i=Ve.ad(Ve.Xc.Md++,0),{open(e){e.seekable=!1},close(){n?.buffer?.length&&n(10)},read(e,t,n,i){for(var a=0,o=0;o<i;o++){try{var s=r()}catch(e){throw new Ve.cc(29)}if(void 0===s&&0===a)throw new Ve.cc(6);if(null==s)break;a++,t[n+o]=s}return a&&(e.node.atime=Date.now()),a},write(e,t,r,i){for(var a=0;a<i;a++)try{n(t[r+a])}catch(e){throw new Ve.cc(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),a}}),Me(e,t,i)}},je=void 0,ze=e=>{for(var t="";;){var r=y[e++];if(!r)return t;t+=String.fromCharCode(r)}},We={},qe={},He={},Xe=class extends Error{constructor(e){super(e),this.name="BindingError"}},Je=e=>{throw new Xe(e)};function Ke(e,t,r={}){return function(e,t,r={}){var n=t.name;if(!e)throw new Xe(`type "${n}" must have a positive integer typeid pointer`);if(qe.hasOwnProperty(e)){if(r.Ee)return;throw new Xe(`Cannot register type '${n}' twice`)}qe[e]=t,delete He[e],We.hasOwnProperty(e)&&(t=We[e],delete We[e],t.forEach(e=>e()))}(e,t,r)}var Qe=(e,t,r)=>{switch(t){case 1:return r?e=>w[e]:e=>y[e];case 2:return r?e=>b[e>>1]:e=>_[e>>1];case 4:return r?e=>$[e>>2]:e=>E[e>>2];case 8:return r?e=>S[e>>3]:e=>T[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Ye=e=>{throw new Xe(e.dc.sc.qc.name+" instance already deleted")},Ze=!1,et=()=>{},tt=e=>globalThis.FinalizationRegistry?(Ze=new FinalizationRegistry(e=>{--(e=e.dc).count.value,0===e.count.value&&(e.Fc?e.Kc.Yc(e.Fc):e.sc.qc.Yc(e.pc))}),tt=e=>{var t=e.dc;return t.Fc&&Ze.register(e,{dc:t},e),e},et=e=>{Ze.unregister(e)},tt(e)):(tt=e=>e,e);function rt(){}var nt=(e,t)=>Object.defineProperty(t,"name",{value:e}),it={},at=(e,t,r)=>{if(void 0===e[t].Ec){var n=e[t];e[t]=function(...n){if(!e[t].Ec.hasOwnProperty(n.length))throw new Xe(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].Ec})!`);return e[t].Ec[n.length].apply(this,n)},e[t].Ec=[],e[t].Ec[n.kd]=n}},ot=(e,t,r)=>{if(n.hasOwnProperty(e)){if(void 0===r||void 0!==n[e].Ec&&void 0!==n[e].Ec[r])throw new Xe(`Cannot register public name '${e}' twice`);if(at(n,e,e),n[e].Ec.hasOwnProperty(r))throw new Xe(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`);n[e].Ec[r]=t}else n[e]=t,n[e].kd=r};function st(e,t,r,n,i,a,o,s){this.name=e,this.constructor=t,this.ed=r,this.Yc=n,this.Hc=i,this.Ae=a,this.sd=o,this.we=s,this.Oe=[]}var ct=(e,t,r)=>{for(;t!==r;){if(!t.sd)throw new Xe(`Expected null or instance of ${r.name}, got an instance of ${t.name}`);e=t.sd(e),t=t.Hc}return e},dt=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function lt(e,t){if(null===t){if(this.Kd)throw new Xe(`null is not a valid ${this.name}`);return 0}if(!t.dc)throw new Xe(`Cannot pass "${dt(t)}" as a ${this.name}`);if(!t.dc.pc)throw new Xe(`Cannot pass deleted object as a pointer of type ${this.name}`);return ct(t.dc.pc,t.dc.sc.qc,this.qc)}function ut(e,t){if(null===t){if(this.Kd)throw new Xe(`null is not a valid ${this.name}`);if(this.xd){var r=this.Qe();return null!==e&&e.push(this.Yc,r),r}return 0}if(!t||!t.dc)throw new Xe(`Cannot pass "${dt(t)}" as a ${this.name}`);if(!t.dc.pc)throw new Xe(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.wd&&t.dc.sc.wd)throw new Xe(`Cannot convert argument of type ${t.dc.Kc?t.dc.Kc.name:t.dc.sc.name} to parameter type ${this.name}`);if(r=ct(t.dc.pc,t.dc.sc.qc,this.qc),this.xd){if(void 0===t.dc.Fc)throw new Xe("Passing raw pointer to smart pointer is illegal");switch(this.Se){case 0:if(t.dc.Kc!==this)throw new Xe(`Cannot convert argument of type ${t.dc.Kc?t.dc.Kc.name:t.dc.sc.name} to parameter type ${this.name}`);r=t.dc.Fc;break;case 1:r=t.dc.Fc;break;case 2:if(t.dc.Kc===this)r=t.dc.Fc;else{var n=t.clone();r=this.Re(r,Mt(()=>n.delete())),null!==e&&e.push(this.Yc,r)}break;default:throw new Xe("Unsupporting sharing policy")}}return r}function ht(e,t){if(null===t){if(this.Kd)throw new Xe(`null is not a valid ${this.name}`);return 0}if(!t.dc)throw new Xe(`Cannot pass "${dt(t)}" as a ${this.name}`);if(!t.dc.pc)throw new Xe(`Cannot pass deleted object as a pointer of type ${this.name}`);if(t.dc.sc.wd)throw new Xe(`Cannot convert argument of type ${t.dc.sc.name} to parameter type ${this.name}`);return ct(t.dc.pc,t.dc.sc.qc,this.qc)}function ft(e){return this.Gc(E[e>>2])}var pt=(e,t,r)=>t===r?e:void 0===r.Hc||null===(e=pt(e,t,r.Hc))?null:r.we(e),mt={},vt=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt=(e,t)=>{if(!t.sc||!t.pc)throw new vt("makeClassHandle requires ptr and ptrType");if(!!t.Kc!=!!t.Fc)throw new vt("Both smartPtrType and smartPtr must be specified");return t.count={value:1},tt(Object.create(e,{dc:{value:t,writable:!0}}))};function wt(e,t,r,n,i,a,o,s,c,d,l){this.name=e,this.qc=t,this.Kd=r,this.wd=n,this.xd=i,this.Ne=a,this.Se=o,this.ie=s,this.Qe=c,this.Re=d,this.Yc=l,i||void 0!==t.Hc?this.Lc=ut:(this.Lc=n?lt:ht,this.Mc=null)}var yt=(e,t,r)=>{if(!n.hasOwnProperty(e))throw new vt("Replacing nonexistent public symbol");void 0!==n[e].Ec&&void 0!==r?n[e].Ec[r]=t:(n[e]=t,n[e].kd=r)},bt=(e,t)=>{e=ze(e);var r=Gn.get(t);if("function"!=typeof r)throw new Xe(`unknown function pointer with signature ${e}: ${t}`);return r};class _t extends Error{}var $t=e=>{e=gn(e);var t=ze(e);return mn(e),t},Et=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||qe[t]||(He[t]?He[t].forEach(e):(r.push(t),n[t]=!0))}),new _t(`${e}: `+r.map($t).join([", "]))},xt=(e,t,r)=>{function n(t){if((t=r(t)).length!==e.length)throw new vt("Mismatched type converter count");for(var n=0;n<e.length;++n)Ke(e[n],t[n])}e.forEach(e=>He[e]=t);var i=Array(t.length),a=[],o=0;for(let[e,r]of t.entries())qe.hasOwnProperty(r)?i[e]=qe[r]:(a.push(r),We.hasOwnProperty(r)||(We[r]=[]),We[r].push(()=>{i[e]=qe[r],++o===a.length&&n(i)}));0===a.length&&n(i)},At=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(E[t+4*n>>2]);return r},St=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Tt(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].Mc)return!0;return!1}function kt(e,t,r,n,i,a){var o=t.length;if(2>o)throw new Xe("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==t[1]&&null!==r,c=Tt(t);r=!t[0].ce;var d=t[0],l=t[1];for(n=[e,Je,n,i,St,d.Gc.bind(d),l?.Lc.bind(l)],i=2;i<o;++i)n.push((d=t[i]).Lc.bind(d));if(!c)for(i=s?1:2;i<t.length;++i)null!==t[i].Mc&&n.push(t[i].Mc);for(c=Tt(t),i=t.length-2,l=[],d=["fn"],s&&d.push("thisWired"),o=0;o<i;++o)l.push(`arg${o}`),d.push(`arg${o}Wired`);l=l.join(","),d=d.join(","),l=`return function (${l}) {\n`,c&&(l+="var destructors = [];\n");var u=c?"destructors":"null",h="humanName throwBindingError invoker fn runDestructors fromRetWire toClassParamWire".split(" ");for(s&&(l+=`var thisWired = toClassParamWire(${u}, this);\n`),o=0;o<i;++o){var f=`toArg${o}Wire`;l+=`var arg${o}Wired = ${f}(${u}, arg${o});\n`,h.push(f)}if(l+=(r||a?"var rv = ":"")+`invoker(${d});\n`,c)l+="runDestructors(destructors);\n";else for(o=s?1:2;o<t.length;++o)a=1===o?"thisWired":"arg"+(o-2)+"Wired",null!==t[o].Mc&&(l+=`${a}_dtor(${a});\n`,h.push(`${a}_dtor`));return r&&(l+="var ret = fromRetWire(rv);\nreturn ret;\n"),t=new Function(h,l+"}\n")(...n),nt(e,t)}var Pt,Ct,Rt,Ot,Ut=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},Lt=[],Bt=[0,1,,1,null,1,!0,1,!1,1],Ft=e=>{9<e&&0===--Bt[e+1]&&(Bt[e]=void 0,Lt.push(e))},Dt=e=>{if(!e)throw new Xe(`Cannot use deleted val. handle = ${e}`);return Bt[e]},Mt=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const t=Lt.pop()||Bt.length;return Bt[t]=e,Bt[t+1]=1,t}},Gt={name:"emscripten::val",Gc:e=>{var t=Dt(e);return Ft(e),t},Lc:(e,t)=>Mt(t),Wc:ft,Mc:null},It=(e,t)=>{switch(t){case 4:return function(e){return this.Gc(x[e>>2])};case 8:return function(e){return this.Gc(A[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Nt=new TextDecoder("utf-16le"),Vt=(e,t,r)=>Nt.decode(_.subarray(e>>=1,j(_,e,t/2,r))),jt=(e,t,r)=>{if(r??=2147483647,2>r)return 0;var n=t;r=(r-=2)<2*e.length?r/2:e.length;for(var i=0;i<r;++i)b[t>>1]=e.charCodeAt(i),t+=2;return b[t>>1]=0,t-n},zt=e=>2*e.length,Wt=(e,t,r)=>{var n="";e>>=2;for(var i=0;!(i>=t/4);i++){var a=E[e+i];if(!a&&!r)break;n+=String.fromCodePoint(a)}return n},qt=(e,t,r)=>{if(r??=2147483647,4>r)return 0;var n=t;r=n+r-4;for(var i=0;i<e.length;++i){var a=e.codePointAt(i);if(65535<a&&i++,$[t>>2]=a,(t+=4)+4>r)break}return $[t>>2]=0,t-n},Ht=e=>{for(var t=0,r=0;r<e.length;++r)65535<e.codePointAt(r)&&r++,t+=4;return t},Xt=0,Jt=[],Kt=(e,t,r)=>{var n=[];return e=e(n,r),n.length&&(E[t>>2]=Mt(n)),e},Qt={},Yt=e=>{var t=Qt[e];return void 0===t?ze(e):t},Zt={},er=e=>{m=e,N||0<Xt||(n.onExit?.(e),R=!0),l(e,new F(e))},tr=e=>{if(!R)try{if(e(),!(N||0<Xt))try{m=e=m,er(e)}catch(e){e instanceof F||"unwind"==e||l(1,e)}}catch(e){e instanceof F||"unwind"==e||l(1,e)}},rr=e=>{var t="ANGLE_instanced_arrays EXT_blend_minmax EXT_disjoint_timer_query EXT_frag_depth EXT_shader_texture_lod EXT_sRGB OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object WEBGL_color_buffer_float WEBGL_depth_texture WEBGL_draw_buffers EXT_color_buffer_float EXT_conservative_depth EXT_disjoint_timer_query_webgl2 EXT_texture_norm16 NV_shader_noperspective_interpolation WEBGL_clip_cull_distance EXT_clip_control EXT_color_buffer_half_float EXT_depth_clamp EXT_float_blend EXT_polygon_offset_clamp EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic KHR_parallel_shader_compile OES_texture_float_linear WEBGL_blend_func_extended WEBGL_compressed_texture_astc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode".split(" ");return(e.getSupportedExtensions()||[]).filter(e=>t.includes(e))},nr=1,ir=[],ar=[],or=[],sr=[],cr=[],dr=[],lr=[],ur=[],hr=[1,1,2,2,4,4,4,2,3,4,8],fr=e=>{for(var t=nr++,r=e.length;r<t;r++)e[r]=null;for(;e[t];)t=nr++;return t},pr=(e,t,r,n)=>{for(var i=0;i<e;i++){var a=Pt[r](),o=a&&fr(n);a?(a.name=o,n[o]=a):Ct||=1282,$[t+4*i>>2]=o}},mr=["default","low-power","high-performance"],vr=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],gr=e=>(e=2<e?z(e):e,vr[e]||("undefined"!=typeof document?document.querySelector(e):null)),wr=e=>{var t=te(e)+1,r=Fn(t);return re(e,y,r,t),r},yr=[],br=[],_r=e=>{if(e)return yr[e>>>0]},$r=e=>z(E[e>>2],E[e+4>>2]),Er=e=>{var t=E[e>>2];return e=E[e+4>>2],t?z(t,e):0===e?"":void 0},xr=e=>({width:E[e>>2],height:E[e+4>>2],depthOrArrayLayers:E[e+8>>2]}),Ar=e=>{var t=e+8;return{texture:_r(E[e>>2]),mipLevel:E[e+4>>2],origin:{x:E[t>>2],y:E[t+4>>2],z:E[t+8>>2]},aspect:Jr[E[e+20>>2]]}},Sr=(e,t)=>{if(e){for(var r={},n=0;n<e;++n){var i=t+24*n;r[$r(i+4)]=A[i+16>>3]}return r}},Tr=e=>e?_r(e):"auto",kr=[,"clamp-to-edge","repeat","mirror-repeat"],Pr=[,"zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha"