@4players/odin-plugin-web 1.9.8 → 1.10.1
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 a=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var $=(r,F)=>{for(var x in F)a(r,x,{get:F[x],enumerable:!0})},J=(r,F,x,D)=>{if(F&&typeof F=="object"||typeof F=="function")for(let A of N(F))!_.call(r,A)&&A!==x&&a(r,A,{get:()=>F[A],enumerable:!(D=H(F,A))||D.enumerable});return r};var K=r=>J(a({},"__esModule",{value:!0}),r);var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var $=(r,F)=>{for(var x in F)a(r,x,{get:F[x],enumerable:!0})},J=(r,F,x,D)=>{if(F&&typeof F=="object"||typeof F=="function")for(let A of N(F))!_.call(r,A)&&A!==x&&a(r,A,{get:()=>F[A],enumerable:!(D=H(F,A))||D.enumerable});return r};var K=r=>J(a({},"__esModule",{value:!0}),r);var sx={};$(sx,{UnsharedCaptureWorker:()=>i,UnsharedPlaybackWorker:()=>o,createCaptureWorker:()=>fx,createPlaybackWorker:()=>bx});module.exports=K(sx);var L=require("@4players/odin-common");var e={};$(e,{AdditionalCaptureBlocks:()=>w,AdditionalPlaybackBlocks:()=>O,ClockJumpCheckInterval:()=>W,ClockJumpThreshold:()=>R,ConnectInterval:()=>rx,ConnectTimeout:()=>Ax,DefaultRefreshRate:()=>M,DefaultVideoCodec:()=>jx,HealthCheckTimeout:()=>S,MainConnectionPingInterval:()=>Q,MaxNumberOfDecoders:()=>U,MinDBFs:()=>k,MinTokenLifetime:()=>Fx,MinTokenRefreshInterval:()=>Dx,PlaybackPreload:()=>P,RenderQuantumSize:()=>V,VadPreload:()=>T,WebRtcAnswerTimeout:()=>Y,WebRtcIceTimeout:()=>X,WebRtcMaxNegotiationAttempts:()=>xx,WebRtcStatsSnapshotInterval:()=>z,WebRtcTimeout:()=>Z});var O=3,w=3,P=3,M=250,T=3,U=512,V=128,k=-758.596,S=1e4,W=1e3,R=1e4,Q=3e3,z=1e3,X=3e3,Z=1e4,Y=1e4,xx=3,Ax=5e3,Fx=6e4,Dx=5e3,rx=[0,100,200,200,500],jx="H264";function v(r,F,x){return r.postMessage(F,x)}function u(r,F){return new Promise(x=>{let D=A=>{let[B,j]=A.data;B===F&&(x(A.data[1]),r.removeEventListener("message",D))};r.addEventListener("message",D)})}var C=require("@4players/odin-common"),g;function d(r,...F){let x=Bx(F);g?g?.error(r,x):(0,C.error)(r,x)}function Bx(...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(F,x,D){this.audioContext=F;this.worklet=x;this.worker=D;this.availableIndexes=[];this.medias=new Map;D.addEventListener("message",this._OnMessages.bind(this))}connectOutput(F){this.worklet.disconnect(),this.worklet.connect(F)}receivePacket(F,x){v(this.worker,["playbackReceivePacket",{connectionId:F,packet:x}],[x.buffer])}addMedias(F,x,D=[1,1]){let A=[];for(let B of x){let j=this._GetFreeIndex();j!==void 0&&(this.medias.set(E({connectionId:F,mediaId:B}),{index:j}),A.push({connectionId:F,mediaId:B,index:j,volume:D}))}v(this.worker,["playbackUpdateMedias",{added:A,removed:[]}])}removeMedias(F,x){let D=[];for(let A of x){let B=E({connectionId:F,mediaId:A}),j=this.medias.get(B);j!==void 0&&(this.medias.delete(B),this.availableIndexes.push(j.index),D.push({connectionId:F,mediaId:A,index:j.index}))}v(this.worker,["playbackUpdateMedias",{added:[],removed:D}])}close(){v(this.worker,["close",void 0]),v(this.worklet.port,["close",void 0]);let F=b.indexOf(this.worker);F>=0&&b.splice(F,1);let x=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(F){}},l=class r{constructor(F,x,D,A,B){this.worklet=F;this.worker=x;this.sink=(j,t)=>{B.deref()!==void 0?D(j,t):(d("capture worker was left abandoned, aborting capture worker"),r.shutdown(F,x))},this.monitorSink=(j,t)=>{B.deref()!==void 0?A(j,t):(d("capture worker was left abandoned, aborting capture worker"),r.shutdown(F,x))},x.addEventListener("message",this._OnMessages.bind(this))}get context(){return this.worklet.context}setMedias(F){v(this.worker,["captureSetMedias",{connections:F}])}setVad(F){v(this.worker,["captureSetVad",F])}close(){r.shutdown(this.worklet,this.worker)}static shutdown(F,x){v(F.port,["close",void 0]),v(x,["close",void 0]);let D=b.indexOf(x);D>=0&&b.splice(D,1);let A=f.indexOf(F);A>=0&&f.splice(A,1)}async dump(){return{captureWorker:await n(this.worker),captureWorklet:await n(this.worklet.port)}}_OnMessages(F){let[x,D]=F.data;x==="sendPacket"&&(D.connectionId===0?this.monitorSink(D.connectionId,D.packet):this.sink(D.connectionId,D.packet))}};function G(r,F,x,D,A){return Promise.all([vx(r),tx(x,F,D,A)])}async function vx(r){let F=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),x=new Worker(F,{type:"module",name:"odin worker"});return b.push(x),x}var q=new WeakMap;async function tx(r,F,x,D){try{let j=new AudioWorkletNode(r,x,D);return f.push(j),j}catch{}let A=q.get(r);if(A===void 0){let j=URL.createObjectURL(new Blob([F],{type:"text/javascript"}));A=r.audioWorklet.addModule(j),q.set(r,A),A.catch(()=>q.delete(r))}await A;let B=new AudioWorkletNode(r,x,D);return f.push(B),B}function n(r){let{port1:F,port2:x}=new MessageChannel,{promise:D,resolve:A}=Promise.withResolvers();return x.onmessage=B=>A(B.data),setTimeout(()=>A("timeout"),100),v(r,["dump",{result:F}],[F]),D}var h=`"use strict";(()=>{var oe=Object.create;var WA=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var de=(n,A)=>()=>(A||n((A={exports:{}}).exports,A),A.exports),qe=(n,A)=>{for(var t in A)WA(n,t,{get:A[t],enumerable:!0})},fe=(n,A,t,e)=>{if(A&&typeof A=="object"||typeof A=="function")for(let l of ke(A))!ce.call(n,l)&&l!==t&&WA(n,l,{get:()=>A[l],enumerable:!(e=ae(A,l))||e.enumerable});return n};var Ce=(n,A,t)=>(t=n!=null?oe(ue(n)):{},fe(A||!n||!n.__esModule?WA(t,"default",{value:n,enumerable:!0}):t,n));var Hj=de((Lj,JA)=>{"use strict";var er=(()=>{var n=globalThis.document?.currentScript?.src;return async function(A={}){var t,e=A,l=!!globalThis.window,d=!!globalThis.WorkerGlobalScope,q=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",p=[],F="./this.program";d&&(n=self.location.href);var D="",KA,O;if(l||d){try{D=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)}),KA=async j=>{var r=await fetch(j,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}var ir=console.log.bind(console),oA=console.error.bind(console),or,ar=!1;function Nj(j){for(var r=0,s=j.length,i=new Uint8Array(s),o;r<s;++r)o=j.charCodeAt(r),i[r]=~o>>8&o;return i}var kr,ur,cr=!1;function Bj(){var j=Ur.buffer;U=new Int8Array(j),aA=new Int16Array(j),e.HEAPU8=_=new Uint8Array(j),Z=new Uint16Array(j),e.HEAP32=kA=new Int32Array(j),e.HEAPU32=m=new Uint32Array(j),e.HEAPF32=fr=new Float32Array(j),Cr=new Float64Array(j),qr=new BigInt64Array(j),Gr=new BigUint64Array(j)}function bj(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Sj(e.preRun.shift());pr(hr)}function Jj(){cr=!0,rA.v()}function Kj(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Vj(e.postRun.shift());pr(Ir)}function OA(j){e.onAbort?.(j),j="Aborted("+j+")",oA(j),ar=!0,j+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(j);throw ur?.(r),r}var dr;function Oj(){return Nj(\`\\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
|
|
@@ -3187,7 +3187,7 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3187
3187
|
|
|
3188
3188
|
|
|
3189
3189
|
\\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\\xE0\\xA9\\v\\0A\\xEC\\xA9\\vX\\0A\\x84\\xAA\\v\\vY\\0\\0\\0Z\\0\\0\\0H\\0A\\x9C\\xAA\\v\\0A\\xAC\\xAA\\v\\b\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\0A\\xF0\\xAA\\v \\xE0\\0\\0\\0\\0\\0\\0A\\x84\\xAB\\v[\\0A\\x9C\\xAB\\vY\\0\\0\\0\\\\\\0\\0\\0X\\0\\0\\0A\\xB4\\xAB\\v\\0A\\xC4\\xAB\\v\\xFF\\xFF\\xFF\\xFF
|
|
3190
|
-
\\0A\\x88\\xAC\\v\\vx\\0x\\0\\x90\`)}function mn(j){return j}async function Pj(j){return j}async function wj(j,r){try{var s=await Pj(j),i=await WebAssembly.instantiate(s,r);return i}catch(o){oA(\`failed to asynchronously prepare wasm: \${o}\`),OA(o)}}async function Mj(j,r,s){return wj(r,s)}function Tj(){var j={a:se};return j}async function Uj(){function j(a,k){return rA=a.exports,ne(rA),Bj(),rA}function r(a){return j(a.instance)}var s=Tj();if(e.instantiateWasm)return new Promise((a,k)=>{e.instantiateWasm(s,(u,c)=>{a(j(u,c))})});dr??=Oj();var i=await Mj(or,dr,s),o=r(i);return o}class En{name="ExitStatus";constructor(r){this.message=\`Program terminated with exit(\${r})\`,this.status=r}}var aA,kA,qr,U,fr,Cr,Z,m,Gr,_,pr=j=>{for(;j.length>0;)j.shift()(e)},Ir=[],Vj=j=>Ir.push(j),hr=[],Sj=j=>hr.push(j),Rj=!0;class Wj{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){m[this.ptr+4>>2]=r}get_type(){return m[this.ptr+4>>2]}set_destructor(r){m[this.ptr+8>>2]=r}get_destructor(){return m[this.ptr+8>>2]}set_caught(r){r=r?1:0,U[this.ptr+12]=r}get_caught(){return U[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,U[this.ptr+13]=r}get_rethrown(){return U[this.ptr+13]!=0}init(r,s){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(s)}set_adjusted_ptr(r){m[this.ptr+16>>2]=r}get_adjusted_ptr(){return m[this.ptr+16>>2]}}var mr=0,Qj=0,zj=(j,r,s)=>{var i=new Wj(j);throw i.init(r,s),mr=j,Qj++,mr},Xj=()=>OA(""),v=j=>{for(var r="";;){var s=_[j++];if(!s)return r;r+=String.fromCharCode(s)}},W={},Q={},uA={},Y=class extends Error{constructor(r){super(r),this.name="BindingError"}},G=j=>{throw new Y(j)};function Zj(j,r,s={}){var i=r.name;if(j||G(\`type "\${i}" must have a positive integer typeid pointer\`),Q.hasOwnProperty(j)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${i}' twice\`)}if(Q[j]=r,delete uA[j],W.hasOwnProperty(j)){var o=W[j];delete W[j],o.forEach(a=>a())}}function N(j,r,s={}){return Zj(j,r,s)}var Er=(j,r,s)=>{switch(r){case 1:return s?i=>U[i]:i=>_[i];case 2:return s?i=>aA[i>>1]:i=>Z[i>>1];case 4:return s?i=>kA[i>>2]:i=>m[i>>2];case 8:return s?i=>qr[i>>3]:i=>Gr[i>>3];default:throw new TypeError(\`invalid integer width (\${r}): \${j}\`)}},Yj=(j,r,s,i,o)=>{r=v(r);let a=i===0n,k=u=>u;if(a){let u=s*8;k=c=>BigInt.asUintN(u,c),o=k(o)}N(j,{name:r,fromWireType:k,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Er(r,s,!a),destructorFunction:null})},At=(j,r,s,i)=>{r=v(r),N(j,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,a){return a?s:i},readValueFromPointer:function(o){return this.fromWireType(_[o])},destructorFunction:null})},rt=j=>({count:j.count,deleteScheduled:j.deleteScheduled,preservePointerOnDelete:j.preservePointerOnDelete,ptr:j.ptr,ptrType:j.ptrType,smartPtr:j.smartPtr,smartPtrType:j.smartPtrType}),PA=j=>{function r(s){return s.$$.ptrType.registeredClass.name}G(r(j)+" instance already deleted")},wA=!1,$r=j=>{},jt=j=>{j.smartPtr?j.smartPtrType.rawDestructor(j.smartPtr):j.ptrType.registeredClass.rawDestructor(j.ptr)},Fr=j=>{j.count.value-=1;var r=j.count.value===0;r&&jt(j)},AA=j=>globalThis.FinalizationRegistry?(wA=new FinalizationRegistry(r=>{Fr(r.$$)}),AA=r=>{var s=r.$$,i=!!s.smartPtr;if(i){var o={$$:s};wA.register(r,o,r)}return r},$r=r=>wA.unregister(r),AA(j)):(AA=r=>r,j),cA=[],tt=()=>{for(;cA.length;){var j=cA.pop();j.$$.deleteScheduled=!1,j.delete()}},vr,et=()=>{let j=dA.prototype;Object.assign(j,{isAliasOf(s){if(!(this instanceof dA)||!(s instanceof dA))return!1;var i=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var a=s.$$.ptrType.registeredClass,k=s.$$.ptr;i.baseClass;)o=i.upcast(o),i=i.baseClass;for(;a.baseClass;)k=a.upcast(k),a=a.baseClass;return i===a&&o===k},clone(){if(this.$$.ptr||PA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=AA(Object.create(Object.getPrototypeOf(this),{$$:{value:rt(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||PA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),$r(this),Fr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||PA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),cA.push(this),cA.length===1&&vr&&vr(tt),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(j[r]=j.delete)};function dA(){}var gr=(j,r)=>Object.defineProperty(r,"name",{value:j}),Lr={},Hr=(j,r,s)=>{if(j[r].overloadTable===void 0){var i=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[i.argCount]=i}},yr=(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\`),Hr(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)},nt=48,st=57,lt=j=>{j=j.replace(/[^a-zA-Z0-9_]/g,"$");var r=j.charCodeAt(0);return r>=nt&&r<=st?\`_\${j}\`:j};function it(j,r,s,i,o,a,k,u){this.name=j,this.constructor=r,this.instancePrototype=s,this.rawDestructor=i,this.baseClass=o,this.getActualType=a,this.upcast=k,this.downcast=u,this.pureVirtualFunctions=[]}var qA=(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},MA=j=>{if(j===null)return"null";var r=typeof j;return r==="object"||r==="array"||r==="function"?j.toString():""+j};function ot(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${MA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=r.$$.ptrType.registeredClass,i=qA(r.$$.ptr,s,this.registeredClass);return i}function at(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 "\${MA(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 i=r.$$.ptrType.registeredClass;if(s=qA(r.$$.ptr,i,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,VA.toHandle(()=>o.delete())),j!==null&&j.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function kt(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${MA(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,i=qA(r.$$.ptr,s,this.registeredClass);return i}function fA(j){return this.fromWireType(m[j>>2])}var _r=(j,r,s)=>{if(r===s)return j;if(s.baseClass===void 0)return null;var i=_r(j,r,s.baseClass);return i===null?null:s.downcast(i)},ut={},ct=(j,r)=>{for(r===void 0&&G("ptr should not be undefined");j.baseClass;)r=j.upcast(r),j=j.baseClass;return r},dt=(j,r)=>(r=ct(j,r),ut[r]),qt=class extends Error{constructor(r){super(r),this.name="InternalError"}},CA=j=>{throw new qt(j)},GA=(j,r)=>{(!r.ptrType||!r.ptr)&&CA("makeClassHandle requires ptr and ptrType");var s=!!r.smartPtrType,i=!!r.smartPtr;return s!==i&&CA("Both smartPtrType and smartPtr must be specified"),r.count={value:1},AA(Object.create(j,{$$:{value:r,writable:!0}}))};function ft(j){var r=this.getPointee(j);if(!r)return this.destructor(j),null;var s=dt(this.registeredClass,r);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=r,s.$$.smartPtr=j,s.clone();var i=s.clone();return this.destructor(j),i}function o(){return this.isSmartPointer?GA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:j}):GA(this.registeredClass.instancePrototype,{ptrType:this,ptr:j})}var a=this.registeredClass.getActualType(r),k=Lr[a];if(!k)return o.call(this);var u;this.isConst?u=k.constPointerType:u=k.pointerType;var c=_r(r,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?GA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:j}):GA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var Ct=()=>{Object.assign(pA.prototype,{getPointee(j){return this.rawGetPointee&&(j=this.rawGetPointee(j)),j},destructor(j){this.rawDestructor?.(j)},readValueFromPointer:fA,fromWireType:ft})};function pA(j,r,s,i,o,a,k,u,c,f,C){this.name=j,this.registeredClass=r,this.isReference=s,this.isConst=i,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=k,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=f,this.rawDestructor=C,!o&&r.baseClass===void 0?i?(this.toWireType=ot,this.destructorFunction=null):(this.toWireType=kt,this.destructorFunction=null):this.toWireType=at}var Dr=(j,r,s)=>{e.hasOwnProperty(j)||CA("Replacing nonexistent public symbol"),e[j].overloadTable!==void 0&&s!==void 0?e[j].overloadTable[s]=r:(e[j]=r,e[j].argCount=s)},xr=[],Gt=j=>{var r=xr[j];return r||(xr[j]=r=Vr.get(j)),r},B=(j,r,s=!1)=>{j=v(j);function i(){var a=Gt(r);return a}var o=i();return typeof o!="function"&&G(\`unknown function pointer with signature \${j}: \${r}\`),o};class pt extends Error{}var It=j=>{var r=Tr(j),s=v(r);return b(r),s},z=(j,r)=>{var s=[],i={};function o(a){if(!i[a]&&!Q[a]){if(uA[a]){uA[a].forEach(o);return}s.push(a),i[a]=!0}}throw r.forEach(o),new pt(\`\${j}: \`+s.map(It).join([", "]))},P=(j,r,s)=>{j.forEach(u=>uA[u]=r);function i(u){var c=s(u);c.length!==j.length&&CA("Mismatched type converter count");for(var f=0;f<j.length;++f)N(j[f],c[f])}var o=new Array(r.length),a=[],k=0;for(let[u,c]of r.entries())Q.hasOwnProperty(c)?o[u]=Q[c]:(a.push(c),W.hasOwnProperty(c)||(W[c]=[]),W[c].push(()=>{o[u]=Q[c],++k,k===a.length&&i(o)}));a.length===0&&i(o)},ht=(j,r,s,i,o,a,k,u,c,f,C,h,E)=>{C=v(C),a=B(o,a),u&&=B(k,u),f&&=B(c,f),E=B(h,E);var I=lt(C);yr(I,function(){z(\`Cannot construct \${C} due to unbound types\`,[i])}),P([j,r,s],i?[i]:[],$=>{$=$[0];var H,J;i?(H=$.registeredClass,J=H.instancePrototype):J=dA.prototype;var y=gr(C,function(...RA){if(Object.getPrototypeOf(this)!==jA)throw new Y(\`Use 'new' to construct \${C}\`);if(L.constructor_body===void 0)throw new Y(\`\${C} has no accessible constructor\`);var Wr=L.constructor_body[RA.length];if(Wr===void 0)throw new Y(\`Tried to invoke ctor of \${C} with invalid number of parameters (\${RA.length}) - expected (\${Object.keys(L.constructor_body).toString()}) parameters instead!\`);return Wr.apply(this,RA)}),jA=Object.create(J,{constructor:{value:y}});y.prototype=jA;var L=new it(C,y,jA,E,H,a,u,f);L.baseClass&&(L.baseClass.__derivedClasses??=[],L.baseClass.__derivedClasses.push(L));var ie=new pA(C,L,!0,!1,!1),Sr=new pA(C+"*",L,!1,!1,!1),Rr=new pA(C+" const*",L,!1,!0,!1);return Lr[j]={pointerType:Sr,constPointerType:Rr},Dr(I,y),[ie,Sr,Rr]})},TA=(j,r)=>{for(var s=[],i=0;i<j;i++)s.push(m[r+i*4>>2]);return s},Nr=j=>{for(;j.length;){var r=j.pop(),s=j.pop();s(r)}};function Br(j){for(var r=1;r<j.length;++r)if(j[r]!==null&&j[r].destructorFunction===void 0)return!0;return!1}function mt(j,r,s,i){var o=Br(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 f=\`return function (\${k}) {
|
|
3190
|
+
\\0A\\x88\\xAC\\v\\vx\\0x\\0\\x90\`)}function $n(j){return j}async function Pj(j){return j}async function wj(j,r){try{var s=await Pj(j),i=await WebAssembly.instantiate(s,r);return i}catch(o){oA(\`failed to asynchronously prepare wasm: \${o}\`),OA(o)}}async function Mj(j,r,s){return wj(r,s)}function Tj(){var j={a:se};return j}async function Uj(){function j(a,k){return rA=a.exports,ne(rA),Bj(),rA}function r(a){return j(a.instance)}var s=Tj();if(e.instantiateWasm)return new Promise((a,k)=>{e.instantiateWasm(s,(u,c)=>{a(j(u,c))})});dr??=Oj();var i=await Mj(or,dr,s),o=r(i);return o}class Fn{name="ExitStatus";constructor(r){this.message=\`Program terminated with exit(\${r})\`,this.status=r}}var aA,kA,qr,U,fr,Cr,Z,m,Gr,_,pr=j=>{for(;j.length>0;)j.shift()(e)},Ir=[],Vj=j=>Ir.push(j),hr=[],Sj=j=>hr.push(j),Rj=!0;class Wj{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){m[this.ptr+4>>2]=r}get_type(){return m[this.ptr+4>>2]}set_destructor(r){m[this.ptr+8>>2]=r}get_destructor(){return m[this.ptr+8>>2]}set_caught(r){r=r?1:0,U[this.ptr+12]=r}get_caught(){return U[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,U[this.ptr+13]=r}get_rethrown(){return U[this.ptr+13]!=0}init(r,s){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(s)}set_adjusted_ptr(r){m[this.ptr+16>>2]=r}get_adjusted_ptr(){return m[this.ptr+16>>2]}}var mr=0,Qj=0,zj=(j,r,s)=>{var i=new Wj(j);throw i.init(r,s),mr=j,Qj++,mr},Xj=()=>OA(""),v=j=>{for(var r="";;){var s=_[j++];if(!s)return r;r+=String.fromCharCode(s)}},W={},Q={},uA={},Y=class extends Error{constructor(r){super(r),this.name="BindingError"}},G=j=>{throw new Y(j)};function Zj(j,r,s={}){var i=r.name;if(j||G(\`type "\${i}" must have a positive integer typeid pointer\`),Q.hasOwnProperty(j)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${i}' twice\`)}if(Q[j]=r,delete uA[j],W.hasOwnProperty(j)){var o=W[j];delete W[j],o.forEach(a=>a())}}function N(j,r,s={}){return Zj(j,r,s)}var Er=(j,r,s)=>{switch(r){case 1:return s?i=>U[i]:i=>_[i];case 2:return s?i=>aA[i>>1]:i=>Z[i>>1];case 4:return s?i=>kA[i>>2]:i=>m[i>>2];case 8:return s?i=>qr[i>>3]:i=>Gr[i>>3];default:throw new TypeError(\`invalid integer width (\${r}): \${j}\`)}},Yj=(j,r,s,i,o)=>{r=v(r);let a=i===0n,k=u=>u;if(a){let u=s*8;k=c=>BigInt.asUintN(u,c),o=k(o)}N(j,{name:r,fromWireType:k,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Er(r,s,!a),destructorFunction:null})},At=(j,r,s,i)=>{r=v(r),N(j,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,a){return a?s:i},readValueFromPointer:function(o){return this.fromWireType(_[o])},destructorFunction:null})},rt=j=>({count:j.count,deleteScheduled:j.deleteScheduled,preservePointerOnDelete:j.preservePointerOnDelete,ptr:j.ptr,ptrType:j.ptrType,smartPtr:j.smartPtr,smartPtrType:j.smartPtrType}),PA=j=>{function r(s){return s.$$.ptrType.registeredClass.name}G(r(j)+" instance already deleted")},wA=!1,$r=j=>{},jt=j=>{j.smartPtr?j.smartPtrType.rawDestructor(j.smartPtr):j.ptrType.registeredClass.rawDestructor(j.ptr)},Fr=j=>{j.count.value-=1;var r=j.count.value===0;r&&jt(j)},AA=j=>globalThis.FinalizationRegistry?(wA=new FinalizationRegistry(r=>{Fr(r.$$)}),AA=r=>{var s=r.$$,i=!!s.smartPtr;if(i){var o={$$:s};wA.register(r,o,r)}return r},$r=r=>wA.unregister(r),AA(j)):(AA=r=>r,j),cA=[],tt=()=>{for(;cA.length;){var j=cA.pop();j.$$.deleteScheduled=!1,j.delete()}},vr,et=()=>{let j=dA.prototype;Object.assign(j,{isAliasOf(s){if(!(this instanceof dA)||!(s instanceof dA))return!1;var i=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var a=s.$$.ptrType.registeredClass,k=s.$$.ptr;i.baseClass;)o=i.upcast(o),i=i.baseClass;for(;a.baseClass;)k=a.upcast(k),a=a.baseClass;return i===a&&o===k},clone(){if(this.$$.ptr||PA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=AA(Object.create(Object.getPrototypeOf(this),{$$:{value:rt(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||PA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),$r(this),Fr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||PA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),cA.push(this),cA.length===1&&vr&&vr(tt),this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;r&&(j[r]=j.delete)};function dA(){}var gr=(j,r)=>Object.defineProperty(r,"name",{value:j}),Lr={},Hr=(j,r,s)=>{if(j[r].overloadTable===void 0){var i=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[i.argCount]=i}},yr=(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\`),Hr(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)},nt=48,st=57,lt=j=>{j=j.replace(/[^a-zA-Z0-9_]/g,"$");var r=j.charCodeAt(0);return r>=nt&&r<=st?\`_\${j}\`:j};function it(j,r,s,i,o,a,k,u){this.name=j,this.constructor=r,this.instancePrototype=s,this.rawDestructor=i,this.baseClass=o,this.getActualType=a,this.upcast=k,this.downcast=u,this.pureVirtualFunctions=[]}var qA=(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},MA=j=>{if(j===null)return"null";var r=typeof j;return r==="object"||r==="array"||r==="function"?j.toString():""+j};function ot(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${MA(r)}" as a \${this.name}\`),r.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=r.$$.ptrType.registeredClass,i=qA(r.$$.ptr,s,this.registeredClass);return i}function at(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 "\${MA(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 i=r.$$.ptrType.registeredClass;if(s=qA(r.$$.ptr,i,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,VA.toHandle(()=>o.delete())),j!==null&&j.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function kt(j,r){if(r===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;r.$$||G(\`Cannot pass "\${MA(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,i=qA(r.$$.ptr,s,this.registeredClass);return i}function fA(j){return this.fromWireType(m[j>>2])}var _r=(j,r,s)=>{if(r===s)return j;if(s.baseClass===void 0)return null;var i=_r(j,r,s.baseClass);return i===null?null:s.downcast(i)},ut={},ct=(j,r)=>{for(r===void 0&&G("ptr should not be undefined");j.baseClass;)r=j.upcast(r),j=j.baseClass;return r},dt=(j,r)=>(r=ct(j,r),ut[r]),qt=class extends Error{constructor(r){super(r),this.name="InternalError"}},CA=j=>{throw new qt(j)},GA=(j,r)=>{(!r.ptrType||!r.ptr)&&CA("makeClassHandle requires ptr and ptrType");var s=!!r.smartPtrType,i=!!r.smartPtr;return s!==i&&CA("Both smartPtrType and smartPtr must be specified"),r.count={value:1},AA(Object.create(j,{$$:{value:r,writable:!0}}))};function ft(j){var r=this.getPointee(j);if(!r)return this.destructor(j),null;var s=dt(this.registeredClass,r);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=r,s.$$.smartPtr=j,s.clone();var i=s.clone();return this.destructor(j),i}function o(){return this.isSmartPointer?GA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:j}):GA(this.registeredClass.instancePrototype,{ptrType:this,ptr:j})}var a=this.registeredClass.getActualType(r),k=Lr[a];if(!k)return o.call(this);var u;this.isConst?u=k.constPointerType:u=k.pointerType;var c=_r(r,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?GA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:j}):GA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var Ct=()=>{Object.assign(pA.prototype,{getPointee(j){return this.rawGetPointee&&(j=this.rawGetPointee(j)),j},destructor(j){this.rawDestructor?.(j)},readValueFromPointer:fA,fromWireType:ft})};function pA(j,r,s,i,o,a,k,u,c,f,C){this.name=j,this.registeredClass=r,this.isReference=s,this.isConst=i,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=k,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=f,this.rawDestructor=C,!o&&r.baseClass===void 0?i?(this.toWireType=ot,this.destructorFunction=null):(this.toWireType=kt,this.destructorFunction=null):this.toWireType=at}var xr=(j,r,s)=>{e.hasOwnProperty(j)||CA("Replacing nonexistent public symbol"),e[j].overloadTable!==void 0&&s!==void 0?e[j].overloadTable[s]=r:(e[j]=r,e[j].argCount=s)},Dr=[],Gt=j=>{var r=Dr[j];return r||(Dr[j]=r=Vr.get(j)),r},B=(j,r,s=!1)=>{j=v(j);function i(){var a=Gt(r);return a}var o=i();return typeof o!="function"&&G(\`unknown function pointer with signature \${j}: \${r}\`),o};class pt extends Error{}var It=j=>{var r=Tr(j),s=v(r);return b(r),s},z=(j,r)=>{var s=[],i={};function o(a){if(!i[a]&&!Q[a]){if(uA[a]){uA[a].forEach(o);return}s.push(a),i[a]=!0}}throw r.forEach(o),new pt(\`\${j}: \`+s.map(It).join([", "]))},P=(j,r,s)=>{j.forEach(u=>uA[u]=r);function i(u){var c=s(u);c.length!==j.length&&CA("Mismatched type converter count");for(var f=0;f<j.length;++f)N(j[f],c[f])}var o=new Array(r.length),a=[],k=0;for(let[u,c]of r.entries())Q.hasOwnProperty(c)?o[u]=Q[c]:(a.push(c),W.hasOwnProperty(c)||(W[c]=[]),W[c].push(()=>{o[u]=Q[c],++k,k===a.length&&i(o)}));a.length===0&&i(o)},ht=(j,r,s,i,o,a,k,u,c,f,C,h,E)=>{C=v(C),a=B(o,a),u&&=B(k,u),f&&=B(c,f),E=B(h,E);var I=lt(C);yr(I,function(){z(\`Cannot construct \${C} due to unbound types\`,[i])}),P([j,r,s],i?[i]:[],$=>{$=$[0];var H,J;i?(H=$.registeredClass,J=H.instancePrototype):J=dA.prototype;var y=gr(C,function(...RA){if(Object.getPrototypeOf(this)!==jA)throw new Y(\`Use 'new' to construct \${C}\`);if(L.constructor_body===void 0)throw new Y(\`\${C} has no accessible constructor\`);var Wr=L.constructor_body[RA.length];if(Wr===void 0)throw new Y(\`Tried to invoke ctor of \${C} with invalid number of parameters (\${RA.length}) - expected (\${Object.keys(L.constructor_body).toString()}) parameters instead!\`);return Wr.apply(this,RA)}),jA=Object.create(J,{constructor:{value:y}});y.prototype=jA;var L=new it(C,y,jA,E,H,a,u,f);L.baseClass&&(L.baseClass.__derivedClasses??=[],L.baseClass.__derivedClasses.push(L));var ie=new pA(C,L,!0,!1,!1),Sr=new pA(C+"*",L,!1,!1,!1),Rr=new pA(C+" const*",L,!1,!0,!1);return Lr[j]={pointerType:Sr,constPointerType:Rr},xr(I,y),[ie,Sr,Rr]})},TA=(j,r)=>{for(var s=[],i=0;i<j;i++)s.push(m[r+i*4>>2]);return s},Nr=j=>{for(;j.length;){var r=j.pop(),s=j.pop();s(r)}};function Br(j){for(var r=1;r<j.length;++r)if(j[r]!==null&&j[r].destructorFunction===void 0)return!0;return!1}function mt(j,r,s,i){var o=Br(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 f=\`return function (\${k}) {
|
|
3191
3191
|
\`;o&&(f+=\`var destructors = [];
|
|
3192
3192
|
\`);var C=o?"destructors":"null",h=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];r&&(f+=\`var thisWired = toClassParamWire(\${C}, this);
|
|
3193
3193
|
\`);for(var c=0;c<a;++c){var E=\`toArg\${c}Wire\`;f+=\`var arg\${c}Wired = \${E}(\${C}, arg\${c});
|
|
@@ -3197,5 +3197,5 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
|
|
|
3197
3197
|
\`,h.push(\`\${I}_dtor\`))}return s&&(f+=\`var ret = fromRetWire(rv);
|
|
3198
3198
|
return ret;
|
|
3199
3199
|
\`),f+=\`}
|
|
3200
|
-
\`,new Function(h,f)}function UA(j,r,s,i,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=Br(r),f=!r[0].isVoid,C=r[0],h=r[1],E=[j,G,i,o,Nr,C.fromWireType.bind(C),h?.toWireType.bind(h)],I=2;I<k;++I){var $=r[I];E.push($.toWireType.bind($))}if(!c)for(var I=u?1:2;I<r.length;++I)r[I].destructorFunction!==null&&E.push(r[I].destructorFunction);var J=mt(r,u,f,a)(...E);return gr(j,J)}var Et=(j,r,s,i,o,a)=>{var k=TA(r,s);o=B(i,o),P([],[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 Y(\`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]=()=>{z(\`Cannot construct \${u.name} due to unbound types\`,k)},P([],k,f=>(f.splice(1,0,null),u.registeredClass.constructor_body[r-1]=UA(c,f,null,o,a),[])),[]})},br=j=>{j=j.trim();let r=j.indexOf("(");return r===-1?j:j.slice(0,r)},$t=(j,r,s,i,o,a,k,u,c,f)=>{var C=TA(s,i);r=v(r),r=br(r),a=B(o,a,c),P([],[j],h=>{h=h[0];var E=\`\${h.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&h.registeredClass.pureVirtualFunctions.push(r);function I(){z(\`Cannot call \${E} due to unbound types\`,C)}var $=h.registeredClass.instancePrototype,H=$[r];return H===void 0||H.overloadTable===void 0&&H.className!==h.name&&H.argCount===s-2?(I.argCount=s-2,I.className=h.name,$[r]=I):(Hr($,r,E),$[r].overloadTable[s-2]=I),P([],C,J=>{var y=UA(E,J,h,a,k,c);return $[r].overloadTable===void 0?(y.argCount=s-2,$[r]=y):$[r].overloadTable[s-2]=y,[]}),[]})},Jr=(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\`),qA(j.$$.ptr,j.$$.ptrType.registeredClass,r.registeredClass)),Ft=(j,r,s,i,o,a,k,u,c,f)=>{r=v(r),o=B(i,o),P([],[j],C=>{C=C[0];var h=\`\${C.name}.\${r}\`,E={get(){z(\`Cannot access \${h} due to unbound types\`,[s,k])},enumerable:!0,configurable:!0};return c?E.set=()=>z(\`Cannot access \${h} due to unbound types\`,[s,k]):E.set=I=>G(h+" is a read-only property"),Object.defineProperty(C.registeredClass.instancePrototype,r,E),P([],c?[s,k]:[s],I=>{var $=I[0],H={get(){var y=Jr(this,C,h+" getter");return $.fromWireType(o(a,y))},enumerable:!0};if(c){c=B(u,c);var J=I[1];H.set=function(y){var jA=Jr(this,C,h+" setter"),L=[];c(f,jA,J.toWireType(L,y)),Nr(L)}}return Object.defineProperty(C.registeredClass.instancePrototype,r,H),[]}),[]})},Kr=[],X=[0,1,,1,null,1,!0,1,!1,1],vt=j=>{j>9&&--X[j+1]===0&&(X[j]=void 0,Kr.push(j))},VA={toValue:j=>(j||G(\`Cannot use deleted val. handle = \${j}\`),X[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=Kr.pop()||X.length;return X[r]=j,X[r+1]=1,r}}}},gt={name:"emscripten::val",fromWireType:j=>{var r=VA.toValue(j);return vt(j),r},toWireType:(j,r)=>VA.toHandle(r),readValueFromPointer:fA,destructorFunction:null},Lt=j=>N(j,gt),Ht=(j,r)=>{switch(r){case 4:return function(s){return this.fromWireType(fr[s>>2])};case 8:return function(s){return this.fromWireType(Cr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${j}\`)}},yt=(j,r,s)=>{r=v(r),N(j,{name:r,fromWireType:i=>i,toWireType:(i,o)=>o,readValueFromPointer:Ht(r,s),destructorFunction:null})},_t=(j,r,s,i,o,a,k,u)=>{var c=TA(r,s);j=v(j),j=br(j),o=B(i,o,k),yr(j,function(){z(\`Cannot call \${j} due to unbound types\`,c)},r-1),P([],c,f=>{var C=[f[0],null].concat(f.slice(1));return Dr(j,UA(j,C,null,o,a,k),r-1),[]})},Dt=(j,r,s,i,o)=>{r=v(r);let a=i===0,k=c=>c;if(a){var u=32-8*s;k=c=>c<<u>>>u,o=k(o)}N(j,{name:r,fromWireType:k,toWireType:(c,f)=>f,readValueFromPointer:Er(r,s,i!==0),destructorFunction:null})},xt=(j,r,s)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=i[r];function a(k){var u=m[k>>2],c=m[k+4>>2];return new o(U.buffer,c,u)}s=v(s),N(j,{name:s,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Nt=(j,r,s,i)=>{if(!(i>0))return 0;for(var o=s,a=s+i-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},Bt=(j,r,s)=>Nt(j,_,r,s),bt=j=>{for(var r=0,s=0;s<j.length;++s){var i=j.charCodeAt(s);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++s):r+=3}return r},Or=globalThis.TextDecoder&&new TextDecoder,Pr=(j,r,s,i)=>{var o=r+s;if(i)return o;for(;j[r]&&!(r>=o);)++r;return r},wr=(j,r=0,s,i)=>{var o=Pr(j,r,s,i);if(o-r>16&&j.buffer&&Or)return Or.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 f=k-65536;a+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return a},Jt=(j,r,s)=>j?wr(_,j,r,s):"",Kt=(j,r)=>{r=v(r);var s=!0;N(j,{name:r,fromWireType(i){var o=m[i>>2],a=i+4,k;if(s)k=Jt(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(_[a+u])}return b(i),k},toWireType(i,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=SA(4+a+1),c=u+4;if(m[u>>2]=a,k)if(s)Bt(o,c,a+1);else for(var f=0;f<a;++f){var C=o.charCodeAt(f);C>255&&(b(u),G("String has UTF-16 code units that do not fit in 8 bits")),_[c+f]=C}else _.set(o,c);return i!==null&&i.push(b,u),u},readValueFromPointer:fA,destructorFunction(i){b(i)}})},Mr=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ot=(j,r,s)=>{var i=j>>1,o=Pr(Z,i,r/2,s);if(o-i>16&&Mr)return Mr.decode(Z.subarray(i,o));for(var a="",k=i;k<o;++k){var u=Z[k];a+=String.fromCharCode(u)}return a},Pt=(j,r,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var i=r,o=s<j.length*2?s/2:j.length,a=0;a<o;++a){var k=j.charCodeAt(a);aA[r>>1]=k,r+=2}return aA[r>>1]=0,r-i},wt=j=>j.length*2,Mt=(j,r,s)=>{for(var i="",o=j>>2,a=0;!(a>=r/4);a++){var k=m[o+a];if(!k&&!s)break;i+=String.fromCodePoint(k)}return i},Tt=(j,r,s)=>{if(s??=2147483647,s<4)return 0;for(var i=r,o=i+s-4,a=0;a<j.length;++a){var k=j.codePointAt(a);if(k>65535&&a++,kA[r>>2]=k,r+=4,r+4>o)break}return kA[r>>2]=0,r-i},Ut=j=>{for(var r=0,s=0;s<j.length;++s){var i=j.codePointAt(s);i>65535&&s++,r+=4}return r},Vt=(j,r,s)=>{s=v(s);var i,o,a;r===2?(i=Ot,o=Pt,a=wt):(i=Mt,o=Tt,a=Ut),N(j,{name:s,fromWireType:k=>{var u=m[k>>2],c=i(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),f=SA(4+c+r);return m[f>>2]=c/r,o(u,f+4,c+r),k!==null&&k.push(b,f),f},readValueFromPointer:fA,destructorFunction(k){b(k)}})},St=(j,r)=>{r=v(r),N(j,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,i)=>{}})},Rt=j=>{OA("OOM")},Wt=j=>{var r=_.length;j>>>=0,Rt(j)},Qt=j=>52,zt=9007199254740992,Xt=-9007199254740992,Zt=j=>j<Xt||j>zt?NaN:Number(j);function Yt(j,r,s,i){return r=Zt(r),70}var Ae=[null,[],[]],re=(j,r)=>{var s=Ae[j];r===0||r===10?((j===1?ir:oA)(wr(s)),s.length=0):s.push(r)},je=(j,r,s,i)=>{for(var o=0,a=0;a<s;a++){var k=m[r>>2],u=m[r+4>>2];r+=8;for(var c=0;c<u;c++)re(j,_[k+c]);o+=u}return m[i>>2]=o,0};if(et(),Ct(),e.noExitRuntime&&(Rj=e.noExitRuntime),e.print&&(ir=e.print),e.printErr&&(oA=e.printErr),e.wasmBinary&&(or=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 Tr,SA,b,te,ee,Ur,Vr;function ne(j){Tr=j.w,SA=e._malloc=j.y,b=e._free=j.z,te=Ur=j.u,ee=Vr=j.x}var se={g:zj,r:Xj,f:Yj,l:At,k:ht,j:Et,d:$t,a:Ft,s:Lt,i:yt,n:_t,c:Dt,b:xt,t:Kt,e:Vt,m:St,o:Wt,q:Qt,p:Yt,h:je};function le(){bj();function j(){e.calledRun=!0,!ar&&(Jj(),kr?.(e),e.onRuntimeInitialized?.(),Kj())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),j()},1)):j()}var rA;return rA=await Uj(),le(),cr?t=e:t=new Promise((j,r)=>{kr=j,ur=r}),t}})();typeof Lj=="object"&&typeof JA=="object"?(JA.exports=er,JA.exports.default=er):typeof define=="function"&&define.amd&&define([],()=>er)});var w={};qe(w,{AdditionalCaptureBlocks:()=>pe,AdditionalPlaybackBlocks:()=>Ge,ClockJumpCheckInterval:()=>ve,ClockJumpThreshold:()=>ge,ConnectInterval:()=>Be,ConnectTimeout:()=>De,DefaultRefreshRate:()=>he,DefaultVideoCodec:()=>be,HealthCheckTimeout:()=>Fe,MainConnectionPingInterval:()=>Le,MaxNumberOfDecoders:()=>Ee,MinDBFs:()=>Qr,MinTokenLifetime:()=>xe,MinTokenRefreshInterval:()=>Ne,PlaybackPreload:()=>Ie,RenderQuantumSize:()=>$e,VadPreload:()=>me,WebRtcIceTimeout:()=>ye,WebRtcStatsSnapshotInterval:()=>He,WebRtcTimeout:()=>_e});var Ge=3,pe=3,Ie=3,he=250,me=3,Ee=512,$e=128,Qr=-758.596,Fe=1e4,ve=1e3,ge=1e4,Le=3e3,He=1e3,ye=3e3,_e=1e4,De=5e3,xe=6e4,Ne=5e3,Be=[0,100,200,200,500],be="H264";function M(n,A,t){return n.postMessage(A,t)}function zr(n){return[n.values[0],n.values[1]]}function IA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function hA(n,A){return n.values[2+A*5]}function Xr(n,A,t){n.values[2+A*5]=t}function Zr(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function mA(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function Yr(n,A){return n.values[2+A*5+3]}function Aj(n,A,t){n.values[2+A*5+3]=t}function rj(n,A){return n.values[2+A*5+4]}function jj(n,A,t){n.values[2+A*5+4]=t}function EA(n){return n.values[0]!==0}function $A(n){return n.values[1]}function FA(n){return n.values[2]}function tj(n){return n.values[3]}function vA(n,A){return n.values[3]=A}function ej(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 oj(n){return{type:"Success",value:n}}function D(n){return{type:"Failure",reason:n}}var{Deno:nj}=globalThis,Ke=typeof nj?.noColor=="boolean"?nj.noColor:!1,Oe=!Ke;function zA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function XA(n,A){return Oe?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function QA(n){return XA(n,zA([0],0))}function sj(n){return XA(n,zA([1],22))}function Pe(n){return XA(n,zA([2],22))}var Bn=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"),we=new Date,gA=(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))(gA||{}),aj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Me={4:Pe,3:QA,2:QA,1:sj,0:sj};function Te({message:n}){return String(n)}function lj(n){return JSON.stringify({timestamp:n.date.toISOString(),level:gA[n.level],message:n.message,extra:n.extra})}function ij(n){function A(q,p){return[Math.floor(q/p),q%p]}function t(){let q,p=n.date.valueOf()-we.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 l=aj[n.level],d=n.logger.name!==void 0?\`@\${n.logger.name}\`:"";return\`\${QA(t())}\${d} \${l} \${Me[n.level](String(n.message))}\${e()}\`}function Ue(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${gA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",l=aj[n.level];return\`\${A} \${l} \${t.padEnd(7," ")} \${e}\${n.message}\`}function Ve(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var kj=class{static sparse=Te;static json=lj;static pretty=ij;static structured=Ue;static default=Ve()?ij:lj;constructor(){}};var Se=class{formatter;consoleObject;filter;constructor(n=kj.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 V=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)},tA=globalThis[Symbol.for("odin-global-logger")]??=new V(3,void 0,[new Se]),Re=V.prototype.log.bind(tA,1),We=V.prototype.log.bind(tA,2),uj=V.prototype.log.bind(tA,3),Qe=V.prototype.log.bind(tA,4),bn=V.prototype.log.bind(tA);var cj;function dj(n,...A){let t=ze(A);cj?cj?.info(n,t):uj(n,t)}function ze(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function LA(n){return n.connectionId*4294967296+n.mediaId}function qj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function K(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 l=n._malloc(t*e.BYTES_PER_ELEMENT);if(l===0||l%e.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${t} \${A} array\`);let d=l/e.BYTES_PER_ELEMENT;return e.subarray(d,d+t)}function S(n,A){n._free(A.byteOffset)}function fj(n,A){return{values:K(n,"f32",2+A*5),length:A}}function Cj(n,A){S(n,A.values)}function Gj(n){return{values:K(n,"f32",4)}}function pj(n,A){S(n,A.values)}function Ij(n){let A=n.length,t=0,e=0;for(;e<A;){let l=n.charCodeAt(e++);if((l&4294967168)===0){t++;continue}else if((l&4294965248)===0)t+=2;else{if(l>=55296&&l<=56319&&e<A){let d=n.charCodeAt(e);(d&64512)===56320&&(++e,l=((l&1023)<<10)+(d&1023)+65536)}(l&4294901760)===0?t+=3:t+=4}}return t}function Xe(n,A,t){let e=n.length,l=t,d=0;for(;d<e;){let q=n.charCodeAt(d++);if((q&4294967168)===0){A[l++]=q;continue}else if((q&4294965248)===0)A[l++]=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[l++]=q>>12&15|224,A[l++]=q>>6&63|128):(A[l++]=q>>18&7|240,A[l++]=q>>12&63|128,A[l++]=q>>6&63|128)}A[l++]=q&63|128}}var Ze=new TextEncoder,Ye=50;function An(n,A,t){Ze.encodeInto(n,A.subarray(t))}function hj(n,A,t){n.length>Ye?An(n,A,t):Xe(n,A,t)}var rn=4096;function ZA(n,A,t){let e=A,l=e+t,d=[],q="";for(;e<l;){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,KA=n[e++]&63,O=(p&7)<<18|F<<12|x<<6|KA;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 mj(n,A,t){return t>tn?en(n,A,t):ZA(n,A,t)}var R=class{constructor(A,t){this.type=A,this.data=t}};var g=class n extends Error{constructor(A){super(A);let t=Object.create(n.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:n.name})}};function Ej(n,A,t){let e=t/4294967296,l=t;n.setUint32(A,e),n.setUint32(A+4,l)}function HA(n,A,t){let e=Math.floor(t/4294967296),l=t;n.setUint32(A,e),n.setUint32(A+4,l)}function yA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function $j(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,l=new Uint8Array(8),d=new DataView(l.buffer);return d.setUint32(0,A<<2|t&3),d.setUint32(4,e),l}else{let t=new Uint8Array(12),e=new DataView(t.buffer);return e.setUint32(0,A),HA(e,4,n),t}}function an(n){let A=n.getTime(),t=Math.floor(A/1e3),e=(A-t*1e3)*1e6,l=Math.floor(e/1e9);return{sec:t+l,nsec:e-l*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),l=(t&3)*4294967296+e,d=t>>>2;return{sec:l,nsec:d}}case 12:{let t=yA(A,4),e=A.getUint32(0);return{sec:t,nsec:e}}default:throw new g(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function cn(n){let A=un(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Fj={type:nn,encode:kn,decode:cn};var T=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Fj)}register({type:A,encode:t,decode:e}){if(A>=0)this.encoders[A]=t,this.decoders[A]=e;else{let l=-1-A;this.builtInEncoders[l]=t,this.builtInDecoders[l]=e}}tryToEncode(A,t){for(let e=0;e<this.builtInEncoders.length;e++){let l=this.builtInEncoders[e];if(l!=null){let d=l(A,t);if(d!=null){let q=-1-e;return new R(q,d)}}}for(let e=0;e<this.encoders.length;e++){let l=this.encoders[e];if(l!=null){let d=l(A,t);if(d!=null){let q=e;return new R(q,d)}}}return A instanceof R?A:null}decode(A,t,e){let l=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return l?l(A,t,e):new R(t,A)}};T.defaultCodec=new T;function dn(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function eA(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,fn=2048,_A=class n{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??T.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??qn,this.initialBufferSize=A?.initialBufferSize??fn,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),l=new DataView(t);e.set(this.bytes),this.view=l,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),hj(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=eA(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 l of A)this.doEncode(l,t+1)}countWithoutUndefined(A,t){let e=0;for(let l of t)A[l]!==void 0&&e++;return e}encodeMap(A,t){let e=Object.keys(A);this.sortKeys&&e.sort();let l=this.ignoreUndefined?this.countWithoutUndefined(A,e):e.length;if(l<16)this.writeU8(128+l);else if(l<65536)this.writeU8(222),this.writeU16(l);else if(l<4294967296)this.writeU8(223),this.writeU32(l);else throw new Error(\`Too large map object: \${l}\`);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),l=e.length;if(l>=4294967296)throw new Error(\`Too large extension object: \${l}\`);this.writeU8(201),this.writeU32(l),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),Ej(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),HA(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 YA(n,A){return new _A(A).encodeSharedRef(n)}function DA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var Cn=16,Gn=16,xA=class{constructor(A=Cn,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 l=this.caches[e-1];A:for(let d of l){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],l={bytes:A,str:t};e.length>=this.maxLengthPerKey?e[Math.random()*e.length|0]=l:e.push(l)}decode(A,t,e){let l=this.find(A,t,e);if(l!=null)return this.hit++,l;this.miss++;let d=ZA(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var Ar="array",lA="map_key",gj="map_value",pn=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new g("The type of key must be string or number but "+typeof n)},rr=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=Ar,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=lA,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===Ar){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===lA||A.type===gj){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}},sA=-1,jr=new DataView(new ArrayBuffer(0)),In=new Uint8Array(jr.buffer);try{jr.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 vj=new RangeError("Insufficient data"),hn=new xA,NA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=jr,this.bytes=In,this.headByte=sA,this.stack=new rr,this.entered=!1,this.extensionCodec=A?.extensionCodec??T.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:hn,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=sA,this.stack.reset()}setBuffer(A){let t=eA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===sA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=eA(A),l=new Uint8Array(t.length+e.length);l.set(t),l.set(e,t.length),this.setBuffer(l)}}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:l,pos:d,totalPos:q}=this;throw new RangeError(\`Insufficient data in parsing \${DA(l)} 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,l=-1;for await(let d of A){if(t&&l===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),e&&(l=this.readArraySize(),e=!1,this.complete());try{for(;yield this.doDecodeSync(),--l!==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 l=A-128;if(l!==0){this.pushMapState(l),this.complete();continue A}else t={}}else if(A<160){let l=A-144;if(l!==0){this.pushArrayState(l),this.complete();continue A}else t=[]}else{let l=A-160;t=this.decodeString(l,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 l=this.lookU8();t=this.decodeString(l,1)}else if(A===218){let l=this.lookU16();t=this.decodeString(l,2)}else if(A===219){let l=this.lookU32();t=this.decodeString(l,4)}else if(A===220){let l=this.readU16();if(l!==0){this.pushArrayState(l),this.complete();continue A}else t=[]}else if(A===221){let l=this.readU32();if(l!==0){this.pushArrayState(l),this.complete();continue A}else t=[]}else if(A===222){let l=this.readU16();if(l!==0){this.pushMapState(l),this.complete();continue A}else t={}}else if(A===223){let l=this.readU32();if(l!==0){this.pushMapState(l),this.complete();continue A}else t={}}else if(A===196){let l=this.lookU8();t=this.decodeBinary(l,1)}else if(A===197){let l=this.lookU16();t=this.decodeBinary(l,2)}else if(A===198){let l=this.lookU32();t=this.decodeBinary(l,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 l=this.lookU8();t=this.decodeExtension(l,1)}else if(A===200){let l=this.lookU16();t=this.decodeExtension(l,2)}else if(A===201){let l=this.lookU32();t=this.decodeExtension(l,4)}else throw new g(\`Unrecognized type byte: \${DA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let l=e.top();if(l.type===Ar)if(l.array[l.position]=t,l.position++,l.position===l.size)t=l.array,e.release(l);else continue A;else if(l.type===lA){if(t==="__proto__")throw new g("The key __proto__ is not allowed");l.key=this.mapKeyConverter(t),l.type=gj;continue A}else if(l.map[l.key]=t,l.readCount++,l.readCount===l.size)t=l.map,e.release(l);else{l.key=null,l.type=lA;continue A}}return t}}readHeadByte(){return this.headByte===sA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=sA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new g(\`Unrecognized array type byte: \${DA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new g(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new g(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,t):this.decodeBinary(A,t)}decodeUtf8String(A,t){if(A>this.maxStrLength)throw new g(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw vj;let e=this.pos+t,l;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?l=this.keyDecoder.decode(this.bytes,e,A):l=mj(this.bytes,e,A),this.pos+=t+A,l}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===lA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new g(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw vj;let e=this.pos+t,l=this.bytes.subarray(e,e+A);return this.pos+=t+A,l}decodeExtension(A,t){if(A>this.maxExtLength)throw new g(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let e=this.view.getInt8(this.pos+t),l=this.decodeBinary(A,t+1);return this.extensionCodec.decode(l,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=$j(this.view,this.pos);return this.pos+=8,A}readI64(){let A=yA(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 tr(n,A){return new NA(A).decode(n)}var iA=class n{constructor(A,t,e,l,d){this.mediaIds=A;this.sequenceNumber=t;this.timeStamp=e;this.isEndOfSpurt=l;this.payload=d}static parse(A){let t;try{t=tr(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],l=t[2]>>>0,d=t[3]>>>0,p=(t[4]&1)!==0,F=t[t.length-1];return F instanceof Uint8Array?oj(new n(e,l,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(YA(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var BA=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,w.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=Gj(this.wasm),this.outBuffer=K(this.wasm,"u8",1270),vA(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(){pj(this.wasm,this.information),S(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){dj(\`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(l=>l.id===0);for(let l of this.connections){if(this.monitoring&&l.id!==0)continue;let d=new iA(l.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));M(globalThis,["sendPacket",{connectionId:l.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:EA(this.information),speechProbability:$A(this.information),rmsDBFS:FA(this.information),volume:tj(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=K(this.wasm,"u32",w.MaxNumberOfDecoders),this.information=fj(this.wasm,w.MaxNumberOfDecoders),IA(this.information,[1,1])}close(){Cj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=iA.parse(t);if(e.type==="Failure"){this.stats.numberPacketError++;let l=Array.from(t).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${e.reason}, connection: \${A}, dump: \${l}\`);return}for(let l of e.value.mediaIds){let d=this.medias.get(LA({connectionId:A,mediaId:l}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=K(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,l=[1,1]){let d=LA({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),mA(this.information,A,l),jj(this.information,A,0),Aj(this.information,A,0)}removeMedia(A,t,e){let l=LA({connectionId:t,mediaId:e}),d=this.medias.get(l);if(!(d===void 0||d.index!==A)&&(this.medias.delete(l),Xr(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:l,connectionId:d,mediaId:q}of e.removed)this.removeMedia(l,d,q);for(let{index:l,connectionId:d,mediaId:q,volume:p}of e.added)this.insertMedia(l,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 l=qj(t);A.push({index:e.index,connectionId:l.connectionId,mediaId:l.mediaId,rmsDBFS:hA(this.information,e.index),volume:Zr(this.information,e.index),voicedBlocks:rj(this.information,e.index),silentBlocks:Yr(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:ej(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:zr(this.information),decoders:A}}};var xj=Ce(Hj()),yj=(0,xj.default)(),_j,Dj;globalThis.addEventListener("message",nr);async function nr(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=nr,_j=new sr(e.sampleRate,await yj,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=nr,Dj=new lr(await yj,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}_j?.onMessage(A),Dj?.onMessage(A)}var sr=class extends BA{constructor(t,e,l){super(t,e);this.sampleRate=t;this.inBuffer=K(this.wasm,"f32",t*.02),this.updateHandle=setInterval(()=>this.update(),l),M(globalThis,["captureReady",{}])}close(){super.close(),S(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,l]=t;switch(e){case"captureSetVolume":this.setVolume(l.value);break;case"captureTick":this.tick(l.buffer);break}}setVolume(t){vA(this.information,t)}tick(t){this.inBuffer.set(t,0),this.encode(this.inBuffer)}update(){M(globalThis,["captureUpdate",{active:EA(this.information),rmsDBFs:FA(this.information),speechProbability:$A(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},lr=class extends bA{constructor(t,e,l){super(t);this.workletPort=e;this.id=w.PlaybackPreload,this.outBuffer=K(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),l),M(globalThis,["playbackReady",{}])}close(){super.close(),S(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,l]=t;switch(e){case"playbackSetVolume":this.setVolume(l.index,l.value);break;case"playbackTick":this.tick();break}}setVolume(t,e){t==="global"?IA(this.information,e):mA(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();M(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let t=new Float32Array(this.information.length*2);for(let l=0;l<=this.largestIndex;l++)t[l]=hA(this.information,l);let e=[];for(let[l,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};M(globalThis,["playbackUpdate",{activities:t,jitterStats:e}],[t.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
|
|
3201
|
-
`;var p='"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:()=>
|
|
3200
|
+
\`,new Function(h,f)}function UA(j,r,s,i,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=Br(r),f=!r[0].isVoid,C=r[0],h=r[1],E=[j,G,i,o,Nr,C.fromWireType.bind(C),h?.toWireType.bind(h)],I=2;I<k;++I){var $=r[I];E.push($.toWireType.bind($))}if(!c)for(var I=u?1:2;I<r.length;++I)r[I].destructorFunction!==null&&E.push(r[I].destructorFunction);var J=mt(r,u,f,a)(...E);return gr(j,J)}var Et=(j,r,s,i,o,a)=>{var k=TA(r,s);o=B(i,o),P([],[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 Y(\`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]=()=>{z(\`Cannot construct \${u.name} due to unbound types\`,k)},P([],k,f=>(f.splice(1,0,null),u.registeredClass.constructor_body[r-1]=UA(c,f,null,o,a),[])),[]})},br=j=>{j=j.trim();let r=j.indexOf("(");return r===-1?j:j.slice(0,r)},$t=(j,r,s,i,o,a,k,u,c,f)=>{var C=TA(s,i);r=v(r),r=br(r),a=B(o,a,c),P([],[j],h=>{h=h[0];var E=\`\${h.name}.\${r}\`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),u&&h.registeredClass.pureVirtualFunctions.push(r);function I(){z(\`Cannot call \${E} due to unbound types\`,C)}var $=h.registeredClass.instancePrototype,H=$[r];return H===void 0||H.overloadTable===void 0&&H.className!==h.name&&H.argCount===s-2?(I.argCount=s-2,I.className=h.name,$[r]=I):(Hr($,r,E),$[r].overloadTable[s-2]=I),P([],C,J=>{var y=UA(E,J,h,a,k,c);return $[r].overloadTable===void 0?(y.argCount=s-2,$[r]=y):$[r].overloadTable[s-2]=y,[]}),[]})},Jr=(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\`),qA(j.$$.ptr,j.$$.ptrType.registeredClass,r.registeredClass)),Ft=(j,r,s,i,o,a,k,u,c,f)=>{r=v(r),o=B(i,o),P([],[j],C=>{C=C[0];var h=\`\${C.name}.\${r}\`,E={get(){z(\`Cannot access \${h} due to unbound types\`,[s,k])},enumerable:!0,configurable:!0};return c?E.set=()=>z(\`Cannot access \${h} due to unbound types\`,[s,k]):E.set=I=>G(h+" is a read-only property"),Object.defineProperty(C.registeredClass.instancePrototype,r,E),P([],c?[s,k]:[s],I=>{var $=I[0],H={get(){var y=Jr(this,C,h+" getter");return $.fromWireType(o(a,y))},enumerable:!0};if(c){c=B(u,c);var J=I[1];H.set=function(y){var jA=Jr(this,C,h+" setter"),L=[];c(f,jA,J.toWireType(L,y)),Nr(L)}}return Object.defineProperty(C.registeredClass.instancePrototype,r,H),[]}),[]})},Kr=[],X=[0,1,,1,null,1,!0,1,!1,1],vt=j=>{j>9&&--X[j+1]===0&&(X[j]=void 0,Kr.push(j))},VA={toValue:j=>(j||G(\`Cannot use deleted val. handle = \${j}\`),X[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=Kr.pop()||X.length;return X[r]=j,X[r+1]=1,r}}}},gt={name:"emscripten::val",fromWireType:j=>{var r=VA.toValue(j);return vt(j),r},toWireType:(j,r)=>VA.toHandle(r),readValueFromPointer:fA,destructorFunction:null},Lt=j=>N(j,gt),Ht=(j,r)=>{switch(r){case 4:return function(s){return this.fromWireType(fr[s>>2])};case 8:return function(s){return this.fromWireType(Cr[s>>3])};default:throw new TypeError(\`invalid float width (\${r}): \${j}\`)}},yt=(j,r,s)=>{r=v(r),N(j,{name:r,fromWireType:i=>i,toWireType:(i,o)=>o,readValueFromPointer:Ht(r,s),destructorFunction:null})},_t=(j,r,s,i,o,a,k,u)=>{var c=TA(r,s);j=v(j),j=br(j),o=B(i,o,k),yr(j,function(){z(\`Cannot call \${j} due to unbound types\`,c)},r-1),P([],c,f=>{var C=[f[0],null].concat(f.slice(1));return xr(j,UA(j,C,null,o,a,k),r-1),[]})},xt=(j,r,s,i,o)=>{r=v(r);let a=i===0,k=c=>c;if(a){var u=32-8*s;k=c=>c<<u>>>u,o=k(o)}N(j,{name:r,fromWireType:k,toWireType:(c,f)=>f,readValueFromPointer:Er(r,s,i!==0),destructorFunction:null})},Dt=(j,r,s)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=i[r];function a(k){var u=m[k>>2],c=m[k+4>>2];return new o(U.buffer,c,u)}s=v(s),N(j,{name:s,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Nt=(j,r,s,i)=>{if(!(i>0))return 0;for(var o=s,a=s+i-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},Bt=(j,r,s)=>Nt(j,_,r,s),bt=j=>{for(var r=0,s=0;s<j.length;++s){var i=j.charCodeAt(s);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++s):r+=3}return r},Or=globalThis.TextDecoder&&new TextDecoder,Pr=(j,r,s,i)=>{var o=r+s;if(i)return o;for(;j[r]&&!(r>=o);)++r;return r},wr=(j,r=0,s,i)=>{var o=Pr(j,r,s,i);if(o-r>16&&j.buffer&&Or)return Or.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 f=k-65536;a+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return a},Jt=(j,r,s)=>j?wr(_,j,r,s):"",Kt=(j,r)=>{r=v(r);var s=!0;N(j,{name:r,fromWireType(i){var o=m[i>>2],a=i+4,k;if(s)k=Jt(a,o,!0);else{k="";for(var u=0;u<o;++u)k+=String.fromCharCode(_[a+u])}return b(i),k},toWireType(i,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=SA(4+a+1),c=u+4;if(m[u>>2]=a,k)if(s)Bt(o,c,a+1);else for(var f=0;f<a;++f){var C=o.charCodeAt(f);C>255&&(b(u),G("String has UTF-16 code units that do not fit in 8 bits")),_[c+f]=C}else _.set(o,c);return i!==null&&i.push(b,u),u},readValueFromPointer:fA,destructorFunction(i){b(i)}})},Mr=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ot=(j,r,s)=>{var i=j>>1,o=Pr(Z,i,r/2,s);if(o-i>16&&Mr)return Mr.decode(Z.subarray(i,o));for(var a="",k=i;k<o;++k){var u=Z[k];a+=String.fromCharCode(u)}return a},Pt=(j,r,s)=>{if(s??=2147483647,s<2)return 0;s-=2;for(var i=r,o=s<j.length*2?s/2:j.length,a=0;a<o;++a){var k=j.charCodeAt(a);aA[r>>1]=k,r+=2}return aA[r>>1]=0,r-i},wt=j=>j.length*2,Mt=(j,r,s)=>{for(var i="",o=j>>2,a=0;!(a>=r/4);a++){var k=m[o+a];if(!k&&!s)break;i+=String.fromCodePoint(k)}return i},Tt=(j,r,s)=>{if(s??=2147483647,s<4)return 0;for(var i=r,o=i+s-4,a=0;a<j.length;++a){var k=j.codePointAt(a);if(k>65535&&a++,kA[r>>2]=k,r+=4,r+4>o)break}return kA[r>>2]=0,r-i},Ut=j=>{for(var r=0,s=0;s<j.length;++s){var i=j.codePointAt(s);i>65535&&s++,r+=4}return r},Vt=(j,r,s)=>{s=v(s);var i,o,a;r===2?(i=Ot,o=Pt,a=wt):(i=Mt,o=Tt,a=Ut),N(j,{name:s,fromWireType:k=>{var u=m[k>>2],c=i(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),f=SA(4+c+r);return m[f>>2]=c/r,o(u,f+4,c+r),k!==null&&k.push(b,f),f},readValueFromPointer:fA,destructorFunction(k){b(k)}})},St=(j,r)=>{r=v(r),N(j,{isVoid:!0,name:r,fromWireType:()=>{},toWireType:(s,i)=>{}})},Rt=j=>{OA("OOM")},Wt=j=>{var r=_.length;j>>>=0,Rt(j)},Qt=j=>52,zt=9007199254740992,Xt=-9007199254740992,Zt=j=>j<Xt||j>zt?NaN:Number(j);function Yt(j,r,s,i){return r=Zt(r),70}var Ae=[null,[],[]],re=(j,r)=>{var s=Ae[j];r===0||r===10?((j===1?ir:oA)(wr(s)),s.length=0):s.push(r)},je=(j,r,s,i)=>{for(var o=0,a=0;a<s;a++){var k=m[r>>2],u=m[r+4>>2];r+=8;for(var c=0;c<u;c++)re(j,_[k+c]);o+=u}return m[i>>2]=o,0};if(et(),Ct(),e.noExitRuntime&&(Rj=e.noExitRuntime),e.print&&(ir=e.print),e.printErr&&(oA=e.printErr),e.wasmBinary&&(or=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 Tr,SA,b,te,ee,Ur,Vr;function ne(j){Tr=j.w,SA=e._malloc=j.y,b=e._free=j.z,te=Ur=j.u,ee=Vr=j.x}var se={g:zj,r:Xj,f:Yj,l:At,k:ht,j:Et,d:$t,a:Ft,s:Lt,i:yt,n:_t,c:xt,b:Dt,t:Kt,e:Vt,m:St,o:Wt,q:Qt,p:Yt,h:je};function le(){bj();function j(){e.calledRun=!0,!ar&&(Jj(),kr?.(e),e.onRuntimeInitialized?.(),Kj())}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),j()},1)):j()}var rA;return rA=await Uj(),le(),cr?t=e:t=new Promise((j,r)=>{kr=j,ur=r}),t}})();typeof Lj=="object"&&typeof JA=="object"?(JA.exports=er,JA.exports.default=er):typeof define=="function"&&define.amd&&define([],()=>er)});var w={};qe(w,{AdditionalCaptureBlocks:()=>pe,AdditionalPlaybackBlocks:()=>Ge,ClockJumpCheckInterval:()=>ve,ClockJumpThreshold:()=>ge,ConnectInterval:()=>Je,ConnectTimeout:()=>Ne,DefaultRefreshRate:()=>he,DefaultVideoCodec:()=>Ke,HealthCheckTimeout:()=>Fe,MainConnectionPingInterval:()=>Le,MaxNumberOfDecoders:()=>Ee,MinDBFs:()=>Qr,MinTokenLifetime:()=>Be,MinTokenRefreshInterval:()=>be,PlaybackPreload:()=>Ie,RenderQuantumSize:()=>$e,VadPreload:()=>me,WebRtcAnswerTimeout:()=>xe,WebRtcIceTimeout:()=>ye,WebRtcMaxNegotiationAttempts:()=>De,WebRtcStatsSnapshotInterval:()=>He,WebRtcTimeout:()=>_e});var Ge=3,pe=3,Ie=3,he=250,me=3,Ee=512,$e=128,Qr=-758.596,Fe=1e4,ve=1e3,ge=1e4,Le=3e3,He=1e3,ye=3e3,_e=1e4,xe=1e4,De=3,Ne=5e3,Be=6e4,be=5e3,Je=[0,100,200,200,500],Ke="H264";function M(n,A,t){return n.postMessage(A,t)}function zr(n){return[n.values[0],n.values[1]]}function IA(n,A){n.values[0]=A[0],n.values[1]=A[1]}function hA(n,A){return n.values[2+A*5]}function Xr(n,A,t){n.values[2+A*5]=t}function Zr(n,A){let t=2+A*5+1;return[n.values[t+0],n.values[t+1]]}function mA(n,A,t){let e=2+A*5+1;n.values[e+0]=t[0],n.values[e+1]=t[1]}function Yr(n,A){return n.values[2+A*5+3]}function Aj(n,A,t){n.values[2+A*5+3]=t}function rj(n,A){return n.values[2+A*5+4]}function jj(n,A,t){n.values[2+A*5+4]=t}function EA(n){return n.values[0]!==0}function $A(n){return n.values[1]}function FA(n){return n.values[2]}function tj(n){return n.values[3]}function vA(n,A){return n.values[3]=A}function ej(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 oj(n){return{type:"Success",value:n}}function x(n){return{type:"Failure",reason:n}}var{Deno:nj}=globalThis,Pe=typeof nj?.noColor=="boolean"?nj.noColor:!1,we=!Pe;function zA(n,A){return{open:\`\\x1B[\${n.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function XA(n,A){return we?\`\${A.open}\${n.replace(A.regexp,A.open)}\${A.close}\`:n}function QA(n){return XA(n,zA([0],0))}function sj(n){return XA(n,zA([1],22))}function Me(n){return XA(n,zA([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,gA=(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))(gA||{}),aj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Ue={4:Me,3:QA,2:QA,1:sj,0:sj};function Ve({message:n}){return String(n)}function lj(n){return JSON.stringify({timestamp:n.date.toISOString(),level:gA[n.level],message:n.message,extra:n.extra})}function ij(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,D]=A(p,60);return\`\${F.toString().padStart(4,"0")}:\${D.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 l=aj[n.level],d=n.logger.name!==void 0?\`@\${n.logger.name}\`:"";return\`\${QA(t())}\${d} \${l} \${Ue[n.level](String(n.message))}\${e()}\`}function Se(n){let A=\`[\${n.date.toISOString()}]\`,t=\`[\${gA[n.level]}]\`,e=n.logger.name!==void 0?\`[\${n.logger.name}] \`:"",l=aj[n.level];return\`\${A} \${l} \${t.padEnd(7," ")} \${e}\${n.message}\`}function Re(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var kj=class{static sparse=Ve;static json=lj;static pretty=ij;static structured=Se;static default=Re()?ij:lj;constructor(){}};var We=class{formatter;consoleObject;filter;constructor(n=kj.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 V=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)},tA=globalThis[Symbol.for("odin-global-logger")]??=new V(3,void 0,[new We]),Qe=V.prototype.log.bind(tA,1),ze=V.prototype.log.bind(tA,2),uj=V.prototype.log.bind(tA,3),Xe=V.prototype.log.bind(tA,4),Kn=V.prototype.log.bind(tA);var cj;function dj(n,...A){let t=Ze(A);cj?cj?.info(n,t):uj(n,t)}function Ze(...n){if(n.length===1&&typeof n[0]=="object"&&n[0]!==null)return{...n[0]};if(n.length>0)return{args:n}}function LA(n){return n.connectionId*4294967296+n.mediaId}function qj(n){return{mediaId:n%4294967296,connectionId:Math.floor(n/4294967296)}}function K(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 l=n._malloc(t*e.BYTES_PER_ELEMENT);if(l===0||l%e.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${t} \${A} array\`);let d=l/e.BYTES_PER_ELEMENT;return e.subarray(d,d+t)}function S(n,A){n._free(A.byteOffset)}function fj(n,A){return{values:K(n,"f32",2+A*5),length:A}}function Cj(n,A){S(n,A.values)}function Gj(n){return{values:K(n,"f32",4)}}function pj(n,A){S(n,A.values)}function Ij(n){let A=n.length,t=0,e=0;for(;e<A;){let l=n.charCodeAt(e++);if((l&4294967168)===0){t++;continue}else if((l&4294965248)===0)t+=2;else{if(l>=55296&&l<=56319&&e<A){let d=n.charCodeAt(e);(d&64512)===56320&&(++e,l=((l&1023)<<10)+(d&1023)+65536)}(l&4294901760)===0?t+=3:t+=4}}return t}function Ye(n,A,t){let e=n.length,l=t,d=0;for(;d<e;){let q=n.charCodeAt(d++);if((q&4294967168)===0){A[l++]=q;continue}else if((q&4294965248)===0)A[l++]=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[l++]=q>>12&15|224,A[l++]=q>>6&63|128):(A[l++]=q>>18&7|240,A[l++]=q>>12&63|128,A[l++]=q>>6&63|128)}A[l++]=q&63|128}}var An=new TextEncoder,rn=50;function jn(n,A,t){An.encodeInto(n,A.subarray(t))}function hj(n,A,t){n.length>rn?jn(n,A,t):Ye(n,A,t)}var tn=4096;function ZA(n,A,t){let e=A,l=e+t,d=[],q="";for(;e<l;){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,D=n[e++]&63;d.push((p&31)<<12|F<<6|D)}else if((p&248)===240){let F=n[e++]&63,D=n[e++]&63,KA=n[e++]&63,O=(p&7)<<18|F<<12|D<<6|KA;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 mj(n,A,t){return t>nn?sn(n,A,t):ZA(n,A,t)}var R=class{constructor(A,t){this.type=A,this.data=t}};var g=class n extends Error{constructor(A){super(A);let t=Object.create(n.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:n.name})}};function Ej(n,A,t){let e=t/4294967296,l=t;n.setUint32(A,e),n.setUint32(A+4,l)}function HA(n,A,t){let e=Math.floor(t/4294967296),l=t;n.setUint32(A,e),n.setUint32(A+4,l)}function yA(n,A){let t=n.getInt32(A),e=n.getUint32(A+4);return t*4294967296+e}function $j(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,l=new Uint8Array(8),d=new DataView(l.buffer);return d.setUint32(0,A<<2|t&3),d.setUint32(4,e),l}else{let t=new Uint8Array(12),e=new DataView(t.buffer);return e.setUint32(0,A),HA(e,4,n),t}}function un(n){let A=n.getTime(),t=Math.floor(A/1e3),e=(A-t*1e3)*1e6,l=Math.floor(e/1e9);return{sec:t+l,nsec:e-l*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),l=(t&3)*4294967296+e,d=t>>>2;return{sec:l,nsec:d}}case 12:{let t=yA(A,4),e=A.getUint32(0);return{sec:t,nsec:e}}default:throw new g(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${n.length}\`)}}function qn(n){let A=dn(n);return new Date(A.sec*1e3+A.nsec/1e6)}var Fj={type:ln,encode:cn,decode:qn};var T=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Fj)}register({type:A,encode:t,decode:e}){if(A>=0)this.encoders[A]=t,this.decoders[A]=e;else{let l=-1-A;this.builtInEncoders[l]=t,this.builtInDecoders[l]=e}}tryToEncode(A,t){for(let e=0;e<this.builtInEncoders.length;e++){let l=this.builtInEncoders[e];if(l!=null){let d=l(A,t);if(d!=null){let q=-1-e;return new R(q,d)}}}for(let e=0;e<this.encoders.length;e++){let l=this.encoders[e];if(l!=null){let d=l(A,t);if(d!=null){let q=e;return new R(q,d)}}}return A instanceof R?A:null}decode(A,t,e){let l=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return l?l(A,t,e):new R(t,A)}};T.defaultCodec=new T;function fn(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function eA(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):fn(n)?new Uint8Array(n):Uint8Array.from(n)}var Cn=100,Gn=2048,_A=class n{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??T.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??Cn,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),l=new DataView(t);e.set(this.bytes),this.view=l,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),hj(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=eA(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 l of A)this.doEncode(l,t+1)}countWithoutUndefined(A,t){let e=0;for(let l of t)A[l]!==void 0&&e++;return e}encodeMap(A,t){let e=Object.keys(A);this.sortKeys&&e.sort();let l=this.ignoreUndefined?this.countWithoutUndefined(A,e):e.length;if(l<16)this.writeU8(128+l);else if(l<65536)this.writeU8(222),this.writeU16(l);else if(l<4294967296)this.writeU8(223),this.writeU32(l);else throw new Error(\`Too large map object: \${l}\`);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),l=e.length;if(l>=4294967296)throw new Error(\`Too large extension object: \${l}\`);this.writeU8(201),this.writeU32(l),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),Ej(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),HA(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 YA(n,A){return new _A(A).encodeSharedRef(n)}function xA(n){return\`\${n<0?"-":""}0x\${Math.abs(n).toString(16).padStart(2,"0")}\`}var pn=16,In=16,DA=class{constructor(A=pn,t=In){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 l=this.caches[e-1];A:for(let d of l){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],l={bytes:A,str:t};e.length>=this.maxLengthPerKey?e[Math.random()*e.length|0]=l:e.push(l)}decode(A,t,e){let l=this.find(A,t,e);if(l!=null)return this.hit++,l;this.miss++;let d=ZA(A,t,e),q=Uint8Array.prototype.slice.call(A,t,t+e);return this.store(q,d),d}};var Ar="array",lA="map_key",gj="map_value",hn=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new g("The type of key must be string or number but "+typeof n)},rr=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=Ar,t.position=0,t.size=A,t.array=new Array(A)}pushMapState(A){let t=this.getUninitializedStateFromPool();t.type=lA,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===Ar){let e=A;e.size=0,e.array=void 0,e.position=0,e.type=void 0}if(A.type===lA||A.type===gj){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}},sA=-1,jr=new DataView(new ArrayBuffer(0)),mn=new Uint8Array(jr.buffer);try{jr.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 vj=new RangeError("Insufficient data"),En=new DA,NA=class n{constructor(A){this.totalPos=0,this.pos=0,this.view=jr,this.bytes=mn,this.headByte=sA,this.stack=new rr,this.entered=!1,this.extensionCodec=A?.extensionCodec??T.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??hn}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=sA,this.stack.reset()}setBuffer(A){let t=eA(A);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===sA&&!this.hasRemaining(1))this.setBuffer(A);else{let t=this.bytes.subarray(this.pos),e=eA(A),l=new Uint8Array(t.length+e.length);l.set(t),l.set(e,t.length),this.setBuffer(l)}}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:l,pos:d,totalPos:q}=this;throw new RangeError(\`Insufficient data in parsing \${xA(l)} 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,l=-1;for await(let d of A){if(t&&l===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),e&&(l=this.readArraySize(),e=!1,this.complete());try{for(;yield this.doDecodeSync(),--l!==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 l=A-128;if(l!==0){this.pushMapState(l),this.complete();continue A}else t={}}else if(A<160){let l=A-144;if(l!==0){this.pushArrayState(l),this.complete();continue A}else t=[]}else{let l=A-160;t=this.decodeString(l,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 l=this.lookU8();t=this.decodeString(l,1)}else if(A===218){let l=this.lookU16();t=this.decodeString(l,2)}else if(A===219){let l=this.lookU32();t=this.decodeString(l,4)}else if(A===220){let l=this.readU16();if(l!==0){this.pushArrayState(l),this.complete();continue A}else t=[]}else if(A===221){let l=this.readU32();if(l!==0){this.pushArrayState(l),this.complete();continue A}else t=[]}else if(A===222){let l=this.readU16();if(l!==0){this.pushMapState(l),this.complete();continue A}else t={}}else if(A===223){let l=this.readU32();if(l!==0){this.pushMapState(l),this.complete();continue A}else t={}}else if(A===196){let l=this.lookU8();t=this.decodeBinary(l,1)}else if(A===197){let l=this.lookU16();t=this.decodeBinary(l,2)}else if(A===198){let l=this.lookU32();t=this.decodeBinary(l,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 l=this.lookU8();t=this.decodeExtension(l,1)}else if(A===200){let l=this.lookU16();t=this.decodeExtension(l,2)}else if(A===201){let l=this.lookU32();t=this.decodeExtension(l,4)}else throw new g(\`Unrecognized type byte: \${xA(A)}\`);this.complete();let e=this.stack;for(;e.length>0;){let l=e.top();if(l.type===Ar)if(l.array[l.position]=t,l.position++,l.position===l.size)t=l.array,e.release(l);else continue A;else if(l.type===lA){if(t==="__proto__")throw new g("The key __proto__ is not allowed");l.key=this.mapKeyConverter(t),l.type=gj;continue A}else if(l.map[l.key]=t,l.readCount++,l.readCount===l.size)t=l.map,e.release(l);else{l.key=null,l.type=lA;continue A}}return t}}readHeadByte(){return this.headByte===sA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=sA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new g(\`Unrecognized array type byte: \${xA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new g(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new g(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,t):this.decodeBinary(A,t)}decodeUtf8String(A,t){if(A>this.maxStrLength)throw new g(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+t+A)throw vj;let e=this.pos+t,l;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?l=this.keyDecoder.decode(this.bytes,e,A):l=mj(this.bytes,e,A),this.pos+=t+A,l}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===lA:!1}decodeBinary(A,t){if(A>this.maxBinLength)throw new g(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+t))throw vj;let e=this.pos+t,l=this.bytes.subarray(e,e+A);return this.pos+=t+A,l}decodeExtension(A,t){if(A>this.maxExtLength)throw new g(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let e=this.view.getInt8(this.pos+t),l=this.decodeBinary(A,t+1);return this.extensionCodec.decode(l,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=$j(this.view,this.pos);return this.pos+=8,A}readI64(){let A=yA(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 tr(n,A){return new NA(A).decode(n)}var iA=class n{constructor(A,t,e,l,d){this.mediaIds=A;this.sequenceNumber=t;this.timeStamp=e;this.isEndOfSpurt=l;this.payload=d}static parse(A){let t;try{t=tr(A)}catch{return x("not valid msgpack")}if(!Array.isArray(t))return x("container must be an array");if(t.length<6)return x("missing fields");if(t[0]!==1)return x("unknown type");if(!Array.isArray(t[1]))return x("media ids must be an array");if(!t[1].every(D=>typeof D=="number"))return x("media ids must be numbers");if(typeof t[2]!="number")return x("sequence number must be a number");if(typeof t[3]!="number")return x("timestamp must be a number");if(typeof t[4]!="number")return x("flags must be a number");let e=t[1],l=t[2]>>>0,d=t[3]>>>0,p=(t[4]&1)!==0,F=t[t.length-1];return F instanceof Uint8Array?oj(new n(e,l,d,p,F)):x("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(YA(t,{forceFloat32:!0,ignoreUndefined:!0}))}};var BA=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,w.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=Gj(this.wasm),this.outBuffer=K(this.wasm,"u8",1270),vA(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(){pj(this.wasm,this.information),S(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){dj(\`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(l=>l.id===0);for(let l of this.connections){if(this.monitoring&&l.id!==0)continue;let d=new iA(l.mediaIds,this.sequenceNumber,this.timestamp,e,this.outBuffer.subarray(0,t));M(globalThis,["sendPacket",{connectionId:l.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:EA(this.information),speechProbability:$A(this.information),rmsDBFS:FA(this.information),volume:tj(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=K(this.wasm,"u32",w.MaxNumberOfDecoders),this.information=fj(this.wasm,w.MaxNumberOfDecoders),IA(this.information,[1,1])}close(){Cj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,t){this.stats.numberPackets++;let e=iA.parse(t);if(e.type==="Failure"){this.stats.numberPacketError++;let l=Array.from(t).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${e.reason}, connection: \${A}, dump: \${l}\`);return}for(let l of e.value.mediaIds){let d=this.medias.get(LA({connectionId:A,mediaId:l}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=t;let q=K(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,l=[1,1]){let d=LA({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),mA(this.information,A,l),jj(this.information,A,0),Aj(this.information,A,0)}removeMedia(A,t,e){let l=LA({connectionId:t,mediaId:e}),d=this.medias.get(l);if(!(d===void 0||d.index!==A)&&(this.medias.delete(l),Xr(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:l,connectionId:d,mediaId:q}of e.removed)this.removeMedia(l,d,q);for(let{index:l,connectionId:d,mediaId:q,volume:p}of e.added)this.insertMedia(l,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 l=qj(t);A.push({index:e.index,connectionId:l.connectionId,mediaId:l.mediaId,rmsDBFS:hA(this.information,e.index),volume:Zr(this.information,e.index),voicedBlocks:rj(this.information,e.index),silentBlocks:Yr(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:ej(e.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:zr(this.information),decoders:A}}};var Dj=Ce(Hj()),yj=(0,Dj.default)(),_j,xj;globalThis.addEventListener("message",nr);async function nr(n){let A=n.data,[t,e]=A;switch(t){case"captureInit":e.workletPort.onmessage=nr,_j=new sr(e.sampleRate,await yj,e.refreshRate);break;case"playbackInit":e.workletPort.onmessage=nr,xj=new lr(await yj,e.workletPort,e.refreshRate);break;case"close":globalThis.close();break}_j?.onMessage(A),xj?.onMessage(A)}var sr=class extends BA{constructor(t,e,l){super(t,e);this.sampleRate=t;this.inBuffer=K(this.wasm,"f32",t*.02),this.updateHandle=setInterval(()=>this.update(),l),M(globalThis,["captureReady",{}])}close(){super.close(),S(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,l]=t;switch(e){case"captureSetVolume":this.setVolume(l.value);break;case"captureTick":this.tick(l.buffer);break}}setVolume(t){vA(this.information,t)}tick(t){this.inBuffer.set(t,0),this.encode(this.inBuffer)}update(){M(globalThis,["captureUpdate",{active:EA(this.information),rmsDBFs:FA(this.information),speechProbability:$A(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},lr=class extends bA{constructor(t,e,l){super(t);this.workletPort=e;this.id=w.PlaybackPreload,this.outBuffer=K(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),l),M(globalThis,["playbackReady",{}])}close(){super.close(),S(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(t){super.onMessage(t);let[e,l]=t;switch(e){case"playbackSetVolume":this.setVolume(l.index,l.value);break;case"playbackTick":this.tick();break}}setVolume(t,e){t==="global"?IA(this.information,e):mA(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();M(this.workletPort,["samples",{id:this.id,buffer:e}],[e.buffer])}}update(){let t=new Float32Array(this.information.length*2);for(let l=0;l<=this.largestIndex;l++)t[l]=hA(this.information,l);let e=[];for(let[l,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};M(globalThis,["playbackUpdate",{activities:t,jitterStats:e}],[t.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
|
|
3201
|
+
`;var p='"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:()=>E,AdditionalPlaybackBlocks:()=>R,ClockJumpCheckInterval:()=>_,ClockJumpThreshold:()=>N,ConnectInterval:()=>Q,ConnectTimeout:()=>G,DefaultRefreshRate:()=>C,DefaultVideoCodec:()=>Y,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>W,MaxNumberOfDecoders:()=>L,MinDBFs:()=>v,MinTokenLifetime:()=>Z,MinTokenRefreshInterval:()=>q,PlaybackPreload:()=>F,RenderQuantumSize:()=>V,VadPreload:()=>D,WebRtcAnswerTimeout:()=>J,WebRtcIceTimeout:()=>$,WebRtcMaxNegotiationAttempts:()=>z,WebRtcStatsSnapshotInterval:()=>j,WebRtcTimeout:()=>H});var R=3,E=3,F=3,C=250,D=3,L=512,V=128,v=-758.596,O=1e4,_=1e3,N=1e4,W=3e3,j=1e3,$=3e3,H=1e4,J=1e4,z=3,G=5e3,Z=6e4,q=5e3,Q=[0,100,200,200,500],Y="H264";function d(e,t,r){return e.postMessage(t,r)}var K;(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||={})})(K||={});var{Deno:k}=globalThis,X=typeof k?.noColor=="boolean"?k.noColor:!1,ee=!X;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 ee?`${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 te(e){return h(e,m([2],22))}var Se=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"),re=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}"},ne={4:te,3:p,2:p,1:U,0:U};function se({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()-re.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],a=e.logger.name!==void 0?`@${e.logger.name}`:"";return`${p(r())}${a} ${s} ${ne[e.level](String(e.message))}${n()}`}function oe(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 ae(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var w=class{static sparse=se;static json=S;static pretty=I;static structured=oe;static default=ae()?I:S;constructor(){}};var ie=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 o=class{#e;sinks;filter;parent;get name(){return this.#e}constructor(e,t=void 0,r=[],n=void 0){this.#e=t,this.sinks=r,this.filter=e,this.parent=n}log(e,t,r=void 0){let n={date:new Date,level:e,logger:this,message:t,extra:r};this.filter<e||this.insert(n)}insert(e){if(!(this.filter<e.level)){for(let t of this.sinks)t.filter>=e.level&&t.handle(e);this.parent!==void 0&&this.parent.insert(e)}}error=this.log.bind(this,1);warn=this.log.bind(this,2);info=this.log.bind(this,3);debug=this.log.bind(this,4)},l=globalThis[Symbol.for("odin-global-logger")]??=new o(3,void 0,[new ie]),ce=o.prototype.log.bind(l,1),ue=o.prototype.log.bind(l,2),le=o.prototype.log.bind(l,3),fe=o.prototype.log.bind(l,4),Ie=o.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 a=this.state.fill(0,r[0][0]);return this.state.offset===this.state.length&&(this.state.flush(),this.state.fill(a,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 a=this.state.fill(0,n[0][0],n[0][1]);return a<u.RenderQuantumSize&&(this.totalBlocks+=1,this.state.next(),this.state.hasVoice?this.voiceBlocks+=1:this.silenceBlocks+=1,this.state.fill(a,n[0][0],n[0][1])),this.alive}dump(){return{type:"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 ex=new L.Strand;function fx(r,F,x,D,A=e.DefaultRefreshRate){return ex.enqueue(async()=>{let[B,j]=await G(h,p,r,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return console.warn("SharedArrayBuffer is not available; creating ODIN CaptureWorker in fallback mode"),i.create(r,F,x,A,B,j,D)})}async function bx(r,F=e.DefaultRefreshRate){if(r.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,D]=await G(h,p,r,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return o.create(r,F,x,D)}var i=class r extends l{constructor(x,D,A,B,j){super(x,D,A,B,j);this._Activity=c;this._SpeechProbability=0;D.addEventListener("message",this._OnMessages.bind(this))}static async create(x,D,A,B,j,t,y){let{port1:I,port2:m}=new MessageChannel;return v(j,["captureInit",{sampleRate:x.sampleRate,refreshRate:B,workletPort:I}],[I]),await u(j,"captureReady"),v(t.port,["init",{workerPort:m}],[m]),new r(t,j,D,A,y)}get activity(){return this._Activity}get speechProbability(){return this._SpeechProbability}setVolume(x){v(this.worker,["captureSetVolume",{value:x}])}_OnMessages(x){super._OnMessages(x);let[D,A]=x.data;D==="captureUpdate"&&(this._Activity={isSilent:!A.active,rmsDBFS:A.rmsDBFs},this._SpeechProbability=A.speechProbability)}},o=class r extends s{constructor(x,D,A){super(x,D,A);this.activities=new Float32Array;this.jitterStats=[]}static async create(x,D,A,B){let{port1:j,port2:t}=new MessageChannel;return v(A,["playbackInit",{workletPort:j,refreshRate:D}],[j]),await u(A,"playbackReady"),v(B.port,["init",{workerPort:t}],[t]),new r(x,B,A)}getActivity(x){let D=this.medias.get(E(x));if(D===void 0)return;let A=this.activities.at(D.index);if(A!==void 0)return A===0?c:{isSilent:!1,rmsDBFS:A}}getJitterStats(x){let D=this.medias.get(E(x));if(D===void 0)return;let A=this.jitterStats.at(D.index);if(A!==void 0)return A}setGlobalVolume(x){v(this.worker,["playbackSetVolume",{index:"global",value:x}])}setVolume(x,D){let A=this.medias.get(E(x));A!==void 0&&v(this.worker,["playbackSetVolume",{index:A.index,value:D}])}_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[D,A]=x.data;D==="playbackUpdate"&&(this.activities=A.activities,this.jitterStats=A.jitterStats)}};0&&(module.exports={UnsharedCaptureWorker,UnsharedPlaybackWorker,createCaptureWorker,createPlaybackWorker});
|