UNPKG

@thorvg/lottie-player

Version:

A web lottie player using ThorVG as a renderer

1 lines 80.6 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(),o=new WeakMap;let a=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=o.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(t,e))}return e}toString(){return this.cssText}};const s=(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)}},c=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new a("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:l,defineProperty:h,getOwnPropertyDescriptor:b,getOwnPropertyNames:u,getOwnPropertySymbols:d,getPrototypeOf:f}=Object,p=globalThis,m=p.trustedTypes,v=m?m.emptyScript:"",w=p.reactiveElementPolyfillSupport,y=(e,t)=>e,g={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}},_=(e,t)=>!l(e,t),E={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;class $ extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=E){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&&h(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){const{get:n,set:i}=b(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return n?.call(this)},set(t){const o=n?.call(this);i.call(this,t),this.requestUpdate(e,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??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),...d(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(c(e))}else void 0!==e&&t.push(c(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 s(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:g).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:g;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??_)(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){}}$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[y("elementProperties")]=new Map,$[y("finalized")]=new Map,w?.({ReactiveElement:$}),(p.reactiveElementVersions??=[]).push("2.0.4");const A={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:_},S=(e=A,t,r)=>{const{kind:n,metadata:i}=r;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),o.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 k(e){return(t,r)=>"object"==typeof r?S(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)}const T=globalThis,x=T.trustedTypes,P=x?x.createPolicy("lit-html",{createHTML:e=>e}):void 0,R="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,U="?"+C,O=`<${U}>`,L=document,j=()=>L.createComment(""),B=e=>null===e||"object"!=typeof e&&"function"!=typeof e,F=Array.isArray,N="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,M=/>/g,G=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,V=/"/g,W=/^(?:script|style|textarea|title)$/i,H=(e,...t)=>({_$litType$:1,strings:e,values:t}),q=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),J=new WeakMap,K=L.createTreeWalker(L,129);function Y(e,t){if(!F(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(t):t}class Q{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let i=0,o=0;const a=e.length-1,s=this.parts,[c,l]=((e,t)=>{const r=e.length-1,n=[];let i,o=2===t?"<svg>":3===t?"<math>":"",a=I;for(let t=0;t<r;t++){const r=e[t];let s,c,l=-1,h=0;for(;h<r.length&&(a.lastIndex=h,c=a.exec(r),null!==c);)h=a.lastIndex,a===I?"!--"===c[1]?a=D:void 0!==c[1]?a=M:void 0!==c[2]?(W.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=G):void 0!==c[3]&&(a=G):a===G?">"===c[0]?(a=i??I,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?G:'"'===c[3]?V:z):a===V||a===z?a=G:a===D||a===M?a=I:(a=G,i=void 0);const b=a===G&&e[t+1].startsWith("/>")?" ":"";o+=a===I?r+O:l>=0?(n.push(s),r.slice(0,l)+R+r.slice(l)+C+b):r+C+(-2===l?t:b)}return[Y(e,o+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),n]})(e,t);if(this.el=Q.createElement(c,r),K.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=K.nextNode())&&s.length<a;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(R)){const t=l[o++],r=n.getAttribute(e).split(C),a=/([.?@])?(.*)/.exec(t);s.push({type:1,index:i,name:a[2],strings:r,ctor:"."===a[1]?ne:"?"===a[1]?ie:"@"===a[1]?oe:re}),n.removeAttribute(e)}else e.startsWith(C)&&(s.push({type:6,index:i}),n.removeAttribute(e));if(W.test(n.tagName)){const e=n.textContent.split(C),t=e.length-1;if(t>0){n.textContent=x?x.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],j()),K.nextNode(),s.push({type:2,index:++i});n.append(e[t],j())}}}else if(8===n.nodeType)if(n.data===U)s.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(C,e+1));)s.push({type:7,index:i}),e+=C.length-1}i++}}static createElement(e,t){const r=L.createElement("template");return r.innerHTML=e,r}}function Z(e,t,r=e,n){if(t===q)return t;let i=void 0!==n?r.o?.[n]:r.l;const o=B(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(e),i._$AT(e,r,n)),void 0!==n?(r.o??=[])[n]=i:r.l=i),void 0!==i&&(t=Z(e,i._$AS(e,t.values),i,n)),t}class ee{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??L).importNode(t,!0);K.currentNode=n;let i=K.nextNode(),o=0,a=0,s=r[0];for(;void 0!==s;){if(o===s.index){let t;2===s.type?t=new te(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new ae(i,this,e)),this._$AV.push(t),s=r[++a]}o!==s?.index&&(i=K.nextNode(),o++)}return K.currentNode=L,n}p(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class te{get _$AU(){return this._$AM?._$AU??this.v}constructor(e,t,r,n){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this.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=Z(this,e,t),B(e)?e===X||null==e||""===e?(this._$AH!==X&&this._$AR(),this._$AH=X):e!==this._$AH&&e!==q&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>F(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==X&&B(this._$AH)?this._$AA.nextSibling.data=e:this.T(L.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Q.createElement(Y(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{const e=new ee(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=J.get(e.strings);return void 0===t&&J.set(e.strings,t=new Q(e)),t}k(e){F(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 te(this.O(j()),this.O(j()),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 re{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=X}_$AI(e,t=this,r,n){const i=this.strings;let o=!1;if(void 0===i)e=Z(this,e,t,0),o=!B(e)||e!==this._$AH&&e!==q,o&&(this._$AH=e);else{const n=e;let a,s;for(e=i[0],a=0;a<i.length-1;a++)s=Z(this,n[r+a],t,a),s===q&&(s=this._$AH[a]),o||=!B(s)||s!==this._$AH[a],s===X?e=X:e!==X&&(e+=(s??"")+i[a+1]),this._$AH[a]=s}o&&!n&&this.j(e)}j(e){e===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ne extends re{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===X?void 0:e}}class ie extends re{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==X)}}class oe extends re{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=Z(this,e,t,0)??X)===q)return;const r=this._$AH,n=e===X&&r!==X||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==X&&(r===X||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ae{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){Z(this,e)}}const se=T.litHtmlPolyfillSupport;se?.(Q,te),(T.litHtmlVersions??=[]).push("3.2.0");class ce extends ${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 te(t.insertBefore(j(),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 q}}ce._$litElement$=!0,ce.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ce});const le=globalThis.litElementPolyfillSupport;async function he(e={}){var r,n=e,i=!!globalThis.window,o=!!globalThis.WorkerGlobalScope,a=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(a){const{createRequire:e}=await Promise.resolve().then((function(){return Se}));var s=e("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("lottie-player.js",document.baseURI).href)}var c,l,h=(e,t)=>{throw t},b="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("lottie-player.js",document.baseURI).href,u="";if(a){var d=s("fs");b.startsWith("file:")&&(u=s("path").dirname(s("url").fileURLToPath(b))+"/"),l=e=>(e=U(e)?new URL(e):e,d.readFileSync(e)),c=async e=>(e=U(e)?new URL(e):e,d.readFileSync(e,void 0)),process.argv.slice(2),h=(e,t)=>{throw process.exitCode=e,t}}else if(i||o){try{u=new URL(".",b).href}catch{}o&&(l=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),c=async e=>{if(U(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 f,p,m,v,w,y,g,_,E,$,A,S,k,T,x,P=void 0,R=void 0,C=!1,U=e=>e.startsWith("file://"),O=!1;function L(){var e=Sr.buffer;w=new Int8Array(e),g=new Int16Array(e),y=new Uint8Array(e),_=new Uint16Array(e),E=new Int32Array(e),$=new Uint32Array(e),A=new Float32Array(e),S=new Float64Array(e),k=new BigInt64Array(e),T=new BigUint64Array(e)}function j(e){throw n.onAbort?.(e),R(e="Aborted("+e+")"),C=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),v?.(e),e}class B{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var F=e=>{for(;0<e.length;)e.shift()(n)},N=[],I=[],D=()=>{var e=n.preRun.shift();I.push(e)},M=!0,G=new TextDecoder,z=(e,t,r,n)=>{if(r=t+r,n)return r;for(;e[t]&&!(t>=r);)++t;return t},V=(e,t,r)=>e?G.decode(y.subarray(e,z(y,e,t,r))):"",W=e=>{for(var t="";;){var r=y[e++];if(!r)return t;t+=String.fromCharCode(r)}},H={},q={},X={},J=class extends Error{constructor(e){super(e),this.name="BindingError"}},K=e=>{throw new J(e)};function Y(e,t,r={}){return function(e,t,r={}){var n=t.name;if(!e)throw new J(`type "${n}" must have a positive integer typeid pointer`);if(q.hasOwnProperty(e)){if(r.od)return;throw new J(`Cannot register type '${n}' twice`)}q[e]=t,delete X[e],H.hasOwnProperty(e)&&(t=H[e],delete H[e],t.forEach((e=>e())))}(e,t,r)}var Q=(e,t,r)=>{switch(t){case 1:return r?e=>w[e]:e=>y[e];case 2:return r?e=>g[e>>1]:e=>_[e>>1];case 4:return r?e=>E[e>>2]:e=>$[e>>2];case 8:return r?e=>k[e>>3]:e=>T[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Z=e=>{throw new J(e.cb.kb.ib.name+" instance already deleted")},ee=!1,te=()=>{},re=e=>globalThis.FinalizationRegistry?(ee=new FinalizationRegistry((e=>{--(e=e.cb).count.value,0===e.count.value&&(e.nb?e.sb.Eb(e.nb):e.kb.ib.Eb(e.hb))})),re=e=>{var t=e.cb;return t.nb&&ee.register(e,{cb:t},e),e},te=e=>{ee.unregister(e)},re(e)):(re=e=>e,e);function ne(){}var ie=(e,t)=>Object.defineProperty(t,"name",{value:e}),oe={},ae=(e,t,r)=>{if(void 0===e[t].mb){var n=e[t];e[t]=function(...n){if(!e[t].mb.hasOwnProperty(n.length))throw new J(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].mb})!`);return e[t].mb[n.length].apply(this,n)},e[t].mb=[],e[t].mb[n.Rb]=n}},se=(e,t,r)=>{if(n.hasOwnProperty(e)){if(void 0===r||void 0!==n[e].mb&&void 0!==n[e].mb[r])throw new J(`Cannot register public name '${e}' twice`);if(ae(n,e,e),n[e].mb.hasOwnProperty(r))throw new J(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`);n[e].mb[r]=t}else n[e]=t,n[e].Rb=r};function ce(e,t,r,n,i,o,a,s){this.name=e,this.constructor=t,this.Mb=r,this.Eb=n,this.pb=i,this.jd=o,this.Zb=a,this.dd=s,this.vd=[]}var le=(e,t,r)=>{for(;t!==r;){if(!t.Zb)throw new J(`Expected null or instance of ${r.name}, got an instance of ${t.name}`);e=t.Zb(e),t=t.pb}return e},he=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function be(e,t){if(null===t){if(this.qc)throw new J(`null is not a valid ${this.name}`);return 0}if(!t.cb)throw new J(`Cannot pass "${he(t)}" as a ${this.name}`);if(!t.cb.hb)throw new J(`Cannot pass deleted object as a pointer of type ${this.name}`);return le(t.cb.hb,t.cb.kb.ib,this.ib)}function ue(e,t){if(null===t){if(this.qc)throw new J(`null is not a valid ${this.name}`);if(this.dc){var r=this.wd();return null!==e&&e.push(this.Eb,r),r}return 0}if(!t||!t.cb)throw new J(`Cannot pass "${he(t)}" as a ${this.name}`);if(!t.cb.hb)throw new J(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.cc&&t.cb.kb.cc)throw new J(`Cannot convert argument of type ${t.cb.sb?t.cb.sb.name:t.cb.kb.name} to parameter type ${this.name}`);if(r=le(t.cb.hb,t.cb.kb.ib,this.ib),this.dc){if(void 0===t.cb.nb)throw new J("Passing raw pointer to smart pointer is illegal");switch(this.yd){case 0:if(t.cb.sb!==this)throw new J(`Cannot convert argument of type ${t.cb.sb?t.cb.sb.name:t.cb.kb.name} to parameter type ${this.name}`);r=t.cb.nb;break;case 1:r=t.cb.nb;break;case 2:if(t.cb.sb===this)r=t.cb.nb;else{var n=t.clone();r=this.xd(r,De((()=>n.delete()))),null!==e&&e.push(this.Eb,r)}break;default:throw new J("Unsupporting sharing policy")}}return r}function de(e,t){if(null===t){if(this.qc)throw new J(`null is not a valid ${this.name}`);return 0}if(!t.cb)throw new J(`Cannot pass "${he(t)}" as a ${this.name}`);if(!t.cb.hb)throw new J(`Cannot pass deleted object as a pointer of type ${this.name}`);if(t.cb.kb.cc)throw new J(`Cannot convert argument of type ${t.cb.kb.name} to parameter type ${this.name}`);return le(t.cb.hb,t.cb.kb.ib,this.ib)}function fe(e){return this.ob($[e>>2])}var pe=(e,t,r)=>t===r?e:void 0===r.pb||null===(e=pe(e,t,r.pb))?null:r.dd(e),me={},ve=class extends Error{constructor(e){super(e),this.name="InternalError"}},we=(e,t)=>{if(!t.kb||!t.hb)throw new ve("makeClassHandle requires ptr and ptrType");if(!!t.sb!=!!t.nb)throw new ve("Both smartPtrType and smartPtr must be specified");return t.count={value:1},re(Object.create(e,{cb:{value:t,writable:!0}}))};function ye(e,t,r,n,i,o,a,s,c,l,h){this.name=e,this.ib=t,this.qc=r,this.cc=n,this.dc=i,this.ud=o,this.yd=a,this.Qc=s,this.wd=c,this.xd=l,this.Eb=h,i||void 0!==t.pb?this.tb=ue:(this.tb=n?be:de,this.ub=null)}var ge=(e,t,r)=>{if(!n.hasOwnProperty(e))throw new ve("Replacing nonexistent public symbol");void 0!==n[e].mb&&void 0!==r?n[e].mb[r]=t:(n[e]=t,n[e].Rb=r)},_e=(e,t)=>{e=W(e);var r=kr.get(t);if("function"!=typeof r)throw new J(`unknown function pointer with signature ${e}: ${t}`);return r};class Ee extends Error{}var $e=e=>{e=$r(e);var t=W(e);return _r(e),t},Ae=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||q[t]||(X[t]?X[t].forEach(e):(r.push(t),n[t]=!0))})),new Ee(`${e}: `+r.map($e).join([", "]))},ke=(e,t,r)=>{function n(t){if((t=r(t)).length!==e.length)throw new ve("Mismatched type converter count");for(var n=0;n<e.length;++n)Y(e[n],t[n])}e.forEach((e=>X[e]=t));var i=Array(t.length),o=[],a=0;t.forEach(((e,t)=>{q.hasOwnProperty(e)?i[t]=q[e]:(o.push(e),H.hasOwnProperty(e)||(H[e]=[]),H[e].push((()=>{i[t]=q[e],++a===o.length&&n(i)})))})),0===o.length&&n(i)},Te=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push($[t+4*n>>2]);return r},xe=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Pe(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].ub)return!0;return!1}function Re(e,t,r,n,i,o){var a=t.length;if(2>a)throw new J("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==t[1]&&null!==r,c=Pe(t);r=!t[0].Mc;var l=t[0],h=t[1];for(n=[e,K,n,i,xe,l.ob.bind(l),h?.tb.bind(h)],i=2;i<a;++i)n.push((l=t[i]).tb.bind(l));if(!c)for(i=s?1:2;i<t.length;++i)null!==t[i].ub&&n.push(t[i].ub);for(c=Pe(t),i=t.length-2,h=[],l=["fn"],s&&l.push("thisWired"),a=0;a<i;++a)h.push(`arg${a}`),l.push(`arg${a}Wired`);h=h.join(","),l=l.join(","),h=`return function (${h}) {\n`,c&&(h+="var destructors = [];\n");var b=c?"destructors":"null",u="humanName throwBindingError invoker fn runDestructors fromRetWire toClassParamWire".split(" ");for(s&&(h+=`var thisWired = toClassParamWire(${b}, this);\n`),a=0;a<i;++a){var d=`toArg${a}Wire`;h+=`var arg${a}Wired = ${d}(${b}, arg${a});\n`,u.push(d)}if(h+=(r||o?"var rv = ":"")+`invoker(${l});\n`,c)h+="runDestructors(destructors);\n";else for(a=s?1:2;a<t.length;++a)o=1===a?"thisWired":"arg"+(a-2)+"Wired",null!==t[a].ub&&(h+=`${o}_dtor(${o});\n`,u.push(`${o}_dtor`));return r&&(h+="var ret = fromRetWire(rv);\nreturn ret;\n"),t=new Function(u,h+"}\n")(...n),ie(e,t)}var Ce,Ue,Oe,Le,je=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},Be=[],Fe=[0,1,,1,null,1,!0,1,!1,1],Ne=e=>{9<e&&0==--Fe[e+1]&&(Fe[e]=void 0,Be.push(e))},Ie=e=>{if(!e)throw new J(`Cannot use deleted val. handle = ${e}`);return Fe[e]},De=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const t=Be.pop()||Fe.length;return Fe[t]=e,Fe[t+1]=1,t}},Me={name:"emscripten::val",ob:e=>{var t=Ie(e);return Ne(e),t},tb:(e,t)=>De(t),Cb:fe,ub:null},Ge=(e,t)=>{switch(t){case 4:return function(e){return this.ob(A[e>>2])};case 8:return function(e){return this.ob(S[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},ze=(e,t,r,n)=>{if(!(0<n))return 0;var i=r;n=r+n-1;for(var o=0;o<e.length;++o){var a=e.codePointAt(o);if(127>=a){if(r>=n)break;t[r++]=a}else if(2047>=a){if(r+1>=n)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(65535>=a){if(r+2>=n)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=n)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a,o++}}return t[r]=0,r-i},Ve=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},We=new TextDecoder("utf-16le"),He=(e,t,r)=>We.decode(_.subarray(e>>=1,z(_,e,t/2,r))),qe=(e,t,r)=>{if(r??=2147483647,2>r)return 0;var n=t;r=(r-=2)<2*e.length?r/2:e.length;for(var i=0;i<r;++i)g[t>>1]=e.charCodeAt(i),t+=2;return g[t>>1]=0,t-n},Xe=e=>2*e.length,Je=(e,t,r)=>{var n="";e>>=2;for(var i=0;!(i>=t/4);i++){var o=$[e+i];if(!o&&!r)break;n+=String.fromCodePoint(o)}return n},Ke=(e,t,r)=>{if(r??=2147483647,4>r)return 0;var n=t;r=n+r-4;for(var i=0;i<e.length;++i){var o=e.codePointAt(i);if(65535<o&&i++,E[t>>2]=o,(t+=4)+4>r)break}return E[t>>2]=0,t-n},Ye=e=>{for(var t=0,r=0;r<e.length;++r)65535<e.codePointAt(r)&&r++,t+=4;return t},Qe=0,Ze=[],et=(e,t,r)=>{var n=[];return e=e(n,r),n.length&&($[t>>2]=De(n)),e},tt={},rt=e=>{var t=tt[e];return void 0===t?W(e):t},nt={},it=e=>{p=e,M||0<Qe||(n.onExit?.(e),C=!0),h(e,new B(e))},ot=e=>{var t="ANGLE_instanced_arrays EXT_blend_minmax EXT_disjoint_timer_query EXT_frag_depth EXT_shader_texture_lod EXT_sRGB OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object WEBGL_color_buffer_float WEBGL_depth_texture WEBGL_draw_buffers EXT_color_buffer_float EXT_conservative_depth EXT_disjoint_timer_query_webgl2 EXT_texture_norm16 NV_shader_noperspective_interpolation WEBGL_clip_cull_distance EXT_clip_control EXT_color_buffer_half_float EXT_depth_clamp EXT_float_blend EXT_polygon_offset_clamp EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic KHR_parallel_shader_compile OES_texture_float_linear WEBGL_blend_func_extended WEBGL_compressed_texture_astc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode".split(" ");return(e.getSupportedExtensions()||[]).filter((e=>t.includes(e)))},at=1,st=[],ct=[],lt=[],ht=[],bt=[],ut=[],dt=[],ft=[],pt=[1,1,2,2,4,4,4,2,3,4,8],mt=e=>{for(var t=at++,r=e.length;r<t;r++)e[r]=null;for(;e[t];)t=at++;return t},vt=(e,t,r,n)=>{for(var i=0;i<e;i++){var o=Ce[r](),a=o&&mt(n);o?(o.name=a,n[a]=o):Ue||=1282,E[t+4*i>>2]=a}},wt=["default","low-power","high-performance"],yt=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],gt=(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},_t=e=>{var t="/"===e.charAt(0),r="/"===e.slice(-1);return(e=gt(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},Et=e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&=t.slice(0,-1),e+t):"."},$t=e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],At=e=>{(At=(()=>{if(a){var e=s("crypto");return t=>e.randomFillSync(t)}return e=>crypto.getRandomValues(e)})())(e)},St=(...e)=>{for(var t="",r=!1,n=e.length-1;-1<=n&&!r;n--){if("string"!=typeof(r=0<=n?e[n]:dr.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";t=r+"/"+t,r="/"===r.charAt(0)}return t=gt(t.split("/").filter((e=>!!e)),!r).join("/"),(r?"/":"")+t||"."},kt=(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=St(e).slice(1),t=St(t).slice(1),e=r(e.split("/")),t=r(t.split("/"));for(var n=Math.min(e.length,t.length),i=n,o=0;o<n;o++)if(e[o]!==t[o]){i=o;break}for(n=[],o=i;o<e.length;o++)n.push("..");return(n=n.concat(t.slice(i))).join("/")},Tt=e=>{var t=z(e,0);return G.decode(e.buffer?e.subarray(0,t):new Uint8Array(e.slice(0,t)))},xt=[],Pt=e=>{var t=Array(Ve(e)+1);return e=ze(e,t,0,t.length),t.length=e,t},Rt=[];function Ct(e,t){Rt[e]={input:[],output:[],Ob:t},Vt(e,Ut)}var Ut={open(e){var t=Rt[e.node.rdev];if(!t)throw new dr.bb(43);e.tty=t,e.seekable=!1},close(e){e.tty.Ob.fsync(e.tty)},fsync(e){e.tty.Ob.fsync(e.tty)},read(e,t,r,n){if(!e.tty||!e.tty.Ob.Ic)throw new dr.bb(60);for(var i=0,o=0;o<n;o++){try{var a=e.tty.Ob.Ic(e.tty)}catch(e){throw new dr.bb(29)}if(void 0===a&&0===i)throw new dr.bb(6);if(null==a)break;i++,t[r+o]=a}return i&&(e.node.atime=Date.now()),i},write(e,t,r,n){if(!e.tty||!e.tty.Ob.vc)throw new dr.bb(60);try{for(var i=0;i<n;i++)e.tty.Ob.vc(e.tty,t[r+i])}catch(e){throw new dr.bb(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),i}},Ot={Ic(){e:{if(!xt.length){var e=null;if(a){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=d.readSync(n,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}0<r&&(e=t.slice(0,r).toString("utf-8"))}else globalThis.window?.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e){e=null;break e}xt=Pt(e)}e=xt.shift()}return e},vc(e,t){null===t||10===t?(P(Tt(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(P(Tt(e.output)),e.output=[])},Wd:()=>({Gd:25856,Id:5,Fd:191,Hd:35387,Ed:[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]}),Xd:()=>0,Yd:()=>[24,80]},Lt={vc(e,t){null===t||10===t?(R(Tt(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(R(Tt(e.output)),e.output=[])}},jt={Ab:null,jb:()=>jt.createNode(null,"/",16895,0),createNode(e,t,r,n){if(24576==(61440&r)||dr.isFIFO(r))throw new dr.bb(63);return jt.Ab||(jt.Ab={dir:{node:{wb:jt.eb.wb,yb:jt.eb.yb,lookup:jt.eb.lookup,Bb:jt.eb.Bb,rename:jt.eb.rename,unlink:jt.eb.unlink,rmdir:jt.eb.rmdir,readdir:jt.eb.readdir,symlink:jt.eb.symlink},stream:{qb:jt.fb.qb}},file:{node:{wb:jt.eb.wb,yb:jt.eb.yb},stream:{qb:jt.fb.qb,read:jt.fb.read,write:jt.fb.write,Nb:jt.fb.Nb,Vb:jt.fb.Vb}},link:{node:{wb:jt.eb.wb,yb:jt.eb.yb,readlink:jt.eb.readlink},stream:{}},yc:{node:{wb:jt.eb.wb,yb:jt.eb.yb},stream:dr.ad}}),Wt((r=dr.createNode(e,t,r,n)).mode)?(r.eb=jt.Ab.dir.node,r.fb=jt.Ab.dir.stream,r.gb={}):dr.isFile(r.mode)?(r.eb=jt.Ab.file.node,r.fb=jt.Ab.file.stream,r.lb=0,r.gb=null):40960==(61440&r.mode)?(r.eb=jt.Ab.link.node,r.fb=jt.Ab.link.stream):8192==(61440&r.mode)&&(r.eb=jt.Ab.yc.node,r.fb=jt.Ab.yc.stream),r.atime=r.mtime=r.ctime=Date.now(),e&&(e.gb[t]=r,e.atime=e.mtime=e.ctime=r.atime),r},Vd:e=>e.gb?e.gb.subarray?e.gb.subarray(0,e.lb):new Uint8Array(e.gb):new Uint8Array(0),eb:{wb(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=Wt(e.mode)?4096:dr.isFile(e.mode)?e.lb:40960==(61440&e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},yb(e,t){for(var r of["mode","atime","mtime","ctime"])null!=t[r]&&(e[r]=t[r]);void 0!==t.size&&e.lb!=(t=t.size)&&(0==t?(e.gb=null,e.lb=0):(r=e.gb,e.gb=new Uint8Array(t),r&&e.gb.set(r.subarray(0,Math.min(t,e.lb))),e.lb=t))},lookup(){throw jt.mc||(jt.mc=new dr.bb(44),jt.mc.stack="<generic error, no stack>"),jt.mc},Bb:(e,t,r,n)=>jt.createNode(e,t,r,n),rename(e,t,r){try{var n=Ht(t,r)}catch(e){}if(n){if(Wt(e.mode))for(var i in n.gb)throw new dr.bb(55);qt(n)}delete e.parent.gb[e.name],t.gb[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.gb[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r,n=Ht(e,t);for(r in n.gb)throw new dr.bb(55);delete e.gb[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.gb)],symlink:(e,t,r)=>((e=jt.createNode(e,t,41471,0)).link=r,e),readlink(e){if(40960!=(61440&e.mode))throw new dr.bb(28);return e.link}},fb:{read(e,t,r,n,i){var o=e.node.gb;if(i>=e.node.lb)return 0;if(8<(e=Math.min(e.node.lb-i,n))&&o.subarray)t.set(o.subarray(i,i+e),r);else for(n=0;n<e;n++)t[r+n]=o[i+n];return e},write(e,t,r,n,i,o){if(t.buffer===w.buffer&&(o=!1),!n)return 0;if((e=e.node).mtime=e.ctime=Date.now(),t.subarray&&(!e.gb||e.gb.subarray)){if(o)return e.gb=t.subarray(r,r+n),e.lb=n;if(0===e.lb&&0===i)return e.gb=t.slice(r,r+n),e.lb=n;if(i+n<=e.lb)return e.gb.set(t.subarray(r,r+n),i),n}var a=e.gb?e.gb.length:0;if(a>=(o=i+n)||(o=Math.max(o,a*(1048576>a?2:1.125)>>>0),0!=a&&(o=Math.max(o,256)),a=e.gb,e.gb=new Uint8Array(o),0<e.lb&&e.gb.set(a.subarray(0,e.lb),0)),e.gb.subarray&&t.subarray)e.gb.set(t.subarray(r,r+n),i);else for(o=0;o<n;o++)e.gb[i+o]=t[r+o];return e.lb=Math.max(e.lb,i+n),n},qb(e,t,r){if(1===r?t+=e.position:2===r&&dr.isFile(e.node.mode)&&(t+=e.node.lb),0>t)throw new dr.bb(28);return t},Nb(e,t,r,n,i){if(!dr.isFile(e.node.mode))throw new dr.bb(43);if(e=e.node.gb,2&i||!e||e.buffer!==w.buffer){if(n=!0,j(),!(i=void 0))throw new dr.bb(48);e&&((0<r||r+t<e.length)&&(e=e.subarray?e.subarray(r,r+t):Array.prototype.slice.call(e,r,r+t)),w.set(e,i))}else n=!1,i=e.byteOffset;return{hb:i,Ad:n}},Vb:(e,t,r,n)=>(jt.fb.write(e,t,0,n,r,!1),0)}},Bt=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Ft=0,Nt=null,It=()=>{if(Ft--,n.monitorRunDependencies?.(Ft),0==Ft&&Nt){var e=Nt;Nt=null,e()}},Dt=()=>{Ft++,n.monitorRunDependencies?.(Ft)},Mt=[],Gt=async(e,t,r,n,i,o,a,s)=>{var l=t?St(_t(e+"/"+t)):e;Dt();try{var h=r;"string"==typeof r&&(h=await(async e=>(e=await c(e),new Uint8Array(e)))(r)),h=await(async(e,t)=>{for(var r of("undefined"!=typeof Browser&&zt(),Mt))if(r.canHandle(t))return r.handle(e,t);return e})(h,l),s?.(),o||Xt(e,t,h,n,i,a)}finally{It()}};function zt(){var e,t,r;dr.pc=!0,e??=n.stdin,t??=n.stdout,r??=n.stderr,e?dr.Db("/dev","stdin",e):dr.symlink("/dev/tty","/dev/stdin"),t?dr.Db("/dev","stdout",null,t):dr.symlink("/dev/tty","/dev/stdout"),r?dr.Db("/dev","stderr",null,r):dr.symlink("/dev/tty1","/dev/stderr"),dr.open("/dev/stdin",0),dr.open("/dev/stdout",1),dr.open("/dev/stderr",1)}function Vt(e,t){dr.Cc[e]={fb:t}}function Wt(e){return 16384==(61440&e)}function Ht(e,t){var r=Wt(e.mode)?(r=er(e,"x"))?r:e.eb.lookup?0:2:54;if(r)throw new dr.bb(r);for(r=dr.zb[Yt(e.id,t)];r;r=r.Jb)if(r.parent.id===e.id&&r.name===t)return r;return dr.lookup(e,t)}function qt(e){var t=Yt(e.parent.id,e.name);if(dr.zb[t]===e)dr.zb[t]=e.Jb;else for(t=dr.zb[t];t;){if(t.Jb===e){t.Jb=e.Jb;break}t=t.Jb}}function Xt(e,t,r,n,i,o){var a=t;if(e&&(e="string"==typeof e?e:Kt(e),a=t?_t(e+"/"+t):e),e=Bt(n,i),a=dr.create(a,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}dr.chmod(a,146|e),t=dr.open(a,577),dr.write(t,r,0,r.length,0,o),dr.close(t),dr.chmod(a,e)}}function Jt(e,t={}){if(!e)throw new dr.bb(44);t.bc??(t.bc=!0),"/"===e.charAt(0)||(e=dr.cwd()+"/"+e);var r=0;e:for(;40>r;r++){e=e.split("/").filter((e=>!!e));for(var n=dr.root,i="/",o=0;o<e.length;o++){var a=o===e.length-1;if(a&&t.parent)break;if("."!==e[o])if(".."===e[o]){if(i=Et(i),dr.rc(n)){e=i+"/"+e.slice(o+1).join("/"),r--;continue e}n=n.parent}else{i=_t(i+"/"+e[o]);try{n=Ht(n,e[o])}catch(e){if(44===e?.Hb&&a&&t.sd)return{path:i};throw e}if(!n.xb||a&&!t.bc||(n=n.xb.root),40960==(61440&n.mode)&&(!a||t.vb)){if(!n.eb.readlink)throw new dr.bb(52);"/"===(n=n.eb.readlink(n)).charAt(0)||(n=Et(i)+"/"+n),e=n+"/"+e.slice(o+1).join("/");continue e}}}return{path:i,node:n}}throw new dr.bb(32)}function Kt(e){for(var t;;){if(dr.rc(e))return e=e.jb.Oc,t?"/"!==e[e.length-1]?`${e}/${t}`:e+t:e;t=t?`${e.name}/${t}`:e.name,e=e.parent}}function Yt(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%dr.zb.length}function Qt(e){var t=Yt(e.parent.id,e.name);e.Jb=dr.zb[t],dr.zb[t]=e}function Zt(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t}function er(e,t){return dr.Kc?0:!t.includes("r")||292&e.mode?t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0:2}function tr(e,t){if(!Wt(e.mode))return 54;try{return Ht(e,t),20}catch(e){}return er(e,"wx")}function rr(e,t,r){try{var n=Ht(e,t)}catch(e){return e.Hb}if(e=er(e,"wx"))return e;if(r){if(!Wt(n.mode))return 54;if(dr.rc(n)||Kt(n)===dr.cwd())return 10}else if(Wt(n.mode))return 31;return 0}function nr(e,t){if(!e)throw new dr.bb(t);return e}function ir(e){if(!(e=dr.md(e)))throw new dr.bb(8);return e}function or(e,t=-1){if(e=Object.assign(new dr.Yc,e),-1==t)e:{for(t=0;t<=dr.$c;t++)if(!dr.streams[t])break e;throw new dr.bb(33)}return e.fd=t,dr.streams[t]=e}function ar(e,t,r){var n=e?.fb.yb;e=n?e:t,n??=t.eb.yb,nr(n,63),n(e,r)}function sr(e){var t=[];for(e=[e];e.length;){var r=e.pop();t.push(r),e.push(...r.Ub)}return t}function cr(e){var t={Dd:4096,Sd:4096,blocks:1e6,Cd:5e5,Bd:5e5,files:dr.uc,Qd:dr.uc-1,Td:42,flags:2,de:255};return e.eb.Sc&&Object.assign(t,e.eb.Sc(e.jb.td.root)),t}function lr(e,t,r){return void 0===r&&(r=t,t=438),dr.Bb(e,8192|t,r)}function hr(e,t,r,n){ar(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),Ec:n})}function br(e,t,r){if(Wt(t.mode))throw new dr.bb(31);if(!dr.isFile(t.mode))throw new dr.bb(28);var n=er(t,"w");if(n)throw new dr.bb(n);ar(e,t,{size:r,timestamp:Date.now()})}function ur(e){if(!(e.qd||e.rd||e.link||e.gb))if(globalThis.XMLHttpRequest)j("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.gb=l(e.url)}catch(e){throw new dr.bb(29)}}var dr={root:null,Ub:[],Cc:{},streams:[],uc:1,zb:null,zc:"/",pc:!1,Kc:!0,hd:null,ic:0,Rc:{},bb:class{name="ErrnoError";constructor(e){this.Hb=e}},Yc:class{rb={};node=null;get object(){return this.node}set object(e){this.node=e}get flags(){return this.rb.flags}set flags(e){this.rb.flags=e}get position(){return this.rb.position}set position(e){this.rb.position=e}},Xc:class{eb={};fb={};xb=null;constructor(e,t,r,n){e||=this,this.parent=e,this.jb=e.jb,this.id=dr.uc++,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 rd(){return Wt(this.mode)}get qd(){return 8192==(61440&this.mode)}},createNode:(e,t,r,n)=>(Qt(e=new dr.Xc(e,t,r,n)),e),rc:e=>e===e.parent,isFile:e=>32768==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),$c:4096,md:e=>dr.streams[e],Nd:(e,t=-1)=>(e=or(e,t),e.fb?.Md?.(e),e),ad:{open(e){e.fb=dr.kd(e.node.rdev).fb,e.fb.open?.(e)},qb(){throw new dr.bb(70)}},sc:e=>e>>8,$d:e=>255&e,Ib:(e,t)=>e<<8|t,kd:e=>dr.Cc[e],Tc(e,t){function r(e){return dr.ic--,t(e)}function n(e){if(e){if(!n.ed)return n.ed=!0,r(e)}else++o>=i.length&&r(null)}"function"==typeof e&&(t=e,e=!1),dr.ic++,1<dr.ic&&R(`warning: ${dr.ic} FS.syncfs operations in flight at once, probably just doing extra work`);var i=sr(dr.root.jb),o=0;i.forEach((t=>{if(!t.type.Tc)return n(null);t.type.Tc(t,e,n)}))},jb(e,t,r){var n="/"===r;if(n&&dr.root)throw new dr.bb(10);if(!n&&r){var i=Jt(r,{bc:!1});if(r=i.path,(i=i.node).xb)throw new dr.bb(10);if(!Wt(i.mode))throw new dr.bb(54)}return(e=e.jb(t={type:e,td:t,Oc:r,Ub:[]})).jb=t,t.root=e,n?dr.root=e:i&&(i.xb=t,i.jb&&i.jb.Ub.push(t)),e},me(e){if(!(e=Jt(e,{bc:!1})).node.xb)throw new dr.bb(28);var t=(e=e.node).xb,r=sr(t);Object.keys(dr.zb).forEach((e=>{for(e=dr.zb[e];e;){var t=e.Jb;r.includes(e.jb)&&qt(e),e=t}})),e.xb=null,e.jb.Ub.splice(e.jb.Ub.indexOf(t),1)},lookup:(e,t)=>e.eb.lookup(e,t),Bb(e,t,r){var n=Jt(e,{parent:!0}).node;if(!(e=$t(e)))throw new dr.bb(28);if("."===e||".."===e)throw new dr.bb(20);var i=tr(n,e);if(i)throw new dr.bb(i);if(!n.eb.Bb)throw new dr.bb(63);return n.eb.Bb(n,e,t,r)},Sc:e=>cr(Jt(e,{vb:!0}).node),ke:e=>cr(e.node),create:(e,t=438)=>dr.Bb(e,4095&t|32768,0),mkdir:(e,t=511)=>dr.Bb(e,1023&t|16384,0),be(e,t){var r,n=e.split("/"),i="";for(r of n)if(r){(i||"/"===e.charAt(0))&&(i+="/"),i+=r;try{dr.mkdir(i,t)}catch(e){if(20!=e.Hb)throw e}}},symlink(e,t){if(!St(e))throw new dr.bb(44);var r=Jt(t,{parent:!0}).node;if(!r)throw new dr.bb(44);var n=tr(r,t=$t(t));if(n)throw new dr.bb(n);if(!r.eb.symlink)throw new dr.bb(63);return r.eb.symlink(r,t,e)},rename(e,t){var r=Et(e),n=Et(t),i=$t(e),o=$t(t),a=Jt(e,{parent:!0}),s=a.node;if(a=(a=Jt(t,{parent:!0})).node,!s||!a)throw new dr.bb(44);if(s.jb!==a.jb)throw new dr.bb(75);var c=Ht(s,i);if("."!==(e=kt(e,n)).charAt(0))throw new dr.bb(28);if("."!==(e=kt(t,r)).charAt(0))throw new dr.bb(55);try{var l=Ht(a,o)}catch(e){}if(c!==l){if(i=rr(s,i,t=Wt(c.mode)))throw new dr.bb(i);if(i=l?rr(a,o,t):tr(a,o))throw new dr.bb(i);if(!s.eb.rename)throw new dr.bb(63);if(c.xb||l&&l.xb)throw new dr.bb(10);if(a!==s&&(i=er(s,"w")))throw new dr.bb(i);qt(c);try{s.eb.rename(c,a,o),c.parent=a}catch(e){throw e}finally{Qt(c)}}},rmdir(e){var t=Jt(e,{parent:!0}).node,r=Ht(t,e=$t(e)),n=rr(t,e,!0);if(n)throw new dr.bb(n);if(!t.eb.rmdir)throw new dr.bb(63);if(r.xb)throw new dr.bb(10);t.eb.rmdir(t,e),qt(r)},readdir:e=>nr((e=Jt(e,{vb:!0}).node).eb.readdir,54)(e),unlink(e){var t=Jt(e,{parent:!0}).node;if(!t)throw new dr.bb(44);var r=Ht(t,e=$t(e)),n=rr(t,e,!1);if(n)throw new dr.bb(n);if(!t.eb.unlink)throw new dr.bb(63);if(r.xb)throw new dr.bb(10);t.eb.unlink(t,e),qt(r)},readlink(e){if(!(e=Jt(e).node))throw new dr.bb(44);if(!e.eb.readlink)throw new dr.bb(28);return e.eb.readlink(e)},stat:(e,t)=>nr((e=Jt(e,{vb:!t}).node).eb.wb,63)(e),fstat(e){var t=ir(e);e=t.node;var r=t.fb.wb;return t=r?t:e,r??=e.eb.wb,nr(r,63),r(t)},lstat:e=>dr.stat(e,!0),chmod(e,t,r){hr(null,e="string"==typeof e?Jt(e,{vb:!r}).node:e,t,r)},lchmod(e,t){dr.chmod(e,t,!0)},fchmod(e,t){hr(e=ir(e),e.node,t,!1)},chown(e,t,r,n){ar(null,e="string"==typeof e?Jt(e,{vb:!n}).node:e,{timestamp:Date.now(),Ec:n})},lchown(e,t,r){dr.chown(e,t,r,!0)},fchown(e){ar(e=ir(e),e.node,{timestamp:Date.now(),Ec:!1})},truncate(e,t){if(0>t)throw new dr.bb(28);br(null,e="string"==typeof e?Jt(e,{vb:!0}).node:e,t)},Ud(e,t){if(e=ir(e),0>t||!(2097155&e.flags))throw new dr.bb(28);br(e,e.node,t)},ne(e,t,r){nr((e=Jt(e,{vb:!0}).node).eb.yb,63)(e,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new dr.bb(44);if("string"==typeof t){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===i)throw Error(`Unknown file open mode: ${t}`);t=i}if(r=64&t?4095&r|32768:0,"object"==typeof e)i=e;else{var o=e.endsWith("/");i=(e=Jt(e,{vb:!(131072&t),sd:!0})).node,e=e.path}var a=!1;if(64&t)if(i){if(128&t)throw new dr.bb(20)}else{if(o)throw new dr.bb(31);i=dr.Bb(e,511|r,0),a=!0}if(!i)throw new dr.bb(44);if(8192==(61440&i.mode)&&(t&=-513),65536&t&&!Wt(i.mode))throw new dr.bb(54);if(!a&&(o=i?40960==(61440&i.mode)?32:Wt(i.mode)&&("r"!==Zt(t)||576&t)?31:er(i,Zt(t)):44))throw new dr.bb(o);return 512&t&&!a&&dr.truncate(i,0),t&=-131713,(o=or({node:i,path:Kt(i),flags:t,seekable:!0,position:0,fb:i.fb,zd:[],error:!1})).fb.open&&o.fb.open(o),a&&dr.chmod(i,511&r),!n.logReadFiles||1&t||e in dr.Rc||(dr.Rc[e]=1),o},close(e){if(null===e.fd)throw new dr.bb(8);e.oc&&(e.oc=null);try{e.fb.close&&e.fb.close(e)}catch(e){throw e}finally{dr.streams[e.fd]=null}e.fd=null},qb(e,t,r){if(null===e.fd)throw new dr.bb(8);if(!e.seekable||!e.fb.qb)throw new dr.bb(70);if(0!=r&&1!=r&&2!=r)throw new dr.bb(28);return e.position=e.fb.qb(e,t,r),e.zd=[],e.position},read(e,t,r,n,i){if(0>n||0>i)throw new dr.bb(28);if(null===e.fd)throw new dr.bb(8);if(1==(2097155&e.flags))throw new dr.bb(8);if(Wt(e.node.mode))throw new dr.bb(31);if(!e.fb.read)throw new dr.bb(28);var o=void 0!==i;if(o){if(!e.seekable)throw new dr.bb(70)}else i=e.position;return t=e.fb.read(e,t,r,n,i),o||(e.position+=t),t},write(e,t,r,n,i,o){if(0>n||0>i)throw new dr.bb(28);if(null===e.fd)throw new dr.bb(8);if(!(2097155&e.flags))throw new dr.bb(8);if(Wt(e.node.mode))throw new dr.bb(31);if(!e.fb.write)throw new dr.bb(28);e.seekable&&1024&e.flags&&dr.qb(e,0,2);var a=void 0!==i;if(a){if(!e.seekable)throw new dr.bb(70)}else i=e.position;return t=e.fb.write(e,t,r,n,i,o),a||(e.position+=t),t},Nb(e,t,r,n,i){if(2&n&&!(2&i)&&2!=(2097155&e.flags))throw new dr.bb(2);if(1==(2097155&e.flags))throw new dr.bb(2);if(!e.fb.Nb)throw new dr.bb(43);if(!t)throw new dr.bb(28);return e.fb.Nb(e,t,r,n,i)},Vb:(e,t,r,n,i)=>e.fb.Vb?e.fb.Vb(e,t,r,n,i):0,Lc(e,t,r){if(!e.fb.Lc)throw new dr.bb(59);return e.fb.Lc(e,t,r)},readFile(e,t={}){t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding&&j(`Invalid encoding type "${t.encoding}"`);var r=dr.open(e,t.flags);e=dr.stat(e).size;var n=new Uint8Array(e);return dr.read(r,n,0,e,0),"utf8"===t.encoding&&(n=Tt(n)),dr.close(r),n},writeFile(e,t,r={}){r.flags=r.flags||577,e=dr.open(e,r.flags,r.mode),"string"==typeof t&&(t=new Uint8Array(Pt(t))),ArrayBuffer.isView(t)?dr.write(e,t,0,t.byteLength,void 0,r.Jd):j("Unsupported data type"),dr.close(e)},cwd:()=>dr.zc,chdir(e){if(null===(e=Jt(e,{vb:!0})).node)throw new dr.bb(44);if(!Wt(e.node.mode))throw new dr.bb(54);var t=er(e.node,"x");if(t)throw new dr.bb(t);dr.zc=e.path},he(){for(var e of(dr.pc=!1,dr.streams))e&&dr.close(e)},Rd(e,t){try{var r=Jt(e,{vb:!t});e=r.path}catch(e){}var n=!1,i=null;try{r=Jt(e,{parent:!0}),$t(e),r=Jt(e,{vb:!t}),n=!0,i=r.node}catch(e){}return n?i:null},Db(e,t,r,n){var i;return e=((e,t)=>_t(e+"/"+t))("string"==typeof e?e:Kt(e),t),t=Bt(!!r,!!n),(i=dr.Db).sc??(i.sc=64),Vt(i=dr.Ib(dr.Db.sc++,0),{open(e){e.seekable=!1},close(){n?.buffer?.length&&n(10)},read(e,t,n,i){for(var o=0,a=0;a<i;a++){try{var s=r()}catch(e){throw new dr.bb(29)}if(void 0===s&&0===o)throw new dr.bb(6);if(null==s)break;o++,t[n+a]=s}return o&&(e.node.atime=Date.now()),o},write(e,t,r,i){for(var o=0;o<i;o++)try{n(t[r+o])}catch(e){throw new dr.bb(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),o}}),lr(e,t,i)}},fr=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),pr=[],mr=e=>0==(e-=5120)?w:1==e?y:2==e?g:4==e?E:6==e?A:5==e||28922==e||28520==e||30779==e||30782==e?$:_,vr=e=>{var t=Ce.cd;if(t){var r=t.Yb[e];return"number"==typeof r&&(t.Yb[e]=r=Ce.getUniformLocation(t,t.Uc[e]+(0<r?`[${r}]`:""))),r}Ue||=1282},wr=[];(()=>{let e=ne.prototype;Object.assign(e,{isAliasOf:function(e){if(!(this instanceof ne&&e instanceof ne))return!1;var t=this.cb.kb.ib,r=this.cb.hb;e.cb=e.cb;var n=e.cb.kb.ib;for(e=e.cb.hb;t.pb;)r=t.Zb(r),t=t.pb;for(;n.pb;)e=n.Zb(e),n=n.pb;return t===n&&r===e},clone:function(){if(this.cb.hb||Z(this),this.cb.Wb)return this.cb.count.value+=1,this;var e=re,t=Object,r=t.create,n=Object.getPrototypeOf(this),i=this.cb;return(e=e(r.call(t,n,{cb:{value:{count:i.count,Tb:i.Tb,Wb:i.Wb,hb:i.hb,kb:i.kb,nb:i.nb,sb:i.sb}}}))).cb.count.value+=1,e.cb.Tb=!1,e},delete(){if(this.cb.hb||Z(this),this.cb.Tb&&!this.cb.Wb)throw new J("Object already scheduled for deletion");te(this);var e=this.cb;--e.count.value,0===e.count.value&&(e.nb?e.sb.Eb(e.nb):e.kb.ib.Eb(e.hb)),this.cb.Wb||(this.cb.nb=void 0,this.cb.hb=void 0)},isDeleted:function(){return!this.cb.hb},deleteLater:function(){if(this.cb.hb||Z(this),this.cb.Tb&&!this.cb.Wb)throw new J("Object already scheduled for deletion");return this.cb.Tb=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(ye.prototype,{ld(e){return this.Qc&&(e=this.Qc(e)),e},Bc(e){this.Eb?.(e)},Cb:fe,ob:function(e){function t(){return we(this.ib.Mb,this.dc?{kb:this.ud,hb:r,sb:this,nb:e}:{kb:this,hb:e})}var r=this.ld(e);if(!r)return this.Bc(e),null;var n=((e,t)=>{if(void 0===t)throw new J("ptr should not be undefined");for(;e.pb;)t=e.Zb(t),e=e.pb;return me[t]})(this.ib,r);if(void 0!==n)return 0===n.cb.count.value?(n.cb.hb=r,n.cb.nb=e,n.clone()):(n=n.clone(),this.Bc(e),n);if(n=this.ib.jd(r),!(n=oe[n]))return t.call(this);var i=pe(r,this.ib,(n=this.cc?n.bd:n.pointerType).ib);return null===i?t.call(this):we(n.ib.Mb,this.dc?{kb:n,hb:i,sb:this,nb:e}:{kb:n,hb:i})}}),"undefined"!=typeof MainLoop&&MainLoop.ee.push((()=>{if(Oe){var e=Oe.Qb;for(Oe.Qb=Oe.Xb,Oe.Xb=e,e=Oe.Fb,Oe.Fb=Oe.jc,Oe.jc=e,e=0;21>=e;++e)Oe.Fb[e]=0}})),dr.Kd=(e,t,r,n,i,o,a,s,c,l)=>{Gt(e,t,r,n,i,s,c,l).then(o).catch(a)},dr.fe=Gt,dr.zb=Array(4096),dr.jb(jt,{},"/"),dr.mkdir("/tmp"),dr.mkdir("/home"),dr.mkdir("/home/web_user"),function(){dr.mkdir("/dev"),Vt(dr.Ib(1,3),{read:()=>0,write:(e,t,r,n)=>n,qb:()=>0}),lr("/dev/null",dr.Ib(1,3)),Ct(dr.Ib(5,0),Ot),Ct(dr.Ib(6,0),Lt),lr("/dev/tty",dr.Ib(5,0)),lr("/dev/tty1",dr.Ib(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(At(e),t=e.byteLength),e[--t]);dr.Db("/dev","random",r),dr.Db("/dev","urandom",r),dr.mkdir("/dev/shm"),dr.mkdir("/dev/shm/tmp")}(),function(){dr.mkdir("/proc");var e=dr.mkdir("/proc/self");dr.mkdir("/proc/self/fd"),dr.jb({jb(){var t=dr.createNode(e,"fd",16895,73);return t.fb={qb:jt.fb.qb},t.eb={lookup(e,t){var r=ir(e=+t);return(e={parent:null,jb:{Oc:"fake"},eb:{readlink:()=>r.path},id:e+1}).parent=e},readdir:()=>Array.from(dr.streams.entries()).filter((([,e])=>e)).map((([e])=>e.toString()))},t}},{},"/proc/self/fd")}(),dr.hd={MEMFS:jt};for(let e=0;32>e;++e)pr.push(Array(e));for(var yr=new In