@4players/odin-plugin-web 1.7.0 → 1.8.0
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/lib/cjs/plugin/index.cjs +7 -7
- package/lib/cjs/worker/shared.cjs +4 -4
- package/lib/cjs/worker/unshared.cjs +4 -4
- package/lib/esm/plugin/index.mjs +7 -7
- package/lib/esm/worker/shared.mjs +4 -4
- package/lib/esm/worker/unshared.mjs +4 -4
- package/lib/index.d.ts +1 -2
- package/package.json +5 -5
- package/cmake/dependencies.cmake +0 -31
- package/cmake/options.cmake +0 -54
- package/esbuild.config.ts +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var $=(A,F)=>{for(var x in F)o(A,x,{get:F[x],enumerable:!0})},U=(A,F,x,D)=>{if(F&&typeof F=="object"||typeof F=="function")for(let r of M(F))!T.call(A,r)&&r!==x&&o(A,r,{get:()=>F[r],enumerable:!(D=P(F,r))||D.enumerable});return A};var V=A=>U(o({},"__esModule",{value:!0}),A);var ax={};$(ax,{createCaptureWorker:()=>ix,createPlaybackWorker:()=>ox});module.exports=V(ax);var J=require("@4players/odin-common");var f={};$(f,{AdditionalCaptureBlocks:()=>S,AdditionalPlaybackBlocks:()=>W,ClockJumpCheckInterval:()=>xx,ClockJumpThreshold:()=>Ax,ConnectInterval:()=>Cx,ConnectTimeout:()=>Bx,DefaultRefreshRate:()=>X,DefaultVideoCodec:()=>Ex,HealthCheckTimeout:()=>Z,MainConnectionPingInterval:()=>Fx,MaxNumberOfDecoders:()=>Q,MinDBFs:()=>a,MinTokenLifetime:()=>vx,MinTokenRefreshInterval:()=>tx,PlaybackPreload:()=>R,RenderQuantumSize:()=>Y,VadPreload:()=>z,WebRtcIceTimeout:()=>rx,WebRtcStatsSnapshotInterval:()=>Dx,WebRtcTimeout:()=>jx});var W=3,S=3,R=3,X=250,z=3,Q=512,Y=128,a=-758.596,Z=1e4,xx=1e3,Ax=1e4,Fx=3e3,Dx=1e3,rx=3e3,jx=1e4,Bx=5e3,vx=6e4,tx=5e3,Cx=[0,100,200,200,500],Ex="H264";function v(A,F,x){return A.postMessage(F,x)}function k(A,F){return new Promise(x=>{let D=r=>{let[j,B]=r.data;j===F&&(x(r.data[1]),A.removeEventListener("message",D))};A.addEventListener("message",D)})}function u(A,F){A.values[0]=F[0],A.values[1]=F[1]}function I(A,F){return A.values[2+F*5]}function g(A,F,x){let D=2+F*5+1;A.values[D+0]=x[0],A.values[D+1]=x[1]}function L(A){return A.values[0]!==0}function H(A){return A.values[1]}function y(A){return A.values[2]}function N(A,F){return A.values[3]=F}var C=require("@4players/odin-common"),K;function d(A,...F){let x=ex(F);K?K?.error(A,x):(0,C.error)(A,x)}function ex(...A){if(A.length===1&&typeof A[0]=="object"&&A[0]!==null)return{...A[0]};if(A.length>0)return{args:A}}var _={isSilent:!0,rmsDBFS:-758.596};function E(A){return A.connectionId*4294967296+A.mediaId}var b=[],e=[],n=class{constructor(F,x,D){this.audioContext=F;this.worklet=x;this.worker=D;this.availableIndexes=[];this.medias=new Map;D.addEventListener("message",this._OnMessages.bind(this))}receivePacket(F,x){v(this.worker,["playbackReceivePacket",{connectionId:F,packet:x}],[x.buffer])}addMedias(F,x,D=[1,1]){let r=[];for(let j of x){let B=this._GetFreeIndex();B!==void 0&&(this.medias.set(E({connectionId:F,mediaId:j}),{index:B}),r.push({connectionId:F,mediaId:j,index:B,volume:D}))}v(this.worker,["playbackUpdateMedias",{added:r,removed:[]}])}removeMedias(F,x){let D=[];for(let r of x){let j=E({connectionId:F,mediaId:r}),B=this.medias.get(j);B!==void 0&&(this.medias.delete(j),this.availableIndexes.push(B.index),D.push({connectionId:F,mediaId:r,index:B.index}))}v(this.worker,["playbackUpdateMedias",{added:[],removed:D}])}close(){v(this.worker,["close",void 0]),v(this.worklet.port,["close",void 0]);let F=b.indexOf(this.worker);F>=0&&b.splice(F,1);let x=e.indexOf(this.worklet);x>=0&&e.splice(x,1)}async dump(){return{playbackWorker:await i(this.worker),playbackWorklet:await i(this.worklet.port)}}_GetFreeIndex(){return this.availableIndexes.pop()}_OnMessages(F){}},l=class A{constructor(F,x,D,r,j){this.worklet=F;this.worker=x;this.sink=(B,t)=>{j.deref()!==void 0?D(B,t):(d("capture worker was left abandoned, aborting capture worker"),A.shutdown(F,x))},this.monitorSink=(B,t)=>{j.deref()!==void 0?r(B,t):(d("capture worker was left abandoned, aborting capture worker"),A.shutdown(F,x))},x.addEventListener("message",this._OnMessages.bind(this))}get context(){return this.worklet.context}setMedias(F){v(this.worker,["captureSetMedias",{connections:F}])}setVad(F){v(this.worker,["captureSetVad",F])}close(){A.shutdown(this.worklet,this.worker)}static shutdown(F,x){v(F.port,["close",void 0]),v(x,["close",void 0]);let D=b.indexOf(x);D>=0&&b.splice(D,1);let r=e.indexOf(F);r>=0&&e.splice(r,1)}async dump(){return{captureWorker:await i(this.worker),captureWorklet:await i(this.worklet.port)}}_OnMessages(F){let[x,D]=F.data;x==="sendPacket"&&(D.connectionId===0?this.monitorSink(D.connectionId,D.packet):this.sink(D.connectionId,D.packet))}};function q(A,F,x,D,r){return Promise.all([fx(A),bx(x,F,D,r)])}async function fx(A){let F=URL.createObjectURL(new Blob([A],{type:"text/javascript"})),x=new Worker(F,{type:"module",name:"odin worker"});return b.push(x),x}async function bx(A,F,x,D){try{let B=new AudioWorkletNode(A,x,D);return e.push(B),B}catch{}let r=URL.createObjectURL(new Blob([F],{type:"text/javascript"}));await A.audioWorklet.addModule(r);let j=new AudioWorkletNode(A,x,D);return e.push(j),j}function i(A){let{port1:F,port2:x}=new MessageChannel,{promise:D,resolve:r}=Promise.withResolvers();return x.onmessage=j=>r(j.data),setTimeout(()=>r("timeout"),100),v(A,["dump",{result:F}],[F]),D}var c=`"use strict";(()=>{var pn=Object.create;var kr=Object.defineProperty;var hn=Object.getOwnPropertyDescriptor;var mn=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty;var $n=(n,A)=>()=>(A||n((A={exports:{}}).exports,A),A.exports),Fn=(n,A)=>{for(var t in A)kr(n,t,{get:A[t],enumerable:!0})},vn=(n,A,t,e)=>{if(A&&typeof A=="object"||typeof A=="function")for(let i of mn(A))!In.call(n,i)&&i!==t&&kr(n,i,{get:()=>A[i],enumerable:!(e=hn(A,i))||e.enumerable});return n};var Ln=(n,A,t)=>(t=n!=null?pn(En(n)):{},vn(A||!n||!n.__esModule?kr(t,"default",{value:n,enumerable:!0}):t,n));var vt=$n((Ft,UA)=>{"use strict";var TA=(()=>{var n=globalThis.document?.currentScript?.src;return async function(A={}){var t,e=A,i=!!globalThis.window,d=!!globalThis.WorkerGlobalScope,q=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",C=d&&globalThis.name=="em-pthread",v=[],B="./this.program",pA=(r,j)=>{throw j};d&&(n=self.location.href);var P="",yt,xt;if(i||d){try{P=new URL(".",n).href}catch{}d&&(xt=r=>{var j=new XMLHttpRequest;return j.open("GET",r,!1),j.responseType="arraybuffer",j.send(null),new Uint8Array(j.response)}),yt=async r=>{var j=await fetch(r,{credentials:"same-origin"});if(j.ok)return j.arrayBuffer();throw new Error(j.status+" : "+j.url)}}var SA=console.log.bind(console),N=console.error.bind(console),_r,nA,hA=!1,z;function Dt(r){for(var j=0,s=r.length,l=new Uint8Array(s),o;j<s;++j)o=r.charCodeAt(j),l[j]=~o>>8&o;return l}var VA,Hr,yr;if(C){let r=function(j){try{var s=j.data,l=s.cmd;if(l==="load"){let o=[];self.onmessage=k=>o.push(k),yr=()=>{postMessage({cmd:"loaded"});for(let k of o)r(k);self.onmessage=r};for(let k of s.handlers)(!e[k]||e[k].proxy)&&(e[k]=(...a)=>{postMessage({cmd:"callHandler",handler:k,args:a})},k=="print"&&(SA=e[k]),k=="printErr"&&(N=e[k]));Y=s.wasmMemory,Nr(),nA=s.wasmModule,Or(),Nj()}else if(l==="run"){Wt(s.pthread_ptr),lr(s.pthread_ptr,0,0,1,0,0),h.threadInitTLS(),nr(s.pthread_ptr),WA||(Ij(),WA=!0);try{Rt(s.start_routine,s.arg)}catch(o){if(o!="unwind")throw o}}else s.target==="setimmediate"||(l==="checkMailbox"?WA&&yA():l&&(N(\`worker: received unknown command \${l}\`),N(s)))}catch(o){throw $j(),o}};var Ds=r,WA=!1;self.onunhandledrejection=j=>{throw j.reason||j},self.onmessage=r}var V,x,mA,sA,Q,I,xr,EA,W,Dr,Br=!1;function Nr(){var r=Y.buffer;V=new Int8Array(r),mA=new Int16Array(r),e.HEAPU8=x=new Uint8Array(r),sA=new Uint16Array(r),e.HEAP32=Q=new Int32Array(r),e.HEAPU32=I=new Uint32Array(r),e.HEAPF32=xr=new Float32Array(r),EA=new Float64Array(r),W=new BigInt64Array(r),Dr=new BigUint64Array(r)}function Bt(){if(!C){if(e.wasmMemory)Y=e.wasmMemory;else{var r=e.INITIAL_MEMORY||16777216;Y=new WebAssembly.Memory({initial:r/65536,maximum:r/65536,shared:!0})}Nr()}}function Nt(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Pt(e.preRun.shift());Tr(Ur)}function Kr(){if(Br=!0,C)return yr();tA.F()}function Kt(){if(!C){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Vt(e.postRun.shift());Tr(Rr)}}function RA(r){e.onAbort?.(r),r="Aborted("+r+")",N(r),hA=!0,r+=". Build with -sASSERTIONS for more info.";var j=new WebAssembly.RuntimeError(r);throw Hr?.(j),j}var Jr;function Jt(){return Dt(\`\\0asm\\0\\0\\0\\xB2>\\\`\\x7F\\0\\\`\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\\`\\0\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`||\\\`\\x7F}\\\`}}\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\0\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\b\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F~\\x7F~\\\`\\x7F\\x7F}\\\`\\x7F}}\\\`\\x7F\\x7F}}\\0\\\`
|
|
2
2
|
\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`|}\\\`|\\x7F|\\\`\\x7F\\x7F}\\0\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\` \\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\f\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\b\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F|\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F|}\\\`\\0|\\\`\\x7F\\x7F\\x7F~~\\0\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F|\\\`\\r\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F~\\x7F\\x7F\\x7F\\\`\\x7F\\x7F|\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\x7F\\x7F\\x7F\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F}}\\x7F\\x7F\\x7F\\x7F\\0\\\`~\\x7F\\x7F\\\` \\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\x7F\\x7F\\\`\\x7F\\x7F|\\x7F\\\`||\\x7F|\\\`|||\\\`\\x7F\\x7F\\x7F|\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\v\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\\`\\f\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`}\\x7F\\x7F\\\`|\\x7F\\x7F\\\`\\x7F\\x7F\\x7F}\\\`\\x7F}\\x7F\\0\\\`\\x7F\\x7F}\\x7F\\x7F\\x7F}\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F}\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F}}\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F|\\\`\\x7F\\x7F|\\0\\xBFab\\0ac\\0ad\\0ae\\0af\\0!ag\\0ah\\0"ai\\0aj\\0
|
|
3
3
|
ak\\0#al\\0am\\0 an\\0$ao\\0ap\\0aq\\0ar\\0\\0as\\0\\0at\\0au\\0av\\0%aw\\0ax\\0\\bay\\0\\0az\\0\\0aA\\0\\baB\\0\\0aC\\0\\baD\\0\\0aE\\0aa\\x80\\x80\\xFB\\xF9\\0\\x07\\f&\\0\\f\\x07\\f\\f\\0\\x07\\0\\x07'(
|
|
4
4
|
\\b\\v)\\x07*\\0\\f+,-.\\v\\0\\0\\x07\\0\\b\\b\\x1B
|
|
@@ -3209,7 +3209,7 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3209
3209
|
|
|
3210
3210
|
|
|
3211
3211
|
\\x07\\0\\0 \\v\\0\\0 \\v\\0\\0\\v\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\v\\r\\0\\r\\0\\0\\0 \\0\\0\\0 \\0\\0\\0!\\f\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\f\\0\\0\\0\\0\\0\\f\\0\\0\\f!\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0*\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 !\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\xC0 \\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\x000123456789ABCDEF\\xA0\\0\\xF8\\0NSt3__214__shared_countE\\0\\0\\0\\0$\\0,\\0\\0\\0\\0\\0\\0\\0\\0\\xF0\\0\\0\\0\\0\\0NSt3__219__shared_weak_countE\\0\\0\\0\\xC8\\0X\\0h\\0N10__cxxabiv116__shim_type_infoE\\0\\0\\0\\0\\xC8\\0\\x88\\0L\\0N10__cxxabiv117__class_type_infoE\\0\\0\\0\\xC8\\0\\xB8\\0L\\0N10__cxxabiv117__pbase_type_infoE\\0\\0\\0\\xC8\\0\\xE8\\0\\xAC\\0N10__cxxabiv119__pointer_type_infoE\\0\\xC8\\0\\0L\\0N10__cxxabiv120__function_type_infoE\\0\\0\\0\\0\\xC8\\0L\\0\\xAC\\0N10__cxxabiv129__pointer_to_member_type_infoE\\0\\0\\0\\0\\0\\0\\0\\x98\\0n\\0\\0\\0o\\0\\0\\0p\\0\\0\\0q\\0\\0\\0r\\0\\0\\0\\xC8\\0\\xA4\\0L\\0N10__cxxabiv123__fundamental_type_infoE\\0\\x84\\0\\xD4\\0v\\0Dn\\0\\0\\0\\0\\x84\\0\\xE4\\0b\\0\\0\\0\\x84\\0\\xF0\\0c\\0\\0\\0\\x84\\0\\xFC\\0h\\0\\0\\0\\x84\\0\\b\\0a\\0\\0\\0\\x84\\0\\0s\\0\\0\\0\\x84\\0 \\0t\\0\\0\\0\\x84\\0,\\0i\\0\\0\\0\\x84\\x008\\0j\\0\\0\\0\\x84\\0D\\0l\\0\\0\\0\\x84\\0P\\0m\\0\\0\\0\\x84\\0\\\\\\0x\\0\\0\\0\\x84\\0h\\0y\\0\\0\\0\\x84\\0t\\0f\\0\\0\\0\\x80\\0\\x88\\0\\0\\0\\0\\0l\\0Pf\\0\\0\\x84\\0\\x94\\0d\\0\\0\\0\\0\\0\\0\\0|\\0n\\0\\0\\0s\\0\\0\\0p\\0\\0\\0q\\0\\0\\0t\\0\\0\\0u\\0\\0\\0v\\0\\0\\0w\\0\\0\\0\\0\\0\\0\\0\\xE8\\0n\\0\\0\\0x\\0\\0\\0p\\0\\0\\0q\\0\\0\\0t\\0\\0\\0y\\0\\0\\0z\\0\\0\\0{\\0\\0\\0\\xC8\\0\\xF4\\0|\\0N10__cxxabiv120__si_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\0D\\0n\\0\\0\\0|\\0\\0\\0p\\0\\0\\0q\\0\\0\\0t\\0\\0\\0}\\0\\0\\0~\\0\\0\\0\\x7F\\0\\0\\0\\xC8\\0P\\0|\\0N10__cxxabiv121__vmi_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\xDC\\0n\\0\\0\\0\\x80\\0\\0\\0p\\0\\0\\0q\\0\\0\\0\\x81\\0\\0\\0\\0\\0\\0\\0\\xDC\\0F\\0\\0\\0\\x82\\0\\0\\0\\x83\\0\\0\\0\\xA0\\0\\xB0\\0St9exception\\0\\0\\0\\0\\xC8\\0\\xCC\\0\\xA8\\0St9bad_alloc\\0\\0\\0\\0\\xC8\\0\\xE8\\0\\xC0\\0St20bad_array_new_length\\0\\0\\0\\0\\0\\0\\0\\0\\0H\\0\\0\\0\\x84\\0\\0\\0\\x85\\0\\0\\0\\xC8\\0$\\0\\xA8\\0St11logic_error\\0\\0\\0\\0\\0H\\0H\\0\\0\\0\\x86\\0\\0\\0\\x85\\0\\0\\0\\xC8\\0T\\0\\0St12length_error\\0\\0\\0\\0\\xA0\\0p\\0St9type_info\\0\\\`\\x80\\0\\x80\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0f\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0g\\0\\0\\0h\\0\\0\\0P\\x1B\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFFY\\xC0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0i\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0g\\0\\0\\0j\\0\\0\\0X\\x1B\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\xFF\\xFF\\xFF\\xFF
|
|
3212
|
-
\\fX\\0\\x90!\\0\\0\\0\\0\`)}function Hs(r){return r}async function bt(r){return r}async function Ot(r,j){try{var s=await bt(r),l=await WebAssembly.instantiate(s,j);return l}catch(o){N(\`failed to asynchronously prepare wasm: \${o}\`),RA(o)}}async function wt(r,j,s){return Ot(j,s)}function br(){Cn();var r={a:Bj};return r}async function Or(){function r(a,u){return tA=a.exports,Xt(tA.M),fn(tA),nA=u,tA}function j(a){return r(a.instance,a.module)}var s=br();if(e.instantiateWasm)return new Promise((a,u)=>{e.instantiateWasm(s,(c,f)=>{a(r(c,f))})});if(C){var l=new WebAssembly.Instance(nA,br());return r(l,nA)}Jr??=Jt();var o=await wt(_r,Jr,s),k=j(o);return k}class wr{name="ExitStatus";constructor(j){this.message=\`Program terminated with exit(\${j})\`,this.status=j}}var Pr=r=>{r.terminate(),r.onmessage=j=>{}},Mr=r=>{var j=h.pthreads[r];h.returnWorkerToPool(j)},Tr=r=>{for(;r.length>0;)r.shift()(e)},Ur=[],Pt=r=>Ur.push(r),Mt=r=>{var j=h.getNewWorker();if(!j)return 6;h.runningWorkers.push(j),h.pthreads[r.pthread_ptr]=j,j.pthread_ptr=r.pthread_ptr;var s={cmd:"run",start_routine:r.startRoutine,arg:r.arg,pthread_ptr:r.pthread_ptr};return j.postMessage(s,r.transferList),0},XA=0,zA=()=>YA||XA>0,Tt=()=>xj(),Sr=r=>Hj(r),Ut=r=>yj(r),iA=(r,j,s,...l)=>{var o=8*l.length*2,k=Tt(),a=Ut(o),u=a>>3;for(var c of l)typeof c=="bigint"?(W[u++]=1n,W[u++]=c):(W[u++]=0n,EA[u++]=c);var f=vj(r,j,o,a,s);return Sr(k),f};function Vr(r){if(C)return iA(0,0,1,r);z=r,zA()||(h.terminateAllThreads(),e.onExit?.(r),hA=!0),pA(r,new wr(r))}function Wr(r){if(C)return iA(1,0,0,r);QA(r)}var St=(r,j)=>{if(z=r,C)throw Wr(r),"unwind";Vr(r)},QA=St,h={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){C||h.initMainThread()},initMainThread(){},terminateAllThreads:()=>{for(var r of h.runningWorkers)Pr(r);for(var r of h.unusedWorkers)Pr(r);h.unusedWorkers=[],h.runningWorkers=[],h.pthreads={}},returnWorkerToPool:r=>{var j=r.pthread_ptr;delete h.pthreads[j],h.unusedWorkers.push(r),h.runningWorkers.splice(h.runningWorkers.indexOf(r),1),r.pthread_ptr=0,Lj(j)},threadInitTLS(){h.tlsInitFunctions.forEach(r=>r())},loadWasmModuleToWorker:r=>new Promise(j=>{r.onmessage=k=>{var a=k.data,u=a.cmd;if(a.targetThread&&a.targetThread!=xA()){var c=h.pthreads[a.targetThread];c?c.postMessage(a,a.transferList):N(\`Internal error! Worker sent a message "\${u}" to target pthread \${a.targetThread}, but that thread no longer exists!\`);return}u==="checkMailbox"?yA():u==="spawnThread"?Mt(a):u==="cleanupThread"?Gj(()=>Mr(a.thread)):u==="loaded"?(r.loaded=!0,j(r)):a.target==="setimmediate"?r.postMessage(a):u==="callHandler"?e[a.handler](...a.args):u&&N(\`worker sent an unknown command \${u}\`)},r.onerror=k=>{var a="worker sent an error!";throw N(\`\${a} \${k.filename}:\${k.lineno}: \${k.message}\`),k};var s=[],l=["onExit","onAbort","print","printErr"];for(var o of l)e.propertyIsEnumerable(o)&&s.push(o);r.postMessage({cmd:"load",handlers:s,wasmMemory:Y,wasmModule:nA})}),allocateUnusedWorker(){var r,j=n;e.mainScriptUrlOrBlob&&(j=e.mainScriptUrlOrBlob,typeof j!="string"&&(j=URL.createObjectURL(j))),r=new Worker(j,{name:"em-pthread"}),h.unusedWorkers.push(r)},getNewWorker(){return h.unusedWorkers.length==0&&(h.allocateUnusedWorker(),h.loadWasmModuleToWorker(h.unusedWorkers[0])),h.unusedWorkers.pop()}},Rr=[],Vt=r=>Rr.push(r);function Wt(r){var j=I[r+52>>2],s=I[r+56>>2],l=j-s;_j(j,l),Sr(j)}var Xr=[],zr=r=>{var j=Xr[r];return j||(Xr[r]=j=Dj.get(r)),j},Rt=(r,j)=>{XA=0,YA=0;var s=zr(r)(j);function l(o){if(zA()){z=o;return}or(o)}l(s)},YA=!0,Xt=r=>h.tlsInitFunctions.push(r),Y;class zt{constructor(j){this.excPtr=j,this.ptr=j-24}set_type(j){I[this.ptr+4>>2]=j}get_type(){return I[this.ptr+4>>2]}set_destructor(j){I[this.ptr+8>>2]=j}get_destructor(){return I[this.ptr+8>>2]}set_caught(j){j=j?1:0,V[this.ptr+12]=j}get_caught(){return V[this.ptr+12]!=0}set_rethrown(j){j=j?1:0,V[this.ptr+13]=j}get_rethrown(){return V[this.ptr+13]!=0}init(j,s){this.set_adjusted_ptr(0),this.set_type(j),this.set_destructor(s)}set_adjusted_ptr(j){I[this.ptr+16>>2]=j}get_adjusted_ptr(){return I[this.ptr+16>>2]}}var Qr=0,Qt=0,Yt=(r,j,s)=>{var l=new zt(r);throw l.init(j,s),Qr=r,Qt++,Qr},Zt=()=>RA(""),L=r=>{for(var j="";;){var s=x[r++];if(!s)return j;j+=String.fromCharCode(s)}},Z={},AA={},IA={},lA=class extends Error{constructor(j){super(j),this.name="BindingError"}},p=r=>{throw new lA(r)};function Ae(r,j,s={}){var l=j.name;if(r||p(\`type "\${l}" must have a positive integer typeid pointer\`),AA.hasOwnProperty(r)){if(s.ignoreDuplicateRegistrations)return;p(\`Cannot register type '\${l}' twice\`)}if(AA[r]=j,delete IA[r],Z.hasOwnProperty(r)){var o=Z[r];delete Z[r],o.forEach(k=>k())}}function K(r,j,s={}){return Ae(r,j,s)}var Yr=(r,j,s)=>{switch(j){case 1:return s?l=>V[l]:l=>x[l];case 2:return s?l=>mA[l>>1]:l=>sA[l>>1];case 4:return s?l=>Q[l>>2]:l=>I[l>>2];case 8:return s?l=>W[l>>3]:l=>Dr[l>>3];default:throw new TypeError(\`invalid integer width (\${j}): \${r}\`)}},re=(r,j,s,l,o)=>{j=L(j);let k=l===0n,a=u=>u;if(k){let u=s*8;a=c=>BigInt.asUintN(u,c),o=a(o)}K(r,{name:j,fromWireType:a,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Yr(j,s,!k),destructorFunction:null})},je=(r,j,s,l)=>{j=L(j),K(r,{name:j,fromWireType:function(o){return!!o},toWireType:function(o,k){return k?s:l},readValueFromPointer:function(o){return this.fromWireType(x[o])},destructorFunction:null})},te=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),ZA=r=>{function j(s){return s.$$.ptrType.registeredClass.name}p(j(r)+" instance already deleted")},Ar=!1,Zr=r=>{},ee=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},Aj=r=>{r.count.value-=1;var j=r.count.value===0;j&&ee(r)},oA=r=>globalThis.FinalizationRegistry?(Ar=new FinalizationRegistry(j=>{Aj(j.$$)}),oA=j=>{var s=j.$$,l=!!s.smartPtr;if(l){var o={$$:s};Ar.register(j,o,j)}return j},Zr=j=>Ar.unregister(j),oA(r)):(oA=j=>j,r),$A=[],ne=()=>{for(;$A.length;){var r=$A.pop();r.$$.deleteScheduled=!1,r.delete()}},rj,se=()=>{let r=FA.prototype;Object.assign(r,{isAliasOf(s){if(!(this instanceof FA)||!(s instanceof FA))return!1;var l=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var k=s.$$.ptrType.registeredClass,a=s.$$.ptr;l.baseClass;)o=l.upcast(o),l=l.baseClass;for(;k.baseClass;)a=k.upcast(a),k=k.baseClass;return l===k&&o===a},clone(){if(this.$$.ptr||ZA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=oA(Object.create(Object.getPrototypeOf(this),{$$:{value:te(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&p("Object already scheduled for deletion"),Zr(this),Aj(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&p("Object already scheduled for deletion"),$A.push(this),$A.length===1&&rj&&rj(ne),this.$$.deleteScheduled=!0,this}});let j=Symbol.dispose;j&&(r[j]=r.delete)};function FA(){}var jj=(r,j)=>Object.defineProperty(j,"name",{value:r}),tj={},ej=(r,j,s)=>{if(r[j].overloadTable===void 0){var l=r[j];r[j]=function(...o){return r[j].overloadTable.hasOwnProperty(o.length)||p(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${r[j].overloadTable})!\`),r[j].overloadTable[o.length].apply(this,o)},r[j].overloadTable=[],r[j].overloadTable[l.argCount]=l}},nj=(r,j,s)=>{e.hasOwnProperty(r)?((s===void 0||e[r].overloadTable!==void 0&&e[r].overloadTable[s]!==void 0)&&p(\`Cannot register public name '\${r}' twice\`),ej(e,r,r),e[r].overloadTable.hasOwnProperty(s)&&p(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),e[r].overloadTable[s]=j):(e[r]=j,e[r].argCount=s)},ie=48,le=57,oe=r=>{r=r.replace(/[^a-zA-Z0-9_]/g,"$");var j=r.charCodeAt(0);return j>=ie&&j<=le?\`_\${r}\`:r};function ae(r,j,s,l,o,k,a,u){this.name=r,this.constructor=j,this.instancePrototype=s,this.rawDestructor=l,this.baseClass=o,this.getActualType=k,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}var vA=(r,j,s)=>{for(;j!==s;)j.upcast||p(\`Expected null or instance of \${s.name}, got an instance of \${j.name}\`),r=j.upcast(r),j=j.baseClass;return r},rr=r=>{if(r===null)return"null";var j=typeof r;return j==="object"||j==="array"||j==="function"?r.toString():""+r};function ke(r,j){if(j===null)return this.isReference&&p(\`null is not a valid \${this.name}\`),0;j.$$||p(\`Cannot pass "\${rr(j)}" as a \${this.name}\`),j.$$.ptr||p(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=j.$$.ptrType.registeredClass,l=vA(j.$$.ptr,s,this.registeredClass);return l}function ue(r,j){var s;if(j===null)return this.isReference&&p(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,s),s):0;(!j||!j.$$)&&p(\`Cannot pass "\${rr(j)}" as a \${this.name}\`),j.$$.ptr||p(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&j.$$.ptrType.isConst&&p(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);var l=j.$$.ptrType.registeredClass;if(s=vA(j.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(j.$$.smartPtr===void 0&&p("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:j.$$.smartPtrType===this?s=j.$$.smartPtr:p(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=j.$$.smartPtr;break;case 2:if(j.$$.smartPtrType===this)s=j.$$.smartPtr;else{var o=j.clone();s=this.rawShare(s,er.toHandle(()=>o.delete())),r!==null&&r.push(this.rawDestructor,s)}break;default:p("Unsupported sharing policy")}return s}function ce(r,j){if(j===null)return this.isReference&&p(\`null is not a valid \${this.name}\`),0;j.$$||p(\`Cannot pass "\${rr(j)}" as a \${this.name}\`),j.$$.ptr||p(\`Cannot pass deleted object as a pointer of type \${this.name}\`),j.$$.ptrType.isConst&&p(\`Cannot convert argument of type \${j.$$.ptrType.name} to parameter type \${this.name}\`);var s=j.$$.ptrType.registeredClass,l=vA(j.$$.ptr,s,this.registeredClass);return l}function LA(r){return this.fromWireType(I[r>>2])}var sj=(r,j,s)=>{if(j===s)return r;if(s.baseClass===void 0)return null;var l=sj(r,j,s.baseClass);return l===null?null:s.downcast(l)},de={},qe=(r,j)=>{for(j===void 0&&p("ptr should not be undefined");r.baseClass;)j=r.upcast(j),r=r.baseClass;return j},fe=(r,j)=>(j=qe(r,j),de[j]),Ce=class extends Error{constructor(j){super(j),this.name="InternalError"}},gA=r=>{throw new Ce(r)},_A=(r,j)=>{(!j.ptrType||!j.ptr)&&gA("makeClassHandle requires ptr and ptrType");var s=!!j.smartPtrType,l=!!j.smartPtr;return s!==l&&gA("Both smartPtrType and smartPtr must be specified"),j.count={value:1},oA(Object.create(r,{$$:{value:j,writable:!0}}))};function Ge(r){var j=this.getPointee(r);if(!j)return this.destructor(r),null;var s=fe(this.registeredClass,j);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=j,s.$$.smartPtr=r,s.clone();var l=s.clone();return this.destructor(r),l}function o(){return this.isSmartPointer?_A(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:j,smartPtrType:this,smartPtr:r}):_A(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var k=this.registeredClass.getActualType(j),a=tj[k];if(!a)return o.call(this);var u;this.isConst?u=a.constPointerType:u=a.pointerType;var c=sj(j,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?_A(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:r}):_A(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var pe=()=>{Object.assign(HA.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor?.(r)},readValueFromPointer:LA,fromWireType:Ge})};function HA(r,j,s,l,o,k,a,u,c,f,G){this.name=r,this.registeredClass=j,this.isReference=s,this.isConst=l,this.isSmartPointer=o,this.pointeeType=k,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=f,this.rawDestructor=G,!o&&j.baseClass===void 0?l?(this.toWireType=ke,this.destructorFunction=null):(this.toWireType=ce,this.destructorFunction=null):this.toWireType=ue}var ij=(r,j,s)=>{e.hasOwnProperty(r)||gA("Replacing nonexistent public symbol"),e[r].overloadTable!==void 0&&s!==void 0?e[r].overloadTable[s]=j:(e[r]=j,e[r].argCount=s)},b=(r,j,s=!1)=>{r=L(r);function l(){var k=zr(j);return k}var o=l();return typeof o!="function"&&p(\`unknown function pointer with signature \${r}: \${j}\`),o};class he extends Error{}var me=r=>{var j=Ej(r),s=L(j);return O(j),s},rA=(r,j)=>{var s=[],l={};function o(k){if(!l[k]&&!AA[k]){if(IA[k]){IA[k].forEach(o);return}s.push(k),l[k]=!0}}throw j.forEach(o),new he(\`\${r}: \`+s.map(me).join([", "]))},M=(r,j,s)=>{r.forEach(u=>IA[u]=j);function l(u){var c=s(u);c.length!==r.length&&gA("Mismatched type converter count");for(var f=0;f<r.length;++f)K(r[f],c[f])}var o=new Array(j.length),k=[],a=0;for(let[u,c]of j.entries())AA.hasOwnProperty(c)?o[u]=AA[c]:(k.push(c),Z.hasOwnProperty(c)||(Z[c]=[]),Z[c].push(()=>{o[u]=AA[c],++a,a===k.length&&l(o)}));k.length===0&&l(o)},Ee=(r,j,s,l,o,k,a,u,c,f,G,m,$)=>{G=L(G),k=b(o,k),u&&=b(a,u),f&&=b(c,f),$=b(m,$);var E=oe(G);nj(E,function(){rA(\`Cannot construct \${G} due to unbound types\`,[l])}),M([r,j,s],l?[l]:[],F=>{F=F[0];var H,w;l?(H=F.registeredClass,w=H.instancePrototype):w=FA.prototype;var y=jj(G,function(...ar){if(Object.getPrototypeOf(this)!==kA)throw new lA(\`Use 'new' to construct \${G}\`);if(_.constructor_body===void 0)throw new lA(\`\${G} has no accessible constructor\`);var bj=_.constructor_body[ar.length];if(bj===void 0)throw new lA(\`Tried to invoke ctor of \${G} with invalid number of parameters (\${ar.length}) - expected (\${Object.keys(_.constructor_body).toString()}) parameters instead!\`);return bj.apply(this,ar)}),kA=Object.create(w,{constructor:{value:y}});y.prototype=kA;var _=new ae(G,y,kA,$,H,k,u,f);_.baseClass&&(_.baseClass.__derivedClasses??=[],_.baseClass.__derivedClasses.push(_));var Gn=new HA(G,_,!0,!1,!1),Kj=new HA(G+"*",_,!1,!1,!1),Jj=new HA(G+" const*",_,!1,!0,!1);return tj[r]={pointerType:Kj,constPointerType:Jj},ij(E,y),[Gn,Kj,Jj]})},jr=(r,j)=>{for(var s=[],l=0;l<r;l++)s.push(I[j+l*4>>2]);return s},lj=r=>{for(;r.length;){var j=r.pop(),s=r.pop();s(j)}};function oj(r){for(var j=1;j<r.length;++j)if(r[j]!==null&&r[j].destructorFunction===void 0)return!0;return!1}function Ie(r,j,s,l){var o=oj(r),k=r.length-2,a=[],u=["fn"];j&&u.push("thisWired");for(var c=0;c<k;++c)a.push(\`arg\${c}\`),u.push(\`arg\${c}Wired\`);a=a.join(","),u=u.join(",");var f=\`return function (\${a}) {
|
|
3212
|
+
\\fX\\0\\x90!\\0\\0\\0\\0\`)}function xs(r){return r}async function bt(r){return r}async function Ot(r,j){try{var s=await bt(r),l=await WebAssembly.instantiate(s,j);return l}catch(o){N(\`failed to asynchronously prepare wasm: \${o}\`),RA(o)}}async function wt(r,j,s){return Ot(j,s)}function br(){Cn();var r={a:Bj};return r}async function Or(){function r(a,u){return tA=a.exports,Xt(tA.M),fn(tA),nA=u,tA}function j(a){return r(a.instance,a.module)}var s=br();if(e.instantiateWasm)return new Promise((a,u)=>{e.instantiateWasm(s,(c,f)=>{a(r(c,f))})});if(C){var l=new WebAssembly.Instance(nA,br());return r(l,nA)}Jr??=Jt();var o=await wt(_r,Jr,s),k=j(o);return k}class wr{name="ExitStatus";constructor(j){this.message=\`Program terminated with exit(\${j})\`,this.status=j}}var Pr=r=>{r.terminate(),r.onmessage=j=>{}},Mr=r=>{var j=h.pthreads[r];h.returnWorkerToPool(j)},Tr=r=>{for(;r.length>0;)r.shift()(e)},Ur=[],Pt=r=>Ur.push(r),Mt=r=>{var j=h.getNewWorker();if(!j)return 6;h.runningWorkers.push(j),h.pthreads[r.pthread_ptr]=j,j.pthread_ptr=r.pthread_ptr;var s={cmd:"run",start_routine:r.startRoutine,arg:r.arg,pthread_ptr:r.pthread_ptr};return j.postMessage(s,r.transferList),0},XA=0,zA=()=>YA||XA>0,Tt=()=>xj(),Sr=r=>Hj(r),Ut=r=>yj(r),iA=(r,j,s,...l)=>{var o=8*l.length*2,k=Tt(),a=Ut(o),u=a>>3;for(var c of l)typeof c=="bigint"?(W[u++]=1n,W[u++]=c):(W[u++]=0n,EA[u++]=c);var f=vj(r,j,o,a,s);return Sr(k),f};function Vr(r){if(C)return iA(0,0,1,r);z=r,zA()||(h.terminateAllThreads(),e.onExit?.(r),hA=!0),pA(r,new wr(r))}function Wr(r){if(C)return iA(1,0,0,r);QA(r)}var St=(r,j)=>{if(z=r,C)throw Wr(r),"unwind";Vr(r)},QA=St,h={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){C||h.initMainThread()},initMainThread(){},terminateAllThreads:()=>{for(var r of h.runningWorkers)Pr(r);for(var r of h.unusedWorkers)Pr(r);h.unusedWorkers=[],h.runningWorkers=[],h.pthreads={}},returnWorkerToPool:r=>{var j=r.pthread_ptr;delete h.pthreads[j],h.unusedWorkers.push(r),h.runningWorkers.splice(h.runningWorkers.indexOf(r),1),r.pthread_ptr=0,Lj(j)},threadInitTLS(){h.tlsInitFunctions.forEach(r=>r())},loadWasmModuleToWorker:r=>new Promise(j=>{r.onmessage=k=>{var a=k.data,u=a.cmd;if(a.targetThread&&a.targetThread!=xA()){var c=h.pthreads[a.targetThread];c?c.postMessage(a,a.transferList):N(\`Internal error! Worker sent a message "\${u}" to target pthread \${a.targetThread}, but that thread no longer exists!\`);return}u==="checkMailbox"?yA():u==="spawnThread"?Mt(a):u==="cleanupThread"?Gj(()=>Mr(a.thread)):u==="loaded"?(r.loaded=!0,j(r)):a.target==="setimmediate"?r.postMessage(a):u==="callHandler"?e[a.handler](...a.args):u&&N(\`worker sent an unknown command \${u}\`)},r.onerror=k=>{var a="worker sent an error!";throw N(\`\${a} \${k.filename}:\${k.lineno}: \${k.message}\`),k};var s=[],l=["onExit","onAbort","print","printErr"];for(var o of l)e.propertyIsEnumerable(o)&&s.push(o);r.postMessage({cmd:"load",handlers:s,wasmMemory:Y,wasmModule:nA})}),allocateUnusedWorker(){var r,j=n;e.mainScriptUrlOrBlob&&(j=e.mainScriptUrlOrBlob,typeof j!="string"&&(j=URL.createObjectURL(j))),r=new Worker(j,{name:"em-pthread"}),h.unusedWorkers.push(r)},getNewWorker(){return h.unusedWorkers.length==0&&(h.allocateUnusedWorker(),h.loadWasmModuleToWorker(h.unusedWorkers[0])),h.unusedWorkers.pop()}},Rr=[],Vt=r=>Rr.push(r);function Wt(r){var j=I[r+52>>2],s=I[r+56>>2],l=j-s;_j(j,l),Sr(j)}var Xr=[],zr=r=>{var j=Xr[r];return j||(Xr[r]=j=Dj.get(r)),j},Rt=(r,j)=>{XA=0,YA=0;var s=zr(r)(j);function l(o){if(zA()){z=o;return}or(o)}l(s)},YA=!0,Xt=r=>h.tlsInitFunctions.push(r),Y;class zt{constructor(j){this.excPtr=j,this.ptr=j-24}set_type(j){I[this.ptr+4>>2]=j}get_type(){return I[this.ptr+4>>2]}set_destructor(j){I[this.ptr+8>>2]=j}get_destructor(){return I[this.ptr+8>>2]}set_caught(j){j=j?1:0,V[this.ptr+12]=j}get_caught(){return V[this.ptr+12]!=0}set_rethrown(j){j=j?1:0,V[this.ptr+13]=j}get_rethrown(){return V[this.ptr+13]!=0}init(j,s){this.set_adjusted_ptr(0),this.set_type(j),this.set_destructor(s)}set_adjusted_ptr(j){I[this.ptr+16>>2]=j}get_adjusted_ptr(){return I[this.ptr+16>>2]}}var Qr=0,Qt=0,Yt=(r,j,s)=>{var l=new zt(r);throw l.init(j,s),Qr=r,Qt++,Qr},Zt=()=>RA(""),L=r=>{for(var j="";;){var s=x[r++];if(!s)return j;j+=String.fromCharCode(s)}},Z={},AA={},IA={},lA=class extends Error{constructor(j){super(j),this.name="BindingError"}},p=r=>{throw new lA(r)};function Ae(r,j,s={}){var l=j.name;if(r||p(\`type "\${l}" must have a positive integer typeid pointer\`),AA.hasOwnProperty(r)){if(s.ignoreDuplicateRegistrations)return;p(\`Cannot register type '\${l}' twice\`)}if(AA[r]=j,delete IA[r],Z.hasOwnProperty(r)){var o=Z[r];delete Z[r],o.forEach(k=>k())}}function K(r,j,s={}){return Ae(r,j,s)}var Yr=(r,j,s)=>{switch(j){case 1:return s?l=>V[l]:l=>x[l];case 2:return s?l=>mA[l>>1]:l=>sA[l>>1];case 4:return s?l=>Q[l>>2]:l=>I[l>>2];case 8:return s?l=>W[l>>3]:l=>Dr[l>>3];default:throw new TypeError(\`invalid integer width (\${j}): \${r}\`)}},re=(r,j,s,l,o)=>{j=L(j);let k=l===0n,a=u=>u;if(k){let u=s*8;a=c=>BigInt.asUintN(u,c),o=a(o)}K(r,{name:j,fromWireType:a,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Yr(j,s,!k),destructorFunction:null})},je=(r,j,s,l)=>{j=L(j),K(r,{name:j,fromWireType:function(o){return!!o},toWireType:function(o,k){return k?s:l},readValueFromPointer:function(o){return this.fromWireType(x[o])},destructorFunction:null})},te=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),ZA=r=>{function j(s){return s.$$.ptrType.registeredClass.name}p(j(r)+" instance already deleted")},Ar=!1,Zr=r=>{},ee=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},Aj=r=>{r.count.value-=1;var j=r.count.value===0;j&&ee(r)},oA=r=>globalThis.FinalizationRegistry?(Ar=new FinalizationRegistry(j=>{Aj(j.$$)}),oA=j=>{var s=j.$$,l=!!s.smartPtr;if(l){var o={$$:s};Ar.register(j,o,j)}return j},Zr=j=>Ar.unregister(j),oA(r)):(oA=j=>j,r),$A=[],ne=()=>{for(;$A.length;){var r=$A.pop();r.$$.deleteScheduled=!1,r.delete()}},rj,se=()=>{let r=FA.prototype;Object.assign(r,{isAliasOf(s){if(!(this instanceof FA)||!(s instanceof FA))return!1;var l=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var k=s.$$.ptrType.registeredClass,a=s.$$.ptr;l.baseClass;)o=l.upcast(o),l=l.baseClass;for(;k.baseClass;)a=k.upcast(a),k=k.baseClass;return l===k&&o===a},clone(){if(this.$$.ptr||ZA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=oA(Object.create(Object.getPrototypeOf(this),{$$:{value:te(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&p("Object already scheduled for deletion"),Zr(this),Aj(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ZA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&p("Object already scheduled for deletion"),$A.push(this),$A.length===1&&rj&&rj(ne),this.$$.deleteScheduled=!0,this}});let j=Symbol.dispose;j&&(r[j]=r.delete)};function FA(){}var jj=(r,j)=>Object.defineProperty(j,"name",{value:r}),tj={},ej=(r,j,s)=>{if(r[j].overloadTable===void 0){var l=r[j];r[j]=function(...o){return r[j].overloadTable.hasOwnProperty(o.length)||p(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${r[j].overloadTable})!\`),r[j].overloadTable[o.length].apply(this,o)},r[j].overloadTable=[],r[j].overloadTable[l.argCount]=l}},nj=(r,j,s)=>{e.hasOwnProperty(r)?((s===void 0||e[r].overloadTable!==void 0&&e[r].overloadTable[s]!==void 0)&&p(\`Cannot register public name '\${r}' twice\`),ej(e,r,r),e[r].overloadTable.hasOwnProperty(s)&&p(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),e[r].overloadTable[s]=j):(e[r]=j,e[r].argCount=s)},ie=48,le=57,oe=r=>{r=r.replace(/[^a-zA-Z0-9_]/g,"$");var j=r.charCodeAt(0);return j>=ie&&j<=le?\`_\${r}\`:r};function ae(r,j,s,l,o,k,a,u){this.name=r,this.constructor=j,this.instancePrototype=s,this.rawDestructor=l,this.baseClass=o,this.getActualType=k,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}var vA=(r,j,s)=>{for(;j!==s;)j.upcast||p(\`Expected null or instance of \${s.name}, got an instance of \${j.name}\`),r=j.upcast(r),j=j.baseClass;return r},rr=r=>{if(r===null)return"null";var j=typeof r;return j==="object"||j==="array"||j==="function"?r.toString():""+r};function ke(r,j){if(j===null)return this.isReference&&p(\`null is not a valid \${this.name}\`),0;j.$$||p(\`Cannot pass "\${rr(j)}" as a \${this.name}\`),j.$$.ptr||p(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=j.$$.ptrType.registeredClass,l=vA(j.$$.ptr,s,this.registeredClass);return l}function ue(r,j){var s;if(j===null)return this.isReference&&p(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,s),s):0;(!j||!j.$$)&&p(\`Cannot pass "\${rr(j)}" as a \${this.name}\`),j.$$.ptr||p(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&j.$$.ptrType.isConst&&p(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);var l=j.$$.ptrType.registeredClass;if(s=vA(j.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(j.$$.smartPtr===void 0&&p("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:j.$$.smartPtrType===this?s=j.$$.smartPtr:p(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=j.$$.smartPtr;break;case 2:if(j.$$.smartPtrType===this)s=j.$$.smartPtr;else{var o=j.clone();s=this.rawShare(s,er.toHandle(()=>o.delete())),r!==null&&r.push(this.rawDestructor,s)}break;default:p("Unsupported sharing policy")}return s}function ce(r,j){if(j===null)return this.isReference&&p(\`null is not a valid \${this.name}\`),0;j.$$||p(\`Cannot pass "\${rr(j)}" as a \${this.name}\`),j.$$.ptr||p(\`Cannot pass deleted object as a pointer of type \${this.name}\`),j.$$.ptrType.isConst&&p(\`Cannot convert argument of type \${j.$$.ptrType.name} to parameter type \${this.name}\`);var s=j.$$.ptrType.registeredClass,l=vA(j.$$.ptr,s,this.registeredClass);return l}function LA(r){return this.fromWireType(I[r>>2])}var sj=(r,j,s)=>{if(j===s)return r;if(s.baseClass===void 0)return null;var l=sj(r,j,s.baseClass);return l===null?null:s.downcast(l)},de={},qe=(r,j)=>{for(j===void 0&&p("ptr should not be undefined");r.baseClass;)j=r.upcast(j),r=r.baseClass;return j},fe=(r,j)=>(j=qe(r,j),de[j]),Ce=class extends Error{constructor(j){super(j),this.name="InternalError"}},gA=r=>{throw new Ce(r)},_A=(r,j)=>{(!j.ptrType||!j.ptr)&&gA("makeClassHandle requires ptr and ptrType");var s=!!j.smartPtrType,l=!!j.smartPtr;return s!==l&&gA("Both smartPtrType and smartPtr must be specified"),j.count={value:1},oA(Object.create(r,{$$:{value:j,writable:!0}}))};function Ge(r){var j=this.getPointee(r);if(!j)return this.destructor(r),null;var s=fe(this.registeredClass,j);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=j,s.$$.smartPtr=r,s.clone();var l=s.clone();return this.destructor(r),l}function o(){return this.isSmartPointer?_A(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:j,smartPtrType:this,smartPtr:r}):_A(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var k=this.registeredClass.getActualType(j),a=tj[k];if(!a)return o.call(this);var u;this.isConst?u=a.constPointerType:u=a.pointerType;var c=sj(j,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?_A(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:r}):_A(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var pe=()=>{Object.assign(HA.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor?.(r)},readValueFromPointer:LA,fromWireType:Ge})};function HA(r,j,s,l,o,k,a,u,c,f,G){this.name=r,this.registeredClass=j,this.isReference=s,this.isConst=l,this.isSmartPointer=o,this.pointeeType=k,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=f,this.rawDestructor=G,!o&&j.baseClass===void 0?l?(this.toWireType=ke,this.destructorFunction=null):(this.toWireType=ce,this.destructorFunction=null):this.toWireType=ue}var ij=(r,j,s)=>{e.hasOwnProperty(r)||gA("Replacing nonexistent public symbol"),e[r].overloadTable!==void 0&&s!==void 0?e[r].overloadTable[s]=j:(e[r]=j,e[r].argCount=s)},b=(r,j,s=!1)=>{r=L(r);function l(){var k=zr(j);return k}var o=l();return typeof o!="function"&&p(\`unknown function pointer with signature \${r}: \${j}\`),o};class he extends Error{}var me=r=>{var j=Ej(r),s=L(j);return O(j),s},rA=(r,j)=>{var s=[],l={};function o(k){if(!l[k]&&!AA[k]){if(IA[k]){IA[k].forEach(o);return}s.push(k),l[k]=!0}}throw j.forEach(o),new he(\`\${r}: \`+s.map(me).join([", "]))},M=(r,j,s)=>{r.forEach(u=>IA[u]=j);function l(u){var c=s(u);c.length!==r.length&&gA("Mismatched type converter count");for(var f=0;f<r.length;++f)K(r[f],c[f])}var o=new Array(j.length),k=[],a=0;for(let[u,c]of j.entries())AA.hasOwnProperty(c)?o[u]=AA[c]:(k.push(c),Z.hasOwnProperty(c)||(Z[c]=[]),Z[c].push(()=>{o[u]=AA[c],++a,a===k.length&&l(o)}));k.length===0&&l(o)},Ee=(r,j,s,l,o,k,a,u,c,f,G,m,$)=>{G=L(G),k=b(o,k),u&&=b(a,u),f&&=b(c,f),$=b(m,$);var E=oe(G);nj(E,function(){rA(\`Cannot construct \${G} due to unbound types\`,[l])}),M([r,j,s],l?[l]:[],F=>{F=F[0];var H,w;l?(H=F.registeredClass,w=H.instancePrototype):w=FA.prototype;var y=jj(G,function(...ar){if(Object.getPrototypeOf(this)!==kA)throw new lA(\`Use 'new' to construct \${G}\`);if(_.constructor_body===void 0)throw new lA(\`\${G} has no accessible constructor\`);var bj=_.constructor_body[ar.length];if(bj===void 0)throw new lA(\`Tried to invoke ctor of \${G} with invalid number of parameters (\${ar.length}) - expected (\${Object.keys(_.constructor_body).toString()}) parameters instead!\`);return bj.apply(this,ar)}),kA=Object.create(w,{constructor:{value:y}});y.prototype=kA;var _=new ae(G,y,kA,$,H,k,u,f);_.baseClass&&(_.baseClass.__derivedClasses??=[],_.baseClass.__derivedClasses.push(_));var Gn=new HA(G,_,!0,!1,!1),Kj=new HA(G+"*",_,!1,!1,!1),Jj=new HA(G+" const*",_,!1,!0,!1);return tj[r]={pointerType:Kj,constPointerType:Jj},ij(E,y),[Gn,Kj,Jj]})},jr=(r,j)=>{for(var s=[],l=0;l<r;l++)s.push(I[j+l*4>>2]);return s},lj=r=>{for(;r.length;){var j=r.pop(),s=r.pop();s(j)}};function oj(r){for(var j=1;j<r.length;++j)if(r[j]!==null&&r[j].destructorFunction===void 0)return!0;return!1}function Ie(r,j,s,l){var o=oj(r),k=r.length-2,a=[],u=["fn"];j&&u.push("thisWired");for(var c=0;c<k;++c)a.push(\`arg\${c}\`),u.push(\`arg\${c}Wired\`);a=a.join(","),u=u.join(",");var f=\`return function (\${a}) {
|
|
3213
3213
|
\`;o&&(f+=\`var destructors = [];
|
|
3214
3214
|
\`);var G=o?"destructors":"null",m=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];j&&(f+=\`var thisWired = toClassParamWire(\${G}, this);
|
|
3215
3215
|
\`);for(var c=0;c<k;++c){var $=\`toArg\${c}Wire\`;f+=\`var arg\${c}Wired = \${$}(\${G}, arg\${c});
|
|
@@ -3219,5 +3219,5 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3219
3219
|
\`,m.push(\`\${E}_dtor\`))}return s&&(f+=\`var ret = fromRetWire(rv);
|
|
3220
3220
|
return ret;
|
|
3221
3221
|
\`),f+=\`}
|
|
3222
|
-
\`,new Function(m,f)}function tr(r,j,s,l,o,k){var a=j.length;a<2&&p("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=j[1]!==null&&s!==null,c=oj(j),f=!j[0].isVoid,G=j[0],m=j[1],$=[r,p,l,o,lj,G.fromWireType.bind(G),m?.toWireType.bind(m)],E=2;E<a;++E){var F=j[E];$.push(F.toWireType.bind(F))}if(!c)for(var E=u?1:2;E<j.length;++E)j[E].destructorFunction!==null&&$.push(j[E].destructorFunction);var w=Ie(j,u,f,k)(...$);return jj(r,w)}var $e=(r,j,s,l,o,k)=>{var a=jr(j,s);o=b(l,o),M([],[r],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[j-1]!==void 0)throw new lA(\`Cannot register multiple constructors with identical number of parameters (\${j-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[j-1]=()=>{rA(\`Cannot construct \${u.name} due to unbound types\`,a)},M([],a,f=>(f.splice(1,0,null),u.registeredClass.constructor_body[j-1]=tr(c,f,null,o,k),[])),[]})},aj=r=>{r=r.trim();let j=r.indexOf("(");return j===-1?r:r.slice(0,j)},Fe=(r,j,s,l,o,k,a,u,c,f)=>{var G=jr(s,l);j=L(j),j=aj(j),k=b(o,k,c),M([],[r],m=>{m=m[0];var $=\`\${m.name}.\${j}\`;j.startsWith("@@")&&(j=Symbol[j.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(j);function E(){rA(\`Cannot call \${$} due to unbound types\`,G)}var F=m.registeredClass.instancePrototype,H=F[j];return H===void 0||H.overloadTable===void 0&&H.className!==m.name&&H.argCount===s-2?(E.argCount=s-2,E.className=m.name,F[j]=E):(ej(F,j,$),F[j].overloadTable[s-2]=E),M([],G,w=>{var y=tr($,w,m,k,a,c);return F[j].overloadTable===void 0?(y.argCount=s-2,F[j]=y):F[j].overloadTable[s-2]=y,[]}),[]})},kj=(r,j,s)=>(r instanceof Object||p(\`\${s} with invalid "this": \${r}\`),r instanceof j.registeredClass.constructor||p(\`\${s} incompatible with "this" of type \${r.constructor.name}\`),r.$$.ptr||p(\`cannot call emscripten binding method \${s} on deleted object\`),vA(r.$$.ptr,r.$$.ptrType.registeredClass,j.registeredClass)),ve=(r,j,s,l,o,k,a,u,c,f)=>{j=L(j),o=b(l,o),M([],[r],G=>{G=G[0];var m=\`\${G.name}.\${j}\`,$={get(){rA(\`Cannot access \${m} due to unbound types\`,[s,a])},enumerable:!0,configurable:!0};return c?$.set=()=>rA(\`Cannot access \${m} due to unbound types\`,[s,a]):$.set=E=>p(m+" is a read-only property"),Object.defineProperty(G.registeredClass.instancePrototype,j,$),M([],c?[s,a]:[s],E=>{var F=E[0],H={get(){var y=kj(this,G,m+" getter");return F.fromWireType(o(k,y))},enumerable:!0};if(c){c=b(u,c);var w=E[1];H.set=function(y){var kA=kj(this,G,m+" setter"),_=[];c(f,kA,w.toWireType(_,y)),lj(_)}}return Object.defineProperty(G.registeredClass.instancePrototype,j,H),[]}),[]})},uj=[],jA=[0,1,,1,null,1,!0,1,!1,1],Le=r=>{r>9&&--jA[r+1]===0&&(jA[r]=void 0,uj.push(r))},er={toValue:r=>(r||p(\`Cannot use deleted val. handle = \${r}\`),jA[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let j=uj.pop()||jA.length;return jA[j]=r,jA[j+1]=1,j}}}},ge={name:"emscripten::val",fromWireType:r=>{var j=er.toValue(r);return Le(r),j},toWireType:(r,j)=>er.toHandle(j),readValueFromPointer:LA,destructorFunction:null},_e=r=>K(r,ge),He=(r,j)=>{switch(j){case 4:return function(s){return this.fromWireType(xr[s>>2])};case 8:return function(s){return this.fromWireType(EA[s>>3])};default:throw new TypeError(\`invalid float width (\${j}): \${r}\`)}},ye=(r,j,s)=>{j=L(j),K(r,{name:j,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:He(j,s),destructorFunction:null})},xe=(r,j,s,l,o,k,a,u)=>{var c=jr(j,s);r=L(r),r=aj(r),o=b(l,o,a),nj(r,function(){rA(\`Cannot call \${r} due to unbound types\`,c)},j-1),M([],c,f=>{var G=[f[0],null].concat(f.slice(1));return ij(r,tr(r,G,null,o,k,a),j-1),[]})},De=(r,j,s,l,o)=>{j=L(j);let k=l===0,a=c=>c;if(k){var u=32-8*s;a=c=>c<<u>>>u,o=a(o)}K(r,{name:j,fromWireType:a,toWireType:(c,f)=>f,readValueFromPointer:Yr(j,s,l!==0),destructorFunction:null})},Be=(r,j,s)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[j];function k(a){var u=I[a>>2],c=I[a+4>>2];return new o(V.buffer,c,u)}s=L(s),K(r,{name:s,fromWireType:k,readValueFromPointer:k},{ignoreDuplicateRegistrations:!0})},Ne=(r,j,s,l)=>{if(!(l>0))return 0;for(var o=s,k=s+l-1,a=0;a<r.length;++a){var u=r.codePointAt(a);if(u<=127){if(s>=k)break;j[s++]=u}else if(u<=2047){if(s+1>=k)break;j[s++]=192|u>>6,j[s++]=128|u&63}else if(u<=65535){if(s+2>=k)break;j[s++]=224|u>>12,j[s++]=128|u>>6&63,j[s++]=128|u&63}else{if(s+3>=k)break;j[s++]=240|u>>18,j[s++]=128|u>>12&63,j[s++]=128|u>>6&63,j[s++]=128|u&63,a++}}return j[s]=0,s-o},Ke=(r,j,s)=>Ne(r,x,j,s),Je=r=>{for(var j=0,s=0;s<r.length;++s){var l=r.charCodeAt(s);l<=127?j++:l<=2047?j+=2:l>=55296&&l<=57343?(j+=4,++s):j+=3}return j},cj=globalThis.TextDecoder&&new TextDecoder,dj=(r,j,s,l)=>{var o=j+s;if(l)return o;for(;r[j]&&!(j>=o);)++j;return j},qj=(r,j=0,s,l)=>{var o=dj(r,j,s,l);if(o-j>16&&r.buffer&&cj)return cj.decode(r.buffer instanceof ArrayBuffer?r.subarray(j,o):r.slice(j,o));for(var k="";j<o;){var a=r[j++];if(!(a&128)){k+=String.fromCharCode(a);continue}var u=r[j++]&63;if((a&224)==192){k+=String.fromCharCode((a&31)<<6|u);continue}var c=r[j++]&63;if((a&240)==224?a=(a&15)<<12|u<<6|c:a=(a&7)<<18|u<<12|c<<6|r[j++]&63,a<65536)k+=String.fromCharCode(a);else{var f=a-65536;k+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return k},be=(r,j,s)=>r?qj(x,r,j,s):"",Oe=(r,j)=>{j=L(j);var s=!0;K(r,{name:j,fromWireType(l){var o=I[l>>2],k=l+4,a;if(s)a=be(k,o,!0);else{a="";for(var u=0;u<o;++u)a+=String.fromCharCode(x[k+u])}return O(l),a},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var k,a=typeof o=="string";a||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||p("Cannot pass non-string to std::string"),s&&a?k=Je(o):k=o.length;var u=ir(4+k+1),c=u+4;if(I[u>>2]=k,a)if(s)Ke(o,c,k+1);else for(var f=0;f<k;++f){var G=o.charCodeAt(f);G>255&&(O(u),p("String has UTF-16 code units that do not fit in 8 bits")),x[c+f]=G}else x.set(o,c);return l!==null&&l.push(O,u),u},readValueFromPointer:LA,destructorFunction(l){O(l)}})},fj=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,we=(r,j,s)=>{var l=r>>1,o=dj(sA,l,j/2,s);if(o-l>16&&fj)return fj.decode(sA.slice(l,o));for(var k="",a=l;a<o;++a){var u=sA[a];k+=String.fromCharCode(u)}return k},Pe=(r,j,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var l=j,o=s<r.length*2?s/2:r.length,k=0;k<o;++k){var a=r.charCodeAt(k);mA[j>>1]=a,j+=2}return mA[j>>1]=0,j-l},Me=r=>r.length*2,Te=(r,j,s)=>{for(var l="",o=r>>2,k=0;!(k>=j/4);k++){var a=I[o+k];if(!a&&!s)break;l+=String.fromCodePoint(a)}return l},Ue=(r,j,s)=>{if(s??=2147483647,s<4)return 0;for(var l=j,o=l+s-4,k=0;k<r.length;++k){var a=r.codePointAt(k);if(a>65535&&k++,Q[j>>2]=a,j+=4,j+4>o)break}return Q[j>>2]=0,j-l},Se=r=>{for(var j=0,s=0;s<r.length;++s){var l=r.codePointAt(s);l>65535&&s++,j+=4}return j},Ve=(r,j,s)=>{s=L(s);var l,o,k;j===2?(l=we,o=Pe,k=Me):(l=Te,o=Ue,k=Se),K(r,{name:s,fromWireType:a=>{var u=I[a>>2],c=l(a+4,u*j,!0);return O(a),c},toWireType:(a,u)=>{typeof u!="string"&&p(\`Cannot pass non-string to C++ string type \${s}\`);var c=k(u),f=ir(4+c+j);return I[f>>2]=c/j,o(u,f+4,c+j),a!==null&&a.push(O,f),f},readValueFromPointer:LA,destructorFunction(a){O(a)}})},We=(r,j)=>{j=L(j),K(r,{isVoid:!0,name:j,fromWireType:()=>{},toWireType:(s,l)=>{}})},Re=r=>{lr(r,!d,1,!i,65536,!1),h.threadInitTLS()},Cj=r=>{if(r instanceof wr||r=="unwind")return z;pA(1,r)},Xe=()=>{if(!zA())try{if(C){xA()&&or(z);return}QA(z)}catch(r){Cj(r)}},Gj=r=>{if(!hA)try{return r()}catch(j){Cj(j)}finally{Xe()}},ze=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./)||[])[2])<91,nr=r=>{if(!ze){var j=Atomics.waitAsync(Q,r>>2,r);j.value.then(yA);var s=r+128;Atomics.store(Q,s>>2,1)}},yA=()=>Gj(()=>{var r=xA();r&&(nr(r),gj())}),Qe=(r,j)=>{if(r==j)setTimeout(yA);else if(C)postMessage({targetThread:r,cmd:"checkMailbox"});else{var s=h.pthreads[r];if(!s)return;s.postMessage({cmd:"checkMailbox"})}},sr=[],Ye=(r,j,s,l,o,k,a)=>{sr.length=0;for(var u=o>>3,c=o+l>>3;u<c;){var f;W[u++]?f=W[u++]:f=EA[u++],sr.push(f)}var G=cn[r];h.currentProxiedOperationCallerThread=s;var m=G(...sr);if(h.currentProxiedOperationCallerThread=0,k){m.then($=>Fj(k,a,$));return}return m},Ze=r=>{C?postMessage({cmd:"cleanupThread",thread:r}):Mr(r)},An=r=>{},rn=()=>performance.timeOrigin+performance.now(),jn=9007199254740992,tn=-9007199254740992,en=r=>r<tn||r>jn?NaN:Number(r),nn=()=>{},sn=()=>{XA+=1},ln=()=>{throw sn(),"unwind"},on=r=>{RA("OOM")},an=r=>{var j=x.length;r>>>=0,on(r)};function pj(r){return C?iA(2,0,1,r):52}function hj(r,j,s,l){return C?iA(3,0,1,r,j,s,l):(j=en(j),70)}var kn=[null,[],[]],un=(r,j)=>{var s=kn[r];j===0||j===10?((r===1?SA:N)(qj(s)),s.length=0):s.push(j)};function mj(r,j,s,l){if(C)return iA(4,0,1,r,j,s,l);for(var o=0,k=0;k<s;k++){var a=I[j>>2],u=I[j+4>>2];j+=8;for(var c=0;c<u;c++)un(r,x[a+c]);o+=u}return I[l>>2]=o,0}h.init();for(var aA=new Uint8Array(123),T=25;T>=0;--T)aA[48+T]=52+T,aA[65+T]=T,aA[97+T]=26+T;if(aA[43]=62,aA[47]=63,se(),pe(),Bt(),e.noExitRuntime&&(YA=e.noExitRuntime),e.print&&(SA=e.print),e.printErr&&(N=e.printErr),e.wasmBinary&&(_r=e.wasmBinary),e.arguments&&(v=e.arguments),e.thisProgram&&(B=e.thisProgram),e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.shift()();var cn=[Vr,Wr,pj,hj,mj],Ej,Ij,xA,ir,O,dn,lr,$j,Fj,vj,Lj,or,gj,_j,Hj,yj,xj,qn,Dj;function fn(r){Ej=r.G,Ij=r.H,xA=r.J,ir=e._malloc=r.K,O=e._free=r.L,dn=r.M,lr=r.N,$j=r.O,Fj=r.P,vj=r.Q,Lj=r.R,or=r.S,gj=r.T,_j=r.U,Hj=r.V,yj=r.W,xj=r.X,qn=Dj=r.I}var Bj;function Cn(){Bj={i:Yt,C:Zt,h:re,o:je,n:Ee,m:$e,e:Fe,b:ve,D:_e,l:ye,q:xe,d:De,c:Be,E:Oe,g:Ve,p:We,z:Re,u:Qe,k:Ye,s:Ze,y:nr,B:An,x:nn,A:ln,f:rn,t:an,r:QA,w:pj,v:hj,j:mj,a:Y}}function Nj(){if(C){VA?.(e),Kr();return}Nt();function r(){e.calledRun=!0,!hA&&(Kr(),VA?.(e),e.onRuntimeInitialized?.(),Kt())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),r()},1)):r()}var tA;return C||(tA=await Or(),Nj()),Br?t=e:t=new Promise((r,j)=>{VA=r,Hr=j}),t}})();typeof Ft=="object"&&typeof UA=="object"?(UA.exports=TA,UA.exports.default=TA):typeof define=="function"&&define.amd&&define([],()=>TA);var _s=globalThis.name=="em-pthread";_s&&TA()});var J={};Fn(J,{AdditionalCaptureBlocks:()=>_n,AdditionalPlaybackBlocks:()=>gn,ClockJumpCheckInterval:()=>Kn,ClockJumpThreshold:()=>Jn,ConnectInterval:()=>Un,ConnectTimeout:()=>Pn,DefaultRefreshRate:()=>yn,HealthCheckTimeout:()=>Nn,MainConnectionPingInterval:()=>bn,MaxNumberOfDecoders:()=>Dn,MinDBFs:()=>Oj,MinTokenLifetime:()=>Mn,MinTokenRefreshInterval:()=>Tn,PlaybackPreload:()=>Hn,RenderQuantumSize:()=>Bn,VadPreload:()=>xn,WebRtcIceTimeout:()=>On,WebRtcTimeout:()=>wn});var gn=3,_n=3,Hn=3,yn=250,xn=3,Dn=512,Bn=128,Oj=-758.596,Nn=1e4,Kn=1e3,Jn=1e4,bn=3e3,On=3e3,wn=1e4,Pn=5e3,Mn=6e4,Tn=5e3,Un=[0,100,200,200,500];function uA(n,A,t){return n.postMessage(A,t)}function ur(n){return n.sampleRate*.02*(n.stereo?2:1)}function cr(n,A){let t=ur(n),e=t*A,i=e+t;return n.samples.subarray(e,i)}function dr(n,A,t){n.headers[A]=t.id}function wj(n){return[n.values[0],n.values[1]]}function Pj(n,A){n.values[0]=A[0],n.values[1]=A[1]}function Mj(n,A){return n.values[2+A*5]}function Tj(n,A,t){n.values[2+A*5]=t}function Uj(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function Sj(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function Vj(n,A){return n.values[2+A*5+3]}function Wj(n,A,t){n.values[2+A*5+3]=t}function Rj(n,A){return n.values[2+A*5+4]}function Xj(n,A,t){n.values[2+A*5+4]=t}function zj(n){return n.values[0]!==0}function Qj(n){return n.values[1]}function Yj(n){return n.values[2]}function Zj(n){return n.values[3]}function At(n,A){return n.values[3]=A}function rt(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Sn;(n=>{let A;(t=>(t[t.InvalidPassword=-1]="InvalidPassword",t[t.Unknown=0]="Unknown",t[t.Unencrypted=1]="Unencrypted",t[t.Encrypted=2]="Encrypted"))(A=n.PeerCipherStatus||={})})(Sn||={});function st(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:jt}=globalThis,Vn=typeof jt?.noColor=="boolean"?jt.noColor:!1,Wn=!Vn;function fr(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function Cr(n,A){return Wn?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function qr(n){return Cr(n,fr([0],0))}function tt(n){return Cr(n,fr([1],22))}function Rn(n){return Cr(n,fr([2],22))}var Ts=new RegExp(["[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)","(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TXZcf-nq-uy=><~]))"].join("|"),"g"),Xn=new Date,DA=(n=>(n[n.CRITICAL=0]="CRITICAL",n[n.ERROR=1]="ERROR",n[n.WARN=2]="WARN",n[n.INFO=3]="INFO",n[n.DEBUG=4]="DEBUG",n))(DA||{}),it={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},zn={4:Rn,3:qr,2:qr,1:tt,0:tt};function Qn({message:n}){return String(n)}function et(n){return JSON.stringify({timestamp:n.date.toISOString(),level:DA[n.level],message:n.message,extra:n.extra})}function nt(n){function A(q,C){return[Math.floor(q/C),q%C]}function t(){let q,C=n.date.valueOf()-Xn.valueOf();[C,q]=A(C,1e3);let[v,B]=A(C,60);return\`\${v.toString().padStart(4,"0")}:\${B.toString().padStart(2,"0")}.\${q.toString().padStart(4,"0")}\`}function e(){return n.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(n.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(n.extra)}let i=it[n.level],d=n.logger.name!==void 0?\`@\${n.logger}\`:"";return\`\${qr(t())}\${d} \${i} \${zn[n.level](String(n.message))}\${e()}\`}function Yn(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${DA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",i=it[n.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${e}\${n.message}\`}function Zn(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var lt={sparse:Qn,json:et,pretty:nt,structured:Yn,default:Zn()?nt:et},As=class{formatter;consoleObject;filter;constructor(n=lt.default,A=4,t=console){this.filter=A,this.formatter=n,this.consoleObject=t}handle(n){let A=this.formatter(n);switch(n.level){case 1:this.consoleObject.error(A);break;case 2:this.consoleObject.warn(A);break;case 3:this.consoleObject.info(A);break;case 4:this.consoleObject.debug(A);break}}};var R=class{#A;sinks;filter;parent;get name(){return this.#A}constructor(n,A=void 0,t=[],e=void 0){this.#A=A,this.sinks=t,this.filter=n,this.parent=e}log(n,A,t=void 0){let e={date:new Date,level:n,logger:this,message:A,extra:t};this.filter<n||this.insert(e)}insert(n){if(!(this.filter<n.level)){for(let A of this.sinks)A.filter>=n.level&&A.handle(n);this.parent!==void 0&&this.parent.insert(n)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},cA=new R(3,void 0,[new As]),rs=R.prototype.log.bind(cA,1),js=R.prototype.log.bind(cA,2),ot=R.prototype.log.bind(cA,3),ts=R.prototype.log.bind(cA,4),Us=R.prototype.log.bind(cA);var at;function kt(n,...A){let t=es(A);at?at?.info(n,t):ot(n,t)}function es(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function BA(n){return n.connectionId*4294967296+n.mediaId}function ut(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function U(n,A,t){let e;switch(A){case"f32":e=n.HEAPF32;break;case"u32":e=n.HEAPU32;break;case"i32":e=n.HEAP32;break;case"u8":e=n.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let i=n._malloc(t*e.BYTES_PER_ELEMENT);if(i===0||i%e.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${t} \${A} array\`);let d=i/e.BYTES_PER_ELEMENT;return e.subarray(d,d+t)}function eA(n,A){n._free(A.byteOffset)}function Gr(n,A,t,e){return{headers:U(n,"i32",t),samples:U(n,"f32",t*ur({sampleRate:A,stereo:e})),length:t,sampleRate:A,stereo:e}}function pr(n,A){eA(n,A.headers),eA(n,A.samples)}function ct(n,A){return{values:U(n,"f32",2+A*5),length:A}}function dt(n,A){eA(n,A.values)}function qt(n){return{values:U(n,"f32",4)}}function ft(n,A){eA(n,A.values)}function Ct(n){let A=n.length,t=0,e=0;for(;e<A;){let i=n.charCodeAt(e++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&e<A){let d=n.charCodeAt(e);(d&64512)===56320&&(++e,i=((i&1023)<<10)+(d&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function ns(n,A,t){let e=n.length,i=t,d=0;for(;d<e;){let q=n.charCodeAt(d++);if((q&4294967168)===0){A[i++]=q;continue}else if((q&4294965248)===0)A[i++]=q>>6&31|192;else{if(q>=55296&&q<=56319&&d<e){let C=n.charCodeAt(d);(C&64512)===56320&&(++d,q=((q&1023)<<10)+(C&1023)+65536)}(q&4294901760)===0?(A[i++]=q>>12&15|224,A[i++]=q>>6&63|128):(A[i++]=q>>18&7|240,A[i++]=q>>12&63|128,A[i++]=q>>6&63|128)}A[i++]=q&63|128}}var ss=new TextEncoder,is=50;function ls(n,A,t){ss.encodeInto(n,A.subarray(t))}function Gt(n,A,t){n.length>is?ls(n,A,t):ns(n,A,t)}var os=4096;function hr(n,A,t){let e=A,i=e+t,d=[],q="";for(;e<i;){let C=n[e++];if((C&128)===0)d.push(C);else if((C&224)===192){let v=n[e++]&63;d.push((C&31)<<6|v)}else if((C&240)===224){let v=n[e++]&63,B=n[e++]&63;d.push((C&31)<<12|v<<6|B)}else if((C&248)===240){let v=n[e++]&63,B=n[e++]&63,pA=n[e++]&63,P=(C&7)<<18|v<<12|B<<6|pA;P>65535&&(P-=65536,d.push(P>>>10&1023|55296),P=56320|P&1023),d.push(P)}else d.push(C);d.length>=os&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var as=new TextDecoder,ks=200;function us(n,A,t){let e=n.subarray(A,A+t);return as.decode(e)}function pt(n,A,t){return t>ks?us(n,A,t):hr(n,A,t)}var X=class{constructor(A,t){this.type=A,this.data=t}};var g=class n extends Error{constructor(A){super(A);let t=Object.create(n.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:n.name})}};function ht(n,A,t){let e=t/4294967296,i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function NA(n,A,t){let e=Math.floor(t/4294967296),i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function KA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function mt(n,A){let t=n.getUint32(A),e=n.getUint32(A+4);return t*4294967296+e}var cs=-1,ds=4294967296-1,qs=17179869184-1;function fs({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=qs)if(A===0&&n<=ds){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,n),t}else{let t=n/4294967296,e=n&4294967295,i=new Uint8Array(8),d=new DataView(i.buffer);return d.setUint32(0,A<<2|t&3),d.setUint32(4,e),i}else{let t=new Uint8Array(12),e=new DataView(t.buffer);return e.setUint32(0,A),NA(e,4,n),t}}function Cs(n){let A=n.getTime(),t=Math.floor(A/1e3),e=(A-t*1e3)*1e6,i=Math.floor(e/1e9);return{sec:t+i,nsec:e-i*1e9}}function Gs(n){if(n instanceof Date){let A=Cs(n);return fs(A)}else return null}function ps(n){let A=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let t=A.getUint32(0),e=A.getUint32(4),i=(t&3)*4294967296+e,d=t>>>2;return{sec:i,nsec:d}}case 12:{let t=KA(A,4),e=A.getUint32(0);return{sec:t,nsec:e}}default:throw new g(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function hs(n){let A=ps(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Et={type:cs,encode:Gs,decode:hs};var S=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Et)}register({type:A,encode:t,decode:e}){if(A>=0)this.encoders[A]=t,this.decoders[A]=e;else{let i=-1-A;this.builtInEncoders[i]=t,this.builtInDecoders[i]=e}}tryToEncode(A,t){for(let e=0;e<this.builtInEncoders.length;e++){let i=this.builtInEncoders[e];if(i!=null){let d=i(A,t);if(d!=null){let q=-1-e;return new X(q,d)}}}for(let e=0;e<this.encoders.length;e++){let i=this.encoders[e];if(i!=null){let d=i(A,t);if(d!=null){let q=e;return new X(q,d)}}}return A instanceof X?A:null}decode(A,t,e){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,e):new X(t,A)}};S.defaultCodec=new S;function ms(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function dA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):ms(n)?new Uint8Array(n):Uint8Array.from(n)}var Es=100,Is=2048,JA=class n{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??S.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??Es,this.initialBufferSize=A?.initialBufferSize??Is,this.sortKeys=A?.sortKeys??!1,this.forceFloat32=A?.forceFloat32??!1,this.ignoreUndefined=A?.ignoreUndefined??!1,this.forceIntegerToFloat=A?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new n({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(A){if(this.entered)return this.clone().encodeSharedRef(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(A){if(this.entered)return this.clone().encode(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(A,t){if(t>this.maxDepth)throw new Error(\`Too deep objects in depth \${t}\`);A==null?this.encodeNil():typeof A=="boolean"?this.encodeBoolean(A):typeof A=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(A):this.encodeNumber(A):typeof A=="string"?this.encodeString(A):this.useBigInt64&&typeof A=="bigint"?this.encodeBigInt64(A):this.encodeObject(A,t)}ensureBufferSizeToWrite(A){let t=this.pos+A;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(A){let t=new ArrayBuffer(A),e=new Uint8Array(t),i=new DataView(t);e.set(this.bytes),this.view=i,this.bytes=e}encodeNil(){this.writeU8(192)}encodeBoolean(A){A===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(A){!this.forceIntegerToFloat&&Number.isSafeInteger(A)?A>=0?A<128?this.writeU8(A):A<256?(this.writeU8(204),this.writeU8(A)):A<65536?(this.writeU8(205),this.writeU16(A)):A<4294967296?(this.writeU8(206),this.writeU32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(207),this.writeU64(A)):A>=-32?this.writeU8(224|A+32):A>=-128?(this.writeU8(208),this.writeI8(A)):A>=-32768?(this.writeU8(209),this.writeI16(A)):A>=-2147483648?(this.writeU8(210),this.writeI32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(211),this.writeI64(A)):this.encodeNumberAsFloat(A)}encodeNumberAsFloat(A){this.forceFloat32?(this.writeU8(202),this.writeF32(A)):(this.writeU8(203),this.writeF64(A))}encodeBigInt64(A){A>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(A)):(this.writeU8(211),this.writeBigInt64(A))}writeStringHeader(A){if(A<32)this.writeU8(160+A);else if(A<256)this.writeU8(217),this.writeU8(A);else if(A<65536)this.writeU8(218),this.writeU16(A);else if(A<4294967296)this.writeU8(219),this.writeU32(A);else throw new Error(\`Too long string: \${A} bytes in UTF-8\`)}encodeString(A){let e=Ct(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),Gt(A,this.bytes,this.pos),this.pos+=e}encodeObject(A,t){let e=this.extensionCodec.tryToEncode(A,this.context);if(e!=null)this.encodeExtension(e);else if(Array.isArray(A))this.encodeArray(A,t);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,t);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let t=A.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(\`Too large binary: \${t}\`);let e=dA(A);this.writeU8a(e)}encodeArray(A,t){let e=A.length;if(e<16)this.writeU8(144+e);else if(e<65536)this.writeU8(220),this.writeU16(e);else if(e<4294967296)this.writeU8(221),this.writeU32(e);else throw new Error(\`Too large array: \${e}\`);for(let i of A)this.doEncode(i,t+1)}countWithoutUndefined(A,t){let e=0;for(let i of t)A[i]!==void 0&&e++;return e}encodeMap(A,t){let e=Object.keys(A);this.sortKeys&&e.sort();let i=this.ignoreUndefined?this.countWithoutUndefined(A,e):e.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(\`Too large map object: \${i}\`);for(let d of e){let q=A[d];this.ignoreUndefined&&q===void 0||(this.encodeString(d),this.doEncode(q,t+1))}}encodeExtension(A){if(typeof A.data=="function"){let e=A.data(this.pos+6),i=e.length;if(i>=4294967296)throw new Error(\`Too large extension object: \${i}\`);this.writeU8(201),this.writeU32(i),this.writeI8(A.type),this.writeU8a(e);return}let t=A.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(\`Too large extension object: \${t}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let t=A.length;this.ensureBufferSizeToWrite(t),this.bytes.set(A,this.pos),this.pos+=t}writeI8(A){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,A),this.pos++}writeU16(A){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,A),this.pos+=2}writeI16(A){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,A),this.pos+=2}writeU32(A){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,A),this.pos+=4}writeI32(A){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,A),this.pos+=4}writeF32(A){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,A),this.pos+=4}writeF64(A){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,A),this.pos+=8}writeU64(A){this.ensureBufferSizeToWrite(8),ht(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),NA(this.view,this.pos,A),this.pos+=8}writeBigUint64(A){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,A),this.pos+=8}writeBigInt64(A){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,A),this.pos+=8}};function mr(n,A){return new JA(A).encodeSharedRef(n)}function bA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var $s=16,Fs=16,OA=class{constructor(A=$s,t=Fs){this.hit=0,this.miss=0,this.maxKeyLength=A,this.maxLengthPerKey=t,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,t,e){let i=this.caches[e-1];A:for(let d of i){let q=d.bytes;for(let C=0;C<e;C++)if(q[C]!==A[t+C])continue A;return d.str}return null}store(A,t){let e=this.caches[A.length-1],i={bytes:A,str:t};e.length>=this.maxLengthPerKey?e[Math.random()*e.length|0]=i:e.push(i)}decode(A,t,e){let i=this.find(A,t,e);if(i!=null)return this.hit++,i;this.miss++;let d=hr(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var Er="array",CA="map_key",$t="map_value",vs=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new g("The type of key must be string or number but "+typeof n)},Ir=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let t=this.getUninitializedStateFromPool();t.type=Er,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=CA,t.readCount=0,t.size=A,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let A={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(A)}return this.stack[this.stackHeadPosition]}release(A){if(this.stack[this.stackHeadPosition]!==A)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(A.type===Er){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===CA||A.type===$t){let e=A;e.size=0,e.map=void 0,e.readCount=0,e.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},fA=-1,$r=new DataView(new ArrayBuffer(0)),Ls=new Uint8Array($r.buffer);try{$r.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var It=new RangeError("Insufficient data"),gs=new OA,wA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=$r,this.bytes=Ls,this.headByte=fA,this.stack=new Ir,this.entered=!1,this.extensionCodec=A?.extensionCodec??S.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.rawStrings=A?.rawStrings??!1,this.maxStrLength=A?.maxStrLength??4294967295,this.maxBinLength=A?.maxBinLength??4294967295,this.maxArrayLength=A?.maxArrayLength??4294967295,this.maxMapLength=A?.maxMapLength??4294967295,this.maxExtLength=A?.maxExtLength??4294967295,this.keyDecoder=A?.keyDecoder!==void 0?A.keyDecoder:gs,this.mapKeyConverter=A?.mapKeyConverter??vs}clone(){return new n({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=fA,this.stack.reset()}setBuffer(A){let t=dA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===fA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=dA(A),i=new Uint8Array(t.length+e.length);i.set(t),i.set(e,t.length),this.setBuffer(i)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:t,pos:e}=this;return new RangeError(\`Extra \${t.byteLength-e} of \${t.byteLength} byte(s) found at buffer[\${A}]\`)}decode(A){if(this.entered)return this.clone().decode(A);try{this.entered=!0,this.reinitializeState(),this.setBuffer(A);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(A){if(this.entered){yield*this.clone().decodeMulti(A);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(A);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(A){if(this.entered)return this.clone().decodeAsync(A);try{this.entered=!0;let t=!1,e;for await(let C of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(C);try{e=this.doDecodeSync(),t=!0}catch(v){if(!(v instanceof RangeError))throw v}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return e}let{headByte:i,pos:d,totalPos:q}=this;throw new RangeError(\`Insufficient data in parsing \${bA(i)} at \${q} (\${d} in the current buffer)\`)}finally{this.entered=!1}}decodeArrayStream(A){return this.decodeMultiAsync(A,!0)}decodeStream(A){return this.decodeMultiAsync(A,!1)}async*decodeMultiAsync(A,t){if(this.entered){yield*this.clone().decodeMultiAsync(A,t);return}try{this.entered=!0;let e=t,i=-1;for await(let d of A){if(t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),e&&(i=this.readArraySize(),e=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(q){if(!(q instanceof RangeError))throw q}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){A:for(;;){let A=this.readHeadByte(),t;if(A>=224)t=A-256;else if(A<192)if(A<128)t=A;else if(A<144){let i=A-128;if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A<160){let i=A-144;if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else{let i=A-160;t=this.decodeString(i,0)}else if(A===192)t=null;else if(A===194)t=!1;else if(A===195)t=!0;else if(A===202)t=this.readF32();else if(A===203)t=this.readF64();else if(A===204)t=this.readU8();else if(A===205)t=this.readU16();else if(A===206)t=this.readU32();else if(A===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(A===208)t=this.readI8();else if(A===209)t=this.readI16();else if(A===210)t=this.readI32();else if(A===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(A===217){let i=this.lookU8();t=this.decodeString(i,1)}else if(A===218){let i=this.lookU16();t=this.decodeString(i,2)}else if(A===219){let i=this.lookU32();t=this.decodeString(i,4)}else if(A===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===196){let i=this.lookU8();t=this.decodeBinary(i,1)}else if(A===197){let i=this.lookU16();t=this.decodeBinary(i,2)}else if(A===198){let i=this.lookU32();t=this.decodeBinary(i,4)}else if(A===212)t=this.decodeExtension(1,0);else if(A===213)t=this.decodeExtension(2,0);else if(A===214)t=this.decodeExtension(4,0);else if(A===215)t=this.decodeExtension(8,0);else if(A===216)t=this.decodeExtension(16,0);else if(A===199){let i=this.lookU8();t=this.decodeExtension(i,1)}else if(A===200){let i=this.lookU16();t=this.decodeExtension(i,2)}else if(A===201){let i=this.lookU32();t=this.decodeExtension(i,4)}else throw new g(\`Unrecognized type byte: \${bA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let i=e.top();if(i.type===Er)if(i.array[i.position]=t,i.position++,i.position===i.size)t=i.array,e.release(i);else continue A;else if(i.type===CA){if(t==="__proto__")throw new g("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=$t;continue A}else if(i.map[i.key]=t,i.readCount++,i.readCount===i.size)t=i.map,e.release(i);else{i.key=null,i.type=CA;continue A}}return t}}readHeadByte(){return this.headByte===fA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=fA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new g(\`Unrecognized array type byte: \${bA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new g(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new g(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,t):this.decodeBinary(A,t)}decodeUtf8String(A,t){if(A>this.maxStrLength)throw new g(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw It;let e=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,e,A):i=pt(this.bytes,e,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===CA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new g(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw It;let e=this.pos+t,i=this.bytes.subarray(e,e+A);return this.pos+=t+A,i}decodeExtension(A,t){if(A>this.maxExtLength)throw new g(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let e=this.view.getInt8(this.pos+t),i=this.decodeBinary(A,t+1);return this.extensionCodec.decode(i,e,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let A=this.view.getUint8(this.pos);return this.pos++,A}readI8(){let A=this.view.getInt8(this.pos);return this.pos++,A}readU16(){let A=this.view.getUint16(this.pos);return this.pos+=2,A}readI16(){let A=this.view.getInt16(this.pos);return this.pos+=2,A}readU32(){let A=this.view.getUint32(this.pos);return this.pos+=4,A}readI32(){let A=this.view.getInt32(this.pos);return this.pos+=4,A}readU64(){let A=mt(this.view,this.pos);return this.pos+=8,A}readI64(){let A=KA(this.view,this.pos);return this.pos+=8,A}readU64AsBigInt(){let A=this.view.getBigUint64(this.pos);return this.pos+=8,A}readI64AsBigInt(){let A=this.view.getBigInt64(this.pos);return this.pos+=8,A}readF32(){let A=this.view.getFloat32(this.pos);return this.pos+=4,A}readF64(){let A=this.view.getFloat64(this.pos);return this.pos+=8,A}};function Fr(n,A){return new wA(A).decode(n)}var GA=class n{constructor(A,t,e,i,d){this.mediaIds=A;this.sequenceNumber=t;this.timeStamp=e;this.isEndOfSpurt=i;this.payload=d}static parse(A){let t;try{t=Fr(A)}catch{return D("not valid msgpack")}if(!Array.isArray(t))return D("container must be an array");if(t.length<6)return D("missing fields");if(t[0]!==1)return D("unknown type");if(!Array.isArray(t[1]))return D("media ids must be an array");if(!t[1].every(B=>typeof B=="number"))return D("media ids must be numbers");if(typeof t[2]!="number")return D("sequence number must be a number");if(typeof t[3]!="number")return D("timestamp must be a number");if(typeof t[4]!="number")return D("flags must be a number");let e=t[1],i=t[2]>>>0,d=t[3]>>>0,C=(t[4]&1)!==0,v=t[t.length-1];return v instanceof Uint8Array?st(new n(e,i,d,C,v)):D("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),t=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(mr(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var PA=class{constructor(A,t){this.sampleRate=A;this.wasm=t;this.sequenceNumber=Math.random()*Math.pow(2,32)>>0;this.timestamp=Math.random()*Math.pow(2,32)>>0;this.connections=[];this.monitoring=!1;this.active=!1;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0};this.encoder=new t.Encoder(A,15,!0,J.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=qt(this.wasm),this.outBuffer=U(this.wasm,"u8",1270),At(this.information,1)}setVad(A){this.encoder.set_volume_gate(A.volumeGate!==void 0,A.volumeGate?.attackThreshold??0,A.volumeGate?.releaseThreshold??0),this.encoder.set_speech_detection(A.voiceActivity!==void 0,A.voiceActivity?.attackThreshold??0,A.voiceActivity?.releaseThreshold??0)}setMedias(A){this.connections=A.filter(({mediaIds:t})=>t.length>0)}close(){ft(this.wasm,this.information),eA(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let t=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(t===0)break;if(t<0){kt(\`failed encoding packet: \${t}\`);return}if(this.timestamp=this.timestamp+1800>>0,t===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let e=this.active&&!this.encoder.active;this.active=this.encoder.active,this.monitoring=this.connections.some(i=>i.id===0);for(let i of this.connections){if(this.monitoring&&i.id!==0)continue;let d=new GA(i.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));uA(globalThis,["sendPacket",{connectionId:i.id,packet:d.toBytes()}])}}}onMessage(A){let[t,e]=A;switch(t){case"captureSetVad":this?.setVad(e);break;case"captureSetMedias":this?.setMedias(e.connections);break;case"close":this.close();break;case"dump":e.result.postMessage(this.dump());break}}dump(){return{sequenceNumber:this.sequenceNumber,timestamp:this.timestamp,connections:this.connections.map(A=>\`\${A.id} => \${A.mediaIds.join(",")}\`),active:this.active,monitoring:this.monitoring,information:{active:zj(this.information),speechProbability:Qj(this.information),rmsDBFS:Yj(this.information),volume:Zj(this.information)},encoder:{sample_rate:this.encoder.sample_rate,fec_packet_loss:this.encoder.fec_packet_loss,voip:this.encoder.voip,vad_preload:this.encoder.vad_preload,complexity:this.encoder.complexity,speech_probability:this.encoder.speech_probability,rms_dbfs:this.encoder.rms_dbfs,active:this.encoder.active,speech_detection_enabled:this.encoder.speech_detection_enabled,speech_detection_going_active:this.encoder.speech_detection_going_active,speech_detection_going_inactive:this.encoder.speech_detection_going_inactive,volume_gate_enabled:this.encoder.volume_gate_enabled,volume_gate_going_active:this.encoder.volume_gate_going_active,volume_gate_going_inactive:this.encoder.volume_gate_going_inactive}}}},MA=class{constructor(A){this.wasm=A;this.medias=new Map;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0,numberTicksWithAudio:0};this.largestIndex=-1;this.decoders=U(this.wasm,"u32",J.MaxNumberOfDecoders),this.information=ct(this.wasm,J.MaxNumberOfDecoders),Pj(this.information,[1,1])}close(){dt(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=GA.parse(t);if(e.type==="Failure"){this.stats.numberPacketError++;let i=Array.from(t).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${e.reason}, connection: \${A}, dump: \${i}\`);return}for(let i of e.value.mediaIds){let d=this.medias.get(BA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=U(this.wasm,"u8",e.value.payload.length);q.set(e.value.payload),d.decoder.push(e.value.sequenceNumber,e.value.timeStamp,e.value.isEndOfSpurt,q.byteOffset,q.length)}}insertMedia(A,t,e,i=[1,1]){let d=BA({connectionId:t,mediaId:e}),q=new this.wasm.Decoder;this.medias.set(d,{index:A,decoder:q,lastPacket:void 0}),this.decoders[A]=q.$$.ptr,this.largestIndex=Math.max(this.largestIndex,A),Sj(this.information,A,i),Xj(this.information,A,0),Wj(this.information,A,0)}removeMedia(A,t,e){let i=BA({connectionId:t,mediaId:e}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Tj(this.information,A,0),this.decoders[A]=0,d.decoder.delete(),A===this.largestIndex)){for(A=A-1;A>=0&&this.decoders[A]===0;A--);this.largestIndex=A}}decode(A){return{hasAudio:this.wasm.pop_many(this.decoders.byteOffset,this.information.values.byteOffset,this.largestIndex+1,A.byteOffset)}}onMessage(A){let[t,e]=A;switch(t){case"playbackReceivePacket":this.receivePacket(e.connectionId,e.packet);break;case"playbackUpdateMedias":for(let{index:i,connectionId:d,mediaId:q}of e.removed)this.removeMedia(i,d,q);for(let{index:i,connectionId:d,mediaId:q,volume:C}of e.added)this.insertMedia(i,d,q,C);break;case"close":this.close();break;case"dump":e.result.postMessage(this.dump());break}}dump(){let A=[];for(let[t,e]of this.medias){let i=ut(t);A.push({index:e.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:Mj(this.information,e.index),volume:Uj(this.information,e.index),voicedBlocks:Rj(this.information,e.index),silentBlocks:Vj(this.information,e.index),time:e.decoder.time,consecutive_silence:e.decoder.consecutive_silence,last_voiced_time_point:e.decoder.last_voiced_time_point,sequence_number:e.decoder.sequence_number,packetsSeen:e.decoder.packets_seen,packetsInvalid:e.decoder.packets_invalid,packetsTooLate:e.decoder.packets_too_late,packetsTooEarly:e.decoder.packets_too_early,packetsRepeated:e.decoder.packets_repeated,packetsProcessed:e.decoder.packets_processed,packetsLost:e.decoder.packets_lost,rewinds:e.decoder.rewinds,cacheLength:e.decoder.cache_length,lastPacket:rt(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:wj(this.information),decoders:A}}};var Ht=Ln(vt()),Lt=(0,Ht.default)(),gt,_t;globalThis.addEventListener("message",vr);async function vr(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=vr,gt=new Lr(e.sampleRate,await Lt);break;case"playbackInit":e.workletPort.onmessage=vr,_t=new gr(await Lt);break;case"close":globalThis.close();break}gt?.onMessage(A),_t?.onMessage(A)}var Lr=class extends PA{constructor(t,e){super(t,e);this.id=-1;this.samples=Gr(this.wasm,t,2+J.VadPreload+J.AdditionalCaptureBlocks,!1),uA(globalThis,["captureReady",{sampleBuffer:this.samples,informationBuffer:this.information}])}close(){super.close(),pr(this.wasm,this.samples)}onMessage(t){super.onMessage(t);let[e,i]=t;e==="captureTick"&&this.tick(i.id)}tick(t){for(;this.id<t;this.id+=1)this.encode(cr(this.samples,this.id%this.samples.length))}dump(){return{type:"shared capture worker",id:this.id,sampleRate:this.samples.sampleRate,stereo:this.samples.stereo,length:this.samples.length,...super.dump()}}},gr=class extends MA{constructor(A){super(A);let t=2+J.AdditionalPlaybackBlocks;this.sampleBuffer=Gr(A,48e3,t,!0),this.sampleBuffer.samples.fill(0),this.prefill=t-2;for(let e=0;e<this.prefill;e++)dr(this.sampleBuffer,e,{id:e});this.id=this.prefill,uA(globalThis,["playbackReady",{sampleBuffer:this.sampleBuffer,informationBuffer:this.information}])}close(){super.close(),pr(this.wasm,this.sampleBuffer)}onMessage(A){super.onMessage(A);let[t,e]=A;t==="playbackTick"&&this.tick(e.id)}tick(A){for(this.stats.numberTicks++;this.id<A+this.prefill;this.id++){let t=this.id%this.sampleBuffer.length,{hasAudio:e}=this.decode(cr(this.sampleBuffer,t));e&&(this.stats.numberTicksWithAudio++,dr(this.sampleBuffer,t,{id:this.id}))}}dump(){return{type:"shared playback worker",id:this.id,prefill:this.prefill,sampleRate:this.sampleBuffer.sampleRate,stereo:this.sampleBuffer.stereo,...super.dump()}}};})();
|
|
3223
|
-
`;var
|
|
3222
|
+
\`,new Function(m,f)}function tr(r,j,s,l,o,k){var a=j.length;a<2&&p("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=j[1]!==null&&s!==null,c=oj(j),f=!j[0].isVoid,G=j[0],m=j[1],$=[r,p,l,o,lj,G.fromWireType.bind(G),m?.toWireType.bind(m)],E=2;E<a;++E){var F=j[E];$.push(F.toWireType.bind(F))}if(!c)for(var E=u?1:2;E<j.length;++E)j[E].destructorFunction!==null&&$.push(j[E].destructorFunction);var w=Ie(j,u,f,k)(...$);return jj(r,w)}var $e=(r,j,s,l,o,k)=>{var a=jr(j,s);o=b(l,o),M([],[r],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[j-1]!==void 0)throw new lA(\`Cannot register multiple constructors with identical number of parameters (\${j-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[j-1]=()=>{rA(\`Cannot construct \${u.name} due to unbound types\`,a)},M([],a,f=>(f.splice(1,0,null),u.registeredClass.constructor_body[j-1]=tr(c,f,null,o,k),[])),[]})},aj=r=>{r=r.trim();let j=r.indexOf("(");return j===-1?r:r.slice(0,j)},Fe=(r,j,s,l,o,k,a,u,c,f)=>{var G=jr(s,l);j=L(j),j=aj(j),k=b(o,k,c),M([],[r],m=>{m=m[0];var $=\`\${m.name}.\${j}\`;j.startsWith("@@")&&(j=Symbol[j.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(j);function E(){rA(\`Cannot call \${$} due to unbound types\`,G)}var F=m.registeredClass.instancePrototype,H=F[j];return H===void 0||H.overloadTable===void 0&&H.className!==m.name&&H.argCount===s-2?(E.argCount=s-2,E.className=m.name,F[j]=E):(ej(F,j,$),F[j].overloadTable[s-2]=E),M([],G,w=>{var y=tr($,w,m,k,a,c);return F[j].overloadTable===void 0?(y.argCount=s-2,F[j]=y):F[j].overloadTable[s-2]=y,[]}),[]})},kj=(r,j,s)=>(r instanceof Object||p(\`\${s} with invalid "this": \${r}\`),r instanceof j.registeredClass.constructor||p(\`\${s} incompatible with "this" of type \${r.constructor.name}\`),r.$$.ptr||p(\`cannot call emscripten binding method \${s} on deleted object\`),vA(r.$$.ptr,r.$$.ptrType.registeredClass,j.registeredClass)),ve=(r,j,s,l,o,k,a,u,c,f)=>{j=L(j),o=b(l,o),M([],[r],G=>{G=G[0];var m=\`\${G.name}.\${j}\`,$={get(){rA(\`Cannot access \${m} due to unbound types\`,[s,a])},enumerable:!0,configurable:!0};return c?$.set=()=>rA(\`Cannot access \${m} due to unbound types\`,[s,a]):$.set=E=>p(m+" is a read-only property"),Object.defineProperty(G.registeredClass.instancePrototype,j,$),M([],c?[s,a]:[s],E=>{var F=E[0],H={get(){var y=kj(this,G,m+" getter");return F.fromWireType(o(k,y))},enumerable:!0};if(c){c=b(u,c);var w=E[1];H.set=function(y){var kA=kj(this,G,m+" setter"),_=[];c(f,kA,w.toWireType(_,y)),lj(_)}}return Object.defineProperty(G.registeredClass.instancePrototype,j,H),[]}),[]})},uj=[],jA=[0,1,,1,null,1,!0,1,!1,1],Le=r=>{r>9&&--jA[r+1]===0&&(jA[r]=void 0,uj.push(r))},er={toValue:r=>(r||p(\`Cannot use deleted val. handle = \${r}\`),jA[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let j=uj.pop()||jA.length;return jA[j]=r,jA[j+1]=1,j}}}},ge={name:"emscripten::val",fromWireType:r=>{var j=er.toValue(r);return Le(r),j},toWireType:(r,j)=>er.toHandle(j),readValueFromPointer:LA,destructorFunction:null},_e=r=>K(r,ge),He=(r,j)=>{switch(j){case 4:return function(s){return this.fromWireType(xr[s>>2])};case 8:return function(s){return this.fromWireType(EA[s>>3])};default:throw new TypeError(\`invalid float width (\${j}): \${r}\`)}},ye=(r,j,s)=>{j=L(j),K(r,{name:j,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:He(j,s),destructorFunction:null})},xe=(r,j,s,l,o,k,a,u)=>{var c=jr(j,s);r=L(r),r=aj(r),o=b(l,o,a),nj(r,function(){rA(\`Cannot call \${r} due to unbound types\`,c)},j-1),M([],c,f=>{var G=[f[0],null].concat(f.slice(1));return ij(r,tr(r,G,null,o,k,a),j-1),[]})},De=(r,j,s,l,o)=>{j=L(j);let k=l===0,a=c=>c;if(k){var u=32-8*s;a=c=>c<<u>>>u,o=a(o)}K(r,{name:j,fromWireType:a,toWireType:(c,f)=>f,readValueFromPointer:Yr(j,s,l!==0),destructorFunction:null})},Be=(r,j,s)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[j];function k(a){var u=I[a>>2],c=I[a+4>>2];return new o(V.buffer,c,u)}s=L(s),K(r,{name:s,fromWireType:k,readValueFromPointer:k},{ignoreDuplicateRegistrations:!0})},Ne=(r,j,s,l)=>{if(!(l>0))return 0;for(var o=s,k=s+l-1,a=0;a<r.length;++a){var u=r.codePointAt(a);if(u<=127){if(s>=k)break;j[s++]=u}else if(u<=2047){if(s+1>=k)break;j[s++]=192|u>>6,j[s++]=128|u&63}else if(u<=65535){if(s+2>=k)break;j[s++]=224|u>>12,j[s++]=128|u>>6&63,j[s++]=128|u&63}else{if(s+3>=k)break;j[s++]=240|u>>18,j[s++]=128|u>>12&63,j[s++]=128|u>>6&63,j[s++]=128|u&63,a++}}return j[s]=0,s-o},Ke=(r,j,s)=>Ne(r,x,j,s),Je=r=>{for(var j=0,s=0;s<r.length;++s){var l=r.charCodeAt(s);l<=127?j++:l<=2047?j+=2:l>=55296&&l<=57343?(j+=4,++s):j+=3}return j},cj=globalThis.TextDecoder&&new TextDecoder,dj=(r,j,s,l)=>{var o=j+s;if(l)return o;for(;r[j]&&!(j>=o);)++j;return j},qj=(r,j=0,s,l)=>{var o=dj(r,j,s,l);if(o-j>16&&r.buffer&&cj)return cj.decode(r.buffer instanceof ArrayBuffer?r.subarray(j,o):r.slice(j,o));for(var k="";j<o;){var a=r[j++];if(!(a&128)){k+=String.fromCharCode(a);continue}var u=r[j++]&63;if((a&224)==192){k+=String.fromCharCode((a&31)<<6|u);continue}var c=r[j++]&63;if((a&240)==224?a=(a&15)<<12|u<<6|c:a=(a&7)<<18|u<<12|c<<6|r[j++]&63,a<65536)k+=String.fromCharCode(a);else{var f=a-65536;k+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return k},be=(r,j,s)=>r?qj(x,r,j,s):"",Oe=(r,j)=>{j=L(j);var s=!0;K(r,{name:j,fromWireType(l){var o=I[l>>2],k=l+4,a;if(s)a=be(k,o,!0);else{a="";for(var u=0;u<o;++u)a+=String.fromCharCode(x[k+u])}return O(l),a},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var k,a=typeof o=="string";a||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||p("Cannot pass non-string to std::string"),s&&a?k=Je(o):k=o.length;var u=ir(4+k+1),c=u+4;if(I[u>>2]=k,a)if(s)Ke(o,c,k+1);else for(var f=0;f<k;++f){var G=o.charCodeAt(f);G>255&&(O(u),p("String has UTF-16 code units that do not fit in 8 bits")),x[c+f]=G}else x.set(o,c);return l!==null&&l.push(O,u),u},readValueFromPointer:LA,destructorFunction(l){O(l)}})},fj=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,we=(r,j,s)=>{var l=r>>1,o=dj(sA,l,j/2,s);if(o-l>16&&fj)return fj.decode(sA.slice(l,o));for(var k="",a=l;a<o;++a){var u=sA[a];k+=String.fromCharCode(u)}return k},Pe=(r,j,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var l=j,o=s<r.length*2?s/2:r.length,k=0;k<o;++k){var a=r.charCodeAt(k);mA[j>>1]=a,j+=2}return mA[j>>1]=0,j-l},Me=r=>r.length*2,Te=(r,j,s)=>{for(var l="",o=r>>2,k=0;!(k>=j/4);k++){var a=I[o+k];if(!a&&!s)break;l+=String.fromCodePoint(a)}return l},Ue=(r,j,s)=>{if(s??=2147483647,s<4)return 0;for(var l=j,o=l+s-4,k=0;k<r.length;++k){var a=r.codePointAt(k);if(a>65535&&k++,Q[j>>2]=a,j+=4,j+4>o)break}return Q[j>>2]=0,j-l},Se=r=>{for(var j=0,s=0;s<r.length;++s){var l=r.codePointAt(s);l>65535&&s++,j+=4}return j},Ve=(r,j,s)=>{s=L(s);var l,o,k;j===2?(l=we,o=Pe,k=Me):(l=Te,o=Ue,k=Se),K(r,{name:s,fromWireType:a=>{var u=I[a>>2],c=l(a+4,u*j,!0);return O(a),c},toWireType:(a,u)=>{typeof u!="string"&&p(\`Cannot pass non-string to C++ string type \${s}\`);var c=k(u),f=ir(4+c+j);return I[f>>2]=c/j,o(u,f+4,c+j),a!==null&&a.push(O,f),f},readValueFromPointer:LA,destructorFunction(a){O(a)}})},We=(r,j)=>{j=L(j),K(r,{isVoid:!0,name:j,fromWireType:()=>{},toWireType:(s,l)=>{}})},Re=r=>{lr(r,!d,1,!i,65536,!1),h.threadInitTLS()},Cj=r=>{if(r instanceof wr||r=="unwind")return z;pA(1,r)},Xe=()=>{if(!zA())try{if(C){xA()&&or(z);return}QA(z)}catch(r){Cj(r)}},Gj=r=>{if(!hA)try{return r()}catch(j){Cj(j)}finally{Xe()}},ze=!Atomics.waitAsync||globalThis.navigator?.userAgent&&Number((navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./)||[])[2])<91,nr=r=>{if(!ze){var j=Atomics.waitAsync(Q,r>>2,r);j.value.then(yA);var s=r+128;Atomics.store(Q,s>>2,1)}},yA=()=>Gj(()=>{var r=xA();r&&(nr(r),gj())}),Qe=(r,j)=>{if(r==j)setTimeout(yA);else if(C)postMessage({targetThread:r,cmd:"checkMailbox"});else{var s=h.pthreads[r];if(!s)return;s.postMessage({cmd:"checkMailbox"})}},sr=[],Ye=(r,j,s,l,o,k,a)=>{sr.length=0;for(var u=o>>3,c=o+l>>3;u<c;){var f;W[u++]?f=W[u++]:f=EA[u++],sr.push(f)}var G=cn[r];h.currentProxiedOperationCallerThread=s;var m=G(...sr);if(h.currentProxiedOperationCallerThread=0,k){m.then($=>Fj(k,a,$));return}return m},Ze=r=>{C?postMessage({cmd:"cleanupThread",thread:r}):Mr(r)},An=r=>{},rn=()=>performance.timeOrigin+performance.now(),jn=9007199254740992,tn=-9007199254740992,en=r=>r<tn||r>jn?NaN:Number(r),nn=()=>{},sn=()=>{XA+=1},ln=()=>{throw sn(),"unwind"},on=r=>{RA("OOM")},an=r=>{var j=x.length;r>>>=0,on(r)};function pj(r){return C?iA(2,0,1,r):52}function hj(r,j,s,l){return C?iA(3,0,1,r,j,s,l):(j=en(j),70)}var kn=[null,[],[]],un=(r,j)=>{var s=kn[r];j===0||j===10?((r===1?SA:N)(qj(s)),s.length=0):s.push(j)};function mj(r,j,s,l){if(C)return iA(4,0,1,r,j,s,l);for(var o=0,k=0;k<s;k++){var a=I[j>>2],u=I[j+4>>2];j+=8;for(var c=0;c<u;c++)un(r,x[a+c]);o+=u}return I[l>>2]=o,0}h.init();for(var aA=new Uint8Array(123),T=25;T>=0;--T)aA[48+T]=52+T,aA[65+T]=T,aA[97+T]=26+T;if(aA[43]=62,aA[47]=63,se(),pe(),Bt(),e.noExitRuntime&&(YA=e.noExitRuntime),e.print&&(SA=e.print),e.printErr&&(N=e.printErr),e.wasmBinary&&(_r=e.wasmBinary),e.arguments&&(v=e.arguments),e.thisProgram&&(B=e.thisProgram),e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.shift()();var cn=[Vr,Wr,pj,hj,mj],Ej,Ij,xA,ir,O,dn,lr,$j,Fj,vj,Lj,or,gj,_j,Hj,yj,xj,qn,Dj;function fn(r){Ej=r.G,Ij=r.H,xA=r.J,ir=e._malloc=r.K,O=e._free=r.L,dn=r.M,lr=r.N,$j=r.O,Fj=r.P,vj=r.Q,Lj=r.R,or=r.S,gj=r.T,_j=r.U,Hj=r.V,yj=r.W,xj=r.X,qn=Dj=r.I}var Bj;function Cn(){Bj={i:Yt,C:Zt,h:re,o:je,n:Ee,m:$e,e:Fe,b:ve,D:_e,l:ye,q:xe,d:De,c:Be,E:Oe,g:Ve,p:We,z:Re,u:Qe,k:Ye,s:Ze,y:nr,B:An,x:nn,A:ln,f:rn,t:an,r:QA,w:pj,v:hj,j:mj,a:Y}}function Nj(){if(C){VA?.(e),Kr();return}Nt();function r(){e.calledRun=!0,!hA&&(Kr(),VA?.(e),e.onRuntimeInitialized?.(),Kt())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),r()},1)):r()}var tA;return C||(tA=await Or(),Nj()),Br?t=e:t=new Promise((r,j)=>{VA=r,Hr=j}),t}})();typeof Ft=="object"&&typeof UA=="object"?(UA.exports=TA,UA.exports.default=TA):typeof define=="function"&&define.amd&&define([],()=>TA);var ys=globalThis.name=="em-pthread";ys&&TA()});var J={};Fn(J,{AdditionalCaptureBlocks:()=>_n,AdditionalPlaybackBlocks:()=>gn,ClockJumpCheckInterval:()=>Kn,ClockJumpThreshold:()=>Jn,ConnectInterval:()=>Sn,ConnectTimeout:()=>Mn,DefaultRefreshRate:()=>yn,DefaultVideoCodec:()=>Vn,HealthCheckTimeout:()=>Nn,MainConnectionPingInterval:()=>bn,MaxNumberOfDecoders:()=>Dn,MinDBFs:()=>Oj,MinTokenLifetime:()=>Tn,MinTokenRefreshInterval:()=>Un,PlaybackPreload:()=>Hn,RenderQuantumSize:()=>Bn,VadPreload:()=>xn,WebRtcIceTimeout:()=>wn,WebRtcStatsSnapshotInterval:()=>On,WebRtcTimeout:()=>Pn});var gn=3,_n=3,Hn=3,yn=250,xn=3,Dn=512,Bn=128,Oj=-758.596,Nn=1e4,Kn=1e3,Jn=1e4,bn=3e3,On=1e3,wn=3e3,Pn=1e4,Mn=5e3,Tn=6e4,Un=5e3,Sn=[0,100,200,200,500],Vn="H264";function uA(n,A,t){return n.postMessage(A,t)}function ur(n){return n.sampleRate*.02*(n.stereo?2:1)}function cr(n,A){let t=ur(n),e=t*A,i=e+t;return n.samples.subarray(e,i)}function dr(n,A,t){n.headers[A]=t.id}function wj(n){return[n.values[0],n.values[1]]}function Pj(n,A){n.values[0]=A[0],n.values[1]=A[1]}function Mj(n,A){return n.values[2+A*5]}function Tj(n,A,t){n.values[2+A*5]=t}function Uj(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function Sj(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function Vj(n,A){return n.values[2+A*5+3]}function Wj(n,A,t){n.values[2+A*5+3]=t}function Rj(n,A){return n.values[2+A*5+4]}function Xj(n,A,t){n.values[2+A*5+4]=t}function zj(n){return n.values[0]!==0}function Qj(n){return n.values[1]}function Yj(n){return n.values[2]}function Zj(n){return n.values[3]}function At(n,A){return n.values[3]=A}function rt(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Wn;(n=>{let A;(t=>(t[t.InvalidPassword=-1]="InvalidPassword",t[t.Unknown=0]="Unknown",t[t.Unencrypted=1]="Unencrypted",t[t.Encrypted=2]="Encrypted"))(A=n.PeerCipherStatus||={})})(Wn||={});function st(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:jt}=globalThis,Rn=typeof jt?.noColor=="boolean"?jt.noColor:!1,Xn=!Rn;function fr(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function Cr(n,A){return Xn?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function qr(n){return Cr(n,fr([0],0))}function tt(n){return Cr(n,fr([1],22))}function zn(n){return Cr(n,fr([2],22))}var Ss=new RegExp(["[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)","(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TXZcf-nq-uy=><~]))"].join("|"),"g"),Qn=new Date,DA=(n=>(n[n.CRITICAL=0]="CRITICAL",n[n.ERROR=1]="ERROR",n[n.WARN=2]="WARN",n[n.INFO=3]="INFO",n[n.DEBUG=4]="DEBUG",n))(DA||{}),it={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Yn={4:zn,3:qr,2:qr,1:tt,0:tt};function Zn({message:n}){return String(n)}function et(n){return JSON.stringify({timestamp:n.date.toISOString(),level:DA[n.level],message:n.message,extra:n.extra})}function nt(n){function A(q,C){return[Math.floor(q/C),q%C]}function t(){let q,C=n.date.valueOf()-Qn.valueOf();[C,q]=A(C,1e3);let[v,B]=A(C,60);return\`\${v.toString().padStart(4,"0")}:\${B.toString().padStart(2,"0")}.\${q.toString().padStart(4,"0")}\`}function e(){return n.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(n.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(n.extra)}let i=it[n.level],d=n.logger.name!==void 0?\`@\${n.logger}\`:"";return\`\${qr(t())}\${d} \${i} \${Yn[n.level](String(n.message))}\${e()}\`}function As(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${DA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",i=it[n.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${e}\${n.message}\`}function rs(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var lt=class{static sparse=Zn;static json=et;static pretty=nt;static structured=As;static default=rs()?nt:et;constructor(){}},js=class{formatter;consoleObject;filter;constructor(n=lt.default,A=4,t=console){this.filter=A,this.formatter=n,this.consoleObject=t}handle(n){let A=this.formatter(n);switch(n.level){case 1:this.consoleObject.error(A);break;case 2:this.consoleObject.warn(A);break;case 3:this.consoleObject.info(A);break;case 4:this.consoleObject.debug(A);break}}};var R=class{#A;sinks;filter;parent;get name(){return this.#A}constructor(n,A=void 0,t=[],e=void 0){this.#A=A,this.sinks=t,this.filter=n,this.parent=e}log(n,A,t=void 0){let e={date:new Date,level:n,logger:this,message:A,extra:t};this.filter<n||this.insert(e)}insert(n){if(!(this.filter<n.level)){for(let A of this.sinks)A.filter>=n.level&&A.handle(n);this.parent!==void 0&&this.parent.insert(n)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},cA=new R(3,void 0,[new js]),ts=R.prototype.log.bind(cA,1),es=R.prototype.log.bind(cA,2),ot=R.prototype.log.bind(cA,3),ns=R.prototype.log.bind(cA,4),Vs=R.prototype.log.bind(cA);var at;function kt(n,...A){let t=ss(A);at?at?.info(n,t):ot(n,t)}function ss(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function BA(n){return n.connectionId*4294967296+n.mediaId}function ut(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function U(n,A,t){let e;switch(A){case"f32":e=n.HEAPF32;break;case"u32":e=n.HEAPU32;break;case"i32":e=n.HEAP32;break;case"u8":e=n.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let i=n._malloc(t*e.BYTES_PER_ELEMENT);if(i===0||i%e.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${t} \${A} array\`);let d=i/e.BYTES_PER_ELEMENT;return e.subarray(d,d+t)}function eA(n,A){n._free(A.byteOffset)}function Gr(n,A,t,e){return{headers:U(n,"i32",t),samples:U(n,"f32",t*ur({sampleRate:A,stereo:e})),length:t,sampleRate:A,stereo:e}}function pr(n,A){eA(n,A.headers),eA(n,A.samples)}function ct(n,A){return{values:U(n,"f32",2+A*5),length:A}}function dt(n,A){eA(n,A.values)}function qt(n){return{values:U(n,"f32",4)}}function ft(n,A){eA(n,A.values)}function Ct(n){let A=n.length,t=0,e=0;for(;e<A;){let i=n.charCodeAt(e++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&e<A){let d=n.charCodeAt(e);(d&64512)===56320&&(++e,i=((i&1023)<<10)+(d&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function is(n,A,t){let e=n.length,i=t,d=0;for(;d<e;){let q=n.charCodeAt(d++);if((q&4294967168)===0){A[i++]=q;continue}else if((q&4294965248)===0)A[i++]=q>>6&31|192;else{if(q>=55296&&q<=56319&&d<e){let C=n.charCodeAt(d);(C&64512)===56320&&(++d,q=((q&1023)<<10)+(C&1023)+65536)}(q&4294901760)===0?(A[i++]=q>>12&15|224,A[i++]=q>>6&63|128):(A[i++]=q>>18&7|240,A[i++]=q>>12&63|128,A[i++]=q>>6&63|128)}A[i++]=q&63|128}}var ls=new TextEncoder,os=50;function as(n,A,t){ls.encodeInto(n,A.subarray(t))}function Gt(n,A,t){n.length>os?as(n,A,t):is(n,A,t)}var ks=4096;function hr(n,A,t){let e=A,i=e+t,d=[],q="";for(;e<i;){let C=n[e++];if((C&128)===0)d.push(C);else if((C&224)===192){let v=n[e++]&63;d.push((C&31)<<6|v)}else if((C&240)===224){let v=n[e++]&63,B=n[e++]&63;d.push((C&31)<<12|v<<6|B)}else if((C&248)===240){let v=n[e++]&63,B=n[e++]&63,pA=n[e++]&63,P=(C&7)<<18|v<<12|B<<6|pA;P>65535&&(P-=65536,d.push(P>>>10&1023|55296),P=56320|P&1023),d.push(P)}else d.push(C);d.length>=ks&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var us=new TextDecoder,cs=200;function ds(n,A,t){let e=n.subarray(A,A+t);return us.decode(e)}function pt(n,A,t){return t>cs?ds(n,A,t):hr(n,A,t)}var X=class{constructor(A,t){this.type=A,this.data=t}};var g=class n extends Error{constructor(A){super(A);let t=Object.create(n.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:n.name})}};function ht(n,A,t){let e=t/4294967296,i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function NA(n,A,t){let e=Math.floor(t/4294967296),i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function KA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function mt(n,A){let t=n.getUint32(A),e=n.getUint32(A+4);return t*4294967296+e}var qs=-1,fs=4294967296-1,Cs=17179869184-1;function Gs({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=Cs)if(A===0&&n<=fs){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,n),t}else{let t=n/4294967296,e=n&4294967295,i=new Uint8Array(8),d=new DataView(i.buffer);return d.setUint32(0,A<<2|t&3),d.setUint32(4,e),i}else{let t=new Uint8Array(12),e=new DataView(t.buffer);return e.setUint32(0,A),NA(e,4,n),t}}function ps(n){let A=n.getTime(),t=Math.floor(A/1e3),e=(A-t*1e3)*1e6,i=Math.floor(e/1e9);return{sec:t+i,nsec:e-i*1e9}}function hs(n){if(n instanceof Date){let A=ps(n);return Gs(A)}else return null}function ms(n){let A=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let t=A.getUint32(0),e=A.getUint32(4),i=(t&3)*4294967296+e,d=t>>>2;return{sec:i,nsec:d}}case 12:{let t=KA(A,4),e=A.getUint32(0);return{sec:t,nsec:e}}default:throw new g(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function Es(n){let A=ms(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Et={type:qs,encode:hs,decode:Es};var S=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Et)}register({type:A,encode:t,decode:e}){if(A>=0)this.encoders[A]=t,this.decoders[A]=e;else{let i=-1-A;this.builtInEncoders[i]=t,this.builtInDecoders[i]=e}}tryToEncode(A,t){for(let e=0;e<this.builtInEncoders.length;e++){let i=this.builtInEncoders[e];if(i!=null){let d=i(A,t);if(d!=null){let q=-1-e;return new X(q,d)}}}for(let e=0;e<this.encoders.length;e++){let i=this.encoders[e];if(i!=null){let d=i(A,t);if(d!=null){let q=e;return new X(q,d)}}}return A instanceof X?A:null}decode(A,t,e){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,e):new X(t,A)}};S.defaultCodec=new S;function Is(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function dA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):Is(n)?new Uint8Array(n):Uint8Array.from(n)}var $s=100,Fs=2048,JA=class n{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??S.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??$s,this.initialBufferSize=A?.initialBufferSize??Fs,this.sortKeys=A?.sortKeys??!1,this.forceFloat32=A?.forceFloat32??!1,this.ignoreUndefined=A?.ignoreUndefined??!1,this.forceIntegerToFloat=A?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new n({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(A){if(this.entered)return this.clone().encodeSharedRef(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(A){if(this.entered)return this.clone().encode(A);try{return this.entered=!0,this.reinitializeState(),this.doEncode(A,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(A,t){if(t>this.maxDepth)throw new Error(\`Too deep objects in depth \${t}\`);A==null?this.encodeNil():typeof A=="boolean"?this.encodeBoolean(A):typeof A=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(A):this.encodeNumber(A):typeof A=="string"?this.encodeString(A):this.useBigInt64&&typeof A=="bigint"?this.encodeBigInt64(A):this.encodeObject(A,t)}ensureBufferSizeToWrite(A){let t=this.pos+A;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(A){let t=new ArrayBuffer(A),e=new Uint8Array(t),i=new DataView(t);e.set(this.bytes),this.view=i,this.bytes=e}encodeNil(){this.writeU8(192)}encodeBoolean(A){A===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(A){!this.forceIntegerToFloat&&Number.isSafeInteger(A)?A>=0?A<128?this.writeU8(A):A<256?(this.writeU8(204),this.writeU8(A)):A<65536?(this.writeU8(205),this.writeU16(A)):A<4294967296?(this.writeU8(206),this.writeU32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(207),this.writeU64(A)):A>=-32?this.writeU8(224|A+32):A>=-128?(this.writeU8(208),this.writeI8(A)):A>=-32768?(this.writeU8(209),this.writeI16(A)):A>=-2147483648?(this.writeU8(210),this.writeI32(A)):this.useBigInt64?this.encodeNumberAsFloat(A):(this.writeU8(211),this.writeI64(A)):this.encodeNumberAsFloat(A)}encodeNumberAsFloat(A){this.forceFloat32?(this.writeU8(202),this.writeF32(A)):(this.writeU8(203),this.writeF64(A))}encodeBigInt64(A){A>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(A)):(this.writeU8(211),this.writeBigInt64(A))}writeStringHeader(A){if(A<32)this.writeU8(160+A);else if(A<256)this.writeU8(217),this.writeU8(A);else if(A<65536)this.writeU8(218),this.writeU16(A);else if(A<4294967296)this.writeU8(219),this.writeU32(A);else throw new Error(\`Too long string: \${A} bytes in UTF-8\`)}encodeString(A){let e=Ct(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),Gt(A,this.bytes,this.pos),this.pos+=e}encodeObject(A,t){let e=this.extensionCodec.tryToEncode(A,this.context);if(e!=null)this.encodeExtension(e);else if(Array.isArray(A))this.encodeArray(A,t);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,t);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let t=A.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(\`Too large binary: \${t}\`);let e=dA(A);this.writeU8a(e)}encodeArray(A,t){let e=A.length;if(e<16)this.writeU8(144+e);else if(e<65536)this.writeU8(220),this.writeU16(e);else if(e<4294967296)this.writeU8(221),this.writeU32(e);else throw new Error(\`Too large array: \${e}\`);for(let i of A)this.doEncode(i,t+1)}countWithoutUndefined(A,t){let e=0;for(let i of t)A[i]!==void 0&&e++;return e}encodeMap(A,t){let e=Object.keys(A);this.sortKeys&&e.sort();let i=this.ignoreUndefined?this.countWithoutUndefined(A,e):e.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(\`Too large map object: \${i}\`);for(let d of e){let q=A[d];this.ignoreUndefined&&q===void 0||(this.encodeString(d),this.doEncode(q,t+1))}}encodeExtension(A){if(typeof A.data=="function"){let e=A.data(this.pos+6),i=e.length;if(i>=4294967296)throw new Error(\`Too large extension object: \${i}\`);this.writeU8(201),this.writeU32(i),this.writeI8(A.type),this.writeU8a(e);return}let t=A.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(\`Too large extension object: \${t}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let t=A.length;this.ensureBufferSizeToWrite(t),this.bytes.set(A,this.pos),this.pos+=t}writeI8(A){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,A),this.pos++}writeU16(A){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,A),this.pos+=2}writeI16(A){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,A),this.pos+=2}writeU32(A){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,A),this.pos+=4}writeI32(A){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,A),this.pos+=4}writeF32(A){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,A),this.pos+=4}writeF64(A){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,A),this.pos+=8}writeU64(A){this.ensureBufferSizeToWrite(8),ht(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),NA(this.view,this.pos,A),this.pos+=8}writeBigUint64(A){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,A),this.pos+=8}writeBigInt64(A){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,A),this.pos+=8}};function mr(n,A){return new JA(A).encodeSharedRef(n)}function bA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var vs=16,Ls=16,OA=class{constructor(A=vs,t=Ls){this.hit=0,this.miss=0,this.maxKeyLength=A,this.maxLengthPerKey=t,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,t,e){let i=this.caches[e-1];A:for(let d of i){let q=d.bytes;for(let C=0;C<e;C++)if(q[C]!==A[t+C])continue A;return d.str}return null}store(A,t){let e=this.caches[A.length-1],i={bytes:A,str:t};e.length>=this.maxLengthPerKey?e[Math.random()*e.length|0]=i:e.push(i)}decode(A,t,e){let i=this.find(A,t,e);if(i!=null)return this.hit++,i;this.miss++;let d=hr(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var Er="array",CA="map_key",$t="map_value",gs=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new g("The type of key must be string or number but "+typeof n)},Ir=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let t=this.getUninitializedStateFromPool();t.type=Er,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=CA,t.readCount=0,t.size=A,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let A={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(A)}return this.stack[this.stackHeadPosition]}release(A){if(this.stack[this.stackHeadPosition]!==A)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(A.type===Er){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===CA||A.type===$t){let e=A;e.size=0,e.map=void 0,e.readCount=0,e.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},fA=-1,$r=new DataView(new ArrayBuffer(0)),_s=new Uint8Array($r.buffer);try{$r.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var It=new RangeError("Insufficient data"),Hs=new OA,wA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=$r,this.bytes=_s,this.headByte=fA,this.stack=new Ir,this.entered=!1,this.extensionCodec=A?.extensionCodec??S.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.rawStrings=A?.rawStrings??!1,this.maxStrLength=A?.maxStrLength??4294967295,this.maxBinLength=A?.maxBinLength??4294967295,this.maxArrayLength=A?.maxArrayLength??4294967295,this.maxMapLength=A?.maxMapLength??4294967295,this.maxExtLength=A?.maxExtLength??4294967295,this.keyDecoder=A?.keyDecoder!==void 0?A.keyDecoder:Hs,this.mapKeyConverter=A?.mapKeyConverter??gs}clone(){return new n({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=fA,this.stack.reset()}setBuffer(A){let t=dA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===fA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=dA(A),i=new Uint8Array(t.length+e.length);i.set(t),i.set(e,t.length),this.setBuffer(i)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:t,pos:e}=this;return new RangeError(\`Extra \${t.byteLength-e} of \${t.byteLength} byte(s) found at buffer[\${A}]\`)}decode(A){if(this.entered)return this.clone().decode(A);try{this.entered=!0,this.reinitializeState(),this.setBuffer(A);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(A){if(this.entered){yield*this.clone().decodeMulti(A);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(A);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(A){if(this.entered)return this.clone().decodeAsync(A);try{this.entered=!0;let t=!1,e;for await(let C of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(C);try{e=this.doDecodeSync(),t=!0}catch(v){if(!(v instanceof RangeError))throw v}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return e}let{headByte:i,pos:d,totalPos:q}=this;throw new RangeError(\`Insufficient data in parsing \${bA(i)} at \${q} (\${d} in the current buffer)\`)}finally{this.entered=!1}}decodeArrayStream(A){return this.decodeMultiAsync(A,!0)}decodeStream(A){return this.decodeMultiAsync(A,!1)}async*decodeMultiAsync(A,t){if(this.entered){yield*this.clone().decodeMultiAsync(A,t);return}try{this.entered=!0;let e=t,i=-1;for await(let d of A){if(t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),e&&(i=this.readArraySize(),e=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(q){if(!(q instanceof RangeError))throw q}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){A:for(;;){let A=this.readHeadByte(),t;if(A>=224)t=A-256;else if(A<192)if(A<128)t=A;else if(A<144){let i=A-128;if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A<160){let i=A-144;if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else{let i=A-160;t=this.decodeString(i,0)}else if(A===192)t=null;else if(A===194)t=!1;else if(A===195)t=!0;else if(A===202)t=this.readF32();else if(A===203)t=this.readF64();else if(A===204)t=this.readU8();else if(A===205)t=this.readU16();else if(A===206)t=this.readU32();else if(A===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(A===208)t=this.readI8();else if(A===209)t=this.readI16();else if(A===210)t=this.readI32();else if(A===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(A===217){let i=this.lookU8();t=this.decodeString(i,1)}else if(A===218){let i=this.lookU16();t=this.decodeString(i,2)}else if(A===219){let i=this.lookU32();t=this.decodeString(i,4)}else if(A===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue A}else t=[]}else if(A===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue A}else t={}}else if(A===196){let i=this.lookU8();t=this.decodeBinary(i,1)}else if(A===197){let i=this.lookU16();t=this.decodeBinary(i,2)}else if(A===198){let i=this.lookU32();t=this.decodeBinary(i,4)}else if(A===212)t=this.decodeExtension(1,0);else if(A===213)t=this.decodeExtension(2,0);else if(A===214)t=this.decodeExtension(4,0);else if(A===215)t=this.decodeExtension(8,0);else if(A===216)t=this.decodeExtension(16,0);else if(A===199){let i=this.lookU8();t=this.decodeExtension(i,1)}else if(A===200){let i=this.lookU16();t=this.decodeExtension(i,2)}else if(A===201){let i=this.lookU32();t=this.decodeExtension(i,4)}else throw new g(\`Unrecognized type byte: \${bA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let i=e.top();if(i.type===Er)if(i.array[i.position]=t,i.position++,i.position===i.size)t=i.array,e.release(i);else continue A;else if(i.type===CA){if(t==="__proto__")throw new g("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=$t;continue A}else if(i.map[i.key]=t,i.readCount++,i.readCount===i.size)t=i.map,e.release(i);else{i.key=null,i.type=CA;continue A}}return t}}readHeadByte(){return this.headByte===fA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=fA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new g(\`Unrecognized array type byte: \${bA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new g(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new g(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,t):this.decodeBinary(A,t)}decodeUtf8String(A,t){if(A>this.maxStrLength)throw new g(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw It;let e=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,e,A):i=pt(this.bytes,e,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===CA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new g(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw It;let e=this.pos+t,i=this.bytes.subarray(e,e+A);return this.pos+=t+A,i}decodeExtension(A,t){if(A>this.maxExtLength)throw new g(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let e=this.view.getInt8(this.pos+t),i=this.decodeBinary(A,t+1);return this.extensionCodec.decode(i,e,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let A=this.view.getUint8(this.pos);return this.pos++,A}readI8(){let A=this.view.getInt8(this.pos);return this.pos++,A}readU16(){let A=this.view.getUint16(this.pos);return this.pos+=2,A}readI16(){let A=this.view.getInt16(this.pos);return this.pos+=2,A}readU32(){let A=this.view.getUint32(this.pos);return this.pos+=4,A}readI32(){let A=this.view.getInt32(this.pos);return this.pos+=4,A}readU64(){let A=mt(this.view,this.pos);return this.pos+=8,A}readI64(){let A=KA(this.view,this.pos);return this.pos+=8,A}readU64AsBigInt(){let A=this.view.getBigUint64(this.pos);return this.pos+=8,A}readI64AsBigInt(){let A=this.view.getBigInt64(this.pos);return this.pos+=8,A}readF32(){let A=this.view.getFloat32(this.pos);return this.pos+=4,A}readF64(){let A=this.view.getFloat64(this.pos);return this.pos+=8,A}};function Fr(n,A){return new wA(A).decode(n)}var GA=class n{constructor(A,t,e,i,d){this.mediaIds=A;this.sequenceNumber=t;this.timeStamp=e;this.isEndOfSpurt=i;this.payload=d}static parse(A){let t;try{t=Fr(A)}catch{return D("not valid msgpack")}if(!Array.isArray(t))return D("container must be an array");if(t.length<6)return D("missing fields");if(t[0]!==1)return D("unknown type");if(!Array.isArray(t[1]))return D("media ids must be an array");if(!t[1].every(B=>typeof B=="number"))return D("media ids must be numbers");if(typeof t[2]!="number")return D("sequence number must be a number");if(typeof t[3]!="number")return D("timestamp must be a number");if(typeof t[4]!="number")return D("flags must be a number");let e=t[1],i=t[2]>>>0,d=t[3]>>>0,C=(t[4]&1)!==0,v=t[t.length-1];return v instanceof Uint8Array?st(new n(e,i,d,C,v)):D("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),t=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(mr(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var PA=class{constructor(A,t){this.sampleRate=A;this.wasm=t;this.sequenceNumber=Math.random()*Math.pow(2,32)>>0;this.timestamp=Math.random()*Math.pow(2,32)>>0;this.connections=[];this.monitoring=!1;this.active=!1;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0};this.encoder=new t.Encoder(A,15,!0,J.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=qt(this.wasm),this.outBuffer=U(this.wasm,"u8",1270),At(this.information,1)}setVad(A){this.encoder.set_volume_gate(A.volumeGate!==void 0,A.volumeGate?.attackThreshold??0,A.volumeGate?.releaseThreshold??0),this.encoder.set_speech_detection(A.voiceActivity!==void 0,A.voiceActivity?.attackThreshold??0,A.voiceActivity?.releaseThreshold??0)}setMedias(A){this.connections=A.filter(({mediaIds:t})=>t.length>0)}close(){ft(this.wasm,this.information),eA(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let t=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(t===0)break;if(t<0){kt(\`failed encoding packet: \${t}\`);return}if(this.timestamp=this.timestamp+1800>>0,t===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let e=this.active&&!this.encoder.active;this.active=this.encoder.active,this.monitoring=this.connections.some(i=>i.id===0);for(let i of this.connections){if(this.monitoring&&i.id!==0)continue;let d=new GA(i.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));uA(globalThis,["sendPacket",{connectionId:i.id,packet:d.toBytes()}])}}}onMessage(A){let[t,e]=A;switch(t){case"captureSetVad":this?.setVad(e);break;case"captureSetMedias":this?.setMedias(e.connections);break;case"close":this.close();break;case"dump":e.result.postMessage(this.dump());break}}dump(){return{sequenceNumber:this.sequenceNumber,timestamp:this.timestamp,connections:this.connections.map(A=>\`\${A.id} => \${A.mediaIds.join(",")}\`),active:this.active,monitoring:this.monitoring,information:{active:zj(this.information),speechProbability:Qj(this.information),rmsDBFS:Yj(this.information),volume:Zj(this.information)},encoder:{sample_rate:this.encoder.sample_rate,fec_packet_loss:this.encoder.fec_packet_loss,voip:this.encoder.voip,vad_preload:this.encoder.vad_preload,complexity:this.encoder.complexity,speech_probability:this.encoder.speech_probability,rms_dbfs:this.encoder.rms_dbfs,active:this.encoder.active,speech_detection_enabled:this.encoder.speech_detection_enabled,speech_detection_going_active:this.encoder.speech_detection_going_active,speech_detection_going_inactive:this.encoder.speech_detection_going_inactive,volume_gate_enabled:this.encoder.volume_gate_enabled,volume_gate_going_active:this.encoder.volume_gate_going_active,volume_gate_going_inactive:this.encoder.volume_gate_going_inactive}}}},MA=class{constructor(A){this.wasm=A;this.medias=new Map;this.stats={numberPackets:0,numberTicks:0,numberPacketError:0,numberPacketsMediaNotFound:0,numberTicksWithAudio:0};this.largestIndex=-1;this.decoders=U(this.wasm,"u32",J.MaxNumberOfDecoders),this.information=ct(this.wasm,J.MaxNumberOfDecoders),Pj(this.information,[1,1])}close(){dt(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=GA.parse(t);if(e.type==="Failure"){this.stats.numberPacketError++;let i=Array.from(t).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${e.reason}, connection: \${A}, dump: \${i}\`);return}for(let i of e.value.mediaIds){let d=this.medias.get(BA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=U(this.wasm,"u8",e.value.payload.length);q.set(e.value.payload),d.decoder.push(e.value.sequenceNumber,e.value.timeStamp,e.value.isEndOfSpurt,q.byteOffset,q.length)}}insertMedia(A,t,e,i=[1,1]){let d=BA({connectionId:t,mediaId:e}),q=new this.wasm.Decoder;this.medias.set(d,{index:A,decoder:q,lastPacket:void 0}),this.decoders[A]=q.$$.ptr,this.largestIndex=Math.max(this.largestIndex,A),Sj(this.information,A,i),Xj(this.information,A,0),Wj(this.information,A,0)}removeMedia(A,t,e){let i=BA({connectionId:t,mediaId:e}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Tj(this.information,A,0),this.decoders[A]=0,d.decoder.delete(),A===this.largestIndex)){for(A=A-1;A>=0&&this.decoders[A]===0;A--);this.largestIndex=A}}decode(A){return{hasAudio:this.wasm.pop_many(this.decoders.byteOffset,this.information.values.byteOffset,this.largestIndex+1,A.byteOffset)}}onMessage(A){let[t,e]=A;switch(t){case"playbackReceivePacket":this.receivePacket(e.connectionId,e.packet);break;case"playbackUpdateMedias":for(let{index:i,connectionId:d,mediaId:q}of e.removed)this.removeMedia(i,d,q);for(let{index:i,connectionId:d,mediaId:q,volume:C}of e.added)this.insertMedia(i,d,q,C);break;case"close":this.close();break;case"dump":e.result.postMessage(this.dump());break}}dump(){let A=[];for(let[t,e]of this.medias){let i=ut(t);A.push({index:e.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:Mj(this.information,e.index),volume:Uj(this.information,e.index),voicedBlocks:Rj(this.information,e.index),silentBlocks:Vj(this.information,e.index),time:e.decoder.time,consecutive_silence:e.decoder.consecutive_silence,last_voiced_time_point:e.decoder.last_voiced_time_point,sequence_number:e.decoder.sequence_number,packetsSeen:e.decoder.packets_seen,packetsInvalid:e.decoder.packets_invalid,packetsTooLate:e.decoder.packets_too_late,packetsTooEarly:e.decoder.packets_too_early,packetsRepeated:e.decoder.packets_repeated,packetsProcessed:e.decoder.packets_processed,packetsLost:e.decoder.packets_lost,rewinds:e.decoder.rewinds,cacheLength:e.decoder.cache_length,lastPacket:rt(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:wj(this.information),decoders:A}}};var Ht=Ln(vt()),Lt=(0,Ht.default)(),gt,_t;globalThis.addEventListener("message",vr);async function vr(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=vr,gt=new Lr(e.sampleRate,await Lt);break;case"playbackInit":e.workletPort.onmessage=vr,_t=new gr(await Lt);break;case"close":globalThis.close();break}gt?.onMessage(A),_t?.onMessage(A)}var Lr=class extends PA{constructor(t,e){super(t,e);this.id=-1;this.samples=Gr(this.wasm,t,2+J.VadPreload+J.AdditionalCaptureBlocks,!1),uA(globalThis,["captureReady",{sampleBuffer:this.samples,informationBuffer:this.information}])}close(){super.close(),pr(this.wasm,this.samples)}onMessage(t){super.onMessage(t);let[e,i]=t;e==="captureTick"&&this.tick(i.id)}tick(t){for(;this.id<t;this.id+=1)this.encode(cr(this.samples,this.id%this.samples.length))}dump(){return{type:"shared capture worker",id:this.id,sampleRate:this.samples.sampleRate,stereo:this.samples.stereo,length:this.samples.length,...super.dump()}}},gr=class extends MA{constructor(A){super(A);let t=2+J.AdditionalPlaybackBlocks;this.sampleBuffer=Gr(A,48e3,t,!0),this.sampleBuffer.samples.fill(0),this.prefill=t-2;for(let e=0;e<this.prefill;e++)dr(this.sampleBuffer,e,{id:e});this.id=this.prefill,uA(globalThis,["playbackReady",{sampleBuffer:this.sampleBuffer,informationBuffer:this.information}])}close(){super.close(),pr(this.wasm,this.sampleBuffer)}onMessage(A){super.onMessage(A);let[t,e]=A;t==="playbackTick"&&this.tick(e.id)}tick(A){for(this.stats.numberTicks++;this.id<A+this.prefill;this.id++){let t=this.id%this.sampleBuffer.length,{hasAudio:e}=this.decode(cr(this.sampleBuffer,t));e&&(this.stats.numberTicksWithAudio++,dr(this.sampleBuffer,t,{id:this.id}))}}dump(){return{type:"shared playback worker",id:this.id,prefill:this.prefill,sampleRate:this.sampleBuffer.sampleRate,stereo:this.sampleBuffer.stereo,...super.dump()}}};})();
|
|
3223
|
+
`;var G='"use strict";(()=>{var R=Object.defineProperty;var F=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})};var l={};F(l,{AdditionalCaptureBlocks:()=>C,AdditionalPlaybackBlocks:()=>D,ClockJumpCheckInterval:()=>$,ClockJumpThreshold:()=>j,ConnectInterval:()=>K,ConnectTimeout:()=>Z,DefaultRefreshRate:()=>V,DefaultVideoCodec:()=>X,HealthCheckTimeout:()=>W,MainConnectionPingInterval:()=>H,MaxNumberOfDecoders:()=>_,MinDBFs:()=>k,MinTokenLifetime:()=>q,MinTokenRefreshInterval:()=>Q,PlaybackPreload:()=>L,RenderQuantumSize:()=>N,VadPreload:()=>O,WebRtcIceTimeout:()=>z,WebRtcStatsSnapshotInterval:()=>J,WebRtcTimeout:()=>G});var D=3,C=3,L=3,V=250,O=3,_=512,N=128,k=-758.596,W=1e4,$=1e3,j=1e4,H=3e3,J=1e3,z=3e3,G=1e4,Z=5e3,q=6e4,Q=5e3,K=[0,100,200,200,500],X="H264";function p(e,t,r){return e.postMessage(t,r)}function Y(e){return e.sampleRate*.02*(e.stereo?2:1)}function f(e,t){let r=Y(e),n=r*t,s=n+r;return e.samples.subarray(n,s)}function S(e,t){return{id:e.headers[t]}}function I(e,t,r){e.headers[t]=r.id}var ee;(e=>{let t;(r=>(r[r.InvalidPassword=-1]="InvalidPassword",r[r.Unknown=0]="Unknown",r[r.Unencrypted=1]="Unencrypted",r[r.Encrypted=2]="Encrypted"))(t=e.PeerCipherStatus||={})})(ee||={});var{Deno:U}=globalThis,te=typeof U?.noColor=="boolean"?U.noColor:!1,re=!te;function h(e,t){return{open:`\\x1B[${e.join(";")}m`,close:`\\x1B[${t}m`,regexp:new RegExp(`\\\\x1b\\\\[${t}m`,"g")}}function b(e,t){return re?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function m(e){return b(e,h([0],0))}function T(e){return b(e,h([1],22))}function ne(e){return b(e,h([2],22))}var Te=new RegExp(["[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)","(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TXZcf-nq-uy=><~]))"].join("|"),"g"),se=new Date,d=(e=>(e[e.CRITICAL=0]="CRITICAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(d||{}),P={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},oe={4:ne,3:m,2:m,1:T,0:T};function ae({message:e}){return String(e)}function B(e){return JSON.stringify({timestamp:e.date.toISOString(),level:d[e.level],message:e.message,extra:e.extra})}function w(e){function t(c,i){return[Math.floor(c/i),c%i]}function r(){let c,i=e.date.valueOf()-se.valueOf();[i,c]=t(i,1e3);let[M,E]=t(i,60);return`${M.toString().padStart(4,"0")}:${E.toString().padStart(2,"0")}.${c.toString().padStart(4,"0")}`}function n(){return e.extra===void 0?"":typeof Deno=="object"?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let s=P[e.level],a=e.logger.name!==void 0?`@${e.logger}`:"";return`${m(r())}${a} ${s} ${oe[e.level](String(e.message))}${n()}`}function ie(e){let t=`[${e.date.toISOString()}]`,r=`[${d[e.level]}]`,n=e.logger.name!==void 0?`[${e.logger.name}] `:"",s=P[e.level];return`${t} ${s} ${r.padEnd(7," ")} ${n}${e.message}`}function ce(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var A=class{static sparse=ae;static json=B;static pretty=w;static structured=ie;static default=ce()?w:B;constructor(){}},le=class{formatter;consoleObject;filter;constructor(e=A.default,t=4,r=console){this.filter=t,this.formatter=e,this.consoleObject=r}handle(e){let t=this.formatter(e);switch(e.level){case 1:this.consoleObject.error(t);break;case 2:this.consoleObject.warn(t);break;case 3:this.consoleObject.info(t);break;case 4:this.consoleObject.debug(t);break}}};var o=class{#e;sinks;filter;parent;get name(){return this.#e}constructor(e,t=void 0,r=[],n=void 0){this.#e=t,this.sinks=r,this.filter=e,this.parent=n}log(e,t,r=void 0){let n={date:new Date,level:e,logger:this,message:t,extra:r};this.filter<e||this.insert(n)}insert(e){if(!(this.filter<e.level)){for(let t of this.sinks)t.filter>=e.level&&t.handle(e);this.parent!==void 0&&this.parent.insert(e)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},u=new o(3,void 0,[new le]),ue=o.prototype.log.bind(u,1),fe=o.prototype.log.bind(u,2),de=o.prototype.log.bind(u,3),pe=o.prototype.log.bind(u,4),Be=o.prototype.log.bind(u);var x=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.blocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"init":this.state=new g(s.sampleBuffer,s.workerPort,sampleRate*.02);break;case"close":this.alive=!1;break;case"dump":s.result.postMessage(this.dump());break}}process(r,n,s){if(this.state===void 0||r.length<1||r[0].length<1)return this.alive;let a=this.state.fill(0,r[0][0]);return this.state.offset===this.state.length&&(this.blocks+=1,this.state.flush(),this.state.fill(a,r[0][0])),this.alive}dump(){return{type:"shared capture worklet",alive:this.alive,sampleRate,id:this.state?.id||null,offset:this.state?.offset||null,length:this.state?.length||null,blocks:this.blocks}}},y=class extends AudioWorkletProcessor{constructor(){super();this.alive=!0;this.silenceBlocks=0;this.voiceBlocks=0;this.totalBlocks=0;this.port.onmessage=this.onMessage.bind(this)}async onMessage(r){let[n,s]=r.data;switch(n){case"close":this.alive=!1;break;case"init":this.state=new v(s.workerPort,s.sampleBuffer,sampleRate*.02);break;case"dump":s.result.postMessage(this.dump());break}n==="close"&&(this.alive=!1)}process(r,n,s){if(this.state===void 0||n.length<1||n[0].length<2)return this.alive;let a=this.state.fill(0,n[0][0],n[0][1]);return a<l.RenderQuantumSize&&(this.totalBlocks+=1,this.state.next(),this.state.hasVoice?this.voiceBlocks+=1:this.silenceBlocks+=1,this.state.fill(a,n[0][0],n[0][1])),this.alive}dump(){return{type:"shared playback worklet",alive:this.alive,sampleRate,id:this.state?.id||null,offset:this.state?.offset||null,length:this.state?.length||null,hasVoice:this.state?.hasVoice??!1,silenceBlocks:this.silenceBlocks,voiceBlocks:this.voiceBlocks,totalBlocks:this.totalBlocks}}},g=class{constructor(t,r,n){this.samples=t;this.port=r;this.length=n;this.id=0,this.offset=0,this.entry=f(this.samples,0)}fill(t,r){let n=Math.min(r.length-t,this.length-this.offset);return this.entry.set(r.subarray(t,t+n),this.offset),this.offset+=n,t+n}flush(){this.id+=1,p(this.port,["captureTick",{id:this.id}]);let t=this.id%this.samples.length;this.entry=f(this.samples,t),I(this.samples,t,{id:this.id}),this.offset=0}},v=class{constructor(t,r,n){this.port=t;this.samples=r;this.length=n;this.id=-1,this.offset=0,this.entry=void 0,this.next()}get hasVoice(){return this.entry!==void 0}fill(t,r,n){let s=Math.min(l.RenderQuantumSize-t,this.length-this.offset);return this.entry!==void 0&&(r.set(this.entry.subarray(this.offset,this.offset+s),t),n.set(this.entry.subarray(this.offset+this.length,this.offset+this.length+s),t)),this.offset+=s,t+s}next(){this.id+=1;let t=this.id%this.samples.length,{id:r}=S(this.samples,t);this.entry=this.id===r?f(this.samples,t):void 0,this.offset=0,p(this.port,["playbackTick",{id:this.id}])}};registerProcessor("OdinCaptureProcessor",x);registerProcessor("OdinPlaybackProcessor",y);})();\n';var lx=new J.Strand;function ix(A,F,x,D,r=f.DefaultRefreshRate){return lx.enqueue(async()=>{let[j,B]=await q(c,G,A,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return p.create(A,F,x,j,B,D)})}async function ox(A,F=f.DefaultRefreshRate){if(A.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,D]=await q(c,G,A,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return h.create(A,x,D)}var h=class A extends n{constructor(x,D,r,j){super(x,D,r);this.information=j}static async create(x,D,r){let{port1:j,port2:B}=new MessageChannel;v(D,["playbackInit",{workletPort:j}],[j]);let{informationBuffer:t,sampleBuffer:s}=await k(D,"playbackReady");return u(t,[1,1]),v(r.port,["init",{sampleBuffer:s,workerPort:B}],[B]),r.connect(x.destination),new A(x,r,D,t)}getActivity(x){let D=this.medias.get(E(x));if(D===void 0)return;let r=I(this.information,D.index);return r===0?_:{isSilent:!1,rmsDBFS:r}}getJitterStats(x){}setGlobalVolume(x){u(this.information,x)}setVolume(x,D){let r=this.medias.get(E(x));r!==void 0&&g(this.information,r.index,D)}_GetFreeIndex(){let x=super._GetFreeIndex();if(x!==void 0)return x;if(this.information.length>this.medias.size)return this.medias.size}},p=class A extends l{constructor(x,D,r,j,B,t){super(x,D,r,j,t);this.information=B}static async create(x,D,r,j,B,t){let{port1:s,port2:m}=new MessageChannel;v(j,["captureInit",{sampleRate:x.sampleRate,workletPort:s}],[s]);let{sampleBuffer:O,informationBuffer:w}=await k(j,"captureReady");return v(B.port,["init",{workerPort:m,sampleBuffer:O}],[m]),new A(B,j,D,r,w,t)}get activity(){return{isSilent:!L(this.information),rmsDBFS:y(this.information)}}get speechProbability(){return H(this.information)}setVolume(x){N(this.information,x)}};0&&(module.exports={createCaptureWorker,createPlaybackWorker});
|