trtc-sdk-v5 5.9.1-beta.1 → 5.9.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +3 -0
- package/package.json +1 -1
- package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -1
- package/plugins/cdn-streaming/cdn-streaming.iife.js +1 -1
- package/plugins/cdn-streaming/package.json +1 -1
- package/plugins/cross-room/cross-room.esm.js +1 -1
- package/plugins/cross-room/cross-room.iife.js +1 -1
- package/plugins/cross-room/package.json +1 -1
- package/plugins/device-detector/device-detector.esm.js +2 -2
- package/plugins/device-detector/device-detector.iife.js +2 -2
- package/plugins/device-detector/package.json +1 -1
- package/plugins/video-decoder/package.json +2 -2
- package/plugins/video-decoder/video-decoder.esm.js +38 -38
- package/plugins/video-decoder/video-decoder.iife.js +38 -38
- package/plugins/video-effect/basic-beauty/basic-beauty.esm.js +2 -2
- package/plugins/video-effect/basic-beauty/basic-beauty.iife.js +2 -2
- package/plugins/video-effect/basic-beauty/package.json +1 -1
- package/plugins/video-effect/beauty/beauty.esm.js +3 -3
- package/plugins/video-effect/beauty/beauty.iife.js +3 -3
- package/plugins/video-effect/beauty/package.json +1 -1
- package/plugins/video-effect/virtual-background/package.json +1 -1
- package/plugins/video-effect/virtual-background/virtual-background.esm.js +38 -38
- package/plugins/video-effect/virtual-background/virtual-background.iife.js +38 -38
- package/plugins/video-effect/watermark/package.json +1 -1
- package/plugins/video-effect/watermark/watermark.esm.js +1 -1
- package/plugins/video-effect/watermark/watermark.iife.js +1 -1
- package/trtc.esm.js +28 -28
- package/trtc.js +1 -1
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
"use strict";var TRTCVideoDecoder=(()=>{var Oi=Object.create;var xr=Object.defineProperty,Ui=Object.defineProperties,gi=Object.getOwnPropertyDescriptor,xi=Object.getOwnPropertyDescriptors,Fi=Object.getOwnPropertyNames,vi=Object.getOwnPropertySymbols,Ni=Object.getPrototypeOf,yi=Object.prototype.hasOwnProperty,Mi=Object.prototype.propertyIsEnumerable;var si=(y,p,s)=>p in y?xr(y,p,{enumerable:!0,configurable:!0,writable:!0,value:s}):y[p]=s,wr=(y,p)=>{for(var s in p||(p={}))yi.call(p,s)&&si(y,s,p[s]);if(vi)for(var s of vi(p))Mi.call(p,s)&&si(y,s,p[s]);return y},Er=(y,p)=>Ui(y,xi(p));var Li=(y,p)=>()=>(p||y((p={exports:{}}).exports,p),p.exports),Wi=(y,p)=>{for(var s in p)xr(y,s,{get:p[s],enumerable:!0})},bi=(y,p,s,b)=>{if(p&&typeof p=="object"||typeof p=="function")for(let P of Fi(p))!yi.call(y,P)&&P!==s&&xr(y,P,{get:()=>p[P],enumerable:!(b=gi(p,P))||b.enumerable});return y};var Hi=(y,p,s)=>(s=y!=null?Oi(Ni(y)):{},bi(p||!y||!y.__esModule?xr(s,"default",{value:y,enumerable:!0}):s,y)),Bi=y=>bi(xr({},"__esModule",{value:!0}),y),Ne=(y,p,s,b)=>{for(var P=b>1?void 0:b?gi(p,s):p,D=y.length-1,$;D>=0;D--)($=y[D])&&(P=(b?$(p,s,P):$(P))||P);return b&&P&&xr(p,s,P),P};var _e=(y,p,s)=>(si(y,typeof p!="symbol"?p+"":p,s),s);var wi=Li((no,ui)=>{"use strict";var Vi=Object.prototype.hasOwnProperty,we="~";function dt(){}Object.create&&(dt.prototype=Object.create(null),new dt().__proto__||(we=!1));function ji(y,p,s){this.fn=y,this.context=p,this.once=s||!1}function _i(y,p,s,b,P){if(typeof s!="function")throw new TypeError("The listener must be a function");var D=new ji(s,b||y,P),$=we?we+p:p;return y._events[$]?y._events[$].fn?y._events[$]=[y._events[$],D]:y._events[$].push(D):(y._events[$]=D,y._eventsCount++),y}function on(y,p){--y._eventsCount===0?y._events=new dt:delete y._events[p]}function fe(){this._events=new dt,this._eventsCount=0}fe.prototype.eventNames=function(){var p=[],s,b;if(this._eventsCount===0)return p;for(b in s=this._events)Vi.call(s,b)&&p.push(we?b.slice(1):b);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(s)):p};fe.prototype.listeners=function(p){var s=we?we+p:p,b=this._events[s];if(!b)return[];if(b.fn)return[b.fn];for(var P=0,D=b.length,$=new Array(D);P<D;P++)$[P]=b[P].fn;return $};fe.prototype.listenerCount=function(p){var s=we?we+p:p,b=this._events[s];return b?b.fn?1:b.length:0};fe.prototype.emit=function(p,s,b,P,D,$){var j=we?we+p:p;if(!this._events[j])return!1;var I=this._events[j],C=arguments.length,L,N;if(I.fn){switch(I.once&&this.removeListener(p,I.fn,void 0,!0),C){case 1:return I.fn.call(I.context),!0;case 2:return I.fn.call(I.context,s),!0;case 3:return I.fn.call(I.context,s,b),!0;case 4:return I.fn.call(I.context,s,b,P),!0;case 5:return I.fn.call(I.context,s,b,P,D),!0;case 6:return I.fn.call(I.context,s,b,P,D,$),!0}for(N=1,L=new Array(C-1);N<C;N++)L[N-1]=arguments[N];I.fn.apply(I.context,L)}else{var H=I.length,pe;for(N=0;N<H;N++)switch(I[N].once&&this.removeListener(p,I[N].fn,void 0,!0),C){case 1:I[N].fn.call(I[N].context);break;case 2:I[N].fn.call(I[N].context,s);break;case 3:I[N].fn.call(I[N].context,s,b);break;case 4:I[N].fn.call(I[N].context,s,b,P);break;default:if(!L)for(pe=1,L=new Array(C-1);pe<C;pe++)L[pe-1]=arguments[pe];I[N].fn.apply(I[N].context,L)}}return!0};fe.prototype.on=function(p,s,b){return _i(this,p,s,b,!1)};fe.prototype.once=function(p,s,b){return _i(this,p,s,b,!0)};fe.prototype.removeListener=function(p,s,b,P){var D=we?we+p:p;if(!this._events[D])return this;if(!s)return on(this,D),this;var $=this._events[D];if($.fn)$.fn===s&&(!P||$.once)&&(!b||$.context===b)&&on(this,D);else{for(var j=0,I=[],C=$.length;j<C;j++)($[j].fn!==s||P&&!$[j].once||b&&$[j].context!==b)&&I.push($[j]);I.length?this._events[D]=I.length===1?I[0]:I:on(this,D)}return this};fe.prototype.removeAllListeners=function(p){var s;return p?(s=we?we+p:p,this._events[s]&&on(this,s)):(this._events=new dt,this._eventsCount=0),this};fe.prototype.off=fe.prototype.removeListener;fe.prototype.addListener=fe.prototype.on;fe.prefixed=we;fe.EventEmitter=fe;typeof ui!="undefined"&&(ui.exports=fe)});var Zi={};Wi(Zi,{VideoDecoderPlugin:()=>cn,default:()=>Yi});var Ti=Hi(wi(),1),Ei=Symbol("instance"),io=Symbol("abortCtrl"),an=Symbol("cacheResult"),ft=class{constructor(p,s,b){this.oldState=p,this.newState=s,this.action=b,this.aborted=!1}abort(p){this.aborted=!0,mt.call(p,this.oldState,new Error(`action '${this.action}' aborted`))}toString(){return`${this.action}ing`}},Fr=class extends Error{constructor(p,s,b){super(s),this.state=p,this.message=s,this.cause=b}};function zi(y){return typeof y=="object"&&y&&"then"in y}var pt=new Map;function je(y,p,s={}){return(b,P,D)=>{let $=s.action||P;if(!s.context){let I=pt.get(b)||[];pt.has(b)||pt.set(b,I),I.push({from:y,to:p,action:$})}let j=D.value;D.value=function(...I){let C=this;if(s.context&&(C=ce.get(typeof s.context=="function"?s.context.call(this,...I):s.context)),C.state===p)return s.sync?C[an]:Promise.resolve(C[an]);C.state instanceof ft&&C.state.action==s.abortAction&&C.state.abort(C);let L=null;Array.isArray(y)?y.length==0?C.state instanceof ft&&C.state.abort(C):(typeof C.state!="string"||!y.includes(C.state))&&(L=new Fr(C._state,`${C.name} ${$} to ${p} failed: current state ${C._state} not from ${y.join("|")}`)):y!==C.state&&(L=new Fr(C._state,`${C.name} ${$} to ${p} failed: current state ${C._state} not from ${y}`));let N=K=>{if(s.fail&&s.fail.call(this,K),s.sync){if(s.ignoreError)return K;throw K}else return s.ignoreError?Promise.resolve(K):Promise.reject(K)};if(L)return N(L);let H=C.state,pe=new ft(H,p,$);mt.call(C,pe);let ke=K=>{var Ge;return C[an]=K,pe.aborted||(mt.call(C,p),(Ge=s.success)===null||Ge===void 0||Ge.call(this,C[an])),K},Me=K=>(mt.call(C,H,K),N(K));try{let K=j.apply(this,I);return zi(K)?K.then(ke).catch(Me):s.sync?ke(K):Promise.resolve(ke(K))}catch(K){return Me(new Fr(C._state,`${C.name} ${$} from ${y} to ${p} failed: ${K}`,K instanceof Error?K:new Error(String(K))))}}}}function Pi(...y){return(p,s,b)=>{let P=b.value,D=s;b.value=function(...$){if(!y.includes(this.state.toString()))throw new Fr(this.state,`${this.name} ${D} failed: current state ${this.state} not in ${y}`);return P.apply(this,$)}}}var Gi=(()=>typeof window!="undefined"&&window.__AFSM__?(s,b)=>{window.dispatchEvent(new CustomEvent(s,{detail:b}))}:typeof importScripts!="undefined"?(s,b)=>{postMessage({type:s,payload:b})}:()=>{})();function mt(y,p){let s=this._state;this._state=y;let b=y.toString();y&&this.emit(b,s),this.emit(ce.STATECHANGED,y,s,p),this.updateDevTools({value:y,old:s,err:p instanceof Error?p.message:String(p)})}var ce=class y extends Ti.default{constructor(p,s,b){super(),this.name=p,this.groupName=s,this._state=y.INIT,p||(p=Date.now().toString(36)),b?Object.setPrototypeOf(this,b):b=Object.getPrototypeOf(this),s||(this.groupName=this.constructor.name);let P=b[Ei];P?this.name=P.name+"-"+P.count++:b[Ei]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let p=Object.getPrototypeOf(this),s=pt.get(p)||[],b=new Set,P=[],D=[],$=new Set,j=Object.getPrototypeOf(p);pt.has(j)&&(j.stateDiagram.forEach(C=>b.add(C)),j.allStates.forEach(C=>$.add(C))),s.forEach(({from:C,to:L,action:N})=>{typeof C=="string"?P.push({from:C,to:L,action:N}):C.length?C.forEach(H=>{P.push({from:H,to:L,action:N})}):D.push({to:L,action:N})}),P.forEach(({from:C,to:L,action:N})=>{$.add(C),$.add(L),$.add(N+"ing"),b.add(`${C} --> ${N}ing : ${N}`),b.add(`${N}ing --> ${L} : ${N} \u{1F7E2}`),b.add(`${N}ing --> ${C} : ${N} \u{1F534}`)}),D.forEach(({to:C,action:L})=>{b.add(`${L}ing --> ${C} : ${L} \u{1F7E2}`),$.forEach(N=>{N!==C&&b.add(`${N} --> ${L}ing : ${L}`)})});let I=[...b];return Object.defineProperties(p,{stateDiagram:{value:I},allStates:{value:$}}),I}static get(p){let s;return typeof p=="string"?(s=y.instances.get(p),s||y.instances.set(p,s=new y(p,void 0,Object.create(y.prototype)))):(s=y.instances2.get(p),s||y.instances2.set(p,s=new y(p.constructor.name,void 0,Object.create(y.prototype)))),s}static getState(p){var s;return(s=y.get(p))===null||s===void 0?void 0:s.state}updateDevTools(p={}){Gi(y.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},p))}get state(){return this._state}set state(p){mt.call(this,p)}};ce.STATECHANGED="stateChanged";ce.UPDATEAFSM="updateAFSM";ce.INIT="[*]";ce.ON="on";ce.OFF="off";ce.instances=new Map;ce.instances2=new WeakMap;var ir=class extends ce{constructor(){super(...arguments);_e(this,"decoder");_e(this,"config")}async initialize(){this.decoder=new VideoDecoder({output:s=>{this.emit("videoFrame",s)},error:s=>{this.close(),this.emit("error",s)}})}configure(s){this.config=s,this.decoder.configure(Er(wr({},s),{codec:this.getCodec(s)}))}getCodec(s){switch(s.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return s.codec}}decode(s){this.decoder.state==="configured"&&this.decoder.decode(new EncodedVideoChunk(s))}flush(){this.decoder.flush()}reset(){this.decoder.reset()}close(){this.decoder.state!=="closed"&&this.decoder.close()}};Ne([je([ce.INIT,"closed"],"initialized")],ir.prototype,"initialize",1),Ne([je("initialized","configured",{sync:!0})],ir.prototype,"configure",1),Ne([Pi("configured")],ir.prototype,"decode",1),Ne([je([],ce.INIT)],ir.prototype,"reset",1),Ne([je([],"closed",{ignoreError:!0,sync:!0})],ir.prototype,"close",1);function Xi(){var y;self.onmessage=p=>{if(p.data.type==="init"){let{canvas:s,wasmScript:b,wasmBinary:P}=p.data,D=s==null?void 0:s.getContext("2d"),$=0,j=0,I={wasmBinary:P,postRun:()=>{y=new I.VideoDecoder({videoInfo(C,L){$=C,j=L,console.log("video info",C,L)},yuvData(C,L){let N=$*j,H=N>>2,pe=I.HEAPU32[C>>2],ke=I.HEAPU32[(C>>2)+1],Me=I.HEAPU32[(C>>2)+2],K=I.HEAPU8.subarray(pe,pe+N),Ge=I.HEAPU8.subarray(ke,ke+H),lr=I.HEAPU8.subarray(Me,Me+H),ae=new Uint8Array(N+H+H);ae.set(K),ae.set(Ge,N),ae.set(lr,N+H);let me=new VideoFrame(ae,{codedWidth:$,codedHeight:j,format:"I420",timestamp:L});s?(D==null||D.drawImage(me,0,0,s.width,s.height),D==null||D.commit()):self.postMessage({type:"yuvData",videoFrame:me},[me])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+b)()(I)}else if(p.data.type==="decode"){let{packet:s}=p.data;y==null||y.decode(s.data,s.type=="key",s.timestamp)}else if(p.data.type==="setCodec"){let{codec:s,format:b,description:P}=p.data;y==null||y.setCodec(s,b,P!=null?P:"")}}}var ze=class extends ce{constructor(s,b,P=!1,D,$=!1){super();this.createModule=s;this.wasmBinary=b;this.workerMode=P;this.canvas=D;this.yuvMode=$;_e(this,"worker");_e(this,"decoder");_e(this,"config");_e(this,"module",{});_e(this,"width",0);_e(this,"height",0)}async initialize(s){var P;if(this.workerMode){let D=new RegExp("\\{(.+)\\}","s").exec(Xi.toString())[1];this.worker=new Worker(URL.createObjectURL(new Blob([D],{type:"text/javascript"})));let $=(P=this.canvas)==null?void 0:P.transferControlToOffscreen(),j=await this.wasmBinary;return console.warn("worker mode",j),this.worker.postMessage({type:"init",canvas:$,wasmScript:this.createModule.toString(),wasmBinary:j},$?[$,j]:[j]),new Promise(I=>{this.worker.onmessage=C=>{if(C.data.type==="ready")delete this.wasmBinary,I(),console.warn("worker mode initialize success");else if(C.data.type==="yuvData"){let{videoFrame:L}=C.data;this.emit("videoFrame",L)}}})}let b=this.module;return this.wasmBinary&&(b.wasmBinary=await this.wasmBinary),b.print=D=>console.log(D),b.printErr=D=>console.log(`[JS] ERROR: ${D}`),b.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),new Promise(D=>{b.postRun=$=>{this.decoder=new this.module.VideoDecoder(this),console.log("video soft decoder initialize success"),D()},s&&Object.assign(b,s),this.createModule(b)})}configure(s){var b,P,D;this.config=s,(P=this.decoder)==null||P.setCodec(this.config.codec,this.config.description?"avcc":"annexb",(b=this.config.description)!=null?b:""),(D=this.worker)==null||D.postMessage({type:"setCodec",codec:this.config.codec,format:this.config.description?"avcc":"annexb",description:this.config.description})}decode(s){var b,P;(b=this.decoder)==null||b.decode(s.data,s.type=="key",s.timestamp),this.state==="configured"&&((P=this.worker)==null||P.postMessage({type:"decode",packet:s}))}flush(){}reset(){this.config=void 0,this.decoder&&this.decoder.clear()}close(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}videoInfo(s,b){this.width=s,this.height=b;let P={width:s,height:b};this.emit("videoCodecInfo",P)}yuvData(s,b){if(!this.module)return;let P=this.width*this.height,D=P>>2,$=this.module.HEAPU32[s>>2],j=this.module.HEAPU32[(s>>2)+1],I=this.module.HEAPU32[(s>>2)+2],C=this.module.HEAPU8.subarray($,$+P),L=this.module.HEAPU8.subarray(j,j+D),N=this.module.HEAPU8.subarray(I,I+D);if(this.yuvMode){this.emit("videoFrame",[C,L,N]);return}let H=new Uint8Array(P+D+D);H.set(C),H.set(L,P),H.set(N,P+D),this.emit("videoFrame",new VideoFrame(H,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:b}))}errorInfo(s){let b={errMsg:s};this.emit("error",b)}};Ne([je([ce.INIT,"closed"],"initialized")],ze.prototype,"initialize",1),Ne([je("initialized","configured")],ze.prototype,"configure",1),Ne([je([],ce.INIT)],ze.prototype,"reset",1),Ne([je([],"closed")],ze.prototype,"close",1);var Ki=(()=>{var y=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,b,P;s.ready=new Promise((e,r)=>{b=e,P=r});var D=Object.assign({},s),$=[],j="./this.program",I=(e,r)=>{throw r},C=typeof window=="object",L=typeof importScripts=="function",N=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",H="";function pe(e){return s.locateFile?s.locateFile(e,H):H+e}var ke,Me,K,Ge;(C||L)&&(L?H=self.location.href:typeof document!="undefined"&&document.currentScript&&(H=document.currentScript.src),y&&(H=y),H.indexOf("blob:")!==0?H=H.substr(0,H.replace(/[?#].*/,"").lastIndexOf("/")+1):H="",ke=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},L&&(K=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Me=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){r(n.response);return}t()},n.onerror=t,n.send(null)},Ge=e=>document.title=e);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,D),D=null,s.arguments&&($=s.arguments),s.thisProgram&&(j=s.thisProgram),s.quit&&(I=s.quit);var me;s.wasmBinary&&(me=s.wasmBinary);var Ai=s.noExitRuntime||!0;typeof WebAssembly!="object"&&Le("no native wasm support detected");var Nr,ee,Mr=!1,dn;function qe(e,r){e||Le(r)}var J,oe,Te,Pe,U,X,Lr,ht;function vt(){var e=Nr.buffer;s.HEAP8=J=new Int8Array(e),s.HEAP16=Te=new Int16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU8=oe=new Uint8Array(e),s.HEAPU16=Pe=new Uint16Array(e),s.HEAPU32=X=new Uint32Array(e),s.HEAPF32=Lr=new Float32Array(e),s.HEAPF64=ht=new Float64Array(e)}var Wr,Hr=[],Br=[],gt=[],fn=!1;function pn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)vn(s.preRun.shift());Gr(Hr)}function mn(){fn=!0,!s.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=!1,We.init(),Gr(Br)}function hn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)Xe(s.postRun.shift());Gr(gt)}function vn(e){Hr.unshift(e)}function gn(e){Br.unshift(e)}function Xe(e){gt.unshift(e)}var Re=0,Ke=null,dr=null;function ci(e){return e}function or(e){Re++,s.monitorRunDependencies&&s.monitorRunDependencies(Re)}function Tr(e){if(Re--,s.monitorRunDependencies&&s.monitorRunDependencies(Re),Re==0&&(Ke!==null&&(clearInterval(Ke),Ke=null),dr)){var r=dr;dr=null,r()}}function Le(e){s.onAbort&&s.onAbort(e),e="Aborted("+e+")",ae(e),Mr=!0,dn=1,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw P(r),r}var ar="data:application/octet-stream;base64,";function Vr(e){return e.startsWith(ar)}var sr;sr="videodec.wasm",Vr(sr)||(sr=pe(sr));function jr(e){if(e==sr&&me)return new Uint8Array(me);if(K)return K(e);throw"both async and sync fetching of the wasm failed"}function yn(e){return!me&&(C||L)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()}).catch(()=>jr(e)):Promise.resolve().then(()=>jr(e))}function yt(e,r,t){return yn(e).then(n=>WebAssembly.instantiate(n,r)).then(n=>n).then(t,n=>{ae("failed to asynchronously prepare wasm: "+n),Le(n)})}function zr(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Vr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(u=>{var l=WebAssembly.instantiateStreaming(u,t);return l.then(n,function(f){return ae("wasm streaming compile failed: "+f),ae("falling back to ArrayBuffer instantiation"),yt(r,t,n)})}):yt(r,t,n)}function bn(){var e={a:Di};function r(n,u){var l=n.exports;return ee=l,Nr=ee.E,vt(),Wr=ee.H,gn(ee.F),Tr("wasm-instantiate"),l}or("wasm-instantiate");function t(n){r(n.instance)}if(s.instantiateWasm)try{return s.instantiateWasm(e,r)}catch(n){ae("Module.instantiateWasm callback failed with error: "+n),P(n)}return zr(me,sr,e,t).catch(P),{}}var x,Q,Gr=e=>{for(;e.length>0;)e.shift()(s)};function _n(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(r){X[this.ptr+4>>2]=r},this.get_type=function(){return X[this.ptr+4>>2]},this.set_destructor=function(r){X[this.ptr+8>>2]=r},this.get_destructor=function(){return X[this.ptr+8>>2]},this.set_caught=function(r){r=r?1:0,J[this.ptr+12>>0]=r},this.get_caught=function(){return J[this.ptr+12>>0]!=0},this.set_rethrown=function(r){r=r?1:0,J[this.ptr+13>>0]=r},this.get_rethrown=function(){return J[this.ptr+13>>0]!=0},this.init=function(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)},this.set_adjusted_ptr=function(r){X[this.ptr+16>>2]=r},this.get_adjusted_ptr=function(){return X[this.ptr+16>>2]},this.get_exception_ptr=function(){var r=mi(this.get_type());if(r)return X[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Pr=0,wn=0;function bt(e,r,t){var n=new _n(e);throw n.init(r,t),Pr=e,wn++,Pr}var he=e=>(U[fi()>>2]=e,e),z={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var u=e[n];u==="."?e.splice(n,1):u===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=z.isAbs(e),t=e.substr(-1)==="/";return e=z.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=z.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=z.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return z.normalize(e.join("/"))},join2:(e,r)=>z.normalize(e+"/"+r)},Je=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);Le("initRandomDevice")},fr=e=>(fr=Je())(e),le={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:a.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=z.isAbs(n)}return e=z.normalizeArray(e.split("/").filter(u=>!!u),!r).join("/"),(r?"/":"")+e||"."},relative:(e,r)=>{e=le.resolve(e).substr(1),r=le.resolve(r).substr(1);function t(h){for(var A=0;A<h.length&&h[A]==="";A++);for(var O=h.length-1;O>=0&&h[O]==="";O--);return A>O?[]:h.slice(A,O-A+1)}for(var n=t(e.split("/")),u=t(r.split("/")),l=Math.min(n.length,u.length),f=l,d=0;d<l;d++)if(n[d]!==u[d]){f=d;break}for(var g=[],d=f;d<n.length;d++)g.push("..");return g=g.concat(u.slice(f)),g.join("/")}},G=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,Ye=(e,r,t)=>{for(var n=r+t,u=r;e[u]&&!(u>=n);)++u;if(u-r>16&&e.buffer&&G)return G.decode(e.subarray(r,u));for(var l="";r<u;){var f=e[r++];if(!(f&128)){l+=String.fromCharCode(f);continue}var d=e[r++]&63;if((f&224)==192){l+=String.fromCharCode((f&31)<<6|d);continue}var g=e[r++]&63;if((f&240)==224?f=(f&15)<<12|d<<6|g:f=(f&7)<<18|d<<12|g<<6|e[r++]&63,f<65536)l+=String.fromCharCode(f);else{var h=f-65536;l+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return l},ur=[],Ze=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},qr=(e,r,t,n)=>{if(!(n>0))return 0;for(var u=t,l=t+n-1,f=0;f<e.length;++f){var d=e.charCodeAt(f);if(d>=55296&&d<=57343){var g=e.charCodeAt(++f);d=65536+((d&1023)<<10)|g&1023}if(d<=127){if(t>=l)break;r[t++]=d}else if(d<=2047){if(t+1>=l)break;r[t++]=192|d>>6,r[t++]=128|d&63}else if(d<=65535){if(t+2>=l)break;r[t++]=224|d>>12,r[t++]=128|d>>6&63,r[t++]=128|d&63}else{if(t+3>=l)break;r[t++]=240|d>>18,r[t++]=128|d>>12&63,r[t++]=128|d>>6&63,r[t++]=128|d&63}}return r[t]=0,t-u};function Se(e,r,t){var n=t>0?t:Ze(e)+1,u=new Array(n),l=qr(e,u,0,u.length);return r&&(u.length=l),u}var En=()=>{if(!ur.length){var e=null;if(typeof window!="undefined"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
1
|
+
"use strict";var TRTCVideoDecoder=(()=>{var Lo=Object.create;var Nr=Object.defineProperty,Mo=Object.defineProperties,To=Object.getOwnPropertyDescriptor,Fo=Object.getOwnPropertyDescriptors,Bo=Object.getOwnPropertyNames,_o=Object.getOwnPropertySymbols,Ho=Object.getPrototypeOf,bo=Object.prototype.hasOwnProperty,Wo=Object.prototype.propertyIsEnumerable;var uo=(_,p,s)=>p in _?Nr(_,p,{enumerable:!0,configurable:!0,writable:!0,value:s}):_[p]=s,br=(_,p)=>{for(var s in p||(p={}))bo.call(p,s)&&uo(_,s,p[s]);if(_o)for(var s of _o(p))Wo.call(p,s)&&uo(_,s,p[s]);return _},Er=(_,p)=>Mo(_,Fo(p));var Vo=(_,p)=>()=>(p||_((p={exports:{}}).exports,p),p.exports),jo=(_,p)=>{for(var s in p)Nr(_,s,{get:p[s],enumerable:!0})},Eo=(_,p,s,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let S of Bo(p))!bo.call(_,S)&&S!==s&&Nr(_,S,{get:()=>p[S],enumerable:!(g=To(p,S))||g.enumerable});return _};var Go=(_,p,s)=>(s=_!=null?Lo(Ho(_)):{},Eo(p||!_||!_.__esModule?Nr(s,"default",{value:_,enumerable:!0}):s,_)),zo=_=>Eo(Nr({},"__esModule",{value:!0}),_),Le=(_,p,s,g)=>{for(var S=g>1?void 0:g?To(p,s):p,I=_.length-1,A;I>=0;I--)(A=_[I])&&(S=(g?A(p,s,S):A(S))||S);return g&&S&&Nr(p,s,S),S};var fe=(_,p,s)=>uo(_,typeof p!="symbol"?p+"":p,s);var So=Vo((li,co)=>{"use strict";var Ko=Object.prototype.hasOwnProperty,be="~";function dt(){}Object.create&&(dt.prototype=Object.create(null),new dt().__proto__||(be=!1));function Xo(_,p,s){this.fn=_,this.context=p,this.once=s||!1}function wo(_,p,s,g,S){if(typeof s!="function")throw new TypeError("The listener must be a function");var I=new Xo(s,g||_,S),A=be?be+p:p;return _._events[A]?_._events[A].fn?_._events[A]=[_._events[A],I]:_._events[A].push(I):(_._events[A]=I,_._eventsCount++),_}function on(_,p){--_._eventsCount===0?_._events=new dt:delete _._events[p]}function pe(){this._events=new dt,this._eventsCount=0}pe.prototype.eventNames=function(){var p=[],s,g;if(this._eventsCount===0)return p;for(g in s=this._events)Ko.call(s,g)&&p.push(be?g.slice(1):g);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(s)):p};pe.prototype.listeners=function(p){var s=be?be+p:p,g=this._events[s];if(!g)return[];if(g.fn)return[g.fn];for(var S=0,I=g.length,A=new Array(I);S<I;S++)A[S]=g[S].fn;return A};pe.prototype.listenerCount=function(p){var s=be?be+p:p,g=this._events[s];return g?g.fn?1:g.length:0};pe.prototype.emit=function(p,s,g,S,I,A){var j=be?be+p:p;if(!this._events[j])return!1;var k=this._events[j],C=arguments.length,F,L;if(k.fn){switch(k.once&&this.removeListener(p,k.fn,void 0,!0),C){case 1:return k.fn.call(k.context),!0;case 2:return k.fn.call(k.context,s),!0;case 3:return k.fn.call(k.context,s,g),!0;case 4:return k.fn.call(k.context,s,g,S),!0;case 5:return k.fn.call(k.context,s,g,S,I),!0;case 6:return k.fn.call(k.context,s,g,S,I,A),!0}for(L=1,F=new Array(C-1);L<C;L++)F[L-1]=arguments[L];k.fn.apply(k.context,F)}else{var H=k.length,me;for(L=0;L<H;L++)switch(k[L].once&&this.removeListener(p,k[L].fn,void 0,!0),C){case 1:k[L].fn.call(k[L].context);break;case 2:k[L].fn.call(k[L].context,s);break;case 3:k[L].fn.call(k[L].context,s,g);break;case 4:k[L].fn.call(k[L].context,s,g,S);break;default:if(!F)for(me=1,F=new Array(C-1);me<C;me++)F[me-1]=arguments[me];k[L].fn.apply(k[L].context,F)}}return!0};pe.prototype.on=function(p,s,g){return wo(this,p,s,g,!1)};pe.prototype.once=function(p,s,g){return wo(this,p,s,g,!0)};pe.prototype.removeListener=function(p,s,g,S){var I=be?be+p:p;if(!this._events[I])return this;if(!s)return on(this,I),this;var A=this._events[I];if(A.fn)A.fn===s&&(!S||A.once)&&(!g||A.context===g)&&on(this,I);else{for(var j=0,k=[],C=A.length;j<C;j++)(A[j].fn!==s||S&&!A[j].once||g&&A[j].context!==g)&&k.push(A[j]);k.length?this._events[I]=k.length===1?k[0]:k:on(this,I)}return this};pe.prototype.removeAllListeners=function(p){var s;return p?(s=be?be+p:p,this._events[s]&&on(this,s)):(this._events=new dt,this._eventsCount=0),this};pe.prototype.off=pe.prototype.removeListener;pe.prototype.addListener=pe.prototype.on;pe.prefixed=be;pe.EventEmitter=pe;typeof co!="undefined"&&(co.exports=pe)});var ii={};jo(ii,{VideoDecoderPlugin:()=>ln,default:()=>oi});var Po=Go(So(),1),Ao=Symbol("instance"),di=Symbol("abortCtrl"),an=Symbol("cacheResult"),ft=class{constructor(p,s,g){this.oldState=p,this.newState=s,this.action=g,this.aborted=!1}abort(p){this.aborted=!0,mt.call(p,this.oldState,new Error(`action '${this.action}' aborted`))}toString(){return`${this.action}ing`}},$r=class extends Error{constructor(p,s,g){super(s),this.state=p,this.message=s,this.cause=g}};function qo(_){return typeof _=="object"&&_&&"then"in _}var pt=new Map;function je(_,p,s={}){return(g,S,I)=>{let A=s.action||S;if(!s.context){let k=pt.get(g)||[];pt.has(g)||pt.set(g,k),k.push({from:_,to:p,action:A})}let j=I.value;I.value=function(...k){let C=this;if(s.context&&(C=ce.get(typeof s.context=="function"?s.context.call(this,...k):s.context)),C.state===p)return s.sync?C[an]:Promise.resolve(C[an]);C.state instanceof ft&&C.state.action==s.abortAction&&C.state.abort(C);let F=null;Array.isArray(_)?_.length==0?C.state instanceof ft&&C.state.abort(C):(typeof C.state!="string"||!_.includes(C.state))&&(F=new $r(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${_.join("|")}`)):_!==C.state&&(F=new $r(C._state,`${C.name} ${A} to ${p} failed: current state ${C._state} not from ${_}`));let L=q=>{if(s.fail&&s.fail.call(this,q),s.sync){if(s.ignoreError)return q;throw q}else return s.ignoreError?Promise.resolve(q):Promise.reject(q)};if(F)return L(F);let H=C.state,me=new ft(H,p,A);mt.call(C,me);let Re=q=>{var ze;return C[an]=q,me.aborted||(mt.call(C,p),(ze=s.success)===null||ze===void 0||ze.call(this,C[an])),q},Me=q=>(mt.call(C,H,q),L(q));try{let q=j.apply(this,k);return qo(q)?q.then(Re).catch(Me):s.sync?Re(q):Promise.resolve(Re(q))}catch(q){return Me(new $r(C._state,`${C.name} ${A} from ${_} to ${p} failed: ${q}`,q instanceof Error?q:new Error(String(q))))}}}}function Co(..._){return(p,s,g)=>{let S=g.value,I=s;g.value=function(...A){if(!_.includes(this.state.toString()))throw new $r(this.state,`${this.name} ${I} failed: current state ${this.state} not in ${_}`);return S.apply(this,A)}}}var Yo=typeof window!="undefined"&&window.__AFSM__?(s,g)=>{window.dispatchEvent(new CustomEvent(s,{detail:g}))}:typeof importScripts!="undefined"?(s,g)=>{postMessage({type:s,payload:g})}:()=>{};function mt(_,p){let s=this._state;this._state=_;let g=_.toString();_&&this.emit(g,s),this.emit(ce.STATECHANGED,_,s,p),this.updateDevTools({value:_,old:s,err:p instanceof Error?p.message:String(p)})}var ce=class _ extends Po.default{constructor(p,s,g){super(),this.name=p,this.groupName=s,this._state=_.INIT,p||(p=Date.now().toString(36)),g?Object.setPrototypeOf(this,g):g=Object.getPrototypeOf(this),s||(this.groupName=this.constructor.name);let S=g[Ao];S?this.name=S.name+"-"+S.count++:g[Ao]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let p=Object.getPrototypeOf(this),s=pt.get(p)||[],g=new Set,S=[],I=[],A=new Set,j=Object.getPrototypeOf(p);pt.has(j)&&(j.stateDiagram.forEach(C=>g.add(C)),j.allStates.forEach(C=>A.add(C))),s.forEach(({from:C,to:F,action:L})=>{typeof C=="string"?S.push({from:C,to:F,action:L}):C.length?C.forEach(H=>{S.push({from:H,to:F,action:L})}):I.push({to:F,action:L})}),S.forEach(({from:C,to:F,action:L})=>{A.add(C),A.add(F),A.add(L+"ing"),g.add(`${C} --> ${L}ing : ${L}`),g.add(`${L}ing --> ${F} : ${L} \u{1F7E2}`),g.add(`${L}ing --> ${C} : ${L} \u{1F534}`)}),I.forEach(({to:C,action:F})=>{g.add(`${F}ing --> ${C} : ${F} \u{1F7E2}`),A.forEach(L=>{L!==C&&g.add(`${L} --> ${F}ing : ${F}`)})});let k=[...g];return Object.defineProperties(p,{stateDiagram:{value:k},allStates:{value:A}}),k}static get(p){let s;return typeof p=="string"?(s=_.instances.get(p),s||_.instances.set(p,s=new _(p,void 0,Object.create(_.prototype)))):(s=_.instances2.get(p),s||_.instances2.set(p,s=new _(p.constructor.name,void 0,Object.create(_.prototype)))),s}static getState(p){var s;return(s=_.get(p))===null||s===void 0?void 0:s.state}updateDevTools(p={}){Yo(_.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},p))}get state(){return this._state}set state(p){mt.call(this,p)}};ce.STATECHANGED="stateChanged";ce.UPDATEAFSM="updateAFSM";ce.INIT="[*]";ce.ON="on";ce.OFF="off";ce.instances=new Map;ce.instances2=new WeakMap;var or=class extends ce{constructor(){super(...arguments);fe(this,"decoder");fe(this,"config")}async initialize(){this.decoder=new VideoDecoder({output:s=>{this.emit("videoFrame",s)},error:s=>{this.close(),this.emit("error",s)}})}configure(s){this.config=s,this.decoder.configure(Er(br({},s),{codec:this.getCodec(s)}))}getCodec(s){switch(s.codec){case"hevc":return"hvc1.1.6.L0.12.34.56.78.9A.BC";case"av1":return"av01.0.05M.08";case"avc":return"avc1.420028";default:return s.codec}}decode(s){this.decoder.state==="configured"&&this.decoder.decode(new EncodedVideoChunk(s))}flush(){this.decoder.flush()}reset(){this.decoder.reset()}close(){this.decoder.state!=="closed"&&this.decoder.close()}};Le([je([ce.INIT,"closed"],"initialized")],or.prototype,"initialize",1),Le([je("initialized","configured",{sync:!0})],or.prototype,"configure",1),Le([Co("configured")],or.prototype,"decode",1),Le([je([],ce.INIT)],or.prototype,"reset",1),Le([je([],"closed",{ignoreError:!0,sync:!0})],or.prototype,"close",1);function Zo(){var _;self.onmessage=p=>{if(p.data.type==="init"){let{canvas:s,wasmScript:g,wasmBinary:S}=p.data,I=s==null?void 0:s.getContext("2d"),A=0,j=0,k={wasmBinary:S,postRun:()=>{_=new k.VideoDecoder({videoInfo(C,F){A=C,j=F,console.log("video info",C,F)},yuvData(C,F){let L=A*j,H=L>>2,me=k.HEAPU32[C>>2],Re=k.HEAPU32[(C>>2)+1],Me=k.HEAPU32[(C>>2)+2],q=k.HEAPU8.subarray(me,me+L),ze=k.HEAPU8.subarray(Re,Re+H),lr=k.HEAPU8.subarray(Me,Me+H),ae=new Uint8Array(L+H+H);ae.set(q),ae.set(ze,L),ae.set(lr,L+H);let he=new VideoFrame(ae,{codedWidth:A,codedHeight:j,format:"I420",timestamp:F});s?(I==null||I.drawImage(he,0,0,s.width,s.height),I==null||I.commit()):self.postMessage({type:"yuvData",videoFrame:he},[he])}}),self.postMessage({type:"ready"})}};Function("var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;return "+g)()(k)}else if(p.data.type==="decode"){let{packet:s}=p.data;_==null||_.decode(s.data,s.type=="key",s.timestamp)}else if(p.data.type==="setCodec"){let{codec:s,format:g,description:S}=p.data;_==null||_.setCodec(s,g,S!=null?S:"")}}}var Ge=class extends ce{constructor(s,g,S=!1,I,A=!1){super();this.createModule=s;this.wasmBinary=g;this.workerMode=S;this.canvas=I;this.yuvMode=A;fe(this,"worker");fe(this,"decoder");fe(this,"config");fe(this,"module",{});fe(this,"width",0);fe(this,"height",0)}async initialize(s){var S;if(this.workerMode){let I=new RegExp("\\{(.+)\\}","s").exec(Zo.toString())[1];this.worker=new Worker(URL.createObjectURL(new Blob([I],{type:"text/javascript"})));let A=(S=this.canvas)==null?void 0:S.transferControlToOffscreen(),j=await this.wasmBinary;return console.warn("worker mode",j),this.worker.postMessage({type:"init",canvas:A,wasmScript:this.createModule.toString(),wasmBinary:j},A?[A,j]:[j]),new Promise(k=>{this.worker.onmessage=C=>{if(C.data.type==="ready")delete this.wasmBinary,k(),console.warn("worker mode initialize success");else if(C.data.type==="yuvData"){let{videoFrame:F}=C.data;this.emit("videoFrame",F)}}})}let g=this.module;return this.wasmBinary&&(g.wasmBinary=await this.wasmBinary),g.print=I=>console.log(I),g.printErr=I=>console.log(`[JS] ERROR: ${I}`),g.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),new Promise(I=>{g.postRun=A=>{this.decoder=new this.module.VideoDecoder(this),console.log("video soft decoder initialize success"),I()},s&&Object.assign(g,s),this.createModule(g)})}configure(s){var g,S,I;this.config=s,(S=this.decoder)==null||S.setCodec(this.config.codec,this.config.description?"avcc":"annexb",(g=this.config.description)!=null?g:""),(I=this.worker)==null||I.postMessage({type:"setCodec",codec:this.config.codec,format:this.config.description?"avcc":"annexb",description:this.config.description})}decode(s){var g,S;(g=this.decoder)==null||g.decode(s.data,s.type=="key",s.timestamp),this.state==="configured"&&((S=this.worker)==null||S.postMessage({type:"decode",packet:s}))}flush(){}reset(){this.config=void 0,this.decoder&&this.decoder.clear()}close(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}videoInfo(s,g){this.width=s,this.height=g;let S={width:s,height:g};this.emit("videoCodecInfo",S)}yuvData(s,g){if(!this.module)return;let S=this.width*this.height,I=S>>2,A=this.module.HEAPU32[s>>2],j=this.module.HEAPU32[(s>>2)+1],k=this.module.HEAPU32[(s>>2)+2],C=this.module.HEAPU8.subarray(A,A+S),F=this.module.HEAPU8.subarray(j,j+I),L=this.module.HEAPU8.subarray(k,k+I);if(this.yuvMode){this.emit("videoFrame",[C,F,L]);return}let H=new Uint8Array(S+I+I);H.set(C),H.set(F,S),H.set(L,S+I),this.emit("videoFrame",new VideoFrame(H,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:g}))}errorInfo(s){let g={errMsg:s};this.emit("error",g)}};Le([je([ce.INIT,"closed"],"initialized")],Ge.prototype,"initialize",1),Le([je("initialized","configured")],Ge.prototype,"configure",1),Le([je([],ce.INIT)],Ge.prototype,"reset",1),Le([je([],"closed")],Ge.prototype,"close",1);var Qo=(()=>{var _=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,g,S;s.ready=new Promise((e,r)=>{g=e,S=r});var I=Object.assign({},s),A=[],j="./this.program",k=(e,r)=>{throw r},C=typeof window=="object",F=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",H="";function me(e){return s.locateFile?s.locateFile(e,H):H+e}var Re,Me,q,ze;(C||F)&&(F?H=self.location.href:typeof document!="undefined"&&document.currentScript&&(H=document.currentScript.src),_&&(H=_),H.indexOf("blob:")!==0?H=H.substr(0,H.replace(/[?#].*/,"").lastIndexOf("/")+1):H="",Re=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},F&&(q=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Me=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){r(n.response);return}t()},n.onerror=t,n.send(null)},ze=e=>document.title=e);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,I),I=null,s.arguments&&(A=s.arguments),s.thisProgram&&(j=s.thisProgram),s.quit&&(k=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Do=s.noExitRuntime||!0;typeof WebAssembly!="object"&&Fe("no native wasm support detected");var Lr,ee,Mr=!1,fn;function Ke(e,r){e||Fe(r)}var Y,ie,we,Se,U,X,Fr,ht;function vt(){var e=Lr.buffer;s.HEAP8=Y=new Int8Array(e),s.HEAP16=we=new Int16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU8=ie=new Uint8Array(e),s.HEAPU16=Se=new Uint16Array(e),s.HEAPU32=X=new Uint32Array(e),s.HEAPF32=Fr=new Float32Array(e),s.HEAPF64=ht=new Float64Array(e)}var Br,Hr=[],Wr=[],gt=[],pn=!1;function mn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)gn(s.preRun.shift());zr(Hr)}function hn(){pn=!0,!s.noFSInit&&!a.init.initialized&&a.init(),a.ignorePermissions=!1,Be.init(),zr(Wr)}function vn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)Xe(s.postRun.shift());zr(gt)}function gn(e){Hr.unshift(e)}function yn(e){Wr.unshift(e)}function Xe(e){gt.unshift(e)}var Oe=0,qe=null,dr=null;function fo(e){return e}function ir(e){Oe++,s.monitorRunDependencies&&s.monitorRunDependencies(Oe)}function wr(e){if(Oe--,s.monitorRunDependencies&&s.monitorRunDependencies(Oe),Oe==0&&(qe!==null&&(clearInterval(qe),qe=null),dr)){var r=dr;dr=null,r()}}function Fe(e){s.onAbort&&s.onAbort(e),e="Aborted("+e+")",ae(e),Mr=!0,fn=1,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw S(r),r}var ar="data:application/octet-stream;base64,";function Vr(e){return e.startsWith(ar)}var sr;sr="videodec.wasm",Vr(sr)||(sr=me(sr));function jr(e){if(e==sr&&he)return new Uint8Array(he);if(q)return q(e);throw"both async and sync fetching of the wasm failed"}function _n(e){return!he&&(C||F)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()}).catch(()=>jr(e)):Promise.resolve().then(()=>jr(e))}function yt(e,r,t){return _n(e).then(n=>WebAssembly.instantiate(n,r)).then(n=>n).then(t,n=>{ae("failed to asynchronously prepare wasm: "+n),Fe(n)})}function Gr(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Vr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(u=>{var l=WebAssembly.instantiateStreaming(u,t);return l.then(n,function(f){return ae("wasm streaming compile failed: "+f),ae("falling back to ArrayBuffer instantiation"),yt(r,t,n)})}):yt(r,t,n)}function Tn(){var e={a:xo};function r(n,u){var l=n.exports;return ee=l,Lr=ee.E,vt(),Br=ee.H,yn(ee.F),wr("wasm-instantiate"),l}ir("wasm-instantiate");function t(n){r(n.instance)}if(s.instantiateWasm)try{return s.instantiateWasm(e,r)}catch(n){ae("Module.instantiateWasm callback failed with error: "+n),S(n)}return Gr(he,sr,e,t).catch(S),{}}var N,Q,zr=e=>{for(;e.length>0;)e.shift()(s)};function bn(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(r){X[this.ptr+4>>2]=r},this.get_type=function(){return X[this.ptr+4>>2]},this.set_destructor=function(r){X[this.ptr+8>>2]=r},this.get_destructor=function(){return X[this.ptr+8>>2]},this.set_caught=function(r){r=r?1:0,Y[this.ptr+12>>0]=r},this.get_caught=function(){return Y[this.ptr+12>>0]!=0},this.set_rethrown=function(r){r=r?1:0,Y[this.ptr+13>>0]=r},this.get_rethrown=function(){return Y[this.ptr+13>>0]!=0},this.init=function(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)},this.set_adjusted_ptr=function(r){X[this.ptr+16>>2]=r},this.get_adjusted_ptr=function(){return X[this.ptr+16>>2]},this.get_exception_ptr=function(){var r=go(this.get_type());if(r)return X[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var Sr=0,En=0;function _t(e,r,t){var n=new bn(e);throw n.init(r,t),Sr=e,En++,Sr}var ve=e=>(U[ho()>>2]=e,e),G={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var u=e[n];u==="."?e.splice(n,1):u===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=G.isAbs(e),t=e.substr(-1)==="/";return e=G.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=G.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=G.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return G.normalize(e.join("/"))},join2:(e,r)=>G.normalize(e+"/"+r)},Ye=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);Fe("initRandomDevice")},fr=e=>(fr=Ye())(e),le={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:a.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=G.isAbs(n)}return e=G.normalizeArray(e.split("/").filter(u=>!!u),!r).join("/"),(r?"/":"")+e||"."},relative:(e,r)=>{e=le.resolve(e).substr(1),r=le.resolve(r).substr(1);function t(h){for(var R=0;R<h.length&&h[R]==="";R++);for(var x=h.length-1;x>=0&&h[x]==="";x--);return R>x?[]:h.slice(R,x-R+1)}for(var n=t(e.split("/")),u=t(r.split("/")),l=Math.min(n.length,u.length),f=l,d=0;d<l;d++)if(n[d]!==u[d]){f=d;break}for(var y=[],d=f;d<n.length;d++)y.push("..");return y=y.concat(u.slice(f)),y.join("/")}},z=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,Je=(e,r,t)=>{for(var n=r+t,u=r;e[u]&&!(u>=n);)++u;if(u-r>16&&e.buffer&&z)return z.decode(e.subarray(r,u));for(var l="";r<u;){var f=e[r++];if(!(f&128)){l+=String.fromCharCode(f);continue}var d=e[r++]&63;if((f&224)==192){l+=String.fromCharCode((f&31)<<6|d);continue}var y=e[r++]&63;if((f&240)==224?f=(f&15)<<12|d<<6|y:f=(f&7)<<18|d<<12|y<<6|e[r++]&63,f<65536)l+=String.fromCharCode(f);else{var h=f-65536;l+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return l},ur=[],Ze=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},Kr=(e,r,t,n)=>{if(!(n>0))return 0;for(var u=t,l=t+n-1,f=0;f<e.length;++f){var d=e.charCodeAt(f);if(d>=55296&&d<=57343){var y=e.charCodeAt(++f);d=65536+((d&1023)<<10)|y&1023}if(d<=127){if(t>=l)break;r[t++]=d}else if(d<=2047){if(t+1>=l)break;r[t++]=192|d>>6,r[t++]=128|d&63}else if(d<=65535){if(t+2>=l)break;r[t++]=224|d>>12,r[t++]=128|d>>6&63,r[t++]=128|d&63}else{if(t+3>=l)break;r[t++]=240|d>>18,r[t++]=128|d>>12&63,r[t++]=128|d>>6&63,r[t++]=128|d&63}}return r[t]=0,t-u};function Ae(e,r,t){var n=t>0?t:Ze(e)+1,u=new Array(n),l=Kr(e,u,0,u.length);return r&&(u.length=l),u}var wn=()=>{if(!ur.length){var e=null;if(typeof window!="undefined"&&typeof window.prompt=="function"?(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
2
2
|
`)):typeof readline=="function"&&(e=readline(),e!==null&&(e+=`
|
|
3
|
-
`)),!e)return null;ur=Se(e,!0)}return ur.shift()},We={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){We.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,We.stream_ops)},stream_ops:{open:function(e){var r=We.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var l=0,f=0;f<n;f++){var d;try{d=e.tty.ops.get_char(e.tty)}catch(g){throw new a.ErrnoError(29)}if(d===void 0&&l===0)throw new a.ErrnoError(6);if(d==null)break;l++,r[t+f]=d}return l&&(e.node.timestamp=Date.now()),l},write:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var l=0;l<n;l++)e.tty.ops.put_char(e.tty,r[t+l])}catch(f){throw new a.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),l}},default_tty_ops:{get_char:function(e){return En()},put_char:function(e,r){r===null||r===10?(lr(Ye(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync:function(e){e.output&&e.output.length>0&&(lr(Ye(e.output,0)),e.output=[])},ioctl_tcgets:function(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[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]}},ioctl_tcsets:function(e,r,t){return 0},ioctl_tiocgwinsz:function(e){return[24,80]}},default_tty1_ops:{put_char:function(e,r){r===null||r===10?(ae(Ye(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync:function(e){e.output&&e.output.length>0&&(ae(Ye(e.output,0)),e.output=[])}}},_t=e=>{Le()},M={ops_table:null,mount(e){return M.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);M.ops_table||(M.ops_table={dir:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr,lookup:M.node_ops.lookup,mknod:M.node_ops.mknod,rename:M.node_ops.rename,unlink:M.node_ops.unlink,rmdir:M.node_ops.rmdir,readdir:M.node_ops.readdir,symlink:M.node_ops.symlink},stream:{llseek:M.stream_ops.llseek}},file:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr},stream:{llseek:M.stream_ops.llseek,read:M.stream_ops.read,write:M.stream_ops.write,allocate:M.stream_ops.allocate,mmap:M.stream_ops.mmap,msync:M.stream_ops.msync}},link:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr,readlink:M.node_ops.readlink},stream:{}},chrdev:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr},stream:a.chrdev_stream_ops}});var u=a.createNode(e,r,t,n);return a.isDir(u.mode)?(u.node_ops=M.ops_table.dir.node,u.stream_ops=M.ops_table.dir.stream,u.contents={}):a.isFile(u.mode)?(u.node_ops=M.ops_table.file.node,u.stream_ops=M.ops_table.file.stream,u.usedBytes=0,u.contents=null):a.isLink(u.mode)?(u.node_ops=M.ops_table.link.node,u.stream_ops=M.ops_table.link.stream):a.isChrdev(u.mode)&&(u.node_ops=M.ops_table.chrdev.node,u.stream_ops=M.ops_table.chrdev.stream),u.timestamp=Date.now(),e&&(e.contents[r]=u,e.timestamp=u.timestamp),u},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var u=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(u.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=a.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,a.isDir(e.mode)?r.size=4096:a.isFile(e.mode)?r.size=e.usedBytes:a.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&M.resizeFileStorage(e,r.size)},lookup(e,r){throw a.genericErrors[44]},mknod(e,r,t,n){return M.createNode(e,r,t,n)},rename(e,r,t){if(a.isDir(e.mode)){var n;try{n=a.lookupNode(r,t)}catch(l){}if(n)for(var u in n.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=a.lookupNode(e,r);for(var n in t.contents)throw new a.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink(e,r,t){var n=M.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,u){var l=e.node.contents;if(u>=e.node.usedBytes)return 0;var f=Math.min(e.node.usedBytes-u,n);if(f>8&&l.subarray)r.set(l.subarray(u,u+f),t);else for(var d=0;d<f;d++)r[t+d]=l[u+d];return f},write(e,r,t,n,u,l){if(!n)return 0;var f=e.node;if(f.timestamp=Date.now(),r.subarray&&(!f.contents||f.contents.subarray)){if(l)return f.contents=r.subarray(t,t+n),f.usedBytes=n,n;if(f.usedBytes===0&&u===0)return f.contents=r.slice(t,t+n),f.usedBytes=n,n;if(u+n<=f.usedBytes)return f.contents.set(r.subarray(t,t+n),u),n}if(M.expandFileStorage(f,u+n),f.contents.subarray&&r.subarray)f.contents.set(r.subarray(t,t+n),u);else for(var d=0;d<n;d++)f.contents[u+d]=r[t+d];return f.usedBytes=Math.max(f.usedBytes,u+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&a.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new a.ErrnoError(28);return n},allocate(e,r,t){M.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,u){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var l,f,d=e.node.contents;if(!(u&2)&&d.buffer===J.buffer)f=!1,l=d.byteOffset;else{if((t>0||t+r<d.length)&&(d.subarray?d=d.subarray(t,t+r):d=Array.prototype.slice.call(d,t,t+r)),f=!0,l=_t(r),!l)throw new a.ErrnoError(48);J.set(d,l)}return{ptr:l,allocated:f}},msync(e,r,t,n,u){return M.stream_ops.write(e,r,0,n,t,!1),0}}},Xr=(e,r,t,n)=>{var u=n?"":`al ${e}`;Me(e,l=>{qe(l,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(l)),u&&Tr(u)},l=>{if(t)t();else throw`Loading data file "${e}" failed.`}),u&&or(u)},wt=s.preloadPlugins||[];function Tn(e,r,t,n){typeof Browser!="undefined"&&Browser.init();var u=!1;return wt.forEach(function(l){u||l.canHandle(r)&&(l.handle(e,r,t,n),u=!0)}),u}function Et(e,r,t,n,u,l,f,d,g,h){var A=r?le.resolve(z.join2(e,r)):e,O=`cp ${A}`;function R(S){function F(Z){h&&h(),d||a.createDataFile(e,r,Z,n,u,g),l&&l(),Tr(O)}Tn(S,A,F,()=>{f&&f(),Tr(O)})||F(S)}or(O),typeof t=="string"?Xr(t,S=>R(S),f):R(t)}function Tt(e){var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t=="undefined")throw new Error(`Unknown file open mode: ${e}`);return t}function Sr(e,r){var t=0;return e&&(t|=365),r&&(t|=146),t}var a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(e,r={})=>{if(e=le.resolve(e),!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new a.ErrnoError(32);for(var n=e.split("/").filter(O=>!!O),u=a.root,l="/",f=0;f<n.length;f++){var d=f===n.length-1;if(d&&r.parent)break;if(u=a.lookupNode(u,n[f]),l=z.join2(l,n[f]),a.isMountpoint(u)&&(!d||d&&r.follow_mount)&&(u=u.mounted.root),!d||r.follow)for(var g=0;a.isLink(u.mode);){var h=a.readlink(l);l=le.resolve(z.dirname(l),h);var A=a.lookupPath(l,{recurse_count:r.recurse_count+1});if(u=A.node,g++>40)throw new a.ErrnoError(32)}}return{path:l,node:u}},getPath:e=>{for(var r;;){if(a.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName:(e,r)=>{for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%a.nameTable.length},hashAddNode:e=>{var r=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[r],a.nameTable[r]=e},hashRemoveNode:e=>{var r=a.hashName(e.parent.id,e.name);if(a.nameTable[r]===e)a.nameTable[r]=e.name_next;else for(var t=a.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:(e,r)=>{var t=a.mayLookup(e);if(t)throw new a.ErrnoError(t,e);for(var n=a.hashName(e.id,r),u=a.nameTable[n];u;u=u.name_next){var l=u.name;if(u.parent.id===e.id&&l===r)return u}return a.lookup(e,r)},createNode:(e,r,t,n)=>{var u=new a.FSNode(e,r,t,n);return a.hashAddNode(u),u},destroyNode:e=>{a.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(e&61440)===32768,isDir:e=>(e&61440)===16384,isLink:e=>(e&61440)===40960,isChrdev:e=>(e&61440)===8192,isBlkdev:e=>(e&61440)===24576,isFIFO:e=>(e&61440)===4096,isSocket:e=>(e&49152)===49152,flagsToPermissionString:e=>{var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions:(e,r)=>a.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0,mayLookup:e=>{var r=a.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:(e,r)=>{try{var t=a.lookupNode(e,r);return 20}catch(n){}return a.nodePermissions(e,"wx")},mayDelete:(e,r,t)=>{var n;try{n=a.lookupNode(e,r)}catch(l){return l.errno}var u=a.nodePermissions(e,"wx");if(u)return u;if(t){if(!a.isDir(n.mode))return 54;if(a.isRoot(n)||a.getPath(n)===a.cwd())return 10}else if(a.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(r)!=="r"||r&512)?31:a.nodePermissions(e,a.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd:()=>{for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked:e=>{var r=a.getStream(e);if(!r)throw new a.ErrnoError(8);return r},getStream:e=>a.streams[e],createStream:(e,r=-1)=>(a.FSStream||(a.FSStream=function(){this.shared={}},a.FSStream.prototype={},Object.defineProperties(a.FSStream.prototype,{object:{get(){return this.node},set(t){this.node=t}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(t){this.shared.flags=t}},position:{get(){return this.shared.position},set(t){this.shared.position=t}}})),e=Object.assign(new a.FSStream,e),r==-1&&(r=a.nextfd()),e.fd=r,a.streams[r]=e,e),closeStream:e=>{a.streams[e]=null},chrdev_stream_ops:{open:e=>{var r=a.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice:(e,r)=>{a.devices[e]={stream_ops:r}},getDevice:e=>a.devices[e],getMounts:e=>{for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:(e,r)=>{typeof e=="function"&&(r=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&ae(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=a.getMounts(a.root.mount),n=0;function u(f){return a.syncFSRequests--,r(f)}function l(f){if(f)return l.errored?void 0:(l.errored=!0,u(f));++n>=t.length&&u(null)}t.forEach(f=>{if(!f.type.syncfs)return l(null);f.type.syncfs(f,e,l)})},mount:(e,r,t)=>{var n=t==="/",u=!t,l;if(n&&a.root)throw new a.ErrnoError(10);if(!n&&!u){var f=a.lookupPath(t,{follow_mount:!1});if(t=f.path,l=f.node,a.isMountpoint(l))throw new a.ErrnoError(10);if(!a.isDir(l.mode))throw new a.ErrnoError(54)}var d={type:e,opts:r,mountpoint:t,mounts:[]},g=e.mount(d);return g.mount=d,d.root=g,n?a.root=g:l&&(l.mounted=d,l.mount&&l.mount.mounts.push(d)),g},unmount:e=>{var r=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(r.node))throw new a.ErrnoError(28);var t=r.node,n=t.mounted,u=a.getMounts(n);Object.keys(a.nameTable).forEach(f=>{for(var d=a.nameTable[f];d;){var g=d.name_next;u.includes(d.mount)&&a.destroyNode(d),d=g}}),t.mounted=null;var l=t.mount.mounts.indexOf(n);t.mount.mounts.splice(l,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod:(e,r,t)=>{var n=a.lookupPath(e,{parent:!0}),u=n.node,l=z.basename(e);if(!l||l==="."||l==="..")throw new a.ErrnoError(28);var f=a.mayCreate(u,l);if(f)throw new a.ErrnoError(f);if(!u.node_ops.mknod)throw new a.ErrnoError(63);return u.node_ops.mknod(u,l,r,t)},create:(e,r)=>(r=r!==void 0?r:438,r&=4095,r|=32768,a.mknod(e,r,0)),mkdir:(e,r)=>(r=r!==void 0?r:511,r&=1023,r|=16384,a.mknod(e,r,0)),mkdirTree:(e,r)=>{for(var t=e.split("/"),n="",u=0;u<t.length;++u)if(t[u]){n+="/"+t[u];try{a.mkdir(n,r)}catch(l){if(l.errno!=20)throw l}}},mkdev:(e,r,t)=>(typeof t=="undefined"&&(t=r,r=438),r|=8192,a.mknod(e,r,t)),symlink:(e,r)=>{if(!le.resolve(e))throw new a.ErrnoError(44);var t=a.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var u=z.basename(r),l=a.mayCreate(n,u);if(l)throw new a.ErrnoError(l);if(!n.node_ops.symlink)throw new a.ErrnoError(63);return n.node_ops.symlink(n,u,e)},rename:(e,r)=>{var t=z.dirname(e),n=z.dirname(r),u=z.basename(e),l=z.basename(r),f,d,g;if(f=a.lookupPath(e,{parent:!0}),d=f.node,f=a.lookupPath(r,{parent:!0}),g=f.node,!d||!g)throw new a.ErrnoError(44);if(d.mount!==g.mount)throw new a.ErrnoError(75);var h=a.lookupNode(d,u),A=le.relative(e,n);if(A.charAt(0)!==".")throw new a.ErrnoError(28);if(A=le.relative(r,t),A.charAt(0)!==".")throw new a.ErrnoError(55);var O;try{O=a.lookupNode(g,l)}catch(F){}if(h!==O){var R=a.isDir(h.mode),S=a.mayDelete(d,u,R);if(S)throw new a.ErrnoError(S);if(S=O?a.mayDelete(g,l,R):a.mayCreate(g,l),S)throw new a.ErrnoError(S);if(!d.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(h)||O&&a.isMountpoint(O))throw new a.ErrnoError(10);if(g!==d&&(S=a.nodePermissions(d,"w"),S))throw new a.ErrnoError(S);a.hashRemoveNode(h);try{d.node_ops.rename(h,g,l)}catch(F){throw F}finally{a.hashAddNode(h)}}},rmdir:e=>{var r=a.lookupPath(e,{parent:!0}),t=r.node,n=z.basename(e),u=a.lookupNode(t,n),l=a.mayDelete(t,n,!0);if(l)throw new a.ErrnoError(l);if(!t.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(u))throw new a.ErrnoError(10);t.node_ops.rmdir(t,n),a.destroyNode(u)},readdir:e=>{var r=a.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new a.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var r=a.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new a.ErrnoError(44);var n=z.basename(e),u=a.lookupNode(t,n),l=a.mayDelete(t,n,!1);if(l)throw new a.ErrnoError(l);if(!t.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(u))throw new a.ErrnoError(10);t.node_ops.unlink(t,n),a.destroyNode(u)},readlink:e=>{var r=a.lookupPath(e),t=r.node;if(!t)throw new a.ErrnoError(44);if(!t.node_ops.readlink)throw new a.ErrnoError(28);return le.resolve(a.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,r)=>{var t=a.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.getattr)throw new a.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>a.stat(e,!0),chmod:(e,r,t)=>{var n;if(typeof e=="string"){var u=a.lookupPath(e,{follow:!t});n=u.node}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()})},lchmod:(e,r)=>{a.chmod(e,r,!0)},fchmod:(e,r)=>{var t=a.getStreamChecked(e);a.chmod(t.node,r)},chown:(e,r,t,n)=>{var u;if(typeof e=="string"){var l=a.lookupPath(e,{follow:!n});u=l.node}else u=e;if(!u.node_ops.setattr)throw new a.ErrnoError(63);u.node_ops.setattr(u,{timestamp:Date.now()})},lchown:(e,r,t)=>{a.chown(e,r,t,!0)},fchown:(e,r,t)=>{var n=a.getStreamChecked(e);a.chown(n.node,r,t)},truncate:(e,r)=>{if(r<0)throw new a.ErrnoError(28);var t;if(typeof e=="string"){var n=a.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(t.mode))throw new a.ErrnoError(31);if(!a.isFile(t.mode))throw new a.ErrnoError(28);var u=a.nodePermissions(t,"w");if(u)throw new a.ErrnoError(u);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate:(e,r)=>{var t=a.getStreamChecked(e);if(!(t.flags&2097155))throw new a.ErrnoError(28);a.truncate(t.node,r)},utime:(e,r,t)=>{var n=a.lookupPath(e,{follow:!0}),u=n.node;u.node_ops.setattr(u,{timestamp:Math.max(r,t)})},open:(e,r,t)=>{if(e==="")throw new a.ErrnoError(44);r=typeof r=="string"?Tt(r):r,t=typeof t=="undefined"?438:t,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{e=z.normalize(e);try{var u=a.lookupPath(e,{follow:!(r&131072)});n=u.node}catch(g){}}var l=!1;if(r&64)if(n){if(r&128)throw new a.ErrnoError(20)}else n=a.mknod(e,t,0),l=!0;if(!n)throw new a.ErrnoError(44);if(a.isChrdev(n.mode)&&(r&=-513),r&65536&&!a.isDir(n.mode))throw new a.ErrnoError(54);if(!l){var f=a.mayOpen(n,r);if(f)throw new a.ErrnoError(f)}r&512&&!l&&a.truncate(n,0),r&=-131713;var d=a.createStream({node:n,path:a.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return d.stream_ops.open&&d.stream_ops.open(d),s.logReadFiles&&!(r&1)&&(a.readFiles||(a.readFiles={}),e in a.readFiles||(a.readFiles[e]=1)),d},close:e=>{if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{a.closeStream(e.fd)}e.fd=null},isClosed:e=>e.fd===null,llseek:(e,r,t)=>{if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read:(e,r,t,n,u)=>{if(n<0||u<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var l=typeof u!="undefined";if(!l)u=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var f=e.stream_ops.read(e,r,t,n,u);return l||(e.position+=f),f},write:(e,r,t,n,u,l)=>{if(n<0||u<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if(!(e.flags&2097155))throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var f=typeof u!="undefined";if(!f)u=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var d=e.stream_ops.write(e,r,t,n,u,l);return f||(e.position+=d),d},allocate:(e,r,t)=>{if(a.isClosed(e))throw new a.ErrnoError(8);if(r<0||t<=0)throw new a.ErrnoError(28);if(!(e.flags&2097155))throw new a.ErrnoError(8);if(!a.isFile(e.node.mode)&&!a.isDir(e.node.mode))throw new a.ErrnoError(43);if(!e.stream_ops.allocate)throw new a.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap:(e,r,t,n,u)=>{if(n&2&&!(u&2)&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,u)},msync:(e,r,t,n,u)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,u):0,munmap:e=>0,ioctl:(e,r,t)=>{if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile:(e,r={})=>{if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=a.open(e,r.flags),u=a.stat(e),l=u.size,f=new Uint8Array(l);return a.read(n,f,0,l,0),r.encoding==="utf8"?t=Ye(f,0):r.encoding==="binary"&&(t=f),a.close(n),t},writeFile:(e,r,t={})=>{t.flags=t.flags||577;var n=a.open(e,t.flags,t.mode);if(typeof r=="string"){var u=new Uint8Array(Ze(r)+1),l=qr(r,u,0,u.length);a.write(n,u,0,l,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))a.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");a.close(n)},cwd:()=>a.currentPath,chdir:e=>{var r=a.lookupPath(e,{follow:!0});if(r.node===null)throw new a.ErrnoError(44);if(!a.isDir(r.node.mode))throw new a.ErrnoError(54);var t=a.nodePermissions(r.node,"x");if(t)throw new a.ErrnoError(t);a.currentPath=r.path},createDefaultDirectories:()=>{a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices:()=>{a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(n,u,l,f,d)=>f}),a.mkdev("/dev/null",a.makedev(1,3)),We.register(a.makedev(5,0),We.default_tty_ops),We.register(a.makedev(6,0),We.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=fr(e).byteLength),e[--r]);a.createDevice("/dev","random",t),a.createDevice("/dev","urandom",t),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount:()=>{var r=a.createNode(e,"fd",16895,73);return r.node_ops={lookup:(t,n)=>{var u=+n,l=a.getStreamChecked(u),f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>l.path}};return f.parent=f,f}},r}},{},"/proc/self/fd")},createStandardStreams:()=>{s.stdin?a.createDevice("/dev","stdin",s.stdin):a.symlink("/dev/tty","/dev/stdin"),s.stdout?a.createDevice("/dev","stdout",null,s.stdout):a.symlink("/dev/tty","/dev/stdout"),s.stderr?a.createDevice("/dev","stderr",null,s.stderr):a.symlink("/dev/tty1","/dev/stderr");var e=a.open("/dev/stdin",0),r=a.open("/dev/stdout",1),t=a.open("/dev/stderr",1)},ensureErrnoError:()=>{a.ErrnoError||(a.ErrnoError=function(r,t){this.name="ErrnoError",this.node=t,this.setErrno=function(n){this.errno=n},this.setErrno(r),this.message="FS error"},a.ErrnoError.prototype=new Error,a.ErrnoError.prototype.constructor=a.ErrnoError,[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:()=>{a.ensureErrnoError(),a.nameTable=new Array(4096),a.mount(M,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:M}},init:(e,r,t)=>{a.init.initialized=!0,a.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=r||s.stdout,s.stderr=t||s.stderr,a.createStandardStreams()},quit:()=>{a.init.initialized=!1;for(var e=0;e<a.streams.length;e++){var r=a.streams[e];r&&a.close(r)}},findObject:(e,r)=>{var t=a.analyzePath(e,r);return t.exists?t.object:null},analyzePath:(e,r)=>{try{var t=a.lookupPath(e,{follow:!r});e=t.path}catch(u){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=a.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=z.basename(e),t=a.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(u){n.error=u.errno}return n},createPath:(e,r,t,n)=>{e=typeof e=="string"?e:a.getPath(e);for(var u=r.split("/").reverse();u.length;){var l=u.pop();if(l){var f=z.join2(e,l);try{a.mkdir(f)}catch(d){}e=f}}return f},createFile:(e,r,t,n,u)=>{var l=z.join2(typeof e=="string"?e:a.getPath(e),r),f=Sr(n,u);return a.create(l,f)},createDataFile:(e,r,t,n,u,l)=>{var f=r;e&&(e=typeof e=="string"?e:a.getPath(e),f=r?z.join2(e,r):e);var d=Sr(n,u),g=a.create(f,d);if(t){if(typeof t=="string"){for(var h=new Array(t.length),A=0,O=t.length;A<O;++A)h[A]=t.charCodeAt(A);t=h}a.chmod(g,d|146);var R=a.open(g,577);a.write(R,t,0,t.length,0,l),a.close(R),a.chmod(g,d)}return g},createDevice:(e,r,t,n)=>{var u=z.join2(typeof e=="string"?e:a.getPath(e),r),l=Sr(!!t,!!n);a.createDevice.major||(a.createDevice.major=64);var f=a.makedev(a.createDevice.major++,0);return a.registerDevice(f,{open:d=>{d.seekable=!1},close:d=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(d,g,h,A,O)=>{for(var R=0,S=0;S<A;S++){var F;try{F=t()}catch(Z){throw new a.ErrnoError(29)}if(F===void 0&&R===0)throw new a.ErrnoError(6);if(F==null)break;R++,g[h+S]=F}return R&&(d.node.timestamp=Date.now()),R},write:(d,g,h,A,O)=>{for(var R=0;R<A;R++)try{n(g[h+R])}catch(S){throw new a.ErrnoError(29)}return A&&(d.node.timestamp=Date.now()),R}}),a.mkdev(u,l,f)},forceLoadFile:e=>{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest!="undefined")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(ke)try{e.contents=Se(ke(e.url),!0),e.usedBytes=e.contents.length}catch(r){throw new a.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:(e,r,t,n,u)=>{function l(){this.lengthKnown=!1,this.chunks=[]}if(l.prototype.get=function(S){if(!(S>this.length-1||S<0)){var F=S%this.chunkSize,Z=S/this.chunkSize|0;return this.getter(Z)[F]}},l.prototype.setDataGetter=function(S){this.getter=S},l.prototype.cacheLength=function(){var S=new XMLHttpRequest;if(S.open("HEAD",t,!1),S.send(null),!(S.status>=200&&S.status<300||S.status===304))throw new Error("Couldn't load "+t+". Status: "+S.status);var F=Number(S.getResponseHeader("Content-length")),Z,re=(Z=S.getResponseHeader("Accept-Ranges"))&&Z==="bytes",se=(Z=S.getResponseHeader("Content-Encoding"))&&Z==="gzip",be=1024*1024;re||(be=F);var ie=(Ae,nr)=>{if(Ae>nr)throw new Error("invalid range ("+Ae+", "+nr+") or no bytes requested!");if(nr>F-1)throw new Error("only "+F+" bytes available! programmer error!");var ue=new XMLHttpRequest;if(ue.open("GET",t,!1),F!==be&&ue.setRequestHeader("Range","bytes="+Ae+"-"+nr),ue.responseType="arraybuffer",ue.overrideMimeType&&ue.overrideMimeType("text/plain; charset=x-user-defined"),ue.send(null),!(ue.status>=200&&ue.status<300||ue.status===304))throw new Error("Couldn't load "+t+". Status: "+ue.status);return ue.response!==void 0?new Uint8Array(ue.response||[]):Se(ue.responseText||"",!0)},_r=this;_r.setDataGetter(Ae=>{var nr=Ae*be,ue=(Ae+1)*be-1;if(ue=Math.min(ue,F-1),typeof _r.chunks[Ae]=="undefined"&&(_r.chunks[Ae]=ie(nr,ue)),typeof _r.chunks[Ae]=="undefined")throw new Error("doXHR failed!");return _r.chunks[Ae]}),(se||!F)&&(be=F=1,F=this.getter(0).length,be=F,lr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=F,this._chunkSize=be,this.lengthKnown=!0},typeof XMLHttpRequest!="undefined"){if(!L)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var f=new l;Object.defineProperties(f,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var d={isDevice:!1,contents:f}}else var d={isDevice:!1,url:t};var g=a.createFile(e,r,d,n,u);d.contents?g.contents=d.contents:d.url&&(g.contents=null,g.url=d.url),Object.defineProperties(g,{usedBytes:{get:function(){return this.contents.length}}});var h={},A=Object.keys(g.stream_ops);A.forEach(R=>{var S=g.stream_ops[R];h[R]=function(){return a.forceLoadFile(g),S.apply(null,arguments)}});function O(R,S,F,Z,re){var se=R.node.contents;if(re>=se.length)return 0;var be=Math.min(se.length-re,Z);if(se.slice)for(var ie=0;ie<be;ie++)S[F+ie]=se[re+ie];else for(var ie=0;ie<be;ie++)S[F+ie]=se.get(re+ie);return be}return h.read=(R,S,F,Z,re)=>(a.forceLoadFile(g),O(R,S,F,Z,re)),h.mmap=(R,S,F,Z,re)=>{a.forceLoadFile(g);var se=_t(S);if(!se)throw new a.ErrnoError(48);return O(R,J,se,S,F),{ptr:se,allocated:!0}},g.stream_ops=h,g}},Pt=(e,r)=>e?Ye(oe,e,r):"",te={DEFAULT_POLLMASK:5,calculateAt:function(e,r,t){if(z.isAbs(r))return r;var n;if(e===-100)n=a.cwd();else{var u=te.getStreamFromFD(e);n=u.path}if(r.length==0){if(!t)throw new a.ErrnoError(44);return n}return z.join2(n,r)},doStat:function(e,r,t){try{var n=e(r)}catch(d){if(d&&d.node&&z.normalize(r)!==z.normalize(a.getPath(d.node)))return-54;throw d}U[t>>2]=n.dev,U[t+4>>2]=n.mode,X[t+8>>2]=n.nlink,U[t+12>>2]=n.uid,U[t+16>>2]=n.gid,U[t+20>>2]=n.rdev,Q=[n.size>>>0,(x=n.size,+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[t+24>>2]=Q[0],U[t+28>>2]=Q[1],U[t+32>>2]=4096,U[t+36>>2]=n.blocks;var u=n.atime.getTime(),l=n.mtime.getTime(),f=n.ctime.getTime();return Q=[Math.floor(u/1e3)>>>0,(x=Math.floor(u/1e3),+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[t+40>>2]=Q[0],U[t+44>>2]=Q[1],X[t+48>>2]=u%1e3*1e3,Q=[Math.floor(l/1e3)>>>0,(x=Math.floor(l/1e3),+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[t+56>>2]=Q[0],U[t+60>>2]=Q[1],X[t+64>>2]=l%1e3*1e3,Q=[Math.floor(f/1e3)>>>0,(x=Math.floor(f/1e3),+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[t+72>>2]=Q[0],U[t+76>>2]=Q[1],X[t+80>>2]=f%1e3*1e3,Q=[n.ino>>>0,(x=n.ino,+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[t+88>>2]=Q[0],U[t+92>>2]=Q[1],0},doMsync:function(e,r,t,n,u){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(n&2)return 0;var l=oe.slice(e,e+t);a.msync(r,l,u,t,n)},varargs:void 0,get(){te.varargs+=4;var e=U[te.varargs-4>>2];return e},getStr(e){var r=Pt(e);return r},getStreamFromFD:function(e){var r=a.getStreamChecked(e);return r}};function Kr(e,r,t){te.varargs=t;try{var n=te.getStreamFromFD(e);switch(r){case 0:{var u=te.get();if(u<0)return-28;var l;return l=a.createStream(n,u),l.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var u=te.get();return n.flags|=u,0}case 5:{var u=te.get(),f=0;return Te[u+f>>1]=2,0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:return he(28),-1;default:return-28}}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return-d.errno}}function pr(e,r,t,n){te.varargs=n;try{r=te.getStr(r),r=te.calculateAt(e,r);var u=n?te.get():0;return a.open(r,t,u).fd}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return-l.errno}}function Pn(e,r,t,n,u){}function Jr(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${e}`)}}function mr(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);St=e}var St=void 0;function ve(e){for(var r="",t=e;oe[t];)r+=St[oe[t++]];return r}var $e={},Qe={},He={},cr=void 0;function q(e){throw new cr(e)}var Ct=void 0;function Cr(e){throw new Ct(e)}function hr(e,r,t){e.forEach(function(d){He[d]=r});function n(d){var g=t(d);g.length!==e.length&&Cr("Mismatched type converter count");for(var h=0;h<e.length;++h)Ie(e[h],g[h])}var u=new Array(r.length),l=[],f=0;r.forEach((d,g)=>{Qe.hasOwnProperty(d)?u[g]=Qe[d]:(l.push(d),$e.hasOwnProperty(d)||($e[d]=[]),$e[d].push(()=>{u[g]=Qe[d],++f,f===l.length&&n(u)}))}),l.length===0&&n(u)}function Be(e,r,t={}){var n=r.name;if(e||q(`type "${n}" must have a positive integer typeid pointer`),Qe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;q(`Cannot register type '${n}' twice`)}if(Qe[e]=r,delete He[e],$e.hasOwnProperty(e)){var u=$e[e];delete $e[e],u.forEach(l=>l())}}function Ie(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Be(e,r,t)}function Sn(e,r,t,n,u){var l=Jr(t);r=ve(r),Ie(e,{name:r,fromWireType:function(f){return!!f},toWireType:function(f,d){return d?n:u},argPackAdvance:8,readValueFromPointer:function(f){var d;if(t===1)d=J;else if(t===2)d=Te;else if(t===4)d=U;else throw new TypeError("Unknown boolean type size: "+r);return this.fromWireType(d[f>>l])},destructorFunction:null})}function Ar(e){if(!(this instanceof Ue)||!(e instanceof Ue))return!1;for(var r=this.$$.ptrType.registeredClass,t=this.$$.ptr,n=e.$$.ptrType.registeredClass,u=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)u=n.upcast(u),n=n.baseClass;return r===n&&t===u}function Yr(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function kr(e){function r(t){return t.$$.ptrType.registeredClass.name}q(r(e)+" instance already deleted")}var Zr=!1;function At(e){}function Qr(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function kt(e){e.count.value-=1;var r=e.count.value===0;r&&Qr(e)}function Dt(e,r,t){if(r===t)return e;if(t.baseClass===void 0)return null;var n=Dt(e,r,t.baseClass);return n===null?null:t.downcast(n)}var Rt={};function Dr(){return Object.keys(yr).length}function Cn(){var e=[];for(var r in yr)yr.hasOwnProperty(r)&&e.push(yr[r]);return e}var vr=[];function et(){for(;vr.length;){var e=vr.pop();e.$$.deleteScheduled=!1,e.delete()}}var gr=void 0;function Oe(e){gr=e,vr.length&&gr&&gr(et)}function An(){s.getInheritedInstanceCount=Dr,s.getLiveInheritedInstances=Cn,s.flushPendingDeletes=et,s.setDelayFunction=Oe}var yr={};function Rr(e,r){for(r===void 0&&q("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r}function $t(e,r){return r=Rr(e,r),yr[r]}function $r(e,r){(!r.ptrType||!r.ptr)&&Cr("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Cr("Both smartPtrType and smartPtr must be specified"),r.count={value:1},De(Object.create(e,{$$:{value:r}}))}function kn(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=$t(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function u(){return this.isSmartPointer?$r(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):$r(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var l=this.registeredClass.getActualType(r),f=Rt[l];if(!f)return u.call(this);var d;this.isConst?d=f.constPointerType:d=f.pointerType;var g=Dt(r,this.registeredClass,d.registeredClass);return g===null?u.call(this):this.isSmartPointer?$r(d.registeredClass.instancePrototype,{ptrType:d,ptr:g,smartPtrType:this,smartPtr:e}):$r(d.registeredClass.instancePrototype,{ptrType:d,ptr:g})}var De=function(e){return typeof FinalizationRegistry=="undefined"?(De=r=>r,e):(Zr=new FinalizationRegistry(r=>{kt(r.$$)}),De=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var u={$$:t};Zr.register(r,u,r)}return r},At=r=>Zr.unregister(r),De(e))};function Dn(){if(this.$$.ptr||kr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=De(Object.create(Object.getPrototypeOf(this),{$$:{value:Yr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function It(){this.$$.ptr||kr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&q("Object already scheduled for deletion"),At(this),kt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ot(){return!this.$$.ptr}function rt(){return this.$$.ptr||kr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&q("Object already scheduled for deletion"),vr.push(this),vr.length===1&&gr&&gr(et),this.$$.deleteScheduled=!0,this}function Rn(){Ue.prototype.isAliasOf=Ar,Ue.prototype.clone=Dn,Ue.prototype.delete=It,Ue.prototype.isDeleted=Ot,Ue.prototype.deleteLater=rt}function Ue(){}var $n=48,Ut=57;function br(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=$n&&r<=Ut?`_${e}`:e}function tt(e,r){return e=br(e),{[e]:function(){return r.apply(this,arguments)}}[e]}function xt(e,r,t){if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||q(`Function '${t}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}}function In(e,r,t){s.hasOwnProperty(e)?((t===void 0||s[e].overloadTable!==void 0&&s[e].overloadTable[t]!==void 0)&&q(`Cannot register public name '${e}' twice`),xt(s,e,e),s.hasOwnProperty(t)&&q(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),s[e].overloadTable[t]=r):(s[e]=r,t!==void 0&&(s[e].numArguments=t))}function Ft(e,r,t,n,u,l,f,d){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=u,this.getActualType=l,this.upcast=f,this.downcast=d,this.pureVirtualFunctions=[]}function ge(e,r,t){for(;r!==t;)r.upcast||q(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e}function Nt(e,r){if(r===null)return this.isReference&&q(`null is not a valid ${this.name}`),0;r.$$||q(`Cannot pass "${at(r)}" as a ${this.name}`),r.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=ge(r.$$.ptr,t,this.registeredClass);return n}function On(e,r){var t;if(r===null)return this.isReference&&q(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;r.$$||q(`Cannot pass "${at(r)}" as a ${this.name}`),r.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&q(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=ge(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&q("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:q(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var u=r.clone();t=this.rawShare(t,Or.toHandle(function(){u.delete()})),e!==null&&e.push(this.rawDestructor,t)}break;default:q("Unsupporting sharing policy")}return t}function Un(e,r){if(r===null)return this.isReference&&q(`null is not a valid ${this.name}`),0;r.$$||q(`Cannot pass "${at(r)}" as a ${this.name}`),r.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&q(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=ge(r.$$.ptr,t,this.registeredClass);return n}function er(e){return this.fromWireType(U[e>>2])}function xn(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function nt(e){this.rawDestructor&&this.rawDestructor(e)}function Fn(e){e!==null&&e.delete()}function Nn(){xe.prototype.getPointee=xn,xe.prototype.destructor=nt,xe.prototype.argPackAdvance=8,xe.prototype.readValueFromPointer=er,xe.prototype.deleteObject=Fn,xe.prototype.fromWireType=kn}function xe(e,r,t,n,u,l,f,d,g,h,A){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=u,this.pointeeType=l,this.sharingPolicy=f,this.rawGetPointee=d,this.rawConstructor=g,this.rawShare=h,this.rawDestructor=A,!u&&r.baseClass===void 0?n?(this.toWireType=Nt,this.destructorFunction=null):(this.toWireType=Un,this.destructorFunction=null):this.toWireType=On}function Mn(e,r,t){s.hasOwnProperty(e)||Cr("Replacing nonexistant public symbol"),s[e].overloadTable!==void 0&&t!==void 0?s[e].overloadTable[t]=r:(s[e]=r,s[e].argCount=t)}var Ln=(e,r,t)=>{var n=s["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)},Ir=[],Mt=e=>{var r=Ir[e];return r||(e>=Ir.length&&(Ir.length=e+1),Ir[e]=r=Wr.get(e)),r},Wn=(e,r,t)=>{if(e.includes("j"))return Ln(e,r,t);var n=Mt(r).apply(null,t);return n},Lt=(e,r)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),Wn(e,r,t)}};function rr(e,r){e=ve(e);function t(){return e.includes("j")?Lt(e,r):Mt(r)}var n=t();return typeof n!="function"&&q(`unknown function pointer with signature ${e}: ${r}`),n}function Wt(e,r){var t=tt(r,function(n){this.name=r,this.message=n;var u=new Error(n).stack;u!==void 0&&(this.stack=this.toString()+`
|
|
4
|
-
`+u.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t}var Ht=void 0;function
|
|
5
|
-
return function ${
|
|
3
|
+
`)),!e)return null;ur=Ae(e,!0)}return ur.shift()},Be={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){Be.ttys[e]={input:[],output:[],ops:r},a.registerDevice(e,Be.stream_ops)},stream_ops:{open:function(e){var r=Be.ttys[e.node.rdev];if(!r)throw new a.ErrnoError(43);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.fsync(e.tty)},fsync:function(e){e.tty.ops.fsync(e.tty)},read:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var l=0,f=0;f<n;f++){var d;try{d=e.tty.ops.get_char(e.tty)}catch(y){throw new a.ErrnoError(29)}if(d===void 0&&l===0)throw new a.ErrnoError(6);if(d==null)break;l++,r[t+f]=d}return l&&(e.node.timestamp=Date.now()),l},write:function(e,r,t,n,u){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var l=0;l<n;l++)e.tty.ops.put_char(e.tty,r[t+l])}catch(f){throw new a.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),l}},default_tty_ops:{get_char:function(e){return wn()},put_char:function(e,r){r===null||r===10?(lr(Je(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync:function(e){e.output&&e.output.length>0&&(lr(Je(e.output,0)),e.output=[])},ioctl_tcgets:function(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[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]}},ioctl_tcsets:function(e,r,t){return 0},ioctl_tiocgwinsz:function(e){return[24,80]}},default_tty1_ops:{put_char:function(e,r){r===null||r===10?(ae(Je(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync:function(e){e.output&&e.output.length>0&&(ae(Je(e.output,0)),e.output=[])}}},Tt=e=>{Fe()},M={ops_table:null,mount(e){return M.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(a.isBlkdev(t)||a.isFIFO(t))throw new a.ErrnoError(63);M.ops_table||(M.ops_table={dir:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr,lookup:M.node_ops.lookup,mknod:M.node_ops.mknod,rename:M.node_ops.rename,unlink:M.node_ops.unlink,rmdir:M.node_ops.rmdir,readdir:M.node_ops.readdir,symlink:M.node_ops.symlink},stream:{llseek:M.stream_ops.llseek}},file:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr},stream:{llseek:M.stream_ops.llseek,read:M.stream_ops.read,write:M.stream_ops.write,allocate:M.stream_ops.allocate,mmap:M.stream_ops.mmap,msync:M.stream_ops.msync}},link:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr,readlink:M.node_ops.readlink},stream:{}},chrdev:{node:{getattr:M.node_ops.getattr,setattr:M.node_ops.setattr},stream:a.chrdev_stream_ops}});var u=a.createNode(e,r,t,n);return a.isDir(u.mode)?(u.node_ops=M.ops_table.dir.node,u.stream_ops=M.ops_table.dir.stream,u.contents={}):a.isFile(u.mode)?(u.node_ops=M.ops_table.file.node,u.stream_ops=M.ops_table.file.stream,u.usedBytes=0,u.contents=null):a.isLink(u.mode)?(u.node_ops=M.ops_table.link.node,u.stream_ops=M.ops_table.link.stream):a.isChrdev(u.mode)&&(u.node_ops=M.ops_table.chrdev.node,u.stream_ops=M.ops_table.chrdev.stream),u.timestamp=Date.now(),e&&(e.contents[r]=u,e.timestamp=u.timestamp),u},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var u=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(u.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=a.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,a.isDir(e.mode)?r.size=4096:a.isFile(e.mode)?r.size=e.usedBytes:a.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&M.resizeFileStorage(e,r.size)},lookup(e,r){throw a.genericErrors[44]},mknod(e,r,t,n){return M.createNode(e,r,t,n)},rename(e,r,t){if(a.isDir(e.mode)){var n;try{n=a.lookupNode(r,t)}catch(l){}if(n)for(var u in n.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=a.lookupNode(e,r);for(var n in t.contents)throw new a.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink(e,r,t){var n=M.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,u){var l=e.node.contents;if(u>=e.node.usedBytes)return 0;var f=Math.min(e.node.usedBytes-u,n);if(f>8&&l.subarray)r.set(l.subarray(u,u+f),t);else for(var d=0;d<f;d++)r[t+d]=l[u+d];return f},write(e,r,t,n,u,l){if(!n)return 0;var f=e.node;if(f.timestamp=Date.now(),r.subarray&&(!f.contents||f.contents.subarray)){if(l)return f.contents=r.subarray(t,t+n),f.usedBytes=n,n;if(f.usedBytes===0&&u===0)return f.contents=r.slice(t,t+n),f.usedBytes=n,n;if(u+n<=f.usedBytes)return f.contents.set(r.subarray(t,t+n),u),n}if(M.expandFileStorage(f,u+n),f.contents.subarray&&r.subarray)f.contents.set(r.subarray(t,t+n),u);else for(var d=0;d<n;d++)f.contents[u+d]=r[t+d];return f.usedBytes=Math.max(f.usedBytes,u+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&a.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new a.ErrnoError(28);return n},allocate(e,r,t){M.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,u){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var l,f,d=e.node.contents;if(!(u&2)&&d.buffer===Y.buffer)f=!1,l=d.byteOffset;else{if((t>0||t+r<d.length)&&(d.subarray?d=d.subarray(t,t+r):d=Array.prototype.slice.call(d,t,t+r)),f=!0,l=Tt(r),!l)throw new a.ErrnoError(48);Y.set(d,l)}return{ptr:l,allocated:f}},msync(e,r,t,n,u){return M.stream_ops.write(e,r,0,n,t,!1),0}}},Xr=(e,r,t,n)=>{var u=n?"":`al ${e}`;Me(e,l=>{Ke(l,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(l)),u&&wr(u)},l=>{if(t)t();else throw`Loading data file "${e}" failed.`}),u&&ir(u)},bt=s.preloadPlugins||[];function Sn(e,r,t,n){typeof Browser!="undefined"&&Browser.init();var u=!1;return bt.forEach(function(l){u||l.canHandle(r)&&(l.handle(e,r,t,n),u=!0)}),u}function Et(e,r,t,n,u,l,f,d,y,h){var R=r?le.resolve(G.join2(e,r)):e,x=`cp ${R}`;function D(P){function $(Z){h&&h(),d||a.createDataFile(e,r,Z,n,u,y),l&&l(),wr(x)}Sn(P,R,$,()=>{f&&f(),wr(x)})||$(P)}ir(x),typeof t=="string"?Xr(t,P=>D(P),f):D(t)}function wt(e){var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t=="undefined")throw new Error(`Unknown file open mode: ${e}`);return t}function Ar(e,r){var t=0;return e&&(t|=365),r&&(t|=146),t}var a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(e,r={})=>{if(e=le.resolve(e),!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new a.ErrnoError(32);for(var n=e.split("/").filter(x=>!!x),u=a.root,l="/",f=0;f<n.length;f++){var d=f===n.length-1;if(d&&r.parent)break;if(u=a.lookupNode(u,n[f]),l=G.join2(l,n[f]),a.isMountpoint(u)&&(!d||d&&r.follow_mount)&&(u=u.mounted.root),!d||r.follow)for(var y=0;a.isLink(u.mode);){var h=a.readlink(l);l=le.resolve(G.dirname(l),h);var R=a.lookupPath(l,{recurse_count:r.recurse_count+1});if(u=R.node,y++>40)throw new a.ErrnoError(32)}}return{path:l,node:u}},getPath:e=>{for(var r;;){if(a.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName:(e,r)=>{for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%a.nameTable.length},hashAddNode:e=>{var r=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[r],a.nameTable[r]=e},hashRemoveNode:e=>{var r=a.hashName(e.parent.id,e.name);if(a.nameTable[r]===e)a.nameTable[r]=e.name_next;else for(var t=a.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:(e,r)=>{var t=a.mayLookup(e);if(t)throw new a.ErrnoError(t,e);for(var n=a.hashName(e.id,r),u=a.nameTable[n];u;u=u.name_next){var l=u.name;if(u.parent.id===e.id&&l===r)return u}return a.lookup(e,r)},createNode:(e,r,t,n)=>{var u=new a.FSNode(e,r,t,n);return a.hashAddNode(u),u},destroyNode:e=>{a.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(e&61440)===32768,isDir:e=>(e&61440)===16384,isLink:e=>(e&61440)===40960,isChrdev:e=>(e&61440)===8192,isBlkdev:e=>(e&61440)===24576,isFIFO:e=>(e&61440)===4096,isSocket:e=>(e&49152)===49152,flagsToPermissionString:e=>{var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions:(e,r)=>a.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0,mayLookup:e=>{var r=a.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:(e,r)=>{try{var t=a.lookupNode(e,r);return 20}catch(n){}return a.nodePermissions(e,"wx")},mayDelete:(e,r,t)=>{var n;try{n=a.lookupNode(e,r)}catch(l){return l.errno}var u=a.nodePermissions(e,"wx");if(u)return u;if(t){if(!a.isDir(n.mode))return 54;if(a.isRoot(n)||a.getPath(n)===a.cwd())return 10}else if(a.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(r)!=="r"||r&512)?31:a.nodePermissions(e,a.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd:()=>{for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked:e=>{var r=a.getStream(e);if(!r)throw new a.ErrnoError(8);return r},getStream:e=>a.streams[e],createStream:(e,r=-1)=>(a.FSStream||(a.FSStream=function(){this.shared={}},a.FSStream.prototype={},Object.defineProperties(a.FSStream.prototype,{object:{get(){return this.node},set(t){this.node=t}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(t){this.shared.flags=t}},position:{get(){return this.shared.position},set(t){this.shared.position=t}}})),e=Object.assign(new a.FSStream,e),r==-1&&(r=a.nextfd()),e.fd=r,a.streams[r]=e,e),closeStream:e=>{a.streams[e]=null},chrdev_stream_ops:{open:e=>{var r=a.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice:(e,r)=>{a.devices[e]={stream_ops:r}},getDevice:e=>a.devices[e],getMounts:e=>{for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:(e,r)=>{typeof e=="function"&&(r=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&ae(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=a.getMounts(a.root.mount),n=0;function u(f){return a.syncFSRequests--,r(f)}function l(f){if(f)return l.errored?void 0:(l.errored=!0,u(f));++n>=t.length&&u(null)}t.forEach(f=>{if(!f.type.syncfs)return l(null);f.type.syncfs(f,e,l)})},mount:(e,r,t)=>{var n=t==="/",u=!t,l;if(n&&a.root)throw new a.ErrnoError(10);if(!n&&!u){var f=a.lookupPath(t,{follow_mount:!1});if(t=f.path,l=f.node,a.isMountpoint(l))throw new a.ErrnoError(10);if(!a.isDir(l.mode))throw new a.ErrnoError(54)}var d={type:e,opts:r,mountpoint:t,mounts:[]},y=e.mount(d);return y.mount=d,d.root=y,n?a.root=y:l&&(l.mounted=d,l.mount&&l.mount.mounts.push(d)),y},unmount:e=>{var r=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(r.node))throw new a.ErrnoError(28);var t=r.node,n=t.mounted,u=a.getMounts(n);Object.keys(a.nameTable).forEach(f=>{for(var d=a.nameTable[f];d;){var y=d.name_next;u.includes(d.mount)&&a.destroyNode(d),d=y}}),t.mounted=null;var l=t.mount.mounts.indexOf(n);t.mount.mounts.splice(l,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod:(e,r,t)=>{var n=a.lookupPath(e,{parent:!0}),u=n.node,l=G.basename(e);if(!l||l==="."||l==="..")throw new a.ErrnoError(28);var f=a.mayCreate(u,l);if(f)throw new a.ErrnoError(f);if(!u.node_ops.mknod)throw new a.ErrnoError(63);return u.node_ops.mknod(u,l,r,t)},create:(e,r)=>(r=r!==void 0?r:438,r&=4095,r|=32768,a.mknod(e,r,0)),mkdir:(e,r)=>(r=r!==void 0?r:511,r&=1023,r|=16384,a.mknod(e,r,0)),mkdirTree:(e,r)=>{for(var t=e.split("/"),n="",u=0;u<t.length;++u)if(t[u]){n+="/"+t[u];try{a.mkdir(n,r)}catch(l){if(l.errno!=20)throw l}}},mkdev:(e,r,t)=>(typeof t=="undefined"&&(t=r,r=438),r|=8192,a.mknod(e,r,t)),symlink:(e,r)=>{if(!le.resolve(e))throw new a.ErrnoError(44);var t=a.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var u=G.basename(r),l=a.mayCreate(n,u);if(l)throw new a.ErrnoError(l);if(!n.node_ops.symlink)throw new a.ErrnoError(63);return n.node_ops.symlink(n,u,e)},rename:(e,r)=>{var t=G.dirname(e),n=G.dirname(r),u=G.basename(e),l=G.basename(r),f,d,y;if(f=a.lookupPath(e,{parent:!0}),d=f.node,f=a.lookupPath(r,{parent:!0}),y=f.node,!d||!y)throw new a.ErrnoError(44);if(d.mount!==y.mount)throw new a.ErrnoError(75);var h=a.lookupNode(d,u),R=le.relative(e,n);if(R.charAt(0)!==".")throw new a.ErrnoError(28);if(R=le.relative(r,t),R.charAt(0)!==".")throw new a.ErrnoError(55);var x;try{x=a.lookupNode(y,l)}catch($){}if(h!==x){var D=a.isDir(h.mode),P=a.mayDelete(d,u,D);if(P)throw new a.ErrnoError(P);if(P=x?a.mayDelete(y,l,D):a.mayCreate(y,l),P)throw new a.ErrnoError(P);if(!d.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(h)||x&&a.isMountpoint(x))throw new a.ErrnoError(10);if(y!==d&&(P=a.nodePermissions(d,"w"),P))throw new a.ErrnoError(P);a.hashRemoveNode(h);try{d.node_ops.rename(h,y,l)}catch($){throw $}finally{a.hashAddNode(h)}}},rmdir:e=>{var r=a.lookupPath(e,{parent:!0}),t=r.node,n=G.basename(e),u=a.lookupNode(t,n),l=a.mayDelete(t,n,!0);if(l)throw new a.ErrnoError(l);if(!t.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(u))throw new a.ErrnoError(10);t.node_ops.rmdir(t,n),a.destroyNode(u)},readdir:e=>{var r=a.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new a.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var r=a.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new a.ErrnoError(44);var n=G.basename(e),u=a.lookupNode(t,n),l=a.mayDelete(t,n,!1);if(l)throw new a.ErrnoError(l);if(!t.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(u))throw new a.ErrnoError(10);t.node_ops.unlink(t,n),a.destroyNode(u)},readlink:e=>{var r=a.lookupPath(e),t=r.node;if(!t)throw new a.ErrnoError(44);if(!t.node_ops.readlink)throw new a.ErrnoError(28);return le.resolve(a.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,r)=>{var t=a.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.getattr)throw new a.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>a.stat(e,!0),chmod:(e,r,t)=>{var n;if(typeof e=="string"){var u=a.lookupPath(e,{follow:!t});n=u.node}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()})},lchmod:(e,r)=>{a.chmod(e,r,!0)},fchmod:(e,r)=>{var t=a.getStreamChecked(e);a.chmod(t.node,r)},chown:(e,r,t,n)=>{var u;if(typeof e=="string"){var l=a.lookupPath(e,{follow:!n});u=l.node}else u=e;if(!u.node_ops.setattr)throw new a.ErrnoError(63);u.node_ops.setattr(u,{timestamp:Date.now()})},lchown:(e,r,t)=>{a.chown(e,r,t,!0)},fchown:(e,r,t)=>{var n=a.getStreamChecked(e);a.chown(n.node,r,t)},truncate:(e,r)=>{if(r<0)throw new a.ErrnoError(28);var t;if(typeof e=="string"){var n=a.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(t.mode))throw new a.ErrnoError(31);if(!a.isFile(t.mode))throw new a.ErrnoError(28);var u=a.nodePermissions(t,"w");if(u)throw new a.ErrnoError(u);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate:(e,r)=>{var t=a.getStreamChecked(e);if((t.flags&2097155)===0)throw new a.ErrnoError(28);a.truncate(t.node,r)},utime:(e,r,t)=>{var n=a.lookupPath(e,{follow:!0}),u=n.node;u.node_ops.setattr(u,{timestamp:Math.max(r,t)})},open:(e,r,t)=>{if(e==="")throw new a.ErrnoError(44);r=typeof r=="string"?wt(r):r,t=typeof t=="undefined"?438:t,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{e=G.normalize(e);try{var u=a.lookupPath(e,{follow:!(r&131072)});n=u.node}catch(y){}}var l=!1;if(r&64)if(n){if(r&128)throw new a.ErrnoError(20)}else n=a.mknod(e,t,0),l=!0;if(!n)throw new a.ErrnoError(44);if(a.isChrdev(n.mode)&&(r&=-513),r&65536&&!a.isDir(n.mode))throw new a.ErrnoError(54);if(!l){var f=a.mayOpen(n,r);if(f)throw new a.ErrnoError(f)}r&512&&!l&&a.truncate(n,0),r&=-131713;var d=a.createStream({node:n,path:a.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return d.stream_ops.open&&d.stream_ops.open(d),s.logReadFiles&&!(r&1)&&(a.readFiles||(a.readFiles={}),e in a.readFiles||(a.readFiles[e]=1)),d},close:e=>{if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{a.closeStream(e.fd)}e.fd=null},isClosed:e=>e.fd===null,llseek:(e,r,t)=>{if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read:(e,r,t,n,u)=>{if(n<0||u<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var l=typeof u!="undefined";if(!l)u=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var f=e.stream_ops.read(e,r,t,n,u);return l||(e.position+=f),f},write:(e,r,t,n,u,l)=>{if(n<0||u<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var f=typeof u!="undefined";if(!f)u=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var d=e.stream_ops.write(e,r,t,n,u,l);return f||(e.position+=d),d},allocate:(e,r,t)=>{if(a.isClosed(e))throw new a.ErrnoError(8);if(r<0||t<=0)throw new a.ErrnoError(28);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(!a.isFile(e.node.mode)&&!a.isDir(e.node.mode))throw new a.ErrnoError(43);if(!e.stream_ops.allocate)throw new a.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap:(e,r,t,n,u)=>{if((n&2)!==0&&(u&2)===0&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,u)},msync:(e,r,t,n,u)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,u):0,munmap:e=>0,ioctl:(e,r,t)=>{if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile:(e,r={})=>{if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=a.open(e,r.flags),u=a.stat(e),l=u.size,f=new Uint8Array(l);return a.read(n,f,0,l,0),r.encoding==="utf8"?t=Je(f,0):r.encoding==="binary"&&(t=f),a.close(n),t},writeFile:(e,r,t={})=>{t.flags=t.flags||577;var n=a.open(e,t.flags,t.mode);if(typeof r=="string"){var u=new Uint8Array(Ze(r)+1),l=Kr(r,u,0,u.length);a.write(n,u,0,l,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))a.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");a.close(n)},cwd:()=>a.currentPath,chdir:e=>{var r=a.lookupPath(e,{follow:!0});if(r.node===null)throw new a.ErrnoError(44);if(!a.isDir(r.node.mode))throw new a.ErrnoError(54);var t=a.nodePermissions(r.node,"x");if(t)throw new a.ErrnoError(t);a.currentPath=r.path},createDefaultDirectories:()=>{a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices:()=>{a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(n,u,l,f,d)=>f}),a.mkdev("/dev/null",a.makedev(1,3)),Be.register(a.makedev(5,0),Be.default_tty_ops),Be.register(a.makedev(6,0),Be.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=fr(e).byteLength),e[--r]);a.createDevice("/dev","random",t),a.createDevice("/dev","urandom",t),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount:()=>{var r=a.createNode(e,"fd",16895,73);return r.node_ops={lookup:(t,n)=>{var u=+n,l=a.getStreamChecked(u),f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>l.path}};return f.parent=f,f}},r}},{},"/proc/self/fd")},createStandardStreams:()=>{s.stdin?a.createDevice("/dev","stdin",s.stdin):a.symlink("/dev/tty","/dev/stdin"),s.stdout?a.createDevice("/dev","stdout",null,s.stdout):a.symlink("/dev/tty","/dev/stdout"),s.stderr?a.createDevice("/dev","stderr",null,s.stderr):a.symlink("/dev/tty1","/dev/stderr");var e=a.open("/dev/stdin",0),r=a.open("/dev/stdout",1),t=a.open("/dev/stderr",1)},ensureErrnoError:()=>{a.ErrnoError||(a.ErrnoError=function(r,t){this.name="ErrnoError",this.node=t,this.setErrno=function(n){this.errno=n},this.setErrno(r),this.message="FS error"},a.ErrnoError.prototype=new Error,a.ErrnoError.prototype.constructor=a.ErrnoError,[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:()=>{a.ensureErrnoError(),a.nameTable=new Array(4096),a.mount(M,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:M}},init:(e,r,t)=>{a.init.initialized=!0,a.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=r||s.stdout,s.stderr=t||s.stderr,a.createStandardStreams()},quit:()=>{a.init.initialized=!1;for(var e=0;e<a.streams.length;e++){var r=a.streams[e];r&&a.close(r)}},findObject:(e,r)=>{var t=a.analyzePath(e,r);return t.exists?t.object:null},analyzePath:(e,r)=>{try{var t=a.lookupPath(e,{follow:!r});e=t.path}catch(u){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=a.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=G.basename(e),t=a.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(u){n.error=u.errno}return n},createPath:(e,r,t,n)=>{e=typeof e=="string"?e:a.getPath(e);for(var u=r.split("/").reverse();u.length;){var l=u.pop();if(l){var f=G.join2(e,l);try{a.mkdir(f)}catch(d){}e=f}}return f},createFile:(e,r,t,n,u)=>{var l=G.join2(typeof e=="string"?e:a.getPath(e),r),f=Ar(n,u);return a.create(l,f)},createDataFile:(e,r,t,n,u,l)=>{var f=r;e&&(e=typeof e=="string"?e:a.getPath(e),f=r?G.join2(e,r):e);var d=Ar(n,u),y=a.create(f,d);if(t){if(typeof t=="string"){for(var h=new Array(t.length),R=0,x=t.length;R<x;++R)h[R]=t.charCodeAt(R);t=h}a.chmod(y,d|146);var D=a.open(y,577);a.write(D,t,0,t.length,0,l),a.close(D),a.chmod(y,d)}return y},createDevice:(e,r,t,n)=>{var u=G.join2(typeof e=="string"?e:a.getPath(e),r),l=Ar(!!t,!!n);a.createDevice.major||(a.createDevice.major=64);var f=a.makedev(a.createDevice.major++,0);return a.registerDevice(f,{open:d=>{d.seekable=!1},close:d=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(d,y,h,R,x)=>{for(var D=0,P=0;P<R;P++){var $;try{$=t()}catch(Z){throw new a.ErrnoError(29)}if($===void 0&&D===0)throw new a.ErrnoError(6);if($==null)break;D++,y[h+P]=$}return D&&(d.node.timestamp=Date.now()),D},write:(d,y,h,R,x)=>{for(var D=0;D<R;D++)try{n(y[h+D])}catch(P){throw new a.ErrnoError(29)}return R&&(d.node.timestamp=Date.now()),D}}),a.mkdev(u,l,f)},forceLoadFile:e=>{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest!="undefined")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(Re)try{e.contents=Ae(Re(e.url),!0),e.usedBytes=e.contents.length}catch(r){throw new a.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:(e,r,t,n,u)=>{function l(){this.lengthKnown=!1,this.chunks=[]}if(l.prototype.get=function(P){if(!(P>this.length-1||P<0)){var $=P%this.chunkSize,Z=P/this.chunkSize|0;return this.getter(Z)[$]}},l.prototype.setDataGetter=function(P){this.getter=P},l.prototype.cacheLength=function(){var P=new XMLHttpRequest;if(P.open("HEAD",t,!1),P.send(null),!(P.status>=200&&P.status<300||P.status===304))throw new Error("Couldn't load "+t+". Status: "+P.status);var $=Number(P.getResponseHeader("Content-length")),Z,re=(Z=P.getResponseHeader("Accept-Ranges"))&&Z==="bytes",se=(Z=P.getResponseHeader("Content-Encoding"))&&Z==="gzip",Te=1024*1024;re||(Te=$);var oe=(Ce,nr)=>{if(Ce>nr)throw new Error("invalid range ("+Ce+", "+nr+") or no bytes requested!");if(nr>$-1)throw new Error("only "+$+" bytes available! programmer error!");var ue=new XMLHttpRequest;if(ue.open("GET",t,!1),$!==Te&&ue.setRequestHeader("Range","bytes="+Ce+"-"+nr),ue.responseType="arraybuffer",ue.overrideMimeType&&ue.overrideMimeType("text/plain; charset=x-user-defined"),ue.send(null),!(ue.status>=200&&ue.status<300||ue.status===304))throw new Error("Couldn't load "+t+". Status: "+ue.status);return ue.response!==void 0?new Uint8Array(ue.response||[]):Ae(ue.responseText||"",!0)},Tr=this;Tr.setDataGetter(Ce=>{var nr=Ce*Te,ue=(Ce+1)*Te-1;if(ue=Math.min(ue,$-1),typeof Tr.chunks[Ce]=="undefined"&&(Tr.chunks[Ce]=oe(nr,ue)),typeof Tr.chunks[Ce]=="undefined")throw new Error("doXHR failed!");return Tr.chunks[Ce]}),(se||!$)&&(Te=$=1,$=this.getter(0).length,Te=$,lr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=$,this._chunkSize=Te,this.lengthKnown=!0},typeof XMLHttpRequest!="undefined"){if(!F)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var f=new l;Object.defineProperties(f,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var d={isDevice:!1,contents:f}}else var d={isDevice:!1,url:t};var y=a.createFile(e,r,d,n,u);d.contents?y.contents=d.contents:d.url&&(y.contents=null,y.url=d.url),Object.defineProperties(y,{usedBytes:{get:function(){return this.contents.length}}});var h={},R=Object.keys(y.stream_ops);R.forEach(D=>{var P=y.stream_ops[D];h[D]=function(){return a.forceLoadFile(y),P.apply(null,arguments)}});function x(D,P,$,Z,re){var se=D.node.contents;if(re>=se.length)return 0;var Te=Math.min(se.length-re,Z);if(se.slice)for(var oe=0;oe<Te;oe++)P[$+oe]=se[re+oe];else for(var oe=0;oe<Te;oe++)P[$+oe]=se.get(re+oe);return Te}return h.read=(D,P,$,Z,re)=>(a.forceLoadFile(y),x(D,P,$,Z,re)),h.mmap=(D,P,$,Z,re)=>{a.forceLoadFile(y);var se=Tt(P);if(!se)throw new a.ErrnoError(48);return x(D,Y,se,P,$),{ptr:se,allocated:!0}},y.stream_ops=h,y}},St=(e,r)=>e?Je(ie,e,r):"",te={DEFAULT_POLLMASK:5,calculateAt:function(e,r,t){if(G.isAbs(r))return r;var n;if(e===-100)n=a.cwd();else{var u=te.getStreamFromFD(e);n=u.path}if(r.length==0){if(!t)throw new a.ErrnoError(44);return n}return G.join2(n,r)},doStat:function(e,r,t){try{var n=e(r)}catch(d){if(d&&d.node&&G.normalize(r)!==G.normalize(a.getPath(d.node)))return-54;throw d}U[t>>2]=n.dev,U[t+4>>2]=n.mode,X[t+8>>2]=n.nlink,U[t+12>>2]=n.uid,U[t+16>>2]=n.gid,U[t+20>>2]=n.rdev,Q=[n.size>>>0,(N=n.size,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+24>>2]=Q[0],U[t+28>>2]=Q[1],U[t+32>>2]=4096,U[t+36>>2]=n.blocks;var u=n.atime.getTime(),l=n.mtime.getTime(),f=n.ctime.getTime();return Q=[Math.floor(u/1e3)>>>0,(N=Math.floor(u/1e3),+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+40>>2]=Q[0],U[t+44>>2]=Q[1],X[t+48>>2]=u%1e3*1e3,Q=[Math.floor(l/1e3)>>>0,(N=Math.floor(l/1e3),+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+56>>2]=Q[0],U[t+60>>2]=Q[1],X[t+64>>2]=l%1e3*1e3,Q=[Math.floor(f/1e3)>>>0,(N=Math.floor(f/1e3),+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+72>>2]=Q[0],U[t+76>>2]=Q[1],X[t+80>>2]=f%1e3*1e3,Q=[n.ino>>>0,(N=n.ino,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[t+88>>2]=Q[0],U[t+92>>2]=Q[1],0},doMsync:function(e,r,t,n,u){if(!a.isFile(r.node.mode))throw new a.ErrnoError(43);if(n&2)return 0;var l=ie.slice(e,e+t);a.msync(r,l,u,t,n)},varargs:void 0,get(){te.varargs+=4;var e=U[te.varargs-4>>2];return e},getStr(e){var r=St(e);return r},getStreamFromFD:function(e){var r=a.getStreamChecked(e);return r}};function qr(e,r,t){te.varargs=t;try{var n=te.getStreamFromFD(e);switch(r){case 0:{var u=te.get();if(u<0)return-28;var l;return l=a.createStream(n,u),l.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var u=te.get();return n.flags|=u,0}case 5:{var u=te.get(),f=0;return we[u+f>>1]=2,0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:return ve(28),-1;default:return-28}}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return-d.errno}}function pr(e,r,t,n){te.varargs=n;try{r=te.getStr(r),r=te.calculateAt(e,r);var u=n?te.get():0;return a.open(r,t,u).fd}catch(l){if(typeof a=="undefined"||l.name!=="ErrnoError")throw l;return-l.errno}}function An(e,r,t,n,u){}function Yr(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${e}`)}}function mr(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);At=e}var At=void 0;function ge(e){for(var r="",t=e;ie[t];)r+=At[ie[t++]];return r}var De={},Qe={},He={},cr=void 0;function K(e){throw new cr(e)}var Pt=void 0;function Pr(e){throw new Pt(e)}function hr(e,r,t){e.forEach(function(d){He[d]=r});function n(d){var y=t(d);y.length!==e.length&&Pr("Mismatched type converter count");for(var h=0;h<e.length;++h)ke(e[h],y[h])}var u=new Array(r.length),l=[],f=0;r.forEach((d,y)=>{Qe.hasOwnProperty(d)?u[y]=Qe[d]:(l.push(d),De.hasOwnProperty(d)||(De[d]=[]),De[d].push(()=>{u[y]=Qe[d],++f,f===l.length&&n(u)}))}),l.length===0&&n(u)}function We(e,r,t={}){var n=r.name;if(e||K(`type "${n}" must have a positive integer typeid pointer`),Qe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;K(`Cannot register type '${n}' twice`)}if(Qe[e]=r,delete He[e],De.hasOwnProperty(e)){var u=De[e];delete De[e],u.forEach(l=>l())}}function ke(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return We(e,r,t)}function Pn(e,r,t,n,u){var l=Yr(t);r=ge(r),ke(e,{name:r,fromWireType:function(f){return!!f},toWireType:function(f,d){return d?n:u},argPackAdvance:8,readValueFromPointer:function(f){var d;if(t===1)d=Y;else if(t===2)d=we;else if(t===4)d=U;else throw new TypeError("Unknown boolean type size: "+r);return this.fromWireType(d[f>>l])},destructorFunction:null})}function Cr(e){if(!(this instanceof Ue)||!(e instanceof Ue))return!1;for(var r=this.$$.ptrType.registeredClass,t=this.$$.ptr,n=e.$$.ptrType.registeredClass,u=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)u=n.upcast(u),n=n.baseClass;return r===n&&t===u}function Jr(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function Rr(e){function r(t){return t.$$.ptrType.registeredClass.name}K(r(e)+" instance already deleted")}var Zr=!1;function Ct(e){}function Qr(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Rt(e){e.count.value-=1;var r=e.count.value===0;r&&Qr(e)}function It(e,r,t){if(r===t)return e;if(t.baseClass===void 0)return null;var n=It(e,r,t.baseClass);return n===null?null:t.downcast(n)}var Ot={};function Ir(){return Object.keys(yr).length}function Cn(){var e=[];for(var r in yr)yr.hasOwnProperty(r)&&e.push(yr[r]);return e}var vr=[];function et(){for(;vr.length;){var e=vr.pop();e.$$.deleteScheduled=!1,e.delete()}}var gr=void 0;function xe(e){gr=e,vr.length&&gr&&gr(et)}function Rn(){s.getInheritedInstanceCount=Ir,s.getLiveInheritedInstances=Cn,s.flushPendingDeletes=et,s.setDelayFunction=xe}var yr={};function Or(e,r){for(r===void 0&&K("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r}function Dt(e,r){return r=Or(e,r),yr[r]}function Dr(e,r){(!r.ptrType||!r.ptr)&&Pr("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Pr("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Ie(Object.create(e,{$$:{value:r}}))}function In(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=Dt(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function u(){return this.isSmartPointer?Dr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Dr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var l=this.registeredClass.getActualType(r),f=Ot[l];if(!f)return u.call(this);var d;this.isConst?d=f.constPointerType:d=f.pointerType;var y=It(r,this.registeredClass,d.registeredClass);return y===null?u.call(this):this.isSmartPointer?Dr(d.registeredClass.instancePrototype,{ptrType:d,ptr:y,smartPtrType:this,smartPtr:e}):Dr(d.registeredClass.instancePrototype,{ptrType:d,ptr:y})}var Ie=function(e){return typeof FinalizationRegistry=="undefined"?(Ie=r=>r,e):(Zr=new FinalizationRegistry(r=>{Rt(r.$$)}),Ie=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var u={$$:t};Zr.register(r,u,r)}return r},Ct=r=>Zr.unregister(r),Ie(e))};function On(){if(this.$$.ptr||Rr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ie(Object.create(Object.getPrototypeOf(this),{$$:{value:Jr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function kt(){this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&K("Object already scheduled for deletion"),Ct(this),Rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function xt(){return!this.$$.ptr}function rt(){return this.$$.ptr||Rr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&K("Object already scheduled for deletion"),vr.push(this),vr.length===1&&gr&&gr(et),this.$$.deleteScheduled=!0,this}function Dn(){Ue.prototype.isAliasOf=Cr,Ue.prototype.clone=On,Ue.prototype.delete=kt,Ue.prototype.isDeleted=xt,Ue.prototype.deleteLater=rt}function Ue(){}var kn=48,Ut=57;function _r(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=kn&&r<=Ut?`_${e}`:e}function tt(e,r){return e=_r(e),{[e]:function(){return r.apply(this,arguments)}}[e]}function Nt(e,r,t){if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||K(`Function '${t}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}}function xn(e,r,t){s.hasOwnProperty(e)?((t===void 0||s[e].overloadTable!==void 0&&s[e].overloadTable[t]!==void 0)&&K(`Cannot register public name '${e}' twice`),Nt(s,e,e),s.hasOwnProperty(t)&&K(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),s[e].overloadTable[t]=r):(s[e]=r,t!==void 0&&(s[e].numArguments=t))}function $t(e,r,t,n,u,l,f,d){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=u,this.getActualType=l,this.upcast=f,this.downcast=d,this.pureVirtualFunctions=[]}function ye(e,r,t){for(;r!==t;)r.upcast||K(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e}function Lt(e,r){if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),0;r.$$||K(`Cannot pass "${at(r)}" as a ${this.name}`),r.$$.ptr||K(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=ye(r.$$.ptr,t,this.registeredClass);return n}function Un(e,r){var t;if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;r.$$||K(`Cannot pass "${at(r)}" as a ${this.name}`),r.$$.ptr||K(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&K(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=ye(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&K("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:K(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var u=r.clone();t=this.rawShare(t,xr.toHandle(function(){u.delete()})),e!==null&&e.push(this.rawDestructor,t)}break;default:K("Unsupporting sharing policy")}return t}function Nn(e,r){if(r===null)return this.isReference&&K(`null is not a valid ${this.name}`),0;r.$$||K(`Cannot pass "${at(r)}" as a ${this.name}`),r.$$.ptr||K(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&K(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=ye(r.$$.ptr,t,this.registeredClass);return n}function er(e){return this.fromWireType(U[e>>2])}function $n(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function nt(e){this.rawDestructor&&this.rawDestructor(e)}function Ln(e){e!==null&&e.delete()}function Mn(){Ne.prototype.getPointee=$n,Ne.prototype.destructor=nt,Ne.prototype.argPackAdvance=8,Ne.prototype.readValueFromPointer=er,Ne.prototype.deleteObject=Ln,Ne.prototype.fromWireType=In}function Ne(e,r,t,n,u,l,f,d,y,h,R){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=u,this.pointeeType=l,this.sharingPolicy=f,this.rawGetPointee=d,this.rawConstructor=y,this.rawShare=h,this.rawDestructor=R,!u&&r.baseClass===void 0?n?(this.toWireType=Lt,this.destructorFunction=null):(this.toWireType=Nn,this.destructorFunction=null):this.toWireType=Un}function Fn(e,r,t){s.hasOwnProperty(e)||Pr("Replacing nonexistant public symbol"),s[e].overloadTable!==void 0&&t!==void 0?s[e].overloadTable[t]=r:(s[e]=r,s[e].argCount=t)}var Bn=(e,r,t)=>{var n=s["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)},kr=[],Mt=e=>{var r=kr[e];return r||(e>=kr.length&&(kr.length=e+1),kr[e]=r=Br.get(e)),r},Hn=(e,r,t)=>{if(e.includes("j"))return Bn(e,r,t);var n=Mt(r).apply(null,t);return n},Ft=(e,r)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),Hn(e,r,t)}};function rr(e,r){e=ge(e);function t(){return e.includes("j")?Ft(e,r):Mt(r)}var n=t();return typeof n!="function"&&K(`unknown function pointer with signature ${e}: ${r}`),n}function Bt(e,r){var t=tt(r,function(n){this.name=r,this.message=n;var u=new Error(n).stack;u!==void 0&&(this.stack=this.toString()+`
|
|
4
|
+
`+u.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t}var Ht=void 0;function ot(e){var r=vo(e),t=ge(r);return tr(r),t}function it(e,r){var t=[],n={};function u(l){if(!n[l]&&!Qe[l]){if(He[l]){He[l].forEach(u);return}t.push(l),n[l]=!0}}throw r.forEach(u),new Ht(`${e}: `+t.map(ot).join([", "]))}function Wn(e,r,t,n,u,l,f,d,y,h,R,x,D){R=ge(R),l=rr(u,l),d&&(d=rr(f,d)),h&&(h=rr(y,h)),D=rr(x,D);var P=_r(R);xn(P,function(){it(`Cannot construct ${R} due to unbound types`,[n])}),hr([e,r,t],n?[n]:[],function($){$=$[0];var Z,re;n?(Z=$.registeredClass,re=Z.instancePrototype):re=Ue.prototype;var se=tt(P,function(){if(Object.getPrototypeOf(this)!==Te)throw new cr("Use 'new' to construct "+R);if(oe.constructor_body===void 0)throw new cr(R+" has no accessible constructor");var ue=oe.constructor_body[arguments.length];if(ue===void 0)throw new cr(`Tried to invoke ctor of ${R} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(oe.constructor_body).toString()}) parameters instead!`);return ue.apply(this,arguments)}),Te=Object.create(re,{constructor:{value:se}});se.prototype=Te;var oe=new $t(R,se,Te,D,Z,l,d,h);oe.baseClass&&(oe.baseClass.__derivedClasses===void 0&&(oe.baseClass.__derivedClasses=[]),oe.baseClass.__derivedClasses.push(oe));var Tr=new Ne(R,oe,!0,!1,!1),Ce=new Ne(R+"*",oe,!1,!1,!1),nr=new Ne(R+" const*",oe,!1,!0,!1);return Ot[e]={pointerType:Ce,constPointerType:nr},Fn(P,se),[Tr,Ce,nr]})}function Wt(e,r){for(var t=[],n=0;n<e;n++)t.push(X[r+n*4>>2]);return t}function Vn(e){for(;e.length;){var r=e.pop(),t=e.pop();t(r)}}function Vt(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=tt(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,u=e.apply(n,r);return u instanceof Object?u:n}function jt(e,r,t,n,u,l){var f=r.length;f<2&&K("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var d=r[1]!==null&&t!==null,y=!1,h=1;h<r.length;++h)if(r[h]!==null&&r[h].destructorFunction===void 0){y=!0;break}for(var R=r[0].name!=="void",x="",D="",h=0;h<f-2;++h)x+=(h!==0?", ":"")+"arg"+h,D+=(h!==0?", ":"")+"arg"+h+"Wired";var P=`
|
|
5
|
+
return function ${_r(e)}(${x}) {
|
|
6
6
|
if (arguments.length !== ${f-2}) {
|
|
7
7
|
throwBindingError('function ${e} called with ${arguments.length} arguments, expected ${f-2} args!');
|
|
8
|
-
}`;
|
|
9
|
-
`);var
|
|
10
|
-
`);for(var h=0;h<f-2;++h)
|
|
11
|
-
`,Z.push("argType"+h),re.push(r[h+2]);if(d&&(
|
|
12
|
-
`,
|
|
13
|
-
`;else for(var h=d?1:2;h<r.length;++h){var se=h===1?"thisWired":"arg"+(h-2)+"Wired";r[h].destructorFunction!==null&&(
|
|
14
|
-
`,Z.push(se+"_dtor"),re.push(r[h].destructorFunction))}return
|
|
8
|
+
}`;y&&(P+=`var destructors = [];
|
|
9
|
+
`);var $=y?"destructors":"null",Z=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],re=[K,n,u,Vn,r[0],r[1]];d&&(P+="var thisWired = classParam.toWireType("+$+`, this);
|
|
10
|
+
`);for(var h=0;h<f-2;++h)P+="var arg"+h+"Wired = argType"+h+".toWireType("+$+", arg"+h+"); // "+r[h+2].name+`
|
|
11
|
+
`,Z.push("argType"+h),re.push(r[h+2]);if(d&&(D="thisWired"+(D.length>0?", ":"")+D),P+=(R||l?"var rv = ":"")+"invoker(fn"+(D.length>0?", ":"")+D+`);
|
|
12
|
+
`,y)P+=`runDestructors(destructors);
|
|
13
|
+
`;else for(var h=d?1:2;h<r.length;++h){var se=h===1?"thisWired":"arg"+(h-2)+"Wired";r[h].destructorFunction!==null&&(P+=se+"_dtor("+se+"); // "+r[h].name+`
|
|
14
|
+
`,Z.push(se+"_dtor"),re.push(r[h].destructorFunction))}return R&&(P+=`var ret = retType.fromWireType(rv);
|
|
15
15
|
return ret;
|
|
16
|
-
`),
|
|
17
|
-
`,Z.push(
|
|
18
|
-
`,
|
|
19
|
-
`,
|
|
20
|
-
`;for(var h=0;h<e-1;++h)t[h+1].deleteObject&&(
|
|
21
|
-
`);n.isVoid||(
|
|
22
|
-
`),
|
|
23
|
-
`,f.push(O);var S=Vt(Function,f).apply(null,d);return l=Yt(S),c[u]=l,l}function v(e,r){return r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN}var w=()=>{Le("")};function T(){return Date.now()}var _=()=>oe.length,k=()=>_(),E=(e,r,t)=>oe.copyWithin(e,r,r+t),W=e=>{Le("OOM")},B=e=>{var r=oe.length;e>>>=0,W(e)},V={},Y=()=>j||"./this.program",ne=()=>{if(!ne.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Y()};for(var t in V)V[t]===void 0?delete r[t]:r[t]=V[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);ne.strings=n}return ne.strings},Ee=(e,r)=>{for(var t=0;t<e.length;++t)J[r++>>0]=e.charCodeAt(t);J[r>>0]=0},de=(e,r)=>{var t=0;return ne().forEach(function(n,u){var l=r+t;X[e+u*4>>2]=l,Ee(n,l),t+=n.length+1}),0},Ve=(e,r)=>{var t=ne();X[e>>2]=t.length;var n=0;return t.forEach(function(u){n+=u.length+1}),X[r>>2]=n,0};function lt(e){try{var r=te.getStreamFromFD(e);return a.close(r),0}catch(t){if(typeof a=="undefined"||t.name!=="ErrnoError")throw t;return t.errno}}function Ce(e,r){try{var t=0,n=0,u=0,l=te.getStreamFromFD(e),f=l.tty?2:a.isDir(l.mode)?3:a.isLink(l.mode)?7:4;return J[r>>0]=f,Te[r+2>>1]=u,Q=[t>>>0,(x=t,+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[r+8>>2]=Q[0],U[r+12>>2]=Q[1],Q=[n>>>0,(x=n,+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[r+16>>2]=Q[0],U[r+20>>2]=Q[1],0}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return d.errno}}var oi=(e,r,t,n)=>{for(var u=0,l=0;l<t;l++){var f=X[r>>2],d=X[r+4>>2];r+=8;var g=a.read(e,J,f,d,n);if(g<0)return-1;if(u+=g,g<d)break;typeof n!="undefined"&&(n+=g)}return u};function Zt(e,r,t,n){try{var u=te.getStreamFromFD(e),l=oi(u,r,t);return X[n>>2]=l,0}catch(f){if(typeof a=="undefined"||f.name!=="ErrnoError")throw f;return f.errno}}function Qt(e,r,t,n,u){var l=v(r,t);try{if(isNaN(l))return 61;var f=te.getStreamFromFD(e);return a.llseek(f,l,n),Q=[f.position>>>0,(x=f.position,+Math.abs(x)>=1?x>0?+Math.floor(x/4294967296)>>>0:~~+Math.ceil((x-+(~~x>>>0))/4294967296)>>>0:0)],U[u>>2]=Q[0],U[u+4>>2]=Q[1],f.getdents&&l===0&&n===0&&(f.getdents=null),0}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return d.errno}}var en=(e,r,t,n)=>{for(var u=0,l=0;l<t;l++){var f=X[r>>2],d=X[r+4>>2];r+=8;var g=a.write(e,J,f,d,n);if(g<0)return-1;u+=g,typeof n!="undefined"&&(n+=g)}return u};function ki(e,r,t,n){try{var u=te.getStreamFromFD(e),l=en(u,r,t);return X[n>>2]=l,0}catch(f){if(typeof a=="undefined"||f.name!=="ErrnoError")throw f;return f.errno}}var di=function(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},rn=365,tn=146;Object.defineProperties(di.prototype,{read:{get:function(){return(this.mode&rn)===rn},set:function(e){e?this.mode|=rn:this.mode&=~rn}},write:{get:function(){return(this.mode&tn)===tn},set:function(e){e?this.mode|=tn:this.mode&=~tn}},isFolder:{get:function(){return a.isDir(this.mode)}},isDevice:{get:function(){return a.isChrdev(this.mode)}}}),a.FSNode=di,a.createPreloadedFile=Et,a.staticInit(),mr(),cr=s.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Ct=s.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Rn(),An(),Nn(),Ht=s.UnboundTypeError=Wt(Error,"UnboundTypeError"),zn(),qn();var Di={p:bt,C:Kr,w:pr,t:Pn,n:Sn,r:Hn,q:Vn,d:jn,D:qt,k:Xt,c:Jn,b:Yn,j:Qn,f:Kt,o:ni,g:Ur,m:Gt,l:m,a:w,e:T,v:k,A:E,u:B,y:de,z:Ve,i:lt,x:Ce,B:Zt,s:Qt,h:ki},Qi=bn(),Ri=()=>(Ri=ee.F)(),ai=e=>(ai=ee.G)(e),tr=e=>(tr=ee.I)(e),fi=()=>(fi=ee.J)(),pi=e=>(pi=ee.K)(e),$i=s.__embind_initialize_bindings=()=>($i=s.__embind_initialize_bindings=ee.L)(),mi=e=>(mi=ee.M)(e),Ii=s.dynCall_jiji=(e,r,t,n,u)=>(Ii=s.dynCall_jiji=ee.N)(e,r,t,n,u),eo=s._ff_h264_cabac_tables=67061,nn;dr=function e(){nn||hi(),nn||(dr=e)};function hi(){if(Re>0||(pn(),Re>0))return;function e(){nn||(nn=!0,s.calledRun=!0,!Mr&&(mn(),b(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),hn()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),e()},1)):e()}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return hi(),p.ready}})(),Si=Ki;var sn=class extends ze{constructor(p){super(Si,p!=null&&p.wasmPath?fetch(p==null?void 0:p.wasmPath).then(s=>s.arrayBuffer()):void 0,p==null?void 0:p.workerMode,p==null?void 0:p.canvas,p==null?void 0:p.yuvMode)}};var Ji=(()=>{var y=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,b,P;s.ready=new Promise((i,o)=>{b=i,P=o});var D=Object.assign({},s),$=[],j="./this.program",I=(i,o)=>{throw o},C=typeof window=="object",L=typeof importScripts=="function",N=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",H="";function pe(i){return s.locateFile?s.locateFile(i,H):H+i}var ke,Me,K,Ge;(C||L)&&(L?H=self.location.href:typeof document!="undefined"&&document.currentScript&&(H=document.currentScript.src),y&&(H=y),H.indexOf("blob:")!==0?H=H.substr(0,H.replace(/[?#].*/,"").lastIndexOf("/")+1):H="",ke=i=>{var o=new XMLHttpRequest;return o.open("GET",i,!1),o.send(null),o.responseText},L&&(K=i=>{var o=new XMLHttpRequest;return o.open("GET",i,!1),o.responseType="arraybuffer",o.send(null),new Uint8Array(o.response)}),Me=(i,o,c)=>{var m=new XMLHttpRequest;m.open("GET",i,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){o(m.response);return}c()},m.onerror=c,m.send(null)},Ge=i=>document.title=i);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,D),D=null,s.arguments&&($=s.arguments),s.thisProgram&&(j=s.thisProgram),s.quit&&(I=s.quit);var me;s.wasmBinary&&(me=s.wasmBinary);var Ai=s.noExitRuntime||!0;typeof WebAssembly!="object"&&or("no native wasm support detected");var Nr,ee,Mr=!1,dn,qe,J,oe,Te,Pe,U,X,Lr;function ht(){var i=Nr.buffer;s.HEAP8=qe=new Int8Array(i),s.HEAP16=oe=new Int16Array(i),s.HEAP32=Pe=new Int32Array(i),s.HEAPU8=J=new Uint8Array(i),s.HEAPU16=Te=new Uint16Array(i),s.HEAPU32=U=new Uint32Array(i),s.HEAPF32=X=new Float32Array(i),s.HEAPF64=Lr=new Float64Array(i)}var vt,Wr=[],Hr=[],Br=[],gt=!1;function fn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)hn(s.preRun.shift());zr(Wr)}function pn(){gt=!0,zr(Hr)}function mn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)gn(s.postRun.shift());zr(Br)}function hn(i){Wr.unshift(i)}function vn(i){Hr.unshift(i)}function gn(i){Br.unshift(i)}var Xe=0,Re=null,Ke=null;function dr(i){Xe++,s.monitorRunDependencies&&s.monitorRunDependencies(Xe)}function ci(i){if(Xe--,s.monitorRunDependencies&&s.monitorRunDependencies(Xe),Xe==0&&(Re!==null&&(clearInterval(Re),Re=null),Ke)){var o=Ke;Ke=null,o()}}function or(i){s.onAbort&&s.onAbort(i),i="Aborted("+i+")",ae(i),Mr=!0,dn=1,i+=". Build with -sASSERTIONS for more info.";var o=new WebAssembly.RuntimeError(i);throw P(o),o}var Tr="data:application/octet-stream;base64,";function Le(i){return i.startsWith(Tr)}var ar;ar="videodec_simd.wasm",Le(ar)||(ar=pe(ar));function Vr(i){if(i==ar&&me)return new Uint8Array(me);if(K)return K(i);throw"both async and sync fetching of the wasm failed"}function sr(i){return!me&&(C||L)&&typeof fetch=="function"?fetch(i,{credentials:"same-origin"}).then(o=>{if(!o.ok)throw"failed to load wasm binary file at '"+i+"'";return o.arrayBuffer()}).catch(()=>Vr(i)):Promise.resolve().then(()=>Vr(i))}function jr(i,o,c){return sr(i).then(m=>WebAssembly.instantiate(m,o)).then(m=>m).then(c,m=>{ae("failed to asynchronously prepare wasm: "+m),or(m)})}function yn(i,o,c,m){return!i&&typeof WebAssembly.instantiateStreaming=="function"&&!Le(o)&&typeof fetch=="function"?fetch(o,{credentials:"same-origin"}).then(v=>{var w=WebAssembly.instantiateStreaming(v,c);return w.then(m,function(T){return ae("wasm streaming compile failed: "+T),ae("falling back to ArrayBuffer instantiation"),jr(o,c,m)})}):jr(o,c,m)}function yt(){var i={a:ri};function o(m,v){var w=m.exports;return ee=w,Nr=ee.v,ht(),vt=ee.z,vn(ee.w),ci("wasm-instantiate"),w}dr("wasm-instantiate");function c(m){o(m.instance)}if(s.instantiateWasm)try{return s.instantiateWasm(i,o)}catch(m){ae("Module.instantiateWasm callback failed with error: "+m),P(m)}return yn(me,ar,i,c).catch(P),{}}var zr=i=>{for(;i.length>0;)i.shift()(s)};function bn(i){this.excPtr=i,this.ptr=i-24,this.set_type=function(o){U[this.ptr+4>>2]=o},this.get_type=function(){return U[this.ptr+4>>2]},this.set_destructor=function(o){U[this.ptr+8>>2]=o},this.get_destructor=function(){return U[this.ptr+8>>2]},this.set_caught=function(o){o=o?1:0,qe[this.ptr+12>>0]=o},this.get_caught=function(){return qe[this.ptr+12>>0]!=0},this.set_rethrown=function(o){o=o?1:0,qe[this.ptr+13>>0]=o},this.get_rethrown=function(){return qe[this.ptr+13>>0]!=0},this.init=function(o,c){this.set_adjusted_ptr(0),this.set_type(o),this.set_destructor(c)},this.set_adjusted_ptr=function(o){U[this.ptr+16>>2]=o},this.get_adjusted_ptr=function(){return U[this.ptr+16>>2]},this.get_exception_ptr=function(){var o=Jt(this.get_type());if(o)return U[this.excPtr>>2];var c=this.get_adjusted_ptr();return c!==0?c:this.excPtr}}var x=0,Q=0;function Gr(i,o,c){var m=new bn(i);throw m.init(o,c),x=i,Q++,x}function _n(i,o,c,m,v){}function Pr(i){switch(i){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${i}`)}}function wn(){for(var i=new Array(256),o=0;o<256;++o)i[o]=String.fromCharCode(o);bt=i}var bt=void 0;function he(i){for(var o="",c=i;J[c];)o+=bt[J[c++]];return o}var z={},Je={},fr={},le=void 0;function G(i){throw new le(i)}var Ye=void 0;function ur(i){throw new Ye(i)}function Ze(i,o,c){i.forEach(function(_){fr[_]=o});function m(_){var k=c(_);k.length!==i.length&&ur("Mismatched type converter count");for(var E=0;E<i.length;++E)Se(i[E],k[E])}var v=new Array(o.length),w=[],T=0;o.forEach((_,k)=>{Je.hasOwnProperty(_)?v[k]=Je[_]:(w.push(_),z.hasOwnProperty(_)||(z[_]=[]),z[_].push(()=>{v[k]=Je[_],++T,T===w.length&&m(v)}))}),w.length===0&&m(v)}function qr(i,o,c={}){var m=o.name;if(i||G(`type "${m}" must have a positive integer typeid pointer`),Je.hasOwnProperty(i)){if(c.ignoreDuplicateRegistrations)return;G(`Cannot register type '${m}' twice`)}if(Je[i]=o,delete fr[i],z.hasOwnProperty(i)){var v=z[i];delete z[i],v.forEach(w=>w())}}function Se(i,o,c={}){if(!("argPackAdvance"in o))throw new TypeError("registerType registeredInstance requires argPackAdvance");return qr(i,o,c)}function En(i,o,c,m,v){var w=Pr(c);o=he(o),Se(i,{name:o,fromWireType:function(T){return!!T},toWireType:function(T,_){return _?m:v},argPackAdvance:8,readValueFromPointer:function(T){var _;if(c===1)_=qe;else if(c===2)_=oe;else if(c===4)_=Pe;else throw new TypeError("Unknown boolean type size: "+o);return this.fromWireType(_[T>>w])},destructorFunction:null})}function We(i){if(!(this instanceof Be)||!(i instanceof Be))return!1;for(var o=this.$$.ptrType.registeredClass,c=this.$$.ptr,m=i.$$.ptrType.registeredClass,v=i.$$.ptr;o.baseClass;)c=o.upcast(c),o=o.baseClass;for(;m.baseClass;)v=m.upcast(v),m=m.baseClass;return o===m&&c===v}function _t(i){return{count:i.count,deleteScheduled:i.deleteScheduled,preservePointerOnDelete:i.preservePointerOnDelete,ptr:i.ptr,ptrType:i.ptrType,smartPtr:i.smartPtr,smartPtrType:i.smartPtrType}}function M(i){function o(c){return c.$$.ptrType.registeredClass.name}G(o(i)+" instance already deleted")}var Xr=!1;function wt(i){}function Tn(i){i.smartPtr?i.smartPtrType.rawDestructor(i.smartPtr):i.ptrType.registeredClass.rawDestructor(i.ptr)}function Et(i){i.count.value-=1;var o=i.count.value===0;o&&Tn(i)}function Tt(i,o,c){if(o===c)return i;if(c.baseClass===void 0)return null;var m=Tt(i,o,c.baseClass);return m===null?null:c.downcast(m)}var Sr={};function a(){return Object.keys(mr).length}function Pt(){var i=[];for(var o in mr)mr.hasOwnProperty(o)&&i.push(mr[o]);return i}var te=[];function Kr(){for(;te.length;){var i=te.pop();i.$$.deleteScheduled=!1,i.delete()}}var pr=void 0;function Pn(i){pr=i,te.length&&pr&&pr(Kr)}function Jr(){s.getInheritedInstanceCount=a,s.getLiveInheritedInstances=Pt,s.flushPendingDeletes=Kr,s.setDelayFunction=Pn}var mr={};function St(i,o){for(o===void 0&&G("ptr should not be undefined");i.baseClass;)o=i.upcast(o),i=i.baseClass;return o}function ve(i,o){return o=St(i,o),mr[o]}function $e(i,o){(!o.ptrType||!o.ptr)&&ur("makeClassHandle requires ptr and ptrType");var c=!!o.smartPtrType,m=!!o.smartPtr;return c!==m&&ur("Both smartPtrType and smartPtr must be specified"),o.count={value:1},He(Object.create(i,{$$:{value:o}}))}function Qe(i){var o=this.getPointee(i);if(!o)return this.destructor(i),null;var c=ve(this.registeredClass,o);if(c!==void 0){if(c.$$.count.value===0)return c.$$.ptr=o,c.$$.smartPtr=i,c.clone();var m=c.clone();return this.destructor(i),m}function v(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:o,smartPtrType:this,smartPtr:i}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:i})}var w=this.registeredClass.getActualType(o),T=Sr[w];if(!T)return v.call(this);var _;this.isConst?_=T.constPointerType:_=T.pointerType;var k=Tt(o,this.registeredClass,_.registeredClass);return k===null?v.call(this):this.isSmartPointer?$e(_.registeredClass.instancePrototype,{ptrType:_,ptr:k,smartPtrType:this,smartPtr:i}):$e(_.registeredClass.instancePrototype,{ptrType:_,ptr:k})}var He=function(i){return typeof FinalizationRegistry=="undefined"?(He=o=>o,i):(Xr=new FinalizationRegistry(o=>{Et(o.$$)}),He=o=>{var c=o.$$,m=!!c.smartPtr;if(m){var v={$$:c};Xr.register(o,v,o)}return o},wt=o=>Xr.unregister(o),He(i))};function cr(){if(this.$$.ptr||M(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var i=He(Object.create(Object.getPrototypeOf(this),{$$:{value:_t(this.$$)}}));return i.$$.count.value+=1,i.$$.deleteScheduled=!1,i}function q(){this.$$.ptr||M(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),wt(this),Et(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ct(){return!this.$$.ptr}function Cr(){return this.$$.ptr||M(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),te.push(this),te.length===1&&pr&&pr(Kr),this.$$.deleteScheduled=!0,this}function hr(){Be.prototype.isAliasOf=We,Be.prototype.clone=cr,Be.prototype.delete=q,Be.prototype.isDeleted=Ct,Be.prototype.deleteLater=Cr}function Be(){}var Ie=48,Sn=57;function Ar(i){if(i===void 0)return"_unknown";i=i.replace(/[^a-zA-Z0-9_]/g,"$");var o=i.charCodeAt(0);return o>=Ie&&o<=Sn?`_${i}`:i}function Yr(i,o){return i=Ar(i),{[i]:function(){return o.apply(this,arguments)}}[i]}function kr(i,o,c){if(i[o].overloadTable===void 0){var m=i[o];i[o]=function(){return i[o].overloadTable.hasOwnProperty(arguments.length)||G(`Function '${c}' called with an invalid number of arguments (${arguments.length}) - expects one of (${i[o].overloadTable})!`),i[o].overloadTable[arguments.length].apply(this,arguments)},i[o].overloadTable=[],i[o].overloadTable[m.argCount]=m}}function Zr(i,o,c){s.hasOwnProperty(i)?((c===void 0||s[i].overloadTable!==void 0&&s[i].overloadTable[c]!==void 0)&&G(`Cannot register public name '${i}' twice`),kr(s,i,i),s.hasOwnProperty(c)&&G(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`),s[i].overloadTable[c]=o):(s[i]=o,c!==void 0&&(s[i].numArguments=c))}function At(i,o,c,m,v,w,T,_){this.name=i,this.constructor=o,this.instancePrototype=c,this.rawDestructor=m,this.baseClass=v,this.getActualType=w,this.upcast=T,this.downcast=_,this.pureVirtualFunctions=[]}function Qr(i,o,c){for(;o!==c;)o.upcast||G(`Expected null or instance of ${c.name}, got an instance of ${o.name}`),i=o.upcast(i),o=o.baseClass;return i}function kt(i,o){if(o===null)return this.isReference&&G(`null is not a valid ${this.name}`),0;o.$$||G(`Cannot pass "${nt(o)}" as a ${this.name}`),o.$$.ptr||G(`Cannot pass deleted object as a pointer of type ${this.name}`);var c=o.$$.ptrType.registeredClass,m=Qr(o.$$.ptr,c,this.registeredClass);return m}function Dt(i,o){var c;if(o===null)return this.isReference&&G(`null is not a valid ${this.name}`),this.isSmartPointer?(c=this.rawConstructor(),i!==null&&i.push(this.rawDestructor,c),c):0;o.$$||G(`Cannot pass "${nt(o)}" as a ${this.name}`),o.$$.ptr||G(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&o.$$.ptrType.isConst&&G(`Cannot convert argument of type ${o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name} to parameter type ${this.name}`);var m=o.$$.ptrType.registeredClass;if(c=Qr(o.$$.ptr,m,this.registeredClass),this.isSmartPointer)switch(o.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:o.$$.smartPtrType===this?c=o.$$.smartPtr:G(`Cannot convert argument of type ${o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:c=o.$$.smartPtr;break;case 2:if(o.$$.smartPtrType===this)c=o.$$.smartPtr;else{var v=o.clone();c=this.rawShare(c,er.toHandle(function(){v.delete()})),i!==null&&i.push(this.rawDestructor,c)}break;default:G("Unsupporting sharing policy")}return c}function Rt(i,o){if(o===null)return this.isReference&&G(`null is not a valid ${this.name}`),0;o.$$||G(`Cannot pass "${nt(o)}" as a ${this.name}`),o.$$.ptr||G(`Cannot pass deleted object as a pointer of type ${this.name}`),o.$$.ptrType.isConst&&G(`Cannot convert argument of type ${o.$$.ptrType.name} to parameter type ${this.name}`);var c=o.$$.ptrType.registeredClass,m=Qr(o.$$.ptr,c,this.registeredClass);return m}function Dr(i){return this.fromWireType(Pe[i>>2])}function Cn(i){return this.rawGetPointee&&(i=this.rawGetPointee(i)),i}function vr(i){this.rawDestructor&&this.rawDestructor(i)}function et(i){i!==null&&i.delete()}function gr(){Oe.prototype.getPointee=Cn,Oe.prototype.destructor=vr,Oe.prototype.argPackAdvance=8,Oe.prototype.readValueFromPointer=Dr,Oe.prototype.deleteObject=et,Oe.prototype.fromWireType=Qe}function Oe(i,o,c,m,v,w,T,_,k,E,W){this.name=i,this.registeredClass=o,this.isReference=c,this.isConst=m,this.isSmartPointer=v,this.pointeeType=w,this.sharingPolicy=T,this.rawGetPointee=_,this.rawConstructor=k,this.rawShare=E,this.rawDestructor=W,!v&&o.baseClass===void 0?m?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=Rt,this.destructorFunction=null):this.toWireType=Dt}function An(i,o,c){s.hasOwnProperty(i)||ur("Replacing nonexistant public symbol"),s[i].overloadTable!==void 0&&c!==void 0?s[i].overloadTable[c]=o:(s[i]=o,s[i].argCount=c)}var yr=(i,o,c)=>{var m=s["dynCall_"+i];return c&&c.length?m.apply(null,[o].concat(c)):m.call(null,o)},Rr=[],$t=i=>{var o=Rr[i];return o||(i>=Rr.length&&(Rr.length=i+1),Rr[i]=o=vt.get(i)),o},$r=(i,o,c)=>{if(i.includes("j"))return yr(i,o,c);var m=$t(o).apply(null,c);return m},kn=(i,o)=>{var c=[];return function(){return c.length=0,Object.assign(c,arguments),$r(i,o,c)}};function De(i,o){i=he(i);function c(){return i.includes("j")?kn(i,o):$t(o)}var m=c();return typeof m!="function"&&G(`unknown function pointer with signature ${i}: ${o}`),m}function Dn(i,o){var c=Yr(o,function(m){this.name=o,this.message=m;var v=new Error(m).stack;v!==void 0&&(this.stack=this.toString()+`
|
|
24
|
-
`+v.replace(/^Error(:[^\n]*)?\n/,""))});return c.prototype=Object.create(
|
|
25
|
-
return function ${
|
|
26
|
-
if (arguments.length !== ${
|
|
27
|
-
throwBindingError('function ${
|
|
28
|
-
}`;
|
|
29
|
-
`);var ne=
|
|
30
|
-
`);for(var E=0;E<
|
|
31
|
-
`,Ee.push("argType"+E),de.push(
|
|
32
|
-
`,
|
|
33
|
-
`;else for(var E=
|
|
34
|
-
`,Ee.push(Ve+"_dtor"),de.push(
|
|
16
|
+
`),P+=`}
|
|
17
|
+
`,Z.push(P),Vt(Function,Z).apply(null,re)}function jn(e,r,t,n,u,l){var f=Wt(r,t);u=rr(n,u),hr([],[e],function(d){d=d[0];var y=`constructor ${d.name}`;if(d.registeredClass.constructor_body===void 0&&(d.registeredClass.constructor_body=[]),d.registeredClass.constructor_body[r-1]!==void 0)throw new cr(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${d.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return d.registeredClass.constructor_body[r-1]=()=>{it(`Cannot construct ${d.name} due to unbound types`,f)},hr([],f,function(h){return h.splice(1,0,null),d.registeredClass.constructor_body[r-1]=jt(y,h,null,u,l),[]}),[]})}function Gn(e,r,t,n,u,l,f,d,y){var h=Wt(t,n);r=ge(r),l=rr(u,l),hr([],[e],function(R){R=R[0];var x=`${R.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),d&&R.registeredClass.pureVirtualFunctions.push(r);function D(){it(`Cannot call ${x} due to unbound types`,h)}var P=R.registeredClass.instancePrototype,$=P[r];return $===void 0||$.overloadTable===void 0&&$.className!==R.name&&$.argCount===t-2?(D.argCount=t-2,D.className=R.name,P[r]=D):(Nt(P,r,x),P[r].overloadTable[t-2]=D),hr([],h,function(Z){var re=jt(x,Z,R,l,f,y);return P[r].overloadTable===void 0?(re.argCount=t-2,P[r]=re):P[r].overloadTable[t-2]=re,[]}),[]})}function zn(){Object.assign(Gt.prototype,{get(e){return this.allocated[e]},has(e){return this.allocated[e]!==void 0},allocate(e){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=e,r},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Gt(){this.allocated=[void 0],this.freelist=[]}var _e=new Gt;function zt(e){e>=_e.reserved&&--_e.get(e).refcount===0&&_e.free(e)}function Kn(){for(var e=0,r=_e.reserved;r<_e.allocated.length;++r)_e.allocated[r]!==void 0&&++e;return e}function Xn(){_e.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),_e.reserved=_e.allocated.length,s.count_emval_handles=Kn}var xr={toValue:e=>(e||K("Cannot use deleted val. handle = "+e),_e.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return _e.allocate({refcount:1,value:e})}}};function Kt(e,r){r=ge(r),ke(e,{name:r,fromWireType:function(t){var n=xr.toValue(t);return zt(t),n},toWireType:function(t,n){return xr.toHandle(n)},argPackAdvance:8,readValueFromPointer:er,destructorFunction:null})}function at(e){if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e}function qn(e,r){switch(r){case 2:return function(t){return this.fromWireType(Fr[t>>2])};case 3:return function(t){return this.fromWireType(ht[t>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Xt(e,r,t){var n=Yr(t);r=ge(r),ke(e,{name:r,fromWireType:function(u){return u},toWireType:function(u,l){return l},argPackAdvance:8,readValueFromPointer:qn(r,n),destructorFunction:null})}function Yn(e,r,t){switch(r){case 0:return t?function(u){return Y[u]}:function(u){return ie[u]};case 1:return t?function(u){return we[u>>1]}:function(u){return Se[u>>1]};case 2:return t?function(u){return U[u>>2]}:function(u){return X[u>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Jn(e,r,t,n,u){r=ge(r),u===-1&&(u=4294967295);var l=Yr(t),f=x=>x;if(n===0){var d=32-8*t;f=x=>x<<d>>>d}var y=r.includes("unsigned"),h=(x,D)=>{},R;y?R=function(x,D){return h(D,this.name),D>>>0}:R=function(x,D){return h(D,this.name),D},ke(e,{name:r,fromWireType:f,toWireType:R,argPackAdvance:8,readValueFromPointer:Yn(r,l,n!==0),destructorFunction:null})}function Zn(e,r,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],u=n[r];function l(f){f=f>>2;var d=X,y=d[f],h=d[f+1];return new u(d.buffer,h,y)}t=ge(t),ke(e,{name:t,fromWireType:l,argPackAdvance:8,readValueFromPointer:l},{ignoreDuplicateRegistrations:!0})}var Qn=(e,r,t)=>Kr(e,ie,r,t);function eo(e,r){r=ge(r);var t=r==="std::string";ke(e,{name:r,fromWireType:function(n){var u=X[n>>2],l=n+4,f;if(t)for(var d=l,y=0;y<=u;++y){var h=l+y;if(y==u||ie[h]==0){var R=h-d,x=St(d,R);f===void 0?f=x:(f+="\0",f+=x),d=h+1}}else{for(var D=new Array(u),y=0;y<u;++y)D[y]=String.fromCharCode(ie[l+y]);f=D.join("")}return tr(n),f},toWireType:function(n,u){u instanceof ArrayBuffer&&(u=new Uint8Array(u));var l,f=typeof u=="string";f||u instanceof Uint8Array||u instanceof Uint8ClampedArray||u instanceof Int8Array||K("Cannot pass non-string to std::string"),t&&f?l=Ze(u):l=u.length;var d=so(4+l+1),y=d+4;if(X[d>>2]=l,t&&f)Qn(u,y,l+1);else if(f)for(var h=0;h<l;++h){var R=u.charCodeAt(h);R>255&&(tr(y),K("String has UTF-16 code units that do not fit in 8 bits")),ie[y+h]=R}else for(var h=0;h<l;++h)ie[y+h]=u[h];return n!==null&&n.push(tr,d),d},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(n){tr(n)}})}var st=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,ro=(e,r)=>{for(var t=e,n=t>>1,u=n+r/2;!(n>=u)&&Se[n];)++n;if(t=n<<1,t-e>32&&st)return st.decode(ie.subarray(e,t));for(var l="",f=0;!(f>=r/2);++f){var d=we[e+f*2>>1];if(d==0)break;l+=String.fromCharCode(d)}return l},to=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<2)return 0;t-=2;for(var n=r,u=t<e.length*2?t/2:e.length,l=0;l<u;++l){var f=e.charCodeAt(l);we[r>>1]=f,r+=2}return we[r>>1]=0,r-n},po=e=>e.length*2,no=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var u=U[e+t*4>>2];if(u==0)break;if(++t,u>=65536){var l=u-65536;n+=String.fromCharCode(55296|l>>10,56320|l&1023)}else n+=String.fromCharCode(u)}return n},$e=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<4)return 0;for(var n=r,u=n+t-4,l=0;l<e.length;++l){var f=e.charCodeAt(l);if(f>=55296&&f<=57343){var d=e.charCodeAt(++l);f=65536+((f&1023)<<10)|d&1023}if(U[r>>2]=f,r+=4,r+4>u)break}return U[r>>2]=0,r-n},ut=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},qt=function(e,r,t){t=ge(t);var n,u,l,f,d;r===2?(n=ro,u=to,f=po,l=()=>Se,d=1):r===4&&(n=no,u=$e,f=ut,l=()=>X,d=2),ke(e,{name:t,fromWireType:function(y){for(var h=X[y>>2],R=l(),x,D=y+4,P=0;P<=h;++P){var $=y+4+P*r;if(P==h||R[$>>d]==0){var Z=$-D,re=n(D,Z);x===void 0?x=re:(x+="\0",x+=re),D=$+r}}return tr(y),x},toWireType:function(y,h){typeof h!="string"&&K(`Cannot pass non-string to C++ string type ${t}`);var R=f(h),x=so(4+R+r);return X[x>>2]=R>>d,u(h,x+4,R+r),y!==null&&y.push(tr,x),x},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(y){tr(y)}})};function oo(e,r){r=ge(r),ke(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:function(){},toWireType:function(t,n){}})}var io={};function Yt(e){var r=io[e];return r===void 0?ge(e):r}var ct=[];function Ur(e,r,t,n){e=ct[e],r=xr.toValue(r),t=Yt(t),e(r,t,null,n)}function Jt(e){var r=ct.length;return ct.push(e),r}function o(e,r){var t=Qe[e];return t===void 0&&K(r+" has unknown type "+ot(e)),t}function i(e,r){for(var t=new Array(e),n=0;n<e;++n)t[n]=o(X[r+n*4>>2],"parameter "+n);return t}var c=[];function m(e,r){var t=i(e,r),n=t[0],u=n.name+"_$"+t.slice(1).map(function($){return $.name}).join("_")+"$",l=c[u];if(l!==void 0)return l;for(var f=["retType"],d=[n],y="",h=0;h<e-1;++h)y+=(h!==0?", ":"")+"arg"+h,f.push("argType"+h),d.push(t[1+h]);for(var R=_r("methodCaller_"+u),x="return function "+R+`(handle, name, destructors, args) {
|
|
18
|
+
`,D=0,h=0;h<e-1;++h)x+=" var arg"+h+" = argType"+h+".readValueFromPointer(args"+(D?"+"+D:"")+`);
|
|
19
|
+
`,D+=t[h+1].argPackAdvance;x+=" var rv = handle[name]("+y+`);
|
|
20
|
+
`;for(var h=0;h<e-1;++h)t[h+1].deleteObject&&(x+=" argType"+h+".deleteObject(arg"+h+`);
|
|
21
|
+
`);n.isVoid||(x+=` return retType.toWireType(destructors, rv);
|
|
22
|
+
`),x+=`};
|
|
23
|
+
`,f.push(x);var P=Vt(Function,f).apply(null,d);return l=Jt(P),c[u]=l,l}function v(e,r){return r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN}var b=()=>{Fe("")};function w(){return Date.now()}var T=()=>ie.length,O=()=>T(),E=(e,r,t)=>ie.copyWithin(e,r,r+t),B=e=>{Fe("OOM")},W=e=>{var r=ie.length;e>>>=0,B(e)},V={},J=()=>j||"./this.program",ne=()=>{if(!ne.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:J()};for(var t in V)V[t]===void 0?delete r[t]:r[t]=V[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);ne.strings=n}return ne.strings},Ee=(e,r)=>{for(var t=0;t<e.length;++t)Y[r++>>0]=e.charCodeAt(t);Y[r>>0]=0},de=(e,r)=>{var t=0;return ne().forEach(function(n,u){var l=r+t;X[e+u*4>>2]=l,Ee(n,l),t+=n.length+1}),0},Ve=(e,r)=>{var t=ne();X[e>>2]=t.length;var n=0;return t.forEach(function(u){n+=u.length+1}),X[r>>2]=n,0};function lt(e){try{var r=te.getStreamFromFD(e);return a.close(r),0}catch(t){if(typeof a=="undefined"||t.name!=="ErrnoError")throw t;return t.errno}}function Pe(e,r){try{var t=0,n=0,u=0,l=te.getStreamFromFD(e),f=l.tty?2:a.isDir(l.mode)?3:a.isLink(l.mode)?7:4;return Y[r>>0]=f,we[r+2>>1]=u,Q=[t>>>0,(N=t,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+8>>2]=Q[0],U[r+12>>2]=Q[1],Q=[n>>>0,(N=n,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+16>>2]=Q[0],U[r+20>>2]=Q[1],0}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return d.errno}}var ao=(e,r,t,n)=>{for(var u=0,l=0;l<t;l++){var f=X[r>>2],d=X[r+4>>2];r+=8;var y=a.read(e,Y,f,d,n);if(y<0)return-1;if(u+=y,y<d)break;typeof n!="undefined"&&(n+=y)}return u};function Zt(e,r,t,n){try{var u=te.getStreamFromFD(e),l=ao(u,r,t);return X[n>>2]=l,0}catch(f){if(typeof a=="undefined"||f.name!=="ErrnoError")throw f;return f.errno}}function Qt(e,r,t,n,u){var l=v(r,t);try{if(isNaN(l))return 61;var f=te.getStreamFromFD(e);return a.llseek(f,l,n),Q=[f.position>>>0,(N=f.position,+Math.abs(N)>=1?N>0?+Math.floor(N/4294967296)>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[u>>2]=Q[0],U[u+4>>2]=Q[1],f.getdents&&l===0&&n===0&&(f.getdents=null),0}catch(d){if(typeof a=="undefined"||d.name!=="ErrnoError")throw d;return d.errno}}var en=(e,r,t,n)=>{for(var u=0,l=0;l<t;l++){var f=X[r>>2],d=X[r+4>>2];r+=8;var y=a.write(e,Y,f,d,n);if(y<0)return-1;u+=y,typeof n!="undefined"&&(n+=y)}return u};function ko(e,r,t,n){try{var u=te.getStreamFromFD(e),l=en(u,r,t);return X[n>>2]=l,0}catch(f){if(typeof a=="undefined"||f.name!=="ErrnoError")throw f;return f.errno}}var mo=function(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},rn=365,tn=146;Object.defineProperties(mo.prototype,{read:{get:function(){return(this.mode&rn)===rn},set:function(e){e?this.mode|=rn:this.mode&=~rn}},write:{get:function(){return(this.mode&tn)===tn},set:function(e){e?this.mode|=tn:this.mode&=~tn}},isFolder:{get:function(){return a.isDir(this.mode)}},isDevice:{get:function(){return a.isChrdev(this.mode)}}}),a.FSNode=mo,a.createPreloadedFile=Et,a.staticInit(),mr(),cr=s.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Pt=s.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Dn(),Rn(),Mn(),Ht=s.UnboundTypeError=Bt(Error,"UnboundTypeError"),zn(),Xn();var xo={p:_t,C:qr,w:pr,t:An,n:Pn,r:Wn,q:jn,d:Gn,D:Kt,k:Xt,c:Jn,b:Zn,j:eo,f:qt,o:oo,g:Ur,m:zt,l:m,a:b,e:w,v:O,A:E,u:W,y:de,z:Ve,i:lt,x:Pe,B:Zt,s:Qt,h:ko},ai=Tn(),Uo=()=>(Uo=ee.F)(),so=e=>(so=ee.G)(e),tr=e=>(tr=ee.I)(e),ho=()=>(ho=ee.J)(),vo=e=>(vo=ee.K)(e),No=s.__embind_initialize_bindings=()=>(No=s.__embind_initialize_bindings=ee.L)(),go=e=>(go=ee.M)(e),$o=s.dynCall_jiji=(e,r,t,n,u)=>($o=s.dynCall_jiji=ee.N)(e,r,t,n,u),si=s._ff_h264_cabac_tables=67061,nn;dr=function e(){nn||yo(),nn||(dr=e)};function yo(){if(Oe>0||(mn(),Oe>0))return;function e(){nn||(nn=!0,s.calledRun=!0,!Mr&&(hn(),g(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),vn()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),e()},1)):e()}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return yo(),p.ready}})(),Ro=Qo;var sn=class extends Ge{constructor(p){super(Ro,p!=null&&p.wasmPath?fetch(p==null?void 0:p.wasmPath).then(s=>s.arrayBuffer()):void 0,p==null?void 0:p.workerMode,p==null?void 0:p.canvas,p==null?void 0:p.yuvMode)}};var ei=(()=>{var _=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return function(p={}){var s=p,g,S;s.ready=new Promise((o,i)=>{g=o,S=i});var I=Object.assign({},s),A=[],j="./this.program",k=(o,i)=>{throw i},C=typeof window=="object",F=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",H="";function me(o){return s.locateFile?s.locateFile(o,H):H+o}var Re,Me,q,ze;(C||F)&&(F?H=self.location.href:typeof document!="undefined"&&document.currentScript&&(H=document.currentScript.src),_&&(H=_),H.indexOf("blob:")!==0?H=H.substr(0,H.replace(/[?#].*/,"").lastIndexOf("/")+1):H="",Re=o=>{var i=new XMLHttpRequest;return i.open("GET",o,!1),i.send(null),i.responseText},F&&(q=o=>{var i=new XMLHttpRequest;return i.open("GET",o,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),Me=(o,i,c)=>{var m=new XMLHttpRequest;m.open("GET",o,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){i(m.response);return}c()},m.onerror=c,m.send(null)},ze=o=>document.title=o);var lr=s.print||console.log.bind(console),ae=s.printErr||console.error.bind(console);Object.assign(s,I),I=null,s.arguments&&(A=s.arguments),s.thisProgram&&(j=s.thisProgram),s.quit&&(k=s.quit);var he;s.wasmBinary&&(he=s.wasmBinary);var Do=s.noExitRuntime||!0;typeof WebAssembly!="object"&&ir("no native wasm support detected");var Lr,ee,Mr=!1,fn,Ke,Y,ie,we,Se,U,X,Fr;function ht(){var o=Lr.buffer;s.HEAP8=Ke=new Int8Array(o),s.HEAP16=ie=new Int16Array(o),s.HEAP32=Se=new Int32Array(o),s.HEAPU8=Y=new Uint8Array(o),s.HEAPU16=we=new Uint16Array(o),s.HEAPU32=U=new Uint32Array(o),s.HEAPF32=X=new Float32Array(o),s.HEAPF64=Fr=new Float64Array(o)}var vt,Br=[],Hr=[],Wr=[],gt=!1;function pn(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)vn(s.preRun.shift());Gr(Br)}function mn(){gt=!0,Gr(Hr)}function hn(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)yn(s.postRun.shift());Gr(Wr)}function vn(o){Br.unshift(o)}function gn(o){Hr.unshift(o)}function yn(o){Wr.unshift(o)}var Xe=0,Oe=null,qe=null;function dr(o){Xe++,s.monitorRunDependencies&&s.monitorRunDependencies(Xe)}function fo(o){if(Xe--,s.monitorRunDependencies&&s.monitorRunDependencies(Xe),Xe==0&&(Oe!==null&&(clearInterval(Oe),Oe=null),qe)){var i=qe;qe=null,i()}}function ir(o){s.onAbort&&s.onAbort(o),o="Aborted("+o+")",ae(o),Mr=!0,fn=1,o+=". Build with -sASSERTIONS for more info.";var i=new WebAssembly.RuntimeError(o);throw S(i),i}var wr="data:application/octet-stream;base64,";function Fe(o){return o.startsWith(wr)}var ar;ar="videodec_simd.wasm",Fe(ar)||(ar=me(ar));function Vr(o){if(o==ar&&he)return new Uint8Array(he);if(q)return q(o);throw"both async and sync fetching of the wasm failed"}function sr(o){return!he&&(C||F)&&typeof fetch=="function"?fetch(o,{credentials:"same-origin"}).then(i=>{if(!i.ok)throw"failed to load wasm binary file at '"+o+"'";return i.arrayBuffer()}).catch(()=>Vr(o)):Promise.resolve().then(()=>Vr(o))}function jr(o,i,c){return sr(o).then(m=>WebAssembly.instantiate(m,i)).then(m=>m).then(c,m=>{ae("failed to asynchronously prepare wasm: "+m),ir(m)})}function _n(o,i,c,m){return!o&&typeof WebAssembly.instantiateStreaming=="function"&&!Fe(i)&&typeof fetch=="function"?fetch(i,{credentials:"same-origin"}).then(v=>{var b=WebAssembly.instantiateStreaming(v,c);return b.then(m,function(w){return ae("wasm streaming compile failed: "+w),ae("falling back to ArrayBuffer instantiation"),jr(i,c,m)})}):jr(i,c,m)}function yt(){var o={a:to};function i(m,v){var b=m.exports;return ee=b,Lr=ee.v,ht(),vt=ee.z,gn(ee.w),fo("wasm-instantiate"),b}dr("wasm-instantiate");function c(m){i(m.instance)}if(s.instantiateWasm)try{return s.instantiateWasm(o,i)}catch(m){ae("Module.instantiateWasm callback failed with error: "+m),S(m)}return _n(he,ar,o,c).catch(S),{}}var Gr=o=>{for(;o.length>0;)o.shift()(s)};function Tn(o){this.excPtr=o,this.ptr=o-24,this.set_type=function(i){U[this.ptr+4>>2]=i},this.get_type=function(){return U[this.ptr+4>>2]},this.set_destructor=function(i){U[this.ptr+8>>2]=i},this.get_destructor=function(){return U[this.ptr+8>>2]},this.set_caught=function(i){i=i?1:0,Ke[this.ptr+12>>0]=i},this.get_caught=function(){return Ke[this.ptr+12>>0]!=0},this.set_rethrown=function(i){i=i?1:0,Ke[this.ptr+13>>0]=i},this.get_rethrown=function(){return Ke[this.ptr+13>>0]!=0},this.init=function(i,c){this.set_adjusted_ptr(0),this.set_type(i),this.set_destructor(c)},this.set_adjusted_ptr=function(i){U[this.ptr+16>>2]=i},this.get_adjusted_ptr=function(){return U[this.ptr+16>>2]},this.get_exception_ptr=function(){var i=Yt(this.get_type());if(i)return U[this.excPtr>>2];var c=this.get_adjusted_ptr();return c!==0?c:this.excPtr}}var N=0,Q=0;function zr(o,i,c){var m=new Tn(o);throw m.init(i,c),N=o,Q++,N}function bn(o,i,c,m,v){}function Sr(o){switch(o){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${o}`)}}function En(){for(var o=new Array(256),i=0;i<256;++i)o[i]=String.fromCharCode(i);_t=o}var _t=void 0;function ve(o){for(var i="",c=o;Y[c];)i+=_t[Y[c++]];return i}var G={},Ye={},fr={},le=void 0;function z(o){throw new le(o)}var Je=void 0;function ur(o){throw new Je(o)}function Ze(o,i,c){o.forEach(function(T){fr[T]=i});function m(T){var O=c(T);O.length!==o.length&&ur("Mismatched type converter count");for(var E=0;E<o.length;++E)Ae(o[E],O[E])}var v=new Array(i.length),b=[],w=0;i.forEach((T,O)=>{Ye.hasOwnProperty(T)?v[O]=Ye[T]:(b.push(T),G.hasOwnProperty(T)||(G[T]=[]),G[T].push(()=>{v[O]=Ye[T],++w,w===b.length&&m(v)}))}),b.length===0&&m(v)}function Kr(o,i,c={}){var m=i.name;if(o||z(`type "${m}" must have a positive integer typeid pointer`),Ye.hasOwnProperty(o)){if(c.ignoreDuplicateRegistrations)return;z(`Cannot register type '${m}' twice`)}if(Ye[o]=i,delete fr[o],G.hasOwnProperty(o)){var v=G[o];delete G[o],v.forEach(b=>b())}}function Ae(o,i,c={}){if(!("argPackAdvance"in i))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Kr(o,i,c)}function wn(o,i,c,m,v){var b=Sr(c);i=ve(i),Ae(o,{name:i,fromWireType:function(w){return!!w},toWireType:function(w,T){return T?m:v},argPackAdvance:8,readValueFromPointer:function(w){var T;if(c===1)T=Ke;else if(c===2)T=ie;else if(c===4)T=Se;else throw new TypeError("Unknown boolean type size: "+i);return this.fromWireType(T[w>>b])},destructorFunction:null})}function Be(o){if(!(this instanceof We)||!(o instanceof We))return!1;for(var i=this.$$.ptrType.registeredClass,c=this.$$.ptr,m=o.$$.ptrType.registeredClass,v=o.$$.ptr;i.baseClass;)c=i.upcast(c),i=i.baseClass;for(;m.baseClass;)v=m.upcast(v),m=m.baseClass;return i===m&&c===v}function Tt(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function M(o){function i(c){return c.$$.ptrType.registeredClass.name}z(i(o)+" instance already deleted")}var Xr=!1;function bt(o){}function Sn(o){o.smartPtr?o.smartPtrType.rawDestructor(o.smartPtr):o.ptrType.registeredClass.rawDestructor(o.ptr)}function Et(o){o.count.value-=1;var i=o.count.value===0;i&&Sn(o)}function wt(o,i,c){if(i===c)return o;if(c.baseClass===void 0)return null;var m=wt(o,i,c.baseClass);return m===null?null:c.downcast(m)}var Ar={};function a(){return Object.keys(mr).length}function St(){var o=[];for(var i in mr)mr.hasOwnProperty(i)&&o.push(mr[i]);return o}var te=[];function qr(){for(;te.length;){var o=te.pop();o.$$.deleteScheduled=!1,o.delete()}}var pr=void 0;function An(o){pr=o,te.length&&pr&&pr(qr)}function Yr(){s.getInheritedInstanceCount=a,s.getLiveInheritedInstances=St,s.flushPendingDeletes=qr,s.setDelayFunction=An}var mr={};function At(o,i){for(i===void 0&&z("ptr should not be undefined");o.baseClass;)i=o.upcast(i),o=o.baseClass;return i}function ge(o,i){return i=At(o,i),mr[i]}function De(o,i){(!i.ptrType||!i.ptr)&&ur("makeClassHandle requires ptr and ptrType");var c=!!i.smartPtrType,m=!!i.smartPtr;return c!==m&&ur("Both smartPtrType and smartPtr must be specified"),i.count={value:1},He(Object.create(o,{$$:{value:i}}))}function Qe(o){var i=this.getPointee(o);if(!i)return this.destructor(o),null;var c=ge(this.registeredClass,i);if(c!==void 0){if(c.$$.count.value===0)return c.$$.ptr=i,c.$$.smartPtr=o,c.clone();var m=c.clone();return this.destructor(o),m}function v(){return this.isSmartPointer?De(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:i,smartPtrType:this,smartPtr:o}):De(this.registeredClass.instancePrototype,{ptrType:this,ptr:o})}var b=this.registeredClass.getActualType(i),w=Ar[b];if(!w)return v.call(this);var T;this.isConst?T=w.constPointerType:T=w.pointerType;var O=wt(i,this.registeredClass,T.registeredClass);return O===null?v.call(this):this.isSmartPointer?De(T.registeredClass.instancePrototype,{ptrType:T,ptr:O,smartPtrType:this,smartPtr:o}):De(T.registeredClass.instancePrototype,{ptrType:T,ptr:O})}var He=function(o){return typeof FinalizationRegistry=="undefined"?(He=i=>i,o):(Xr=new FinalizationRegistry(i=>{Et(i.$$)}),He=i=>{var c=i.$$,m=!!c.smartPtr;if(m){var v={$$:c};Xr.register(i,v,i)}return i},bt=i=>Xr.unregister(i),He(o))};function cr(){if(this.$$.ptr||M(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var o=He(Object.create(Object.getPrototypeOf(this),{$$:{value:Tt(this.$$)}}));return o.$$.count.value+=1,o.$$.deleteScheduled=!1,o}function K(){this.$$.ptr||M(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&z("Object already scheduled for deletion"),bt(this),Et(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Pt(){return!this.$$.ptr}function Pr(){return this.$$.ptr||M(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&z("Object already scheduled for deletion"),te.push(this),te.length===1&&pr&&pr(qr),this.$$.deleteScheduled=!0,this}function hr(){We.prototype.isAliasOf=Be,We.prototype.clone=cr,We.prototype.delete=K,We.prototype.isDeleted=Pt,We.prototype.deleteLater=Pr}function We(){}var ke=48,Pn=57;function Cr(o){if(o===void 0)return"_unknown";o=o.replace(/[^a-zA-Z0-9_]/g,"$");var i=o.charCodeAt(0);return i>=ke&&i<=Pn?`_${o}`:o}function Jr(o,i){return o=Cr(o),{[o]:function(){return i.apply(this,arguments)}}[o]}function Rr(o,i,c){if(o[i].overloadTable===void 0){var m=o[i];o[i]=function(){return o[i].overloadTable.hasOwnProperty(arguments.length)||z(`Function '${c}' called with an invalid number of arguments (${arguments.length}) - expects one of (${o[i].overloadTable})!`),o[i].overloadTable[arguments.length].apply(this,arguments)},o[i].overloadTable=[],o[i].overloadTable[m.argCount]=m}}function Zr(o,i,c){s.hasOwnProperty(o)?((c===void 0||s[o].overloadTable!==void 0&&s[o].overloadTable[c]!==void 0)&&z(`Cannot register public name '${o}' twice`),Rr(s,o,o),s.hasOwnProperty(c)&&z(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`),s[o].overloadTable[c]=i):(s[o]=i,c!==void 0&&(s[o].numArguments=c))}function Ct(o,i,c,m,v,b,w,T){this.name=o,this.constructor=i,this.instancePrototype=c,this.rawDestructor=m,this.baseClass=v,this.getActualType=b,this.upcast=w,this.downcast=T,this.pureVirtualFunctions=[]}function Qr(o,i,c){for(;i!==c;)i.upcast||z(`Expected null or instance of ${c.name}, got an instance of ${i.name}`),o=i.upcast(o),i=i.baseClass;return o}function Rt(o,i){if(i===null)return this.isReference&&z(`null is not a valid ${this.name}`),0;i.$$||z(`Cannot pass "${nt(i)}" as a ${this.name}`),i.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`);var c=i.$$.ptrType.registeredClass,m=Qr(i.$$.ptr,c,this.registeredClass);return m}function It(o,i){var c;if(i===null)return this.isReference&&z(`null is not a valid ${this.name}`),this.isSmartPointer?(c=this.rawConstructor(),o!==null&&o.push(this.rawDestructor,c),c):0;i.$$||z(`Cannot pass "${nt(i)}" as a ${this.name}`),i.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&i.$$.ptrType.isConst&&z(`Cannot convert argument of type ${i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name} to parameter type ${this.name}`);var m=i.$$.ptrType.registeredClass;if(c=Qr(i.$$.ptr,m,this.registeredClass),this.isSmartPointer)switch(i.$$.smartPtr===void 0&&z("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:i.$$.smartPtrType===this?c=i.$$.smartPtr:z(`Cannot convert argument of type ${i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:c=i.$$.smartPtr;break;case 2:if(i.$$.smartPtrType===this)c=i.$$.smartPtr;else{var v=i.clone();c=this.rawShare(c,er.toHandle(function(){v.delete()})),o!==null&&o.push(this.rawDestructor,c)}break;default:z("Unsupporting sharing policy")}return c}function Ot(o,i){if(i===null)return this.isReference&&z(`null is not a valid ${this.name}`),0;i.$$||z(`Cannot pass "${nt(i)}" as a ${this.name}`),i.$$.ptr||z(`Cannot pass deleted object as a pointer of type ${this.name}`),i.$$.ptrType.isConst&&z(`Cannot convert argument of type ${i.$$.ptrType.name} to parameter type ${this.name}`);var c=i.$$.ptrType.registeredClass,m=Qr(i.$$.ptr,c,this.registeredClass);return m}function Ir(o){return this.fromWireType(Se[o>>2])}function Cn(o){return this.rawGetPointee&&(o=this.rawGetPointee(o)),o}function vr(o){this.rawDestructor&&this.rawDestructor(o)}function et(o){o!==null&&o.delete()}function gr(){xe.prototype.getPointee=Cn,xe.prototype.destructor=vr,xe.prototype.argPackAdvance=8,xe.prototype.readValueFromPointer=Ir,xe.prototype.deleteObject=et,xe.prototype.fromWireType=Qe}function xe(o,i,c,m,v,b,w,T,O,E,B){this.name=o,this.registeredClass=i,this.isReference=c,this.isConst=m,this.isSmartPointer=v,this.pointeeType=b,this.sharingPolicy=w,this.rawGetPointee=T,this.rawConstructor=O,this.rawShare=E,this.rawDestructor=B,!v&&i.baseClass===void 0?m?(this.toWireType=Rt,this.destructorFunction=null):(this.toWireType=Ot,this.destructorFunction=null):this.toWireType=It}function Rn(o,i,c){s.hasOwnProperty(o)||ur("Replacing nonexistant public symbol"),s[o].overloadTable!==void 0&&c!==void 0?s[o].overloadTable[c]=i:(s[o]=i,s[o].argCount=c)}var yr=(o,i,c)=>{var m=s["dynCall_"+o];return c&&c.length?m.apply(null,[i].concat(c)):m.call(null,i)},Or=[],Dt=o=>{var i=Or[o];return i||(o>=Or.length&&(Or.length=o+1),Or[o]=i=vt.get(o)),i},Dr=(o,i,c)=>{if(o.includes("j"))return yr(o,i,c);var m=Dt(i).apply(null,c);return m},In=(o,i)=>{var c=[];return function(){return c.length=0,Object.assign(c,arguments),Dr(o,i,c)}};function Ie(o,i){o=ve(o);function c(){return o.includes("j")?In(o,i):Dt(i)}var m=c();return typeof m!="function"&&z(`unknown function pointer with signature ${o}: ${i}`),m}function On(o,i){var c=Jr(i,function(m){this.name=i,this.message=m;var v=new Error(m).stack;v!==void 0&&(this.stack=this.toString()+`
|
|
24
|
+
`+v.replace(/^Error(:[^\n]*)?\n/,""))});return c.prototype=Object.create(o.prototype),c.prototype.constructor=c,c.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},c}var kt=void 0;function xt(o){var i=qt(o),c=ve(i);return $e(i),c}function rt(o,i){var c=[],m={};function v(b){if(!m[b]&&!Ye[b]){if(fr[b]){fr[b].forEach(v);return}c.push(b),m[b]=!0}}throw i.forEach(v),new kt(`${o}: `+c.map(xt).join([", "]))}function Dn(o,i,c,m,v,b,w,T,O,E,B,W,V){B=ve(B),b=Ie(v,b),T&&(T=Ie(w,T)),E&&(E=Ie(O,E)),V=Ie(W,V);var J=Cr(B);Zr(J,function(){rt(`Cannot construct ${B} due to unbound types`,[m])}),Ze([o,i,c],m?[m]:[],function(ne){ne=ne[0];var Ee,de;m?(Ee=ne.registeredClass,de=Ee.instancePrototype):de=We.prototype;var Ve=Jr(J,function(){if(Object.getPrototypeOf(this)!==lt)throw new le("Use 'new' to construct "+B);if(Pe.constructor_body===void 0)throw new le(B+" has no accessible constructor");var en=Pe.constructor_body[arguments.length];if(en===void 0)throw new le(`Tried to invoke ctor of ${B} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(Pe.constructor_body).toString()}) parameters instead!`);return en.apply(this,arguments)}),lt=Object.create(de,{constructor:{value:Ve}});Ve.prototype=lt;var Pe=new Ct(B,Ve,lt,V,Ee,b,T,E);Pe.baseClass&&(Pe.baseClass.__derivedClasses===void 0&&(Pe.baseClass.__derivedClasses=[]),Pe.baseClass.__derivedClasses.push(Pe));var ao=new xe(B,Pe,!0,!1,!1),Zt=new xe(B+"*",Pe,!1,!1,!1),Qt=new xe(B+" const*",Pe,!1,!0,!1);return Ar[o]={pointerType:Zt,constPointerType:Qt},Rn(J,Ve),[ao,Zt,Qt]})}function Ue(o,i){for(var c=[],m=0;m<o;m++)c.push(U[i+m*4>>2]);return c}function kn(o){for(;o.length;){var i=o.pop(),c=o.pop();c(i)}}function Ut(o,i){if(!(o instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof o} which is not a function`);var c=Jr(o.name||"unknownFunctionName",function(){});c.prototype=o.prototype;var m=new c,v=o.apply(m,i);return v instanceof Object?v:m}function _r(o,i,c,m,v,b){var w=i.length;w<2&&z("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var T=i[1]!==null&&c!==null,O=!1,E=1;E<i.length;++E)if(i[E]!==null&&i[E].destructorFunction===void 0){O=!0;break}for(var B=i[0].name!=="void",W="",V="",E=0;E<w-2;++E)W+=(E!==0?", ":"")+"arg"+E,V+=(E!==0?", ":"")+"arg"+E+"Wired";var J=`
|
|
25
|
+
return function ${Cr(o)}(${W}) {
|
|
26
|
+
if (arguments.length !== ${w-2}) {
|
|
27
|
+
throwBindingError('function ${o} called with ${arguments.length} arguments, expected ${w-2} args!');
|
|
28
|
+
}`;O&&(J+=`var destructors = [];
|
|
29
|
+
`);var ne=O?"destructors":"null",Ee=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],de=[z,m,v,kn,i[0],i[1]];T&&(J+="var thisWired = classParam.toWireType("+ne+`, this);
|
|
30
|
+
`);for(var E=0;E<w-2;++E)J+="var arg"+E+"Wired = argType"+E+".toWireType("+ne+", arg"+E+"); // "+i[E+2].name+`
|
|
31
|
+
`,Ee.push("argType"+E),de.push(i[E+2]);if(T&&(V="thisWired"+(V.length>0?", ":"")+V),J+=(B||b?"var rv = ":"")+"invoker(fn"+(V.length>0?", ":"")+V+`);
|
|
32
|
+
`,O)J+=`runDestructors(destructors);
|
|
33
|
+
`;else for(var E=T?1:2;E<i.length;++E){var Ve=E===1?"thisWired":"arg"+(E-2)+"Wired";i[E].destructorFunction!==null&&(J+=Ve+"_dtor("+Ve+"); // "+i[E].name+`
|
|
34
|
+
`,Ee.push(Ve+"_dtor"),de.push(i[E].destructorFunction))}return B&&(J+=`var ret = retType.fromWireType(rv);
|
|
35
35
|
return ret;
|
|
36
|
-
`),
|
|
37
|
-
`,Ee.push(
|
|
38
|
-
`,V=0,E=0;E<
|
|
39
|
-
`,V+=c[E+1].argPackAdvance;
|
|
40
|
-
`;for(var E=0;E<
|
|
41
|
-
`);m.isVoid||(
|
|
42
|
-
`),
|
|
43
|
-
`,
|
|
36
|
+
`),J+=`}
|
|
37
|
+
`,Ee.push(J),Ut(Function,Ee).apply(null,de)}function tt(o,i,c,m,v,b){var w=Ue(i,c);v=Ie(m,v),Ze([],[o],function(T){T=T[0];var O=`constructor ${T.name}`;if(T.registeredClass.constructor_body===void 0&&(T.registeredClass.constructor_body=[]),T.registeredClass.constructor_body[i-1]!==void 0)throw new le(`Cannot register multiple constructors with identical number of parameters (${i-1}) for class '${T.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return T.registeredClass.constructor_body[i-1]=()=>{rt(`Cannot construct ${T.name} due to unbound types`,w)},Ze([],w,function(E){return E.splice(1,0,null),T.registeredClass.constructor_body[i-1]=_r(O,E,null,v,b),[]}),[]})}function Nt(o,i,c,m,v,b,w,T,O){var E=Ue(c,m);i=ve(i),b=Ie(v,b),Ze([],[o],function(B){B=B[0];var W=`${B.name}.${i}`;i.startsWith("@@")&&(i=Symbol[i.substring(2)]),T&&B.registeredClass.pureVirtualFunctions.push(i);function V(){rt(`Cannot call ${W} due to unbound types`,E)}var J=B.registeredClass.instancePrototype,ne=J[i];return ne===void 0||ne.overloadTable===void 0&&ne.className!==B.name&&ne.argCount===c-2?(V.argCount=c-2,V.className=B.name,J[i]=V):(Rr(J,i,W),J[i].overloadTable[c-2]=V),Ze([],E,function(Ee){var de=_r(W,Ee,B,b,w,O);return J[i].overloadTable===void 0?(de.argCount=c-2,J[i]=de):J[i].overloadTable[c-2]=de,[]}),[]})}function xn(){Object.assign($t.prototype,{get(o){return this.allocated[o]},has(o){return this.allocated[o]!==void 0},allocate(o){var i=this.freelist.pop()||this.allocated.length;return this.allocated[i]=o,i},free(o){this.allocated[o]=void 0,this.freelist.push(o)}})}function $t(){this.allocated=[void 0],this.freelist=[]}var ye=new $t;function Lt(o){o>=ye.reserved&&--ye.get(o).refcount===0&&ye.free(o)}function Un(){for(var o=0,i=ye.reserved;i<ye.allocated.length;++i)ye.allocated[i]!==void 0&&++o;return o}function Nn(){ye.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),ye.reserved=ye.allocated.length,s.count_emval_handles=Un}var er={toValue:o=>(o||z("Cannot use deleted val. handle = "+o),ye.get(o).value),toHandle:o=>{switch(o){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return ye.allocate({refcount:1,value:o})}}};function $n(o,i){i=ve(i),Ae(o,{name:i,fromWireType:function(c){var m=er.toValue(c);return Lt(c),m},toWireType:function(c,m){return er.toHandle(m)},argPackAdvance:8,readValueFromPointer:Ir,destructorFunction:null})}function nt(o){if(o===null)return"null";var i=typeof o;return i==="object"||i==="array"||i==="function"?o.toString():""+o}function Ln(o,i){switch(i){case 2:return function(c){return this.fromWireType(X[c>>2])};case 3:return function(c){return this.fromWireType(Fr[c>>3])};default:throw new TypeError("Unknown float type: "+o)}}function Mn(o,i,c){var m=Sr(c);i=ve(i),Ae(o,{name:i,fromWireType:function(v){return v},toWireType:function(v,b){return b},argPackAdvance:8,readValueFromPointer:Ln(i,m),destructorFunction:null})}function Ne(o,i,c){switch(i){case 0:return c?function(v){return Ke[v]}:function(v){return Y[v]};case 1:return c?function(v){return ie[v>>1]}:function(v){return we[v>>1]};case 2:return c?function(v){return Se[v>>2]}:function(v){return U[v>>2]};default:throw new TypeError("Unknown integer type: "+o)}}function Fn(o,i,c,m,v){i=ve(i),v===-1&&(v=4294967295);var b=Sr(c),w=W=>W;if(m===0){var T=32-8*c;w=W=>W<<T>>>T}var O=i.includes("unsigned"),E=(W,V)=>{},B;O?B=function(W,V){return E(V,this.name),V>>>0}:B=function(W,V){return E(V,this.name),V},Ae(o,{name:i,fromWireType:w,toWireType:B,argPackAdvance:8,readValueFromPointer:Ne(i,b,m!==0),destructorFunction:null})}function Bn(o,i,c){var m=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],v=m[i];function b(w){w=w>>2;var T=U,O=T[w],E=T[w+1];return new v(T.buffer,E,O)}c=ve(c),Ae(o,{name:c,fromWireType:b,argPackAdvance:8,readValueFromPointer:b},{ignoreDuplicateRegistrations:!0})}var kr=(o,i,c,m)=>{if(!(m>0))return 0;for(var v=c,b=c+m-1,w=0;w<o.length;++w){var T=o.charCodeAt(w);if(T>=55296&&T<=57343){var O=o.charCodeAt(++w);T=65536+((T&1023)<<10)|O&1023}if(T<=127){if(c>=b)break;i[c++]=T}else if(T<=2047){if(c+1>=b)break;i[c++]=192|T>>6,i[c++]=128|T&63}else if(T<=65535){if(c+2>=b)break;i[c++]=224|T>>12,i[c++]=128|T>>6&63,i[c++]=128|T&63}else{if(c+3>=b)break;i[c++]=240|T>>18,i[c++]=128|T>>12&63,i[c++]=128|T>>6&63,i[c++]=128|T&63}}return i[c]=0,c-v},Mt=(o,i,c)=>kr(o,Y,i,c),Hn=o=>{for(var i=0,c=0;c<o.length;++c){var m=o.charCodeAt(c);m<=127?i++:m<=2047?i+=2:m>=55296&&m<=57343?(i+=4,++c):i+=3}return i},Ft=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0,rr=(o,i,c)=>{for(var m=i+c,v=i;o[v]&&!(v>=m);)++v;if(v-i>16&&o.buffer&&Ft)return Ft.decode(o.subarray(i,v));for(var b="";i<v;){var w=o[i++];if(!(w&128)){b+=String.fromCharCode(w);continue}var T=o[i++]&63;if((w&224)==192){b+=String.fromCharCode((w&31)<<6|T);continue}var O=o[i++]&63;if((w&240)==224?w=(w&15)<<12|T<<6|O:w=(w&7)<<18|T<<12|O<<6|o[i++]&63,w<65536)b+=String.fromCharCode(w);else{var E=w-65536;b+=String.fromCharCode(55296|E>>10,56320|E&1023)}}return b},Bt=(o,i)=>o?rr(Y,o,i):"";function Ht(o,i){i=ve(i);var c=i==="std::string";Ae(o,{name:i,fromWireType:function(m){var v=U[m>>2],b=m+4,w;if(c)for(var T=b,O=0;O<=v;++O){var E=b+O;if(O==v||Y[E]==0){var B=E-T,W=Bt(T,B);w===void 0?w=W:(w+="\0",w+=W),T=E+1}}else{for(var V=new Array(v),O=0;O<v;++O)V[O]=String.fromCharCode(Y[b+O]);w=V.join("")}return $e(m),w},toWireType:function(m,v){v instanceof ArrayBuffer&&(v=new Uint8Array(v));var b,w=typeof v=="string";w||v instanceof Uint8Array||v instanceof Uint8ClampedArray||v instanceof Int8Array||z("Cannot pass non-string to std::string"),c&&w?b=Hn(v):b=v.length;var T=ut(4+b+1),O=T+4;if(U[T>>2]=b,c&&w)Mt(v,O,b+1);else if(w)for(var E=0;E<b;++E){var B=v.charCodeAt(E);B>255&&($e(O),z("String has UTF-16 code units that do not fit in 8 bits")),Y[O+E]=B}else for(var E=0;E<b;++E)Y[O+E]=v[E];return m!==null&&m.push($e,T),T},argPackAdvance:8,readValueFromPointer:Ir,destructorFunction:function(m){$e(m)}})}var ot=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0,it=(o,i)=>{for(var c=o,m=c>>1,v=m+i/2;!(m>=v)&&we[m];)++m;if(c=m<<1,c-o>32&&ot)return ot.decode(Y.subarray(o,c));for(var b="",w=0;!(w>=i/2);++w){var T=ie[o+w*2>>1];if(T==0)break;b+=String.fromCharCode(T)}return b},Wn=(o,i,c)=>{if(c===void 0&&(c=2147483647),c<2)return 0;c-=2;for(var m=i,v=c<o.length*2?c/2:o.length,b=0;b<v;++b){var w=o.charCodeAt(b);ie[i>>1]=w,i+=2}return ie[i>>1]=0,i-m},Wt=o=>o.length*2,Vn=(o,i)=>{for(var c=0,m="";!(c>=i/4);){var v=Se[o+c*4>>2];if(v==0)break;if(++c,v>=65536){var b=v-65536;m+=String.fromCharCode(55296|b>>10,56320|b&1023)}else m+=String.fromCharCode(v)}return m},Vt=(o,i,c)=>{if(c===void 0&&(c=2147483647),c<4)return 0;for(var m=i,v=m+c-4,b=0;b<o.length;++b){var w=o.charCodeAt(b);if(w>=55296&&w<=57343){var T=o.charCodeAt(++b);w=65536+((w&1023)<<10)|T&1023}if(Se[i>>2]=w,i+=4,i+4>v)break}return Se[i>>2]=0,i-m},jt=o=>{for(var i=0,c=0;c<o.length;++c){var m=o.charCodeAt(c);m>=55296&&m<=57343&&++c,i+=4}return i},jn=function(o,i,c){c=ve(c);var m,v,b,w,T;i===2?(m=it,v=Wn,w=Wt,b=()=>we,T=1):i===4&&(m=Vn,v=Vt,w=jt,b=()=>U,T=2),Ae(o,{name:c,fromWireType:function(O){for(var E=U[O>>2],B=b(),W,V=O+4,J=0;J<=E;++J){var ne=O+4+J*i;if(J==E||B[ne>>T]==0){var Ee=ne-V,de=m(V,Ee);W===void 0?W=de:(W+="\0",W+=de),V=ne+i}}return $e(O),W},toWireType:function(O,E){typeof E!="string"&&z(`Cannot pass non-string to C++ string type ${c}`);var B=w(E),W=ut(4+B+i);return U[W>>2]=B>>T,v(E,W+4,B+i),O!==null&&O.push($e,W),W},argPackAdvance:8,readValueFromPointer:Ir,destructorFunction:function(O){$e(O)}})};function Gn(o,i){i=ve(i),Ae(o,{isVoid:!0,name:i,argPackAdvance:0,fromWireType:function(){},toWireType:function(c,m){}})}var zn={};function Gt(o){var i=zn[o];return i===void 0?ve(o):i}var _e=[];function zt(o,i,c,m){o=_e[o],i=er.toValue(i),c=Gt(c),o(i,c,null,m)}function Kn(o){var i=_e.length;return _e.push(o),i}function Xn(o,i){var c=Ye[o];return c===void 0&&z(i+" has unknown type "+xt(o)),c}function xr(o,i){for(var c=new Array(o),m=0;m<o;++m)c[m]=Xn(U[i+m*4>>2],"parameter "+m);return c}var Kt=[];function at(o,i){var c=xr(o,i),m=c[0],v=m.name+"_$"+c.slice(1).map(function(ne){return ne.name}).join("_")+"$",b=Kt[v];if(b!==void 0)return b;for(var w=["retType"],T=[m],O="",E=0;E<o-1;++E)O+=(E!==0?", ":"")+"arg"+E,w.push("argType"+E),T.push(c[1+E]);for(var B=Cr("methodCaller_"+v),W="return function "+B+`(handle, name, destructors, args) {
|
|
38
|
+
`,V=0,E=0;E<o-1;++E)W+=" var arg"+E+" = argType"+E+".readValueFromPointer(args"+(V?"+"+V:"")+`);
|
|
39
|
+
`,V+=c[E+1].argPackAdvance;W+=" var rv = handle[name]("+O+`);
|
|
40
|
+
`;for(var E=0;E<o-1;++E)c[E+1].deleteObject&&(W+=" argType"+E+".deleteObject(arg"+E+`);
|
|
41
|
+
`);m.isVoid||(W+=` return retType.toWireType(destructors, rv);
|
|
42
|
+
`),W+=`};
|
|
43
|
+
`,w.push(W);var J=Ut(Function,w).apply(null,T);return b=Kn(J),Kt[v]=b,b}var qn=()=>{ir("")},Xt;Xt=()=>performance.now();var Yn=(o,i,c)=>Y.copyWithin(o,i,i+c),Jn=o=>{ir("OOM")},Zn=o=>{var i=Y.length;o>>>=0,Jn(o)},Qn=[null,[],[]],eo=(o,i)=>{var c=Qn[o];i===0||i===10?((o===1?lr:ae)(rr(c,0)),c.length=0):c.push(i)},st={varargs:void 0,get(){st.varargs+=4;var o=Se[st.varargs-4>>2];return o},getStr(o){var i=Bt(o);return i}},ro=(o,i,c,m)=>{for(var v=0,b=0;b<c;b++){var w=U[i>>2],T=U[i+4>>2];i+=8;for(var O=0;O<T;O++)eo(o,Y[w+O]);v+=T}return U[m>>2]=v,0};En(),le=s.BindingError=class extends Error{constructor(i){super(i),this.name="BindingError"}},Je=s.InternalError=class extends Error{constructor(i){super(i),this.name="InternalError"}},hr(),Yr(),gr(),kt=s.UnboundTypeError=On(Error,"UnboundTypeError"),xn(),Nn();var to={o:zr,r:bn,m:wn,q:Dn,p:tt,d:Nt,u:$n,k:Mn,b:Fn,a:Bn,j:Ht,g:jn,n:Gn,e:zt,l:Lt,h:at,f:qn,c:Xt,t:Yn,s:Zn,i:ro},po=yt(),no=()=>(no=ee.w)(),$e=o=>($e=ee.x)(o),ut=o=>(ut=ee.y)(o),qt=o=>(qt=ee.A)(o),oo=s.__embind_initialize_bindings=()=>(oo=s.__embind_initialize_bindings=ee.B)(),io=()=>(io=ee.__errno_location)(),Yt=o=>(Yt=ee.C)(o),ct=s.dynCall_jiji=(o,i,c,m,v)=>(ct=s.dynCall_jiji=ee.D)(o,i,c,m,v),Ur;qe=function o(){Ur||Jt(),Ur||(qe=o)};function Jt(){if(Xe>0||(pn(),Xe>0))return;function o(){Ur||(Ur=!0,s.calledRun=!0,!Mr&&(mn(),g(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),hn()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),o()},1)):o()}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return Jt(),p.ready}})(),Io=ei;var un=class extends Ge{constructor(p){super(Io,p!=null&&p.wasmPath?fetch(p.wasmPath).then(s=>s.arrayBuffer()):void 0,p==null?void 0:p.workerMode,p==null?void 0:p.canvas,p==null?void 0:p.yuvMode)}};var ri="web.sdk.qcloud.com";var ti=`https://${ri}/trtc/webrtc/v5/doc`;var Wi=`${ti}/zh-cn/`;var Oo=(A=>(A[A.TRACE=0]="TRACE",A[A.DEBUG=1]="DEBUG",A[A.INFO=2]="INFO",A[A.WARN=3]="WARN",A[A.ERROR=4]="ERROR",A[A.NONE=5]="NONE",A))(Oo||{});var Vi=7*24*3600*1e3;var cn={CANVAS:"canvas",AUDIO:"audio",VIDEO:"video",SCREEN:"screen",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",SMALL_VIDEO:"smallVideo",FACING_MODE_USER:"user",FACING_MODE_ENVIRONMENT:"environment",MUTE:"mute",UNMUTE:"unmute",ENDED:"ended",PLAYING:"playing",PAUSE:"pause",ERROR:"error",LOADEDDATA:"loadeddata",LOADEDMETADATA:"loadedmetadata",AUDIO_INPUT:"audioinput",VIDEO_INPUT:"videoinput",DETAIL:"detail",TEXT:"text",MAIN:"main",BACKUP:"backup",BANNED:"banned",KICK:"kick",USER_TIME_OUT:"user_time_out",ROOM_DISBAND:"room_disband",SEI_MESSAGE:"sei-message",ADD:"add",REMOVE:"remove",REPLACE:"replace",TRACK:"track",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",TRANSCEIVER_DIRECTION_SENDONLY:"sendonly",TRANSCEIVER_DIRECTION_RECVONLY:"recvonly",ENTER_PICTURE_IN_PICTURE:"enterpictureinpicture",LEAVE_PICTURE_IN_PICTURE:"leavepictureinpicture"};var ji=cn.MAIN,Gi=cn.AUXILIARY;var zi=cn.BIG,Ki=cn.SMALL,Xi=10*1e3;var qi=Object.keys(Oo);var Yi=10*1e3;var va=typeof window!="undefined"&&typeof window.glog=="function"?window.glog:()=>{};function lo(){return!performance||!performance.now?Date.now():Math.floor(performance.now())}var{toString:ga}=Object.prototype;var dn=class dn{constructor(p){this.core=p;fe(this,"contextMap",new Map);fe(this,"decodeProcessorMap",new WeakMap);this.addKVReportBeforeExitRoom=this.addKVReportBeforeExitRoom.bind(this),this.createDecoder=this.createDecoder.bind(this),this.core.innerEmitter.on("51",this.addKVReportBeforeExitRoom)}getAlias(){return"videoDecoder"}getGroup(p){return p!=null&&p.track?`${p.track.userId}${p.track.streamType}`:"*"}getName(){return dn.Name}getValidateRule(p){return{type:this.core.enums.BASIC_TYPE.Object}}createDecoder(p,s){switch(p){case"wasm":return this.core.rtcDectection.isSIMDSupported()?new un(Er(br({},s),{wasmPath:`${this.core.assetsPath}videodec_simd.wasm`})):new sn(Er(br({},s),{wasmPath:`${this.core.assetsPath}videodec.wasm`}));case"webCodecs":return new or;case"mse":throw new Error("mse decoder not supported yet");default:throw new Error("Unsupported decoder type")}}start(p){this.decodeProcessorMap.set(p.track,this.decode(p)),this.core.room.videoManager.addDecodeProcessor({processor:({frame:s,track:g})=>{var S;return((S=this.decodeProcessorMap.get(g))==null?void 0:S({frame:s,track:g}))||s},type:3})}decode(p){let{pipe:s,take:g,subscribe:S}=this.core.rx;return({frame:I,track:A})=>{if(A!==p.track||I.type==="empty")return I;if(this.contextMap.has(A))return this.contextMap.get(A).decode(I);let j=this.core.room.videoManager.createDecodeContext(Er(br({},p),{createDecoder:this.createDecoder}));return s(j.trackDoneOB,g(1),S(()=>{this.core.clearStarted(this,this.getGroup(p)),this.stop({track:A})})),this.contextMap.set(A,j),j.decode(I)}}stop(p){if(!(p!=null&&p.track))this.contextMap.forEach((s,g)=>{s.close("stop"),this.contextMap.delete(g)});else{let s=this.contextMap.get(p.track);s&&(s.close("stop"),this.report(s,p.track),this.contextMap.delete(p.track))}this.contextMap.size===0&&this.core.room.videoManager.removeDecodeProcessor({type:3})}report(p,s){if(p.isReported)return;p.isReported=!0;let g=lo()-p.startPerformanceTime,S=this.getRemoteTrackFreezeDuration(s,p);g&&this.core.kvStatManager.addNumber({key:514800,value:Math.floor(S/g*100),split:1}),p.inputFrameCount&&this.core.kvStatManager.addNumber({key:514801,value:Math.floor(p.decodedFrameCount/p.inputFrameCount*100),split:1})}addKVReportBeforeExitRoom({room:p}){p===this.core.room&&this.contextMap.forEach((s,g)=>{this.report(s,g)})}update(p){let s=this.contextMap.get(p.track);if(s){if(p.type==="mock"){s.mock(this.core.enums.DECODE_FAILED_ERROR_CODE.TEST);return}s.close("update"),this.contextMap.set(p.track,this.core.room.videoManager.createDecodeContext(Er(br({},p),{createDecoder:this.createDecoder})))}}getRemoteTrackFreezeDuration(p,s){let g=this.core.room.badCaseDetector.getRenderFreezeMap().get(`${p.userId}_${p.streamType}`),S=0;return g&&g.freezeTimeline.forEach(({startTime:I,endTime:A})=>{I>s.startPerformanceTime&&(S+=A===0?lo()-I:A-I)}),S}destroy(){this.core.innerEmitter.off("51",this.addKVReportBeforeExitRoom)}};fe(dn,"Name","TRTCVideoDecoder");var ln=dn;var oi=ln;return zo(ii);})().default;
|