@4players/odin-plugin-web 1.7.1 → 1.9.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var I=(r,A)=>{for(var x in A)a(r,x,{get:A[x],enumerable:!0})},K=(r,A,x,F)=>{if(A&&typeof A=="object"||typeof A=="function")for(let D of H(A))!N.call(r,D)&&D!==x&&a(r,D,{get:()=>A[D],enumerable:!(F=y(A,D))||F.enumerable});return r};var _=r=>K(a({},"__esModule",{value:!0}),r);var ex={};I(ex,{UnsharedCaptureWorker:()=>i,UnsharedPlaybackWorker:()=>o,createCaptureWorker:()=>Cx,createPlaybackWorker:()=>Ex});module.exports=_(ex);var g=require("@4players/odin-common");var e={};I(e,{AdditionalCaptureBlocks:()=>O,AdditionalPlaybackBlocks:()=>J,ClockJumpCheckInterval:()=>S,ClockJumpThreshold:()=>W,ConnectInterval:()=>Ax,ConnectTimeout:()=>Y,DefaultRefreshRate:()=>P,DefaultVideoCodec:()=>Fx,HealthCheckTimeout:()=>V,MainConnectionPingInterval:()=>R,MaxNumberOfDecoders:()=>T,MinDBFs:()=>k,MinTokenLifetime:()=>Z,MinTokenRefreshInterval:()=>xx,PlaybackPreload:()=>w,RenderQuantumSize:()=>U,VadPreload:()=>M,WebRtcIceTimeout:()=>X,WebRtcStatsSnapshotInterval:()=>z,WebRtcTimeout:()=>Q});var J=3,O=3,w=3,P=250,M=3,T=512,U=128,k=-758.596,V=1e4,S=1e3,W=1e4,R=3e3,z=1e3,X=3e3,Q=1e4,Y=5e3,Z=6e4,xx=5e3,Ax=[0,100,200,200,500],Fx="H264";function v(r,A,x){return r.postMessage(A,x)}function u(r,A){return new Promise(x=>{let F=D=>{let[B,j]=D.data;B===A&&(x(D.data[1]),r.removeEventListener("message",F))};r.addEventListener("message",F)})}var C=require("@4players/odin-common"),$;function d(r,...A){let x=Dx(A);$?$?.error(r,x):(0,C.error)(r,x)}function Dx(...r){if(r.length===1&&typeof r[0]=="object"&&r[0]!==null)return{...r[0]};if(r.length>0)return{args:r}}var c={isSilent:!0,rmsDBFS:-758.596};function E(r){return r.connectionId*4294967296+r.mediaId}var b=[],f=[],s=class{constructor(A,x,F){this.audioContext=A;this.worklet=x;this.worker=F;this.availableIndexes=[];this.medias=new Map;F.addEventListener("message",this._OnMessages.bind(this))}receivePacket(A,x){v(this.worker,["playbackReceivePacket",{connectionId:A,packet:x}],[x.buffer])}addMedias(A,x,F=[1,1]){let D=[];for(let B of x){let j=this._GetFreeIndex();j!==void 0&&(this.medias.set(E({connectionId:A,mediaId:B}),{index:j}),D.push({connectionId:A,mediaId:B,index:j,volume:F}))}v(this.worker,["playbackUpdateMedias",{added:D,removed:[]}])}removeMedias(A,x){let F=[];for(let D of x){let B=E({connectionId:A,mediaId:D}),j=this.medias.get(B);j!==void 0&&(this.medias.delete(B),this.availableIndexes.push(j.index),F.push({connectionId:A,mediaId:D,index:j.index}))}v(this.worker,["playbackUpdateMedias",{added:[],removed:F}])}close(){v(this.worker,["close",void 0]),v(this.worklet.port,["close",void 0]);let A=b.indexOf(this.worker);A>=0&&b.splice(A,1);let x=f.indexOf(this.worklet);x>=0&&f.splice(x,1)}async dump(){return{playbackWorker:await n(this.worker),playbackWorklet:await n(this.worklet.port)}}_GetFreeIndex(){return this.availableIndexes.pop()}_OnMessages(A){}},l=class r{constructor(A,x,F,D,B){this.worklet=A;this.worker=x;this.sink=(j,t)=>{B.deref()!==void 0?F(j,t):(d("capture worker was left abandoned, aborting capture worker"),r.shutdown(A,x))},this.monitorSink=(j,t)=>{B.deref()!==void 0?D(j,t):(d("capture worker was left abandoned, aborting capture worker"),r.shutdown(A,x))},x.addEventListener("message",this._OnMessages.bind(this))}get context(){return this.worklet.context}setMedias(A){v(this.worker,["captureSetMedias",{connections:A}])}setVad(A){v(this.worker,["captureSetVad",A])}close(){r.shutdown(this.worklet,this.worker)}static shutdown(A,x){v(A.port,["close",void 0]),v(x,["close",void 0]);let F=b.indexOf(x);F>=0&&b.splice(F,1);let D=f.indexOf(A);D>=0&&f.splice(D,1)}async dump(){return{captureWorker:await n(this.worker),captureWorklet:await n(this.worklet.port)}}_OnMessages(A){let[x,F]=A.data;x==="sendPacket"&&(F.connectionId===0?this.monitorSink(F.connectionId,F.packet):this.sink(F.connectionId,F.packet))}};function q(r,A,x,F,D){return Promise.all([rx(r),jx(x,A,F,D)])}async function rx(r){let A=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),x=new Worker(A,{type:"module",name:"odin worker"});return b.push(x),x}async function jx(r,A,x,F){try{let j=new AudioWorkletNode(r,x,F);return f.push(j),j}catch{}let D=URL.createObjectURL(new Blob([A],{type:"text/javascript"}));await r.audioWorklet.addModule(D);let B=new AudioWorkletNode(r,x,F);return f.push(B),B}function n(r){let{port1:A,port2:x}=new MessageChannel,{promise:F,resolve:D}=Promise.withResolvers();return x.onmessage=B=>D(B.data),setTimeout(()=>D("timeout"),100),v(r,["dump",{result:A}],[A]),F}var G=`"use strict";(()=>{var ke=Object.create;var XA=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var Ce=(n,A)=>()=>(A||n((A={exports:{}}).exports,A),A.exports),fe=(n,A)=>{for(var t in A)XA(n,t,{get:A[t],enumerable:!0})},Ge=(n,A,t,e)=>{if(A&&typeof A=="object"||typeof A=="function")for(let i of ce(A))!qe.call(n,i)&&i!==t&&XA(n,i,{get:()=>A[i],enumerable:!(e=ue(A,i))||e.enumerable});return n};var pe=(n,A,t)=>(t=n!=null?ke(de(n)):{},Ge(A||!n||!n.__esModule?XA(t,"default",{value:n,enumerable:!0}):t,n));var _j=Ce((yj,OA)=>{"use strict";var sr=(()=>{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",p=[],F="./this.program";d&&(n=self.location.href);var x="",wA,O;if(i||d){try{x=new URL(".",n).href}catch{}d&&(O=j=>{var r=new XMLHttpRequest;return r.open("GET",j,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),wA=async j=>{var r=await fetch(j,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}var ar=console.log.bind(console),kA=console.error.bind(console),kr,ur=!1;function Bj(j){for(var r=0,s=j.length,l=new Uint8Array(s),o;r<s;++r)o=j.charCodeAt(r),l[r]=~o>>8&o;return l}var cr,dr,V,_,uA,Z,cA,I,qr,Cr,fr,Gr,pr=!1;function Jj(){var j=Sr.buffer;V=new Int8Array(j),uA=new Int16Array(j),e.HEAPU8=_=new Uint8Array(j),Z=new Uint16Array(j),e.HEAP32=cA=new Int32Array(j),e.HEAPU32=I=new Uint32Array(j),e.HEAPF32=qr=new Float32Array(j),Cr=new Float64Array(j),fr=new BigInt64Array(j),Gr=new BigUint64Array(j)}function bj(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Rj(e.preRun.shift());mr(Er)}function Oj(){pr=!0,tA.v()}function wj(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Wj(e.postRun.shift());mr(Ir)}function PA(j){e.onAbort?.(j),j="Aborted("+j+")",kA(j),ur=!0,j+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(j);throw dr?.(r),r}var hr;function Pj(){return Bj(\`\\0asm\\0\\0\\0\\x8D9\\\`\\x7F\\x7F\\\`\\x7F\\0\\\`\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\\`\\0\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\\`||\\\`\\x7F}\\\`}}\\\`\\x07\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\x7F\\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\\x7F~~\\0\\\`\\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|\\\`\\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}}\\0yaa\\0ab\\0ac\\0ad\\0ae\\0af\\0!ag\\0ah\\0 ai\\0aj\\0\\bak\\0"al\\0am\\0an\\0ao\\0\\0ap\\0#aq\\0\\0ar\\0
|
|
3
3
|
as\\0at\\0\\xBB\\xB9\\0\\0\\f$\\f\\x07\\0\\f\\x07\\f\\x07\\0%& \\0
|
|
4
4
|
\\0\\x07\\v\\0'\\0\\0(\\0\\f\\0)*+\\x07\\v\\x07\\0
|
|
@@ -3177,7 +3177,7 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3177
3177
|
|
|
3178
3178
|
|
|
3179
3179
|
\\x07\\0\\0 \\v\\0\\0 \\v\\0\\0\\v\\0\\0\\0\\0\\0A\\xC1\\x9D\\v!\\0\\0\\0\\0\\0\\0\\0\\0\\0\\v\\r\\0\\r\\0\\0\\0 \\0\\0\\0 \\0\\0\\0\\0A\\xFB\\x9D\\v\\f\\0A\\x87\\x9E\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\f\\0\\0\\0\\0\\0\\f\\0\\0\\f\\0A\\xB5\\x9E\\v\\0A\\xC1\\x9E\\v\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0A\\xEF\\x9E\\v\\0A\\xFB\\x9E\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0A\\xB2\\x9F\\v\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0A\\xE3\\x9F\\v\\0A\\xEF\\x9F\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0A\\x9D\\xA0\\v\\0A\\xA9\\xA0\\v\\xB3 \\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\x000123456789ABCDEF\\0\\0X\\0NSt3__214__shared_countE\\0\\0\\0\\0\\x84\\0\\x8C\\0\\0\\0\\0\\0\\0\\0\\0P\\0\\0\\0\\0\\0NSt3__219__shared_weak_countE\\0\\0\\0(\\0\\xB8\\0\\xC8\\0N10__cxxabiv116__shim_type_infoE\\0\\0\\0\\0(\\0\\xE8\\0\\xAC\\0N10__cxxabiv117__class_type_infoE\\0\\0\\0(\\0\\0\\xAC\\0N10__cxxabiv117__pbase_type_infoE\\0\\0\\0(\\0H\\0\\f\\0N10__cxxabiv119__pointer_type_infoE\\0(\\0x\\0\\xAC\\0N10__cxxabiv120__function_type_infoE\\0\\0\\0\\0(\\0\\xAC\\0\\f\\0N10__cxxabiv129__pointer_to_member_type_infoE\\0\\0\\0\\0\\0\\0\\0\\xF8\\0\\\`\\0\\0\\0a\\0\\0\\0b\\0\\0\\0c\\0\\0\\0d\\0\\0\\0(\\0\\0\\xAC\\0N10__cxxabiv123__fundamental_type_infoE\\0\\xE4\\x004\\0v\\0Dn\\0\\0\\0\\0\\xE4\\0D\\0b\\0\\0\\0\\xE4\\0P\\0c\\0\\0\\0\\xE4\\0\\\\\\0h\\0\\0\\0\\xE4\\0h\\0a\\0\\0\\0\\xE4\\0t\\0s\\0\\0\\0\\xE4\\0\\x80\\0t\\0\\0\\0\\xE4\\0\\x8C\\0i\\0\\0\\0\\xE4\\0\\x98\\0j\\0\\0\\0\\xE4\\0\\xA4\\0l\\0\\0\\0\\xE4\\0\\xB0\\0m\\0\\0\\0\\xE4\\0\\xBC\\0x\\0\\0\\0\\xE4\\0\\xC8\\0y\\0\\0\\0\\xE4\\0\\xD4\\0f\\0\\0\\0\\xE0\\0\\xE8\\0\\0\\0\\0\\0\\xCC\\0Pf\\0\\0\\xE4\\0\\xF4\\0d\\0\\0\\0\\0\\0\\0\\0\\xDC\\0\\\`\\0\\0\\0e\\0\\0\\0b\\0\\0\\0c\\0\\0\\0f\\0\\0\\0g\\0\\0\\0h\\0\\0\\0i\\0\\0\\0\\0\\0\\0\\0H\\0\\\`\\0\\0\\0j\\0\\0\\0b\\0\\0\\0c\\0\\0\\0f\\0\\0\\0k\\0\\0\\0l\\0\\0\\0m\\0\\0\\0(\\0T\\0\\xDC\\0N10__cxxabiv120__si_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\0\\xA4\\0\\\`\\0\\0\\0n\\0\\0\\0b\\0\\0\\0c\\0\\0\\0f\\0\\0\\0o\\0\\0\\0p\\0\\0\\0q\\0\\0\\0(\\0\\xB0\\0\\xDC\\0N10__cxxabiv121__vmi_class_type_infoE\\0\\0\\0\\0\\0\\0\\0<\\0\\\`\\0\\0\\0r\\0\\0\\0b\\0\\0\\0c\\0\\0\\0s\\0\\0\\0\\0\\0\\0\\0<\\0F\\0\\0\\0t\\0\\0\\0u\\0\\0\\0\\0\\0\\0St9exception\\0\\0\\0\\0(\\0,\\0\\b\\0St9bad_alloc\\0\\0\\0\\0(\\0H\\0 \\0St20bad_array_new_length\\0\\0\\0\\0\\0\\0\\0\\0x\\0H\\0\\0\\0v\\0\\0\\0w\\0\\0\\0(\\0\\x84\\0\\b\\0St11logic_error\\0\\0\\0\\0\\0\\xA8\\0H\\0\\0\\0x\\0\\0\\0w\\0\\0\\0(\\0\\xB4\\0x\\0St12length_error\\0\\0\\0\\0\\0\\0\\xD0\\0St9type_info\\0A\\xE1\\xA9\\v\\b \\0\\0\\0\\0\\0\\0\\0A\\xF4\\xA9\\vX\\0A\\x8C\\xAA\\v\\vY\\0\\0\\0Z\\0\\0\\0\\0A\\xA4\\xAA\\v\\0A\\xB4\\xAA\\v\\b\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\0A\\xF8\\xAA\\v \\xE8\\0\\0\\0\\0\\0\\0A\\x8C\\xAB\\v[\\0A\\xA4\\xAB\\vY\\0\\0\\0\\\\\\0\\0\\0\\0\\0\\0A\\xBC\\xAB\\v\\0A\\xCC\\xAB\\v\\xFF\\xFF\\xFF\\xFF
|
|
3180
|
-
\\0A\\x90\\xAC\\v\\x07\\x80\\0\`)}function In(j){return j}async function Mj(j){return j}async function Tj(j,r){try{var s=await Mj(j),l=await WebAssembly.instantiate(s,r);return l}catch(o){kA(\`failed to asynchronously prepare wasm: \${o}\`),PA(o)}}async function Uj(j,r,s){return Tj(r,s)}function Vj(){var j={a:le};return j}async function Sj(){function j(a,k){return tA=a.exports,ie(tA),Jj(),tA}function r(a){return j(a.instance)}var s=Vj();if(e.instantiateWasm)return new Promise((a,k)=>{e.instantiateWasm(s,(u,c)=>{a(j(u,c))})});hr??=Pj();var l=await Uj(kr,hr,s),o=r(l);return o}class En{name="ExitStatus";constructor(r){this.message=\`Program terminated with exit(\${r})\`,this.status=r}}var mr=j=>{for(;j.length>0;)j.shift()(e)},Ir=[],Wj=j=>Ir.push(j),Er=[],Rj=j=>Er.push(j),zj=!0;class Xj{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){I[this.ptr+4>>2]=r}get_type(){return I[this.ptr+4>>2]}set_destructor(r){I[this.ptr+8>>2]=r}get_destructor(){return I[this.ptr+8>>2]}set_caught(r){r=r?1:0,V[this.ptr+12]=r}get_caught(){return V[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,V[this.ptr+13]=r}get_rethrown(){return V[this.ptr+13]!=0}init(r,s){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(s)}set_adjusted_ptr(r){I[this.ptr+16>>2]=r}get_adjusted_ptr(){return I[this.ptr+16>>2]}}var $r=0,Qj=0,Yj=(j,r,s)=>{var l=new Xj(j);throw l.init(r,s),$r=j,Qj++,$r},Zj=()=>PA(""),v=j=>{for(var r="";;){var s=_[j++];if(!s)return r;r+=String.fromCharCode(s)}},z={},X={},dA={},AA=class extends Error{constructor(r){super(r),this.name="BindingError"}},G=j=>{throw new AA(j)};function At(j,r,s={}){var l=r.name;if(j||G(\`type "\${l}" must have a positive integer typeid pointer\`),X.hasOwnProperty(j)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${l}' twice\`)}if(X[j]=r,delete dA[j],z.hasOwnProperty(j)){var o=z[j];delete z[j],o.forEach(a=>a())}}function K(j,r,s={}){return At(j,r,s)}var Fr=(j,r,s)=>{switch(r){case 1:return s?l=>V[l]:l=>_[l];case 2:return s?l=>uA[l>>1]:l=>Z[l>>1];case 4:return s?l=>cA[l>>2]:l=>I[l>>2];case 8:return s?l=>fr[l>>3]:l=>Gr[l>>3];default:throw new TypeError(\`invalid integer width (\${r}): \${j}\`)}},rt=(j,r,s,l,o)=>{r=v(r);let a=l===0n,k=u=>u;if(a){let u=s*8;k=c=>BigInt.asUintN(u,c),o=k(o)}K(j,{name:r,fromWireType:k,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Fr(r,s,!a),destructorFunction:null})},jt=(j,r,s,l)=>{r=v(r),K(j,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,a){return a?s:l},readValueFromPointer:function(o){return this.fromWireType(_[o])},destructorFunction:null})},tt=j=>({count:j.count,deleteScheduled:j.deleteScheduled,preservePointerOnDelete:j.preservePointerOnDelete,ptr:j.ptr,ptrType:j.ptrType,smartPtr:j.smartPtr,smartPtrType:j.smartPtrType}),MA=j=>{function r(s){return s.$$.ptrType.registeredClass.name}G(r(j)+" instance already deleted")},TA=!1,vr=j=>{},et=j=>{j.smartPtr?j.smartPtrType.rawDestructor(j.smartPtr):j.ptrType.registeredClass.rawDestructor(j.ptr)},Lr=j=>{j.count.value-=1;var r=j.count.value===0;r&&et(j)},rA=j=>globalThis.FinalizationRegistry?(TA=new FinalizationRegistry(r=>{Lr(r.$$)}),rA=r=>{var s=r.$$,l=!!s.smartPtr;if(l){var o={$$:s};TA.register(r,o,r)}return r},vr=r=>TA.unregister(r),rA(j)):(rA=r=>r,j),qA=[],nt=()=>{for(;qA.length;){var j=qA.pop();j.$$.deleteScheduled=!1,j.delete()}},gr,st=()=>{let j=CA.prototype;Object.assign(j,{isAliasOf(s){if(!(this instanceof CA)||!(s instanceof CA))return!1;var l=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var a=s.$$.ptrType.registeredClass,k=s.$$.ptr;l.baseClass;)o=l.upcast(o),l=l.baseClass;for(;a.baseClass;)k=a.upcast(k),a=a.baseClass;return l===a&&o===k},clone(){if(this.$$.ptr||MA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=rA(Object.create(Object.getPrototypeOf(this),{$$:{value:tt(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||MA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),vr(this),Lr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||MA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),qA.push(this),qA.length===1&&gr&&gr(nt),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(j[r]=j.delete)};function CA(){}var Hr=(j,r)=>Object.defineProperty(r,"name",{value:j}),yr={},_r=(j,r,s)=>{if(j[r].overloadTable===void 0){var l=j[r];j[r]=function(...o){return j[r].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${j[r].overloadTable})!\`),j[r].overloadTable[o.length].apply(this,o)},j[r].overloadTable=[],j[r].overloadTable[l.argCount]=l}},Dr=(j,r,s)=>{e.hasOwnProperty(j)?((s===void 0||e[j].overloadTable!==void 0&&e[j].overloadTable[s]!==void 0)&&G(\`Cannot register public name '\${j}' twice\`),_r(e,j,j),e[j].overloadTable.hasOwnProperty(s)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),e[j].overloadTable[s]=r):(e[j]=r,e[j].argCount=s)},it=48,lt=57,ot=j=>{j=j.replace(/[^a-zA-Z0-9_]/g,"$");var r=j.charCodeAt(0);return r>=it&&r<=lt?\`_\${j}\`:j};function at(j,r,s,l,o,a,k,u){this.name=j,this.constructor=r,this.instancePrototype=s,this.rawDestructor=l,this.baseClass=o,this.getActualType=a,this.upcast=k,this.downcast=u,this.pureVirtualFunctions=[]}var fA=(j,r,s)=>{for(;r!==s;)r.upcast||G(\`Expected null or instance of \${s.name}, got an instance of \${r.name}\`),j=r.upcast(j),r=r.baseClass;return j},UA=j=>{if(j===null)return"null";var r=typeof j;return r==="object"||r==="array"||r==="function"?j.toString():""+j};function kt(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=r.$$.ptrType.registeredClass,l=fA(r.$$.ptr,s,this.registeredClass);return l}function ut(j,r){var s;if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),j!==null&&j.push(this.rawDestructor,s),s):0;(!r||!r.$$)&&G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);var l=r.$$.ptrType.registeredClass;if(s=fA(r.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?s=r.$$.smartPtr:G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)s=r.$$.smartPtr;else{var o=r.clone();s=this.rawShare(s,WA.toHandle(()=>o.delete())),j!==null&&j.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function ct(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.ptrType.name} to parameter type \${this.name}\`);var s=r.$$.ptrType.registeredClass,l=fA(r.$$.ptr,s,this.registeredClass);return l}function GA(j){return this.fromWireType(I[j>>2])}var xr=(j,r,s)=>{if(r===s)return j;if(s.baseClass===void 0)return null;var l=xr(j,r,s.baseClass);return l===null?null:s.downcast(l)},dt={},qt=(j,r)=>{for(r===void 0&&G("ptr should not be undefined");j.baseClass;)r=j.upcast(r),j=j.baseClass;return r},Ct=(j,r)=>(r=qt(j,r),dt[r]),ft=class extends Error{constructor(r){super(r),this.name="InternalError"}},pA=j=>{throw new ft(j)},hA=(j,r)=>{(!r.ptrType||!r.ptr)&&pA("makeClassHandle requires ptr and ptrType");var s=!!r.smartPtrType,l=!!r.smartPtr;return s!==l&&pA("Both smartPtrType and smartPtr must be specified"),r.count={value:1},rA(Object.create(j,{$$:{value:r,writable:!0}}))};function Gt(j){var r=this.getPointee(j);if(!r)return this.destructor(j),null;var s=Ct(this.registeredClass,r);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=r,s.$$.smartPtr=j,s.clone();var l=s.clone();return this.destructor(j),l}function o(){return this.isSmartPointer?hA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:j}):hA(this.registeredClass.instancePrototype,{ptrType:this,ptr:j})}var a=this.registeredClass.getActualType(r),k=yr[a];if(!k)return o.call(this);var u;this.isConst?u=k.constPointerType:u=k.pointerType;var c=xr(r,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?hA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:j}):hA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var pt=()=>{Object.assign(mA.prototype,{getPointee(j){return this.rawGetPointee&&(j=this.rawGetPointee(j)),j},destructor(j){this.rawDestructor?.(j)},readValueFromPointer:GA,fromWireType:Gt})};function mA(j,r,s,l,o,a,k,u,c,C,f){this.name=j,this.registeredClass=r,this.isReference=s,this.isConst=l,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=k,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=C,this.rawDestructor=f,!o&&r.baseClass===void 0?l?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=ct,this.destructorFunction=null):this.toWireType=ut}var Kr=(j,r,s)=>{e.hasOwnProperty(j)||pA("Replacing nonexistent public symbol"),e[j].overloadTable!==void 0&&s!==void 0?e[j].overloadTable[s]=r:(e[j]=r,e[j].argCount=s)},Nr=[],ht=j=>{var r=Nr[j];return r||(Nr[j]=r=Wr.get(j)),r},N=(j,r,s=!1)=>{j=v(j);function l(){var a=ht(r);return a}var o=l();return typeof o!="function"&&G(\`unknown function pointer with signature \${j}: \${r}\`),o};class mt extends Error{}var It=j=>{var r=Vr(j),s=v(r);return B(r),s},Q=(j,r)=>{var s=[],l={};function o(a){if(!l[a]&&!X[a]){if(dA[a]){dA[a].forEach(o);return}s.push(a),l[a]=!0}}throw r.forEach(o),new mt(\`\${j}: \`+s.map(It).join([", "]))},w=(j,r,s)=>{j.forEach(u=>dA[u]=r);function l(u){var c=s(u);c.length!==j.length&&pA("Mismatched type converter count");for(var C=0;C<j.length;++C)K(j[C],c[C])}var o=new Array(r.length),a=[],k=0;for(let[u,c]of r.entries())X.hasOwnProperty(c)?o[u]=X[c]:(a.push(c),z.hasOwnProperty(c)||(z[c]=[]),z[c].push(()=>{o[u]=X[c],++k,k===a.length&&l(o)}));a.length===0&&l(o)},Et=(j,r,s,l,o,a,k,u,c,C,f,m,E)=>{f=v(f),a=N(o,a),u&&=N(k,u),C&&=N(c,C),E=N(m,E);var h=ot(f);Dr(h,function(){Q(\`Cannot construct \${f} due to unbound types\`,[l])}),w([j,r,s],l?[l]:[],$=>{$=$[0];var H,J;l?(H=$.registeredClass,J=H.instancePrototype):J=CA.prototype;var y=Hr(f,function(...zA){if(Object.getPrototypeOf(this)!==eA)throw new AA(\`Use 'new' to construct \${f}\`);if(g.constructor_body===void 0)throw new AA(\`\${f} has no accessible constructor\`);var Xr=g.constructor_body[zA.length];if(Xr===void 0)throw new AA(\`Tried to invoke ctor of \${f} with invalid number of parameters (\${zA.length}) - expected (\${Object.keys(g.constructor_body).toString()}) parameters instead!\`);return Xr.apply(this,zA)}),eA=Object.create(J,{constructor:{value:y}});y.prototype=eA;var g=new at(f,y,eA,E,H,a,u,C);g.baseClass&&(g.baseClass.__derivedClasses??=[],g.baseClass.__derivedClasses.push(g));var ae=new mA(f,g,!0,!1,!1),Rr=new mA(f+"*",g,!1,!1,!1),zr=new mA(f+" const*",g,!1,!0,!1);return yr[j]={pointerType:Rr,constPointerType:zr},Kr(h,y),[ae,Rr,zr]})},VA=(j,r)=>{for(var s=[],l=0;l<j;l++)s.push(I[r+l*4>>2]);return s},Br=j=>{for(;j.length;){var r=j.pop(),s=j.pop();s(r)}};function Jr(j){for(var r=1;r<j.length;++r)if(j[r]!==null&&j[r].destructorFunction===void 0)return!0;return!1}function $t(j,r,s,l){var o=Jr(j),a=j.length-2,k=[],u=["fn"];r&&u.push("thisWired");for(var c=0;c<a;++c)k.push(\`arg\${c}\`),u.push(\`arg\${c}Wired\`);k=k.join(","),u=u.join(",");var C=\`return function (\${k}) {
|
|
3180
|
+
\\0A\\x90\\xAC\\v\\x07\\x80\\0\`)}function $n(j){return j}async function Mj(j){return j}async function Tj(j,r){try{var s=await Mj(j),l=await WebAssembly.instantiate(s,r);return l}catch(o){kA(\`failed to asynchronously prepare wasm: \${o}\`),PA(o)}}async function Uj(j,r,s){return Tj(r,s)}function Vj(){var j={a:le};return j}async function Sj(){function j(a,k){return tA=a.exports,ie(tA),Jj(),tA}function r(a){return j(a.instance)}var s=Vj();if(e.instantiateWasm)return new Promise((a,k)=>{e.instantiateWasm(s,(u,c)=>{a(j(u,c))})});hr??=Pj();var l=await Uj(kr,hr,s),o=r(l);return o}class Fn{name="ExitStatus";constructor(r){this.message=\`Program terminated with exit(\${r})\`,this.status=r}}var mr=j=>{for(;j.length>0;)j.shift()(e)},Ir=[],Wj=j=>Ir.push(j),Er=[],Rj=j=>Er.push(j),zj=!0;class Xj{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){I[this.ptr+4>>2]=r}get_type(){return I[this.ptr+4>>2]}set_destructor(r){I[this.ptr+8>>2]=r}get_destructor(){return I[this.ptr+8>>2]}set_caught(r){r=r?1:0,V[this.ptr+12]=r}get_caught(){return V[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,V[this.ptr+13]=r}get_rethrown(){return V[this.ptr+13]!=0}init(r,s){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(s)}set_adjusted_ptr(r){I[this.ptr+16>>2]=r}get_adjusted_ptr(){return I[this.ptr+16>>2]}}var $r=0,Qj=0,Yj=(j,r,s)=>{var l=new Xj(j);throw l.init(r,s),$r=j,Qj++,$r},Zj=()=>PA(""),v=j=>{for(var r="";;){var s=_[j++];if(!s)return r;r+=String.fromCharCode(s)}},z={},X={},dA={},AA=class extends Error{constructor(r){super(r),this.name="BindingError"}},G=j=>{throw new AA(j)};function At(j,r,s={}){var l=r.name;if(j||G(\`type "\${l}" must have a positive integer typeid pointer\`),X.hasOwnProperty(j)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${l}' twice\`)}if(X[j]=r,delete dA[j],z.hasOwnProperty(j)){var o=z[j];delete z[j],o.forEach(a=>a())}}function K(j,r,s={}){return At(j,r,s)}var Fr=(j,r,s)=>{switch(r){case 1:return s?l=>V[l]:l=>_[l];case 2:return s?l=>uA[l>>1]:l=>Z[l>>1];case 4:return s?l=>cA[l>>2]:l=>I[l>>2];case 8:return s?l=>fr[l>>3]:l=>Gr[l>>3];default:throw new TypeError(\`invalid integer width (\${r}): \${j}\`)}},rt=(j,r,s,l,o)=>{r=v(r);let a=l===0n,k=u=>u;if(a){let u=s*8;k=c=>BigInt.asUintN(u,c),o=k(o)}K(j,{name:r,fromWireType:k,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Fr(r,s,!a),destructorFunction:null})},jt=(j,r,s,l)=>{r=v(r),K(j,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,a){return a?s:l},readValueFromPointer:function(o){return this.fromWireType(_[o])},destructorFunction:null})},tt=j=>({count:j.count,deleteScheduled:j.deleteScheduled,preservePointerOnDelete:j.preservePointerOnDelete,ptr:j.ptr,ptrType:j.ptrType,smartPtr:j.smartPtr,smartPtrType:j.smartPtrType}),MA=j=>{function r(s){return s.$$.ptrType.registeredClass.name}G(r(j)+" instance already deleted")},TA=!1,vr=j=>{},et=j=>{j.smartPtr?j.smartPtrType.rawDestructor(j.smartPtr):j.ptrType.registeredClass.rawDestructor(j.ptr)},Lr=j=>{j.count.value-=1;var r=j.count.value===0;r&&et(j)},rA=j=>globalThis.FinalizationRegistry?(TA=new FinalizationRegistry(r=>{Lr(r.$$)}),rA=r=>{var s=r.$$,l=!!s.smartPtr;if(l){var o={$$:s};TA.register(r,o,r)}return r},vr=r=>TA.unregister(r),rA(j)):(rA=r=>r,j),qA=[],nt=()=>{for(;qA.length;){var j=qA.pop();j.$$.deleteScheduled=!1,j.delete()}},gr,st=()=>{let j=CA.prototype;Object.assign(j,{isAliasOf(s){if(!(this instanceof CA)||!(s instanceof CA))return!1;var l=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var a=s.$$.ptrType.registeredClass,k=s.$$.ptr;l.baseClass;)o=l.upcast(o),l=l.baseClass;for(;a.baseClass;)k=a.upcast(k),a=a.baseClass;return l===a&&o===k},clone(){if(this.$$.ptr||MA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=rA(Object.create(Object.getPrototypeOf(this),{$$:{value:tt(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||MA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),vr(this),Lr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||MA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),qA.push(this),qA.length===1&&gr&&gr(nt),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(j[r]=j.delete)};function CA(){}var Hr=(j,r)=>Object.defineProperty(r,"name",{value:j}),yr={},_r=(j,r,s)=>{if(j[r].overloadTable===void 0){var l=j[r];j[r]=function(...o){return j[r].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${j[r].overloadTable})!\`),j[r].overloadTable[o.length].apply(this,o)},j[r].overloadTable=[],j[r].overloadTable[l.argCount]=l}},Dr=(j,r,s)=>{e.hasOwnProperty(j)?((s===void 0||e[j].overloadTable!==void 0&&e[j].overloadTable[s]!==void 0)&&G(\`Cannot register public name '\${j}' twice\`),_r(e,j,j),e[j].overloadTable.hasOwnProperty(s)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),e[j].overloadTable[s]=r):(e[j]=r,e[j].argCount=s)},it=48,lt=57,ot=j=>{j=j.replace(/[^a-zA-Z0-9_]/g,"$");var r=j.charCodeAt(0);return r>=it&&r<=lt?\`_\${j}\`:j};function at(j,r,s,l,o,a,k,u){this.name=j,this.constructor=r,this.instancePrototype=s,this.rawDestructor=l,this.baseClass=o,this.getActualType=a,this.upcast=k,this.downcast=u,this.pureVirtualFunctions=[]}var fA=(j,r,s)=>{for(;r!==s;)r.upcast||G(\`Expected null or instance of \${s.name}, got an instance of \${r.name}\`),j=r.upcast(j),r=r.baseClass;return j},UA=j=>{if(j===null)return"null";var r=typeof j;return r==="object"||r==="array"||r==="function"?j.toString():""+j};function kt(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=r.$$.ptrType.registeredClass,l=fA(r.$$.ptr,s,this.registeredClass);return l}function ut(j,r){var s;if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),j!==null&&j.push(this.rawDestructor,s),s):0;(!r||!r.$$)&&G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);var l=r.$$.ptrType.registeredClass;if(s=fA(r.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?s=r.$$.smartPtr:G(\`Cannot convert argument of type \${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)s=r.$$.smartPtr;else{var o=r.clone();s=this.rawShare(s,WA.toHandle(()=>o.delete())),j!==null&&j.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function ct(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${UA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),r.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${r.$$.ptrType.name} to parameter type \${this.name}\`);var s=r.$$.ptrType.registeredClass,l=fA(r.$$.ptr,s,this.registeredClass);return l}function GA(j){return this.fromWireType(I[j>>2])}var xr=(j,r,s)=>{if(r===s)return j;if(s.baseClass===void 0)return null;var l=xr(j,r,s.baseClass);return l===null?null:s.downcast(l)},dt={},qt=(j,r)=>{for(r===void 0&&G("ptr should not be undefined");j.baseClass;)r=j.upcast(r),j=j.baseClass;return r},Ct=(j,r)=>(r=qt(j,r),dt[r]),ft=class extends Error{constructor(r){super(r),this.name="InternalError"}},pA=j=>{throw new ft(j)},hA=(j,r)=>{(!r.ptrType||!r.ptr)&&pA("makeClassHandle requires ptr and ptrType");var s=!!r.smartPtrType,l=!!r.smartPtr;return s!==l&&pA("Both smartPtrType and smartPtr must be specified"),r.count={value:1},rA(Object.create(j,{$$:{value:r,writable:!0}}))};function Gt(j){var r=this.getPointee(j);if(!r)return this.destructor(j),null;var s=Ct(this.registeredClass,r);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=r,s.$$.smartPtr=j,s.clone();var l=s.clone();return this.destructor(j),l}function o(){return this.isSmartPointer?hA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:j}):hA(this.registeredClass.instancePrototype,{ptrType:this,ptr:j})}var a=this.registeredClass.getActualType(r),k=yr[a];if(!k)return o.call(this);var u;this.isConst?u=k.constPointerType:u=k.pointerType;var c=xr(r,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?hA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:j}):hA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var pt=()=>{Object.assign(mA.prototype,{getPointee(j){return this.rawGetPointee&&(j=this.rawGetPointee(j)),j},destructor(j){this.rawDestructor?.(j)},readValueFromPointer:GA,fromWireType:Gt})};function mA(j,r,s,l,o,a,k,u,c,C,f){this.name=j,this.registeredClass=r,this.isReference=s,this.isConst=l,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=k,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=C,this.rawDestructor=f,!o&&r.baseClass===void 0?l?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=ct,this.destructorFunction=null):this.toWireType=ut}var Kr=(j,r,s)=>{e.hasOwnProperty(j)||pA("Replacing nonexistent public symbol"),e[j].overloadTable!==void 0&&s!==void 0?e[j].overloadTable[s]=r:(e[j]=r,e[j].argCount=s)},Nr=[],ht=j=>{var r=Nr[j];return r||(Nr[j]=r=Wr.get(j)),r},N=(j,r,s=!1)=>{j=v(j);function l(){var a=ht(r);return a}var o=l();return typeof o!="function"&&G(\`unknown function pointer with signature \${j}: \${r}\`),o};class mt extends Error{}var It=j=>{var r=Vr(j),s=v(r);return B(r),s},Q=(j,r)=>{var s=[],l={};function o(a){if(!l[a]&&!X[a]){if(dA[a]){dA[a].forEach(o);return}s.push(a),l[a]=!0}}throw r.forEach(o),new mt(\`\${j}: \`+s.map(It).join([", "]))},w=(j,r,s)=>{j.forEach(u=>dA[u]=r);function l(u){var c=s(u);c.length!==j.length&&pA("Mismatched type converter count");for(var C=0;C<j.length;++C)K(j[C],c[C])}var o=new Array(r.length),a=[],k=0;for(let[u,c]of r.entries())X.hasOwnProperty(c)?o[u]=X[c]:(a.push(c),z.hasOwnProperty(c)||(z[c]=[]),z[c].push(()=>{o[u]=X[c],++k,k===a.length&&l(o)}));a.length===0&&l(o)},Et=(j,r,s,l,o,a,k,u,c,C,f,m,E)=>{f=v(f),a=N(o,a),u&&=N(k,u),C&&=N(c,C),E=N(m,E);var h=ot(f);Dr(h,function(){Q(\`Cannot construct \${f} due to unbound types\`,[l])}),w([j,r,s],l?[l]:[],$=>{$=$[0];var H,J;l?(H=$.registeredClass,J=H.instancePrototype):J=CA.prototype;var y=Hr(f,function(...zA){if(Object.getPrototypeOf(this)!==eA)throw new AA(\`Use 'new' to construct \${f}\`);if(g.constructor_body===void 0)throw new AA(\`\${f} has no accessible constructor\`);var Xr=g.constructor_body[zA.length];if(Xr===void 0)throw new AA(\`Tried to invoke ctor of \${f} with invalid number of parameters (\${zA.length}) - expected (\${Object.keys(g.constructor_body).toString()}) parameters instead!\`);return Xr.apply(this,zA)}),eA=Object.create(J,{constructor:{value:y}});y.prototype=eA;var g=new at(f,y,eA,E,H,a,u,C);g.baseClass&&(g.baseClass.__derivedClasses??=[],g.baseClass.__derivedClasses.push(g));var ae=new mA(f,g,!0,!1,!1),Rr=new mA(f+"*",g,!1,!1,!1),zr=new mA(f+" const*",g,!1,!0,!1);return yr[j]={pointerType:Rr,constPointerType:zr},Kr(h,y),[ae,Rr,zr]})},VA=(j,r)=>{for(var s=[],l=0;l<j;l++)s.push(I[r+l*4>>2]);return s},Br=j=>{for(;j.length;){var r=j.pop(),s=j.pop();s(r)}};function Jr(j){for(var r=1;r<j.length;++r)if(j[r]!==null&&j[r].destructorFunction===void 0)return!0;return!1}function $t(j,r,s,l){var o=Jr(j),a=j.length-2,k=[],u=["fn"];r&&u.push("thisWired");for(var c=0;c<a;++c)k.push(\`arg\${c}\`),u.push(\`arg\${c}Wired\`);k=k.join(","),u=u.join(",");var C=\`return function (\${k}) {
|
|
3181
3181
|
\`;o&&(C+=\`var destructors = [];
|
|
3182
3182
|
\`);var f=o?"destructors":"null",m=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];r&&(C+=\`var thisWired = toClassParamWire(\${f}, this);
|
|
3183
3183
|
\`);for(var c=0;c<a;++c){var E=\`toArg\${c}Wire\`;C+=\`var arg\${c}Wired = \${E}(\${f}, arg\${c});
|
|
@@ -3187,5 +3187,5 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3187
3187
|
\`,m.push(\`\${h}_dtor\`))}return s&&(C+=\`var ret = fromRetWire(rv);
|
|
3188
3188
|
return ret;
|
|
3189
3189
|
\`),C+=\`}
|
|
3190
|
-
\`,new Function(m,C)}function SA(j,r,s,l,o,a){var k=r.length;k<2&&G("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=r[1]!==null&&s!==null,c=Jr(r),C=!r[0].isVoid,f=r[0],m=r[1],E=[j,G,l,o,Br,f.fromWireType.bind(f),m?.toWireType.bind(m)],h=2;h<k;++h){var $=r[h];E.push($.toWireType.bind($))}if(!c)for(var h=u?1:2;h<r.length;++h)r[h].destructorFunction!==null&&E.push(r[h].destructorFunction);var J=$t(r,u,C,a)(...E);return Hr(j,J)}var Ft=(j,r,s,l,o,a)=>{var k=VA(r,s);o=N(l,o),w([],[j],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[r-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${r-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[r-1]=()=>{Q(\`Cannot construct \${u.name} due to unbound types\`,k)},w([],k,C=>(C.splice(1,0,null),u.registeredClass.constructor_body[r-1]=SA(c,C,null,o,a),[])),[]})},br=j=>{j=j.trim();let r=j.indexOf("(");return r===-1?j:j.slice(0,r)},vt=(j,r,s,l,o,a,k,u,c,C)=>{var f=VA(s,l);r=v(r),r=br(r),a=N(o,a,c),w([],[j],m=>{m=m[0];var E=\`\${m.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(r);function h(){Q(\`Cannot call \${E} due to unbound types\`,f)}var $=m.registeredClass.instancePrototype,H=$[r];return H===void 0||H.overloadTable===void 0&&H.className!==m.name&&H.argCount===s-2?(h.argCount=s-2,h.className=m.name,$[r]=h):(_r($,r,E),$[r].overloadTable[s-2]=h),w([],f,J=>{var y=SA(E,J,m,a,k,c);return $[r].overloadTable===void 0?(y.argCount=s-2,$[r]=y):$[r].overloadTable[s-2]=y,[]}),[]})},Or=(j,r,s)=>(j instanceof Object||G(\`\${s} with invalid "this": \${j}\`),j instanceof r.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${j.constructor.name}\`),j.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(j.$$.ptr,j.$$.ptrType.registeredClass,r.registeredClass)),Lt=(j,r,s,l,o,a,k,u,c,C)=>{r=v(r),o=N(l,o),w([],[j],f=>{f=f[0];var m=\`\${f.name}.\${r}\`,E={get(){Q(\`Cannot access \${m} due to unbound types\`,[s,k])},enumerable:!0,configurable:!0};return c?E.set=()=>Q(\`Cannot access \${m} due to unbound types\`,[s,k]):E.set=h=>G(m+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,r,E),w([],c?[s,k]:[s],h=>{var $=h[0],H={get(){var y=Or(this,f,m+" getter");return $.fromWireType(o(a,y))},enumerable:!0};if(c){c=N(u,c);var J=h[1];H.set=function(y){var eA=Or(this,f,m+" setter"),g=[];c(C,eA,J.toWireType(g,y)),Br(g)}}return Object.defineProperty(f.registeredClass.instancePrototype,r,H),[]}),[]})},wr=[],Y=[0,1,,1,null,1,!0,1,!1,1],gt=j=>{j>9&&--Y[j+1]===0&&(Y[j]=void 0,wr.push(j))},WA={toValue:j=>(j||G(\`Cannot use deleted val. handle = \${j}\`),Y[j]),toHandle:j=>{switch(j){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=wr.pop()||Y.length;return Y[r]=j,Y[r+1]=1,r}}}},Ht={name:"emscripten::val",fromWireType:j=>{var r=WA.toValue(j);return gt(j),r},toWireType:(j,r)=>WA.toHandle(r),readValueFromPointer:GA,destructorFunction:null},yt=j=>K(j,Ht),_t=(j,r)=>{switch(r){case 4:return function(s){return this.fromWireType(qr[s>>2])};case 8:return function(s){return this.fromWireType(Cr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${j}\`)}},Dt=(j,r,s)=>{r=v(r),K(j,{name:r,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:_t(r,s),destructorFunction:null})},xt=(j,r,s,l,o,a,k,u)=>{var c=VA(r,s);j=v(j),j=br(j),o=N(l,o,k),Dr(j,function(){Q(\`Cannot call \${j} due to unbound types\`,c)},r-1),w([],c,C=>{var f=[C[0],null].concat(C.slice(1));return Kr(j,SA(j,f,null,o,a,k),r-1),[]})},Kt=(j,r,s,l,o)=>{r=v(r);let a=l===0,k=c=>c;if(a){var u=32-8*s;k=c=>c<<u>>>u,o=k(o)}K(j,{name:r,fromWireType:k,toWireType:(c,C)=>C,readValueFromPointer:Fr(r,s,l!==0),destructorFunction:null})},Nt=(j,r,s)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[r];function a(k){var u=I[k>>2],c=I[k+4>>2];return new o(V.buffer,c,u)}s=v(s),K(j,{name:s,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Bt=(j,r,s,l)=>{if(!(l>0))return 0;for(var o=s,a=s+l-1,k=0;k<j.length;++k){var u=j.codePointAt(k);if(u<=127){if(s>=a)break;r[s++]=u}else if(u<=2047){if(s+1>=a)break;r[s++]=192|u>>6,r[s++]=128|u&63}else if(u<=65535){if(s+2>=a)break;r[s++]=224|u>>12,r[s++]=128|u>>6&63,r[s++]=128|u&63}else{if(s+3>=a)break;r[s++]=240|u>>18,r[s++]=128|u>>12&63,r[s++]=128|u>>6&63,r[s++]=128|u&63,k++}}return r[s]=0,s-o},Jt=(j,r,s)=>Bt(j,_,r,s),bt=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.charCodeAt(s);l<=127?r++:l<=2047?r+=2:l>=55296&&l<=57343?(r+=4,++s):r+=3}return r},Pr=globalThis.TextDecoder&&new TextDecoder,Mr=(j,r,s,l)=>{var o=r+s;if(l)return o;for(;j[r]&&!(r>=o);)++r;return r},Tr=(j,r=0,s,l)=>{var o=Mr(j,r,s,l);if(o-r>16&&j.buffer&&Pr)return Pr.decode(j.subarray(r,o));for(var a="";r<o;){var k=j[r++];if(!(k&128)){a+=String.fromCharCode(k);continue}var u=j[r++]&63;if((k&224)==192){a+=String.fromCharCode((k&31)<<6|u);continue}var c=j[r++]&63;if((k&240)==224?k=(k&15)<<12|u<<6|c:k=(k&7)<<18|u<<12|c<<6|j[r++]&63,k<65536)a+=String.fromCharCode(k);else{var C=k-65536;a+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return a},Ot=(j,r,s)=>j?Tr(_,j,r,s):"",wt=(j,r)=>{r=v(r);var s=!0;K(j,{name:r,fromWireType(l){var o=I[l>>2],a=l+4,k;if(s)k=Ot(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(_[a+u])}return B(l),k},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var a,k=typeof o=="string";k||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&k?a=bt(o):a=o.length;var u=RA(4+a+1),c=u+4;if(I[u>>2]=a,k)if(s)Jt(o,c,a+1);else for(var C=0;C<a;++C){var f=o.charCodeAt(C);f>255&&(B(u),G("String has UTF-16 code units that do not fit in 8 bits")),_[c+C]=f}else _.set(o,c);return l!==null&&l.push(B,u),u},readValueFromPointer:GA,destructorFunction(l){B(l)}})},Ur=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Pt=(j,r,s)=>{var l=j>>1,o=Mr(Z,l,r/2,s);if(o-l>16&&Ur)return Ur.decode(Z.subarray(l,o));for(var a="",k=l;k<o;++k){var u=Z[k];a+=String.fromCharCode(u)}return a},Mt=(j,r,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var l=r,o=s<j.length*2?s/2:j.length,a=0;a<o;++a){var k=j.charCodeAt(a);uA[r>>1]=k,r+=2}return uA[r>>1]=0,r-l},Tt=j=>j.length*2,Ut=(j,r,s)=>{for(var l="",o=j>>2,a=0;!(a>=r/4);a++){var k=I[o+a];if(!k&&!s)break;l+=String.fromCodePoint(k)}return l},Vt=(j,r,s)=>{if(s??=2147483647,s<4)return 0;for(var l=r,o=l+s-4,a=0;a<j.length;++a){var k=j.codePointAt(a);if(k>65535&&a++,cA[r>>2]=k,r+=4,r+4>o)break}return cA[r>>2]=0,r-l},St=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.codePointAt(s);l>65535&&s++,r+=4}return r},Wt=(j,r,s)=>{s=v(s);var l,o,a;r===2?(l=Pt,o=Mt,a=Tt):(l=Ut,o=Vt,a=St),K(j,{name:s,fromWireType:k=>{var u=I[k>>2],c=l(k+4,u*r,!0);return B(k),c},toWireType:(k,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var c=a(u),C=RA(4+c+r);return I[C>>2]=c/r,o(u,C+4,c+r),k!==null&&k.push(B,C),C},readValueFromPointer:GA,destructorFunction(k){B(k)}})},Rt=(j,r)=>{r=v(r),K(j,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,l)=>{}})},zt=j=>{PA("OOM")},Xt=j=>{var r=_.length;j>>>=0,zt(j)},Qt=j=>52,Yt=9007199254740992,Zt=-9007199254740992,Ae=j=>j<Zt||j>Yt?NaN:Number(j);function re(j,r,s,l){return r=Ae(r),70}for(var je=[null,[],[]],te=(j,r)=>{var s=je[j];r===0||r===10?((j===1?ar:kA)(Tr(s)),s.length=0):s.push(r)},ee=(j,r,s,l)=>{for(var o=0,a=0;a<s;a++){var k=I[r>>2],u=I[r+4>>2];r+=8;for(var c=0;c<u;c++)te(j,_[k+c]);o+=u}return I[l>>2]=o,0},jA=new Uint8Array(123),P=25;P>=0;--P)jA[48+P]=52+P,jA[65+P]=P,jA[97+P]=26+P;if(jA[43]=62,jA[47]=63,st(),pt(),e.noExitRuntime&&(zj=e.noExitRuntime),e.print&&(ar=e.print),e.printErr&&(kA=e.printErr),e.wasmBinary&&(kr=e.wasmBinary),e.arguments&&(p=e.arguments),e.thisProgram&&(F=e.thisProgram),e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.shift()();var Vr,RA,B,ne,se,Sr,Wr;function ie(j){Vr=j.w,RA=e._malloc=j.y,B=e._free=j.z,ne=Sr=j.u,se=Wr=j.x}var le={g:Yj,r:Zj,f:rt,l:jt,k:Et,j:Ft,d:vt,a:Lt,s:yt,i:Dt,n:xt,c:Kt,b:Nt,t:wt,e:Wt,m:Rt,o:Xt,q:Qt,p:re,h:ee};function oe(){bj();function j(){e.calledRun=!0,!ur&&(Oj(),cr?.(e),e.onRuntimeInitialized?.(),wj())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),j()},1)):j()}var tA;return tA=await Sj(),oe(),pr?t=e:t=new Promise((j,r)=>{cr=j,dr=r}),t}})();typeof yj=="object"&&typeof OA=="object"?(OA.exports=sr,OA.exports.default=sr):typeof define=="function"&&define.amd&&define([],()=>sr)});var M={};fe(M,{AdditionalCaptureBlocks:()=>me,AdditionalPlaybackBlocks:()=>he,ClockJumpCheckInterval:()=>ge,ClockJumpThreshold:()=>He,ConnectInterval:()=>Be,ConnectTimeout:()=>xe,DefaultRefreshRate:()=>Ee,HealthCheckTimeout:()=>Le,MainConnectionPingInterval:()=>ye,MaxNumberOfDecoders:()=>Fe,MinDBFs:()=>Qr,MinTokenLifetime:()=>Ke,MinTokenRefreshInterval:()=>Ne,PlaybackPreload:()=>Ie,RenderQuantumSize:()=>ve,VadPreload:()=>$e,WebRtcIceTimeout:()=>_e,WebRtcTimeout:()=>De});var he=3,me=3,Ie=3,Ee=250,$e=3,Fe=512,ve=128,Qr=-758.596,Le=1e4,ge=1e3,He=1e4,ye=3e3,_e=3e3,De=1e4,xe=5e3,Ke=6e4,Ne=5e3,Be=[0,100,200,200,500];function T(n,A,t){return n.postMessage(A,t)}function Yr(n){return[n.values[0],n.values[1]]}function IA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function EA(n,A){return n.values[2+A*5]}function Zr(n,A,t){n.values[2+A*5]=t}function Aj(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function $A(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function rj(n,A){return n.values[2+A*5+3]}function jj(n,A,t){n.values[2+A*5+3]=t}function tj(n,A){return n.values[2+A*5+4]}function ej(n,A,t){n.values[2+A*5+4]=t}function FA(n){return n.values[0]!==0}function vA(n){return n.values[1]}function LA(n){return n.values[2]}function nj(n){return n.values[3]}function gA(n,A){return n.values[3]=A}function sj(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Je;(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||={})})(Je||={});function kj(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:ij}=globalThis,be=typeof ij?.noColor=="boolean"?ij.noColor:!1,Oe=!be;function YA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(n,A){return Oe?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function QA(n){return ZA(n,YA([0],0))}function lj(n){return ZA(n,YA([1],22))}function we(n){return ZA(n,YA([2],22))}var Nn=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"),Pe=new Date,HA=(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))(HA||{}),uj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Me={4:we,3:QA,2:QA,1:lj,0:lj};function Te({message:n}){return String(n)}function oj(n){return JSON.stringify({timestamp:n.date.toISOString(),level:HA[n.level],message:n.message,extra:n.extra})}function aj(n){function A(q,p){return[Math.floor(q/p),q%p]}function t(){let q,p=n.date.valueOf()-Pe.valueOf();[p,q]=A(p,1e3);let[F,x]=A(p,60);return\`\${F.toString().padStart(4,"0")}:\${x.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=uj[n.level],d=n.logger.name!==void 0?\`@\${n.logger}\`:"";return\`\${QA(t())}\${d} \${i} \${Me[n.level](String(n.message))}\${e()}\`}function Ue(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${HA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",i=uj[n.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${e}\${n.message}\`}function Ve(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var cj={sparse:Te,json:oj,pretty:aj,structured:Ue,default:Ve()?aj:oj},Se=class{formatter;consoleObject;filter;constructor(n=cj.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 S=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)},nA=new S(3,void 0,[new Se]),We=S.prototype.log.bind(nA,1),Re=S.prototype.log.bind(nA,2),dj=S.prototype.log.bind(nA,3),ze=S.prototype.log.bind(nA,4),Bn=S.prototype.log.bind(nA);var qj;function Cj(n,...A){let t=Xe(A);qj?qj?.info(n,t):dj(n,t)}function Xe(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function yA(n){return n.connectionId*4294967296+n.mediaId}function fj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function b(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 W(n,A){n._free(A.byteOffset)}function Gj(n,A){return{values:b(n,"f32",2+A*5),length:A}}function pj(n,A){W(n,A.values)}function hj(n){return{values:b(n,"f32",4)}}function mj(n,A){W(n,A.values)}function Ij(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 Qe(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 p=n.charCodeAt(d);(p&64512)===56320&&(++d,q=((q&1023)<<10)+(p&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 Ye=new TextEncoder,Ze=50;function An(n,A,t){Ye.encodeInto(n,A.subarray(t))}function Ej(n,A,t){n.length>Ze?An(n,A,t):Qe(n,A,t)}var rn=4096;function Ar(n,A,t){let e=A,i=e+t,d=[],q="";for(;e<i;){let p=n[e++];if((p&128)===0)d.push(p);else if((p&224)===192){let F=n[e++]&63;d.push((p&31)<<6|F)}else if((p&240)===224){let F=n[e++]&63,x=n[e++]&63;d.push((p&31)<<12|F<<6|x)}else if((p&248)===240){let F=n[e++]&63,x=n[e++]&63,wA=n[e++]&63,O=(p&7)<<18|F<<12|x<<6|wA;O>65535&&(O-=65536,d.push(O>>>10&1023|55296),O=56320|O&1023),d.push(O)}else d.push(p);d.length>=rn&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var jn=new TextDecoder,tn=200;function en(n,A,t){let e=n.subarray(A,A+t);return jn.decode(e)}function $j(n,A,t){return t>tn?en(n,A,t):Ar(n,A,t)}var R=class{constructor(A,t){this.type=A,this.data=t}};var L=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 Fj(n,A,t){let e=t/4294967296,i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function _A(n,A,t){let e=Math.floor(t/4294967296),i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function DA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function vj(n,A){let t=n.getUint32(A),e=n.getUint32(A+4);return t*4294967296+e}var nn=-1,sn=4294967296-1,ln=17179869184-1;function on({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=ln)if(A===0&&n<=sn){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),_A(e,4,n),t}}function an(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 kn(n){if(n instanceof Date){let A=an(n);return on(A)}else return null}function un(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=DA(A,4),e=A.getUint32(0);return{sec:t,nsec:e}}default:throw new L(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function cn(n){let A=un(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Lj={type:nn,encode:kn,decode:cn};var U=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Lj)}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 R(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 R(q,d)}}}return A instanceof R?A:null}decode(A,t,e){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,e):new R(t,A)}};U.defaultCodec=new U;function dn(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function sA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):dn(n)?new Uint8Array(n):Uint8Array.from(n)}var qn=100,Cn=2048,xA=class n{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??U.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??qn,this.initialBufferSize=A?.initialBufferSize??Cn,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=Ij(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),Ej(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=sA(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),Fj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),_A(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 rr(n,A){return new xA(A).encodeSharedRef(n)}function KA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var fn=16,Gn=16,NA=class{constructor(A=fn,t=Gn){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 p=0;p<e;p++)if(q[p]!==A[t+p])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=Ar(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var jr="array",oA="map_key",Hj="map_value",pn=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new L("The type of key must be string or number but "+typeof n)},tr=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=jr,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=oA,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===jr){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===oA||A.type===Hj){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}},lA=-1,er=new DataView(new ArrayBuffer(0)),hn=new Uint8Array(er.buffer);try{er.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 gj=new RangeError("Insufficient data"),mn=new NA,BA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=er,this.bytes=hn,this.headByte=lA,this.stack=new tr,this.entered=!1,this.extensionCodec=A?.extensionCodec??U.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:mn,this.mapKeyConverter=A?.mapKeyConverter??pn}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=lA,this.stack.reset()}setBuffer(A){let t=sA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=sA(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 p of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{e=this.doDecodeSync(),t=!0}catch(F){if(!(F instanceof RangeError))throw F}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 \${KA(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 L(\`Unrecognized type byte: \${KA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let i=e.top();if(i.type===jr)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===oA){if(t==="__proto__")throw new L("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=Hj;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=oA;continue A}}return t}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}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 L(\`Unrecognized array type byte: \${KA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new L(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new L(\`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 L(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw gj;let e=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,e,A):i=$j(this.bytes,e,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===oA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new L(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw gj;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 L(\`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=vj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=DA(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 nr(n,A){return new BA(A).decode(n)}var aA=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=nr(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(x=>typeof x=="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,p=(t[4]&1)!==0,F=t[t.length-1];return F instanceof Uint8Array?kj(new n(e,i,d,p,F)):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(rr(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var JA=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,M.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=hj(this.wasm),this.outBuffer=b(this.wasm,"u8",1270),gA(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(){mj(this.wasm,this.information),W(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){Cj(\`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 aA(i.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));T(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:FA(this.information),speechProbability:vA(this.information),rmsDBFS:LA(this.information),volume:nj(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}}}},bA=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=b(this.wasm,"u32",M.MaxNumberOfDecoders),this.information=Gj(this.wasm,M.MaxNumberOfDecoders),IA(this.information,[1,1])}close(){pj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=aA.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(yA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=b(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=yA({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),$A(this.information,A,i),ej(this.information,A,0),jj(this.information,A,0)}removeMedia(A,t,e){let i=yA({connectionId:t,mediaId:e}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Zr(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:p}of e.added)this.insertMedia(i,d,q,p);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=fj(t);A.push({index:e.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:EA(this.information,e.index),volume:Aj(this.information,e.index),voicedBlocks:tj(this.information,e.index),silentBlocks:rj(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:sj(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Yr(this.information),decoders:A}}};var Nj=pe(_j()),Dj=(0,Nj.default)(),xj,Kj;globalThis.addEventListener("message",ir);async function ir(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=ir,xj=new lr(e.sampleRate,await Dj,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=ir,Kj=new or(await Dj,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}xj?.onMessage(A),Kj?.onMessage(A)}var lr=class extends JA{constructor(t,e,i){super(t,e);this.sampleRate=t;this.inBuffer=b(this.wasm,"f32",t*.02),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["captureReady",{}])}close(){super.close(),W(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"captureSetVolume":this.setVolume(i.value);break;case"captureTick":this.tick(i.buffer);break}}setVolume(t){gA(this.information,t)}tick(t){this.inBuffer.set(t,0),this.encode(this.inBuffer)}update(){T(globalThis,["captureUpdate",{active:FA(this.information),rmsDBFs:LA(this.information),speechProbability:vA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},or=class extends bA{constructor(t,e,i){super(t);this.workletPort=e;this.id=M.PlaybackPreload,this.outBuffer=b(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["playbackReady",{}])}close(){super.close(),W(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"playbackSetVolume":this.setVolume(i.index,i.value);break;case"playbackTick":this.tick();break}}setVolume(t,e){t==="global"?IA(this.information,e):$A(this.information,t,e)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:t}=this.decode(this.outBuffer);if(t){let e=this.outBuffer.slice();T(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let t=new Float32Array(this.information.length*2);for(let i=0;i<=this.largestIndex;i++)t[i]=EA(this.information,i);let e=[];for(let[i,d]of this.medias)e[d.index]={packetsBuffered:d.decoder.cache_length,packetsSeen:d.decoder.packets_seen,packetsProcessed:d.decoder.packets_processed,packetsTooEarly:d.decoder.packets_too_early,packetsTooLate:d.decoder.packets_too_late,packetsDropped:0,packetsInvalid:d.decoder.packets_invalid,packetsRepeated:d.decoder.packets_repeated,packetsLost:d.decoder.packets_lost};T(globalThis,["playbackUpdate",{activities:t,jitterStats:e}],[t.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
|
|
3191
|
-
`;var
|
|
3190
|
+
\`,new Function(m,C)}function SA(j,r,s,l,o,a){var k=r.length;k<2&&G("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=r[1]!==null&&s!==null,c=Jr(r),C=!r[0].isVoid,f=r[0],m=r[1],E=[j,G,l,o,Br,f.fromWireType.bind(f),m?.toWireType.bind(m)],h=2;h<k;++h){var $=r[h];E.push($.toWireType.bind($))}if(!c)for(var h=u?1:2;h<r.length;++h)r[h].destructorFunction!==null&&E.push(r[h].destructorFunction);var J=$t(r,u,C,a)(...E);return Hr(j,J)}var Ft=(j,r,s,l,o,a)=>{var k=VA(r,s);o=N(l,o),w([],[j],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[r-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${r-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[r-1]=()=>{Q(\`Cannot construct \${u.name} due to unbound types\`,k)},w([],k,C=>(C.splice(1,0,null),u.registeredClass.constructor_body[r-1]=SA(c,C,null,o,a),[])),[]})},br=j=>{j=j.trim();let r=j.indexOf("(");return r===-1?j:j.slice(0,r)},vt=(j,r,s,l,o,a,k,u,c,C)=>{var f=VA(s,l);r=v(r),r=br(r),a=N(o,a,c),w([],[j],m=>{m=m[0];var E=\`\${m.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(r);function h(){Q(\`Cannot call \${E} due to unbound types\`,f)}var $=m.registeredClass.instancePrototype,H=$[r];return H===void 0||H.overloadTable===void 0&&H.className!==m.name&&H.argCount===s-2?(h.argCount=s-2,h.className=m.name,$[r]=h):(_r($,r,E),$[r].overloadTable[s-2]=h),w([],f,J=>{var y=SA(E,J,m,a,k,c);return $[r].overloadTable===void 0?(y.argCount=s-2,$[r]=y):$[r].overloadTable[s-2]=y,[]}),[]})},Or=(j,r,s)=>(j instanceof Object||G(\`\${s} with invalid "this": \${j}\`),j instanceof r.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${j.constructor.name}\`),j.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(j.$$.ptr,j.$$.ptrType.registeredClass,r.registeredClass)),Lt=(j,r,s,l,o,a,k,u,c,C)=>{r=v(r),o=N(l,o),w([],[j],f=>{f=f[0];var m=\`\${f.name}.\${r}\`,E={get(){Q(\`Cannot access \${m} due to unbound types\`,[s,k])},enumerable:!0,configurable:!0};return c?E.set=()=>Q(\`Cannot access \${m} due to unbound types\`,[s,k]):E.set=h=>G(m+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,r,E),w([],c?[s,k]:[s],h=>{var $=h[0],H={get(){var y=Or(this,f,m+" getter");return $.fromWireType(o(a,y))},enumerable:!0};if(c){c=N(u,c);var J=h[1];H.set=function(y){var eA=Or(this,f,m+" setter"),g=[];c(C,eA,J.toWireType(g,y)),Br(g)}}return Object.defineProperty(f.registeredClass.instancePrototype,r,H),[]}),[]})},wr=[],Y=[0,1,,1,null,1,!0,1,!1,1],gt=j=>{j>9&&--Y[j+1]===0&&(Y[j]=void 0,wr.push(j))},WA={toValue:j=>(j||G(\`Cannot use deleted val. handle = \${j}\`),Y[j]),toHandle:j=>{switch(j){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=wr.pop()||Y.length;return Y[r]=j,Y[r+1]=1,r}}}},Ht={name:"emscripten::val",fromWireType:j=>{var r=WA.toValue(j);return gt(j),r},toWireType:(j,r)=>WA.toHandle(r),readValueFromPointer:GA,destructorFunction:null},yt=j=>K(j,Ht),_t=(j,r)=>{switch(r){case 4:return function(s){return this.fromWireType(qr[s>>2])};case 8:return function(s){return this.fromWireType(Cr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${j}\`)}},Dt=(j,r,s)=>{r=v(r),K(j,{name:r,fromWireType:l=>l,toWireType:(l,o)=>o,readValueFromPointer:_t(r,s),destructorFunction:null})},xt=(j,r,s,l,o,a,k,u)=>{var c=VA(r,s);j=v(j),j=br(j),o=N(l,o,k),Dr(j,function(){Q(\`Cannot call \${j} due to unbound types\`,c)},r-1),w([],c,C=>{var f=[C[0],null].concat(C.slice(1));return Kr(j,SA(j,f,null,o,a,k),r-1),[]})},Kt=(j,r,s,l,o)=>{r=v(r);let a=l===0,k=c=>c;if(a){var u=32-8*s;k=c=>c<<u>>>u,o=k(o)}K(j,{name:r,fromWireType:k,toWireType:(c,C)=>C,readValueFromPointer:Fr(r,s,l!==0),destructorFunction:null})},Nt=(j,r,s)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=l[r];function a(k){var u=I[k>>2],c=I[k+4>>2];return new o(V.buffer,c,u)}s=v(s),K(j,{name:s,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Bt=(j,r,s,l)=>{if(!(l>0))return 0;for(var o=s,a=s+l-1,k=0;k<j.length;++k){var u=j.codePointAt(k);if(u<=127){if(s>=a)break;r[s++]=u}else if(u<=2047){if(s+1>=a)break;r[s++]=192|u>>6,r[s++]=128|u&63}else if(u<=65535){if(s+2>=a)break;r[s++]=224|u>>12,r[s++]=128|u>>6&63,r[s++]=128|u&63}else{if(s+3>=a)break;r[s++]=240|u>>18,r[s++]=128|u>>12&63,r[s++]=128|u>>6&63,r[s++]=128|u&63,k++}}return r[s]=0,s-o},Jt=(j,r,s)=>Bt(j,_,r,s),bt=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.charCodeAt(s);l<=127?r++:l<=2047?r+=2:l>=55296&&l<=57343?(r+=4,++s):r+=3}return r},Pr=globalThis.TextDecoder&&new TextDecoder,Mr=(j,r,s,l)=>{var o=r+s;if(l)return o;for(;j[r]&&!(r>=o);)++r;return r},Tr=(j,r=0,s,l)=>{var o=Mr(j,r,s,l);if(o-r>16&&j.buffer&&Pr)return Pr.decode(j.subarray(r,o));for(var a="";r<o;){var k=j[r++];if(!(k&128)){a+=String.fromCharCode(k);continue}var u=j[r++]&63;if((k&224)==192){a+=String.fromCharCode((k&31)<<6|u);continue}var c=j[r++]&63;if((k&240)==224?k=(k&15)<<12|u<<6|c:k=(k&7)<<18|u<<12|c<<6|j[r++]&63,k<65536)a+=String.fromCharCode(k);else{var C=k-65536;a+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return a},Ot=(j,r,s)=>j?Tr(_,j,r,s):"",wt=(j,r)=>{r=v(r);var s=!0;K(j,{name:r,fromWireType(l){var o=I[l>>2],a=l+4,k;if(s)k=Ot(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(_[a+u])}return B(l),k},toWireType(l,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var a,k=typeof o=="string";k||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&k?a=bt(o):a=o.length;var u=RA(4+a+1),c=u+4;if(I[u>>2]=a,k)if(s)Jt(o,c,a+1);else for(var C=0;C<a;++C){var f=o.charCodeAt(C);f>255&&(B(u),G("String has UTF-16 code units that do not fit in 8 bits")),_[c+C]=f}else _.set(o,c);return l!==null&&l.push(B,u),u},readValueFromPointer:GA,destructorFunction(l){B(l)}})},Ur=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Pt=(j,r,s)=>{var l=j>>1,o=Mr(Z,l,r/2,s);if(o-l>16&&Ur)return Ur.decode(Z.subarray(l,o));for(var a="",k=l;k<o;++k){var u=Z[k];a+=String.fromCharCode(u)}return a},Mt=(j,r,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var l=r,o=s<j.length*2?s/2:j.length,a=0;a<o;++a){var k=j.charCodeAt(a);uA[r>>1]=k,r+=2}return uA[r>>1]=0,r-l},Tt=j=>j.length*2,Ut=(j,r,s)=>{for(var l="",o=j>>2,a=0;!(a>=r/4);a++){var k=I[o+a];if(!k&&!s)break;l+=String.fromCodePoint(k)}return l},Vt=(j,r,s)=>{if(s??=2147483647,s<4)return 0;for(var l=r,o=l+s-4,a=0;a<j.length;++a){var k=j.codePointAt(a);if(k>65535&&a++,cA[r>>2]=k,r+=4,r+4>o)break}return cA[r>>2]=0,r-l},St=j=>{for(var r=0,s=0;s<j.length;++s){var l=j.codePointAt(s);l>65535&&s++,r+=4}return r},Wt=(j,r,s)=>{s=v(s);var l,o,a;r===2?(l=Pt,o=Mt,a=Tt):(l=Ut,o=Vt,a=St),K(j,{name:s,fromWireType:k=>{var u=I[k>>2],c=l(k+4,u*r,!0);return B(k),c},toWireType:(k,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var c=a(u),C=RA(4+c+r);return I[C>>2]=c/r,o(u,C+4,c+r),k!==null&&k.push(B,C),C},readValueFromPointer:GA,destructorFunction(k){B(k)}})},Rt=(j,r)=>{r=v(r),K(j,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,l)=>{}})},zt=j=>{PA("OOM")},Xt=j=>{var r=_.length;j>>>=0,zt(j)},Qt=j=>52,Yt=9007199254740992,Zt=-9007199254740992,Ae=j=>j<Zt||j>Yt?NaN:Number(j);function re(j,r,s,l){return r=Ae(r),70}for(var je=[null,[],[]],te=(j,r)=>{var s=je[j];r===0||r===10?((j===1?ar:kA)(Tr(s)),s.length=0):s.push(r)},ee=(j,r,s,l)=>{for(var o=0,a=0;a<s;a++){var k=I[r>>2],u=I[r+4>>2];r+=8;for(var c=0;c<u;c++)te(j,_[k+c]);o+=u}return I[l>>2]=o,0},jA=new Uint8Array(123),P=25;P>=0;--P)jA[48+P]=52+P,jA[65+P]=P,jA[97+P]=26+P;if(jA[43]=62,jA[47]=63,st(),pt(),e.noExitRuntime&&(zj=e.noExitRuntime),e.print&&(ar=e.print),e.printErr&&(kA=e.printErr),e.wasmBinary&&(kr=e.wasmBinary),e.arguments&&(p=e.arguments),e.thisProgram&&(F=e.thisProgram),e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.shift()();var Vr,RA,B,ne,se,Sr,Wr;function ie(j){Vr=j.w,RA=e._malloc=j.y,B=e._free=j.z,ne=Sr=j.u,se=Wr=j.x}var le={g:Yj,r:Zj,f:rt,l:jt,k:Et,j:Ft,d:vt,a:Lt,s:yt,i:Dt,n:xt,c:Kt,b:Nt,t:wt,e:Wt,m:Rt,o:Xt,q:Qt,p:re,h:ee};function oe(){bj();function j(){e.calledRun=!0,!ur&&(Oj(),cr?.(e),e.onRuntimeInitialized?.(),wj())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),j()},1)):j()}var tA;return tA=await Sj(),oe(),pr?t=e:t=new Promise((j,r)=>{cr=j,dr=r}),t}})();typeof yj=="object"&&typeof OA=="object"?(OA.exports=sr,OA.exports.default=sr):typeof define=="function"&&define.amd&&define([],()=>sr)});var M={};fe(M,{AdditionalCaptureBlocks:()=>me,AdditionalPlaybackBlocks:()=>he,ClockJumpCheckInterval:()=>ge,ClockJumpThreshold:()=>He,ConnectInterval:()=>Je,ConnectTimeout:()=>Ke,DefaultRefreshRate:()=>Ee,DefaultVideoCodec:()=>be,HealthCheckTimeout:()=>Le,MainConnectionPingInterval:()=>ye,MaxNumberOfDecoders:()=>Fe,MinDBFs:()=>Qr,MinTokenLifetime:()=>Ne,MinTokenRefreshInterval:()=>Be,PlaybackPreload:()=>Ie,RenderQuantumSize:()=>ve,VadPreload:()=>$e,WebRtcIceTimeout:()=>De,WebRtcStatsSnapshotInterval:()=>_e,WebRtcTimeout:()=>xe});var he=3,me=3,Ie=3,Ee=250,$e=3,Fe=512,ve=128,Qr=-758.596,Le=1e4,ge=1e3,He=1e4,ye=3e3,_e=1e3,De=3e3,xe=1e4,Ke=5e3,Ne=6e4,Be=5e3,Je=[0,100,200,200,500],be="H264";function T(n,A,t){return n.postMessage(A,t)}function Yr(n){return[n.values[0],n.values[1]]}function IA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function EA(n,A){return n.values[2+A*5]}function Zr(n,A,t){n.values[2+A*5]=t}function Aj(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function $A(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function rj(n,A){return n.values[2+A*5+3]}function jj(n,A,t){n.values[2+A*5+3]=t}function tj(n,A){return n.values[2+A*5+4]}function ej(n,A,t){n.values[2+A*5+4]=t}function FA(n){return n.values[0]!==0}function vA(n){return n.values[1]}function LA(n){return n.values[2]}function nj(n){return n.values[3]}function gA(n,A){return n.values[3]=A}function sj(n){return n?Array.from(n).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var Oe;(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||={})})(Oe||={});function kj(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:ij}=globalThis,we=typeof ij?.noColor=="boolean"?ij.noColor:!1,Pe=!we;function YA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(n,A){return Pe?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function QA(n){return ZA(n,YA([0],0))}function lj(n){return ZA(n,YA([1],22))}function Me(n){return ZA(n,YA([2],22))}var Jn=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"),Te=new Date,HA=(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))(HA||{}),uj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Ue={4:Me,3:QA,2:QA,1:lj,0:lj};function Ve({message:n}){return String(n)}function oj(n){return JSON.stringify({timestamp:n.date.toISOString(),level:HA[n.level],message:n.message,extra:n.extra})}function aj(n){function A(q,p){return[Math.floor(q/p),q%p]}function t(){let q,p=n.date.valueOf()-Te.valueOf();[p,q]=A(p,1e3);let[F,x]=A(p,60);return\`\${F.toString().padStart(4,"0")}:\${x.toString().padStart(2,"0")}.\${q.toString().padStart(3,"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=uj[n.level],d=n.logger.name!==void 0?\`@\${n.logger.name}\`:"";return\`\${QA(t())}\${d} \${i} \${Ue[n.level](String(n.message))}\${e()}\`}function Se(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${HA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",i=uj[n.level];return\`\${A} \${i} \${t.padEnd(7," ")} \${e}\${n.message}\`}function We(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var cj=class{static sparse=Ve;static json=oj;static pretty=aj;static structured=Se;static default=We()?aj:oj;constructor(){}},Re=class{formatter;consoleObject;filter;constructor(n=cj.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 0: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 S=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)},nA=new S(3,void 0,[new Re]),ze=S.prototype.log.bind(nA,1),Xe=S.prototype.log.bind(nA,2),dj=S.prototype.log.bind(nA,3),Qe=S.prototype.log.bind(nA,4),bn=S.prototype.log.bind(nA);var qj;function Cj(n,...A){let t=Ye(A);qj?qj?.info(n,t):dj(n,t)}function Ye(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function yA(n){return n.connectionId*4294967296+n.mediaId}function fj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function b(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 W(n,A){n._free(A.byteOffset)}function Gj(n,A){return{values:b(n,"f32",2+A*5),length:A}}function pj(n,A){W(n,A.values)}function hj(n){return{values:b(n,"f32",4)}}function mj(n,A){W(n,A.values)}function Ij(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 Ze(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 p=n.charCodeAt(d);(p&64512)===56320&&(++d,q=((q&1023)<<10)+(p&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 An=new TextEncoder,rn=50;function jn(n,A,t){An.encodeInto(n,A.subarray(t))}function Ej(n,A,t){n.length>rn?jn(n,A,t):Ze(n,A,t)}var tn=4096;function Ar(n,A,t){let e=A,i=e+t,d=[],q="";for(;e<i;){let p=n[e++];if((p&128)===0)d.push(p);else if((p&224)===192){let F=n[e++]&63;d.push((p&31)<<6|F)}else if((p&240)===224){let F=n[e++]&63,x=n[e++]&63;d.push((p&31)<<12|F<<6|x)}else if((p&248)===240){let F=n[e++]&63,x=n[e++]&63,wA=n[e++]&63,O=(p&7)<<18|F<<12|x<<6|wA;O>65535&&(O-=65536,d.push(O>>>10&1023|55296),O=56320|O&1023),d.push(O)}else d.push(p);d.length>=tn&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var en=new TextDecoder,nn=200;function sn(n,A,t){let e=n.subarray(A,A+t);return en.decode(e)}function $j(n,A,t){return t>nn?sn(n,A,t):Ar(n,A,t)}var R=class{constructor(A,t){this.type=A,this.data=t}};var L=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 Fj(n,A,t){let e=t/4294967296,i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function _A(n,A,t){let e=Math.floor(t/4294967296),i=t;n.setUint32(A,e),n.setUint32(A+4,i)}function DA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function vj(n,A){let t=n.getUint32(A),e=n.getUint32(A+4);return t*4294967296+e}var ln=-1,on=4294967296-1,an=17179869184-1;function kn({sec:n,nsec:A}){if(n>=0&&A>=0&&n<=an)if(A===0&&n<=on){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),_A(e,4,n),t}}function un(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 cn(n){if(n instanceof Date){let A=un(n);return kn(A)}else return null}function dn(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=DA(A,4),e=A.getUint32(0);return{sec:t,nsec:e}}default:throw new L(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function qn(n){let A=dn(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Lj={type:ln,encode:cn,decode:qn};var U=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Lj)}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 R(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 R(q,d)}}}return A instanceof R?A:null}decode(A,t,e){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(A,t,e):new R(t,A)}};U.defaultCodec=new U;function Cn(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function sA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):Cn(n)?new Uint8Array(n):Uint8Array.from(n)}var fn=100,Gn=2048,xA=class n{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??U.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??fn,this.initialBufferSize=A?.initialBufferSize??Gn,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=Ij(A);this.ensureBufferSizeToWrite(5+e),this.writeStringHeader(e),Ej(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=sA(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),Fj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),_A(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 rr(n,A){return new xA(A).encodeSharedRef(n)}function KA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var pn=16,hn=16,NA=class{constructor(A=pn,t=hn){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 p=0;p<e;p++)if(q[p]!==A[t+p])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=Ar(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var jr="array",oA="map_key",Hj="map_value",mn=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new L("The type of key must be string or number but "+typeof n)},tr=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=jr,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=oA,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===jr){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===oA||A.type===Hj){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}},lA=-1,er=new DataView(new ArrayBuffer(0)),In=new Uint8Array(er.buffer);try{er.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 gj=new RangeError("Insufficient data"),En=new NA,BA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=er,this.bytes=In,this.headByte=lA,this.stack=new tr,this.entered=!1,this.extensionCodec=A?.extensionCodec??U.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:En,this.mapKeyConverter=A?.mapKeyConverter??mn}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=lA,this.stack.reset()}setBuffer(A){let t=sA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=sA(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 p of A){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{e=this.doDecodeSync(),t=!0}catch(F){if(!(F instanceof RangeError))throw F}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 \${KA(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 L(\`Unrecognized type byte: \${KA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let i=e.top();if(i.type===jr)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===oA){if(t==="__proto__")throw new L("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=Hj;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=oA;continue A}}return t}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}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 L(\`Unrecognized array type byte: \${KA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new L(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new L(\`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 L(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw gj;let e=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?i=this.keyDecoder.decode(this.bytes,e,A):i=$j(this.bytes,e,A),this.pos+=t+A,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===oA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new L(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw gj;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 L(\`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=vj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=DA(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 nr(n,A){return new BA(A).decode(n)}var aA=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=nr(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(x=>typeof x=="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,p=(t[4]&1)!==0,F=t[t.length-1];return F instanceof Uint8Array?kj(new n(e,i,d,p,F)):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(rr(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var JA=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,M.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=hj(this.wasm),this.outBuffer=b(this.wasm,"u8",1270),gA(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(){mj(this.wasm,this.information),W(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){Cj(\`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 aA(i.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));T(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:FA(this.information),speechProbability:vA(this.information),rmsDBFS:LA(this.information),volume:nj(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}}}},bA=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=b(this.wasm,"u32",M.MaxNumberOfDecoders),this.information=Gj(this.wasm,M.MaxNumberOfDecoders),IA(this.information,[1,1])}close(){pj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=aA.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(yA({connectionId:A,mediaId:i}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=b(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=yA({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),$A(this.information,A,i),ej(this.information,A,0),jj(this.information,A,0)}removeMedia(A,t,e){let i=yA({connectionId:t,mediaId:e}),d=this.medias.get(i);if(!(d===void 0||d.index!==A)&&(this.medias.delete(i),Zr(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:p}of e.added)this.insertMedia(i,d,q,p);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=fj(t);A.push({index:e.index,connectionId:i.connectionId,mediaId:i.mediaId,rmsDBFS:EA(this.information,e.index),volume:Aj(this.information,e.index),voicedBlocks:tj(this.information,e.index),silentBlocks:rj(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:sj(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Yr(this.information),decoders:A}}};var Nj=pe(_j()),Dj=(0,Nj.default)(),xj,Kj;globalThis.addEventListener("message",ir);async function ir(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=ir,xj=new lr(e.sampleRate,await Dj,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=ir,Kj=new or(await Dj,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}xj?.onMessage(A),Kj?.onMessage(A)}var lr=class extends JA{constructor(t,e,i){super(t,e);this.sampleRate=t;this.inBuffer=b(this.wasm,"f32",t*.02),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["captureReady",{}])}close(){super.close(),W(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"captureSetVolume":this.setVolume(i.value);break;case"captureTick":this.tick(i.buffer);break}}setVolume(t){gA(this.information,t)}tick(t){this.inBuffer.set(t,0),this.encode(this.inBuffer)}update(){T(globalThis,["captureUpdate",{active:FA(this.information),rmsDBFs:LA(this.information),speechProbability:vA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},or=class extends bA{constructor(t,e,i){super(t);this.workletPort=e;this.id=M.PlaybackPreload,this.outBuffer=b(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),i),T(globalThis,["playbackReady",{}])}close(){super.close(),W(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,i]=t;switch(e){case"playbackSetVolume":this.setVolume(i.index,i.value);break;case"playbackTick":this.tick();break}}setVolume(t,e){t==="global"?IA(this.information,e):$A(this.information,t,e)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:t}=this.decode(this.outBuffer);if(t){let e=this.outBuffer.slice();T(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let t=new Float32Array(this.information.length*2);for(let i=0;i<=this.largestIndex;i++)t[i]=EA(this.information,i);let e=[];for(let[i,d]of this.medias)e[d.index]={packetsBuffered:d.decoder.cache_length,packetsSeen:d.decoder.packets_seen,packetsProcessed:d.decoder.packets_processed,packetsTooEarly:d.decoder.packets_too_early,packetsTooLate:d.decoder.packets_too_late,packetsDropped:0,packetsInvalid:d.decoder.packets_invalid,packetsRepeated:d.decoder.packets_repeated,packetsLost:d.decoder.packets_lost};T(globalThis,["playbackUpdate",{activities:t,jitterStats:e}],[t.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
|
|
3191
|
+
`;var h='"use strict";(()=>{var P=Object.defineProperty;var M=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})};var u={};M(u,{AdditionalCaptureBlocks:()=>R,AdditionalPlaybackBlocks:()=>E,ClockJumpCheckInterval:()=>_,ClockJumpThreshold:()=>N,ConnectInterval:()=>Z,ConnectTimeout:()=>J,DefaultRefreshRate:()=>D,DefaultVideoCodec:()=>q,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>W,MaxNumberOfDecoders:()=>L,MinDBFs:()=>v,MinTokenLifetime:()=>z,MinTokenRefreshInterval:()=>G,PlaybackPreload:()=>F,RenderQuantumSize:()=>V,VadPreload:()=>C,WebRtcIceTimeout:()=>j,WebRtcStatsSnapshotInterval:()=>$,WebRtcTimeout:()=>H});var E=3,R=3,F=3,D=250,C=3,L=512,V=128,v=-758.596,O=1e4,_=1e3,N=1e4,W=3e3,$=1e3,j=3e3,H=1e4,J=5e3,z=6e4,G=5e3,Z=[0,100,200,200,500],q="H264";function d(e,t,r){return e.postMessage(t,r)}var Q;(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||={})})(Q||={});var{Deno:k}=globalThis,K=typeof k?.noColor=="boolean"?k.noColor:!1,X=!K;function m(e,t){return{open:`\\x1B[${e.join(";")}m`,close:`\\x1B[${t}m`,regexp:new RegExp(`\\\\x1b\\\\[${t}m`,"g")}}function h(e,t){return X?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function p(e){return h(e,m([0],0))}function U(e){return h(e,m([1],22))}function Y(e){return h(e,m([2],22))}var ke=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"),ee=new Date,f=(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))(f||{}),T={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},te={4:Y,3:p,2:p,1:U,0:U};function re({message:e}){return String(e)}function S(e){return JSON.stringify({timestamp:e.date.toISOString(),level:f[e.level],message:e.message,extra:e.extra})}function I(e){function t(c,i){return[Math.floor(c/i),c%i]}function r(){let c,i=e.date.valueOf()-ee.valueOf();[i,c]=t(i,1e3);let[B,A]=t(i,60);return`${B.toString().padStart(4,"0")}:${A.toString().padStart(2,"0")}.${c.toString().padStart(3,"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=T[e.level],o=e.logger.name!==void 0?`@${e.logger.name}`:"";return`${p(r())}${o} ${s} ${te[e.level](String(e.message))}${n()}`}function ne(e){let t=`[${e.date.toISOString()}]`,r=`[${f[e.level]}]`,n=e.logger.name!==void 0?`[${e.logger.name}] `:"",s=T[e.level];return`${t} ${s} ${r.padEnd(7," ")} ${n}${e.message}`}function se(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var w=class{static sparse=re;static json=S;static pretty=I;static structured=ne;static default=se()?I:S;constructor(){}},ae=class{formatter;consoleObject;filter;constructor(e=w.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 0: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 a=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)},l=new a(3,void 0,[new ae]),oe=a.prototype.log.bind(l,1),ie=a.prototype.log.bind(l,2),ce=a.prototype.log.bind(l,3),ue=a.prototype.log.bind(l,4),Ue=a.prototype.log.bind(l);var b=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 y(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 o=this.state.fill(0,r[0][0]);return this.state.offset===this.state.length&&(this.state.flush(),this.state.fill(o,r[0][0])),this.alive}dump(){return{type:"unshared capture worklet",alive:this.alive,sampleRate,offset:this.state?.offset||null,length:this.state?.length||null,blocks:this.blocks}}},x=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 g(s.workerPort,sampleRate*.02),s.workerPort.onmessage=this.onMessage.bind(this);break;case"samples":this.state?.add(s.id,s.buffer);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 o=this.state.fill(0,n[0][0],n[0][1]);return o<u.RenderQuantumSize&&(this.totalBlocks+=1,this.state.next(),this.state.hasVoice?this.voiceBlocks+=1:this.silenceBlocks+=1,this.state.fill(o,n[0][0],n[0][1])),this.alive}dump(){return{type:"unshared 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}}},y=class{constructor(t,r){this.port=t;this.length=r;this.offset=0,this.buffer=new Float32Array(r)}fill(t,r){let n=Math.min(r.length-t,this.length-this.offset);return this.buffer.set(r.subarray(t,t+n),this.offset),this.offset+=n,t+n}flush(){d(this.port,["captureTick",{buffer:this.buffer}],[this.buffer.buffer]),this.offset=0,this.buffer=new Float32Array(this.length)}},g=class{constructor(t,r){this.port=t;this.length=r;this.cache=[];this.id=-1,this.offset=0,this.buffer=void 0,this.next()}get hasVoice(){return this.buffer!==void 0}fill(t,r,n){let s=Math.min(u.RenderQuantumSize-t,this.length-this.offset);return this.buffer!==void 0&&(r.set(this.buffer.subarray(this.offset,this.offset+s),t),n.set(this.buffer.subarray(this.offset+this.length,this.offset+this.length+s),t)),this.offset+=s,t+s}add(t,r){this.cache.push({id:t,buffer:r})}next(){for(this.id+=1;this.cache[0]?.id<this.id;)this.cache.shift();this.cache[0]?.id===this.id?(this.buffer=this.cache[0].buffer,this.cache.shift()):this.buffer=void 0,this.offset=0,d(this.port,["playbackTick",{}])}};registerProcessor("OdinCaptureProcessor",b);registerProcessor("OdinPlaybackProcessor",x);})();\n';var tx=new g.Strand;function Cx(r,A,x,F,D=e.DefaultRefreshRate){return tx.enqueue(async()=>{let[B,j]=await q(G,h,r,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return console.warn("SharedArrayBuffer is not available; creating ODIN CaptureWorker in fallback mode"),i.create(r,A,x,D,B,j,F)})}async function Ex(r,A=e.DefaultRefreshRate){if(r.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,F]=await q(G,h,r,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return o.create(r,A,x,F)}var i=class r extends l{constructor(x,F,D,B,j){super(x,F,D,B,j);this._Activity=c;this._SpeechProbability=0;F.addEventListener("message",this._OnMessages.bind(this))}static async create(x,F,D,B,j,t,L){let{port1:p,port2:m}=new MessageChannel;return v(j,["captureInit",{sampleRate:x.sampleRate,refreshRate:B,workletPort:p}],[p]),await u(j,"captureReady"),v(t.port,["init",{workerPort:m}],[m]),new r(t,j,F,D,L)}get activity(){return this._Activity}get speechProbability(){return this._SpeechProbability}setVolume(x){v(this.worker,["captureSetVolume",{value:x}])}_OnMessages(x){super._OnMessages(x);let[F,D]=x.data;F==="captureUpdate"&&(this._Activity={isSilent:!D.active,rmsDBFS:D.rmsDBFs},this._SpeechProbability=D.speechProbability)}},o=class r extends s{constructor(x,F,D){super(x,F,D);this.activities=new Float32Array;this.jitterStats=[]}static async create(x,F,D,B){let{port1:j,port2:t}=new MessageChannel;return v(D,["playbackInit",{workletPort:j,refreshRate:F}],[j]),await u(D,"playbackReady"),v(B.port,["init",{workerPort:t}],[t]),B.connect(x.destination),new r(x,B,D)}getActivity(x){let F=this.medias.get(E(x));if(F===void 0)return;let D=this.activities.at(F.index);if(D!==void 0)return D===0?c:{isSilent:!1,rmsDBFS:D}}getJitterStats(x){let F=this.medias.get(E(x));if(F===void 0)return;let D=this.jitterStats.at(F.index);if(D!==void 0)return D}setGlobalVolume(x){v(this.worker,["playbackSetVolume",{index:"global",value:x}])}setVolume(x,F){let D=this.medias.get(E(x));D!==void 0&&v(this.worker,["playbackSetVolume",{index:D.index,value:F}])}_GetFreeIndex(){let x=super._GetFreeIndex();if(x!==void 0)return x;if(this.medias.size<e.MaxNumberOfDecoders)return this.medias.size}_OnMessages(x){super._OnMessages(x);let[F,D]=x.data;F==="playbackUpdate"&&(this.activities=D.activities,this.jitterStats=D.jitterStats)}};0&&(module.exports={UnsharedCaptureWorker,UnsharedPlaybackWorker,createCaptureWorker,createPlaybackWorker});
|