UNPKG

@thorvg/lottie-player

Version:

A web lottie player using ThorVG as a renderer

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