UNPKG

@thorvg/lottie-player

Version:

A web lottie player using ThorVG as a renderer

1 lines 105 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["lottie-player"]={})}(this,(function(e){"use strict";var t="undefined"!=typeof document?document.currentScript:null;const r=globalThis,n=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;let o=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&a.set(t,e))}return e}toString(){return this.cssText}};const s=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:c,defineProperty:d,getOwnPropertyDescriptor:l,getOwnPropertyNames:u,getOwnPropertySymbols:h,getPrototypeOf:f}=Object,p=globalThis,m=p.trustedTypes,v=m?m.emptyScript:"",g=p.reactiveElementPolyfillSupport,y=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},b=(e,t)=>!c(e,t),_={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:b};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;class x extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&d(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){const{get:n,set:i}=l(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){const a=n?.call(this);i.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...u(e),...h(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(s(e))}else void 0!==e&&t.push(s(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(n)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of t){const t=document.createElement("style"),i=r.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){const r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:w).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){const r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=n,this[n]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){if(r??=this.constructor.getPropertyOptions(e),!(r.hasChanged??b)(this[e],t))return;this.P(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,r]of e)!0!==r.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],r)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[y("elementProperties")]=new Map,x[y("finalized")]=new Map,g?.({ReactiveElement:x}),(p.reactiveElementVersions??=[]).push("2.0.4");const A=globalThis,E=A.trustedTypes,$=E?E.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+T,P=`<${C}>`,k=document,F=()=>k.createComment(""),U=e=>null===e||"object"!=typeof e&&"function"!=typeof e,B=Array.isArray,L="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,z=/>/g,D=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,j=/"/g,I=/^(?:script|style|textarea|title)$/i,W=(e,...t)=>({_$litType$:1,strings:e,values:t}),G=Symbol.for("lit-noChange"),N=Symbol.for("lit-nothing"),V=new WeakMap,H=k.createTreeWalker(k,129);function q(e,t){if(!B(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(t):t}class X{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let i=0,a=0;const o=e.length-1,s=this.parts,[c,d]=((e,t)=>{const r=e.length-1,n=[];let i,a=2===t?"<svg>":3===t?"<math>":"",o=R;for(let t=0;t<r;t++){const r=e[t];let s,c,d=-1,l=0;for(;l<r.length&&(o.lastIndex=l,c=o.exec(r),null!==c);)l=o.lastIndex,o===R?"!--"===c[1]?o=O:void 0!==c[1]?o=z:void 0!==c[2]?(I.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=D):void 0!==c[3]&&(o=D):o===D?">"===c[0]?(o=i??R,d=-1):void 0===c[1]?d=-2:(d=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?D:'"'===c[3]?j:M):o===j||o===M?o=D:o===O||o===z?o=R:(o=D,i=void 0);const u=o===D&&e[t+1].startsWith("/>")?" ":"";a+=o===R?r+P:d>=0?(n.push(s),r.slice(0,d)+S+r.slice(d)+T+u):r+T+(-2===d?t:u)}return[q(e,a+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),n]})(e,t);if(this.el=X.createElement(c,r),H.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=H.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(S)){const t=d[a++],r=n.getAttribute(e).split(T),o=/([.?@])?(.*)/.exec(t);s.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?Z:"?"===o[1]?ee:"@"===o[1]?te:Y}),n.removeAttribute(e)}else e.startsWith(T)&&(s.push({type:6,index:i}),n.removeAttribute(e));if(I.test(n.tagName)){const e=n.textContent.split(T),t=e.length-1;if(t>0){n.textContent=E?E.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],F()),H.nextNode(),s.push({type:2,index:++i});n.append(e[t],F())}}}else if(8===n.nodeType)if(n.data===C)s.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(T,e+1));)s.push({type:7,index:i}),e+=T.length-1}i++}}static createElement(e,t){const r=k.createElement("template");return r.innerHTML=e,r}}function J(e,t,r=e,n){if(t===G)return t;let i=void 0!==n?r.o?.[n]:r.l;const a=U(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0!==n?(r.o??=[])[n]=i:r.l=i),void 0!==i&&(t=J(e,i._$AS(e,t.values),i,n)),t}class K{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??k).importNode(t,!0);H.currentNode=n;let i=H.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new Q(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new re(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=H.nextNode(),a++)}return H.currentNode=k,n}p(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class Q{get _$AU(){return this._$AM?._$AU??this.v}constructor(e,t,r,n){this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this.v=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=J(this,e,t),U(e)?e===N||null==e||""===e?(this._$AH!==N&&this._$AR(),this._$AH=N):e!==this._$AH&&e!==G&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>B(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==N&&U(this._$AH)?this._$AA.nextSibling.data=e:this.T(k.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=X.createElement(q(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{const e=new K(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new X(e)),t}k(e){B(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,n=0;for(const i of e)n===t.length?t.push(r=new Q(this.O(F()),this.O(F()),this,this.options)):r=t[n],r._$AI(i),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this.v=e,this._$AP?.(e))}}class Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=N,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=N}_$AI(e,t=this,r,n){const i=this.strings;let a=!1;if(void 0===i)e=J(this,e,t,0),a=!U(e)||e!==this._$AH&&e!==G,a&&(this._$AH=e);else{const n=e;let o,s;for(e=i[0],o=0;o<i.length-1;o++)s=J(this,n[r+o],t,o),s===G&&(s=this._$AH[o]),a||=!U(s)||s!==this._$AH[o],s===N?e=N:e!==N&&(e+=(s??"")+i[o+1]),this._$AH[o]=s}a&&!n&&this.j(e)}j(e){e===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Z extends Y{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===N?void 0:e}}class ee extends Y{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==N)}}class te extends Y{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=J(this,e,t,0)??N)===G)return;const r=this._$AH,n=e===N&&r!==N||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==N&&(r===N||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class re{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){J(this,e)}}const ne=A.litHtmlPolyfillSupport;ne?.(X,Q),(A.litHtmlVersions??=[]).push("3.2.0");class ie extends x{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this.o=((e,t,r)=>{const n=r?.renderBefore??t;let i=n._$litPart$;if(void 0===i){const e=r?.renderBefore??null;n._$litPart$=i=new Q(t.insertBefore(F(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return G}}ie._$litElement$=!0,ie.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ie});const ae=globalThis.litElementPolyfillSupport;ae?.({LitElement:ie}),(globalThis.litElementVersions??=[]).push("4.1.0");const oe={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:b},se=(e=oe,t,r)=>{const{kind:n,metadata:i}=r;let a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,e),"accessor"===n){const{name:n}=r;return{set(r){const i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e)},init(t){return void 0!==t&&this.P(n,void 0,e),t}}}if("setter"===n){const{name:n}=r;return function(r){const i=this[n];t.call(this,r),this.requestUpdate(n,i,e)}}throw Error("Unsupported decorator location: "+n)};function ce(e){return(t,r)=>"object"==typeof r?se(e,t,r):((e,t,r)=>{const n=t.hasOwnProperty(r);return t.constructor.createProperty(r,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}for(var de,le=[],ue=0;ue<256;++ue)le.push((ue+256).toString(16).slice(1));var he=new Uint8Array(16);function fe(){if(!de&&!(de="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return de(he)}var pe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function me(e,t,r){if(pe.randomUUID&&!t&&!e)return pe.randomUUID();var n=(e=e||{}).random||(e.rng||fe)();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(e,t=0){return(le[e[t+0]]+le[e[t+1]]+le[e[t+2]]+le[e[t+3]]+"-"+le[e[t+4]]+le[e[t+5]]+"-"+le[e[t+6]]+le[e[t+7]]+"-"+le[e[t+8]]+le[e[t+9]]+"-"+le[e[t+10]]+le[e[t+11]]+le[e[t+12]]+le[e[t+13]]+le[e[t+14]]+le[e[t+15]]).toLowerCase()}(n)}var ve,ge=(ve="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&t.src||new URL("lottie-player.js",document.baseURI).href,async function(e={}){var r,n,i=e,a=new Promise(((e,t)=>{r=e,n=t})),o="object"==typeof window,s="undefined"!=typeof WorkerGlobalScope,c="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type;if(c){const{createRequire:e}=await Promise.resolve().then((function(){return Be}));let r="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&t.src||new URL("lottie-player.js",document.baseURI).href;r.startsWith("data:")&&(r="/");var d=e(r)}var l,u,h=Object.assign({},i),f="./this.program",p=(e,t)=>{throw t},m="";if(c){var v=d("fs"),g=d("path");("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&t.src||new URL("lottie-player.js",document.baseURI).href).startsWith("data:")||(m=g.dirname(d("url").fileURLToPath("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&t.src||new URL("lottie-player.js",document.baseURI).href))+"/"),u=e=>(e=H(e)?new URL(e):e,v.readFileSync(e)),l=async e=>(e=H(e)?new URL(e):e,v.readFileSync(e,void 0)),!i.thisProgram&&1<process.argv.length&&(f=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),p=(e,t)=>{throw process.exitCode=e,t}}else(o||s)&&(s?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),ve&&(m=ve),m=m.startsWith("blob:")?"":m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1),s&&(u=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),l=async e=>{if(H(e))return new Promise(((t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r(n.status)},n.onerror=r,n.send(null)}));var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw Error(t.status+" : "+t.url)});var y=i.print||void 0,w=i.printErr||void 0;Object.assign(i,h),h=null,i.thisProgram&&(f=i.thisProgram);var b,_,x,A,E,$,S,T,C,P,k=i.wasmBinary,F=!1;function U(){var e=b.buffer;i.HEAP8=x=new Int8Array(e),i.HEAP16=E=new Int16Array(e),i.HEAPU8=A=new Uint8Array(e),i.HEAPU16=$=new Uint16Array(e),i.HEAP32=S=new Int32Array(e),i.HEAPU32=T=new Uint32Array(e),i.HEAPF32=C=new Float32Array(e),i.HEAPF64=P=new Float64Array(e)}var B=[],L=[],R=[];function O(){var e=i.preRun.shift();B.unshift(e)}var z=0,D=null;function M(){z++,i.monitorRunDependencies?.(z)}function j(){if(z--,i.monitorRunDependencies?.(z),0==z&&D){var e=D;D=null,e()}}function I(e){throw i.onAbort?.(e),w(e="Aborted("+e+")"),F=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),n(e),e}var W,G,N,V=e=>e.startsWith("data:application/octet-stream;base64,"),H=e=>e.startsWith("file://");class q{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var X=e=>{for(;0<e.length;)e.shift()(i)},J=i.noExitRuntime||!0,K="undefined"!=typeof TextDecoder?new TextDecoder:void 0,Q=(e,t=0,r=NaN)=>{var n=t+r;for(r=t;e[r]&&!(r>=n);)++r;if(16<r-t&&e.buffer&&K)return K.decode(e.subarray(t,r));for(n="";t<r;){var i=e[t++];if(128&i){var a=63&e[t++];if(192==(224&i))n+=String.fromCharCode((31&i)<<6|a);else{var o=63&e[t++];65536>(i=224==(240&i)?(15&i)<<12|a<<6|o:(7&i)<<18|a<<12|o<<6|63&e[t++])?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else n+=String.fromCharCode(i)}return n},Y=()=>{var e=S[+Ne>>2];return Ne+=4,e},Z=(e,t)=>{for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},ee=e=>{var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=Z(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},te=e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&=t.substr(0,t.length-1),e+t):"."},re=e=>{if("/"===e)return"/";var t=(e=(e=ee(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},ne=e=>(ne=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(c)try{var e=d("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}I("initRandomDevice")})())(e),ie=(...e)=>{for(var t="",r=!1,n=e.length-1;-1<=n&&!r;n--){if("string"!=typeof(r=0<=n?e[n]:Ge.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";t=r+"/"+t,r="/"===r.charAt(0)}return t=Z(t.split("/").filter((e=>!!e)),!r).join("/"),(r?"/":"")+t||"."},ae=(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;0<=r&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ie(e).substr(1),t=ie(t).substr(1),e=r(e.split("/")),t=r(t.split("/"));for(var n=Math.min(e.length,t.length),i=n,a=0;a<n;a++)if(e[a]!==t[a]){i=a;break}for(n=[],a=i;a<e.length;a++)n.push("..");return(n=n.concat(t.slice(i))).join("/")},oe=[],se=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);127>=n?t++:2047>=n?t+=2:55296<=n&&57343>=n?(t+=4,++r):t+=3}return t},ce=(e,t,r,n)=>{if(!(0<n))return 0;var i=r;n=r+n-1;for(var a=0;a<e.length;++a){var o=e.charCodeAt(a);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),127>=o){if(r>=n)break;t[r++]=o}else{if(2047>=o){if(r+1>=n)break;t[r++]=192|o>>6}else{if(65535>=o){if(r+2>=n)break;t[r++]=224|o>>12}else{if(r+3>=n)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63}t[r++]=128|o>>6&63}t[r++]=128|63&o}}return t[r]=0,r-i};function de(e){var t=Array(se(e)+1);return e=ce(e,t,0,t.length),t.length=e,t}var le=[];function ue(e,t){le[e]={input:[],output:[],Xc:t},xe(e,he)}var he={open(e){var t=le[e.node.rdev];if(!t)throw new Ge.xc(43);e.tty=t,e.seekable=!1},close(e){e.tty.Xc.fsync(e.tty)},fsync(e){e.tty.Xc.fsync(e.tty)},read(e,t,r,n){if(!e.tty||!e.tty.Xc.je)throw new Ge.xc(60);for(var i=0,a=0;a<n;a++){try{var o=e.tty.Xc.je(e.tty)}catch(e){throw new Ge.xc(29)}if(void 0===o&&0===i)throw new Ge.xc(6);if(null==o)break;i++,t[r+a]=o}return i&&(e.node.atime=Date.now()),i},write(e,t,r,n){if(!e.tty||!e.tty.Xc.Qd)throw new Ge.xc(60);try{for(var i=0;i<n;i++)e.tty.Xc.Qd(e.tty,t[r+i])}catch(e){throw new Ge.xc(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),i}},fe={je(){e:{if(!oe.length){var e=null;if(c){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=v.readSync(n,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}0<r&&(e=t.slice(0,r).toString("utf-8"))}else"undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e){e=null;break e}oe=de(e)}e=oe.shift()}return e},Qd(e,t){null===t||10===t?(y(Q(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&0<e.output.length&&(y(Q(e.output)),e.output=[])},Re:()=>({mf:25856,pf:5,lf:191,nf:35387,kf:[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]}),Se:()=>0,Te:()=>[24,80]},pe={Qd(e,t){null===t||10===t?(w(Q(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&0<e.output.length&&(w(Q(e.output)),e.output=[])}};function me(e,t){var r=e.Bc?e.Bc.length:0;r>=t||(t=Math.max(t,r*(1048576>r?2:1.125)>>>0),0!=r&&(t=Math.max(t,256)),r=e.Bc,e.Bc=new Uint8Array(t),0<e.Ec&&e.Bc.set(r.subarray(0,e.Ec),0))}var ge={Uc:null,Fc:()=>ge.createNode(null,"/",16895,0),createNode(e,t,r,n){if(24576==(61440&r)||Ge.isFIFO(r))throw new Ge.xc(63);return ge.Uc||(ge.Uc={dir:{node:{Sc:ge.zc.Sc,Ic:ge.zc.Ic,lookup:ge.zc.lookup,Wc:ge.zc.Wc,rename:ge.zc.rename,unlink:ge.zc.unlink,rmdir:ge.zc.rmdir,readdir:ge.zc.readdir,symlink:ge.zc.symlink},stream:{Mc:ge.Ac.Mc}},file:{node:{Sc:ge.zc.Sc,Ic:ge.zc.Ic},stream:{Mc:ge.Ac.Mc,read:ge.Ac.read,write:ge.Ac.write,md:ge.Ac.md,jd:ge.Ac.jd,rd:ge.Ac.rd}},link:{node:{Sc:ge.zc.Sc,Ic:ge.zc.Ic,readlink:ge.zc.readlink},stream:{}},$d:{node:{Sc:ge.zc.Sc,Ic:ge.zc.Ic},stream:Ge.De}}),Ae((r=Ge.createNode(e,t,r,n)).mode)?(r.zc=ge.Uc.dir.node,r.Ac=ge.Uc.dir.stream,r.Bc={}):Ge.isFile(r.mode)?(r.zc=ge.Uc.file.node,r.Ac=ge.Uc.file.stream,r.Ec=0,r.Bc=null):40960==(61440&r.mode)?(r.zc=ge.Uc.link.node,r.Ac=ge.Uc.link.stream):8192==(61440&r.mode)&&(r.zc=ge.Uc.$d.node,r.Ac=ge.Uc.$d.stream),r.atime=r.mtime=r.ctime=Date.now(),e&&(e.Bc[t]=r,e.atime=e.mtime=e.ctime=r.atime),r},Cf:e=>e.Bc?e.Bc.subarray?e.Bc.subarray(0,e.Ec):new Uint8Array(e.Bc):new Uint8Array(0),zc:{Sc(e){var t={};return t.dev=8192==(61440&e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=Ae(e.mode)?4096:Ge.isFile(e.mode)?e.Ec:40960==(61440&e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.Be=4096,t.blocks=Math.ceil(t.size/t.Be),t},Ic(e,t){for(var r of["mode","atime","mtime","ctime"])t[r]&&(e[r]=t[r]);void 0!==t.size&&e.Ec!=(t=t.size)&&(0==t?(e.Bc=null,e.Ec=0):(r=e.Bc,e.Bc=new Uint8Array(t),r&&e.Bc.set(r.subarray(0,Math.min(t,e.Ec))),e.Ec=t))},lookup(){throw ge.he},Wc:(e,t,r,n)=>ge.createNode(e,t,r,n),rename(e,t,r){try{var n=Ee(t,r)}catch(e){}if(n){if(Ae(e.mode))for(var i in n.Bc)throw new Ge.xc(55);$e(n)}delete e.parent.Bc[e.name],t.Bc[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.Bc[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r,n=Ee(e,t);for(r in n.Bc)throw new Ge.xc(55);delete e.Bc[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.Bc)],symlink:(e,t,r)=>((e=ge.createNode(e,t,41471,0)).link=r,e),readlink(e){if(40960!=(61440&e.mode))throw new Ge.xc(28);return e.link}},Ac:{read(e,t,r,n,i){var a=e.node.Bc;if(i>=e.node.Ec)return 0;if(8<(e=Math.min(e.node.Ec-i,n))&&a.subarray)t.set(a.subarray(i,i+e),r);else for(n=0;n<e;n++)t[r+n]=a[i+n];return e},write(e,t,r,n,i,a){if(t.buffer===x.buffer&&(a=!1),!n)return 0;if((e=e.node).mtime=e.ctime=Date.now(),t.subarray&&(!e.Bc||e.Bc.subarray)){if(a)return e.Bc=t.subarray(r,r+n),e.Ec=n;if(0===e.Ec&&0===i)return e.Bc=t.slice(r,r+n),e.Ec=n;if(i+n<=e.Ec)return e.Bc.set(t.subarray(r,r+n),i),n}if(me(e,i+n),e.Bc.subarray&&t.subarray)e.Bc.set(t.subarray(r,r+n),i);else for(a=0;a<n;a++)e.Bc[i+a]=t[r+a];return e.Ec=Math.max(e.Ec,i+n),n},Mc(e,t,r){if(1===r?t+=e.position:2===r&&Ge.isFile(e.node.mode)&&(t+=e.node.Ec),0>t)throw new Ge.xc(28);return t},md(e,t,r){me(e.node,t+r),e.node.Ec=Math.max(e.node.Ec,t+r)},jd(e,t,r,n,i){if(!Ge.isFile(e.node.mode))throw new Ge.xc(43);if(e=e.node.Bc,2&i||!e||e.buffer!==x.buffer){if(n=!0,I(),!(i=void 0))throw new Ge.xc(48);e&&((0<r||r+t<e.length)&&(e=e.subarray?e.subarray(r,r+t):Array.prototype.slice.call(e,r,r+t)),x.set(e,i))}else n=!1,i=e.byteOffset;return{Cc:i,ff:n}},rd:(e,t,r,n)=>(ge.Ac.write(e,t,0,n,r,!1),0)}},ye=i.preloadPlugins||[],we=(e,t,r,n,i,a,o,s,c,d)=>{function u(r){function l(r){d?.(),s||Ge.Hd(e,t,r,n,i,c),a?.(),j()}((e,t,r,n)=>{"undefined"!=typeof Browser&&_e();var i=!1;return ye.forEach((a=>{!i&&a.canHandle(t)&&(a.handle(e,t,r,n),i=!0)})),i})(r,h,l,(()=>{o?.(),j()}))||l(r)}var h=t?ie(ee(e+"/"+t)):e;M(),"string"==typeof r?(async e=>(e=await l(e),new Uint8Array(e)))(r).then(u,o):u(r)},be=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r};function _e(){var e,t,r;Ge.Kd=!0,e??=i.stdin,t??=i.stdout,r??=i.stderr,e?Ge.Vc("/dev","stdin",e):Ge.symlink("/dev/tty","/dev/stdin"),t?Ge.Vc("/dev","stdout",null,t):Ge.symlink("/dev/tty","/dev/stdout"),r?Ge.Vc("/dev","stderr",null,r):Ge.symlink("/dev/tty1","/dev/stderr"),Ge.open("/dev/stdin",0),Ge.open("/dev/stdout",1),Ge.open("/dev/stderr",1)}function xe(e,t){Ge.fe[e]={Ac:t}}function Ae(e){return 16384==(61440&e)}function Ee(e,t){var r=Ae(e.mode)?(r=Fe(e,"x"))?r:e.zc.lookup?0:2:54;if(r)throw new Ge.xc(r);for(r=Ge.Tc[Ce(e.id,t)];r;r=r.cd)if(r.parent.id===e.id&&r.name===t)return r;return Ge.lookup(e,t)}function $e(e){var t=Ce(e.parent.id,e.name);if(Ge.Tc[t]===e)Ge.Tc[t]=e.cd;else for(t=Ge.Tc[t];t;){if(t.cd===e){t.cd=e.cd;break}t=t.cd}}function Se(e,t={}){if(!e)return{path:"",node:null};t.yd??(t.yd=!0),"/"===e.charAt(0)||(e=Ge.cwd()+"/"+e);var r=0;e:for(;40>r;r++){e=e.split("/").filter((e=>!!e&&"."!==e));for(var n=Ge.root,i="/",a=0;a<e.length;a++){var o=a===e.length-1;if(o&&t.parent)break;if(".."===e[a])i=te(i),n=n.parent;else{i=ee(i+"/"+e[a]);try{n=Ee(n,e[a])}catch(e){if(44===e?.Rc&&o&&t.We)return{path:i};throw e}if(!n.Pc||o&&!t.yd||(n=n.Pc.root),40960==(61440&n.mode)&&(!o||t.Oc)){if(!n.zc.readlink)throw new Ge.xc(52);"/"===(n=n.zc.readlink(n)).charAt(0)||(n=te(i)+"/"+n),e=n+"/"+e.slice(a+1).join("/");continue e}}}return{path:i,node:n}}throw new Ge.xc(32)}function Te(e){for(var t;;){if(Ge.le(e))return e=e.Fc.ne,t?"/"!==e[e.length-1]?`${e}/${t}`:e+t:e;t=t?`${e.name}/${t}`:e.name,e=e.parent}}function Ce(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Ge.Tc.length}function Pe(e){var t=Ce(e.parent.id,e.name);e.cd=Ge.Tc[t],Ge.Tc[t]=e}function ke(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t}function Fe(e,t){return Ge.ke?0:!t.includes("r")||292&e.mode?t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0:2}function Ue(e,t){if(!Ae(e.mode))return 54;try{return Ee(e,t),20}catch(e){}return Fe(e,"wx")}function Le(e,t,r){try{var n=Ee(e,t)}catch(e){return e.Rc}if(e=Fe(e,"wx"))return e;if(r){if(!Ae(n.mode))return 54;if(Ge.le(n)||Te(n)===Ge.cwd())return 10}else if(Ae(n.mode))return 31;return 0}function Re(e){if(!(e=Ge.Oe(e)))throw new Ge.xc(8);return e}function Oe(e,t=-1){if(e=Object.assign(new Ge.ye,e),-1==t)e:{for(t=0;t<=Ge.Ae;t++)if(!Ge.streams[t])break e;throw new Ge.xc(33)}return e.fd=t,Ge.streams[t]=e}function ze(e){var t=[];for(e=[e];e.length;){var r=e.pop();t.push(r),e.push(...r.qd)}return t}function De(e,t,r){return void 0===r&&(r=t,t=438),Ge.Wc(e,8192|t,r)}function Me(e){if(!(e.Ue||e.Ve||e.link||e.Bc)){if("undefined"!=typeof XMLHttpRequest)throw Error("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.");try{e.Bc=u(e.url),e.Ec=e.Bc.length}catch(e){throw new Ge.xc(29)}}}var je,Ie,We,Ge={root:null,qd:[],fe:{},streams:[],Pd:1,Tc:null,ce:"/",Kd:!1,ke:!0,xc:class{name="ErrnoError";constructor(e){this.Rc=e}},Ke:null,Fd:0,qe:{},ye:class{Kc={};node=null;get object(){return this.node}set object(e){this.node=e}get flags(){return this.Kc.flags}set flags(e){this.Kc.flags=e}get position(){return this.Kc.position}set position(e){this.Kc.position=e}},xe:class{zc={};Ac={};Pc=null;constructor(e,t,r,n){e||=this,this.parent=e,this.Fc=e.Fc,this.id=Ge.Pd++,this.name=t,this.mode=r,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return!(365&~this.mode)}set read(e){e?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(e){e?this.mode|=146:this.mode&=-147}get Ve(){return Ae(this.mode)}get Ue(){return 8192==(61440&this.mode)}},createNode:(e,t,r,n)=>(Pe(e=new Ge.xe(e,t,r,n)),e),le:e=>e===e.parent,isFile:e=>32768==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),Ae:4096,Oe:e=>Ge.streams[e],De:{open(e){e.Ac=Ge.Me(e.node.rdev).Ac,e.Ac.open?.(e)},Mc(){throw new Ge.xc(70)}},Nd:e=>e>>8,Gf:e=>255&e,bd:(e,t)=>e<<8|t,Me:e=>Ge.fe[e],se(e,t){function r(e){return Ge.Fd--,t(e)}function n(e){if(e){if(!n.Ie)return n.Ie=!0,r(e)}else++a>=i.length&&r(null)}"function"==typeof e&&(t=e,e=!1),Ge.Fd++,1<Ge.Fd&&w(`warning: ${Ge.Fd} FS.syncfs operations in flight at once, probably just doing extra work`);var i=ze(Ge.root.Fc),a=0;i.forEach((t=>{if(!t.type.se)return n(null);t.type.se(t,e,n)}))},Fc(e,t,r){var n="/"===r;if(n&&Ge.root)throw new Ge.xc(10);if(!n&&r){var i=Se(r,{yd:!1});if(r=i.path,(i=i.node).Pc)throw new Ge.xc(10);if(!Ae(i.mode))throw new Ge.xc(54)}return(e=e.Fc(t={type:e,Xe:t,ne:r,qd:[]})).Fc=t,t.root=e,n?Ge.root=e:i&&(i.Pc=t,i.Fc&&i.Fc.qd.push(t)),e},Sf(e){if(!(e=Se(e,{yd:!1})).node.Pc)throw new Ge.xc(28);var t=(e=e.node).Pc,r=ze(t);Object.keys(Ge.Tc).forEach((e=>{for(e=Ge.Tc[e];e;){var t=e.cd;r.includes(e.Fc)&&$e(e),e=t}})),e.Pc=null,e.Fc.qd.splice(e.Fc.qd.indexOf(t),1)},lookup:(e,t)=>e.zc.lookup(e,t),Wc(e,t,r){var n=Se(e,{parent:!0}).node;if(!(e=re(e))||"."===e||".."===e)throw new Ge.xc(28);var i=Ue(n,e);if(i)throw new Ge.xc(i);if(!n.zc.Wc)throw new Ge.xc(63);return n.zc.Wc(n,e,t,r)},re(e){var t={jf:4096,zf:4096,blocks:1e6,hf:5e5,gf:5e5,files:Ge.Pd,xf:Ge.Pd-1,Af:42,flags:2,Kf:255};return e=Se(e,{Oc:!0}).node,e?.zc.re&&Object.assign(t,e.zc.re(e.Fc.Xe.root)),t},create:(e,t=438)=>Ge.Wc(e,4095&t|32768,0),mkdir:(e,t=511)=>Ge.Wc(e,1023&t|16384,0),If(e,t){e=e.split("/");for(var r="",n=0;n<e.length;++n)if(e[n]){r+="/"+e[n];try{Ge.mkdir(r,t)}catch(e){if(20!=e.Rc)throw e}}},symlink(e,t){if(!ie(e))throw new Ge.xc(44);var r=Se(t,{parent:!0}).node;if(!r)throw new Ge.xc(44);var n=Ue(r,t=re(t));if(n)throw new Ge.xc(n);if(!r.zc.symlink)throw new Ge.xc(63);return r.zc.symlink(r,t,e)},rename(e,t){var r=te(e),n=te(t),i=re(e),a=re(t),o=Se(e,{parent:!0}),s=o.node;if(o=(o=Se(t,{parent:!0})).node,!s||!o)throw new Ge.xc(44);if(s.Fc!==o.Fc)throw new Ge.xc(75);var c=Ee(s,i);if("."!==(e=ae(e,n)).charAt(0))throw new Ge.xc(28);if("."!==(e=ae(t,r)).charAt(0))throw new Ge.xc(55);try{var d=Ee(o,a)}catch(e){}if(c!==d){if(i=Le(s,i,t=Ae(c.mode)))throw new Ge.xc(i);if(i=d?Le(o,a,t):Ue(o,a))throw new Ge.xc(i);if(!s.zc.rename)throw new Ge.xc(63);if(c.Pc||d&&d.Pc)throw new Ge.xc(10);if(o!==s&&(i=Fe(s,"w")))throw new Ge.xc(i);$e(c);try{s.zc.rename(c,o,a),c.parent=o}catch(e){throw e}finally{Pe(c)}}},rmdir(e){var t=Se(e,{parent:!0}).node,r=Ee(t,e=re(e)),n=Le(t,e,!0);if(n)throw new Ge.xc(n);if(!t.zc.rmdir)throw new Ge.xc(63);if(r.Pc)throw new Ge.xc(10);t.zc.rmdir(t,e),$e(r)},readdir(e){if(!(e=Se(e,{Oc:!0}).node).zc.readdir)throw new Ge.xc(54);return e.zc.readdir(e)},unlink(e){var t=Se(e,{parent:!0}).node;if(!t)throw new Ge.xc(44);var r=Ee(t,e=re(e)),n=Le(t,e,!1);if(n)throw new Ge.xc(n);if(!t.zc.unlink)throw new Ge.xc(63);if(r.Pc)throw new Ge.xc(10);t.zc.unlink(t,e),$e(r)},readlink(e){if(!(e=Se(e).node))throw new Ge.xc(44);if(!e.zc.readlink)throw new Ge.xc(28);return e.zc.readlink(e)},stat(e,t){if(!(e=Se(e,{Oc:!t}).node))throw new Ge.xc(44);if(!e.zc.Sc)throw new Ge.xc(63);return e.zc.Sc(e)},lstat:e=>Ge.stat(e,!0),chmod(e,t,r){if(!(e="string"==typeof e?Se(e,{Oc:!r}).node:e).zc.Ic)throw new Ge.xc(63);e.zc.Ic(e,{mode:4095&t|-4096&e.mode,ctime:Date.now()})},lchmod(e,t){Ge.chmod(e,t,!0)},fchmod(e,t){e=Re(e),Ge.chmod(e.node,t)},chown(e,t,r,n){if(!(e="string"==typeof e?Se(e,{Oc:!n}).node:e).zc.Ic)throw new Ge.xc(63);e.zc.Ic(e,{timestamp:Date.now()})},lchown(e,t,r){Ge.chown(e,t,r,!0)},fchown(e,t,r){e=Re(e),Ge.chown(e.node,t,r)},truncate(e,t){if(0>t)throw new Ge.xc(28);if(!(e="string"==typeof e?Se(e,{Oc:!0}).node:e).zc.Ic)throw new Ge.xc(63);if(Ae(e.mode))throw new Ge.xc(31);if(!Ge.isFile(e.mode))throw new Ge.xc(28);var r=Fe(e,"w");if(r)throw new Ge.xc(r);e.zc.Ic(e,{size:t,timestamp:Date.now()})},Bf(e,t){if(!(2097155&(e=Re(e)).flags))throw new Ge.xc(28);Ge.truncate(e.node,t)},Uf(e,t,r){(e=Se(e,{Oc:!0}).node).zc.Ic(e,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new Ge.xc(44);if("string"==typeof t){var n={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===n)throw Error(`Unknown file open mode: ${t}`);t=n}r=64&t?4095&r|32768:0,"object"==typeof e?n=e:(n=(e=Se(e,{Oc:!(131072&t),We:!0})).node,e=e.path);var a=!1;if(64&t)if(n){if(128&t)throw new Ge.xc(20)}else n=Ge.Wc(e,r,0),a=!0;if(!n)throw new Ge.xc(44);if(8192==(61440&n.mode)&&(t&=-513),65536&t&&!Ae(n.mode))throw new Ge.xc(54);if(!a&&(r=n?40960==(61440&n.mode)?32:Ae(n.mode)&&("r"!==ke(t)||512&t)?31:Fe(n,ke(t)):44))throw new Ge.xc(r);return 512&t&&!a&&Ge.truncate(n,0),t&=-131713,(r=Oe({node:n,path:Te(n),flags:t,seekable:!0,position:0,Ac:n.Ac,ef:[],error:!1})).Ac.open&&r.Ac.open(r),!i.logReadFiles||1&t||e in Ge.qe||(Ge.qe[e]=1),r},close(e){if(null===e.fd)throw new Ge.xc(8);e.Jd&&(e.Jd=null);try{e.Ac.close&&e.Ac.close(e)}catch(e){throw e}finally{Ge.streams[e.fd]=null}e.fd=null},Mc(e,t,r){if(null===e.fd)throw new Ge.xc(8);if(!e.seekable||!e.Ac.Mc)throw new Ge.xc(70);if(0!=r&&1!=r&&2!=r)throw new Ge.xc(28);return e.position=e.Ac.Mc(e,t,r),e.ef=[],e.position},read(e,t,r,n,i){if(0>n||0>i)throw new Ge.xc(28);if(null===e.fd)throw new Ge.xc(8);if(1==(2097155&e.flags))throw new Ge.xc(8);if(Ae(e.node.mode))throw new Ge.xc(31);if(!e.Ac.read)throw new Ge.xc(28);var a=void 0!==i;if(a){if(!e.seekable)throw new Ge.xc(70)}else i=e.position;return t=e.Ac.read(e,t,r,n,i),a||(e.position+=t),t},write(e,t,r,n,i,a){if(0>n||0>i)throw new Ge.xc(28);if(null===e.fd)throw new Ge.xc(8);if(!(2097155&e.flags))throw new Ge.xc(8);if(Ae(e.node.mode))throw new Ge.xc(31);if(!e.Ac.write)throw new Ge.xc(28);e.seekable&&1024&e.flags&&Ge.Mc(e,0,2);var o=void 0!==i;if(o){if(!e.seekable)throw new Ge.xc(70)}else i=e.position;return t=e.Ac.write(e,t,r,n,i,a),o||(e.position+=t),t},md(e,t,r){if(null===e.fd)throw new Ge.xc(8);if(0>t||0>=r)throw new Ge.xc(28);if(!(2097155&e.flags))throw new Ge.xc(8);if(!Ge.isFile(e.node.mode)&&!Ae(e.node.mode))throw new Ge.xc(43);if(!e.Ac.md)throw new Ge.xc(138);e.Ac.md(e,t,r)},jd(e,t,r,n,i){if(2&n&&!(2&i)&&2!=(2097155&e.flags))throw new Ge.xc(2);if(1==(2097155&e.flags))throw new Ge.xc(2);if(!e.Ac.jd)throw new Ge.xc(43);if(!t)throw new Ge.xc(28);return e.Ac.jd(e,t,r,n,i)},rd:(e,t,r,n,i)=>e.Ac.rd?e.Ac.rd(e,t,r,n,i):0,Ld(e,t,r){if(!e.Ac.Ld)throw new Ge.xc(59);return e.Ac.Ld(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw Error(`Invalid encoding type "${t.encoding}"`);var r,n=Ge.open(e,t.flags);e=Ge.stat(e).size;var i=new Uint8Array(e);return Ge.read(n,i,0,e,0),"utf8"===t.encoding?r=Q(i):"binary"===t.encoding&&(r=i),Ge.close(n),r},writeFile(e,t,r={}){if(r.flags=r.flags||577,e=Ge.open(e,r.flags,r.mode),"string"==typeof t){var n=new Uint8Array(se(t)+1);t=ce(t,n,0,n.length),Ge.write(e,n,0,t,void 0,r.Ce)}else{if(!ArrayBuffer.isView(t))throw Error("Unsupported data type");Ge.write(e,t,0,t.byteLength,void 0,r.Ce)}Ge.close(e)},cwd:()=>Ge.ce,chdir(e){if(null===(e=Se(e,{Oc:!0})).node)throw new Ge.xc(44);if(!Ae(e.node.mode))throw new Ge.xc(54);var t=Fe(e.node,"x");if(t)throw new Ge.xc(t);Ge.ce=e.path},Nf(){Ge.Kd=!1;for(var e=0;e<Ge.streams.length;e++){var t=Ge.streams[e];t&&Ge.close(t)}},yf(e,t){try{var r=Se(e,{Oc:!t});e=r.path}catch(e){}var n=!1,i=null;try{r=Se(e,{parent:!0}),re(e),r=Se(e,{Oc:!t}),n=!0,i=r.node}catch(e){}return n?i:null},be(e,t){for(e="string"==typeof e?e:Te(e),t=t.split("/").reverse();t.length;){var r=t.pop();if(r){var n=ee(e+"/"+r);try{Ge.mkdir(n)}catch(e){}e=n}}return n},Hd(e,t,r,n,i,a){var o=t;if(e&&(e="string"==typeof e?e:Te(e),o=t?ee(e+"/"+t):e),e=be(n,i),o=Ge.create(o,e),r){if("string"==typeof r){for(t=Array(r.length),n=0,i=r.length;n<i;++n)t[n]=r.charCodeAt(n);r=t}Ge.chmod(o,146|e),t=Ge.open(o,577),Ge.write(t,r,0,r.length,0,a),Ge.close(t),Ge.chmod(o,e)}},Vc(e,t,r,n){var i;return e=((e,t)=>ee(e+"/"+t))("string"==typeof e?e:Te(e),t),t=be(!!r,!!n),(i=Ge.Vc).Nd??(i.Nd=64),xe(i=Ge.bd(Ge.Vc.Nd++,0),{open(e){e.seekable=!1},close(){n?.buffer?.length&&n(10)},read(e,t,n,i){for(var a=0,o=0;o<i;o++){try{var s=r()}catch(e){throw new Ge.xc(29)}if(void 0===s&&0===a)throw new Ge.xc(6);if(null==s)break;a++,t[n+o]=s}return a&&(e.node.atime=Date.now()),a},write(e,t,r,i){for(var a=0;a<i;a++)try{n(t[r+a])}catch(e){throw new Ge.xc(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),a}}),De(e,t,i)},ae(e,t,r,n,i){class a{Vd=!1;Kc=[];Ud=void 0;Xd=0;Wd=0;get(e){if(!(e>this.length-1||0>e)){var t=e%this.chunkSize;return this.Ud(e/this.chunkSize|0)[t]}}we(e){this.Ud=e}Yd(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(200<=e.status&&300>e.status||304===e.status))throw Error("Couldn't load "+r+". Status: "+e.status);var t,n=Number(e.getResponseHeader("Content-length")),i=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t;e=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t;var a=1048576;i||(a=n);var o=this;o.we((e=>{var t=e*a,i=(e+1)*a-1;if(i=Math.min(i,n-1),void 0===o.Kc[e]){var s=o.Kc;if(t>i)throw Error("invalid range ("+t+", "+i+") or no bytes requested!");if(i>n-1)throw Error("only "+n+" bytes available! programmer error!");var c=new XMLHttpRequest;if(c.open("GET",r,!1),n!==a&&c.setRequestHeader("Range","bytes="+t+"-"+i),c.responseType="arraybuffer",c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),c.send(null),!(200<=c.status&&300>c.status||304===c.status))throw Error("Couldn't load "+r+". Status: "+c.status);t=void 0!==c.response?new Uint8Array(c.response||[]):de(c.responseText||""),s[e]=t}if(void 0===o.Kc[e])throw Error("doXHR failed!");return o.Kc[e]})),!e&&n||(a=n=1,a=n=this.Ud(0).length,y("LazyFiles on gzip forces download of the whole file when length is accessed")),this.Xd=n,this.Wd=a,this.Vd=!0}get length(){return this.Vd||this.Yd(),this.Xd}get chunkSize(){return this.Vd||this.Yd(),this.Wd}}if("undefined"!=typeof XMLHttpRequest){if(!s)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new a,c=void 0}else c=r,o=void 0;var d=function(e,t,r,n){return e="string"==typeof e?e:Te(e),t=ee(e+"/"+t),Ge.create(t,be(r,n))}(e,t,n,i);o?d.Bc=o:c&&(d.Bc=null,d.url=c),Object.defineProperties(d,{Ec:{get:function(){return this.Bc.length}}});var l={};return Object.keys(d.Ac).forEach((e=>{var t=d.Ac[e];l[e]=(...e)=>(Me(d),t(...e))})),l.read=(e,t,r,n,i)=>{if(Me(d),i>=(e=e.node.Bc).length)t=0;else{if(n=Math.min(e.length-i,n),e.slice)for(var a=0;a<n;a++)t[r+a]=e[i+a];else for(a=0;a<n;a++)t[r+a]=e.get(i+a);t=n}return t},l.jd=()=>{throw Me(d),I(),new Ge.xc(48)},d.Ac=l,d}},Ne=void 0,Ve=e=>{for(var t="";A[e];)t+=je[A[e++]];return t},He={},qe={},Xe={},Je=e=>{throw new Ie(e)},Ke=(e,t,r)=>{function n(t){if((t=r(t)).length!==e.length)throw new We("Mismatched type converter count");for(var n=0;n<e.length;++n)Qe(e[n],t[n])}e.forEach((e=>Xe[e]=t));var i=Array(t.length),a=[],o=0;t.forEach(((e,t)=>{qe.hasOwnProperty(e)?i[t]=qe[e]:(a.push(e),He.hasOwnProperty(e)||(He[e]=[]),He[e].push((()=>{i[t]=qe[e],++o===a.length&&n(i)})))})),0===a.length&&n(i)};function Qe(e,t,r={}){return function(e,t,r={}){var n=t.name;if(!e)throw new Ie(`type "${n}" must have a positive integer typeid pointer`);if(qe.hasOwnProperty(e)){if(r.Pe)return;throw new Ie(`Cannot register type '${n}' twice`)}qe[e]=t,delete Xe[e],He.hasOwnProperty(e)&&(t=He[e],delete He[e],t.forEach((e=>e())))}(e,t,r)}var Ye=e=>{throw new Ie(e.yc.Gc.Dc.name+" instance already deleted")},Ze=!1,et=()=>{},tt=(e,t,r)=>t===r?e:void 0===r.Lc||null===(e=tt(e,t,r.Lc))?null:r.He(e),rt={},nt={},it=(e,t)=>{if(!t.Gc||!t.Cc)throw new We("makeClassHandle requires ptr and ptrType");if(!!t.Nc!=!!t.Jc)throw new We("Both smartPtrType and smartPtr must be specified");return t.count={value:1},at(Object.create(e,{yc:{value:t,writable:!0}}))},at=e=>"undefined"==typeof FinalizationRegistry?(at=e=>e,e):(Ze=new FinalizationRegistry((e=>{--(e=e.yc).count.value,0===e.count.value&&(e.Jc?e.Nc.Zc(e.Jc):e.Gc.Dc.Zc(e.Cc))})),at=e=>{var t=e.yc;return t.Jc&&Ze.register(e,{yc:t},e),e},et=e=>{Ze.unregister(e)},at(e));function ot(){}var st=(e,t)=>Object.defineProperty(t,"name",{value:e}),ct=(e,t,r)=>{if(void 0===e[t].Hc){var n=e[t];e[t]=function(...n){if(!e[t].Hc.hasOwnProperty(n.length))throw new Ie(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].Hc})!`);return e[t].Hc[n.length].apply(this,n)},e[t].Hc=[],e[t].Hc[n.nd]=n}},dt=(e,t,r)=>{if(i.hasOwnProperty(e)){if(void 0===r||void 0!==i[e].Hc&&void 0!==i[e].Hc[r])throw new Ie(`Cannot register public name '${e}' twice`);if(ct(i,e,e),i[e].Hc.hasOwnProperty(r))throw new Ie(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`);i[e].Hc[r]=t}else i[e]=t,i[e].nd=r};function lt(e,t,r,n,i,a,o,s){this.name=e,this.constructor=t,this.hd=r,this.Zc=n,this.Lc=i,this.Le=a,this.vd=o,this.He=s,this.Ze=[]}var ut=(e,t,r)=>{for(;t!==r;){if(!t.vd)throw new Ie(`Expected null or instance of ${r.name}, got an instance of ${t.name}`);e=t.vd(e),t=t.Lc}return e};function ht(e,t){if(null===t){if(this.Md)throw new Ie(`null is not a valid ${this.name}`);return 0}if(!t.yc)throw new Ie(`Cannot pass "${tr(t)}" as a ${this.name}`);if(!t.yc.Cc)throw new Ie(`Cannot pass deleted object as a pointer of type ${this.name}`);return ut(t.yc.Cc,t.yc.Gc.Dc,this.Dc)}function ft(e,t){if(null===t){if(this.Md)throw new Ie(`null is not a valid ${this.name}`);if(this.Ad){var r=this.af();return null!==e&&e.push(this.Zc,r),r}return 0}if(!t||!t.yc)throw new Ie(`Cannot pass "${tr(t)}" as a ${this.name}`);if(!t.yc.Cc)throw new Ie(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.zd&&t.yc.Gc.zd)throw new Ie(`Cannot convert argument of type ${t.yc.Nc?t.yc.Nc.name:t.yc.Gc.name} to parameter type ${this.name}`);if(r=ut(t.yc.Cc,t.yc.Gc.Dc,this.Dc),this.Ad){if(void 0===t.yc.Jc)throw new Ie("Passing raw pointer to smart pointer is illegal");switch(this.df){case 0:if(t.yc.Nc!==this)throw new Ie(`Cannot convert argument of type ${t.yc.Nc?t.yc.Nc.name:t.yc.Gc.name} to parameter type ${this.name}`);r=t.yc.Jc;break;case 1:r=t.yc.Jc;break;case 2:if(t.yc.Nc===this)r=t.yc.Jc;else{var n=t.clone();r=this.bf(r,Zt((()=>n.delete()))),null!==e&&e.push(this.Zc,r)}break;default:throw new Ie("Unsupporting sharing policy")}}return r}function pt(e,t){if(null===t){if(this.Md)throw new Ie(`null is not a valid ${this.name}`);return 0}if(!t.yc)throw new Ie(`Cannot pass "${tr(t)}" as a ${this.name}`);if(!t.yc.Cc)throw new Ie(`Cannot pass deleted object as a pointer of type ${this.name}`);if(t.yc.Gc.zd)throw new Ie(`Cannot convert argument of type ${t.yc.Gc.name} to parameter type ${this.name}`);return ut(t.yc.Cc,t.yc.Gc.Dc,this.Dc)}function mt(e){return this.fromWireType(T[e>>2])}function vt(e,t,r,n,i,a,o,s,c,d,l){this.name=e,this.Dc=t,this.Md=r,this.zd=n,this.Ad=i,this.Ye=a,this.df=o,this.pe=s,this.af=c,this.bf=d,this.Zc=l,i||void 0!==t.Lc?this.toWireType=ft:(this.toWireType=n?ht:pt,this.Qc=null)}var gt,yt,wt=(e,t,r)=>{if(!i.hasOwnProperty(e))throw new We("Replacing nonexistent public symbol");void 0!==i[e].Hc&&void 0!==r?i[e].Hc[r]=t:(i[e]=t,i[e].nd=r)},bt=(e,t)=>{var r=(e=Ve(e)).includes("j")?((e,t)=>(...r)=>((e,t,r=[])=>(e.includes("j")?(e=e.replace(/p/g,"i"),t=(0,i["dynCall_"+e])(t,...r)):t=gt.get(t)(...r),t))(e,t,r))(e,t):gt.get(t);if("function"!=typeof r)throw new Ie(`unknown function pointer with signature ${e}: ${t}`);return r},_t=e=>{e=Bn(e);var t=Ve(e);return Fn(e),t},xt=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||qe[t]||(Xe[t]?Xe[t].forEach(e):(r.push(t),n[t]=!0))})),new yt(`${e}: `+r.map(_t).join([", "]))},At=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(T[t+4*n>>2]);return r},Et=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function $t(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].Qc)return!0;return!1}function St(e,t,r,n,i,a){var o=t.length;if(2>o)throw new Ie("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==t[1]&&null!==r,c=$t(t);for(r="void"!==t[0].name,n=[e,Je,n,i,Et,t[0],t[1]],i=0;i<o-2;++i)n.push(t[i+2]);if(!c)for(i=s?1:2;i<t.length;++i)null!==t[i].Qc&&n.push(t[i].Qc);c=$t(t),i=t.length-2;var d=[],l=["fn"];for(s&&l.push("thisWired"),o=0;o<i;++o)d.push(`arg${o}`),l.push(`arg${o}Wired`);d=d.join(","),l=l.join(","),d=`return function (${d}) {\n`,c&&(d+="var destructors = [];\n");var u=c?"destructors":"null",h="humanName throwBindingError invoker fn runDestructors retType classParam".split(" ");for(s&&(d+=`var thisWired = classParam['toWireType'](${u}, this);\n`),o=0;o<i;++o)d+=`var arg${o}Wired = argType${o}['toWireType'](${u}, arg${o});\n`,h.push(`argType${o}`);if(d+=(r||a?"var rv = ":"")+`invoker(${l});\n`,c)d+="runDestructors(destructors);\n";else for(o=s?1:2;o<t.length;++o)a=1===o?"thisWired":"arg"+(o-2)+"Wired",null!==t[o].Qc&&(d+=`${a}_dtor(${a});\n`,h.push(`${a}_dtor`));r&&(d+="var ret = retType['fromWireType'](rv);\nreturn ret;\n");let[f,p]=[h,d+"}\n"];return f.push(p),t=function(e){var t=Function;if(!(t instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof t} which is not a function`);var r=st(t.name||"unknownFunctionName",(function(){}));return r.prototype=t.prototype,r=new r,(e=t.apply(r,e))instanceof Object?e:r}(f)(...n),st(e,t)}var Tt,Ct,Pt,kt,Ft,Ut,Bt,Lt,Rt,Ot,zt,Dt,Mt,jt,It,Wt,Gt,Nt,Vt,Ht,qt,Xt,Jt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Kt=[],Qt=[],Yt=e=>{9<e&&0==--Qt[e+1]&&(Qt[e]=void 0,Kt.push(e))},Zt=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const t=Kt.pop()||Qt.length;return Qt[t]=e,Qt[t+1]=1,t}},er={name:"emscripten::val",fromWireType:e=>{if(!e)throw new Ie("Cannot use deleted val. handle = "+e);var t=Qt[e];return Yt(e),t},toWireType:(e,t)=>Zt(t),Yc:8,readValueFromPointer:mt,Qc:null},tr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},rr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(C[e>>2])};case 8:return function(e){return this.fromWireType(P[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},nr=(e,t,r)=>{switch(t){case 1:return r?e=>x[e]:e=>A[e];case 2:return r?e=>E[e>>1]:e=>$[e>>1];case 4:return r?e=>S[e>>2]:e=>T[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},ir="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,ar=(e,t)=>{for(var r