@4players/odin-plugin-web 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var I=Object.defineProperty;var g=(r,D)=>{for(var x in D)I(r,x,{get:D[x],enumerable:!0})};import{Strand as jx}from"@4players/odin-common";var C={};g(C,{AdditionalCaptureBlocks:()=>H,AdditionalPlaybackBlocks:()=>y,ClockJumpCheckInterval:()=>w,ClockJumpThreshold:()=>U,ConnectInterval:()=>X,ConnectTimeout:()=>W,DefaultRefreshRate:()=>N,DefaultVideoCodec:()=>Z,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>K,MaxNumberOfDecoders:()=>P,MinDBFs:()=>n,MinTokenLifetime:()=>Q,MinTokenRefreshInterval:()=>z,PlaybackPreload:()=>L,RenderQuantumSize:()=>J,VadPreload:()=>_,WebRtcAnswerTimeout:()=>V,WebRtcIceTimeout:()=>T,WebRtcMaxNegotiationAttempts:()=>R,WebRtcStatsSnapshotInterval:()=>M,WebRtcTimeout:()=>S});var y=3,H=3,L=3,N=250,_=3,P=512,J=128,n=-758.596,O=1e4,w=1e3,U=1e4,K=3e3,M=1e3,T=3e3,S=1e4,V=1e4,R=3,W=5e3,Q=6e4,z=5e3,X=[0,100,200,200,500],Z="H264";function v(r,D,x){return r.postMessage(D,x)}function i(r,D){return new Promise(x=>{let F=A=>{let[B,j]=A.data;B===D&&(x(A.data[1]),r.removeEventListener("message",F))};r.addEventListener("message",F)})}import{error as Y,warn as ax,info as kx,debug as ux,Logger as dx,LogLevel as qx,CallbackSink as px,Formatter as hx}from"@4players/odin-common";var m;function o(r,...D){let x=xx(D);m?m?.error(r,x):Y(r,x)}function xx(...r){if(r.length===1&&typeof r[0]=="object"&&r[0]!==null)return{...r[0]};if(r.length>0)return{args:r}}var a={isSilent:!0,rmsDBFS:-758.596};function E(r){return r.connectionId*4294967296+r.mediaId}var f=[],e=[],b=class{constructor(D,x,F){this.audioContext=D;this.worklet=x;this.worker=F;this.availableIndexes=[];this.medias=new Map;F.addEventListener("message",this._OnMessages.bind(this))}connectOutput(D){this.worklet.disconnect(),this.worklet.connect(D)}receivePacket(D,x){v(this.worker,["playbackReceivePacket",{connectionId:D,packet:x}],[x.buffer])}addMedias(D,x,F=[1,1]){let A=[];for(let B of x){let j=this._GetFreeIndex();j!==void 0&&(this.medias.set(E({connectionId:D,mediaId:B}),{index:j}),A.push({connectionId:D,mediaId:B,index:j,volume:F}))}v(this.worker,["playbackUpdateMedias",{added:A,removed:[]}])}removeMedias(D,x){let F=[];for(let A of x){let B=E({connectionId:D,mediaId:A}),j=this.medias.get(B);j!==void 0&&(this.medias.delete(B),this.availableIndexes.push(j.index),F.push({connectionId:D,mediaId:A,index:j.index}))}v(this.worker,["playbackUpdateMedias",{added:[],removed:F}])}close(){v(this.worker,["close",void 0]),v(this.worklet.port,["close",void 0]);let D=f.indexOf(this.worker);D>=0&&f.splice(D,1);let x=e.indexOf(this.worklet);x>=0&&e.splice(x,1)}async dump(){return{playbackWorker:await l(this.worker),playbackWorklet:await l(this.worklet.port)}}_GetFreeIndex(){return this.availableIndexes.pop()}_OnMessages(D){}},s=class r{constructor(D,x,F,A,B){this.worklet=D;this.worker=x;this.sink=(j,t)=>{B.deref()!==void 0?F(j,t):(o("capture worker was left abandoned, aborting capture worker"),r.shutdown(D,x))},this.monitorSink=(j,t)=>{B.deref()!==void 0?A(j,t):(o("capture worker was left abandoned, aborting capture worker"),r.shutdown(D,x))},x.addEventListener("message",this._OnMessages.bind(this))}get context(){return this.worklet.context}setMedias(D){v(this.worker,["captureSetMedias",{connections:D}])}setVad(D){v(this.worker,["captureSetVad",D])}close(){r.shutdown(this.worklet,this.worker)}static shutdown(D,x){v(D.port,["close",void 0]),v(x,["close",void 0]);let F=f.indexOf(x);F>=0&&f.splice(F,1);let A=e.indexOf(D);A>=0&&e.splice(A,1)}async dump(){return{captureWorker:await l(this.worker),captureWorklet:await l(this.worklet.port)}}_OnMessages(D){let[x,F]=D.data;x==="sendPacket"&&(F.connectionId===0?this.monitorSink(F.connectionId,F.packet):this.sink(F.connectionId,F.packet))}};function u(r,D,x,F,A){return Promise.all([Ax(r),Fx(x,D,F,A)])}async function Ax(r){let D=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),x=new Worker(D,{type:"module",name:"odin worker"});return f.push(x),x}var k=new WeakMap;async function Fx(r,D,x,F){try{let j=new AudioWorkletNode(r,x,F);return e.push(j),j}catch{}let A=k.get(r);if(A===void 0){let j=URL.createObjectURL(new Blob([D],{type:"text/javascript"}));A=r.audioWorklet.addModule(j),k.set(r,A),A.catch(()=>k.delete(r))}await A;let B=new AudioWorkletNode(r,x,F);return e.push(B),B}function l(r){let{port1:D,port2:x}=new MessageChannel,{promise:F,resolve:A}=Promise.withResolvers();return x.onmessage=B=>A(B.data),setTimeout(()=>A("timeout"),100),v(r,["dump",{result:D}],[D]),F}var d=`"use strict";(()=>{var ne=Object.create;var QA=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var ae=(e,A)=>()=>{try{return A||e((A={exports:{}}).exports,A),A.exports}catch(r){throw A=0,r}},ke=(e,A)=>{for(var r in A)QA(e,r,{get:A[r],enumerable:!0})},ue=(e,A,r,n)=>{if(A&&typeof A=="object"||typeof A=="function")for(let l of le(A))!oe.call(e,l)&&l!==r&&QA(e,l,{get:()=>A[l],enumerable:!(n=se(A,l))||n.enumerable});return e};var ce=(e,A,r)=>(r=e!=null?ne(ie(e)):{},ue(A||!e||!e.__esModule?QA(r,"default",{value:e,enumerable:!0}):r,e));var Fj=ae(($j,OA)=>{"use strict";var nr=(()=>{var e=globalThis.document?.currentScript?.src;return async function(A={}){var r=A,n=!!globalThis.window,l=!!globalThis.WorkerGlobalScope,d=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",q=[],p="./this.program";l&&(e=self.location.href);var I="",N,UA;if(n||l){try{I=new URL(".",e).href}catch{}l&&(UA=t=>{var j=new XMLHttpRequest;return j.open("GET",t,!1),j.responseType="arraybuffer",j.send(null),new Uint8Array(j.response)}),N=async t=>{var j=await fetch(t,{credentials:"same-origin"});if(j.ok)return j.arrayBuffer();throw new Error(j.status+" : "+j.url)}}var x=console.log.bind(console),aA=console.error.bind(console),yj,or=!1;class Hj{}class En extends Hj{}function Lj(t){for(var j=0,s=t.length,i=new Uint8Array(s),o;j<s;++j)o=t.charCodeAt(j),i[j]=~o>>8&o;return i}var gj=!1;function Nj(){var t=Or.buffer;S=new Int8Array(t),uA=new Int16Array(t),r.HEAPU8=L=new Uint8Array(t),Y=new Uint16Array(t),r.HEAP32=cA=new Int32Array(t),r.HEAPU32=h=new Uint32Array(t),r.HEAPF32=ur=new Float32Array(t),cr=new Float64Array(t),kr=new BigInt64Array(t),dr=new BigUint64Array(t)}function Bj(){var t=r.preRun;t&&(typeof t=="function"&&(t=[t]),fr.push(...t)),qr(fr)}function xj(){gj=!0,jA.v()}function bj(){var t=r.postRun;t&&(typeof t=="function"&&(t=[t]),Cr.push(...t)),qr(Cr)}function kA(t){r.onAbort?.(t),t=\`Aborted(\${t})\`,aA(t),or=!0,t+=". Build with -sASSERTIONS for more info.";var j=new WebAssembly.RuntimeError(t);throw j}var ar;function Jj(){return Lj(\`\\0asm\\0\\0\\0\\x8E9\\\`\\x7F\\x7F\\\`\\x7F\\0\\\`\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\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\\\`
1
+ var I=Object.defineProperty;var g=(r,D)=>{for(var x in D)I(r,x,{get:D[x],enumerable:!0})};import{Strand as Bx}from"@4players/odin-common";var C={};g(C,{AdditionalCaptureBlocks:()=>H,AdditionalPlaybackBlocks:()=>y,ClockJumpCheckInterval:()=>w,ClockJumpThreshold:()=>U,ConnectInterval:()=>X,ConnectTimeout:()=>W,DefaultRefreshRate:()=>N,DefaultVideoCodec:()=>Y,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>K,MaxNumberOfDecoders:()=>P,MaxReconnectDuration:()=>Z,MinDBFs:()=>n,MinTokenLifetime:()=>Q,MinTokenRefreshInterval:()=>z,PlaybackPreload:()=>L,RenderQuantumSize:()=>J,VadPreload:()=>_,WebRtcAnswerTimeout:()=>V,WebRtcIceTimeout:()=>T,WebRtcMaxNegotiationAttempts:()=>R,WebRtcStatsSnapshotInterval:()=>M,WebRtcTimeout:()=>S});var y=3,H=3,L=3,N=250,_=3,P=512,J=128,n=-758.596,O=1e4,w=1e3,U=1e4,K=3e3,M=1e3,T=3e3,S=1e4,V=1e4,R=3,W=5e3,Q=6e4,z=5e3,X=[0,100,200,200,500],Z=12e4,Y="H264";function v(r,D,x){return r.postMessage(D,x)}function i(r,D){return new Promise(x=>{let F=A=>{let[B,j]=A.data;B===D&&(x(A.data[1]),r.removeEventListener("message",F))};r.addEventListener("message",F)})}import{error as xx,warn as kx,info as ux,debug as dx,Logger as cx,LogLevel as Gx,CallbackSink as hx,Formatter as mx}from"@4players/odin-common";var m;function o(r,...D){let x=Ax(D);m?m?.error(r,x):xx(r,x)}function Ax(...r){if(r.length===1&&typeof r[0]=="object"&&r[0]!==null)return{...r[0]};if(r.length>0)return{args:r}}var a={isSilent:!0,rmsDBFS:-758.596};function E(r){return r.connectionId*4294967296+r.mediaId}var f=[],e=[],b=class{constructor(D,x,F){this.audioContext=D;this.worklet=x;this.worker=F;this.availableIndexes=[];this.medias=new Map;F.addEventListener("message",this._OnMessages.bind(this))}connectOutput(D){this.worklet.disconnect(),this.worklet.connect(D)}receivePacket(D,x){v(this.worker,["playbackReceivePacket",{connectionId:D,packet:x}],[x.buffer])}addMedias(D,x,F=[1,1]){let A=[];for(let B of x){let j=this._GetFreeIndex();j!==void 0&&(this.medias.set(E({connectionId:D,mediaId:B}),{index:j}),A.push({connectionId:D,mediaId:B,index:j,volume:F}))}v(this.worker,["playbackUpdateMedias",{added:A,removed:[]}])}removeMedias(D,x){let F=[];for(let A of x){let B=E({connectionId:D,mediaId:A}),j=this.medias.get(B);j!==void 0&&(this.medias.delete(B),this.availableIndexes.push(j.index),F.push({connectionId:D,mediaId:A,index:j.index}))}v(this.worker,["playbackUpdateMedias",{added:[],removed:F}])}close(){v(this.worker,["close",void 0]),v(this.worklet.port,["close",void 0]);let D=f.indexOf(this.worker);D>=0&&f.splice(D,1);let x=e.indexOf(this.worklet);x>=0&&e.splice(x,1)}async dump(){return{playbackWorker:await l(this.worker),playbackWorklet:await l(this.worklet.port)}}_GetFreeIndex(){return this.availableIndexes.pop()}_OnMessages(D){}},s=class r{constructor(D,x,F,A,B){this.worklet=D;this.worker=x;this.sink=(j,t)=>{B.deref()!==void 0?F(j,t):(o("capture worker was left abandoned, aborting capture worker"),r.shutdown(D,x))},this.monitorSink=(j,t)=>{B.deref()!==void 0?A(j,t):(o("capture worker was left abandoned, aborting capture worker"),r.shutdown(D,x))},x.addEventListener("message",this._OnMessages.bind(this))}get context(){return this.worklet.context}setMedias(D){v(this.worker,["captureSetMedias",{connections:D}])}setVad(D){v(this.worker,["captureSetVad",D])}close(){r.shutdown(this.worklet,this.worker)}static shutdown(D,x){v(D.port,["close",void 0]),v(x,["close",void 0]);let F=f.indexOf(x);F>=0&&f.splice(F,1);let A=e.indexOf(D);A>=0&&e.splice(A,1)}async dump(){return{captureWorker:await l(this.worker),captureWorklet:await l(this.worklet.port)}}_OnMessages(D){let[x,F]=D.data;x==="sendPacket"&&(F.connectionId===0?this.monitorSink(F.connectionId,F.packet):this.sink(F.connectionId,F.packet))}};function u(r,D,x,F,A){return Promise.all([Fx(r),Dx(x,D,F,A)])}async function Fx(r){let D=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),x=new Worker(D,{type:"module",name:"odin worker"});return f.push(x),x}var k=new WeakMap;async function Dx(r,D,x,F){try{let j=new AudioWorkletNode(r,x,F);return e.push(j),j}catch{}let A=k.get(r);if(A===void 0){let j=URL.createObjectURL(new Blob([D],{type:"text/javascript"}));A=r.audioWorklet.addModule(j),k.set(r,A),A.catch(()=>k.delete(r))}await A;let B=new AudioWorkletNode(r,x,F);return e.push(B),B}function l(r){let{port1:D,port2:x}=new MessageChannel,{promise:F,resolve:A}=Promise.withResolvers();return x.onmessage=B=>A(B.data),setTimeout(()=>A("timeout"),100),v(r,["dump",{result:D}],[D]),F}var d=`"use strict";(()=>{var ne=Object.create;var QA=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var ae=(e,A)=>()=>{try{return A||e((A={exports:{}}).exports,A),A.exports}catch(r){throw A=0,r}},ke=(e,A)=>{for(var r in A)QA(e,r,{get:A[r],enumerable:!0})},ue=(e,A,r,n)=>{if(A&&typeof A=="object"||typeof A=="function")for(let l of le(A))!oe.call(e,l)&&l!==r&&QA(e,l,{get:()=>A[l],enumerable:!(n=se(A,l))||n.enumerable});return e};var ce=(e,A,r)=>(r=e!=null?ne(ie(e)):{},ue(A||!e||!e.__esModule?QA(r,"default",{value:e,enumerable:!0}):r,e));var Fj=ae(($j,OA)=>{"use strict";var nr=(()=>{var e=globalThis.document?.currentScript?.src;return async function(A={}){var r=A,n=!!globalThis.window,l=!!globalThis.WorkerGlobalScope,d=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",q=[],p="./this.program";l&&(e=self.location.href);var I="",N,UA;if(n||l){try{I=new URL(".",e).href}catch{}l&&(UA=t=>{var j=new XMLHttpRequest;return j.open("GET",t,!1),j.responseType="arraybuffer",j.send(null),new Uint8Array(j.response)}),N=async t=>{var j=await fetch(t,{credentials:"same-origin"});if(j.ok)return j.arrayBuffer();throw new Error(j.status+" : "+j.url)}}var x=console.log.bind(console),aA=console.error.bind(console),yj,or=!1;class Hj{}class mn extends Hj{}function Lj(t){for(var j=0,s=t.length,i=new Uint8Array(s),o;j<s;++j)o=t.charCodeAt(j),i[j]=~o>>8&o;return i}var gj=!1;function Nj(){var t=Or.buffer;S=new Int8Array(t),uA=new Int16Array(t),r.HEAPU8=L=new Uint8Array(t),Y=new Uint16Array(t),r.HEAP32=cA=new Int32Array(t),r.HEAPU32=h=new Uint32Array(t),r.HEAPF32=ur=new Float32Array(t),cr=new Float64Array(t),kr=new BigInt64Array(t),dr=new BigUint64Array(t)}function Bj(){var t=r.preRun;t&&(typeof t=="function"&&(t=[t]),fr.push(...t)),qr(fr)}function xj(){gj=!0,jA.v()}function bj(){var t=r.postRun;t&&(typeof t=="function"&&(t=[t]),Cr.push(...t)),qr(Cr)}function kA(t){r.onAbort?.(t),t=\`Aborted(\${t})\`,aA(t),or=!0,t+=". Build with -sASSERTIONS for more info.";var j=new WebAssembly.RuntimeError(t);throw j}var ar;function Jj(){return Lj(\`\\0asm\\0\\0\\0\\x8E9\\\`\\x7F\\x7F\\\`\\x7F\\0\\\`\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\0\\\`\\x7F\\x7F\\x7F\\x7F\\x7F\\0\\\`\\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\\\`\\x07\\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\\0ag\\0!ah\\0 ai\\0aj\\0\\bak\\0"al\\0am\\0an\\0ao\\0\\0ap\\0#aq\\0\\0ar\\0
3
3
  as\\0at\\0\\xBA\\xB8\\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
@@ -3198,7 +3198,7 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
3198
3198
 
3199
3199
  
3200
3200
  \\x07\\0\\0 \\v\\0\\0 \\v\\0\\0\\v\\0\\0\\0\\0\\0A\\xD1\\x9E\\v!\\0\\0\\0\\0\\0\\0\\0\\0\\0\\v\\r\\0\\r\\0\\0\\0 \\0\\0\\0 \\0\\0\\0\\0A\\x8B\\x9F\\v\\f\\0A\\x97\\x9F\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\f\\0\\0\\0\\0\\0\\f\\0\\0\\f\\0A\\xC5\\x9F\\v\\0A\\xD1\\x9F\\v\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0A\\xFF\\x9F\\v\\0A\\x8B\\xA0\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0A\\xC2\\xA0\\v\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0A\\xF3\\xA0\\v\\0A\\xFF\\xA0\\v\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0A\\xAD\\xA1\\v\\0A\\xB9\\xA1\\v\\xB3 \\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0\\0\\0\\0\\x000123456789ABCDEF\\x90\\0\\xE8\\0NSt3__214__shared_countE\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\xE0\\0\\0\\0\\0\\0NSt3__219__shared_weak_countE\\0\\0\\0\\xB8\\0H\\0X\\0N10__cxxabiv116__shim_type_infoE\\0\\0\\0\\0\\xB8\\0x\\0<\\0N10__cxxabiv117__class_type_infoE\\0\\0\\0\\xB8\\0\\xA8\\0<\\0N10__cxxabiv117__pbase_type_infoE\\0\\0\\0\\xB8\\0\\xD8\\0\\x9C\\0N10__cxxabiv119__pointer_type_infoE\\0\\xB8\\0\\b\\0<\\0N10__cxxabiv120__function_type_infoE\\0\\0\\0\\0\\xB8\\0<\\0\\x9C\\0N10__cxxabiv129__pointer_to_member_type_infoE\\0\\0\\0\\0\\0\\0\\0\\x88\\0_\\0\\0\\0\\\`\\0\\0\\0a\\0\\0\\0b\\0\\0\\0c\\0\\0\\0\\xB8\\0\\x94\\0<\\0N10__cxxabiv123__fundamental_type_infoE\\0t\\0\\xC4\\0v\\0Dn\\0\\0\\0\\0t\\0\\xD4\\0b\\0\\0\\0t\\0\\xE0\\0c\\0\\0\\0t\\0\\xEC\\0h\\0\\0\\0t\\0\\xF8\\0a\\0\\0\\0t\\0\\0s\\0\\0\\0t\\0\\0t\\0\\0\\0t\\0\\0i\\0\\0\\0t\\0(\\0j\\0\\0\\0t\\x004\\0l\\0\\0\\0t\\0@\\0m\\0\\0\\0t\\0L\\0x\\0\\0\\0t\\0X\\0y\\0\\0\\0t\\0d\\0f\\0\\0\\0p\\0x\\0\\0\\0\\0\\0\\\\\\0Pf\\0\\0t\\0\\x84\\0d\\0\\0\\0\\0\\0\\0\\0l\\0_\\0\\0\\0d\\0\\0\\0a\\0\\0\\0b\\0\\0\\0e\\0\\0\\0f\\0\\0\\0g\\0\\0\\0h\\0\\0\\0\\0\\0\\0\\0\\xD8\\0_\\0\\0\\0i\\0\\0\\0a\\0\\0\\0b\\0\\0\\0e\\0\\0\\0j\\0\\0\\0k\\0\\0\\0l\\0\\0\\0\\xB8\\0\\xE4\\0l\\0N10__cxxabiv120__si_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\x004\\0_\\0\\0\\0m\\0\\0\\0a\\0\\0\\0b\\0\\0\\0e\\0\\0\\0n\\0\\0\\0o\\0\\0\\0p\\0\\0\\0\\xB8\\0@\\0l\\0N10__cxxabiv121__vmi_class_type_infoE\\0\\0\\0\\0\\0\\0\\0\\xCC\\0_\\0\\0\\0q\\0\\0\\0a\\0\\0\\0b\\0\\0\\0r\\0\\0\\0\\0\\0\\0\\0\\xCC\\0E\\0\\0\\0s\\0\\0\\0t\\0\\0\\0\\x90\\0\\xA0\\0St9exception\\0\\0\\0\\0\\xB8\\0\\xBC\\0\\x98\\0St9bad_alloc\\0\\0\\0\\0\\xB8\\0\\xD8\\0\\xB0\\0St20bad_array_new_length\\0\\0\\0\\0\\0\\0\\0\\0\\b\\0G\\0\\0\\0u\\0\\0\\0v\\0\\0\\0\\xB8\\0\\0\\x98\\0St11logic_error\\0\\0\\0\\0\\x008\\0G\\0\\0\\0w\\0\\0\\0v\\0\\0\\0\\xB8\\0D\\0\\b\\0St12length_error\\0\\0\\0\\0\\x90\\0\\\`\\0St9type_info\\0A\\xF0\\xAA\\v\\0A\\xFC\\xAA\\vW\\0A\\x94\\xAB\\v\\vX\\0\\0\\0Y\\0\\0\\0\\xD8\\0A\\xAC\\xAB\\v\\0A\\xBC\\xAB\\v\\b\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\0A\\x80\\xAC\\v p\\0\\0\\0\\0\\0\\0A\\x94\\xAC\\vZ\\0A\\xAC\\xAC\\vX\\0\\0\\0[\\0\\0\\0\\xE8\\0\\0\\0A\\xC4\\xAC\\v\\0A\\xD4\\xAC\\v\\xFF\\xFF\\xFF\\xFF
3201
- \\0A\\x98\\xAD\\v\\v\\b\\0\\b\\x1B\\0 \`)}function mn(t){return t}async function Pj(t){return t}async function Oj(t,j){try{var s=await Pj(t),i=await WebAssembly.instantiate(s,j);return i}catch(o){aA(\`failed to asynchronously prepare wasm: \${o}\`),kA(o)}}async function Uj(t,j,s){return Oj(j,s)}function wj(){var t={a:je};return t}async function Tj(){function t(a){return jA=a.exports,re(jA),Nj(),jA}function j(a){return t(a.instance)}var s=wj(),i=r.instantiateWasm;if(i)return new Promise(a=>{i(s,u=>a(t(u)))});ar??=Jj();var o=await Uj(yj,ar,s),k=j(o);return k}class hn{name="ExitStatus";constructor(j){this.message=\`Program terminated with exit(\${j})\`,this.status=j}}var uA,cA,kr,S,ur,cr,Y,h,dr,L,qr=t=>{for(;t.length>0;)t.shift()(r)},Cr=[],fr=[],Kj=!0;class Sj{constructor(j){this.excPtr=j,this.ptr=j-24}set_type(j){h[this.ptr+4>>2]=j}get_type(){return h[this.ptr+4>>2]}set_destructor(j){h[this.ptr+8>>2]=j}get_destructor(){return h[this.ptr+8>>2]}set_caught(j){j=j?1:0,S[this.ptr+12]=j}get_caught(){return S[this.ptr+12]!=0}set_rethrown(j){j=j?1:0,S[this.ptr+13]=j}get_rethrown(){return S[this.ptr+13]!=0}init(j,s){this.set_adjusted_ptr(0),this.set_type(j),this.set_destructor(s)}set_adjusted_ptr(j){h[this.ptr+16>>2]=j}get_adjusted_ptr(){return h[this.ptr+16>>2]}}var Mj=0,Vj=(t,j,s)=>{var i=new Sj(t);i.init(j,s),Mj++,kA()},Rj=()=>kA(""),v=t=>{for(var j="";;){var s=L[t++];if(!s)return j;j+=String.fromCharCode(s)}},Q={},z={},dA={},AA=class extends Error{constructor(j){super(j),this.name="BindingError"}},G=t=>{throw new AA(t)};function Wj(t,j,s={}){var i=j.name;if(t||G(\`type "\${i}" must have a positive integer typeid pointer\`),z.hasOwnProperty(t)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${i}' twice\`)}if(z[t]=j,delete dA[t],Q.hasOwnProperty(t)){var o=Q[t];delete Q[t],o.forEach(k=>k())}}function B(t,j,s={}){return Wj(t,j,s)}var Gr=(t,j,s)=>{switch(j){case 1:return s?i=>S[i]:i=>L[i];case 2:return s?i=>uA[i>>1]:i=>Y[i>>1];case 4:return s?i=>cA[i>>2]:i=>h[i>>2];case 8:return s?i=>kr[i>>3]:i=>dr[i>>3];default:throw new TypeError(\`invalid integer width (\${j}): \${t}\`)}},Qj=(t,j,s,i,o)=>{j=v(j);let k=i===0n,a=u=>u;if(k){let u=s*8;a=c=>BigInt.asUintN(u,c),o=a(o)}B(t,{name:j,fromWireType:a,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Gr(j,s,!k),destructorFunction:null})},zj=(t,j,s,i)=>{j=v(j),B(t,{name:j,fromWireType:function(o){return!!o},toWireType:function(o,k){return k?s:i},readValueFromPointer:function(o){return this.fromWireType(L[o])},destructorFunction:null})},Xj=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),wA=t=>{function j(s){return s.$$.ptrType.registeredClass.name}G(j(t)+" instance already deleted")},TA=!1,pr=t=>{},Zj=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Er=t=>{t.count.value-=1;var j=t.count.value===0;j&&Zj(t)},rA=t=>globalThis.FinalizationRegistry?(TA=new FinalizationRegistry(j=>{Er(j.$$)}),rA=j=>{var s=j.$$,i=!!s.smartPtr;if(i){var o={$$:s};TA.register(j,o,j)}return j},pr=j=>TA.unregister(j),rA(t)):(rA=j=>j,t),qA=[],Yj=()=>{for(;qA.length;){var t=qA.pop();t.$$.deleteScheduled=!1,t.delete()}},mr,At=()=>{let t=CA.prototype;Object.assign(t,{isAliasOf(s){if(!(this instanceof CA)||!(s instanceof CA))return!1;var i=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var k=s.$$.ptrType.registeredClass,a=s.$$.ptr;i.baseClass;)o=i.upcast(o),i=i.baseClass;for(;k.baseClass;)a=k.upcast(a),k=k.baseClass;return i===k&&o===a},clone(){if(this.$$.ptr||wA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=rA(Object.create(Object.getPrototypeOf(this),{$$:{value:Xj(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||wA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),pr(this),Er(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||wA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),qA.push(this),qA.length===1&&mr&&mr(Yj),this.$$.deleteScheduled=!0,this}});let j=Symbol.dispose;j&&(t[j]=t.delete)};function CA(){}var hr=(t,j)=>Object.defineProperty(j,"name",{value:t}),$r={},Fr=(t,j,s)=>{if(t[j].overloadTable===void 0){var i=t[j];t[j]=function(...o){return t[j].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${t[j].overloadTable})!\`),t[j].overloadTable[o.length].apply(this,o)},t[j].overloadTable=[],t[j].overloadTable[i.argCount]=i}},Ir=(t,j,s)=>{r.hasOwnProperty(t)?((s===void 0||r[t].overloadTable!==void 0&&r[t].overloadTable[s]!==void 0)&&G(\`Cannot register public name '\${t}' twice\`),Fr(r,t,t),r[t].overloadTable.hasOwnProperty(s)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),r[t].overloadTable[s]=j):(r[t]=j,r[t].argCount=s)},rt=48,jt=57,tt=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var j=t.charCodeAt(0);return j>=rt&&j<=jt?\`_\${t}\`:t};function et(t,j,s,i,o,k,a,u){this.name=t,this.constructor=j,this.instancePrototype=s,this.rawDestructor=i,this.baseClass=o,this.getActualType=k,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}var fA=(t,j,s)=>{for(;j!==s;)j.upcast||G(\`Expected null or instance of \${s.name}, got an instance of \${j.name}\`),t=j.upcast(t),j=j.baseClass;return t},KA=t=>{if(t===null)return"null";var j=typeof t;return j==="object"||j==="array"||j==="function"?t.toString():""+t};function nt(t,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${KA(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=j.$$.ptrType.registeredClass,i=fA(j.$$.ptr,s,this.registeredClass);return i}function st(t,j){var s;if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,s),s):0;(!j||!j.$$)&&G(\`Cannot pass "\${KA(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);var i=j.$$.ptrType.registeredClass;if(s=fA(j.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(j.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:j.$$.smartPtrType===this?s=j.$$.smartPtr:G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=j.$$.smartPtr;break;case 2:if(j.$$.smartPtrType===this)s=j.$$.smartPtr;else{var o=j.clone();s=this.rawShare(s,VA.toHandle(()=>o.delete())),t!==null&&t.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function lt(t,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${KA(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.ptrType.name} to parameter type \${this.name}\`);var s=j.$$.ptrType.registeredClass,i=fA(j.$$.ptr,s,this.registeredClass);return i}function GA(t){return this.fromWireType(h[t>>2])}var vr=(t,j,s)=>{if(j===s)return t;if(s.baseClass===void 0)return null;var i=vr(t,j,s.baseClass);return i===null?null:s.downcast(i)},it={},ot=(t,j)=>{for(j===void 0&&G("ptr should not be undefined");t.baseClass;)j=t.upcast(j),t=t.baseClass;return j},at=(t,j)=>(j=ot(t,j),it[j]),kt=class extends Error{constructor(j){super(j),this.name="InternalError"}},pA=t=>{throw new kt(t)},EA=(t,j)=>{(!j.ptrType||!j.ptr)&&pA("makeClassHandle requires ptr and ptrType");var s=!!j.smartPtrType,i=!!j.smartPtr;return s!==i&&pA("Both smartPtrType and smartPtr must be specified"),j.count={value:1},rA(Object.create(t,{$$:{value:j,writable:!0}}))};function ut(t){var j=this.getPointee(t);if(!j)return this.destructor(t),null;var s=at(this.registeredClass,j);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=j,s.$$.smartPtr=t,s.clone();var i=s.clone();return this.destructor(t),i}function o(){return this.isSmartPointer?EA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:j,smartPtrType:this,smartPtr:t}):EA(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var k=this.registeredClass.getActualType(j),a=$r[k];if(!a)return o.call(this);var u;this.isConst?u=a.constPointerType:u=a.pointerType;var c=vr(j,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:t}):EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var ct=()=>{Object.assign(mA.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},readValueFromPointer:GA,fromWireType:ut})};function mA(t,j,s,i,o,k,a,u,c,C,f){this.name=t,this.registeredClass=j,this.isReference=s,this.isConst=i,this.isSmartPointer=o,this.pointeeType=k,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=C,this.rawDestructor=f,!o&&j.baseClass===void 0?i?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=lt,this.destructorFunction=null):this.toWireType=st}var Dr=(t,j,s)=>{r.hasOwnProperty(t)||pA("Replacing nonexistent public symbol"),r[t].overloadTable!==void 0&&s!==void 0?r[t].overloadTable[s]=j:(r[t]=j,r[t].argCount=s)},_r=[],dt=t=>{var j=_r[t];return j||(_r[t]=j=Ur.get(t)),j},b=(t,j,s=!1)=>{t=v(t);function i(){var k=dt(j);return k}var o=i();return typeof o!="function"&&G(\`unknown function pointer with signature \${t}: \${j}\`),o};class qt extends Error{}var Ct=t=>{var j=Pr(t),s=v(j);return J(j),s},X=(t,j)=>{var s=[],i={};function o(k){if(!i[k]&&!z[k]){if(dA[k]){dA[k].forEach(o);return}s.push(k),i[k]=!0}}throw j.forEach(o),new qt(\`\${t}: \`+s.map(Ct).join([", "]))},U=(t,j,s)=>{t.forEach(u=>dA[u]=j);function i(u){var c=s(u);c.length!==t.length&&pA("Mismatched type converter count");for(var C=0;C<t.length;++C)B(t[C],c[C])}var o=new Array(j.length),k=[],a=0;for(let[u,c]of j.entries())z.hasOwnProperty(c)?o[u]=z[c]:(k.push(c),Q.hasOwnProperty(c)||(Q[c]=[]),Q[c].push(()=>{o[u]=z[c],++a,a===k.length&&i(o)}));k.length===0&&i(o)},ft=(t,j,s,i,o,k,a,u,c,C,f,m,$)=>{f=v(f),k=b(o,k),u&&=b(a,u),C&&=b(c,C),$=b(m,$);var E=tt(f);Ir(E,function(){X(\`Cannot construct \${f} due to unbound types\`,[i])}),U([t,j,s],i?[i]:[],F=>{F=F[0];var y,P;i?(y=F.registeredClass,P=y.instancePrototype):P=CA.prototype;var H=hr(f,function(...WA){if(Object.getPrototypeOf(this)!==tA)throw new AA(\`Use 'new' to construct \${f}\`);if(_.constructor_body===void 0)throw new AA(\`\${f} has no accessible constructor\`);var Kr=_.constructor_body[WA.length];if(Kr===void 0)throw new AA(\`Tried to invoke ctor of \${f} with invalid number of parameters (\${WA.length}) - expected (\${Object.keys(_.constructor_body).toString()}) parameters instead!\`);return Kr.apply(this,WA)}),tA=Object.create(P,{constructor:{value:H}});H.prototype=tA;var _=new et(f,H,tA,$,y,k,u,C);_.baseClass&&(_.baseClass.__derivedClasses??=[],_.baseClass.__derivedClasses.push(_));var ee=new mA(f,_,!0,!1,!1),wr=new mA(f+"*",_,!1,!1,!1),Tr=new mA(f+" const*",_,!1,!0,!1);return $r[t]={pointerType:wr,constPointerType:Tr},Dr(E,H),[ee,wr,Tr]})},SA=(t,j)=>{for(var s=[],i=0;i<t;i++)s.push(h[j+i*4>>2]);return s},yr=t=>{for(;t.length;){var j=t.pop(),s=t.pop();s(j)}};function Hr(t){for(var j=1;j<t.length;++j)if(t[j]!==null&&t[j].destructorFunction===void 0)return!0;return!1}function Gt(t,j,s,i){var o=Hr(t),k=t.length-2,a=[],u=["fn"];j&&u.push("thisWired");for(var c=0;c<k;++c)a.push(\`arg\${c}\`),u.push(\`arg\${c}Wired\`);a=a.join(),u=u.join();var C=\`return function (\${a}) {
3201
+ \\0A\\x98\\xAD\\v\\v\\b\\0\\b\\x1B\\0 \`)}function hn(t){return t}async function Pj(t){return t}async function Oj(t,j){try{var s=await Pj(t),i=await WebAssembly.instantiate(s,j);return i}catch(o){aA(\`failed to asynchronously prepare wasm: \${o}\`),kA(o)}}async function Uj(t,j,s){return Oj(j,s)}function wj(){var t={a:je};return t}async function Tj(){function t(a){return jA=a.exports,re(jA),Nj(),jA}function j(a){return t(a.instance)}var s=wj(),i=r.instantiateWasm;if(i)return new Promise(a=>{i(s,u=>a(t(u)))});ar??=Jj();var o=await Uj(yj,ar,s),k=j(o);return k}class $n{name="ExitStatus";constructor(j){this.message=\`Program terminated with exit(\${j})\`,this.status=j}}var uA,cA,kr,S,ur,cr,Y,h,dr,L,qr=t=>{for(;t.length>0;)t.shift()(r)},Cr=[],fr=[],Kj=!0;class Sj{constructor(j){this.excPtr=j,this.ptr=j-24}set_type(j){h[this.ptr+4>>2]=j}get_type(){return h[this.ptr+4>>2]}set_destructor(j){h[this.ptr+8>>2]=j}get_destructor(){return h[this.ptr+8>>2]}set_caught(j){j=j?1:0,S[this.ptr+12]=j}get_caught(){return S[this.ptr+12]!=0}set_rethrown(j){j=j?1:0,S[this.ptr+13]=j}get_rethrown(){return S[this.ptr+13]!=0}init(j,s){this.set_adjusted_ptr(0),this.set_type(j),this.set_destructor(s)}set_adjusted_ptr(j){h[this.ptr+16>>2]=j}get_adjusted_ptr(){return h[this.ptr+16>>2]}}var Mj=0,Vj=(t,j,s)=>{var i=new Sj(t);i.init(j,s),Mj++,kA()},Rj=()=>kA(""),v=t=>{for(var j="";;){var s=L[t++];if(!s)return j;j+=String.fromCharCode(s)}},Q={},z={},dA={},AA=class extends Error{constructor(j){super(j),this.name="BindingError"}},G=t=>{throw new AA(t)};function Wj(t,j,s={}){var i=j.name;if(t||G(\`type "\${i}" must have a positive integer typeid pointer\`),z.hasOwnProperty(t)){if(s.ignoreDuplicateRegistrations)return;G(\`Cannot register type '\${i}' twice\`)}if(z[t]=j,delete dA[t],Q.hasOwnProperty(t)){var o=Q[t];delete Q[t],o.forEach(k=>k())}}function B(t,j,s={}){return Wj(t,j,s)}var Gr=(t,j,s)=>{switch(j){case 1:return s?i=>S[i]:i=>L[i];case 2:return s?i=>uA[i>>1]:i=>Y[i>>1];case 4:return s?i=>cA[i>>2]:i=>h[i>>2];case 8:return s?i=>kr[i>>3]:i=>dr[i>>3];default:throw new TypeError(\`invalid integer width (\${j}): \${t}\`)}},Qj=(t,j,s,i,o)=>{j=v(j);let k=i===0n,a=u=>u;if(k){let u=s*8;a=c=>BigInt.asUintN(u,c),o=a(o)}B(t,{name:j,fromWireType:a,toWireType:(u,c)=>(typeof c=="number"&&(c=BigInt(c)),c),readValueFromPointer:Gr(j,s,!k),destructorFunction:null})},zj=(t,j,s,i)=>{j=v(j),B(t,{name:j,fromWireType:function(o){return!!o},toWireType:function(o,k){return k?s:i},readValueFromPointer:function(o){return this.fromWireType(L[o])},destructorFunction:null})},Xj=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),wA=t=>{function j(s){return s.$$.ptrType.registeredClass.name}G(j(t)+" instance already deleted")},TA=!1,pr=t=>{},Zj=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Er=t=>{t.count.value-=1;var j=t.count.value===0;j&&Zj(t)},rA=t=>globalThis.FinalizationRegistry?(TA=new FinalizationRegistry(j=>{Er(j.$$)}),rA=j=>{var s=j.$$,i=!!s.smartPtr;if(i){var o={$$:s};TA.register(j,o,j)}return j},pr=j=>TA.unregister(j),rA(t)):(rA=j=>j,t),qA=[],Yj=()=>{for(;qA.length;){var t=qA.pop();t.$$.deleteScheduled=!1,t.delete()}},mr,At=()=>{let t=CA.prototype;Object.assign(t,{isAliasOf(s){if(!(this instanceof CA)||!(s instanceof CA))return!1;var i=this.$$.ptrType.registeredClass,o=this.$$.ptr;s.$$=s.$$;for(var k=s.$$.ptrType.registeredClass,a=s.$$.ptr;i.baseClass;)o=i.upcast(o),i=i.baseClass;for(;k.baseClass;)a=k.upcast(a),k=k.baseClass;return i===k&&o===a},clone(){if(this.$$.ptr||wA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var s=rA(Object.create(Object.getPrototypeOf(this),{$$:{value:Xj(this.$$)}}));return s.$$.count.value+=1,s.$$.deleteScheduled=!1,s},delete(){this.$$.ptr||wA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),pr(this),Er(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||wA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&G("Object already scheduled for deletion"),qA.push(this),qA.length===1&&mr&&mr(Yj),this.$$.deleteScheduled=!0,this}});let j=Symbol.dispose;j&&(t[j]=t.delete)};function CA(){}var hr=(t,j)=>Object.defineProperty(j,"name",{value:t}),$r={},Fr=(t,j,s)=>{if(t[j].overloadTable===void 0){var i=t[j];t[j]=function(...o){return t[j].overloadTable.hasOwnProperty(o.length)||G(\`Function '\${s}' called with an invalid number of arguments (\${o.length}) - expects one of (\${t[j].overloadTable})!\`),t[j].overloadTable[o.length].apply(this,o)},t[j].overloadTable=[],t[j].overloadTable[i.argCount]=i}},Ir=(t,j,s)=>{r.hasOwnProperty(t)?((s===void 0||r[t].overloadTable!==void 0&&r[t].overloadTable[s]!==void 0)&&G(\`Cannot register public name '\${t}' twice\`),Fr(r,t,t),r[t].overloadTable.hasOwnProperty(s)&&G(\`Cannot register multiple overloads of a function with the same number of arguments (\${s})!\`),r[t].overloadTable[s]=j):(r[t]=j,r[t].argCount=s)},rt=48,jt=57,tt=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var j=t.charCodeAt(0);return j>=rt&&j<=jt?\`_\${t}\`:t};function et(t,j,s,i,o,k,a,u){this.name=t,this.constructor=j,this.instancePrototype=s,this.rawDestructor=i,this.baseClass=o,this.getActualType=k,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}var fA=(t,j,s)=>{for(;j!==s;)j.upcast||G(\`Expected null or instance of \${s.name}, got an instance of \${j.name}\`),t=j.upcast(t),j=j.baseClass;return t},KA=t=>{if(t===null)return"null";var j=typeof t;return j==="object"||j==="array"||j==="function"?t.toString():""+t};function nt(t,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${KA(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`);var s=j.$$.ptrType.registeredClass,i=fA(j.$$.ptr,s,this.registeredClass);return i}function st(t,j){var s;if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),this.isSmartPointer?(s=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,s),s):0;(!j||!j.$$)&&G(\`Cannot pass "\${KA(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),!this.isConst&&j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);var i=j.$$.ptrType.registeredClass;if(s=fA(j.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(j.$$.smartPtr===void 0&&G("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:j.$$.smartPtrType===this?s=j.$$.smartPtr:G(\`Cannot convert argument of type \${j.$$.smartPtrType?j.$$.smartPtrType.name:j.$$.ptrType.name} to parameter type \${this.name}\`);break;case 1:s=j.$$.smartPtr;break;case 2:if(j.$$.smartPtrType===this)s=j.$$.smartPtr;else{var o=j.clone();s=this.rawShare(s,VA.toHandle(()=>o.delete())),t!==null&&t.push(this.rawDestructor,s)}break;default:G("Unsupported sharing policy")}return s}function lt(t,j){if(j===null)return this.isReference&&G(\`null is not a valid \${this.name}\`),0;j.$$||G(\`Cannot pass "\${KA(j)}" as a \${this.name}\`),j.$$.ptr||G(\`Cannot pass deleted object as a pointer of type \${this.name}\`),j.$$.ptrType.isConst&&G(\`Cannot convert argument of type \${j.$$.ptrType.name} to parameter type \${this.name}\`);var s=j.$$.ptrType.registeredClass,i=fA(j.$$.ptr,s,this.registeredClass);return i}function GA(t){return this.fromWireType(h[t>>2])}var vr=(t,j,s)=>{if(j===s)return t;if(s.baseClass===void 0)return null;var i=vr(t,j,s.baseClass);return i===null?null:s.downcast(i)},it={},ot=(t,j)=>{for(j===void 0&&G("ptr should not be undefined");t.baseClass;)j=t.upcast(j),t=t.baseClass;return j},at=(t,j)=>(j=ot(t,j),it[j]),kt=class extends Error{constructor(j){super(j),this.name="InternalError"}},pA=t=>{throw new kt(t)},EA=(t,j)=>{(!j.ptrType||!j.ptr)&&pA("makeClassHandle requires ptr and ptrType");var s=!!j.smartPtrType,i=!!j.smartPtr;return s!==i&&pA("Both smartPtrType and smartPtr must be specified"),j.count={value:1},rA(Object.create(t,{$$:{value:j,writable:!0}}))};function ut(t){var j=this.getPointee(t);if(!j)return this.destructor(t),null;var s=at(this.registeredClass,j);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=j,s.$$.smartPtr=t,s.clone();var i=s.clone();return this.destructor(t),i}function o(){return this.isSmartPointer?EA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:j,smartPtrType:this,smartPtr:t}):EA(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var k=this.registeredClass.getActualType(j),a=$r[k];if(!a)return o.call(this);var u;this.isConst?u=a.constPointerType:u=a.pointerType;var c=vr(j,this.registeredClass,u.registeredClass);return c===null?o.call(this):this.isSmartPointer?EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c,smartPtrType:this,smartPtr:t}):EA(u.registeredClass.instancePrototype,{ptrType:u,ptr:c})}var ct=()=>{Object.assign(mA.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},readValueFromPointer:GA,fromWireType:ut})};function mA(t,j,s,i,o,k,a,u,c,C,f){this.name=t,this.registeredClass=j,this.isReference=s,this.isConst=i,this.isSmartPointer=o,this.pointeeType=k,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=c,this.rawShare=C,this.rawDestructor=f,!o&&j.baseClass===void 0?i?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=lt,this.destructorFunction=null):this.toWireType=st}var Dr=(t,j,s)=>{r.hasOwnProperty(t)||pA("Replacing nonexistent public symbol"),r[t].overloadTable!==void 0&&s!==void 0?r[t].overloadTable[s]=j:(r[t]=j,r[t].argCount=s)},_r=[],dt=t=>{var j=_r[t];return j||(_r[t]=j=Ur.get(t)),j},b=(t,j,s=!1)=>{t=v(t);function i(){var k=dt(j);return k}var o=i();return typeof o!="function"&&G(\`unknown function pointer with signature \${t}: \${j}\`),o};class qt extends Error{}var Ct=t=>{var j=Pr(t),s=v(j);return J(j),s},X=(t,j)=>{var s=[],i={};function o(k){if(!i[k]&&!z[k]){if(dA[k]){dA[k].forEach(o);return}s.push(k),i[k]=!0}}throw j.forEach(o),new qt(\`\${t}: \`+s.map(Ct).join([", "]))},U=(t,j,s)=>{t.forEach(u=>dA[u]=j);function i(u){var c=s(u);c.length!==t.length&&pA("Mismatched type converter count");for(var C=0;C<t.length;++C)B(t[C],c[C])}var o=new Array(j.length),k=[],a=0;for(let[u,c]of j.entries())z.hasOwnProperty(c)?o[u]=z[c]:(k.push(c),Q.hasOwnProperty(c)||(Q[c]=[]),Q[c].push(()=>{o[u]=z[c],++a,a===k.length&&i(o)}));k.length===0&&i(o)},ft=(t,j,s,i,o,k,a,u,c,C,f,m,$)=>{f=v(f),k=b(o,k),u&&=b(a,u),C&&=b(c,C),$=b(m,$);var E=tt(f);Ir(E,function(){X(\`Cannot construct \${f} due to unbound types\`,[i])}),U([t,j,s],i?[i]:[],F=>{F=F[0];var y,P;i?(y=F.registeredClass,P=y.instancePrototype):P=CA.prototype;var H=hr(f,function(...WA){if(Object.getPrototypeOf(this)!==tA)throw new AA(\`Use 'new' to construct \${f}\`);if(_.constructor_body===void 0)throw new AA(\`\${f} has no accessible constructor\`);var Kr=_.constructor_body[WA.length];if(Kr===void 0)throw new AA(\`Tried to invoke ctor of \${f} with invalid number of parameters (\${WA.length}) - expected (\${Object.keys(_.constructor_body).toString()}) parameters instead!\`);return Kr.apply(this,WA)}),tA=Object.create(P,{constructor:{value:H}});H.prototype=tA;var _=new et(f,H,tA,$,y,k,u,C);_.baseClass&&(_.baseClass.__derivedClasses??=[],_.baseClass.__derivedClasses.push(_));var ee=new mA(f,_,!0,!1,!1),wr=new mA(f+"*",_,!1,!1,!1),Tr=new mA(f+" const*",_,!1,!0,!1);return $r[t]={pointerType:wr,constPointerType:Tr},Dr(E,H),[ee,wr,Tr]})},SA=(t,j)=>{for(var s=[],i=0;i<t;i++)s.push(h[j+i*4>>2]);return s},yr=t=>{for(;t.length;){var j=t.pop(),s=t.pop();s(j)}};function Hr(t){for(var j=1;j<t.length;++j)if(t[j]!==null&&t[j].destructorFunction===void 0)return!0;return!1}function Gt(t,j,s,i){var o=Hr(t),k=t.length-2,a=[],u=["fn"];j&&u.push("thisWired");for(var c=0;c<k;++c)a.push(\`arg\${c}\`),u.push(\`arg\${c}Wired\`);a=a.join(),u=u.join();var C=\`return function (\${a}) {
3202
3202
  \`;o&&(C+=\`var destructors = [];
3203
3203
  \`);var f=o?"destructors":"null",m=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];j&&(C+=\`var thisWired = toClassParamWire(\${f}, this);
3204
3204
  \`);for(var c=0;c<k;++c){var $=\`toArg\${c}Wire\`;C+=\`var arg\${c}Wired = \${$}(\${f}, arg\${c});
@@ -3208,5 +3208,5 @@ K\\xE08\\xDF\\0}\\xBC\\x8A\\x1B\\f\\xE5\\xFF\\xCF\\xE8?\\x9F\\xFFFq\\0\\x88\\xB
3208
3208
  \`,m.push(\`\${E}_dtor\`))}return s&&(C+=\`var ret = fromRetWire(rv);
3209
3209
  return ret;
3210
3210
  \`),C+=\`}
3211
- \`,new Function(m,C)}function MA(t,j,s,i,o,k){var a=j.length;a<2&&G("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=j[1]!==null&&s!==null,c=Hr(j),C=!j[0].isVoid,f=j[0],m=j[1],$=[t,G,i,o,yr,f.fromWireType.bind(f),m?.toWireType.bind(m)],E=2;E<a;++E){var F=j[E];$.push(F.toWireType.bind(F))}if(!c)for(var E=u?1:2;E<j.length;++E)j[E].destructorFunction!==null&&$.push(j[E].destructorFunction);var P=Gt(j,u,C,k)(...$);return hr(t,P)}var pt=(t,j,s,i,o,k)=>{var a=SA(j,s);o=b(i,o),U([],[t],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[j-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${j-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[j-1]=()=>{X(\`Cannot construct \${u.name} due to unbound types\`,a)},U([],a,C=>(C.splice(1,0,null),u.registeredClass.constructor_body[j-1]=MA(c,C,null,o,k),[])),[]})},Lr=t=>{t=t.trim();let j=t.indexOf("(");return j===-1?t:t.slice(0,j)},Et=(t,j,s,i,o,k,a,u,c,C)=>{var f=SA(s,i);j=v(j),j=Lr(j),k=b(o,k,c),U([],[t],m=>{m=m[0];var $=\`\${m.name}.\${j}\`;j.startsWith("@@")&&(j=Symbol[j.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(j);function E(){X(\`Cannot call \${$} due to unbound types\`,f)}var F=m.registeredClass.instancePrototype,y=F[j];return y===void 0||y.overloadTable===void 0&&y.className!==m.name&&y.argCount===s-2?(E.argCount=s-2,E.className=m.name,F[j]=E):(Fr(F,j,$),F[j].overloadTable[s-2]=E),U([],f,P=>{var H=MA($,P,m,k,a,c);return F[j].overloadTable===void 0?(H.argCount=s-2,F[j]=H):F[j].overloadTable[s-2]=H,[]}),[]})},gr=(t,j,s)=>(t instanceof Object||G(\`\${s} with invalid "this": \${t}\`),t instanceof j.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${t.constructor.name}\`),t.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(t.$$.ptr,t.$$.ptrType.registeredClass,j.registeredClass)),mt=(t,j,s,i,o,k,a,u,c,C)=>{j=v(j),o=b(i,o),U([],[t],f=>{f=f[0];var m=\`\${f.name}.\${j}\`,$={get(){X(\`Cannot access \${m} due to unbound types\`,[s,a])},enumerable:!0,configurable:!0};return c?$.set=()=>X(\`Cannot access \${m} due to unbound types\`,[s,a]):$.set=E=>G(m+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,j,$),U([],c?[s,a]:[s],E=>{var F=E[0],y={get(){var H=gr(this,f,m+" getter");return F.fromWireType(o(k,H))},enumerable:!0};if(c){c=b(u,c);var P=E[1];y.set=function(H){var tA=gr(this,f,m+" setter"),_=[];c(C,tA,P.toWireType(_,H)),yr(_)}}return Object.defineProperty(f.registeredClass.instancePrototype,j,y),[]}),[]})},Nr=[],M=[0,1,,1,null,1,!0,1,!1,1],ht=t=>{if(t>9&&--M[t+1]===0){var j=M[t];M[t]=void 0,Nr.push(t)}},VA={toValue:t=>(t||G(\`Cannot use deleted val. handle = \${t}\`),M[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let j=Nr.pop()||M.length;return M[j]=t,M[j+1]=1,j}}}},$t={name:"emscripten::val",fromWireType:t=>{var j=VA.toValue(t);return ht(t),j},toWireType:(t,j)=>VA.toHandle(j),readValueFromPointer:GA,destructorFunction:null},Ft=t=>B(t,$t),It=(t,j)=>{switch(j){case 4:return function(s){return this.fromWireType(ur[s>>2])};case 8:return function(s){return this.fromWireType(cr[s>>3])};default:throw new TypeError(\`invalid float width (\${j}): \${t}\`)}},vt=(t,j,s)=>{j=v(j),B(t,{name:j,fromWireType:i=>i,toWireType:(i,o)=>o,readValueFromPointer:It(j,s),destructorFunction:null})},Dt=(t,j,s,i,o,k,a,u)=>{var c=SA(j,s);t=v(t),t=Lr(t),o=b(i,o,a),Ir(t,function(){X(\`Cannot call \${t} due to unbound types\`,c)},j-1),U([],c,C=>{var f=[C[0],null].concat(C.slice(1));return Dr(t,MA(t,f,null,o,k,a),j-1),[]})},_t=(t,j,s,i,o)=>{j=v(j);let k=i===0,a=c=>c;if(k){var u=32-8*s;a=c=>c<<u>>>u,o=a(o)}B(t,{name:j,fromWireType:a,toWireType:(c,C)=>C,readValueFromPointer:Gr(j,s,i!==0),destructorFunction:null})},yt=(t,j,s)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=i[j];function k(a){var u=h[a>>2],c=h[a+4>>2];return new o(S.buffer,c,u)}s=v(s),B(t,{name:s,fromWireType:k,readValueFromPointer:k},{ignoreDuplicateRegistrations:!0})},Ht=(t,j,s,i)=>{if(!(i>0))return 0;for(var o=s,k=s+i-1,a=0;a<t.length;++a){var u=t.codePointAt(a);if(u<=127){if(s>=k)break;j[s++]=u}else if(u<=2047){if(s+1>=k)break;j[s++]=192|u>>6,j[s++]=128|u&63}else if(u<=65535){if(s+2>=k)break;j[s++]=224|u>>12,j[s++]=128|u>>6&63,j[s++]=128|u&63}else{if(s+3>=k)break;j[s++]=240|u>>18,j[s++]=128|u>>12&63,j[s++]=128|u>>6&63,j[s++]=128|u&63,a++}}return j[s]=0,s-o},Lt=(t,j,s)=>Ht(t,L,j,s),gt=t=>{for(var j=0,s=0;s<t.length;++s){var i=t.charCodeAt(s);i<=127?j++:i<=2047?j+=2:i>=55296&&i<=57343?(j+=4,++s):j+=3}return j},Br=globalThis.TextDecoder&&new TextDecoder,xr=(t,j,s,i)=>{var o=j+s;if(i)return o;for(;t[j]&&!(j>=o);)++j;return j},br=(t,j=0,s,i)=>{var o=xr(t,j,s,i);if(o-j>16&&t.buffer&&Br)return Br.decode(t.subarray(j,o));for(var k="";j<o;){var a=t[j++];if(!(a&128)){k+=String.fromCharCode(a);continue}var u=t[j++]&63;if((a&224)==192){k+=String.fromCharCode((a&31)<<6|u);continue}var c=t[j++]&63;if((a&240)==224?a=(a&15)<<12|u<<6|c:a=(a&7)<<18|u<<12|c<<6|t[j++]&63,a<65536)k+=String.fromCharCode(a);else{var C=a-65536;k+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return k},Nt=(t,j,s)=>t?br(L,t,j,s):"",Bt=(t,j)=>{j=v(j);var s=!0;B(t,{name:j,fromWireType(i){var o=h[i>>2],k=i+4,a;if(s)a=Nt(k,o,!0);else{a="";for(var u=0;u<o;++u)a+=String.fromCharCode(L[k+u])}return J(i),a},toWireType(i,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var k,a=typeof o=="string";a||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&a?k=gt(o):k=o.length;var u=RA(4+k+1),c=u+4;if(h[u>>2]=k,a)if(s)Lt(o,c,k+1);else for(var C=0;C<k;++C){var f=o.charCodeAt(C);f>255&&(J(u),G("String has UTF-16 code units that do not fit in 8 bits")),L[c+C]=f}else L.set(o,c);return i!==null&&i.push(J,u),u},readValueFromPointer:GA,destructorFunction(i){J(i)}})},Jr=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,xt=(t,j,s)=>{var i=t>>1,o=xr(Y,i,j/2,s);if(o-i>16&&Jr)return Jr.decode(Y.subarray(i,o));for(var k="",a=i;a<o;++a){var u=Y[a];k+=String.fromCharCode(u)}return k},bt=(t,j,s=2147483647)=>{if(s<2)return 0;s-=2;for(var i=j,o=s<t.length*2?s/2:t.length,k=0;k<o;++k){var a=t.charCodeAt(k);uA[j>>1]=a,j+=2}return uA[j>>1]=0,j-i},Jt=t=>t.length*2,Pt=(t,j,s)=>{for(var i="",o=t>>2,k=0;!(k>=j/4);k++){var a=h[o+k];if(!a&&!s)break;i+=String.fromCodePoint(a)}return i},Ot=(t,j,s=2147483647)=>{if(s<4)return 0;for(var i=j,o=i+s-4,k=0;k<t.length;++k){var a=t.codePointAt(k);if(a>65535&&k++,cA[j>>2]=a,j+=4,j+4>o)break}return cA[j>>2]=0,j-i},Ut=t=>{for(var j=0,s=0;s<t.length;++s){var i=t.codePointAt(s);i>65535&&s++,j+=4}return j},wt=(t,j,s)=>{s=v(s);var i,o,k;j===2?(i=xt,o=bt,k=Jt):(i=Pt,o=Ot,k=Ut),B(t,{name:s,fromWireType:a=>{var u=h[a>>2],c=i(a+4,u*j,!0);return J(a),c},toWireType:(a,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var c=k(u),C=RA(4+c+j);return h[C>>2]=c/j,o(u,C+4,c+j),a!==null&&a.push(J,C),C},readValueFromPointer:GA,destructorFunction(a){J(a)}})},Tt=(t,j)=>{j=v(j),B(t,{isVoid:!0,name:j,fromWireType:()=>{},toWireType:(s,i)=>{}})},Kt=t=>{kA("OOM")},St=t=>{var j=L.length;t>>>=0,Kt(t)},Mt=t=>52,Vt=9007199254740992,Rt=-9007199254740992,Wt=t=>t<Rt||t>Vt?NaN:Number(t);function Qt(t,j,s,i){return j=Wt(j),70}var zt=[null,[],[]],Xt=(t,j)=>{var s=zt[t];j===0||j===10?((t===1?x:aA)(br(s)),s.length=0):s.push(j)},Zt=(t,j,s,i)=>{for(var o=0,k=0;k<s;k++){var a=h[j>>2],u=h[j+4>>2];j+=8;for(var c=0;c<u;c++)Xt(t,L[a+c]);o+=u}return h[i>>2]=o,0};At(),ct();{r.noExitRuntime&&(Kj=r.noExitRuntime),r.print&&(x=r.print),r.printErr&&(aA=r.printErr),r.arguments&&(q=r.arguments),r.thisProgram&&(p=r.thisProgram);var Z=r.preInit;if(Z)for(typeof Z=="function"&&(r.preInit=Z=[Z]);Z.length>0;)Z.shift()()}var Pr,RA,J,Yt,Ae,Or,Ur;function re(t){Pr=t.w,RA=r._malloc=t.y,J=r._free=t.z,Yt=Or=t.u,Ae=Ur=t.x}var je={i:Vj,r:Rj,g:Qj,l:zj,k:ft,j:pt,d:Et,a:mt,s:Ft,f:vt,n:Dt,c:_t,b:yt,t:Bt,e:wt,m:Tt,o:St,q:Mt,p:Qt,h:Zt};async function te(){Bj();var t=r.setStatus;t&&(t("Running..."),await new Promise(j=>setTimeout(j,1)),setTimeout(t,1,"")),!or&&(xj(),r.onRuntimeInitialized?.(),bj())}var jA;return jA=await Tj(),await te(),r}})();typeof $j=="object"&&typeof OA=="object"?(OA.exports=nr,OA.exports.default=nr):typeof define=="function"&&define.amd&&define([],()=>nr)});var w={};ke(w,{AdditionalCaptureBlocks:()=>qe,AdditionalPlaybackBlocks:()=>de,ClockJumpCheckInterval:()=>he,ClockJumpThreshold:()=>$e,ConnectInterval:()=>Ne,ConnectTimeout:()=>He,DefaultRefreshRate:()=>fe,DefaultVideoCodec:()=>Be,HealthCheckTimeout:()=>me,MainConnectionPingInterval:()=>Fe,MaxNumberOfDecoders:()=>pe,MinDBFs:()=>Sr,MinTokenLifetime:()=>Le,MinTokenRefreshInterval:()=>ge,PlaybackPreload:()=>Ce,RenderQuantumSize:()=>Ee,VadPreload:()=>Ge,WebRtcAnswerTimeout:()=>_e,WebRtcIceTimeout:()=>ve,WebRtcMaxNegotiationAttempts:()=>ye,WebRtcStatsSnapshotInterval:()=>Ie,WebRtcTimeout:()=>De});var de=3,qe=3,Ce=3,fe=250,Ge=3,pe=512,Ee=128,Sr=-758.596,me=1e4,he=1e3,$e=1e4,Fe=3e3,Ie=1e3,ve=3e3,De=1e4,_e=1e4,ye=3,He=5e3,Le=6e4,ge=5e3,Ne=[0,100,200,200,500],Be="H264";function T(e,A,r){return e.postMessage(A,r)}function Mr(e){return[e.values[0],e.values[1]]}function hA(e,A){e.values[0]=A[0],e.values[1]=A[1]}function $A(e,A){return e.values[2+A*5]}function Vr(e,A,r){e.values[2+A*5]=r}function Rr(e,A){let r=2+A*5+1;return[e.values[r+0],e.values[r+1]]}function FA(e,A,r){let n=2+A*5+1;e.values[n+0]=r[0],e.values[n+1]=r[1]}function Wr(e,A){return e.values[2+A*5+3]}function Qr(e,A,r){e.values[2+A*5+3]=r}function zr(e,A){return e.values[2+A*5+4]}function Xr(e,A,r){e.values[2+A*5+4]=r}function IA(e){return e.values[0]!==0}function vA(e){return e.values[1]}function DA(e){return e.values[2]}function Zr(e){return e.values[3]}function _A(e,A){return e.values[3]=A}function Yr(e){return e?Array.from(e).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var xe;(e=>{let A;(r=>(r[r.InvalidPassword=-1]="InvalidPassword",r[r.Unknown=0]="Unknown",r[r.Unencrypted=1]="Unencrypted",r[r.Encrypted=2]="Encrypted"))(A=e.PeerCipherStatus||={})})(xe||={});function ej(e){return{type:"Success",value:e}}function g(e){return{type:"Failure",reason:e}}var{Deno:Aj}=globalThis,be=typeof Aj?.noColor=="boolean"?Aj.noColor:!1,Je=!be;function XA(e,A){return{open:\`\\x1B[\${e.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(e,A){return Je?\`\${A.open}\${e.replace(A.regexp,A.open)}\${A.close}\`:e}function zA(e){return ZA(e,XA([0],0))}function rj(e){return ZA(e,XA([1],22))}function Pe(e){return ZA(e,XA([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"),Oe=new Date,yA=(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))(yA||{}),nj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},Ue={4:Pe,3:zA,2:zA,1:rj,0:rj};function we({message:e}){return String(e)}function jj(e){return JSON.stringify({timestamp:e.date.toISOString(),level:yA[e.level],message:e.message,extra:e.extra})}function tj(e){function A(q,p){return[Math.floor(q/p),q%p]}function r(){let q,p=e.date.valueOf()-Oe.valueOf();[p,q]=A(p,1e3);let[I,N]=A(p,60);return\`\${I.toString().padStart(4,"0")}:\${N.toString().padStart(2,"0")}.\${q.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 l=nj[e.level],d=e.logger.name!==void 0?\`@\${e.logger.name}\`:"";return\`\${zA(r())}\${d} \${l} \${Ue[e.level](String(e.message))}\${n()}\`}function Te(e){let A=\`[\${e.date.toISOString()}]\`,r=\`[\${yA[e.level]}]\`,n=e.logger.name!==void 0?\`[\${e.logger.name}] \`:"",l=nj[e.level];return\`\${A} \${l} \${r.padEnd(7," ")} \${n}\${e.message}\`}function Ke(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var sj=class{static sparse=we;static json=jj;static pretty=tj;static structured=Te;static default=Ke()?tj:jj;constructor(){}};var Se=class{formatter;consoleObject;filter;constructor(e=sj.default,A=4,r=console){this.filter=A,this.formatter=e,this.consoleObject=r}handle(e){let A=this.formatter(e);switch(e.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(e,A=void 0,r=[],n=void 0){this.#A=A,this.sinks=r,this.filter=e,this.parent=n}log(e,A,r=void 0){let n={date:new Date,level:e,logger:this,message:A,extra:r};this.filter<e||this.insert(n)}insert(e){if(!(this.filter<e.level)){for(let A of this.sinks)A.filter>=e.level&&A.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)},eA=globalThis[Symbol.for("odin-global-logger")]??=new V(3,void 0,[new Se]),Me=V.prototype.log.bind(eA,1),Ve=V.prototype.log.bind(eA,2),lj=V.prototype.log.bind(eA,3),Re=V.prototype.log.bind(eA,4),xn=V.prototype.log.bind(eA);var ij;function oj(e,...A){let r=We(A);ij?ij?.info(e,r):lj(e,r)}function We(...e){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null)return{...e[0]};if(e.length>0)return{args:e}}function HA(e){return e.connectionId*4294967296+e.mediaId}function aj(e){return{mediaId:e%4294967296,connectionId:Math.floor(e/4294967296)}}function O(e,A,r){let n;switch(A){case"f32":n=e.HEAPF32;break;case"u32":n=e.HEAPU32;break;case"i32":n=e.HEAP32;break;case"u8":n=e.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let l=e._malloc(r*n.BYTES_PER_ELEMENT);if(l===0||l%n.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${r} \${A} array\`);let d=l/n.BYTES_PER_ELEMENT;return n.subarray(d,d+r)}function R(e,A){e._free(A.byteOffset)}function kj(e,A){return{values:O(e,"f32",2+A*5),length:A}}function uj(e,A){R(e,A.values)}function cj(e){return{values:O(e,"f32",4)}}function dj(e,A){R(e,A.values)}function qj(e){let A=e.length,r=0,n=0;for(;n<A;){let l=e.charCodeAt(n++);if((l&4294967168)===0){r++;continue}else if((l&4294965248)===0)r+=2;else{if(l>=55296&&l<=56319&&n<A){let d=e.charCodeAt(n);(d&64512)===56320&&(++n,l=((l&1023)<<10)+(d&1023)+65536)}(l&4294901760)===0?r+=3:r+=4}}return r}function Qe(e,A,r){let n=e.length,l=r,d=0;for(;d<n;){let q=e.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<n){let p=e.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,Xe=50;function Ze(e,A,r){ze.encodeInto(e,A.subarray(r))}function Cj(e,A,r){e.length>Xe?Ze(e,A,r):Qe(e,A,r)}var Ye=4096;function YA(e,A,r){let n=A,l=n+r,d=[],q="";for(;n<l;){let p=e[n++];if((p&128)===0)d.push(p);else if((p&224)===192){let I=e[n++]&63;d.push((p&31)<<6|I)}else if((p&240)===224){let I=e[n++]&63,N=e[n++]&63;d.push((p&31)<<12|I<<6|N)}else if((p&248)===240){let I=e[n++]&63,N=e[n++]&63,UA=e[n++]&63,x=(p&7)<<18|I<<12|N<<6|UA;x>65535&&(x-=65536,d.push(x>>>10&1023|55296),x=56320|x&1023),d.push(x)}else d.push(p);d.length>=Ye&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var An=new TextDecoder,rn=200;function jn(e,A,r){let n=e.subarray(A,A+r);return An.decode(n)}function fj(e,A,r){return r>rn?jn(e,A,r):YA(e,A,r)}var W=class{constructor(A,r){this.type=A,this.data=r}};var D=class e extends Error{constructor(A){super(A);let r=Object.create(e.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:e.name})}};function Gj(e,A,r){let n=r/4294967296,l=r;e.setUint32(A,n),e.setUint32(A+4,l)}function LA(e,A,r){let n=Math.floor(r/4294967296),l=r;e.setUint32(A,n),e.setUint32(A+4,l)}function gA(e,A){let r=e.getInt32(A),n=e.getUint32(A+4);return r*4294967296+n}function pj(e,A){let r=e.getUint32(A),n=e.getUint32(A+4);return r*4294967296+n}var tn=-1,en=4294967296-1,nn=17179869184-1;function sn({sec:e,nsec:A}){if(e>=0&&A>=0&&e<=nn)if(A===0&&e<=en){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e),r}else{let r=e/4294967296,n=e&4294967295,l=new Uint8Array(8),d=new DataView(l.buffer);return d.setUint32(0,A<<2|r&3),d.setUint32(4,n),l}else{let r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,A),LA(n,4,e),r}}function ln(e){let A=e.getTime(),r=Math.floor(A/1e3),n=(A-r*1e3)*1e6,l=Math.floor(n/1e9);return{sec:r+l,nsec:n-l*1e9}}function on(e){if(e instanceof Date){let A=ln(e);return sn(A)}else return null}function an(e){let A=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let r=A.getUint32(0),n=A.getUint32(4),l=(r&3)*4294967296+n,d=r>>>2;return{sec:l,nsec:d}}case 12:{let r=gA(A,4),n=A.getUint32(0);return{sec:r,nsec:n}}default:throw new D(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${e.length}\`)}}function kn(e){let A=an(e);return new Date(A.sec*1e3+A.nsec/1e6)}var Ej={type:tn,encode:on,decode:kn};var K=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Ej)}register({type:A,encode:r,decode:n}){if(A>=0)this.encoders[A]=r,this.decoders[A]=n;else{let l=-1-A;this.builtInEncoders[l]=r,this.builtInDecoders[l]=n}}tryToEncode(A,r){for(let n=0;n<this.builtInEncoders.length;n++){let l=this.builtInEncoders[n];if(l!=null){let d=l(A,r);if(d!=null){let q=-1-n;return new W(q,d)}}}for(let n=0;n<this.encoders.length;n++){let l=this.encoders[n];if(l!=null){let d=l(A,r);if(d!=null){let q=n;return new W(q,d)}}}return A instanceof W?A:null}decode(A,r,n){let l=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return l?l(A,r,n):new W(r,A)}};K.defaultCodec=new K;function un(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function nA(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):un(e)?new Uint8Array(e):Uint8Array.from(e)}var cn=100,dn=2048,NA=class e{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??K.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??cn,this.initialBufferSize=A?.initialBufferSize??dn,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 e({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,r){if(r>this.maxDepth)throw new Error(\`Too deep objects in depth \${r}\`);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,r)}ensureBufferSizeToWrite(A){let r=this.pos+A;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(A){let r=new ArrayBuffer(A),n=new Uint8Array(r),l=new DataView(r);n.set(this.bytes),this.view=l,this.bytes=n}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 n=qj(A);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),Cj(A,this.bytes,this.pos),this.pos+=n}encodeObject(A,r){let n=this.extensionCodec.tryToEncode(A,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(A))this.encodeArray(A,r);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,r);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let r=A.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(\`Too large binary: \${r}\`);let n=nA(A);this.writeU8a(n)}encodeArray(A,r){let n=A.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(\`Too large array: \${n}\`);for(let l of A)this.doEncode(l,r+1)}countWithoutUndefined(A,r){let n=0;for(let l of r)A[l]!==void 0&&n++;return n}encodeMap(A,r){let n=Object.keys(A);this.sortKeys&&n.sort();let l=this.ignoreUndefined?this.countWithoutUndefined(A,n):n.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 n){let q=A[d];this.ignoreUndefined&&q===void 0||(this.encodeString(d),this.doEncode(q,r+1))}}encodeExtension(A){if(typeof A.data=="function"){let n=A.data(this.pos+6),l=n.length;if(l>=4294967296)throw new Error(\`Too large extension object: \${l}\`);this.writeU8(201),this.writeU32(l),this.writeI8(A.type),this.writeU8a(n);return}let r=A.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(\`Too large extension object: \${r}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let r=A.length;this.ensureBufferSizeToWrite(r),this.bytes.set(A,this.pos),this.pos+=r}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),Gj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),LA(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 Ar(e,A){return new NA(A).encodeSharedRef(e)}function BA(e){return\`\${e<0?"-":""}0x\${Math.abs(e).toString(16).padStart(2,"0")}\`}var qn=16,Cn=16,xA=class{constructor(A=qn,r=Cn){this.hit=0,this.miss=0,this.maxKeyLength=A,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,r,n){let l=this.caches[n-1];A:for(let d of l){let q=d.bytes;for(let p=0;p<n;p++)if(q[p]!==A[r+p])continue A;return d.str}return null}store(A,r){let n=this.caches[A.length-1],l={bytes:A,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=l:n.push(l)}decode(A,r,n){let l=this.find(A,r,n);if(l!=null)return this.hit++,l;this.miss++;let d=YA(A,r,n),q=Uint8Array.prototype.slice.call(A,r,r+n);return this.store(q,d),d}};var rr="array",iA="map_key",hj="map_value",fn=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new D("The type of key must be string or number but "+typeof e)},jr=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let r=this.getUninitializedStateFromPool();r.type=rr,r.position=0,r.size=A,r.array=new Array(A)}pushMapState(A){let r=this.getUninitializedStateFromPool();r.type=iA,r.readCount=0,r.size=A,r.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===rr){let n=A;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(A.type===iA||A.type===hj){let n=A;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},lA=-1,tr=new DataView(new ArrayBuffer(0)),Gn=new Uint8Array(tr.buffer);try{tr.getInt8(0)}catch(e){if(!(e 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 mj=new RangeError("Insufficient data"),pn=new xA,bA=class e{constructor(A){this.totalPos=0,this.pos=0,this.view=tr,this.bytes=Gn,this.headByte=lA,this.stack=new jr,this.entered=!1,this.extensionCodec=A?.extensionCodec??K.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:pn,this.mapKeyConverter=A?.mapKeyConverter??fn}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=lA,this.stack.reset()}setBuffer(A){let r=nA(A);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let r=this.bytes.subarray(this.pos),n=nA(A),l=new Uint8Array(r.length+n.length);l.set(r),l.set(n,r.length),this.setBuffer(l)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:r,pos:n}=this;return new RangeError(\`Extra \${r.byteLength-n} of \${r.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 r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}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 r=!1,n;for await(let p of A){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{n=this.doDecodeSync(),r=!0}catch(I){if(!(I instanceof RangeError))throw I}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}let{headByte:l,pos:d,totalPos:q}=this;throw new RangeError(\`Insufficient data in parsing \${BA(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,r){if(this.entered){yield*this.clone().decodeMultiAsync(A,r);return}try{this.entered=!0;let n=r,l=-1;for await(let d of A){if(r&&l===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),n&&(l=this.readArraySize(),n=!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(),r;if(A>=224)r=A-256;else if(A<192)if(A<128)r=A;else if(A<144){let l=A-128;if(l!==0){this.pushMapState(l),this.complete();continue A}else r={}}else if(A<160){let l=A-144;if(l!==0){this.pushArrayState(l),this.complete();continue A}else r=[]}else{let l=A-160;r=this.decodeString(l,0)}else if(A===192)r=null;else if(A===194)r=!1;else if(A===195)r=!0;else if(A===202)r=this.readF32();else if(A===203)r=this.readF64();else if(A===204)r=this.readU8();else if(A===205)r=this.readU16();else if(A===206)r=this.readU32();else if(A===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(A===208)r=this.readI8();else if(A===209)r=this.readI16();else if(A===210)r=this.readI32();else if(A===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(A===217){let l=this.lookU8();r=this.decodeString(l,1)}else if(A===218){let l=this.lookU16();r=this.decodeString(l,2)}else if(A===219){let l=this.lookU32();r=this.decodeString(l,4)}else if(A===220){let l=this.readU16();if(l!==0){this.pushArrayState(l),this.complete();continue A}else r=[]}else if(A===221){let l=this.readU32();if(l!==0){this.pushArrayState(l),this.complete();continue A}else r=[]}else if(A===222){let l=this.readU16();if(l!==0){this.pushMapState(l),this.complete();continue A}else r={}}else if(A===223){let l=this.readU32();if(l!==0){this.pushMapState(l),this.complete();continue A}else r={}}else if(A===196){let l=this.lookU8();r=this.decodeBinary(l,1)}else if(A===197){let l=this.lookU16();r=this.decodeBinary(l,2)}else if(A===198){let l=this.lookU32();r=this.decodeBinary(l,4)}else if(A===212)r=this.decodeExtension(1,0);else if(A===213)r=this.decodeExtension(2,0);else if(A===214)r=this.decodeExtension(4,0);else if(A===215)r=this.decodeExtension(8,0);else if(A===216)r=this.decodeExtension(16,0);else if(A===199){let l=this.lookU8();r=this.decodeExtension(l,1)}else if(A===200){let l=this.lookU16();r=this.decodeExtension(l,2)}else if(A===201){let l=this.lookU32();r=this.decodeExtension(l,4)}else throw new D(\`Unrecognized type byte: \${BA(A)}\`);this.complete();let n=this.stack;for(;n.length>0;){let l=n.top();if(l.type===rr)if(l.array[l.position]=r,l.position++,l.position===l.size)r=l.array,n.release(l);else continue A;else if(l.type===iA){if(r==="__proto__")throw new D("The key __proto__ is not allowed");l.key=this.mapKeyConverter(r),l.type=hj;continue A}else if(l.map[l.key]=r,l.readCount++,l.readCount===l.size)r=l.map,n.release(l);else{l.key=null,l.type=iA;continue A}}return r}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new D(\`Unrecognized array type byte: \${BA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new D(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new D(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,r):this.decodeBinary(A,r)}decodeUtf8String(A,r){if(A>this.maxStrLength)throw new D(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+r+A)throw mj;let n=this.pos+r,l;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?l=this.keyDecoder.decode(this.bytes,n,A):l=fj(this.bytes,n,A),this.pos+=r+A,l}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===iA:!1}decodeBinary(A,r){if(A>this.maxBinLength)throw new D(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+r))throw mj;let n=this.pos+r,l=this.bytes.subarray(n,n+A);return this.pos+=r+A,l}decodeExtension(A,r){if(A>this.maxExtLength)throw new D(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let n=this.view.getInt8(this.pos+r),l=this.decodeBinary(A,r+1);return this.extensionCodec.decode(l,n,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=pj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=gA(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 er(e,A){return new bA(A).decode(e)}var oA=class e{constructor(A,r,n,l,d){this.mediaIds=A;this.sequenceNumber=r;this.timeStamp=n;this.isEndOfSpurt=l;this.payload=d}static parse(A){let r;try{r=er(A)}catch{return g("not valid msgpack")}if(!Array.isArray(r))return g("container must be an array");if(r.length<6)return g("missing fields");if(r[0]!==1)return g("unknown type");if(!Array.isArray(r[1]))return g("media ids must be an array");if(!r[1].every(N=>typeof N=="number"))return g("media ids must be numbers");if(typeof r[2]!="number")return g("sequence number must be a number");if(typeof r[3]!="number")return g("timestamp must be a number");if(typeof r[4]!="number")return g("flags must be a number");let n=r[1],l=r[2]>>>0,d=r[3]>>>0,p=(r[4]&1)!==0,I=r[r.length-1];return I instanceof Uint8Array?ej(new e(n,l,d,p,I)):g("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),r=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(Ar(r,{forceFloat32:!0,ignoreUndefined:!0}))}};var JA=class{constructor(A,r){this.sampleRate=A;this.wasm=r;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 r.Encoder(A,15,!0,w.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=cj(this.wasm),this.outBuffer=O(this.wasm,"u8",1270),_A(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:r})=>r.length>0)}close(){dj(this.wasm,this.information),R(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let r=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(r===0)break;if(r<0){oj(\`failed encoding packet: \${r}\`);return}if(this.timestamp=this.timestamp+1800>>0,r===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let n=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 oA(l.mediaIds,this.sequenceNumber,this.timestamp,n,this.outBuffer.subarray(0,r));T(globalThis,["sendPacket",{connectionId:l.id,packet:d.toBytes()}])}}}onMessage(A){let[r,n]=A;switch(r){case"captureSetVad":this?.setVad(n);break;case"captureSetMedias":this?.setMedias(n.connections);break;case"close":this.close();break;case"dump":n.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:IA(this.information),speechProbability:vA(this.information),rmsDBFS:DA(this.information),volume:Zr(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}}}},PA=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=O(this.wasm,"u32",w.MaxNumberOfDecoders),this.information=kj(this.wasm,w.MaxNumberOfDecoders),hA(this.information,[1,1])}close(){uj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,r){this.stats.numberPackets++;let n=oA.parse(r);if(n.type==="Failure"){this.stats.numberPacketError++;let l=Array.from(r).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${n.reason}, connection: \${A}, dump: \${l}\`);return}for(let l of n.value.mediaIds){let d=this.medias.get(HA({connectionId:A,mediaId:l}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=r;let q=O(this.wasm,"u8",n.value.payload.length);q.set(n.value.payload),d.decoder.push(n.value.sequenceNumber,n.value.timeStamp,n.value.isEndOfSpurt,q.byteOffset,q.length)}}insertMedia(A,r,n,l=[1,1]){let d=HA({connectionId:r,mediaId:n}),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),FA(this.information,A,l),Xr(this.information,A,0),Qr(this.information,A,0)}removeMedia(A,r,n){let l=HA({connectionId:r,mediaId:n}),d=this.medias.get(l);if(!(d===void 0||d.index!==A)&&(this.medias.delete(l),Vr(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[r,n]=A;switch(r){case"playbackReceivePacket":this.receivePacket(n.connectionId,n.packet);break;case"playbackUpdateMedias":for(let{index:l,connectionId:d,mediaId:q}of n.removed)this.removeMedia(l,d,q);for(let{index:l,connectionId:d,mediaId:q,volume:p}of n.added)this.insertMedia(l,d,q,p);break;case"close":this.close();break;case"dump":n.result.postMessage(this.dump());break}}dump(){let A=[];for(let[r,n]of this.medias){let l=aj(r);A.push({index:n.index,connectionId:l.connectionId,mediaId:l.mediaId,rmsDBFS:$A(this.information,n.index),volume:Rr(this.information,n.index),voicedBlocks:zr(this.information,n.index),silentBlocks:Wr(this.information,n.index),time:n.decoder.time,consecutive_silence:n.decoder.consecutive_silence,last_voiced_time_point:n.decoder.last_voiced_time_point,sequence_number:n.decoder.sequence_number,packetsSeen:n.decoder.packets_seen,packetsInvalid:n.decoder.packets_invalid,packetsTooLate:n.decoder.packets_too_late,packetsTooEarly:n.decoder.packets_too_early,packetsRepeated:n.decoder.packets_repeated,packetsProcessed:n.decoder.packets_processed,packetsLost:n.decoder.packets_lost,rewinds:n.decoder.rewinds,voiceAccelerated:n.decoder.voice_accelerated,silenceAccelerated:n.decoder.silence_accelerated,cacheLength:n.decoder.cache_length,lastPacket:Yr(n.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Mr(this.information),decoders:A}}};var _j=ce(Fj()),Ij=(0,_j.default)(),vj,Dj;globalThis.addEventListener("message",sr);async function sr(e){let A=e.data,[r,n]=A;switch(r){case"captureInit":n.workletPort.onmessage=sr,vj=new lr(n.sampleRate,await Ij,n.refreshRate);break;case"playbackInit":n.workletPort.onmessage=sr,Dj=new ir(await Ij,n.workletPort,n.refreshRate);break;case"close":globalThis.close();break}vj?.onMessage(A),Dj?.onMessage(A)}var lr=class extends JA{constructor(r,n,l){super(r,n);this.sampleRate=r;this.inBuffer=O(this.wasm,"f32",r*.02),this.updateHandle=setInterval(()=>this.update(),l),T(globalThis,["captureReady",{}])}close(){super.close(),R(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(r){super.onMessage(r);let[n,l]=r;switch(n){case"captureSetVolume":this.setVolume(l.value);break;case"captureTick":this.tick(l.buffer);break}}setVolume(r){_A(this.information,r)}tick(r){this.inBuffer.set(r,0),this.encode(this.inBuffer)}update(){T(globalThis,["captureUpdate",{active:IA(this.information),rmsDBFs:DA(this.information),speechProbability:vA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},ir=class extends PA{constructor(r,n,l){super(r);this.workletPort=n;this.id=w.PlaybackPreload,this.outBuffer=O(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),l),T(globalThis,["playbackReady",{}])}close(){super.close(),R(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(r){super.onMessage(r);let[n,l]=r;switch(n){case"playbackSetVolume":this.setVolume(l.index,l.value);break;case"playbackTick":this.tick();break}}setVolume(r,n){r==="global"?hA(this.information,n):FA(this.information,r,n)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:r}=this.decode(this.outBuffer);if(r){let n=this.outBuffer.slice();T(this.workletPort,["samples",{id:this.id,buffer:n}],[n.buffer])}}update(){let r=new Float32Array(this.information.length*2);for(let l=0;l<=this.largestIndex;l++)r[l]=$A(this.information,l);let n=[];for(let[l,d]of this.medias)n[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:d.decoder.voice_accelerated,packetsInvalid:d.decoder.packets_invalid,packetsRepeated:d.decoder.packets_repeated,packetsLost:d.decoder.packets_lost};T(globalThis,["playbackUpdate",{activities:r,jitterStats:n}],[r.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
3212
- `;var c='"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 Bx=new jx;function j0(r,D,x,F,A=C.DefaultRefreshRate){return Bx.enqueue(async()=>{let[B,j]=await u(d,c,r,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return console.warn("SharedArrayBuffer is not available; creating ODIN CaptureWorker in fallback mode"),q.create(r,D,x,A,B,j,F)})}async function B0(r,D=C.DefaultRefreshRate){if(r.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,F]=await u(d,c,r,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return G.create(r,D,x,F)}var q=class r extends s{constructor(x,F,A,B,j){super(x,F,A,B,j);this._Activity=a;this._SpeechProbability=0;F.addEventListener("message",this._OnMessages.bind(this))}static async create(x,F,A,B,j,t,$){let{port1:p,port2:h}=new MessageChannel;return v(j,["captureInit",{sampleRate:x.sampleRate,refreshRate:B,workletPort:p}],[p]),await i(j,"captureReady"),v(t.port,["init",{workerPort:h}],[h]),new r(t,j,F,A,$)}get activity(){return this._Activity}get speechProbability(){return this._SpeechProbability}setVolume(x){v(this.worker,["captureSetVolume",{value:x}])}_OnMessages(x){super._OnMessages(x);let[F,A]=x.data;F==="captureUpdate"&&(this._Activity={isSilent:!A.active,rmsDBFS:A.rmsDBFs},this._SpeechProbability=A.speechProbability)}},G=class r extends b{constructor(x,F,A){super(x,F,A);this.activities=new Float32Array;this.jitterStats=[]}static async create(x,F,A,B){let{port1:j,port2:t}=new MessageChannel;return v(A,["playbackInit",{workletPort:j,refreshRate:F}],[j]),await i(A,"playbackReady"),v(B.port,["init",{workerPort:t}],[t]),new r(x,B,A)}getActivity(x){let F=this.medias.get(E(x));if(F===void 0)return;let A=this.activities.at(F.index);if(A!==void 0)return A===0?a:{isSilent:!1,rmsDBFS:A}}getJitterStats(x){let F=this.medias.get(E(x));if(F===void 0)return;let A=this.jitterStats.at(F.index);if(A!==void 0)return A}setGlobalVolume(x){v(this.worker,["playbackSetVolume",{index:"global",value:x}])}setVolume(x,F){let A=this.medias.get(E(x));A!==void 0&&v(this.worker,["playbackSetVolume",{index:A.index,value:F}])}_GetFreeIndex(){let x=super._GetFreeIndex();if(x!==void 0)return x;if(this.medias.size<C.MaxNumberOfDecoders)return this.medias.size}_OnMessages(x){super._OnMessages(x);let[F,A]=x.data;F==="playbackUpdate"&&(this.activities=A.activities,this.jitterStats=A.jitterStats)}};export{q as UnsharedCaptureWorker,G as UnsharedPlaybackWorker,j0 as createCaptureWorker,B0 as createPlaybackWorker};
3211
+ \`,new Function(m,C)}function MA(t,j,s,i,o,k){var a=j.length;a<2&&G("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=j[1]!==null&&s!==null,c=Hr(j),C=!j[0].isVoid,f=j[0],m=j[1],$=[t,G,i,o,yr,f.fromWireType.bind(f),m?.toWireType.bind(m)],E=2;E<a;++E){var F=j[E];$.push(F.toWireType.bind(F))}if(!c)for(var E=u?1:2;E<j.length;++E)j[E].destructorFunction!==null&&$.push(j[E].destructorFunction);var P=Gt(j,u,C,k)(...$);return hr(t,P)}var pt=(t,j,s,i,o,k)=>{var a=SA(j,s);o=b(i,o),U([],[t],u=>{u=u[0];var c=\`constructor \${u.name}\`;if(u.registeredClass.constructor_body===void 0&&(u.registeredClass.constructor_body=[]),u.registeredClass.constructor_body[j-1]!==void 0)throw new AA(\`Cannot register multiple constructors with identical number of parameters (\${j-1}) for class '\${u.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!\`);return u.registeredClass.constructor_body[j-1]=()=>{X(\`Cannot construct \${u.name} due to unbound types\`,a)},U([],a,C=>(C.splice(1,0,null),u.registeredClass.constructor_body[j-1]=MA(c,C,null,o,k),[])),[]})},Lr=t=>{t=t.trim();let j=t.indexOf("(");return j===-1?t:t.slice(0,j)},Et=(t,j,s,i,o,k,a,u,c,C)=>{var f=SA(s,i);j=v(j),j=Lr(j),k=b(o,k,c),U([],[t],m=>{m=m[0];var $=\`\${m.name}.\${j}\`;j.startsWith("@@")&&(j=Symbol[j.substring(2)]),u&&m.registeredClass.pureVirtualFunctions.push(j);function E(){X(\`Cannot call \${$} due to unbound types\`,f)}var F=m.registeredClass.instancePrototype,y=F[j];return y===void 0||y.overloadTable===void 0&&y.className!==m.name&&y.argCount===s-2?(E.argCount=s-2,E.className=m.name,F[j]=E):(Fr(F,j,$),F[j].overloadTable[s-2]=E),U([],f,P=>{var H=MA($,P,m,k,a,c);return F[j].overloadTable===void 0?(H.argCount=s-2,F[j]=H):F[j].overloadTable[s-2]=H,[]}),[]})},gr=(t,j,s)=>(t instanceof Object||G(\`\${s} with invalid "this": \${t}\`),t instanceof j.registeredClass.constructor||G(\`\${s} incompatible with "this" of type \${t.constructor.name}\`),t.$$.ptr||G(\`cannot call emscripten binding method \${s} on deleted object\`),fA(t.$$.ptr,t.$$.ptrType.registeredClass,j.registeredClass)),mt=(t,j,s,i,o,k,a,u,c,C)=>{j=v(j),o=b(i,o),U([],[t],f=>{f=f[0];var m=\`\${f.name}.\${j}\`,$={get(){X(\`Cannot access \${m} due to unbound types\`,[s,a])},enumerable:!0,configurable:!0};return c?$.set=()=>X(\`Cannot access \${m} due to unbound types\`,[s,a]):$.set=E=>G(m+" is a read-only property"),Object.defineProperty(f.registeredClass.instancePrototype,j,$),U([],c?[s,a]:[s],E=>{var F=E[0],y={get(){var H=gr(this,f,m+" getter");return F.fromWireType(o(k,H))},enumerable:!0};if(c){c=b(u,c);var P=E[1];y.set=function(H){var tA=gr(this,f,m+" setter"),_=[];c(C,tA,P.toWireType(_,H)),yr(_)}}return Object.defineProperty(f.registeredClass.instancePrototype,j,y),[]}),[]})},Nr=[],M=[0,1,,1,null,1,!0,1,!1,1],ht=t=>{if(t>9&&--M[t+1]===0){var j=M[t];M[t]=void 0,Nr.push(t)}},VA={toValue:t=>(t||G(\`Cannot use deleted val. handle = \${t}\`),M[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let j=Nr.pop()||M.length;return M[j]=t,M[j+1]=1,j}}}},$t={name:"emscripten::val",fromWireType:t=>{var j=VA.toValue(t);return ht(t),j},toWireType:(t,j)=>VA.toHandle(j),readValueFromPointer:GA,destructorFunction:null},Ft=t=>B(t,$t),It=(t,j)=>{switch(j){case 4:return function(s){return this.fromWireType(ur[s>>2])};case 8:return function(s){return this.fromWireType(cr[s>>3])};default:throw new TypeError(\`invalid float width (\${j}): \${t}\`)}},vt=(t,j,s)=>{j=v(j),B(t,{name:j,fromWireType:i=>i,toWireType:(i,o)=>o,readValueFromPointer:It(j,s),destructorFunction:null})},Dt=(t,j,s,i,o,k,a,u)=>{var c=SA(j,s);t=v(t),t=Lr(t),o=b(i,o,a),Ir(t,function(){X(\`Cannot call \${t} due to unbound types\`,c)},j-1),U([],c,C=>{var f=[C[0],null].concat(C.slice(1));return Dr(t,MA(t,f,null,o,k,a),j-1),[]})},_t=(t,j,s,i,o)=>{j=v(j);let k=i===0,a=c=>c;if(k){var u=32-8*s;a=c=>c<<u>>>u,o=a(o)}B(t,{name:j,fromWireType:a,toWireType:(c,C)=>C,readValueFromPointer:Gr(j,s,i!==0),destructorFunction:null})},yt=(t,j,s)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=i[j];function k(a){var u=h[a>>2],c=h[a+4>>2];return new o(S.buffer,c,u)}s=v(s),B(t,{name:s,fromWireType:k,readValueFromPointer:k},{ignoreDuplicateRegistrations:!0})},Ht=(t,j,s,i)=>{if(!(i>0))return 0;for(var o=s,k=s+i-1,a=0;a<t.length;++a){var u=t.codePointAt(a);if(u<=127){if(s>=k)break;j[s++]=u}else if(u<=2047){if(s+1>=k)break;j[s++]=192|u>>6,j[s++]=128|u&63}else if(u<=65535){if(s+2>=k)break;j[s++]=224|u>>12,j[s++]=128|u>>6&63,j[s++]=128|u&63}else{if(s+3>=k)break;j[s++]=240|u>>18,j[s++]=128|u>>12&63,j[s++]=128|u>>6&63,j[s++]=128|u&63,a++}}return j[s]=0,s-o},Lt=(t,j,s)=>Ht(t,L,j,s),gt=t=>{for(var j=0,s=0;s<t.length;++s){var i=t.charCodeAt(s);i<=127?j++:i<=2047?j+=2:i>=55296&&i<=57343?(j+=4,++s):j+=3}return j},Br=globalThis.TextDecoder&&new TextDecoder,xr=(t,j,s,i)=>{var o=j+s;if(i)return o;for(;t[j]&&!(j>=o);)++j;return j},br=(t,j=0,s,i)=>{var o=xr(t,j,s,i);if(o-j>16&&t.buffer&&Br)return Br.decode(t.subarray(j,o));for(var k="";j<o;){var a=t[j++];if(!(a&128)){k+=String.fromCharCode(a);continue}var u=t[j++]&63;if((a&224)==192){k+=String.fromCharCode((a&31)<<6|u);continue}var c=t[j++]&63;if((a&240)==224?a=(a&15)<<12|u<<6|c:a=(a&7)<<18|u<<12|c<<6|t[j++]&63,a<65536)k+=String.fromCharCode(a);else{var C=a-65536;k+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return k},Nt=(t,j,s)=>t?br(L,t,j,s):"",Bt=(t,j)=>{j=v(j);var s=!0;B(t,{name:j,fromWireType(i){var o=h[i>>2],k=i+4,a;if(s)a=Nt(k,o,!0);else{a="";for(var u=0;u<o;++u)a+=String.fromCharCode(L[k+u])}return J(i),a},toWireType(i,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var k,a=typeof o=="string";a||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||G("Cannot pass non-string to std::string"),s&&a?k=gt(o):k=o.length;var u=RA(4+k+1),c=u+4;if(h[u>>2]=k,a)if(s)Lt(o,c,k+1);else for(var C=0;C<k;++C){var f=o.charCodeAt(C);f>255&&(J(u),G("String has UTF-16 code units that do not fit in 8 bits")),L[c+C]=f}else L.set(o,c);return i!==null&&i.push(J,u),u},readValueFromPointer:GA,destructorFunction(i){J(i)}})},Jr=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,xt=(t,j,s)=>{var i=t>>1,o=xr(Y,i,j/2,s);if(o-i>16&&Jr)return Jr.decode(Y.subarray(i,o));for(var k="",a=i;a<o;++a){var u=Y[a];k+=String.fromCharCode(u)}return k},bt=(t,j,s=2147483647)=>{if(s<2)return 0;s-=2;for(var i=j,o=s<t.length*2?s/2:t.length,k=0;k<o;++k){var a=t.charCodeAt(k);uA[j>>1]=a,j+=2}return uA[j>>1]=0,j-i},Jt=t=>t.length*2,Pt=(t,j,s)=>{for(var i="",o=t>>2,k=0;!(k>=j/4);k++){var a=h[o+k];if(!a&&!s)break;i+=String.fromCodePoint(a)}return i},Ot=(t,j,s=2147483647)=>{if(s<4)return 0;for(var i=j,o=i+s-4,k=0;k<t.length;++k){var a=t.codePointAt(k);if(a>65535&&k++,cA[j>>2]=a,j+=4,j+4>o)break}return cA[j>>2]=0,j-i},Ut=t=>{for(var j=0,s=0;s<t.length;++s){var i=t.codePointAt(s);i>65535&&s++,j+=4}return j},wt=(t,j,s)=>{s=v(s);var i,o,k;j===2?(i=xt,o=bt,k=Jt):(i=Pt,o=Ot,k=Ut),B(t,{name:s,fromWireType:a=>{var u=h[a>>2],c=i(a+4,u*j,!0);return J(a),c},toWireType:(a,u)=>{typeof u!="string"&&G(\`Cannot pass non-string to C++ string type \${s}\`);var c=k(u),C=RA(4+c+j);return h[C>>2]=c/j,o(u,C+4,c+j),a!==null&&a.push(J,C),C},readValueFromPointer:GA,destructorFunction(a){J(a)}})},Tt=(t,j)=>{j=v(j),B(t,{isVoid:!0,name:j,fromWireType:()=>{},toWireType:(s,i)=>{}})},Kt=t=>{kA("OOM")},St=t=>{var j=L.length;t>>>=0,Kt(t)},Mt=t=>52,Vt=9007199254740992,Rt=-9007199254740992,Wt=t=>t<Rt||t>Vt?NaN:Number(t);function Qt(t,j,s,i){return j=Wt(j),70}var zt=[null,[],[]],Xt=(t,j)=>{var s=zt[t];j===0||j===10?((t===1?x:aA)(br(s)),s.length=0):s.push(j)},Zt=(t,j,s,i)=>{for(var o=0,k=0;k<s;k++){var a=h[j>>2],u=h[j+4>>2];j+=8;for(var c=0;c<u;c++)Xt(t,L[a+c]);o+=u}return h[i>>2]=o,0};At(),ct();{r.noExitRuntime&&(Kj=r.noExitRuntime),r.print&&(x=r.print),r.printErr&&(aA=r.printErr),r.arguments&&(q=r.arguments),r.thisProgram&&(p=r.thisProgram);var Z=r.preInit;if(Z)for(typeof Z=="function"&&(r.preInit=Z=[Z]);Z.length>0;)Z.shift()()}var Pr,RA,J,Yt,Ae,Or,Ur;function re(t){Pr=t.w,RA=r._malloc=t.y,J=r._free=t.z,Yt=Or=t.u,Ae=Ur=t.x}var je={i:Vj,r:Rj,g:Qj,l:zj,k:ft,j:pt,d:Et,a:mt,s:Ft,f:vt,n:Dt,c:_t,b:yt,t:Bt,e:wt,m:Tt,o:St,q:Mt,p:Qt,h:Zt};async function te(){Bj();var t=r.setStatus;t&&(t("Running..."),await new Promise(j=>setTimeout(j,1)),setTimeout(t,1,"")),!or&&(xj(),r.onRuntimeInitialized?.(),bj())}var jA;return jA=await Tj(),await te(),r}})();typeof $j=="object"&&typeof OA=="object"?(OA.exports=nr,OA.exports.default=nr):typeof define=="function"&&define.amd&&define([],()=>nr)});var w={};ke(w,{AdditionalCaptureBlocks:()=>qe,AdditionalPlaybackBlocks:()=>de,ClockJumpCheckInterval:()=>he,ClockJumpThreshold:()=>$e,ConnectInterval:()=>Ne,ConnectTimeout:()=>He,DefaultRefreshRate:()=>fe,DefaultVideoCodec:()=>xe,HealthCheckTimeout:()=>me,MainConnectionPingInterval:()=>Fe,MaxNumberOfDecoders:()=>pe,MaxReconnectDuration:()=>Be,MinDBFs:()=>Sr,MinTokenLifetime:()=>Le,MinTokenRefreshInterval:()=>ge,PlaybackPreload:()=>Ce,RenderQuantumSize:()=>Ee,VadPreload:()=>Ge,WebRtcAnswerTimeout:()=>_e,WebRtcIceTimeout:()=>ve,WebRtcMaxNegotiationAttempts:()=>ye,WebRtcStatsSnapshotInterval:()=>Ie,WebRtcTimeout:()=>De});var de=3,qe=3,Ce=3,fe=250,Ge=3,pe=512,Ee=128,Sr=-758.596,me=1e4,he=1e3,$e=1e4,Fe=3e3,Ie=1e3,ve=3e3,De=1e4,_e=1e4,ye=3,He=5e3,Le=6e4,ge=5e3,Ne=[0,100,200,200,500],Be=12e4,xe="H264";function T(e,A,r){return e.postMessage(A,r)}function Mr(e){return[e.values[0],e.values[1]]}function hA(e,A){e.values[0]=A[0],e.values[1]=A[1]}function $A(e,A){return e.values[2+A*5]}function Vr(e,A,r){e.values[2+A*5]=r}function Rr(e,A){let r=2+A*5+1;return[e.values[r+0],e.values[r+1]]}function FA(e,A,r){let n=2+A*5+1;e.values[n+0]=r[0],e.values[n+1]=r[1]}function Wr(e,A){return e.values[2+A*5+3]}function Qr(e,A,r){e.values[2+A*5+3]=r}function zr(e,A){return e.values[2+A*5+4]}function Xr(e,A,r){e.values[2+A*5+4]=r}function IA(e){return e.values[0]!==0}function vA(e){return e.values[1]}function DA(e){return e.values[2]}function Zr(e){return e.values[3]}function _A(e,A){return e.values[3]=A}function Yr(e){return e?Array.from(e).map(A=>A.toString(16).padStart(2,"0")).join(""):null}var be;(e=>{let A;(r=>(r[r.InvalidPassword=-1]="InvalidPassword",r[r.Unknown=0]="Unknown",r[r.Unencrypted=1]="Unencrypted",r[r.Encrypted=2]="Encrypted"))(A=e.PeerCipherStatus||={})})(be||={});function ej(e){return{type:"Success",value:e}}function g(e){return{type:"Failure",reason:e}}var{Deno:Aj}=globalThis,Je=typeof Aj?.noColor=="boolean"?Aj.noColor:!1,Pe=!Je;function XA(e,A){return{open:\`\\x1B[\${e.join(";")}m\`,close:\`\\x1B[\${A}m\`,regexp:new RegExp(\`\\\\x1b\\\\[\${A}m\`,"g")}}function ZA(e,A){return Pe?\`\${A.open}\${e.replace(A.regexp,A.open)}\${A.close}\`:e}function zA(e){return ZA(e,XA([0],0))}function rj(e){return ZA(e,XA([1],22))}function Oe(e){return ZA(e,XA([2],22))}var xn=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"),Ue=new Date,yA=(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))(yA||{}),nj={0:"\\u{1F4A5}",1:"\\u{1F534}",2:"\\u{1F7E1}",3:"\\u{1F535}",4:"\\u{1F7E3}"},we={4:Oe,3:zA,2:zA,1:rj,0:rj};function Te({message:e}){return String(e)}function jj(e){return JSON.stringify({timestamp:e.date.toISOString(),level:yA[e.level],message:e.message,extra:e.extra})}function tj(e){function A(q,p){return[Math.floor(q/p),q%p]}function r(){let q,p=e.date.valueOf()-Ue.valueOf();[p,q]=A(p,1e3);let[I,N]=A(p,60);return\`\${I.toString().padStart(4,"0")}:\${N.toString().padStart(2,"0")}.\${q.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 l=nj[e.level],d=e.logger.name!==void 0?\`@\${e.logger.name}\`:"";return\`\${zA(r())}\${d} \${l} \${we[e.level](String(e.message))}\${n()}\`}function Ke(e){let A=\`[\${e.date.toISOString()}]\`,r=\`[\${yA[e.level]}]\`,n=e.logger.name!==void 0?\`[\${e.logger.name}] \`:"",l=nj[e.level];return\`\${A} \${l} \${r.padEnd(7," ")} \${n}\${e.message}\`}function Se(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var sj=class{static sparse=Te;static json=jj;static pretty=tj;static structured=Ke;static default=Se()?tj:jj;constructor(){}};var Me=class{formatter;consoleObject;filter;constructor(e=sj.default,A=4,r=console){this.filter=A,this.formatter=e,this.consoleObject=r}handle(e){let A=this.formatter(e);switch(e.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(e,A=void 0,r=[],n=void 0){this.#A=A,this.sinks=r,this.filter=e,this.parent=n}log(e,A,r=void 0){let n={date:new Date,level:e,logger:this,message:A,extra:r};this.filter<e||this.insert(n)}insert(e){if(!(this.filter<e.level)){for(let A of this.sinks)A.filter>=e.level&&A.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)},eA=globalThis[Symbol.for("odin-global-logger")]??=new V(3,void 0,[new Me]),Ve=V.prototype.log.bind(eA,1),Re=V.prototype.log.bind(eA,2),lj=V.prototype.log.bind(eA,3),We=V.prototype.log.bind(eA,4),bn=V.prototype.log.bind(eA);var ij;function oj(e,...A){let r=Qe(A);ij?ij?.info(e,r):lj(e,r)}function Qe(...e){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null)return{...e[0]};if(e.length>0)return{args:e}}function HA(e){return e.connectionId*4294967296+e.mediaId}function aj(e){return{mediaId:e%4294967296,connectionId:Math.floor(e/4294967296)}}function O(e,A,r){let n;switch(A){case"f32":n=e.HEAPF32;break;case"u32":n=e.HEAPU32;break;case"i32":n=e.HEAP32;break;case"u8":n=e.HEAPU8;break;default:throw new Error(\`allocating \${A} is not supported\`)}let l=e._malloc(r*n.BYTES_PER_ELEMENT);if(l===0||l%n.BYTES_PER_ELEMENT!==0)throw new Error(\`failed allocating a \${r} \${A} array\`);let d=l/n.BYTES_PER_ELEMENT;return n.subarray(d,d+r)}function R(e,A){e._free(A.byteOffset)}function kj(e,A){return{values:O(e,"f32",2+A*5),length:A}}function uj(e,A){R(e,A.values)}function cj(e){return{values:O(e,"f32",4)}}function dj(e,A){R(e,A.values)}function qj(e){let A=e.length,r=0,n=0;for(;n<A;){let l=e.charCodeAt(n++);if((l&4294967168)===0){r++;continue}else if((l&4294965248)===0)r+=2;else{if(l>=55296&&l<=56319&&n<A){let d=e.charCodeAt(n);(d&64512)===56320&&(++n,l=((l&1023)<<10)+(d&1023)+65536)}(l&4294901760)===0?r+=3:r+=4}}return r}function ze(e,A,r){let n=e.length,l=r,d=0;for(;d<n;){let q=e.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<n){let p=e.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 Xe=new TextEncoder,Ze=50;function Ye(e,A,r){Xe.encodeInto(e,A.subarray(r))}function Cj(e,A,r){e.length>Ze?Ye(e,A,r):ze(e,A,r)}var An=4096;function YA(e,A,r){let n=A,l=n+r,d=[],q="";for(;n<l;){let p=e[n++];if((p&128)===0)d.push(p);else if((p&224)===192){let I=e[n++]&63;d.push((p&31)<<6|I)}else if((p&240)===224){let I=e[n++]&63,N=e[n++]&63;d.push((p&31)<<12|I<<6|N)}else if((p&248)===240){let I=e[n++]&63,N=e[n++]&63,UA=e[n++]&63,x=(p&7)<<18|I<<12|N<<6|UA;x>65535&&(x-=65536,d.push(x>>>10&1023|55296),x=56320|x&1023),d.push(x)}else d.push(p);d.length>=An&&(q+=String.fromCharCode(...d),d.length=0)}return d.length>0&&(q+=String.fromCharCode(...d)),q}var rn=new TextDecoder,jn=200;function tn(e,A,r){let n=e.subarray(A,A+r);return rn.decode(n)}function fj(e,A,r){return r>jn?tn(e,A,r):YA(e,A,r)}var W=class{constructor(A,r){this.type=A,this.data=r}};var D=class e extends Error{constructor(A){super(A);let r=Object.create(e.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:e.name})}};function Gj(e,A,r){let n=r/4294967296,l=r;e.setUint32(A,n),e.setUint32(A+4,l)}function LA(e,A,r){let n=Math.floor(r/4294967296),l=r;e.setUint32(A,n),e.setUint32(A+4,l)}function gA(e,A){let r=e.getInt32(A),n=e.getUint32(A+4);return r*4294967296+n}function pj(e,A){let r=e.getUint32(A),n=e.getUint32(A+4);return r*4294967296+n}var en=-1,nn=4294967296-1,sn=17179869184-1;function ln({sec:e,nsec:A}){if(e>=0&&A>=0&&e<=sn)if(A===0&&e<=nn){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e),r}else{let r=e/4294967296,n=e&4294967295,l=new Uint8Array(8),d=new DataView(l.buffer);return d.setUint32(0,A<<2|r&3),d.setUint32(4,n),l}else{let r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,A),LA(n,4,e),r}}function on(e){let A=e.getTime(),r=Math.floor(A/1e3),n=(A-r*1e3)*1e6,l=Math.floor(n/1e9);return{sec:r+l,nsec:n-l*1e9}}function an(e){if(e instanceof Date){let A=on(e);return ln(A)}else return null}function kn(e){let A=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:A.getUint32(0),nsec:0};case 8:{let r=A.getUint32(0),n=A.getUint32(4),l=(r&3)*4294967296+n,d=r>>>2;return{sec:l,nsec:d}}case 12:{let r=gA(A,4),n=A.getUint32(0);return{sec:r,nsec:n}}default:throw new D(\`Unrecognized data size for timestamp (expected 4, 8, or 12): \${e.length}\`)}}function un(e){let A=kn(e);return new Date(A.sec*1e3+A.nsec/1e6)}var Ej={type:en,encode:an,decode:un};var K=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Ej)}register({type:A,encode:r,decode:n}){if(A>=0)this.encoders[A]=r,this.decoders[A]=n;else{let l=-1-A;this.builtInEncoders[l]=r,this.builtInDecoders[l]=n}}tryToEncode(A,r){for(let n=0;n<this.builtInEncoders.length;n++){let l=this.builtInEncoders[n];if(l!=null){let d=l(A,r);if(d!=null){let q=-1-n;return new W(q,d)}}}for(let n=0;n<this.encoders.length;n++){let l=this.encoders[n];if(l!=null){let d=l(A,r);if(d!=null){let q=n;return new W(q,d)}}}return A instanceof W?A:null}decode(A,r,n){let l=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return l?l(A,r,n):new W(r,A)}};K.defaultCodec=new K;function cn(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function nA(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):cn(e)?new Uint8Array(e):Uint8Array.from(e)}var dn=100,qn=2048,NA=class e{constructor(A){this.entered=!1,this.extensionCodec=A?.extensionCodec??K.defaultCodec,this.context=A?.context,this.useBigInt64=A?.useBigInt64??!1,this.maxDepth=A?.maxDepth??dn,this.initialBufferSize=A?.initialBufferSize??qn,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 e({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,r){if(r>this.maxDepth)throw new Error(\`Too deep objects in depth \${r}\`);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,r)}ensureBufferSizeToWrite(A){let r=this.pos+A;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(A){let r=new ArrayBuffer(A),n=new Uint8Array(r),l=new DataView(r);n.set(this.bytes),this.view=l,this.bytes=n}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 n=qj(A);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),Cj(A,this.bytes,this.pos),this.pos+=n}encodeObject(A,r){let n=this.extensionCodec.tryToEncode(A,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(A))this.encodeArray(A,r);else if(ArrayBuffer.isView(A))this.encodeBinary(A);else if(typeof A=="object")this.encodeMap(A,r);else throw new Error(\`Unrecognized object: \${Object.prototype.toString.apply(A)}\`)}encodeBinary(A){let r=A.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(\`Too large binary: \${r}\`);let n=nA(A);this.writeU8a(n)}encodeArray(A,r){let n=A.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(\`Too large array: \${n}\`);for(let l of A)this.doEncode(l,r+1)}countWithoutUndefined(A,r){let n=0;for(let l of r)A[l]!==void 0&&n++;return n}encodeMap(A,r){let n=Object.keys(A);this.sortKeys&&n.sort();let l=this.ignoreUndefined?this.countWithoutUndefined(A,n):n.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 n){let q=A[d];this.ignoreUndefined&&q===void 0||(this.encodeString(d),this.doEncode(q,r+1))}}encodeExtension(A){if(typeof A.data=="function"){let n=A.data(this.pos+6),l=n.length;if(l>=4294967296)throw new Error(\`Too large extension object: \${l}\`);this.writeU8(201),this.writeU32(l),this.writeI8(A.type),this.writeU8a(n);return}let r=A.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(\`Too large extension object: \${r}\`);this.writeI8(A.type),this.writeU8a(A.data)}writeU8(A){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,A),this.pos++}writeU8a(A){let r=A.length;this.ensureBufferSizeToWrite(r),this.bytes.set(A,this.pos),this.pos+=r}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),Gj(this.view,this.pos,A),this.pos+=8}writeI64(A){this.ensureBufferSizeToWrite(8),LA(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 Ar(e,A){return new NA(A).encodeSharedRef(e)}function BA(e){return\`\${e<0?"-":""}0x\${Math.abs(e).toString(16).padStart(2,"0")}\`}var Cn=16,fn=16,xA=class{constructor(A=Cn,r=fn){this.hit=0,this.miss=0,this.maxKeyLength=A,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(A){return A>0&&A<=this.maxKeyLength}find(A,r,n){let l=this.caches[n-1];A:for(let d of l){let q=d.bytes;for(let p=0;p<n;p++)if(q[p]!==A[r+p])continue A;return d.str}return null}store(A,r){let n=this.caches[A.length-1],l={bytes:A,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=l:n.push(l)}decode(A,r,n){let l=this.find(A,r,n);if(l!=null)return this.hit++,l;this.miss++;let d=YA(A,r,n),q=Uint8Array.prototype.slice.call(A,r,r+n);return this.store(q,d),d}};var rr="array",iA="map_key",hj="map_value",Gn=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new D("The type of key must be string or number but "+typeof e)},jr=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(A){let r=this.getUninitializedStateFromPool();r.type=rr,r.position=0,r.size=A,r.array=new Array(A)}pushMapState(A){let r=this.getUninitializedStateFromPool();r.type=iA,r.readCount=0,r.size=A,r.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===rr){let n=A;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(A.type===iA||A.type===hj){let n=A;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},lA=-1,tr=new DataView(new ArrayBuffer(0)),pn=new Uint8Array(tr.buffer);try{tr.getInt8(0)}catch(e){if(!(e 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 mj=new RangeError("Insufficient data"),En=new xA,bA=class e{constructor(A){this.totalPos=0,this.pos=0,this.view=tr,this.bytes=pn,this.headByte=lA,this.stack=new jr,this.entered=!1,this.extensionCodec=A?.extensionCodec??K.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??Gn}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=lA,this.stack.reset()}setBuffer(A){let r=nA(A);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(A){if(this.headByte===lA&&!this.hasRemaining(1))this.setBuffer(A);else{let r=this.bytes.subarray(this.pos),n=nA(A),l=new Uint8Array(r.length+n.length);l.set(r),l.set(n,r.length),this.setBuffer(l)}}hasRemaining(A){return this.view.byteLength-this.pos>=A}createExtraByteError(A){let{view:r,pos:n}=this;return new RangeError(\`Extra \${r.byteLength-n} of \${r.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 r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}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 r=!1,n;for await(let p of A){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(p);try{n=this.doDecodeSync(),r=!0}catch(I){if(!(I instanceof RangeError))throw I}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}let{headByte:l,pos:d,totalPos:q}=this;throw new RangeError(\`Insufficient data in parsing \${BA(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,r){if(this.entered){yield*this.clone().decodeMultiAsync(A,r);return}try{this.entered=!0;let n=r,l=-1;for await(let d of A){if(r&&l===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(d),n&&(l=this.readArraySize(),n=!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(),r;if(A>=224)r=A-256;else if(A<192)if(A<128)r=A;else if(A<144){let l=A-128;if(l!==0){this.pushMapState(l),this.complete();continue A}else r={}}else if(A<160){let l=A-144;if(l!==0){this.pushArrayState(l),this.complete();continue A}else r=[]}else{let l=A-160;r=this.decodeString(l,0)}else if(A===192)r=null;else if(A===194)r=!1;else if(A===195)r=!0;else if(A===202)r=this.readF32();else if(A===203)r=this.readF64();else if(A===204)r=this.readU8();else if(A===205)r=this.readU16();else if(A===206)r=this.readU32();else if(A===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(A===208)r=this.readI8();else if(A===209)r=this.readI16();else if(A===210)r=this.readI32();else if(A===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(A===217){let l=this.lookU8();r=this.decodeString(l,1)}else if(A===218){let l=this.lookU16();r=this.decodeString(l,2)}else if(A===219){let l=this.lookU32();r=this.decodeString(l,4)}else if(A===220){let l=this.readU16();if(l!==0){this.pushArrayState(l),this.complete();continue A}else r=[]}else if(A===221){let l=this.readU32();if(l!==0){this.pushArrayState(l),this.complete();continue A}else r=[]}else if(A===222){let l=this.readU16();if(l!==0){this.pushMapState(l),this.complete();continue A}else r={}}else if(A===223){let l=this.readU32();if(l!==0){this.pushMapState(l),this.complete();continue A}else r={}}else if(A===196){let l=this.lookU8();r=this.decodeBinary(l,1)}else if(A===197){let l=this.lookU16();r=this.decodeBinary(l,2)}else if(A===198){let l=this.lookU32();r=this.decodeBinary(l,4)}else if(A===212)r=this.decodeExtension(1,0);else if(A===213)r=this.decodeExtension(2,0);else if(A===214)r=this.decodeExtension(4,0);else if(A===215)r=this.decodeExtension(8,0);else if(A===216)r=this.decodeExtension(16,0);else if(A===199){let l=this.lookU8();r=this.decodeExtension(l,1)}else if(A===200){let l=this.lookU16();r=this.decodeExtension(l,2)}else if(A===201){let l=this.lookU32();r=this.decodeExtension(l,4)}else throw new D(\`Unrecognized type byte: \${BA(A)}\`);this.complete();let n=this.stack;for(;n.length>0;){let l=n.top();if(l.type===rr)if(l.array[l.position]=r,l.position++,l.position===l.size)r=l.array,n.release(l);else continue A;else if(l.type===iA){if(r==="__proto__")throw new D("The key __proto__ is not allowed");l.key=this.mapKeyConverter(r),l.type=hj;continue A}else if(l.map[l.key]=r,l.readCount++,l.readCount===l.size)r=l.map,n.release(l);else{l.key=null,l.type=iA;continue A}}return r}}readHeadByte(){return this.headByte===lA&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lA}readArraySize(){let A=this.readHeadByte();switch(A){case 220:return this.readU16();case 221:return this.readU32();default:{if(A<160)return A-144;throw new D(\`Unrecognized array type byte: \${BA(A)}\`)}}}pushMapState(A){if(A>this.maxMapLength)throw new D(\`Max length exceeded: map length (\${A}) > maxMapLengthLength (\${this.maxMapLength})\`);this.stack.pushMapState(A)}pushArrayState(A){if(A>this.maxArrayLength)throw new D(\`Max length exceeded: array length (\${A}) > maxArrayLength (\${this.maxArrayLength})\`);this.stack.pushArrayState(A)}decodeString(A,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(A,r):this.decodeBinary(A,r)}decodeUtf8String(A,r){if(A>this.maxStrLength)throw new D(\`Max length exceeded: UTF-8 byte length (\${A}) > maxStrLength (\${this.maxStrLength})\`);if(this.bytes.byteLength<this.pos+r+A)throw mj;let n=this.pos+r,l;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(A)?l=this.keyDecoder.decode(this.bytes,n,A):l=fj(this.bytes,n,A),this.pos+=r+A,l}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===iA:!1}decodeBinary(A,r){if(A>this.maxBinLength)throw new D(\`Max length exceeded: bin length (\${A}) > maxBinLength (\${this.maxBinLength})\`);if(!this.hasRemaining(A+r))throw mj;let n=this.pos+r,l=this.bytes.subarray(n,n+A);return this.pos+=r+A,l}decodeExtension(A,r){if(A>this.maxExtLength)throw new D(\`Max length exceeded: ext length (\${A}) > maxExtLength (\${this.maxExtLength})\`);let n=this.view.getInt8(this.pos+r),l=this.decodeBinary(A,r+1);return this.extensionCodec.decode(l,n,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=pj(this.view,this.pos);return this.pos+=8,A}readI64(){let A=gA(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 er(e,A){return new bA(A).decode(e)}var oA=class e{constructor(A,r,n,l,d){this.mediaIds=A;this.sequenceNumber=r;this.timeStamp=n;this.isEndOfSpurt=l;this.payload=d}static parse(A){let r;try{r=er(A)}catch{return g("not valid msgpack")}if(!Array.isArray(r))return g("container must be an array");if(r.length<6)return g("missing fields");if(r[0]!==1)return g("unknown type");if(!Array.isArray(r[1]))return g("media ids must be an array");if(!r[1].every(N=>typeof N=="number"))return g("media ids must be numbers");if(typeof r[2]!="number")return g("sequence number must be a number");if(typeof r[3]!="number")return g("timestamp must be a number");if(typeof r[4]!="number")return g("flags must be a number");let n=r[1],l=r[2]>>>0,d=r[3]>>>0,p=(r[4]&1)!==0,I=r[r.length-1];return I instanceof Uint8Array?ej(new e(n,l,d,p,I)):g("payload must be bytes")}toBytes(){let A=Number(this.isEndOfSpurt),r=[1,this.mediaIds,this.sequenceNumber>>>0,this.timeStamp>>>0,A,this.payload];return new Uint8Array(Ar(r,{forceFloat32:!0,ignoreUndefined:!0}))}};var JA=class{constructor(A,r){this.sampleRate=A;this.wasm=r;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 r.Encoder(A,15,!0,w.VadPreload),this.encoder.complexity=navigator.hardwareConcurrency>=4?6:4,this.information=cj(this.wasm),this.outBuffer=O(this.wasm,"u8",1270),_A(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:r})=>r.length>0)}close(){dj(this.wasm,this.information),R(this.wasm,this.outBuffer),this.encoder.delete()}encode(A){for(this.encoder.push(A.byteOffset,this.information.values.byteOffset);;){let r=this.encoder.pop(this.connections.length===0?0:this.outBuffer.byteOffset,this.outBuffer.length);if(r===0)break;if(r<0){oj(\`failed encoding packet: \${r}\`);return}if(this.timestamp=this.timestamp+1800>>0,r===1)continue;this.sequenceNumber=this.sequenceNumber+1>>0;let n=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 oA(l.mediaIds,this.sequenceNumber,this.timestamp,n,this.outBuffer.subarray(0,r));T(globalThis,["sendPacket",{connectionId:l.id,packet:d.toBytes()}])}}}onMessage(A){let[r,n]=A;switch(r){case"captureSetVad":this?.setVad(n);break;case"captureSetMedias":this?.setMedias(n.connections);break;case"close":this.close();break;case"dump":n.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:IA(this.information),speechProbability:vA(this.information),rmsDBFS:DA(this.information),volume:Zr(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}}}},PA=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=O(this.wasm,"u32",w.MaxNumberOfDecoders),this.information=kj(this.wasm,w.MaxNumberOfDecoders),hA(this.information,[1,1])}close(){uj(this.wasm,this.information);for(let{decoder:A}of this.medias.values())A.delete()}receivePacket(A,r){this.stats.numberPackets++;let n=oA.parse(r);if(n.type==="Failure"){this.stats.numberPacketError++;let l=Array.from(r).map(d=>d.toString(16).padStart(2,"0")).join("");console.error(\`failed decoding audio packet; reason: \${n.reason}, connection: \${A}, dump: \${l}\`);return}for(let l of n.value.mediaIds){let d=this.medias.get(HA({connectionId:A,mediaId:l}));if(d===void 0){this.stats.numberPacketsMediaNotFound++;continue}d.lastPacket=r;let q=O(this.wasm,"u8",n.value.payload.length);q.set(n.value.payload),d.decoder.push(n.value.sequenceNumber,n.value.timeStamp,n.value.isEndOfSpurt,q.byteOffset,q.length)}}insertMedia(A,r,n,l=[1,1]){let d=HA({connectionId:r,mediaId:n}),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),FA(this.information,A,l),Xr(this.information,A,0),Qr(this.information,A,0)}removeMedia(A,r,n){let l=HA({connectionId:r,mediaId:n}),d=this.medias.get(l);if(!(d===void 0||d.index!==A)&&(this.medias.delete(l),Vr(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[r,n]=A;switch(r){case"playbackReceivePacket":this.receivePacket(n.connectionId,n.packet);break;case"playbackUpdateMedias":for(let{index:l,connectionId:d,mediaId:q}of n.removed)this.removeMedia(l,d,q);for(let{index:l,connectionId:d,mediaId:q,volume:p}of n.added)this.insertMedia(l,d,q,p);break;case"close":this.close();break;case"dump":n.result.postMessage(this.dump());break}}dump(){let A=[];for(let[r,n]of this.medias){let l=aj(r);A.push({index:n.index,connectionId:l.connectionId,mediaId:l.mediaId,rmsDBFS:$A(this.information,n.index),volume:Rr(this.information,n.index),voicedBlocks:zr(this.information,n.index),silentBlocks:Wr(this.information,n.index),time:n.decoder.time,consecutive_silence:n.decoder.consecutive_silence,last_voiced_time_point:n.decoder.last_voiced_time_point,sequence_number:n.decoder.sequence_number,packetsSeen:n.decoder.packets_seen,packetsInvalid:n.decoder.packets_invalid,packetsTooLate:n.decoder.packets_too_late,packetsTooEarly:n.decoder.packets_too_early,packetsRepeated:n.decoder.packets_repeated,packetsProcessed:n.decoder.packets_processed,packetsLost:n.decoder.packets_lost,rewinds:n.decoder.rewinds,voiceAccelerated:n.decoder.voice_accelerated,silenceAccelerated:n.decoder.silence_accelerated,cacheLength:n.decoder.cache_length,lastPacket:Yr(n.lastPacket)})}return{largestIndex:this.largestIndex,globalVolume:Mr(this.information),decoders:A}}};var _j=ce(Fj()),Ij=(0,_j.default)(),vj,Dj;globalThis.addEventListener("message",sr);async function sr(e){let A=e.data,[r,n]=A;switch(r){case"captureInit":n.workletPort.onmessage=sr,vj=new lr(n.sampleRate,await Ij,n.refreshRate);break;case"playbackInit":n.workletPort.onmessage=sr,Dj=new ir(await Ij,n.workletPort,n.refreshRate);break;case"close":globalThis.close();break}vj?.onMessage(A),Dj?.onMessage(A)}var lr=class extends JA{constructor(r,n,l){super(r,n);this.sampleRate=r;this.inBuffer=O(this.wasm,"f32",r*.02),this.updateHandle=setInterval(()=>this.update(),l),T(globalThis,["captureReady",{}])}close(){super.close(),R(this.wasm,this.inBuffer),clearInterval(this.updateHandle)}onMessage(r){super.onMessage(r);let[n,l]=r;switch(n){case"captureSetVolume":this.setVolume(l.value);break;case"captureTick":this.tick(l.buffer);break}}setVolume(r){_A(this.information,r)}tick(r){this.inBuffer.set(r,0),this.encode(this.inBuffer)}update(){T(globalThis,["captureUpdate",{active:IA(this.information),rmsDBFs:DA(this.information),speechProbability:vA(this.information)}])}dump(){return{type:"unshared capture worker",sampleRate:this.sampleRate,...super.dump()}}},ir=class extends PA{constructor(r,n,l){super(r);this.workletPort=n;this.id=w.PlaybackPreload,this.outBuffer=O(this.wasm,"f32",48e3*.02*2),this.updateHandle=setInterval(()=>this.update(),l),T(globalThis,["playbackReady",{}])}close(){super.close(),R(this.wasm,this.outBuffer),clearInterval(this.updateHandle)}onMessage(r){super.onMessage(r);let[n,l]=r;switch(n){case"playbackSetVolume":this.setVolume(l.index,l.value);break;case"playbackTick":this.tick();break}}setVolume(r,n){r==="global"?hA(this.information,n):FA(this.information,r,n)}tick(){this.stats.numberTicks++,this.id+=1;let{hasAudio:r}=this.decode(this.outBuffer);if(r){let n=this.outBuffer.slice();T(this.workletPort,["samples",{id:this.id,buffer:n}],[n.buffer])}}update(){let r=new Float32Array(this.information.length*2);for(let l=0;l<=this.largestIndex;l++)r[l]=$A(this.information,l);let n=[];for(let[l,d]of this.medias)n[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:d.decoder.voice_accelerated,packetsInvalid:d.decoder.packets_invalid,packetsRepeated:d.decoder.packets_repeated,packetsLost:d.decoder.packets_lost};T(globalThis,["playbackUpdate",{activities:r,jitterStats:n}],[r.buffer])}dump(){return{type:"unshared playback worker",id:this.id,...super.dump()}}};})();
3212
+ `;var c='"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:()=>D,DefaultVideoCodec:()=>K,HealthCheckTimeout:()=>O,MainConnectionPingInterval:()=>W,MaxNumberOfDecoders:()=>L,MaxReconnectDuration:()=>Y,MinDBFs:()=>v,MinTokenLifetime:()=>Z,MinTokenRefreshInterval:()=>q,PlaybackPreload:()=>F,RenderQuantumSize:()=>V,VadPreload:()=>C,WebRtcAnswerTimeout:()=>J,WebRtcIceTimeout:()=>$,WebRtcMaxNegotiationAttempts:()=>z,WebRtcStatsSnapshotInterval:()=>j,WebRtcTimeout:()=>H});var R=3,E=3,F=3,D=250,C=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=12e4,K="H264";function d(e,t,r){return e.postMessage(t,r)}var X;(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||={})})(X||={});var{Deno:k}=globalThis,ee=typeof k?.noColor=="boolean"?k.noColor:!1,te=!ee;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 te?`${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 re(e){return h(e,m([2],22))}var Ie=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"),ne=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}"},se={4:re,3:p,2:p,1:U,0:U};function oe({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()-ne.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} ${se[e.level](String(e.message))}${n()}`}function ae(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 ie(){return typeof Deno=="object"&&Deno.stdout.isTerminal()}var w=class{static sparse=oe;static json=S;static pretty=I;static structured=ae;static default=ie()?I:S;constructor(){}};var ce=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 ce]),ue=o.prototype.log.bind(l,1),le=o.prototype.log.bind(l,2),fe=o.prototype.log.bind(l,3),de=o.prototype.log.bind(l,4),Te=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 vx=new Bx;function B0(r,D,x,F,A=C.DefaultRefreshRate){return vx.enqueue(async()=>{let[B,j]=await u(d,c,r,"OdinCaptureProcessor",{channelCount:1,numberOfInputs:1,numberOfOutputs:0});return console.warn("SharedArrayBuffer is not available; creating ODIN CaptureWorker in fallback mode"),q.create(r,D,x,A,B,j,F)})}async function v0(r,D=C.DefaultRefreshRate){if(r.sampleRate!==48e3)throw new Error("playback sample rate must be 48kHz ");let[x,F]=await u(d,c,r,"OdinPlaybackProcessor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]});return G.create(r,D,x,F)}var q=class r extends s{constructor(x,F,A,B,j){super(x,F,A,B,j);this._Activity=a;this._SpeechProbability=0;F.addEventListener("message",this._OnMessages.bind(this))}static async create(x,F,A,B,j,t,$){let{port1:p,port2:h}=new MessageChannel;return v(j,["captureInit",{sampleRate:x.sampleRate,refreshRate:B,workletPort:p}],[p]),await i(j,"captureReady"),v(t.port,["init",{workerPort:h}],[h]),new r(t,j,F,A,$)}get activity(){return this._Activity}get speechProbability(){return this._SpeechProbability}setVolume(x){v(this.worker,["captureSetVolume",{value:x}])}_OnMessages(x){super._OnMessages(x);let[F,A]=x.data;F==="captureUpdate"&&(this._Activity={isSilent:!A.active,rmsDBFS:A.rmsDBFs},this._SpeechProbability=A.speechProbability)}},G=class r extends b{constructor(x,F,A){super(x,F,A);this.activities=new Float32Array;this.jitterStats=[]}static async create(x,F,A,B){let{port1:j,port2:t}=new MessageChannel;return v(A,["playbackInit",{workletPort:j,refreshRate:F}],[j]),await i(A,"playbackReady"),v(B.port,["init",{workerPort:t}],[t]),new r(x,B,A)}getActivity(x){let F=this.medias.get(E(x));if(F===void 0)return;let A=this.activities.at(F.index);if(A!==void 0)return A===0?a:{isSilent:!1,rmsDBFS:A}}getJitterStats(x){let F=this.medias.get(E(x));if(F===void 0)return;let A=this.jitterStats.at(F.index);if(A!==void 0)return A}setGlobalVolume(x){v(this.worker,["playbackSetVolume",{index:"global",value:x}])}setVolume(x,F){let A=this.medias.get(E(x));A!==void 0&&v(this.worker,["playbackSetVolume",{index:A.index,value:F}])}_GetFreeIndex(){let x=super._GetFreeIndex();if(x!==void 0)return x;if(this.medias.size<C.MaxNumberOfDecoders)return this.medias.size}_OnMessages(x){super._OnMessages(x);let[F,A]=x.data;F==="playbackUpdate"&&(this.activities=A.activities,this.jitterStats=A.jitterStats)}};export{q as UnsharedCaptureWorker,G as UnsharedPlaybackWorker,B0 as createCaptureWorker,v0 as createPlaybackWorker};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4players/odin-plugin-web",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "A backend plugin providing the custom WebAssembly audio processing module for ODIN web clients",
5
5
  "homepage": "https://www.4players.io",
6
6
  "repository": {