@thorvg/lottie-player
Version:
A web lottie player using ThorVG as a renderer
1 lines • 83.3 kB
JavaScript
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let i=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const r=this.t;if(e&&void 0===t){const e=void 0!==r&&1===r.length;e&&(t=n.get(r)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(r,t))}return t}toString(){return this.cssText}};const a=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new i("string"==typeof t?t:t+"",void 0,r))(e)})(t):t,{is:o,defineProperty:s,getOwnPropertyDescriptor:l,getOwnPropertyNames:c,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,d=globalThis,f=d.trustedTypes,p=f?f.emptyScript:"",m=d.reactiveElementPolyfillSupport,b=(t,e)=>t,v={toAttribute(t,e){switch(e){case Boolean:t=t?p:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},w=(t,e)=>!o(t,e),g={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),d.litPropertyMetadata??=new WeakMap;let y=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=g){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);void 0!==n&&s(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:i}=l(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const a=n?.call(this);i?.call(this,e),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??g}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=h(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...c(t),...u(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const r=this._$Eu(t,e);void 0!==r&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((r,n)=>{if(e)r.adoptedStyleSheets=n.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of n){const n=document.createElement("style"),i=t.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=e.cssText,r.appendChild(n)}})(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){const r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(void 0!==n&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:v).toAttribute(e,r.type);this._$Em=t,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(t,e){const r=this.constructor,n=r._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=r.getPropertyOptions(n),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:v;this._$Em=n;const a=i.fromAttribute(e,t.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,r,n=!1,i){if(void 0!==t){const a=this.constructor;if(!1===n&&(i=this[t]),r??=a.getPropertyOptions(t),!((r.hasChanged??w)(i,e)||r.useDefault&&r.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(a._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:n,wrapped:i},a){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==i||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,r,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[b("elementProperties")]=new Map,y[b("finalized")]=new Map,m?.({ReactiveElement:y}),(d.reactiveElementVersions??=[]).push("2.1.2");const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:w},_=(t=$,e,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&&((t=Object.create(t)).wrapped=!0),a.set(r.name,t),"accessor"===n){const{name:n}=r;return{set(r){const i=e.get.call(this);e.set.call(this,r),this.requestUpdate(n,i,t,!0,r)},init(e){return void 0!==e&&this.C(n,void 0,t,e),e}}}if("setter"===n){const{name:n}=r;return function(r){const i=this[n];e.call(this,r),this.requestUpdate(n,i,t,!0,r)}}throw Error("Unsupported decorator location: "+n)};function A(t){return(e,r)=>"object"==typeof r?_(t,e,r):((t,e,r)=>{const n=e.hasOwnProperty(r);return e.constructor.createProperty(r,t),n?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)}const x=globalThis,S=t=>t,k=x.trustedTypes,E=k?k.createPolicy("lit-html",{createHTML:t=>t}):void 0,I="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+C,P=`<${T}>`,M=document,U=()=>M.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,L="[ \t\n\f\r]",N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,V=/>/g,D=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,B=/"/g,z=/^(?:script|style|textarea|title)$/i,J=(t,...e)=>({_$litType$:1,strings:t,values:e}),W=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),H=new WeakMap,q=M.createTreeWalker(M,129);function X(t,e){if(!O(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(e):e}const Y=(t,e)=>{const r=t.length-1,n=[];let i,a=2===e?"<svg>":3===e?"<math>":"",o=N;for(let e=0;e<r;e++){const r=t[e];let s,l,c=-1,u=0;for(;u<r.length&&(o.lastIndex=u,l=o.exec(r),null!==l);)u=o.lastIndex,o===N?"!--"===l[1]?o=F:void 0!==l[1]?o=V:void 0!==l[2]?(z.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=D):void 0!==l[3]&&(o=D):o===D?">"===l[0]?(o=i??N,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,s=l[1],o=void 0===l[3]?D:'"'===l[3]?B:j):o===B||o===j?o=D:o===F||o===V?o=N:(o=D,i=void 0);const h=o===D&&t[e+1].startsWith("/>")?" ":"";a+=o===N?r+P:c>=0?(n.push(s),r.slice(0,c)+I+r.slice(c)+C+h):r+C+(-2===c?e:h)}return[X(t,a+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class K{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,a=0;const o=t.length-1,s=this.parts,[l,c]=Y(t,e);if(this.el=K.createElement(l,r),q.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=q.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(I)){const e=c[a++],r=n.getAttribute(t).split(C),o=/([.?@])?(.*)/.exec(e);s.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?rt:"?"===o[1]?nt:"@"===o[1]?it:et}),n.removeAttribute(t)}else t.startsWith(C)&&(s.push({type:6,index:i}),n.removeAttribute(t));if(z.test(n.tagName)){const t=n.textContent.split(C),e=t.length-1;if(e>0){n.textContent=k?k.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],U()),q.nextNode(),s.push({type:2,index:++i});n.append(t[e],U())}}}else if(8===n.nodeType)if(n.data===T)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(C,t+1));)s.push({type:7,index:i}),t+=C.length-1}i++}}static createElement(t,e){const r=M.createElement("template");return r.innerHTML=t,r}}function Q(t,e,r=t,n){if(e===W)return e;let i=void 0!==n?r._$Co?.[n]:r._$Cl;const a=R(e)?void 0:e._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(t),i._$AT(t,r,n)),void 0!==n?(r._$Co??=[])[n]=i:r._$Cl=i),void 0!==i&&(e=Q(t,i._$AS(t,e.values),i,n)),e}class Z{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??M).importNode(e,!0);q.currentNode=n;let i=q.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let e;2===s.type?e=new tt(i,i.nextSibling,this,t):1===s.type?e=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(e=new at(i,this,t)),this._$AV.push(e),s=r[++o]}a!==s?.index&&(i=q.nextNode(),a++)}return q.currentNode=M,n}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class tt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=G,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),R(t)?t===G||null==t||""===t?(this._$AH!==G&&this._$AR(),this._$AH=G):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>O(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==G&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,n="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=K.createElement(X(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new Z(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=H.get(t.strings);return void 0===e&&H.set(t.strings,e=new K(t)),e}k(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new tt(this.O(U()),this.O(U()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=S(t).nextSibling;S(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=G,this._$AN=void 0,this.element=t,this.name=e,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=G}_$AI(t,e=this,r,n){const i=this.strings;let a=!1;if(void 0===i)t=Q(this,t,e,0),a=!R(t)||t!==this._$AH&&t!==W,a&&(this._$AH=t);else{const n=t;let o,s;for(t=i[0],o=0;o<i.length-1;o++)s=Q(this,n[r+o],e,o),s===W&&(s=this._$AH[o]),a||=!R(s)||s!==this._$AH[o],s===G?t=G:t!==G&&(t+=(s??"")+i[o+1]),this._$AH[o]=s}a&&!n&&this.j(t)}j(t){t===G?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===G?void 0:t}}class nt extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==G)}}class it extends et{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??G)===W)return;const r=this._$AH,n=t===G&&r!==G||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==G&&(r===G||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const ot=x.litHtmlPolyfillSupport;ot?.(K,tt),(x.litHtmlVersions??=[]).push("3.3.2");const st=globalThis;class lt extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{const n=r?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=r?.renderBefore??null;n._$litPart$=i=new tt(e.insertBefore(U(),t),t,void 0,r??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}lt._$litElement$=!0,lt.finalized=!0,st.litElementHydrateSupport?.({LitElement:lt});const ct=st.litElementPolyfillSupport;function ut(t,e,r,n){var i,a=arguments.length,o=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(o=(a<3?i(o):a>3?i(e,r,o):i(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o}ct?.({LitElement:lt}),(st.litElementVersions??=[]).push("4.2.2");let ht=null,dt=!1;var ft=function(t){return t.JSON="json",t.LOT="lot",t.JPG="jpg",t.PNG="png",t.SVG="svg",t}({});const pt=t=>new Promise(e=>setTimeout(e,t));let mt="idle";class bt extends lt{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(dt)for(;!ht;)await pt(100);if(ht||(dt=!0,ht=await async function(t={}){var e,r=t,n=!!globalThis.window,i=!!globalThis.WorkerGlobalScope,a=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(a){const{createRequire:t}=await Promise.resolve().then(function(){return gt});var o=t(import.meta.url)}var s,l,c=(t,e)=>{throw e},u=import.meta.url,h="";if(a){var d=o("fs");u.startsWith("file:")&&(h=o("path").dirname(o("url").fileURLToPath(u))+"/"),l=t=>(t=P(t)?new URL(t):t,d.readFileSync(t)),s=async t=>(t=P(t)?new URL(t):t,d.readFileSync(t,void 0)),process.argv.slice(2),c=(t,e)=>{throw process.exitCode=t,e}}else if(n||i){try{h=new URL(".",u).href}catch{}i&&(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),s=async t=>{if(P(t))return new Promise((e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r(n.status)},n.onerror=r,n.send(null)});var e=await fetch(t,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw Error(e.status+" : "+e.url)}}var f,p,m,b,v,w,g,y,$,_,A,x,S,k,E,I=function(){}.bind(),C=function(){}.bind(),T=!1,P=t=>t.startsWith("file://"),M=!1;function U(){var t=sn.buffer;v=new Int8Array(t),g=new Int16Array(t),w=new Uint8Array(t),y=new Uint16Array(t),$=new Int32Array(t),_=new Uint32Array(t),A=new Float32Array(t),x=new Float64Array(t),S=new BigInt64Array(t),k=new BigUint64Array(t)}function R(t){throw r.onAbort?.(t),C(t="Aborted("+t+")"),T=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),b?.(t),t}class O{name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var L=t=>{for(;0<t.length;)t.shift()(r)},N=[],F=[],V=()=>{var t=r.preRun.shift();F.push(t)},D=!0,j=new TextDecoder,B=(t,e,r,n)=>{if(r=e+r,n)return r;for(;t[e]&&!(e>=r);)++e;return e},z=(t,e,r)=>t?j.decode(w.subarray(t,B(w,t,e,r))):"",J=t=>{for(var e="";;){var r=w[t++];if(!r)return e;e+=String.fromCharCode(r)}},W={},G={},H={},q=class extends Error{constructor(t){super(t),this.name="BindingError"}},X=t=>{throw new q(t)};function Y(t,e,r={}){return function(t,e,r={}){var n=e.name;if(!t)throw new q(`type "${n}" must have a positive integer typeid pointer`);if(G.hasOwnProperty(t)){if(r.Gc)return;throw new q(`Cannot register type '${n}' twice`)}G[t]=e,delete H[t],W.hasOwnProperty(t)&&(e=W[t],delete W[t],e.forEach(t=>t()))}(t,e,r)}var K=(t,e,r)=>{switch(e){case 1:return r?t=>v[t]:t=>w[t];case 2:return r?t=>g[t>>1]:t=>y[t>>1];case 4:return r?t=>$[t>>2]:t=>_[t>>2];case 8:return r?t=>S[t>>3]:t=>k[t>>3];default:throw new TypeError(`invalid integer width (${e}): ${t}`)}},Q=t=>{throw new q(t.Ja.Xa.Ua.name+" instance already deleted")},Z=!1,tt=()=>{},et=t=>globalThis.FinalizationRegistry?(Z=new FinalizationRegistry(t=>{--(t=t.Ja).count.value,0===t.count.value&&(t.ib?t.mb.zb(t.ib):t.Xa.Ua.zb(t.Va))}),et=t=>{var e=t.Ja;return e.ib&&Z.register(t,{Ja:e},t),t},tt=t=>{Z.unregister(t)},et(t)):(et=t=>t,t);function rt(){}var nt=(t,e)=>Object.defineProperty(e,"name",{value:t}),it={},at=(t,e,r)=>{if(void 0===t[e].hb){var n=t[e];t[e]=function(...n){if(!t[e].hb.hasOwnProperty(n.length))throw new q(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${t[e].hb})!`);return t[e].hb[n.length].apply(this,n)},t[e].hb=[],t[e].hb[n.Hb]=n}},ot=(t,e,n)=>{if(r.hasOwnProperty(t)){if(void 0===n||void 0!==r[t].hb&&void 0!==r[t].hb[n])throw new q(`Cannot register public name '${t}' twice`);if(at(r,t,t),r[t].hb.hasOwnProperty(n))throw new q(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`);r[t].hb[n]=e}else r[t]=e,r[t].Hb=n};function st(t,e,r,n,i,a,o,s){this.name=t,this.constructor=e,this.Eb=r,this.zb=n,this.kb=i,this.Cc=a,this.Mb=o,this.zc=s,this.Mc=[]}var lt=(t,e,r)=>{for(;e!==r;){if(!e.Mb)throw new q(`Expected null or instance of ${r.name}, got an instance of ${e.name}`);t=e.Mb(t),e=e.kb}return t},ct=t=>{if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t};function ut(t,e){if(null===e){if(this.Wb)throw new q(`null is not a valid ${this.name}`);return 0}if(!e.Ja)throw new q(`Cannot pass "${ct(e)}" as a ${this.name}`);if(!e.Ja.Va)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);return lt(e.Ja.Va,e.Ja.Xa.Ua,this.Ua)}function ht(t,e){if(null===e){if(this.Wb)throw new q(`null is not a valid ${this.name}`);if(this.Pb){var r=this.Nc();return null!==t&&t.push(this.zb,r),r}return 0}if(!e||!e.Ja)throw new q(`Cannot pass "${ct(e)}" as a ${this.name}`);if(!e.Ja.Va)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Ob&&e.Ja.Xa.Ob)throw new q(`Cannot convert argument of type ${e.Ja.mb?e.Ja.mb.name:e.Ja.Xa.name} to parameter type ${this.name}`);if(r=lt(e.Ja.Va,e.Ja.Xa.Ua,this.Ua),this.Pb){if(void 0===e.Ja.ib)throw new q("Passing raw pointer to smart pointer is illegal");switch(this.Pc){case 0:if(e.Ja.mb!==this)throw new q(`Cannot convert argument of type ${e.Ja.mb?e.Ja.mb.name:e.Ja.Xa.name} to parameter type ${this.name}`);r=e.Ja.ib;break;case 1:r=e.Ja.ib;break;case 2:if(e.Ja.mb===this)r=e.Ja.ib;else{var n=e.clone();r=this.Oc(r,Ot(()=>n.delete())),null!==t&&t.push(this.zb,r)}break;default:throw new q("Unsupporting sharing policy")}}return r}function dt(t,e){if(null===e){if(this.Wb)throw new q(`null is not a valid ${this.name}`);return 0}if(!e.Ja)throw new q(`Cannot pass "${ct(e)}" as a ${this.name}`);if(!e.Ja.Va)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(e.Ja.Xa.Ob)throw new q(`Cannot convert argument of type ${e.Ja.Xa.name} to parameter type ${this.name}`);return lt(e.Ja.Va,e.Ja.Xa.Ua,this.Ua)}function ft(t){return this.jb(_[t>>2])}var pt=(t,e,r)=>e===r?t:void 0===r.kb||null===(t=pt(t,e,r.kb))?null:r.zc(t),mt={},bt=class extends Error{constructor(t){super(t),this.name="InternalError"}},vt=(t,e)=>{if(!e.Xa||!e.Va)throw new bt("makeClassHandle requires ptr and ptrType");if(!!e.mb!=!!e.ib)throw new bt("Both smartPtrType and smartPtr must be specified");return e.count={value:1},et(Object.create(t,{Ja:{value:e,writable:!0}}))};function wt(t,e,r,n,i,a,o,s,l,c,u){this.name=t,this.Ua=e,this.Wb=r,this.Ob=n,this.Pb=i,this.Lc=a,this.Pc=o,this.pc=s,this.Nc=l,this.Oc=c,this.zb=u,i||void 0!==e.kb?this.nb=ht:(this.nb=n?ut:dt,this.ob=null)}var yt=(t,e,n)=>{if(!r.hasOwnProperty(t))throw new bt("Replacing nonexistent public symbol");void 0!==r[t].hb&&void 0!==n?r[t].hb[n]=e:(r[t]=e,r[t].Hb=n)},$t=(t,e)=>{t=J(t);var r=ln.get(e);if("function"!=typeof r)throw new q(`unknown function pointer with signature ${t}: ${e}`);return r};class _t extends Error{}var At=t=>{t=Vr(t);var e=J(t);return Nr(t),e},xt=(t,e)=>{var r=[],n={};throw e.forEach(function t(e){n[e]||G[e]||(H[e]?H[e].forEach(t):(r.push(e),n[e]=!0))}),new _t(`${t}: `+r.map(At).join([", "]))},St=(t,e,r)=>{function n(e){if((e=r(e)).length!==t.length)throw new bt("Mismatched type converter count");for(var n=0;n<t.length;++n)Y(t[n],e[n])}t.forEach(t=>H[t]=e);var i=Array(e.length),a=[],o=0;for(let[t,r]of e.entries())G.hasOwnProperty(r)?i[t]=G[r]:(a.push(r),W.hasOwnProperty(r)||(W[r]=[]),W[r].push(()=>{i[t]=G[r],++o===a.length&&n(i)}));0===a.length&&n(i)},kt=(t,e)=>{for(var r=[],n=0;n<t;n++)r.push(_[e+4*n>>2]);return r},Et=t=>{for(;t.length;){var e=t.pop();t.pop()(e)}};function It(t){for(var e=1;e<t.length;++e)if(null!==t[e]&&void 0===t[e].ob)return!0;return!1}function Ct(t,e,r,n,i,a){var o=e.length;if(2>o)throw new q("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==e[1]&&null!==r,l=It(e);r=!e[0].nc;var c=e[0],u=e[1];for(n=[t,X,n,i,Et,c.jb.bind(c),u?.nb.bind(u)],i=2;i<o;++i)n.push((c=e[i]).nb.bind(c));if(!l)for(i=s?1:2;i<e.length;++i)null!==e[i].ob&&n.push(e[i].ob);for(l=It(e),i=e.length-2,u=[],c=["fn"],s&&c.push("thisWired"),o=0;o<i;++o)u.push(`arg${o}`),c.push(`arg${o}Wired`);u=u.join(","),c=c.join(","),u=`return function (${u}) {\n`,l&&(u+="var destructors = [];\n");var h=l?"destructors":"null",d="humanName throwBindingError invoker fn runDestructors fromRetWire toClassParamWire".split(" ");for(s&&(u+=`var thisWired = toClassParamWire(${h}, this);\n`),o=0;o<i;++o){var f=`toArg${o}Wire`;u+=`var arg${o}Wired = ${f}(${h}, arg${o});\n`,d.push(f)}if(u+=(r||a?"var rv = ":"")+`invoker(${c});\n`,l)u+="runDestructors(destructors);\n";else for(o=s?1:2;o<e.length;++o)a=1===o?"thisWired":"arg"+(o-2)+"Wired",null!==e[o].ob&&(u+=`${a}_dtor(${a});\n`,d.push(`${a}_dtor`));return r&&(u+="var ret = fromRetWire(rv);\nreturn ret;\n"),e=new Function(d,u+"}\n")(...n),nt(t,e)}var Tt=t=>{const e=(t=t.trim()).indexOf("(");return-1===e?t:t.slice(0,e)},Pt=[],Mt=[0,1,,1,null,1,!0,1,!1,1],Ut=t=>{9<t&&0===--Mt[t+1]&&(Mt[t]=void 0,Pt.push(t))},Rt=t=>{if(!t)throw new q(`Cannot use deleted val. handle = ${t}`);return Mt[t]},Ot=t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const e=Pt.pop()||Mt.length;return Mt[e]=t,Mt[e+1]=1,e}},Lt={name:"emscripten::val",jb:t=>{var e=Rt(t);return Ut(t),e},nb:(t,e)=>Ot(e),xb:ft,ob:null},Nt=(t,e)=>{switch(e){case 4:return function(t){return this.jb(A[t>>2])};case 8:return function(t){return this.jb(x[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},Ft=(t,e,r,n)=>{if(!(0<n))return 0;var i=r;n=r+n-1;for(var a=0;a<t.length;++a){var o=t.codePointAt(a);if(127>=o){if(r>=n)break;e[r++]=o}else if(2047>=o){if(r+1>=n)break;e[r++]=192|o>>6,e[r++]=128|63&o}else if(65535>=o){if(r+2>=n)break;e[r++]=224|o>>12,e[r++]=128|o>>6&63,e[r++]=128|63&o}else{if(r+3>=n)break;e[r++]=240|o>>18,e[r++]=128|o>>12&63,e[r++]=128|o>>6&63,e[r++]=128|63&o,a++}}return e[r]=0,r-i},Vt=t=>{for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);127>=n?e++:2047>=n?e+=2:55296<=n&&57343>=n?(e+=4,++r):e+=3}return e},Dt=new TextDecoder("utf-16le"),jt=(t,e,r)=>Dt.decode(y.subarray(t>>=1,B(y,t,e/2,r))),Bt=(t,e,r)=>{if(r??=2147483647,2>r)return 0;var n=e;r=(r-=2)<2*t.length?r/2:t.length;for(var i=0;i<r;++i)g[e>>1]=t.charCodeAt(i),e+=2;return g[e>>1]=0,e-n},zt=t=>2*t.length,Jt=(t,e,r)=>{var n="";t>>=2;for(var i=0;!(i>=e/4);i++){var a=_[t+i];if(!a&&!r)break;n+=String.fromCodePoint(a)}return n},Wt=(t,e,r)=>{if(r??=2147483647,4>r)return 0;var n=e;r=n+r-4;for(var i=0;i<t.length;++i){var a=t.codePointAt(i);if(65535<a&&i++,$[e>>2]=a,(e+=4)+4>r)break}return $[e>>2]=0,e-n},Gt=t=>{for(var e=0,r=0;r<t.length;++r)65535<t.codePointAt(r)&&r++,e+=4;return e},Ht=0,qt=[],Xt=(t,e,r)=>{var n=[];return t=t(n,r),n.length&&(_[e>>2]=Ot(n)),t},Yt={},Kt=t=>{var e=Yt[t];return void 0===e?J(t):e},Qt={},Zt=t=>{p=t,D||0<Ht||(r.onExit?.(t),T=!0),c(t,new O(t))},te=t=>{if(!T)try{if(t(),!(D||0<Ht))try{p=t=p,Zt(t)}catch(t){t instanceof O||"unwind"==t||c(1,t)}}catch(t){t instanceof O||"unwind"==t||c(1,t)}},ee=t=>{var e=Vt(t)+1,r=an(e);return Ft(t,w,r,e),r},re=[],ne=[],ie=t=>{if(t)return re[t>>>0]},ae=t=>z(_[t>>2],_[t+4>>2]),oe=t=>{var e=_[t>>2];return t=_[t+4>>2],e?z(e,t):0===t?"":void 0},se=t=>({width:_[t>>2],height:_[t+4>>2],depthOrArrayLayers:_[t+8>>2]}),le=t=>{var e=t+8;return{texture:ie(_[t>>2]),mipLevel:_[t+4>>2],origin:{x:_[e>>2],y:_[e+4>>2],z:_[e+8>>2]},aspect:Me[_[t+20>>2]]}},ce=(t,e)=>{if(t){for(var r={},n=0;n<t;++n){var i=e+24*n;r[ae(i+4)]=x[i+16>>3]}return r}},ue=t=>t?ie(t):"auto",he=[,"clamp-to-edge","repeat","mirror-repeat"],de=[,"zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1alpha","one-minus-src1alpha"],fe=[,"add","subtract","reverse-subtract","min","max"],pe=["binding-not-used",,"uniform","storage","read-only-storage"],me=[,"never","less","equal","less-equal","greater","not-equal","greater-equal","always"],be=[,"opaque","premultiplied","unpremultiplied","inherit"],ve=[,"none","front","back"],we=[,"compatibility","core"],ge={1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",327692:"chromium-experimental-unorm16-texture-formats",327693:"chromium-experimental-snorm16-texture-formats",327732:"chromium-experimental-multi-draw-indirect"},ye=[,"nearest","linear"],$e=[,"ccw","cw"],_e=[,"uint16","uint32"],Ae=[,"load","clear"],xe=[,"nearest","linear"],Se=[,"low-power","high-performance"],ke=[,"srgb","display-p3"],Ee=[,"point-list","line-list","line-strip","triangle-list","triangle-strip"],Ie=["binding-not-used",,"filtering","non-filtering","comparison"],Ce=[,"keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],Te=["binding-not-used",,"write-only","read-only","read-write"],Pe=[,"store","discard"],Me=[,"all","stencil-only","depth-only"],Ue=[,"1d","2d","3d"],Re=[,"r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32float","r32uint","r32sint","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rgb9e5ufloat","rg32float","rg32uint","rg32sint","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32float","rgba32uint","rgba32sint","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],Oe=["binding-not-used",,"float","unfilterable-float","depth","sint","uint"],Le=[,"1d","2d","2d-array","cube","cube-array","3d"],Ne=[,"standard","extended"],Fe=[,"uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],Ve=[,"vertex","instance"],De={undefined:1,unknown:1,destroyed:2},je=t=>-9007199254740992>t||9007199254740992<t?NaN:Number(t),Be=(t,e)=>{for(var r=0,n=t.length-1;0<=n;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},ze=t=>{var e="/"===t.charAt(0),r="/"===t.slice(-1);return(t=Be(t.split("/").filter(t=>!!t),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},Je=t=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1);return t=e[0],e=e[1],t||e?(e&&=e.slice(0,-1),t+e):"."},We=t=>t&&t.match(/([^\/]+|\/)\/*$/)[1],Ge=t=>{(Ge=(()=>{if(a){var t=o("crypto");return e=>t.randomFillSync(e)}return t=>crypto.getRandomValues(t)})())(t)},He=(...t)=>{for(var e="",r=!1,n=t.length-1;-1<=n&&!r;n--){if("string"!=typeof(r=0<=n?t[n]:Or.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";e=r+"/"+e,r="/"===r.charAt(0)}return e=Be(e.split("/").filter(t=>!!t),!r).join("/"),(r?"/":"")+e||"."},qe=(t,e)=>{function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;0<=r&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=He(t).slice(1),e=He(e).slice(1),t=r(t.split("/")),e=r(e.split("/"));for(var n=Math.min(t.length,e.length),i=n,a=0;a<n;a++)if(t[a]!==e[a]){i=a;break}for(n=[],a=i;a<t.length;a++)n.push("..");return(n=n.concat(e.slice(i))).join("/")},Xe=t=>{var e=B(t,0);return j.decode(t.buffer?t.subarray(0,e):new Uint8Array(t.slice(0,e)))},Ye=[],Ke=t=>{var e=Array(Vt(t)+1);return t=Ft(t,e,0,e.length),e.length=t,e},Qe=[];function Ze(t,e){Qe[t]={input:[],output:[],Gb:e},dr(t,tr)}var tr={open(t){var e=Qe[t.node.rdev];if(!e)throw new Or.Ia(43);t.tty=e,t.seekable=!1},close(t){t.tty.Gb.fsync(t.tty)},fsync(t){t.tty.Gb.fsync(t.tty)},read(t,e,r,n){if(!t.tty||!t.tty.Gb.kc)throw new Or.Ia(60);for(var i=0,a=0;a<n;a++){try{var o=t.tty.Gb.kc(t.tty)}catch(t){throw new Or.Ia(29)}if(void 0===o&&0===i)throw new Or.Ia(6);if(null==o)break;i++,e[r+a]=o}return i&&(t.node.atime=Date.now()),i},write(t,e,r,n){if(!t.tty||!t.tty.Gb.$b)throw new Or.Ia(60);try{for(var i=0;i<n;i++)t.tty.Gb.$b(t.tty,e[r+i])}catch(t){throw new Or.Ia(29)}return n&&(t.node.mtime=t.node.ctime=Date.now()),i}},er={kc(){t:{if(!Ye.length){var t=null;if(a){var e=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=d.readSync(n,e,0,256)}catch(t){if(!t.toString().includes("EOF"))throw t;r=0}0<r&&(t=e.slice(0,r).toString("utf-8"))}else globalThis.window?.prompt&&null!==(t=window.prompt("Input: "))&&(t+="\n");if(!t){t=null;break t}Ye=Ke(t)}t=Ye.shift()}return t},$b(t,e){null===e||10===e?(I(Xe(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(I(Xe(t.output)),t.output=[])},ld:()=>({Xc:25856,Zc:5,Wc:191,Yc:35387,Vc:[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]}),md:()=>0,nd:()=>[24,80]},rr={$b(t,e){null===e||10===e?(C(Xe(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(C(Xe(t.output)),t.output=[])}},nr={tb:null,Wa:()=>nr.createNode(null,"/",16895,0),createNode(t,e,r,n){if(24576==(61440&r)||Or.isFIFO(r))throw new Or.Ia(63);return nr.tb||(nr.tb={dir:{node:{qb:nr.La.qb,sb:nr.La.sb,lookup:nr.La.lookup,vb:nr.La.vb,rename:nr.La.rename,unlink:nr.La.unlink,rmdir:nr.La.rmdir,readdir:nr.La.readdir,symlink:nr.La.symlink},stream:{lb:nr.Ma.lb}},file:{node:{qb:nr.La.qb,sb:nr.La.sb},stream:{lb:nr.Ma.lb,read:nr.Ma.read,write:nr.Ma.write,Fb:nr.Ma.Fb,Kb:nr.Ma.Kb}},link:{node:{qb:nr.La.qb,sb:nr.La.sb,readlink:nr.La.readlink},stream:{}},ec:{node:{qb:nr.La.qb,sb:nr.La.sb},stream:Or.xc}}),fr((r=Or.createNode(t,e,r,n)).mode)?(r.La=nr.tb.dir.node,r.Ma=nr.tb.dir.stream,r.Na={}):Or.isFile(r.mode)?(r.La=nr.tb.file.node,r.Ma=nr.tb.file.stream,r.Ya=0,r.Na=null):40960==(61440&r.mode)?(r.La=nr.tb.link.node,r.Ma=nr.tb.link.stream):8192==(61440&r.mode)&&(r.La=nr.tb.ec.node,r.Ma=nr.tb.ec.stream),r.atime=r.mtime=r.ctime=Date.now(),t&&(t.Na[e]=r,t.atime=t.mtime=t.ctime=r.atime),r},kd:t=>t.Na?t.Na.subarray?t.Na.subarray(0,t.Ya):new Uint8Array(t.Na):new Uint8Array(0),La:{qb(t){var e={};return e.dev=8192==(61440&t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,e.size=fr(t.mode)?4096:Or.isFile(t.mode)?t.Ya:40960==(61440&t.mode)?t.link.length:0,e.atime=new Date(t.atime),e.mtime=new Date(t.mtime),e.ctime=new Date(t.ctime),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},sb(t,e){for(var r of["mode","atime","mtime","ctime"])null!=e[r]&&(t[r]=e[r]);void 0!==e.size&&t.Ya!=(e=e.size)&&(0==e?(t.Na=null,t.Ya=0):(r=t.Na,t.Na=new Uint8Array(e),r&&t.Na.set(r.subarray(0,Math.min(e,t.Ya))),t.Ya=e))},lookup(){throw nr.Tb||(nr.Tb=new Or.Ia(44),nr.Tb.stack="<generic error, no stack>"),nr.Tb},vb:(t,e,r,n)=>nr.createNode(t,e,r,n),rename(t,e,r){try{var n=pr(e,r)}catch(t){}if(n){if(fr(t.mode))for(var i in n.Na)throw new Or.Ia(55);mr(n)}delete t.parent.Na[t.name],e.Na[r]=t,t.name=r,e.ctime=e.mtime=t.parent.ctime=t.parent.mtime=Date.now()},unlink(t,e){delete t.Na[e],t.ctime=t.mtime=Date.now()},rmdir(t,e){var r,n=pr(t,e);for(r in n.Na)throw new Or.Ia(55);delete t.Na[e],t.ctime=t.mtime=Date.now()},readdir:t=>[".","..",...Object.keys(t.Na)],symlink:(t,e,r)=>((t=nr.createNode(t,e,41471,0)).link=r,t),readlink(t){if(40960!=(61440&t.mode))throw new Or.Ia(28);return t.link}},Ma:{read(t,e,r,n,i){var a=t.node.Na;if(i>=t.node.Ya)return 0;if(8<(t=Math.min(t.node.Ya-i,n))&&a.subarray)e.set(a.subarray(i,i+t),r);else for(n=0;n<t;n++)e[r+n]=a[i+n];return t},write(t,e,r,n,i,a){if(e.buffer===v.buffer&&(a=!1),!n)return 0;if((t=t.node).mtime=t.ctime=Date.now(),e.subarray&&(!t.Na||t.Na.subarray)){if(a)return t.Na=e.subarray(r,r+n),t.Ya=n;if(0===t.Ya&&0===i)return t.Na=e.slice(r,r+n),t.Ya=n;if(i+n<=t.Ya)return t.Na.set(e.subarray(r,r+n),i),n}var o=t.Na?t.Na.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=t.Na,t.Na=new Uint8Array(a),0<t.Ya&&t.Na.set(o.subarray(0,t.Ya),0)),t.Na.subarray&&e.subarray)t.Na.set(e.subarray(r,r+n),i);else for(a=0;a<n;a++)t.Na[i+a]=e[r+a];return t.Ya=Math.max(t.Ya,i+n),n},lb(t,e,r){if(1===r?e+=t.position:2===r&&Or.isFile(t.node.mode)&&(e+=t.node.Ya),0>e)throw new Or.Ia(28);return e},Fb(t,e,r,n,i){if(!Or.isFile(t.node.mode))throw new Or.Ia(43);if(t=t.node.Na,2&i||!t||t.buffer!==v.buffer){if(n=!0,R(),!(i=void 0))throw new Or.Ia(48);t&&((0<r||r+e<t.length)&&(t=t.subarray?t.subarray(r,r+e):Array.prototype.slice.call(t,r,r+e)),v.set(t,i))}else n=!1,i=t.byteOffset;return{Va:i,Rc:n}},Kb:(t,e,r,n)=>(nr.Ma.write(t,e,0,n,r,!1),0)}},ir=(t,e)=>{var r=0;return t&&(r|=365),e&&(r|=146),r},ar=0,or=null,sr=()=>{if(ar--,r.monitorRunDependencies?.(ar),0==ar&&or){var t=or;or=null,t()}},lr=()=>{ar++,r.monitorRunDependencies?.(ar)},cr=[],ur=async(t,e,r,n,i,a,o,l)=>{var c=e?He(ze(t+"/"+e)):t;lr();try{var u=r;"string"==typeof r&&(u=await(async t=>(t=await s(t),new Uint8Array(t)))(r)),u=await(async(t,e)=>{for(var r of("undefined"!=typeof Browser&&hr(),cr))if(r.canHandle(e))return r.handle(t,e);return t})(u,c),l?.(),a||br(t,e,u,n,i,o)}finally{sr()}};function hr(){var t,e,n;Or.Vb=!0,t??=r.stdin,e??=r.stdout,n??=r.stderr,t?Or.yb("/dev","stdin",t):Or.symlink("/dev/tty","/dev/stdin"),e?Or.yb("/dev","stdout",null,e):Or.symlink("/dev/tty","/dev/stdout"),n?Or.yb("/dev","stderr",null,n):Or.symlink("/dev/tty1","/dev/stderr"),Or.open("/dev/stdin",0),Or.open("/dev/stdout",1),Or.open("/dev/stderr",1)}function dr(t,e){Or.ic[t]={Ma:e}}function fr(t){return 16384==(61440&t)}function pr(t,e){var r=fr(t.mode)?(r=_r(t,"x"))?r:t.La.lookup?0:2:54;if(r)throw new Or.Ia(r);for(r=Or.wb[gr(t.id,e)];r;r=r.Db)if(r.parent.id===t.id&&r.name===e)return r;return Or.lookup(t,e)}function mr(t){var e=gr(t.parent.id,t.name);if(Or.wb[e]===t)Or.wb[e]=t.Db;else for(e=Or.wb[e];e;){if(e.Db===t){e.Db=t.Db;break}e=e.Db}}function br(t,e,r,n,i,a){var o=e;if(t&&(t="string"==typeof t?t:wr(t),o=e?ze(t+"/"+e):t),t=ir(n,i),o=Or.create(o,t),r){if("string"==typeof r){for(e=Array(r.length),n=0,i=r.length;n<i;++n)e[n]=r.charCodeAt(n);r=e}Or.chmod(o,146|t),e=Or.open(o,577),Or.write(e,r,0,r.length,0,a),Or.close(e),Or.chmod(o,t)}}function vr(t,e={}){if(!t)throw new Or.Ia(44);e.Nb??(e.Nb=!0),"/"===t.charAt(0)||(t=Or.cwd()+"/"+t);var r=0;t:for(;40>r;r++){t=t.split("/").filter(t=>!!t);for(var n=Or.root,i="/",a=0;a<t.length;a++){var o=a===t.length-1;if(o&&e.parent)break;if("."!==t[a])if(".."===t[a]){if(i=Je(i),Or.Xb(n)){t=i+"/"+t.slice(a+1).join("/"),r--;continue t}n=n.parent}else{i=ze(i+"/"+t[a]);try{n=pr(n,t[a])}catch(t){if(44===t?.Bb&&o&&e.Jc)return{path:i};throw t}if(!n.rb||o&&!e.Nb||(n=n.rb.root),40960==(61440&n.mode)&&(!o||e.pb)){if(!n.La.readlink)throw new Or.Ia(52);"/"===(n=n.La.readlink(n)).charAt(0)||(n=Je(i)+"/"+n),t=n+"/"+t.slice(a+1).join("/");continue t}}}return{path:i,node:n}}throw new Or.Ia(32)}function wr(t){for(var e;;){if(Or.Xb(t))return t=t.Wa.oc,e?"/"!==t[t.length-1]?`${t}/${e}`:t+e:t;e=e?`${t.name}/${e}`:t.name,t=t.parent}}function gr(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%Or.wb.length}function yr(t){var e=gr(t.parent.id,t.name);t.Db=Or.wb[e],Or.wb[e]=t}function $r(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e}function _r(t,e){return Or.lc?0:!e.includes("r")||292&t.mode?e.includes("w")&&!(146&t.mode)||e.includes("x")&&!(73&t.mode)?2:0:2}function Ar(t,e){if(!fr(t.mode))return 54;try{return pr(t,e),20}catch(t){}return _r(t,"wx")}function xr(t,e,r){try{var n=pr(t,e)}catch(t){return t.Bb}if(t=_r(t,"wx"))return t;if(r){if(!fr(n.mode))return 54;if(Or.Xb(n)||wr(n)===Or.cwd())return 10}else if(fr(n.mode))return 31;return 0}function Sr(t,e){if(!t)throw new Or.Ia(e);return t}function kr(t){if(!(t=Or.Fc(t)))throw new Or.Ia(8);return t}function Er(t,e=-1){if(t=Object.assign(new Or.uc,t),-1==e)t:{for(e=0;e<=Or.vc;e++)if(!Or.streams[e])break t;throw new Or.Ia(33)}return t.fd=e,Or.streams[e]=t}function Ir(t,e,r){var n=t?.Ma.sb;t=n?t:e,n??=e.La.sb,Sr(n,63),n(t,r)}function Cr(t){var e=[];for(t=[t];t.length;){var r=t.pop();e.push(r),t.push(...r.Jb)}return e}function Tr(t){var e={Uc:4096,gd:4096,blocks:1e6,Tc:5e5,Sc:5e5,files:Or.Zb,dd:Or.Zb-1,hd:42,flags:2,qd:255};return t.La.rc&&Object.assign(e,t.La.rc(t.Wa.Kc.root)),e}function Pr(t,e,r){return void 0===r&&(r=e,e=438),Or.vb(t,8192|e,r)}function Mr(t,e,r,n){Ir(t,e,{mode:4095&r|-4096&e.mode,ctime:Date.now(),jc:n})}function Ur(t,e,r){if(fr(e.mode))throw new Or.Ia(31);if(!Or.isFile(e.mode))throw new Or.Ia(28);var n=_r(e,"w");if(n)throw new Or.Ia(n);Ir(t,e,{size:r,timestamp:Date.now()})}function Rr(t){if(!(t.Hc||t.Ic||t.link||t.Na))if(globalThis.XMLHttpRequest)R("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{t.Na=l(t.url)}catch(t){throw new Or.Ia(29)}}var Or={root:null,Jb:[],ic:{},streams:[],Zb:1,wb:null,fc:"/",Vb:!1,lc:!0,Bc:null,Qb:0,qc:{},Ia:class{name="ErrnoError";constructor(t){this.Bb=t}},uc:class{ub={};node=null;get object(){return this.node}set object(t){this.node=t}get flags(){return this.ub.flags}set flags(t){this.ub.flags=t}get position(){return this.ub.position}set position(t){this.ub.position=t}},tc:class{La={};Ma={};rb=null;constructor(t,e,r,n){t||=this,this.parent=t,this.Wa=t.Wa,this.id=Or.Zb++,this.name=e,this.mode=r,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return!(365&~this.mode)}set read(t){t?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(t){t?this.mode|=146:this.mode&=-147}get Ic(){return fr(this.mode)}get Hc(){return 8192==(61440&this.mode)}},createNode:(t,e,r,n)=>(yr(t=new Or.tc(t,e,r,n)),t),Xb:t=>t===t.parent,isFile:t=>32768==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>!(49152&~t),vc:4096,Fc:t=>Or.streams[t],cd:(t,e=-1)=>(t=Er(t,e),t.Ma?.bd?.(t),t),xc:{open(t){t.Ma=Or.Dc(t.node.rdev).Ma,t.Ma.open?.(t)},lb(){throw new Or.Ia(70)}},Yb:t=>t>>8,od:t=>255&t,Cb:(t,e)=>t<<8|e,Dc:t=>Or.ic[t],sc(t,e){function r(t){return Or.Qb--,e(t)}function n(t){if(t){if(!n.Ac)return n.Ac=!0,r(t)}else++o>=a.length&&r(null)}"function"==typeof t&&(e=t,t=!1),Or.Qb++,1<Or.Qb&&C(`warning: ${Or.Qb} FS.syncfs operations in flight at once, probably just doing extra work`);var i,a=Cr(Or.root.Wa),o=0;for(i of a)i.type.sc?i.type.sc(i,t,n):n(null)},Wa(t,e,r){var n="/"===r;if(n&&Or.root)throw new Or.Ia(10);if(!n&&r){var i=vr(r,{Nb:!1});if(r=i.path,(i=i.node).rb)throw new Or.Ia(10);if(!fr(i.mode))throw new Or.Ia(54)}return(t=t.Wa(e={type:t,Kc:e,oc:r,Jb:[]})).Wa=e,e.root=t,n?Or.root=t:i&&(i.rb=e,i.Wa&&i.Wa.Jb.push(e)),t},xd(t){if(!(t=vr(t,{Nb:!1})).node.rb)throw new Or.Ia(28);var e=(t=t.node).rb,r=Cr(e);for([,i]of Object.entries(Or.wb))for(;i;){var n=i.Db;r.includes(i.Wa)&&mr(i);var i=n}t.rb=null,t.Wa.Jb.splice(t.Wa.Jb.indexOf(e),1)},lookup:(t,e)=>t.La.lookup(t,e),vb(t,e,r){var n=vr(t,{parent:!0}).node;if(!(t=We(t)))throw new Or.Ia(28);if("."===t||".."===t)throw new Or.Ia(20);var i=Ar(n,t);if(i)throw new Or.Ia(i);if(!n.La.vb)throw new Or.Ia(63);return n.La.vb(n,t,e,r)},rc:t=>Tr(vr(t,{pb:!0}).node),td:t=>Tr(t.node),create:(t,e=438)=>Or.vb(t,4095&e|32768,0),mkdir:(t,e=511)=>Or.vb(t,1023&e|16384,0),pd(t,e){var r,n=t.split("/"),i="";for(r of n)if(r){(i||"/"===t.charAt(0))&&(i+="/"),i+=r;try{Or.mkdir(i,e)}catch(t){if(20!=t.Bb)throw t}}},symlink(t,e){if(!He(t))throw new Or.Ia(44);var r=vr(e,{parent:!0}).node;if(!r)throw new Or.Ia(44);var n=Ar(r,e=We(e));if(n)throw new Or.Ia(n);if(!r.La.symlink)throw new Or.Ia(63);return r.La.symlink(r,e,t)},rename(t,e){var r=Je(t),n=Je(e),i=We(t),a=We(e),o=vr(t,{parent:!0}),s=o.node;if(o=(o=vr(e,{parent:!0})).node,!s||!o)throw new Or.Ia(44);if(s.Wa!==o.Wa)throw new Or.Ia(75);var l=pr(s,i);if("."!==(t=qe(t,n)).charAt(0))throw new Or.Ia(28);if("."!==(t=qe(e,r)).charAt(0))throw new Or.Ia(55);try{var c=pr(o,a)}catch(t){}if(l!==c){if(i=xr(s,i,e=fr(l.mode)))throw new Or.Ia(i);if(i=c?xr(o,a,e):Ar(o,a))throw new Or.Ia(i);if(!s.La.rename)throw new Or.Ia(63);if(l.rb||c&&c.rb)throw new Or.Ia(10);if(o!==s&&(i=_r(s,"w")))throw new Or.Ia(i);mr(l);try{s.La.rename(l,o,a),l.parent=o}catch(t){throw t}finally{yr(l)}}},rmdir(t){var e=vr(t,{parent:!0}).node,r=pr(e,t=We(t)),n=xr(e,t,!0);if(n)throw new Or.Ia(n);if(!e.La.rmdir)throw new Or.Ia(63);if(r.rb)throw new Or.Ia(10);e.La.rmdir(e,t),mr(r)},readdir:t=>Sr((t=vr(t,{pb:!0}).node).La.readdir,54)(t),unlink(t){var e=vr(t,{parent:!0}).node;if(!e)throw new Or.Ia(44);var r=pr(e,t=We(t)),n=xr(e,t,!1);if(n)throw new Or.Ia(n);if(!e.La.unlink)throw new Or.Ia(63);if(r.rb)throw new Or.Ia(10);e.La.unlink(e,t),mr(r)},readlink(t){if(!(t=vr(t).node))throw new Or.Ia(44);if(!t.La.readlink)throw new Or.Ia(28);return t.La.readlink(t)},stat:(t,e)=>Sr((t=vr(t,{pb:!e}).node).La.qb,63)(t),fstat(t){var e=kr(t);t=e.node;var r=e.Ma.qb;return e=r?e:t,r??=t.La.qb,Sr(r,63),r(e)},lstat:t=>Or.stat(t,!0),chmod(t,e,r){Mr(null,t="string"==typeof t?vr(t,{pb:!r}).node:t,e,r)},lchmod(t,e){Or.chmod(t,e,!0)},fchmod(t,e){Mr(t=kr(t),t.node,e,!1)},chown(t,e,r,n){Ir(null,t="string"==typeof t?vr(t,{pb:!n}).node:t,{timestamp:Date.now(),jc:n})},lchown(t,e,r){Or.chown(t,e,r,!0)},fchown(t){Ir(t=kr(t),t.node,{timestamp:Date.now(),jc:!1})},truncate(t,e){if(0>e)throw new Or.Ia(28);Ur(null,t="string"==typeof t?vr(t,{pb:!0}).node:t,e)},jd(t,e){if(t=kr(t),0>e||!(2097155&t.flags))throw new Or.Ia(28);Ur(t,t.node,e)},yd(t,e,r){Sr((t=vr(t,{pb:!0}).node).La.sb,63)(t,{atime:e,mtime:r})},open(t,e,n=438){if(""===t)throw new Or.Ia(44);if("string"==typeof e){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===i)throw Error(`Unknown file open mode: ${e}`);e=i}if(n=64&e?4095&n|32768:0,"object"==typeof t)i=t;else{var a=t.endsWith("/");i=(t=vr(t,{pb:!(131072&e),Jc:!0})).node,t=t.path}var o=!1;if(64&e)if(i){if(128&e)throw new Or.Ia(20)}else{if(a)throw new Or.Ia(31);i=Or.vb(t,511|n,0),o=!0}if(!i)throw new Or.Ia(44);if(8192==(61440&i.mode)&&(e&=-513),65536&e&&!fr(i.mode))throw new Or.Ia(54);if(!o&&(a=i?40960==(61440&i.mode)?32:fr(i.mode)&&("r"!==$r(e)||576&e)?31:_r(i,$r(e)):44))throw new Or.Ia(a);return 512&e&&!o&&Or.truncate(i,0),e&=-131713,(a=Er({node:i,path:wr(i),flags:e,seekable:!0,position:0,Ma:i.Ma,Qc:[],error:!1})).Ma.open&&a.Ma.open(a),o&&Or.chmod(i,511&n),!r.logReadFiles||1&e||t in Or.qc||(Or.qc[t]=1),a},close(t){if(null===t.fd)throw new Or.Ia(8);t.Ub&&(t.Ub=null);try{t.Ma.close&&t.Ma.close(t)}catch(t){throw t}finally{Or.streams[t.fd]=null}t.fd=null},lb(t,e,r){if(null===t.fd)throw new Or.Ia(8);if(!t.seekable||!t.Ma.lb)throw new Or.Ia(70);if(0!=r&&1!=r&&2!=r)throw new Or.Ia(28);return t.position=t.Ma.lb(t,e,r),t.Qc=[],t.position},read(t,e,r,n,i){if(0>n||0>i)throw new Or.Ia(28);if(null===t.fd)throw new Or.Ia(8);if(1==(2097155&t.flags))throw new Or.Ia(8);if(fr(t.node.mode))throw new Or.Ia(31);if(!t.Ma.read)throw new Or.Ia(28);var a=void 0!==i;if(a){if(!t.seekable)throw new Or.Ia(70)}else i=t.position;return e=t.Ma.read(t,e,r,n,i),a||(t.position+=e),e},write(t,e,r,n,i,a){if(0>n||0>i)throw new Or.Ia(28);if(null===t.fd)throw new Or.Ia(8);if(!(2097155&t.flags))throw new Or.Ia(8);if(fr(t.node.mode))throw new Or.Ia(31);if(!t.Ma.write)throw new Or.Ia(28);t.seekable&&1024&t.flags&&Or.lb(t,0,2);var o=void 0!==i;if(o){if(!t.seekable)throw new Or.Ia(70)}else i=t.position;return e=t.Ma.write(t,e,r,n,i,a),o||(t.position+=e),e},Fb(t,e,r,n,i){if(2&n&&!(2&i)&&2!=(2097155&t.flags))throw new Or.Ia(2);if(1==(2097155&t.flags))throw new Or.Ia(2);if(!t.Ma.Fb)throw new Or.Ia(43);if(!e)throw new Or.Ia(28);return t.Ma.Fb(t,e,r,n,i)},Kb:(t,e,r,n,i)=>t.Ma.Kb?t.Ma.Kb(t,e,r,n,i):0,mc(t,e,r){if(!t.Ma.mc)throw new Or.Ia(59);return t.Ma.mc(t,e,r)},readFile(t,e={}){e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding&&R(`Invalid encoding type "${e.encoding}"`);var r=Or.open(t,e.flags);t=Or.stat(t).size;var n=new Uint8Array(t);return Or.read(r,n,0,t,0),"utf8"===e.encoding&&(n=Xe(n)),Or.close(r),n},writeFile(t,e,r={}){r.flags=r.flags||577,t=Or.open(t,r.flags,r.mode),"string"==typeof e&&(e=new Uint8Array(Ke(e))),ArrayBuffer.isView(e)?Or.write(t,e,0,e.byteLength,void 0,r