@thorvg/lottie-player
Version:
A web lottie player using ThorVG as a renderer
1 lines • 67.4 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["lottie-player"]={})}(this,(function(t){"use strict";var e="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(t,e,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&a.set(e,t))}return t}toString(){return this.cssText}};const s=(t,e)=>{if(n)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),i=r.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=n.cssText,t.appendChild(e)}},h=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:l,defineProperty:u,getOwnPropertyDescriptor:c,getOwnPropertyNames:d,getOwnPropertySymbols:f,getPrototypeOf:p}=Object,w=globalThis,m=w.trustedTypes,v=m?m.emptyScript:"",y=w.reactiveElementPolyfillSupport,g=(t,e)=>t,b={toAttribute(t,e){switch(e){case Boolean:t=t?v: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}},$=(t,e)=>!l(t,e),_={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:$};Symbol.metadata??=Symbol("metadata"),w.litPropertyMetadata??=new WeakMap;class A 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=_){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);void 0!==n&&u(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:i}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return n?.call(this)},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)??_}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,e=[...d(t),...f(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(h(t))}else void 0!==t&&e.push(h(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 t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(t,this.constructor.elementStyles),t}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)}_$EC(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:b).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:b;this._$Em=n,this[n]=i.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){if(r??=this.constructor.getPropertyOptions(t),!(r.hasChanged??$)(this[t],e))return;this.P(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){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)!0!==r.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],r)}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._$EU()}catch(e){throw t=!1,this._$EU(),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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[g("elementProperties")]=new Map,A[g("finalized")]=new Map,y?.({ReactiveElement:A}),(w.reactiveElementVersions??=[]).push("2.0.4");const S={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:$},E=(t=S,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),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)},init(e){return void 0!==e&&this.P(n,void 0,t),e}}}if("setter"===n){const{name:n}=r;return function(r){const i=this[n];e.call(this,r),this.requestUpdate(n,i,t)}}throw Error("Unsupported decorator location: "+n)};function L(t){return(e,r)=>"object"==typeof r?E(t,e,r):((t,e,r)=>{const n=e.hasOwnProperty(r);return e.constructor.createProperty(r,n?{...t,wrapped:!0}:t),n?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)}const T=globalThis,P=T.trustedTypes,k=P?P.createPolicy("lit-html",{createHTML:t=>t}):void 0,R="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,U="?"+O,M=`<${U}>`,C=document,N=()=>C.createComment(""),x=t=>null===t||"object"!=typeof t&&"function"!=typeof t,F=Array.isArray,j="[ \t\n\f\r]",V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,z=/-->/g,D=/>/g,I=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,W=/"/g,B=/^(?:script|style|textarea|title)$/i,G=(t,...e)=>({_$litType$:1,strings:t,values:e}),q=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),Z=new WeakMap,Y=C.createTreeWalker(C,129);function J(t,e){if(!F(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==k?k.createHTML(e):e}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,[h,l]=((t,e)=>{const r=t.length-1,n=[];let i,a=2===e?"<svg>":3===e?"<math>":"",o=V;for(let e=0;e<r;e++){const r=t[e];let s,h,l=-1,u=0;for(;u<r.length&&(o.lastIndex=u,h=o.exec(r),null!==h);)u=o.lastIndex,o===V?"!--"===h[1]?o=z:void 0!==h[1]?o=D:void 0!==h[2]?(B.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=I):void 0!==h[3]&&(o=I):o===I?">"===h[0]?(o=i??V,l=-1):void 0===h[1]?l=-2:(l=o.lastIndex-h[2].length,s=h[1],o=void 0===h[3]?I:'"'===h[3]?W:H):o===W||o===H?o=I:o===z||o===D?o=V:(o=I,i=void 0);const c=o===I&&t[e+1].startsWith("/>")?" ":"";a+=o===V?r+M:l>=0?(n.push(s),r.slice(0,l)+R+r.slice(l)+O+c):r+O+(-2===l?e:c)}return[J(t,a+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]})(t,e);if(this.el=K.createElement(h,r),Y.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=Y.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(R)){const e=l[a++],r=n.getAttribute(t).split(O),o=/([.?@])?(.*)/.exec(e);s.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?nt:"?"===o[1]?it:"@"===o[1]?at:rt}),n.removeAttribute(t)}else t.startsWith(O)&&(s.push({type:6,index:i}),n.removeAttribute(t));if(B.test(n.tagName)){const t=n.textContent.split(O),e=t.length-1;if(e>0){n.textContent=P?P.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],N()),Y.nextNode(),s.push({type:2,index:++i});n.append(t[e],N())}}}else if(8===n.nodeType)if(n.data===U)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(O,t+1));)s.push({type:7,index:i}),t+=O.length-1}i++}}static createElement(t,e){const r=C.createElement("template");return r.innerHTML=t,r}}function Q(t,e,r=t,n){if(e===q)return e;let i=void 0!==n?r.o?.[n]:r.l;const a=x(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.o??=[])[n]=i:r.l=i),void 0!==i&&(e=Q(t,i._$AS(t,e.values),i,n)),e}class tt{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??C).importNode(e,!0);Y.currentNode=n;let i=Y.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let e;2===s.type?e=new et(i,i.nextSibling,this,t):1===s.type?e=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(e=new ot(i,this,t)),this._$AV.push(e),s=r[++o]}a!==s?.index&&(i=Y.nextNode(),a++)}return Y.currentNode=C,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 et{get _$AU(){return this._$AM?._$AU??this.v}constructor(t,e,r,n){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this.v=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),x(t)?t===X||null==t||""===t?(this._$AH!==X&&this._$AR(),this._$AH=X):t!==this._$AH&&t!==q&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>F(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!==X&&x(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.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(J(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new tt(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=Z.get(t.strings);return void 0===e&&Z.set(t.strings,e=new K(t)),e}k(t){F(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 et(this.O(N()),this.O(N()),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&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this.v=t,this._$AP?.(t))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=X,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=X}_$AI(t,e=this,r,n){const i=this.strings;let a=!1;if(void 0===i)t=Q(this,t,e,0),a=!x(t)||t!==this._$AH&&t!==q,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===q&&(s=this._$AH[o]),a||=!x(s)||s!==this._$AH[o],s===X?t=X:t!==X&&(t+=(s??"")+i[o+1]),this._$AH[o]=s}a&&!n&&this.j(t)}j(t){t===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class nt extends rt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===X?void 0:t}}class it extends rt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==X)}}class at extends rt{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)??X)===q)return;const r=this._$AH,n=t===X&&r!==X||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==X&&(r===X||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 ot{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 st=T.litHtmlPolyfillSupport;st?.(K,et),(T.litHtmlVersions??=[]).push("3.2.0");class ht extends A{constructor(){super(...arguments),this.renderOptions={host:this},this.o=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.o=((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 et(e.insertBefore(N(),t),t,void 0,r??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return q}}ht._$litElement$=!0,ht.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ht});const lt=globalThis.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}lt?.({LitElement:ht}),(globalThis.litElementVersions??=[]).push("4.1.0");let ct=null,dt=!1;var ft,pt,wt,mt,vt,yt;!function(t){t.SW="sw",t.WG="wg",t.GL="gl"}(ft||(ft={})),function(t){t.IDLE="idle",t.FAILED="failed",t.REQUESTED="requested",t.INITIALIZED="initialized"}(pt||(pt={})),function(t){t.JSON="json",t.LOT="lot",t.JPG="jpg",t.PNG="png",t.SVG="svg"}(wt||(wt={})),function(t){t.Destroyed="destroyed",t.Error="error",t.Loading="loading",t.Paused="paused",t.Playing="playing",t.Stopped="stopped",t.Frozen="frozen"}(mt||(mt={})),function(t){t.Bounce="bounce",t.Normal="normal"}(vt||(vt={})),function(t){t.Complete="complete",t.Destroyed="destroyed",t.Error="error",t.Frame="frame",t.Freeze="freeze",t.Load="load",t.Loop="loop",t.Pause="pause",t.Play="play",t.Ready="ready",t.Stop="stop"}(yt||(yt={}));const gt=t=>new Promise((e=>setTimeout(e,t)));let bt="idle";class $t extends ht{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])}TVG=null;canvas;config;_imageData;_beginTime=Date.now();_counter=1;_timer;_observer;_observable=!1;async _init(){if(dt)for(;!ct;)await gt(100);if(ct||(dt=!0,ct=await async function(t={}){var r,n=t,i=!!globalThis.window,a=!!globalThis.WorkerGlobalScope,o=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(o){const{createRequire:t}=await Promise.resolve().then((function(){return St}));var s=t("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("lottie-player.js",document.baseURI).href)}var h,l,u=(t,e)=>{throw e},c="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("lottie-player.js",document.baseURI).href,d="";if(o){var f=s("fs");c.startsWith("file:")&&(d=s("path").dirname(s("url").fileURLToPath(c))+"/"),l=t=>(t=U(t)?new URL(t):t,f.readFileSync(t)),h=async t=>(t=U(t)?new URL(t):t,f.readFileSync(t,void 0)),process.argv.slice(2),u=(t,e)=>{throw process.exitCode=t,e}}else if(i||a){try{d=new URL(".",c).href}catch{}a&&(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),h=async t=>{if(U(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 p,w,m,v,y,g,b,$,_,A,S,E,L,T,P,k=void 0,R=void 0,O=!1,U=t=>t.startsWith("file://"),M=!1;function C(){var t=Ke.buffer;y=new Int8Array(t),b=new Int16Array(t),g=new Uint8Array(t),$=new Uint16Array(t),_=new Int32Array(t),A=new Uint32Array(t),S=new Float32Array(t),E=new Float64Array(t),L=new BigInt64Array(t),T=new BigUint64Array(t)}function N(t){throw n.onAbort?.(t),R(t="Aborted("+t+")"),O=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),v?.(t),t}class x{name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var F=t=>{for(;0<t.length;)t.shift()(n)},j=[],V=[],z=()=>{var t=n.preRun.shift();V.push(t)},D=!0,I=t=>{for(var e="";;){var r=g[t++];if(!r)return e;e+=String.fromCharCode(r)}},H={},W={},B={},G=class extends Error{constructor(t){super(t),this.name="BindingError"}},q=t=>{throw new G(t)};function X(t,e,r={}){return function(t,e,r={}){var n=e.name;if(!t)throw new G(`type "${n}" must have a positive integer typeid pointer`);if(W.hasOwnProperty(t)){if(r.vb)return;throw new G(`Cannot register type '${n}' twice`)}W[t]=e,delete B[t],H.hasOwnProperty(t)&&(e=H[t],delete H[t],e.forEach((t=>t())))}(t,e,r)}var Z=(t,e,r)=>{switch(e){case 1:return r?t=>y[t]:t=>g[t];case 2:return r?t=>b[t>>1]:t=>$[t>>1];case 4:return r?t=>_[t>>2]:t=>A[t>>2];case 8:return r?t=>L[t>>3]:t=>T[t>>3];default:throw new TypeError(`invalid integer width (${e}): ${t}`)}},Y=t=>{throw new G(t.M.U.R.name+" instance already deleted")},J=!1,K=()=>{},Q=t=>globalThis.FinalizationRegistry?(J=new FinalizationRegistry((t=>{--(t=t.M).count.value,0===t.count.value&&(t.X?t.aa.oa(t.X):t.U.R.oa(t.S))})),Q=t=>{var e=t.M;return e.X&&J.register(t,{M:e},t),t},K=t=>{J.unregister(t)},Q(t)):(Q=t=>t,t);function tt(){}var et=(t,e)=>Object.defineProperty(e,"name",{value:t}),rt={},nt=(t,e,r)=>{if(void 0===t[e].W){var n=t[e];t[e]=function(...n){if(!t[e].W.hasOwnProperty(n.length))throw new G(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${t[e].W})!`);return t[e].W[n.length].apply(this,n)},t[e].W=[],t[e].W[n.wa]=n}},it=(t,e,r)=>{if(n.hasOwnProperty(t)){if(void 0===r||void 0!==n[t].W&&void 0!==n[t].W[r])throw new G(`Cannot register public name '${t}' twice`);if(nt(n,t,t),n[t].W.hasOwnProperty(r))throw new G(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`);n[t].W[r]=e}else n[t]=e,n[t].wa=r};function at(t,e,r,n,i,a,o,s){this.name=t,this.constructor=e,this.ta=r,this.oa=n,this.Z=i,this.rb=a,this.Ba=o,this.ob=s,this.Bb=[]}var ot=(t,e,r)=>{for(;e!==r;){if(!e.Ba)throw new G(`Expected null or instance of ${r.name}, got an instance of ${e.name}`);t=e.Ba(t),e=e.Z}return t},st=t=>{if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t};function ht(t,e){if(null===e){if(this.La)throw new G(`null is not a valid ${this.name}`);return 0}if(!e.M)throw new G(`Cannot pass "${st(e)}" as a ${this.name}`);if(!e.M.S)throw new G(`Cannot pass deleted object as a pointer of type ${this.name}`);return ot(e.M.S,e.M.U.R,this.R)}function lt(t,e){if(null===e){if(this.La)throw new G(`null is not a valid ${this.name}`);if(this.Ea){var r=this.Cb();return null!==t&&t.push(this.oa,r),r}return 0}if(!e||!e.M)throw new G(`Cannot pass "${st(e)}" as a ${this.name}`);if(!e.M.S)throw new G(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Da&&e.M.U.Da)throw new G(`Cannot convert argument of type ${e.M.aa?e.M.aa.name:e.M.U.name} to parameter type ${this.name}`);if(r=ot(e.M.S,e.M.U.R,this.R),this.Ea){if(void 0===e.M.X)throw new G("Passing raw pointer to smart pointer is illegal");switch(this.Eb){case 0:if(e.M.aa!==this)throw new G(`Cannot convert argument of type ${e.M.aa?e.M.aa.name:e.M.U.name} to parameter type ${this.name}`);r=e.M.X;break;case 1:r=e.M.X;break;case 2:if(e.M.aa===this)r=e.M.X;else{var n=e.clone();r=this.Db(r,Mt((()=>n.delete()))),null!==t&&t.push(this.oa,r)}break;default:throw new G("Unsupporting sharing policy")}}return r}function ut(t,e){if(null===e){if(this.La)throw new G(`null is not a valid ${this.name}`);return 0}if(!e.M)throw new G(`Cannot pass "${st(e)}" as a ${this.name}`);if(!e.M.S)throw new G(`Cannot pass deleted object as a pointer of type ${this.name}`);if(e.M.U.Da)throw new G(`Cannot convert argument of type ${e.M.U.name} to parameter type ${this.name}`);return ot(e.M.S,e.M.U.R,this.R)}function ct(t){return this.Y(A[t>>2])}var dt=(t,e,r)=>e===r?t:void 0===r.Z||null===(t=dt(t,e,r.Z))?null:r.ob(t),ft={},pt=class extends Error{constructor(t){super(t),this.name="InternalError"}},wt=(t,e)=>{if(!e.U||!e.S)throw new pt("makeClassHandle requires ptr and ptrType");if(!!e.aa!=!!e.X)throw new pt("Both smartPtrType and smartPtr must be specified");return e.count={value:1},Q(Object.create(t,{M:{value:e,writable:!0}}))};function mt(t,e,r,n,i,a,o,s,h,l,u){this.name=t,this.R=e,this.La=r,this.Da=n,this.Ea=i,this.Ab=a,this.Eb=o,this.eb=s,this.Cb=h,this.Db=l,this.oa=u,i||void 0!==e.Z?this.ba=lt:(this.ba=n?ht:ut,this.da=null)}var vt=(t,e,r)=>{if(!n.hasOwnProperty(t))throw new pt("Replacing nonexistent public symbol");void 0!==n[t].W&&void 0!==r?n[t].W[r]=e:(n[t]=e,n[t].wa=r)},yt=(t,e)=>{t=I(t);var r=Qe.get(e);if("function"!=typeof r)throw new G(`unknown function pointer with signature ${t}: ${e}`);return r};class gt extends Error{}var bt=t=>{t=Ye(t);var e=I(t);return Xe(t),e},$t=(t,e)=>{var r=[],n={};throw e.forEach((function t(e){n[e]||W[e]||(B[e]?B[e].forEach(t):(r.push(e),n[e]=!0))})),new gt(`${t}: `+r.map(bt).join([", "]))},_t=(t,e,r)=>{function n(e){if((e=r(e)).length!==t.length)throw new pt("Mismatched type converter count");for(var n=0;n<t.length;++n)X(t[n],e[n])}t.forEach((t=>B[t]=e));var i=Array(e.length),a=[],o=0;e.forEach(((t,e)=>{W.hasOwnProperty(t)?i[e]=W[t]:(a.push(t),H.hasOwnProperty(t)||(H[t]=[]),H[t].push((()=>{i[e]=W[t],++o===a.length&&n(i)})))})),0===a.length&&n(i)},At=(t,e)=>{for(var r=[],n=0;n<t;n++)r.push(A[e+4*n>>2]);return r},Et=t=>{for(;t.length;){var e=t.pop();t.pop()(e)}};function Lt(t){for(var e=1;e<t.length;++e)if(null!==t[e]&&void 0===t[e].da)return!0;return!1}function Tt(t,e,r,n,i,a){var o=e.length;if(2>o)throw new G("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==e[1]&&null!==r,h=Lt(e);r=!e[0].bb;var l=e[0],u=e[1];for(n=[t,q,n,i,Et,l.Y.bind(l),u?.ba.bind(u)],i=2;i<o;++i)n.push((l=e[i]).ba.bind(l));if(!h)for(i=s?1:2;i<e.length;++i)null!==e[i].da&&n.push(e[i].da);for(h=Lt(e),i=e.length-2,u=[],l=["fn"],s&&l.push("thisWired"),o=0;o<i;++o)u.push(`arg${o}`),l.push(`arg${o}Wired`);u=u.join(","),l=l.join(","),u=`return function (${u}) {\n`,h&&(u+="var destructors = [];\n");var c=h?"destructors":"null",d="humanName throwBindingError invoker fn runDestructors fromRetWire toClassParamWire".split(" ");for(s&&(u+=`var thisWired = toClassParamWire(${c}, this);\n`),o=0;o<i;++o){var f=`toArg${o}Wire`;u+=`var arg${o}Wired = ${f}(${c}, arg${o});\n`,d.push(f)}if(u+=(r||a?"var rv = ":"")+`invoker(${l});\n`,h)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].da&&(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),et(t,e)}var Pt=t=>{const e=(t=t.trim()).indexOf("(");return-1===e?t:t.slice(0,e)},kt=[],Rt=[0,1,,1,null,1,!0,1,!1,1],Ot=t=>{9<t&&0==--Rt[t+1]&&(Rt[t]=void 0,kt.push(t))},Ut=t=>{if(!t)throw new G(`Cannot use deleted val. handle = ${t}`);return Rt[t]},Mt=t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const e=kt.pop()||Rt.length;return Rt[e]=t,Rt[e+1]=1,e}},Ct={name:"emscripten::val",Y:t=>{var e=Ut(t);return Ot(t),e},ba:(t,e)=>Mt(e),ma:ct,da:null},Nt=(t,e)=>{switch(e){case 4:return function(t){return this.Y(S[t>>2])};case 8:return function(t){return this.Y(E[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},xt=(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},Ft=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},jt=new TextDecoder,Vt=(t,e,r,n)=>{if(r=e+r,n)return r;for(;t[e]&&!(e>=r);)++e;return e},zt=new TextDecoder("utf-16le"),Dt=(t,e,r)=>zt.decode($.subarray(t>>=1,Vt($,t,e/2,r))),It=(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)b[e>>1]=t.charCodeAt(i),e+=2;return b[e>>1]=0,e-n},Ht=t=>2*t.length,Wt=(t,e,r)=>{var n="";t>>=2;for(var i=0;!(i>=e/4);i++){var a=A[t+i];if(!a&&!r)break;n+=String.fromCodePoint(a)}return n},Bt=(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},qt=0,Xt=[],Zt=(t,e,r)=>{var n=[];return t=t(n,r),n.length&&(A[e>>2]=Mt(n)),t},Yt={},Jt=t=>{var e=Yt[t];return void 0===e?I(t):e},Kt={},Qt=t=>{w=t,D||0<qt||(n.onExit?.(t),O=!0),u(t,new x(t))},te=(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},ee=t=>{var e="/"===t.charAt(0),r="/"===t.slice(-1);return(t=te(t.split("/").filter((t=>!!t)),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},re=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):"."},ne=t=>t&&t.match(/([^\/]+|\/)\/*$/)[1],ie=t=>{(ie=(()=>{if(o){var t=s("crypto");return e=>t.randomFillSync(e)}return t=>crypto.getRandomValues(t)})())(t)},ae=(...t)=>{for(var e="",r=!1,n=t.length-1;-1<=n&&!r;n--){if("string"!=typeof(r=0<=n?t[n]:qe.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";e=r+"/"+e,r="/"===r.charAt(0)}return e=te(e.split("/").filter((t=>!!t)),!r).join("/"),(r?"/":"")+e||"."},oe=(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=ae(t).slice(1),e=ae(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("/")},se=t=>{var e=Vt(t,0);return jt.decode(t.buffer?t.subarray(0,e):new Uint8Array(t.slice(0,e)))},he=[],le=t=>{var e=Array(Ft(t)+1);return t=xt(t,e,0,e.length),e.length=t,e},ue=[];function ce(t,e){ue[t]={input:[],output:[],va:e},Se(t,de)}var de={open(t){var e=ue[t.node.rdev];if(!e)throw new qe.L(43);t.tty=e,t.seekable=!1},close(t){t.tty.va.fsync(t.tty)},fsync(t){t.tty.va.fsync(t.tty)},read(t,e,r,n){if(!t.tty||!t.tty.va.Za)throw new qe.L(60);for(var i=0,a=0;a<n;a++){try{var o=t.tty.va.Za(t.tty)}catch(t){throw new qe.L(29)}if(void 0===o&&0===i)throw new qe.L(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.va.Pa)throw new qe.L(60);try{for(var i=0;i<n;i++)t.tty.va.Pa(t.tty,e[r+i])}catch(t){throw new qe.L(29)}return n&&(t.node.mtime=t.node.ctime=Date.now()),i}},fe={Za(){t:{if(!he.length){var t=null;if(o){var e=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=f.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}he=le(t)}t=he.shift()}return t},Pa(t,e){null===e||10===e?(k(se(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(k(se(t.output)),t.output=[])},Zb:()=>({Mb:25856,Ob:5,Lb:191,Nb:35387,Kb:[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]}),$b:()=>0,ac:()=>[24,80]},pe={Pa(t,e){null===e||10===e?(R(se(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(R(se(t.output)),t.output=[])}},we={ja:null,T:()=>we.createNode(null,"/",16895,0),createNode(t,e,r,n){if(24576==(61440&r)||qe.isFIFO(r))throw new qe.L(63);return we.ja||(we.ja={dir:{node:{fa:we.N.fa,ha:we.N.ha,lookup:we.N.lookup,la:we.N.la,rename:we.N.rename,unlink:we.N.unlink,rmdir:we.N.rmdir,readdir:we.N.readdir,symlink:we.N.symlink},stream:{$:we.O.$}},file:{node:{fa:we.N.fa,ha:we.N.ha},stream:{$:we.O.$,read:we.O.read,write:we.O.write,ua:we.O.ua,za:we.O.za}},link:{node:{fa:we.N.fa,ha:we.N.ha,readlink:we.N.readlink},stream:{}},Ua:{node:{fa:we.N.fa,ha:we.N.ha},stream:qe.mb}}),Ee((r=qe.createNode(t,e,r,n)).mode)?(r.N=we.ja.dir.node,r.O=we.ja.dir.stream,r.P={}):qe.isFile(r.mode)?(r.N=we.ja.file.node,r.O=we.ja.file.stream,r.V=0,r.P=null):40960==(61440&r.mode)?(r.N=we.ja.link.node,r.O=we.ja.link.stream):8192==(61440&r.mode)&&(r.N=we.ja.Ua.node,r.O=we.ja.Ua.stream),r.atime=r.mtime=r.ctime=Date.now(),t&&(t.P[e]=r,t.atime=t.mtime=t.ctime=r.atime),r},Yb:t=>t.P?t.P.subarray?t.P.subarray(0,t.V):new Uint8Array(t.P):new Uint8Array(0),N:{fa(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=Ee(t.mode)?4096:qe.isFile(t.mode)?t.V: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},ha(t,e){for(var r of["mode","atime","mtime","ctime"])null!=e[r]&&(t[r]=e[r]);void 0!==e.size&&t.V!=(e=e.size)&&(0==e?(t.P=null,t.V=0):(r=t.P,t.P=new Uint8Array(e),r&&t.P.set(r.subarray(0,Math.min(e,t.V))),t.V=e))},lookup(){throw we.Ia||(we.Ia=new qe.L(44),we.Ia.stack="<generic error, no stack>"),we.Ia},la:(t,e,r,n)=>we.createNode(t,e,r,n),rename(t,e,r){try{var n=Le(e,r)}catch(t){}if(n){if(Ee(t.mode))for(var i in n.P)throw new qe.L(55);Te(n)}delete t.parent.P[t.name],e.P[r]=t,t.name=r,e.ctime=e.mtime=t.parent.ctime=t.parent.mtime=Date.now()},unlink(t,e){delete t.P[e],t.ctime=t.mtime=Date.now()},rmdir(t,e){var r,n=Le(t,e);for(r in n.P)throw new qe.L(55);delete t.P[e],t.ctime=t.mtime=Date.now()},readdir:t=>[".","..",...Object.keys(t.P)],symlink:(t,e,r)=>((t=we.createNode(t,e,41471,0)).link=r,t),readlink(t){if(40960!=(61440&t.mode))throw new qe.L(28);return t.link}},O:{read(t,e,r,n,i){var a=t.node.P;if(i>=t.node.V)return 0;if(8<(t=Math.min(t.node.V-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===y.buffer&&(a=!1),!n)return 0;if((t=t.node).mtime=t.ctime=Date.now(),e.subarray&&(!t.P||t.P.subarray)){if(a)return t.P=e.subarray(r,r+n),t.V=n;if(0===t.V&&0===i)return t.P=e.slice(r,r+n),t.V=n;if(i+n<=t.V)return t.P.set(e.subarray(r,r+n),i),n}var o=t.P?t.P.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.P,t.P=new Uint8Array(a),0<t.V&&t.P.set(o.subarray(0,t.V),0)),t.P.subarray&&e.subarray)t.P.set(e.subarray(r,r+n),i);else for(a=0;a<n;a++)t.P[i+a]=e[r+a];return t.V=Math.max(t.V,i+n),n},$(t,e,r){if(1===r?e+=t.position:2===r&&qe.isFile(t.node.mode)&&(e+=t.node.V),0>e)throw new qe.L(28);return e},ua(t,e,r,n,i){if(!qe.isFile(t.node.mode))throw new qe.L(43);if(t=t.node.P,2&i||!t||t.buffer!==y.buffer){if(n=!0,N(),!(i=void 0))throw new qe.L(48);t&&((0<r||r+e<t.length)&&(t=t.subarray?t.subarray(r,r+e):Array.prototype.slice.call(t,r,r+e)),y.set(t,i))}else n=!1,i=t.byteOffset;return{S:i,Gb:n}},za:(t,e,r,n)=>(we.O.write(t,e,0,n,r,!1),0)}},me=(t,e)=>{var r=0;return t&&(r|=365),e&&(r|=146),r},ve=0,ye=null,ge=()=>{if(ve--,n.monitorRunDependencies?.(ve),0==ve&&ye){var t=ye;ye=null,t()}},be=()=>{ve++,n.monitorRunDependencies?.(ve)},$e=[],_e=async(t,e,r,n,i,a,o,s)=>{var l=e?ae(ee(t+"/"+e)):t;be();try{var u=r;"string"==typeof r&&(u=await(async t=>(t=await h(t),new Uint8Array(t)))(r)),u=await(async(t,e)=>{for(var r of("undefined"!=typeof Browser&&Ae(),$e))if(r.canHandle(e))return r.handle(t,e);return t})(u,l),s?.(),a||Pe(t,e,u,n,i,o)}finally{ge()}};function Ae(){var t,e,r;qe.Ka=!0,t??=n.stdin,e??=n.stdout,r??=n.stderr,t?qe.na("/dev","stdin",t):qe.symlink("/dev/tty","/dev/stdin"),e?qe.na("/dev","stdout",null,e):qe.symlink("/dev/tty","/dev/stdout"),r?qe.na("/dev","stderr",null,r):qe.symlink("/dev/tty1","/dev/stderr"),qe.open("/dev/stdin",0),qe.open("/dev/stdout",1),qe.open("/dev/stderr",1)}function Se(t,e){qe.Xa[t]={O:e}}function Ee(t){return 16384==(61440&t)}function Le(t,e){var r=Ee(t.mode)?(r=Ce(t,"x"))?r:t.N.lookup?0:2:54;if(r)throw new qe.L(r);for(r=qe.ia[Oe(t.id,e)];r;r=r.sa)if(r.parent.id===t.id&&r.name===e)return r;return qe.lookup(t,e)}function Te(t){var e=Oe(t.parent.id,t.name);if(qe.ia[e]===t)qe.ia[e]=t.sa;else for(e=qe.ia[e];e;){if(e.sa===t){e.sa=t.sa;break}e=e.sa}}function Pe(t,e,r,n,i,a){var o=e;if(t&&(t="string"==typeof t?t:Re(t),o=e?ee(t+"/"+e):t),t=me(n,i),o=qe.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}qe.chmod(o,146|t),e=qe.open(o,577),qe.write(e,r,0,r.length,0,a),qe.close(e),qe.chmod(o,t)}}function ke(t,e={}){if(!t)throw new qe.L(44);e.Ca??(e.Ca=!0),"/"===t.charAt(0)||(t=qe.cwd()+"/"+t);var r=0;t:for(;40>r;r++){t=t.split("/").filter((t=>!!t));for(var n=qe.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=re(i),qe.Ma(n)){t=i+"/"+t.slice(a+1).join("/"),r--;continue t}n=n.parent}else{i=ee(i+"/"+t[a]);try{n=Le(n,t[a])}catch(t){if(44===t?.qa&&o&&e.yb)return{path:i};throw t}if(!n.ga||o&&!e.Ca||(n=n.ga.root),40960==(61440&n.mode)&&(!o||e.ea)){if(!n.N.readlink)throw new qe.L(52);"/"===(n=n.N.readlink(n)).charAt(0)||(n=re(i)+"/"+n),t=n+"/"+t.slice(a+1).join("/");continue t}}}return{path:i,node:n}}throw new qe.L(32)}function Re(t){for(var e;;){if(qe.Ma(t))return t=t.T.cb,e?"/"!==t[t.length-1]?`${t}/${e}`:t+e:t;e=e?`${t.name}/${e}`:t.name,t=t.parent}}function Oe(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%qe.ia.length}function Ue(t){var e=Oe(t.parent.id,t.name);t.sa=qe.ia[e],qe.ia[e]=t}function Me(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e}function Ce(t,e){return qe.$a?0:!e.includes("r")||292&t.mode?e.includes("w")&&!(146&t.mode)||e.includes("x")&&!(73&t.mode)?2:0:2}function Ne(t,e){if(!Ee(t.mode))return 54;try{return Le(t,e),20}catch(t){}return Ce(t,"wx")}function xe(t,e,r){try{var n=Le(t,e)}catch(t){return t.qa}if(t=Ce(t,"wx"))return t;if(r){if(!Ee(n.mode))return 54;if(qe.Ma(n)||Re(n)===qe.cwd())return 10}else if(Ee(n.mode))return 31;return 0}function Fe(t,e){if(!t)throw new qe.L(e);return t}function je(t){if(!(t=qe.ub(t)))throw new qe.L(8);return t}function Ve(t,e=-1){if(t=Object.assign(new qe.jb,t),-1==e)t:{for(e=0;e<=qe.kb;e++)if(!qe.streams[e])break t;throw new qe.L(33)}return t.fd=e,qe.streams[e]=t}function ze(t,e,r){var n=t?.O.ha;t=n?t:e,n??=e.N.ha,Fe(n,63),n(t,r)}function De(t){var e=[];for(t=[t];t.length;){var r=t.pop();e.push(r),t.push(...r.ya)}return e}function Ie(t){var e={Jb:4096,Vb:4096,blocks:1e6,Ib:5e5,Hb:5e5,files:qe.Oa,Tb:qe.Oa-1,Wb:42,flags:2,dc:255};return t.N.gb&&Object.assign(e,t.N.gb(t.T.zb.root)),e}function He(t,e,r){return void 0===r&&(r=e,e=438),qe.la(t,8192|e,r)}function We(t,e,r,n){ze(t,e,{mode:4095&r|-4096&e.mode,ctime:Date.now(),Ya:n})}function Be(t,e,r){if(Ee(e.mode))throw new qe.L(31);if(!qe.isFile(e.mode))throw new qe.L(28);var n=Ce(e,"w");if(n)throw new qe.L(n);ze(t,e,{size:r,timestamp:Date.now()})}function Ge(t){if(!(t.wb||t.xb||t.link||t.P))if(globalThis.XMLHttpRequest)N("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.P=l(t.url)}catch(t){throw new qe.L(29)}}var qe={root:null,ya:[],Xa:{},streams:[],Oa:1,ia:null,Va:"/",Ka:!1,$a:!0,qb:null,Fa:0,fb:{},L:class{name="ErrnoError";constructor(t){this.qa=t}},jb:class{ka={};node=null;get object(){return this.node}set object(t){this.node=t}get flags(){return this.ka.flags}set flags(t){this.ka.flags=t}get position(){return this.ka.position}set position(t){this.ka.position=t}},ib:class{N={};O={};ga=null;constructor(t,e,r,n){t||=this,this.parent=t,this.T=t.T,this.id=qe.Oa++,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 xb(){return Ee(this.mode)}get wb(){return 8192==(61440&this.mode)}},createNode:(t,e,r,n)=>(Ue(t=new qe.ib(t,e,r,n)),t),Ma:t=>t===t.parent,isFile:t=>32768==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>!(49152&~t),kb:4096,ub:t=>qe.streams[t],Sb:(t,e=-1)=>(t=Ve(t,e),t.O?.Rb?.(t),t),mb:{open(t){t.O=qe.sb(t.node.rdev).O,t.O.open?.(t)},$(){throw new qe.L(70)}},Na:t=>t>>8,bc:t=>255&t,ra:(t,e)=>t<<8|e,sb:t=>qe.Xa[t],hb(t,e){function r(t){return qe.Fa--,e(t)}function n(t){if(t){if(!n.pb)return n.pb=!0,r(t)}else++a>=i.length&&r(null)}"function"==typeof t&&(e=t,t=!1),qe.Fa++,1<qe.Fa&&R(`warning: ${qe.Fa} FS.syncfs operations in flight at once, probably just doing extra work`);var i=De(qe.root.T),a=0;i.forEach((e=>{if(!e.type.hb)return n(null);e.type.hb(e,t,n)}))},T(t,e,r){var n="/"===r;if(n&&qe.root)throw new qe.L(10);if(!n&&r){var i=ke(r,{Ca:!1});if(r=i.path,(i=i.node).ga)throw new qe.L(10);if(!Ee(i.mode))throw new qe.L(54)}return(t=t.T(e={type:t,zb:e,cb:r,ya:[]})).T=e,e.root=t,n?qe.root=t:i&&(i.ga=e,i.T&&i.T.ya.push(e)),t},jc(t){if(!(t=ke(t,{Ca:!1})).node.ga)throw new qe.L(28);var e=(t=t.node).ga,r=De(e);Object.keys(qe.ia).forEach((t=>{for(t=qe.ia[t];t;){var e=t.sa;r.includes(t.T)&&Te(t),t=e}})),t.ga=null,t.T.ya.splice(t.T.ya.indexOf(e),1)},lookup:(t,e)=>t.N.lookup(t,e),la(t,e,r){var n=ke(t,{parent:!0}).node;if(!(t=ne(t)))throw new qe.L(28);if("."===t||".."===t)throw new qe.L(20);var i=Ne(n,t);if(i)throw new qe.L(i);if(!n.N.la)throw new qe.L(63);return n.N.la(n,t,e,r)},gb:t=>Ie(ke(t,{ea:!0}).node),hc:t=>Ie(t.node),create:(t,e=438)=>qe.la(t,4095&e|32768,0),mkdir:(t,e=511)=>qe.la(t,1023&e|16384,0),cc(t,e){var r,n=t.split("/"),i="";for(r of n)if(r){(i||"/"===t.charAt(0))&&(i+="/"),i+=r;try{qe.mkdir(i,e)}catch(t){if(20!=t.qa)throw t}}},symlink(t,e){if(!ae(t))throw new qe.L(44);var r=ke(e,{parent:!0}).node;if(!r)throw new qe.L(44);var n=Ne(r,e=ne(e));if(n)throw new qe.L(n);if(!r.N.symlink)throw new qe.L(63);return r.N.symlink(r,e,t)},rename(t,e){var r=re(t),n=re(e),i=ne(t),a=ne(e),o=ke(t,{parent:!0}),s=o.node;if(o=(o=ke(e,{parent:!0})).node,!s||!o)throw new qe.L(44);if(s.T!==o.T)throw new qe.L(75);var h=Le(s,i);if("."!==(t=oe(t,n)).charAt(0))throw new qe.L(28);if("."!==(t=oe(e,r)).charAt(0))throw new qe.L(55);try{var l=Le(o,a)}catch(t){}if(h!==l){if(i=xe(s,i,e=Ee(h.mode)))throw new qe.L(i);if(i=l?xe(o,a,e):Ne(o,a))throw new qe.L(i);if(!s.N.rename)throw new qe.L(63);if(h.ga||l&&l.ga)throw new qe.L(10);if(o!==s&&(i=Ce(s,"w")))throw new qe.L(i);Te(h);try{s.N.rename(h,o,a),h.parent=o}catch(t){throw t}finally{Ue(h)}}},rmdir(t){var e=ke(t,{parent:!0}).node,r=Le(e,t=ne(t)),n=xe(e,t,!0);if(n)throw new qe.L(n);if(!e.N.rmdir)throw new qe.L(63);if(r.ga)throw new qe.L(10);e.N.rmdir(e,t),Te(r)},readdir:t=>Fe((t=ke(t,{ea:!0}).node).N.readdir,54)(t),unlink(t){var e=ke(t,{parent:!0}).node;if(!e)throw new qe.L(44);var r=Le(e,t=ne(t)),n=xe(e,t,!1);if(n)throw new qe.L(n);if(!e.N.unlink)throw new qe.L(63);if(r.ga)throw new qe.L(10);e.N.unlink(e,t),Te(r)},readlink(t){if(!(t=ke(t).node))throw new qe.L(44);if(!t.N.readlink)throw new qe.L(28);return t.N.readlink(t)},stat:(t,e)=>Fe((t=ke(t,{ea:!e}).node).N.fa,63)(t),fstat(t){var e=je(t);t=e.node;var r=e.O.fa;return e=r?e:t,r??=t.N.fa,Fe(r,63),r(e)},lstat:t=>qe.stat(t,!0),chmod(t,e,r){We(null,t="string"==typeof t?ke(t,{ea:!r}).node:t,e,r)},lchmod(t,e){qe.chmod(t,e,!0)},fchmod(t,e){We(t=je(t),t.node,e,!1)},chown(t,e,r,n){ze(null,t="string"==typeof t?ke(t,{ea:!n}).node:t,{timestamp:Date.now(),Ya:n})},lchown(t,e,r){qe.chown(t,e,r,!0)},fchown(t){ze(t=je(t),t.node,{timestamp:Date.now(),Ya:!1})},truncate(t,e){if(0>e)throw new qe.L(28);Be(null,t="string"==typeof t?ke(t,{ea:!0}).node:t,e)},Xb(t,e){if(t=je(t),0>e||!(2097155&t.flags))throw new qe.L(28);Be(t,t.node,e)},kc(t,e,r){Fe((t=ke(t,{ea:!0}).node).N.ha,63)(t,{atime:e,mtime:r})},open(t,e,r=438){if(""===t)throw new qe.L(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(r=64&e?4095&r|32768:0,"object"==typeof t)i=t;else{var a=t.endsWith("/");i=(t=ke(t,{ea:!(131072&e),yb:!0})).node,t=t.path}var o=!1;if(64&e)if(i){if(128&e)throw new qe.L(20)}else{if(a)throw new qe.L(31);i=qe.la(t,511|r,0),o=!0}if(!i)throw new qe.L(44);if(8192==(61440&i.mode)&&(e&=-513),65536&e&&!Ee(i.mode))throw new qe.L(54);if(!o&&(a=i?40960==(61440&i.mode)?32:Ee(i.mode)&&("r"!==Me(e)||576&e)?31:Ce(i,Me(e)):44))throw new qe.L(a);return 512&e&&!o&&qe.truncate(i,0),e&=-131713,(a=Ve({node:i,path:Re(i),flags:e,seekable:!0,position:0,O:i.O,Fb:[],error:!1})).O.open&&a.O.open(a),o&&qe.chmod(i,511&r),!n.logReadFiles||1&e||t in qe.fb||(qe.fb[t]=1),a},close(t){if(null===t.fd)throw new qe.L(8);t.Ja&&(t.Ja=null);try{t.O.close&&t.O.close(t)}catch(t){throw t}finally{qe.streams[t.fd]=null}t.fd=null},$(t,e,r){if(null===t.fd)throw new qe.L(8);if(!t.seekable||!t.O.$)throw new qe.L(70);if(0!=r&&1!=r&&2!=r)throw new qe.L(28);return t.position=t.O.$(t,e,r),t.Fb=[],t.position},read(t,e,r,n,i){if(0>n||0>i)throw new qe.L(28);if(null===t.fd)throw new qe.L(8);if(1==(2097155&t.flags))throw new qe.L(8);if(Ee(t.node.mode))throw new qe.L(31);if(!t.O.read)throw new qe.L(28);var a=void 0!==i;if(a){if(!t.seekable)throw new qe.L(70)}else i=t.position;return e=t.O.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 qe.L(28);if(null===t.fd)throw new qe.L(8);if(!(2097155&t.flags))throw new qe.L(8);if(Ee(t.node.mode))throw new qe.L(31);if(!t.O.write)throw new qe.L(28);t.seekable&&1024&t.flags&&qe.$(t,0,2);var o=void 0!==i;if(o){if(!t.seekable)throw new qe.L(70)}else i=t.position;return e=t.O.write(t,e,r,n,i,a),o||(t.position+=e),e},ua(t,e,r,n,i){if(2&n&&!(2&i)&&2!=(2097155&t.flags))throw new qe.L(2);if(1==(2097155&t.flags))throw new qe.L(2);if(!t.O.ua)throw new qe.L(43);if(!e)throw new qe.L(28);return t.O.ua(t,e,r,n,i)},za:(t,e,r,n,i)=>t.O.za?t.O.za(t,e,r,n,i):0,ab(t,e,r){if(!t.O.ab)throw new qe.L(59);return t.O.ab(t,e,r)},readFile(t,e={}){e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding&&N(`Invalid encoding type "${e.encoding}"`);var r=qe.open(t,e.flags);t=qe.stat(t).size;var n=new Uint8Array(t);return qe.read(r,n,0,t,0),"utf8"===e.encoding&&(n=se(n)),qe.close(r),n},writeFile(t,e,r={}){r.flags=r.flags||577,t=qe.open(t,r.flags,r.mode),"string"==typeof e&&(e=new Uint8Array(le(e))),ArrayBuffer.isView(e)?qe.write(t,e,0,e.byteLength,void 0,r.Pb):N("Unsupported data type"),qe.close(t)},cwd:()=>qe.Va,chdir(t){if(null===(t=ke(t,{ea:!0})).node)throw new qe.L(44);if(!Ee(t.node.mode))throw new qe.L(54);var e=Ce(t.node,"x");if(e)throw new qe.L(e);qe.Va=t.path},fc(){for(var t of(qe.Ka=!1,qe.streams))t&&qe.close(t)},Ub(t,e){try{var r=ke(t,{ea:!e});t=r.path}catch(t){}var n=!1,i=null;try{r=ke(t,{parent:!0}),ne(t),r=ke(t,{ea:!e}),n=!0,i=r.node}catch(t){}return n?i:null},na(t,e,r,n){var i;return t=((t,e)=>ee(t+"/"+e))("string"==typeof t?t:Re(t),e),e=me(!!r,!!n),(i=qe.na).Na??(i.Na=64),Se(i=qe.ra(qe.na.Na++,0),{open(t){t.seekable=!1},close(){n?.buffer?.length&&n(10)},read(t,e,n,i){for(var a=0,o=0;o<i;o++){try{var s=r()}catch(t){throw new qe.L(29)}if(void 0===s&&0===a)throw new qe.L(6);if(null==s)break;a++,e[n+o]=s}return a&&(t.node.atime=Date.now()),a},write(t,e,r,i){for(var a=0;a<i;a++)try{n(e[r+a])}catch(t){throw new qe.L(29)}return i&&(t.node.mtime=t.node.ctime=Date.now()),a}}),He(t,e,i)}};if((()=>{let t=tt.prototype;Object.assign(t,{isAliasOf:function(t){if(!(this instanceof tt&&t instanceof tt))return!1;var e=this.M.U.R,r=this.M.S;t.M=t.M;var n=t.M.U.R;for(t=t.M.S;e.Z;)r=e.Ba(r),e=e.Z;for(;n.Z;)t=n.Ba(t),n=n.Z;return e===n&&r===t},clone:function(){if(this.M.S||Y(this),this.M.Aa)return this.M.count.value+=1,this;var t=Q,e=Object,r=e.create,n=Object.getPrototypeOf(this),i=this.M;return(t=t(r.call(e,n,{M:{value:{count:i.count,xa:i.xa,Aa:i.Aa,S:i.S,U:i.U,X:i.X,aa:i.aa}}}))).M.count.value+=1,t.M.xa=!1,t},delete(){if(this.M.S||Y(this),this.M.xa&&!this.M.Aa)throw new G("Object already scheduled for deletion");K(this);var t=this.M;--t.count.value,0===t.count.value&&(t.X?t.aa.oa(t.X):t.U.R.oa(t.S)),this.M.Aa||(this.M.X=void 0,this.M.S=void 0)},isDeleted:function(){return!this.M.S},deleteLater:function(){if(this.M.S||Y(this),this.M.xa&&!this.M.Aa)throw new G("Object already scheduled for deletion");return this.M.xa=!0,this}});const e=Symbol.dispose;e&&(t[e]=t.delete)})(),Object.assign(mt.prototype,{tb(t){return this.eb&&(t=this.eb(t)),t},Wa(t){this.oa?.(t)},ma:ct,Y:function(t){function e(){return wt(this.R.ta,this.Ea?{U:this.Ab,S:r,aa:this,X:t}:{U:this,S:t})}var r=this.tb(t);if(!r)return this.Wa(t),null;var n=((t,e)=>{if(void 0===e)throw new G("ptr should not be undefined");for(;t.Z;)e=t.Ba(e),t=t.Z;return ft[e]})(this.R,r);if(void 0!==n)return 0===n.M.count.value?(n.M.S=r,n.M.X=t,n.clone()):(n=n.clone(),this.Wa(t),n);if(n=this.R.rb(r),!(n=rt[n]))return e.call(this);var i=dt(r,this.R,(n=this.Da?n.nb:n.pointerType).R);return null===i?e.call(this):wt(n.R.ta,this.Ea?{U:n,S:i,aa:this,X:t}:{U:n,S:i})}}),qe.Qb=(t,e,r,n,i,a,o,s,h,l)=>{_e(t,e,r,n,i,s,h,l).then(a).catch(o)},qe.ec=_e,qe.ia=Array(4096),qe.T(we,{},"/"),qe.mkdir("/tmp"),qe.mkdir("/home"),qe.mkdir("/home/web_user"),function(){qe.mkdir("/dev"),Se(qe.ra(1,3),{read:()=>0,write:(t,e,r,n)=>n,$:()=>0}),He("/dev/null",qe.ra(1,3)),ce(qe.ra(5,0),fe),ce(qe.ra(6,0),pe),He("/dev/tty",qe.ra(5,0)),He("/dev/tty1",qe.ra(6,0));var t=new Uint8Array(1024),e=0,r=()=>(0===e&&(ie(t),e=t.byteLength),t[--e]);qe.na("/dev","random",r),qe.na("/dev","urandom",r),qe.mkdir("/dev/shm"),qe.mkdir("/dev/shm/tmp")}(),function(){qe.mkdir("/proc");var t=qe.mkdir("/proc/self");qe.mkdir("/proc/self/fd"),qe.T({T(){var e=qe.createNode(t,"fd",16895,73);return e.O={$:we.O.$},e.N={lookup(t,e){var r=je(t=+e);return(t={parent:null,T:{cb:"fake"},N:{readlink:()=>r.path},id:t+1}).parent=t},readdir:()=>Array.from(qe.streams.entries()).filter((([,t])=>t)).map((([t])=>t.toString()))},e}},{},"/proc/self/fd")}(),qe.qb={MEMFS:we},n.noExitRuntime&&(D=n.noExitRuntime),n.preloadPlugins&&($e=n.preloadPlugins),n.print&&(k=n.print),n.printErr&&(R=n.printErr),n.wasmBinary&&(p=n.wasmBinary),n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.shift()();n.addRunDependency=be,n.removeRunDependency=ge,n.FS_preloadFile=_e,n.FS_unlink=(...t)=>qe.unlink(...t),n.FS_createPath=(...t)=>function(t,e){for(t="string"==typeof t?t:Re(t),e=e.split("/").reverse();e.length;){var r=e.pop();if(r){var n=ee(t+"/"+r);try{qe.mkdir(n)}catch(t){if(20!=t.qa)throw t}t=n}}return n}(...t),n.FS_createDevice=(...t)=>qe.na(...t),n.FS=qe,n.FS_createDataFile=(...t)=>Pe(...t),n.FS_createLazyFile=(...t)=>function(t,e,r,n,i){class o{Ha=!1;ka=[];Ga=void 0;Ra=0;Qa=0;get(t){if(!(t>this.length-1||0>t)){var e=t%this.chunkSize;return this.Ga(t/this.chunkSize|0)[e]}}lb(t){this.Ga=t}Sa(){var t=new XMLHttpRequest;t.open("HEAD",r,!1),t.send(null),200<=t