@4players/odin-common 9.0.3 → 9.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/mod.js CHANGED
@@ -1 +1 @@
1
- var ve=Object.create;var M=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Pe=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var Ce=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},ee=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of Re(t))!Te.call(e,m)&&m!==n&&M(e,m,{get:()=>t[m],enumerable:!(s=ke(t,m))||s.enumerable});return e};var R=(e,t,n)=>(n=e!=null?ve(Pe(e)):{},ee(t||!e||!e.__esModule?M(n,"default",{value:e,enumerable:!0}):n,e)),Ae=e=>ee(M({},"__esModule",{value:!0}),e);var Mt={};Ce(Mt,{APM_DEFAULTS:()=>wt,Backend:()=>ge,ByteArraySchema:()=>b,CONNECTION_STATS_INITIAL:()=>Ct,ChannelSet:()=>O,ChannelSetSchema:()=>q,ConsoleSink:()=>J,Formatter:()=>fe,GLOBAL_LOGGER:()=>T,JITTER_STATS_INITIAL:()=>At,JsonSchema:()=>C,LogFilter:()=>F,LogLevel:()=>Q,Logger:()=>k,MainCommandsRpc:()=>je,MainNotificationSchema:()=>_e,MainNotificationsRpc:()=>Ie,MediaAudioPropertiesSchema:()=>ne,MediaIdSchema:()=>z,MediaPropertiesSchema:()=>j,MediaSchema:()=>U,MediaVideoPropertiesSchema:()=>oe,MessagePackRpcSchema:()=>we,MessageReceivedSchema:()=>N,MinDBFS:()=>Cr,PeerIdSchema:()=>x,PeerPositionSchema:()=>L,PeerSchema:()=>_,PeerUpdateSchema:()=>I,RoomCommandsRpc:()=>Ue,RoomNotificationSchema:()=>Be,RoomNotificationsRpc:()=>Oe,RoomV1:()=>v,RoomV2:()=>ae,Selector:()=>H,Strand:()=>Z,TokenAudienceSchema:()=>te,TokenClaimsSchema:()=>Me,TokenSubjectSchema:()=>re,VAD_DEFAULTS:()=>Lt,VideoCodec:()=>$,WebRtcUpdateSchema:()=>P,abortableSleep:()=>Xe,assert:()=>w,debug:()=>Pt,error:()=>vt,extendUrl:()=>tt,fail:()=>G,failure:()=>S,find:()=>We,fromBase64:()=>Ee,fromBase64Url:()=>De,fromBytes:()=>Je,generateUUID:()=>nt,info:()=>Rt,isAudioCapable:()=>qe,isBlinkBrowser:()=>pe,isElectronBrowser:()=>$e,isFailure:()=>lt,isFirefoxBrowser:()=>He,isFunction:()=>at,isNull:()=>st,isNumber:()=>pt,isObject:()=>ct,isProperty:()=>it,isSafariBrowser:()=>Ze,isSharedArrayBufferCapable:()=>Ge,isString:()=>ut,isSuccess:()=>mt,isUndefined:()=>dt,log:()=>Tt,nextTick:()=>Qe,normalizeUrl:()=>et,oneOrMany:()=>A,sleep:()=>Ke,success:()=>y,toBytes:()=>Fe,toRaw:()=>Ye,tryParseLogFilter:()=>St,unwrap:()=>Ne,unwrapOr:()=>E,validateUUID:()=>ot,warn:()=>kt});module.exports=Ae(Mt);var d=require("zod"),b=d.z.custom(e=>e instanceof Uint8Array),Le=d.z.union([d.z.string(),d.z.number(),d.z.boolean(),d.z.null()]),C=d.z.lazy(()=>d.z.union([Le,d.z.array(C),d.z.record(d.z.string(),C)])),we=d.z.union([d.z.tuple([d.z.literal(0),d.z.number(),d.z.string(),d.z.unknown()]),d.z.tuple([d.z.literal(1),d.z.number(),d.z.nullable(d.z.string()),d.z.unknown()]),d.z.tuple([d.z.literal(2),d.z.string(),d.z.unknown()])]);var c=require("zod"),te=c.z.enum(["sfu","gateway"]),re=c.z.enum(["connect","roomclose","roomupdate","roombanclient","roomsendmessage"]),Me=c.z.object({uid:c.z.string(),cid:c.z.optional(c.z.string()),rid:A(c.z.string()).refine(e=>e.length>=1,{message:"missing rid"}),nsp:c.z.optional(c.z.string()),adr:c.z.optional(c.z.string()),aud:c.z.optional(A(te)),sub:c.z.optional(A(re)),exp:c.z.optional(c.z.number()),nbf:c.z.optional(c.z.number()),ups:c.z.optional(c.z.string()),tgs:c.z.optional(A(c.z.string())),tsp:c.z.optional(c.z.number()),internal:c.z.optional(c.z.object({server:c.z.optional(c.z.string())}))});function A(e){return c.z.union([e.transform(t=>[t]),c.z.array(e)])}var r=R(require("zod"));var u=R(require("zod")),z=u.number(),ne=u.object({kind:u.optional(u.literal("audio")),uid:u.optional(u.string()),customType:u.optional(u.string())}),oe=u.object({kind:u.optional(u.literal("video")),codec:u.optional(u.string()),uid:u.optional(u.string()),customType:u.optional(u.string()),id:u.optional(u.string())}),j=u.union([ne,oe]),U=u.object({id:z,properties:j,paused:u.boolean()});var l=R(require("zod"));var x=l.number(),L=l.union([l.tuple([l.number(),l.number(),l.number()]),l.tuple([l.number(),l.number()])]),_=l.object({id:x,user_id:l.string(),user_data:b,medias:l.array(U)}),I=l.discriminatedUnion("kind",[l.object({kind:l.literal("UserDataChanged"),peer_id:x,user_data:b}),l.object({kind:l.literal("MediaStarted"),peer_id:x,media:U}),l.object({kind:l.literal("MediaStopped"),peer_id:x,media_id:z})]);var ie=R(require("zod")),O=class e{constructor(t=BigInt(0)){this.value=t}from(...t){let n=t.reduce((s,m)=>s|B(m),BigInt(0));return new e(n)}contains(t){return(this.value&B(t))!==BigInt(0)}insert(t){this.value|=B(t)}remove(t){this.value&=~B(t)}[Symbol.iterator](){let t=-1,n=new e(this.value);return{next(){for(;t<63;)if(t+=1,n.contains(t))return{value:t,done:!1};return{value:void 0,done:!0}}}}},q=ie.bigint().transform(e=>new O(e));function B(e){return BigInt(1)<<BigInt(e)}var v;(p=>(p.RoomIdSchema=r.string(),p.RoomSchema=r.object({id:p.RoomIdSchema,customer:r.string(),user_data:b,peers:r.array(_)}),p.RoomUpdateSchema=r.discriminatedUnion("kind",[r.object({kind:r.literal("Joined"),room:p.RoomSchema,media_ids:r.array(z),own_peer_id:x}),r.object({kind:r.literal("Left"),reason:r.enum(["RoomClosing","ServerClosing","PeerKicked"])}),r.object({kind:r.literal("UserDataChanged"),user_data:r.optional(b)}),r.object({kind:r.literal("PeerJoined"),peer:_}),r.object({kind:r.literal("PeerLeft"),peer_id:x})]),p.RoomUpdatesSchema=r.object({updates:r.array(p.RoomUpdateSchema)}),p.RoomStatusSchema=r.enum(["Joining","Joined","Closed"]),p.RoomStatusChangedSchema=r.object({status:p.RoomStatusSchema,message:r.optional(r.string())})))(v||={});var ae;(i=>(i.ParametersSchema=r.record(C),i.PeerProperties=r.object({user_data:b.optional(),tags:r.array(r.string()).optional(),audio_parameters:i.ParametersSchema.optional(),video_parameters:i.ParametersSchema.optional()}),i.PingSchema=r.object({Ping:r.object({id:r.number()})}),i.ChangeSelfSchema=r.object({ChangeSelf:i.PeerProperties.omit({tags:!0})}),i.SetAudioMaskSchema=r.object({SetAudioMask:r.object({peer_id:r.number(),mask:q})}),i.SendMessageSchema=r.object({SendMessage:r.object({peer_ids:r.number().array().default([]),message:b})}),i.CallSchema=i.PingSchema.or(i.ChangeSelfSchema).or(i.SetAudioMaskSchema).or(i.SendMessageSchema),i.PongSchema=r.object({Pong:r.object({id:r.number()})}),i.JoinedSchema=r.object({Joined:r.object({own_peer_id:r.number(),room_id:r.string(),customer:r.string()})}),i.LeftSchema=r.object({Left:r.object({reason:r.enum(["room_closing","server_closing","peer_kicked"])})}),i.PeerJoinedSchema=r.object({PeerJoined:i.PeerProperties.extend({peer_id:r.number(),user_id:r.string()})}),i.PeerLeftSchema=r.object({PeerLeft:r.object({peer_id:r.number()})}),i.PeerChangedSchema=r.object({PeerChanged:i.PeerProperties.extend({peer_id:r.number()})}),i.NewReconnectTokenSchema=r.object({NewReconnectToken:r.object({token:r.string()})}),i.MessageReceivedSchema=r.object({MessageReceived:r.object({sender_peer_id:r.number(),message:b})}),i.ErrorSchema=r.object({Error:r.object({message:b})}),i.EventSchema=i.PongSchema.or(i.JoinedSchema).or(i.LeftSchema).or(i.PeerJoinedSchema).or(i.PeerLeftSchema).or(i.PeerChangedSchema).or(i.NewReconnectTokenSchema).or(i.MessageReceivedSchema).or(i.ErrorSchema)))(ae||={});var se=require("zod");var N=se.z.object({sender_peer_id:x,message:b});var a=R(require("zod"));var P=a.discriminatedUnion("kind",[a.object({kind:a.literal("Sdp"),type:a.enum(["Answer","Offer"]),sdp:a.string(),media_map:a.array(a.tuple([z,a.string()]))}),a.object({kind:a.literal("Trickle"),candidate:a.string(),spd_mid:a.optional(a.string()),spd_mline_index:a.optional(a.number()),username_fragment:a.optional(a.union([a.string(),a.null()]))}),a.object({kind:a.literal("TrickleFinished")})]);var o=require("zod");var je={Hello:{request:o.z.object({stream:o.z.literal("main")}),response:o.z.null()},JoinRoom:{request:o.z.object({token:o.z.string(),room_id:v.RoomIdSchema,user_data:b,position:L}),response:o.z.object({peer_id:x,stream_id:o.z.optional(o.z.number()),token:o.z.optional(o.z.string())})},WebRtcUpdate:{request:P,response:o.z.null()},RequestReconnectToken:{request:o.z.object({peer_id:o.z.optional(x)}),response:o.z.string()},Ping:{request:o.z.object({}),response:o.z.null()}},Ue={Hello:{request:o.z.object({stream:o.z.literal("room"),token:o.z.string(),room_id:o.z.string(),user_data:b,position:L}),response:o.z.null()},UpdatePeer:{request:o.z.object({user_data:b}),response:o.z.null()},StartMedia:{request:o.z.object({media_id:z,properties:j}),response:o.z.null()},StopMedia:{request:o.z.object({media_id:z}),response:o.z.null()},PauseMedia:{request:o.z.object({media_id:z}),response:o.z.null()},ResumeMedia:{request:o.z.object({media_id:z}),response:o.z.null()},SetPeerPosition:{request:o.z.object({position:L}),response:o.z.null()},SendMessage:{request:o.z.object({target_peer_ids:o.z.optional(o.z.array(x)),message:b}),response:o.z.null()}};var h=R(require("zod"));var _e=h.object({name:h.literal("WebRtcUpdate"),properties:P}),Ie={WebRtcUpdate:P},Be=h.union([h.object({name:h.literal("RoomStatusChanged"),properties:v.RoomStatusChangedSchema}),h.object({name:h.literal("RoomUpdated"),properties:v.RoomUpdatesSchema}),h.object({name:h.literal("PeerUpdated"),properties:I}),h.object({name:h.literal("MessageReceived"),properties:N})]),Oe={RoomStatusChanged:v.RoomStatusChangedSchema,RoomUpdated:v.RoomUpdatesSchema,PeerUpdated:I,MessageReceived:N};function w(e,t){e||G(t)}function G(e){throw new Error(e)}function y(e){return{type:"Success",value:e}}function S(e){return{type:"Failure",reason:e}}function Ne(e){return e.type==="Failure"&&G(e.reason),e.value}function E(e,t){return e.type==="Success"?e.value:t}function Ee(e){try{let t=atob(e),n=Uint8Array.from(t,m=>m.codePointAt(0)),s=new TextDecoder("utf8");return y(s.decode(n))}catch(t){return S(String(t))}}function De(e){try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=Uint8Array.from(t,m=>m.codePointAt(0)),s=new TextDecoder("utf8");return y(s.decode(n))}catch(t){return S(String(t))}}function Fe(e){try{w(e!==void 0,"undefined cannot be converted to byte array"),w(e!==null,"null cannot be converted to byte array");let t=JSON.stringify(e),n=new TextEncoder;return y(n.encode(t))}catch(t){return S(String(t))}}function Je(e){try{w(e.length>0,"empty byte array cannot be converted to value");let t=new TextDecoder().decode(e),n=JSON.parse(t);return y(n)}catch(t){return S(String(t))}}var Ve=["VP8","VP9","AV1","H264"],$=class{constructor(t){this.codec=t}channels=0;clockRate=9e4;isValid(){return Ve.includes(this.codec)}isSupported(){if(typeof RTCRtpReceiver>"u"||typeof RTCRtpReceiver.getCapabilities>"u")return null;let t=E(this.getMimeType(),"").toLowerCase(),n=new Set(E(this.getSdpFmtpLine(),"").split(";").map(s=>s.trim().toLowerCase()));return RTCRtpReceiver.getCapabilities("video")?.codecs?.find(s=>{let m=s.mimeType.toLowerCase(),f=new Set((s.sdpFmtpLine??"").split(";").map(p=>p.trim().toLowerCase()));if(t!==m||n.size!==f.size)return!1;for(let p of n)if(!f.has(p))return!1;return!0})??null}getPayloadType(){switch(this.codec){case"VP8":return y(96);case"VP9":return y(98);case"AV1":return y(41);case"H264":return y(102);default:return S("invalid video codec")}}getMimeType(){switch(this.codec){case"VP8":return y("video/VP8");case"VP9":return y("video/VP9");case"AV1":return y("video/AV1");case"H264":return y("video/H264");default:return S("invalid video codec")}}getSdpFmtpLine(){switch(this.codec){case"VP8":return y("");case"VP9":return y("profile-id=2");case"AV1":return y("level-idx=5;profile=0;tier=0");case"H264":return y("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f");default:return S("invalid video codec")}}};function We(e,t){for(let n of e)if(t(n))return n}function qe(){return typeof AudioContext<"u"&&typeof Worker<"u"}function Ge(){return typeof SharedArrayBuffer<"u"}function pe(){return/(apple)?webkit\/537\.36/i.test(globalThis.navigator.userAgent)}function $e(){return/electron/i.test(globalThis.navigator.userAgent)}function He(){return/firefox|iceweasel|fxios/i.test(globalThis.navigator.userAgent)}function Ze(){return pe()?!1:/safari|applewebkit/i.test(globalThis.navigator.userAgent)}function Ye(e){return JSON.parse(JSON.stringify(e))}var H=class e{constructor(t){this._Generators=t;this._Futures=t.map(e.addIndex)}_Futures;async next(){let[t,n]=await Promise.race(this._Futures);return this._Futures[n]=e.addIndex(this._Generators[n],n),t}static async addIndex(t,n){return[await t(),n]}};function Ke(e,t){return e<=0?Promise.resolve(t):new Promise(n=>setTimeout(()=>n(t),e))}function Xe(e,t){return t.aborted?Promise.resolve("aborted"):new Promise(n=>{let s=()=>n("aborted");t.addEventListener("abort",s,{once:!0}),setTimeout(()=>{t.removeEventListener("abort",s),n(void 0)},e)})}function Qe(){return new Promise(e=>setTimeout(e,0))}var Z=class{_Tasks=[];_Running=!1;_Values;constructor(...t){this._Values=t}enqueue(t){return new Promise((n,s)=>{let m=async()=>{try{let f=await t(...this._Values);n(f)}catch(f){s(f)}};this._Tasks.push(m),this._Running||this.execute()})}async execute(){for(this._Running=!0;;){let t=this._Tasks.shift();if(t===void 0)break;await t()}this._Running=!1}};function et(e){let t=e.trim();e.indexOf("://")===-1&&(t=`https://${t}`);try{return y(new URL(t))}catch(n){return S(String(n))}}function tt(e,t){let n=e.pathname;n.endsWith("/")===!1&&(n+="/");try{return y(new URL(n+t,e))}catch(s){return S(String(s))}}var rt=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function nt(){return crypto.randomUUID()}function ot(e){return rt.test(e)}function it(e,t){return t in e}function at(e){return typeof e=="function"}function st(e){return typeof e=="object"&&e===null}function pt(e){return typeof e=="number"}function ct(e){return typeof e=="object"}function ut(e){return typeof e=="string"}function dt(e){return typeof e>"u"}function lt(e){return e.type==="Failure"}function mt(e){return e.type==="Success"}var{Deno:ce}=globalThis,ft=typeof ce?.noColor=="boolean"?ce.noColor:!1,gt=!ft;function Y(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}function K(e,t){return gt?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function D(e){return K(e,Y([0],0))}function X(e){return K(e,Y([1],22))}function ue(e){return K(e,Y([2],22))}var Pr=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");var F=(g=>(g[g.Nothing=0]="Nothing",g[g.CRITICAL=1]="CRITICAL",g[g.ERROR=2]="ERROR",g[g.WARN=3]="WARN",g[g.INFO=4]="INFO",g[g.DEBUG=5]="DEBUG",g[g.Everything=6]="Everything",g))(F||{}),bt=new Date,Q=(f=>(f[f.CRITICAL=1]="CRITICAL",f[f.ERROR=2]="ERROR",f[f.WARN=3]="WARN",f[f.INFO=4]="INFO",f[f.DEBUG=5]="DEBUG",f))(Q||{}),xt={1:"\u{1F4A5}",2:"\u{1F534}",3:"\u{1F7E1}",4:"\u{1F535}",5:"\u{1F7E3}"},ht={5:ue,4:D,3:D,2:X,1:X};function St(e){for(let t of Object.keys(F))if(isNaN(Number(t))!==!1&&t.localeCompare(e,void 0,{sensitivity:"accent"})===0)return F[t]}function zt({message:e}){return String(e)}function de(e){return JSON.stringify({timestamp:e.date.toISOString(),level:Q[e.level],message:e.message,extra:e.extra})}function le(e){function t(p,g){return[Math.floor(p/g),p%g]}function n(){let p,g=e.date.valueOf()-bt.valueOf();[g,p]=t(g,1e3);let[V,W]=t(g,60);return`${V.toString().padStart(4,"0")}:${W.toString().padStart(2,"0")}.${p.toString().padStart(4,"0")}`}function s(){return e.extra===void 0?"":"Deno"in globalThis?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let m=xt[e.level],f=e.logger.name!==void 0?`@${e.logger}`:"";return`${D(n())}${f} ${m} ${ht[e.level](String(e.message))}${s()}`}var fe={sparse:zt,json:de,pretty:le,default:"Deno"in globalThis&&Deno.stdout.isTerminal()?le:de},J=class{#e;#t;filter;constructor(t=fe.default,n=6,s=console){this.filter=n,this.#e=t,this.#t=s}handle(t){let n=this.#e(t);switch(t.level){case 2:this.#t.error(n);break;case 3:this.#t.warn(n);break;case 4:this.#t.info(n);break;case 5:this.#t.debug(n);break}}},k=class{#e;sinks;filter;get name(){return this.#e}constructor(t,n=void 0,s=[new J]){this.#e=n,this.sinks=s,this.filter=t}log(t,n,s=void 0){if(this.filter<t)return;let m=me;for(let f of this.sinks)f.filter<t||(m===me&&(m={date:new Date,level:t,logger:this,message:typeof n=="function"?n():n,extra:s}),f.handle(m))}error=this.log.bind(this,2);warn=this.log.bind(this,3);info=this.log.bind(this,4);debug=this.log.bind(this,5)},T=new k(4),vt=k.prototype.log.bind(T,2),kt=k.prototype.log.bind(T,3),Rt=k.prototype.log.bind(T,4),Pt=k.prototype.log.bind(T,5),Tt=k.prototype.log.bind(T),me=Symbol();var Cr=-758.596,ge;(t=>{let e;(p=>(p[p.InvalidPassword=-1]="InvalidPassword",p[p.Unknown=0]="Unknown",p[p.Unencrypted=1]="Unencrypted",p[p.Encrypted=2]="Encrypted"))(e=t.PeerCipherStatus||={})})(ge||={});var Ct={bytesSent:0,bytesReceived:0,packetsSent:0,packetsReceived:0,rtt:0,packetLoss:0},At={packetsBuffered:0,packetsSeen:0,packetsProcessed:0,packetsTooEarly:0,packetsTooLate:0,packetsDropped:0,packetsInvalid:0,packetsRepeated:0,packetsLost:0},Lt={voiceActivity:{attackThreshold:.9,releaseThreshold:.8},volumeGate:{attackThreshold:-30,releaseThreshold:-40}},wt={echoCanceller:!0,highPassFilter:!1,noiseSuppression:"Moderate",transientSuppressor:!1,gainController:!0};0&&(module.exports={APM_DEFAULTS,Backend,ByteArraySchema,CONNECTION_STATS_INITIAL,ChannelSet,ChannelSetSchema,ConsoleSink,Formatter,GLOBAL_LOGGER,JITTER_STATS_INITIAL,JsonSchema,LogFilter,LogLevel,Logger,MainCommandsRpc,MainNotificationSchema,MainNotificationsRpc,MediaAudioPropertiesSchema,MediaIdSchema,MediaPropertiesSchema,MediaSchema,MediaVideoPropertiesSchema,MessagePackRpcSchema,MessageReceivedSchema,MinDBFS,PeerIdSchema,PeerPositionSchema,PeerSchema,PeerUpdateSchema,RoomCommandsRpc,RoomNotificationSchema,RoomNotificationsRpc,RoomV1,RoomV2,Selector,Strand,TokenAudienceSchema,TokenClaimsSchema,TokenSubjectSchema,VAD_DEFAULTS,VideoCodec,WebRtcUpdateSchema,abortableSleep,assert,debug,error,extendUrl,fail,failure,find,fromBase64,fromBase64Url,fromBytes,generateUUID,info,isAudioCapable,isBlinkBrowser,isElectronBrowser,isFailure,isFirefoxBrowser,isFunction,isNull,isNumber,isObject,isProperty,isSafariBrowser,isSharedArrayBufferCapable,isString,isSuccess,isUndefined,log,nextTick,normalizeUrl,oneOrMany,sleep,success,toBytes,toRaw,tryParseLogFilter,unwrap,unwrapOr,validateUUID,warn});
1
+ var ke=Object.create;var M=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Te=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Ae=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},ee=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of Pe(t))!Ce.call(e,m)&&m!==n&&M(e,m,{get:()=>t[m],enumerable:!(s=Re(t,m))||s.enumerable});return e};var R=(e,t,n)=>(n=e!=null?ke(Te(e)):{},ee(t||!e||!e.__esModule?M(n,"default",{value:e,enumerable:!0}):n,e)),Le=e=>ee(M({},"__esModule",{value:!0}),e);var Mt={};Ae(Mt,{APM_DEFAULTS:()=>wt,Backend:()=>ye,ByteArraySchema:()=>b,CONNECTION_STATS_INITIAL:()=>Ct,ChannelSet:()=>O,ChannelSetSchema:()=>q,ConsoleSink:()=>J,Formatter:()=>ge,GLOBAL_LOGGER:()=>T,JITTER_STATS_INITIAL:()=>At,JsonSchema:()=>C,LogFilter:()=>F,LogLevel:()=>Q,LogSymbols:()=>fe,Logger:()=>k,MainCommandsRpc:()=>Ue,MainNotificationSchema:()=>Ie,MainNotificationsRpc:()=>Be,MediaAudioPropertiesSchema:()=>ne,MediaIdSchema:()=>z,MediaPropertiesSchema:()=>j,MediaSchema:()=>U,MediaVideoPropertiesSchema:()=>oe,MessagePackRpcSchema:()=>Me,MessageReceivedSchema:()=>N,MinDBFS:()=>Cr,PeerIdSchema:()=>x,PeerPositionSchema:()=>L,PeerSchema:()=>_,PeerUpdateSchema:()=>I,RoomCommandsRpc:()=>_e,RoomNotificationSchema:()=>Oe,RoomNotificationsRpc:()=>Ne,RoomV1:()=>v,RoomV2:()=>ae,Selector:()=>H,Strand:()=>Z,TokenAudienceSchema:()=>te,TokenClaimsSchema:()=>je,TokenSubjectSchema:()=>re,VAD_DEFAULTS:()=>Lt,VideoCodec:()=>$,WebRtcUpdateSchema:()=>P,abortableSleep:()=>Qe,assert:()=>w,debug:()=>Pt,error:()=>vt,extendUrl:()=>rt,fail:()=>G,failure:()=>S,find:()=>qe,fromBase64:()=>De,fromBase64Url:()=>Fe,fromBytes:()=>Ve,generateUUID:()=>ot,info:()=>Rt,isAudioCapable:()=>Ge,isBlinkBrowser:()=>pe,isElectronBrowser:()=>He,isFailure:()=>mt,isFirefoxBrowser:()=>Ze,isFunction:()=>st,isNull:()=>pt,isNumber:()=>ct,isObject:()=>ut,isProperty:()=>at,isSafariBrowser:()=>Ye,isSharedArrayBufferCapable:()=>$e,isString:()=>dt,isSuccess:()=>ft,isUndefined:()=>lt,log:()=>Tt,nextTick:()=>et,normalizeUrl:()=>tt,oneOrMany:()=>A,sleep:()=>Xe,success:()=>y,toBytes:()=>Je,toRaw:()=>Ke,tryParseLogFilter:()=>St,unwrap:()=>Ee,unwrapOr:()=>E,validateUUID:()=>it,warn:()=>kt});module.exports=Le(Mt);var d=require("zod"),b=d.z.custom(e=>e instanceof Uint8Array),we=d.z.union([d.z.string(),d.z.number(),d.z.boolean(),d.z.null()]),C=d.z.lazy(()=>d.z.union([we,d.z.array(C),d.z.record(d.z.string(),C)])),Me=d.z.union([d.z.tuple([d.z.literal(0),d.z.number(),d.z.string(),d.z.unknown()]),d.z.tuple([d.z.literal(1),d.z.number(),d.z.nullable(d.z.string()),d.z.unknown()]),d.z.tuple([d.z.literal(2),d.z.string(),d.z.unknown()])]);var c=require("zod"),te=c.z.enum(["sfu","gateway"]),re=c.z.enum(["connect","roomclose","roomupdate","roombanclient","roomsendmessage"]),je=c.z.object({uid:c.z.string(),cid:c.z.optional(c.z.string()),rid:A(c.z.string()).refine(e=>e.length>=1,{message:"missing rid"}),nsp:c.z.optional(c.z.string()),adr:c.z.optional(c.z.string()),aud:c.z.optional(A(te)),sub:c.z.optional(A(re)),exp:c.z.optional(c.z.number()),nbf:c.z.optional(c.z.number()),ups:c.z.optional(c.z.string()),tgs:c.z.optional(A(c.z.string())),tsp:c.z.optional(c.z.number()),internal:c.z.optional(c.z.object({server:c.z.optional(c.z.string())}))});function A(e){return c.z.union([e.transform(t=>[t]),c.z.array(e)])}var r=R(require("zod"));var u=R(require("zod")),z=u.number(),ne=u.object({kind:u.optional(u.literal("audio")),uid:u.optional(u.string()),customType:u.optional(u.string())}),oe=u.object({kind:u.optional(u.literal("video")),codec:u.optional(u.string()),uid:u.optional(u.string()),customType:u.optional(u.string()),id:u.optional(u.string())}),j=u.union([ne,oe]),U=u.object({id:z,properties:j,paused:u.boolean()});var l=R(require("zod"));var x=l.number(),L=l.union([l.tuple([l.number(),l.number(),l.number()]),l.tuple([l.number(),l.number()])]),_=l.object({id:x,user_id:l.string(),user_data:b,medias:l.array(U)}),I=l.discriminatedUnion("kind",[l.object({kind:l.literal("UserDataChanged"),peer_id:x,user_data:b}),l.object({kind:l.literal("MediaStarted"),peer_id:x,media:U}),l.object({kind:l.literal("MediaStopped"),peer_id:x,media_id:z})]);var ie=R(require("zod")),O=class e{constructor(t=BigInt(0)){this.value=t}from(...t){let n=t.reduce((s,m)=>s|B(m),BigInt(0));return new e(n)}contains(t){return(this.value&B(t))!==BigInt(0)}insert(t){this.value|=B(t)}remove(t){this.value&=~B(t)}[Symbol.iterator](){let t=-1,n=new e(this.value);return{next(){for(;t<63;)if(t+=1,n.contains(t))return{value:t,done:!1};return{value:void 0,done:!0}}}}},q=ie.bigint().transform(e=>new O(e));function B(e){return BigInt(1)<<BigInt(e)}var v;(p=>(p.RoomIdSchema=r.string(),p.RoomSchema=r.object({id:p.RoomIdSchema,customer:r.string(),user_data:b,peers:r.array(_)}),p.RoomUpdateSchema=r.discriminatedUnion("kind",[r.object({kind:r.literal("Joined"),room:p.RoomSchema,media_ids:r.array(z),own_peer_id:x}),r.object({kind:r.literal("Left"),reason:r.enum(["RoomClosing","ServerClosing","PeerKicked"])}),r.object({kind:r.literal("UserDataChanged"),user_data:r.optional(b)}),r.object({kind:r.literal("PeerJoined"),peer:_}),r.object({kind:r.literal("PeerLeft"),peer_id:x})]),p.RoomUpdatesSchema=r.object({updates:r.array(p.RoomUpdateSchema)}),p.RoomStatusSchema=r.enum(["Joining","Joined","Closed"]),p.RoomStatusChangedSchema=r.object({status:p.RoomStatusSchema,message:r.optional(r.string())})))(v||={});var ae;(i=>(i.ParametersSchema=r.record(r.string(),C),i.PeerProperties=r.object({user_data:b.optional(),tags:r.array(r.string()).optional(),audio_parameters:i.ParametersSchema.optional(),video_parameters:i.ParametersSchema.optional()}),i.PingSchema=r.object({Ping:r.object({id:r.number()})}),i.ChangeSelfSchema=r.object({ChangeSelf:i.PeerProperties.omit({tags:!0})}),i.SetAudioMaskSchema=r.object({SetAudioMask:r.object({peer_id:r.number(),mask:q})}),i.SendMessageSchema=r.object({SendMessage:r.object({peer_ids:r.number().array().default([]),message:b})}),i.CallSchema=i.PingSchema.or(i.ChangeSelfSchema).or(i.SetAudioMaskSchema).or(i.SendMessageSchema),i.PongSchema=r.object({Pong:r.object({id:r.number()})}),i.JoinedSchema=r.object({Joined:r.object({own_peer_id:r.number(),room_id:r.string(),customer:r.string()})}),i.LeftSchema=r.object({Left:r.object({reason:r.enum(["room_closing","server_closing","peer_kicked"])})}),i.PeerJoinedSchema=r.object({PeerJoined:i.PeerProperties.extend({peer_id:r.number(),user_id:r.string()})}),i.PeerLeftSchema=r.object({PeerLeft:r.object({peer_id:r.number()})}),i.PeerChangedSchema=r.object({PeerChanged:i.PeerProperties.extend({peer_id:r.number()})}),i.NewReconnectTokenSchema=r.object({NewReconnectToken:r.object({token:r.string()})}),i.MessageReceivedSchema=r.object({MessageReceived:r.object({sender_peer_id:r.number(),message:b})}),i.ErrorSchema=r.object({Error:r.object({message:b})}),i.EventSchema=i.PongSchema.or(i.JoinedSchema).or(i.LeftSchema).or(i.PeerJoinedSchema).or(i.PeerLeftSchema).or(i.PeerChangedSchema).or(i.NewReconnectTokenSchema).or(i.MessageReceivedSchema).or(i.ErrorSchema)))(ae||={});var se=require("zod");var N=se.z.object({sender_peer_id:x,message:b});var a=R(require("zod"));var P=a.discriminatedUnion("kind",[a.object({kind:a.literal("Sdp"),type:a.enum(["Answer","Offer"]),sdp:a.string(),media_map:a.array(a.tuple([z,a.string()]))}),a.object({kind:a.literal("Trickle"),candidate:a.string(),spd_mid:a.optional(a.string()),spd_mline_index:a.optional(a.number()),username_fragment:a.optional(a.union([a.string(),a.null()]))}),a.object({kind:a.literal("TrickleFinished")})]);var o=require("zod");var Ue={Hello:{request:o.z.object({stream:o.z.literal("main")}),response:o.z.null()},JoinRoom:{request:o.z.object({token:o.z.string(),room_id:v.RoomIdSchema,user_data:b,position:L}),response:o.z.object({peer_id:x,stream_id:o.z.optional(o.z.number()),token:o.z.optional(o.z.string())})},WebRtcUpdate:{request:P,response:o.z.null()},RequestReconnectToken:{request:o.z.object({peer_id:o.z.optional(x)}),response:o.z.string()},Ping:{request:o.z.object({}),response:o.z.null()}},_e={Hello:{request:o.z.object({stream:o.z.literal("room"),token:o.z.string(),room_id:o.z.string(),user_data:b,position:L}),response:o.z.null()},UpdatePeer:{request:o.z.object({user_data:b}),response:o.z.null()},StartMedia:{request:o.z.object({media_id:z,properties:j}),response:o.z.null()},StopMedia:{request:o.z.object({media_id:z}),response:o.z.null()},PauseMedia:{request:o.z.object({media_id:z}),response:o.z.null()},ResumeMedia:{request:o.z.object({media_id:z}),response:o.z.null()},SetPeerPosition:{request:o.z.object({position:L}),response:o.z.null()},SendMessage:{request:o.z.object({target_peer_ids:o.z.optional(o.z.array(x)),message:b}),response:o.z.null()}};var h=R(require("zod"));var Ie=h.object({name:h.literal("WebRtcUpdate"),properties:P}),Be={WebRtcUpdate:P},Oe=h.union([h.object({name:h.literal("RoomStatusChanged"),properties:v.RoomStatusChangedSchema}),h.object({name:h.literal("RoomUpdated"),properties:v.RoomUpdatesSchema}),h.object({name:h.literal("PeerUpdated"),properties:I}),h.object({name:h.literal("MessageReceived"),properties:N})]),Ne={RoomStatusChanged:v.RoomStatusChangedSchema,RoomUpdated:v.RoomUpdatesSchema,PeerUpdated:I,MessageReceived:N};function w(e,t){e||G(t)}function G(e){throw new Error(e)}function y(e){return{type:"Success",value:e}}function S(e){return{type:"Failure",reason:e}}function Ee(e){return e.type==="Failure"&&G(e.reason),e.value}function E(e,t){return e.type==="Success"?e.value:t}function De(e){try{let t=atob(e),n=Uint8Array.from(t,m=>m.codePointAt(0)),s=new TextDecoder("utf8");return y(s.decode(n))}catch(t){return S(String(t))}}function Fe(e){try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=Uint8Array.from(t,m=>m.codePointAt(0)),s=new TextDecoder("utf8");return y(s.decode(n))}catch(t){return S(String(t))}}function Je(e){try{w(e!==void 0,"undefined cannot be converted to byte array"),w(e!==null,"null cannot be converted to byte array");let t=JSON.stringify(e),n=new TextEncoder;return y(n.encode(t))}catch(t){return S(String(t))}}function Ve(e){try{w(e.length>0,"empty byte array cannot be converted to value");let t=new TextDecoder().decode(e),n=JSON.parse(t);return y(n)}catch(t){return S(String(t))}}var We=["VP8","VP9","AV1","H264"],$=class{constructor(t){this.codec=t}channels=0;clockRate=9e4;isValid(){return We.includes(this.codec)}isSupported(){if(typeof RTCRtpReceiver>"u"||typeof RTCRtpReceiver.getCapabilities>"u")return null;let t=E(this.getMimeType(),"").toLowerCase(),n=new Set(E(this.getSdpFmtpLine(),"").split(";").map(s=>s.trim().toLowerCase()));return RTCRtpReceiver.getCapabilities("video")?.codecs?.find(s=>{let m=s.mimeType.toLowerCase(),f=new Set((s.sdpFmtpLine??"").split(";").map(p=>p.trim().toLowerCase()));if(t!==m||n.size!==f.size)return!1;for(let p of n)if(!f.has(p))return!1;return!0})??null}getPayloadType(){switch(this.codec){case"VP8":return y(96);case"VP9":return y(98);case"AV1":return y(41);case"H264":return y(102);default:return S("invalid video codec")}}getMimeType(){switch(this.codec){case"VP8":return y("video/VP8");case"VP9":return y("video/VP9");case"AV1":return y("video/AV1");case"H264":return y("video/H264");default:return S("invalid video codec")}}getSdpFmtpLine(){switch(this.codec){case"VP8":return y("");case"VP9":return y("profile-id=2");case"AV1":return y("level-idx=5;profile=0;tier=0");case"H264":return y("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f");default:return S("invalid video codec")}}};function qe(e,t){for(let n of e)if(t(n))return n}function Ge(){return typeof AudioContext<"u"&&typeof Worker<"u"}function $e(){return typeof SharedArrayBuffer<"u"}function pe(){return/(apple)?webkit\/537\.36/i.test(globalThis.navigator.userAgent)}function He(){return/electron/i.test(globalThis.navigator.userAgent)}function Ze(){return/firefox|iceweasel|fxios/i.test(globalThis.navigator.userAgent)}function Ye(){return pe()?!1:/safari|applewebkit/i.test(globalThis.navigator.userAgent)}function Ke(e){return JSON.parse(JSON.stringify(e))}var H=class e{constructor(t){this._Generators=t;this._Futures=t.map(e.addIndex)}_Futures;async next(){let[t,n]=await Promise.race(this._Futures);return this._Futures[n]=e.addIndex(this._Generators[n],n),t}static async addIndex(t,n){return[await t(),n]}};function Xe(e,t){return e<=0?Promise.resolve(t):new Promise(n=>setTimeout(()=>n(t),e))}function Qe(e,t){return t.aborted?Promise.resolve("aborted"):new Promise(n=>{let s=()=>n("aborted");t.addEventListener("abort",s,{once:!0}),setTimeout(()=>{t.removeEventListener("abort",s),n(void 0)},e)})}function et(){return new Promise(e=>setTimeout(e,0))}var Z=class{_Tasks=[];_Running=!1;_Values;constructor(...t){this._Values=t}enqueue(t){return new Promise((n,s)=>{let m=async()=>{try{let f=await t(...this._Values);n(f)}catch(f){s(f)}};this._Tasks.push(m),this._Running||this.execute()})}async execute(){for(this._Running=!0;;){let t=this._Tasks.shift();if(t===void 0)break;await t()}this._Running=!1}};function tt(e){let t=e.trim();e.indexOf("://")===-1&&(t=`https://${t}`);try{return y(new URL(t))}catch(n){return S(String(n))}}function rt(e,t){let n=e.pathname;n.endsWith("/")===!1&&(n+="/");try{return y(new URL(n+t,e))}catch(s){return S(String(s))}}var nt=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function ot(){return crypto.randomUUID()}function it(e){return nt.test(e)}function at(e,t){return t in e}function st(e){return typeof e=="function"}function pt(e){return typeof e=="object"&&e===null}function ct(e){return typeof e=="number"}function ut(e){return typeof e=="object"}function dt(e){return typeof e=="string"}function lt(e){return typeof e>"u"}function mt(e){return e.type==="Failure"}function ft(e){return e.type==="Success"}var{Deno:ce}=globalThis,gt=typeof ce?.noColor=="boolean"?ce.noColor:!1,yt=!gt;function Y(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}function K(e,t){return yt?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function D(e){return K(e,Y([0],0))}function X(e){return K(e,Y([1],22))}function ue(e){return K(e,Y([2],22))}var Pr=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");var F=(g=>(g[g.Nothing=0]="Nothing",g[g.CRITICAL=1]="CRITICAL",g[g.ERROR=2]="ERROR",g[g.WARN=3]="WARN",g[g.INFO=4]="INFO",g[g.DEBUG=5]="DEBUG",g[g.Everything=6]="Everything",g))(F||{}),xt=new Date,Q=(f=>(f[f.CRITICAL=1]="CRITICAL",f[f.ERROR=2]="ERROR",f[f.WARN=3]="WARN",f[f.INFO=4]="INFO",f[f.DEBUG=5]="DEBUG",f))(Q||{}),fe={1:"\u{1F4A5}",2:"\u{1F534}",3:"\u{1F7E1}",4:"\u{1F535}",5:"\u{1F7E3}"},ht={5:ue,4:D,3:D,2:X,1:X};function St(e){for(let t of Object.keys(F))if(isNaN(Number(t))!==!1&&t.localeCompare(e,void 0,{sensitivity:"accent"})===0)return F[t]}function zt({message:e}){return String(e)}function de(e){return JSON.stringify({timestamp:e.date.toISOString(),level:Q[e.level],message:e.message,extra:e.extra})}function le(e){function t(p,g){return[Math.floor(p/g),p%g]}function n(){let p,g=e.date.valueOf()-xt.valueOf();[g,p]=t(g,1e3);let[V,W]=t(g,60);return`${V.toString().padStart(4,"0")}:${W.toString().padStart(2,"0")}.${p.toString().padStart(4,"0")}`}function s(){return e.extra===void 0?"":"Deno"in globalThis?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let m=fe[e.level],f=e.logger.name!==void 0?`@${e.logger}`:"";return`${D(n())}${f} ${m} ${ht[e.level](String(e.message))}${s()}`}var ge={sparse:zt,json:de,pretty:le,default:"Deno"in globalThis&&Deno.stdout.isTerminal()?le:de},J=class{#e;#t;filter;constructor(t=ge.default,n=6,s=console){this.filter=n,this.#e=t,this.#t=s}handle(t){let n=this.#e(t);switch(t.level){case 2:this.#t.error(n);break;case 3:this.#t.warn(n);break;case 4:this.#t.info(n);break;case 5:this.#t.debug(n);break}}},k=class{#e;sinks;filter;get name(){return this.#e}constructor(t,n=void 0,s=[new J]){this.#e=n,this.sinks=s,this.filter=t}log(t,n,s=void 0){if(this.filter<t)return;let m=me;for(let f of this.sinks)f.filter<t||(m===me&&(m={date:new Date,level:t,logger:this,message:typeof n=="function"?n():n,extra:s}),f.handle(m))}error=this.log.bind(this,2);warn=this.log.bind(this,3);info=this.log.bind(this,4);debug=this.log.bind(this,5)},T=new k(4),vt=k.prototype.log.bind(T,2),kt=k.prototype.log.bind(T,3),Rt=k.prototype.log.bind(T,4),Pt=k.prototype.log.bind(T,5),Tt=k.prototype.log.bind(T),me=Symbol();var Cr=-758.596,ye;(t=>{let e;(p=>(p[p.InvalidPassword=-1]="InvalidPassword",p[p.Unknown=0]="Unknown",p[p.Unencrypted=1]="Unencrypted",p[p.Encrypted=2]="Encrypted"))(e=t.PeerCipherStatus||={})})(ye||={});var Ct={bytesSent:0,bytesReceived:0,packetsSent:0,packetsReceived:0,rtt:0,packetLoss:0},At={packetsBuffered:0,packetsSeen:0,packetsProcessed:0,packetsTooEarly:0,packetsTooLate:0,packetsDropped:0,packetsInvalid:0,packetsRepeated:0,packetsLost:0},Lt={voiceActivity:{attackThreshold:.9,releaseThreshold:.8},volumeGate:{attackThreshold:-30,releaseThreshold:-40}},wt={echoCanceller:!0,highPassFilter:!1,noiseSuppression:"Moderate",transientSuppressor:!1,gainController:!0};0&&(module.exports={APM_DEFAULTS,Backend,ByteArraySchema,CONNECTION_STATS_INITIAL,ChannelSet,ChannelSetSchema,ConsoleSink,Formatter,GLOBAL_LOGGER,JITTER_STATS_INITIAL,JsonSchema,LogFilter,LogLevel,LogSymbols,Logger,MainCommandsRpc,MainNotificationSchema,MainNotificationsRpc,MediaAudioPropertiesSchema,MediaIdSchema,MediaPropertiesSchema,MediaSchema,MediaVideoPropertiesSchema,MessagePackRpcSchema,MessageReceivedSchema,MinDBFS,PeerIdSchema,PeerPositionSchema,PeerSchema,PeerUpdateSchema,RoomCommandsRpc,RoomNotificationSchema,RoomNotificationsRpc,RoomV1,RoomV2,Selector,Strand,TokenAudienceSchema,TokenClaimsSchema,TokenSubjectSchema,VAD_DEFAULTS,VideoCodec,WebRtcUpdateSchema,abortableSleep,assert,debug,error,extendUrl,fail,failure,find,fromBase64,fromBase64Url,fromBytes,generateUUID,info,isAudioCapable,isBlinkBrowser,isElectronBrowser,isFailure,isFirefoxBrowser,isFunction,isNull,isNumber,isObject,isProperty,isSafariBrowser,isSharedArrayBufferCapable,isString,isSuccess,isUndefined,log,nextTick,normalizeUrl,oneOrMany,sleep,success,toBytes,toRaw,tryParseLogFilter,unwrap,unwrapOr,validateUUID,warn});
package/esm/mod.js CHANGED
@@ -1 +1 @@
1
- import{z as d}from"zod";var b=d.custom(e=>e instanceof Uint8Array),ue=d.union([d.string(),d.number(),d.boolean(),d.null()]),T=d.lazy(()=>d.union([ue,d.array(T),d.record(d.string(),T)])),Me=d.union([d.tuple([d.literal(0),d.number(),d.string(),d.unknown()]),d.tuple([d.literal(1),d.number(),d.nullable(d.string()),d.unknown()]),d.tuple([d.literal(2),d.string(),d.unknown()])]);import{z as p}from"zod";var de=p.enum(["sfu","gateway"]),le=p.enum(["connect","roomclose","roomupdate","roombanclient","roomsendmessage"]),_e=p.object({uid:p.string(),cid:p.optional(p.string()),rid:C(p.string()).refine(e=>e.length>=1,{message:"missing rid"}),nsp:p.optional(p.string()),adr:p.optional(p.string()),aud:p.optional(C(de)),sub:p.optional(C(le)),exp:p.optional(p.number()),nbf:p.optional(p.number()),ups:p.optional(p.string()),tgs:p.optional(C(p.string())),tsp:p.optional(p.number()),internal:p.optional(p.object({server:p.optional(p.string())}))});function C(e){return p.union([e.transform(t=>[t]),p.array(e)])}import*as r from"zod";import*as c from"zod";var z=c.number(),me=c.object({kind:c.optional(c.literal("audio")),uid:c.optional(c.string()),customType:c.optional(c.string())}),fe=c.object({kind:c.optional(c.literal("video")),codec:c.optional(c.string()),uid:c.optional(c.string()),customType:c.optional(c.string()),id:c.optional(c.string())}),_=c.union([me,fe]),I=c.object({id:z,properties:_,paused:c.boolean()});import*as l from"zod";var h=l.number(),A=l.union([l.tuple([l.number(),l.number(),l.number()]),l.tuple([l.number(),l.number()])]),B=l.object({id:h,user_id:l.string(),user_data:b,medias:l.array(I)}),O=l.discriminatedUnion("kind",[l.object({kind:l.literal("UserDataChanged"),peer_id:h,user_data:b}),l.object({kind:l.literal("MediaStarted"),peer_id:h,media:I}),l.object({kind:l.literal("MediaStopped"),peer_id:h,media_id:z})]);import*as G from"zod";var N=class e{constructor(t=BigInt(0)){this.value=t}from(...t){let n=t.reduce((u,y)=>u|L(y),BigInt(0));return new e(n)}contains(t){return(this.value&L(t))!==BigInt(0)}insert(t){this.value|=L(t)}remove(t){this.value&=~L(t)}[Symbol.iterator](){let t=-1,n=new e(this.value);return{next(){for(;t<63;)if(t+=1,n.contains(t))return{value:t,done:!1};return{value:void 0,done:!0}}}}},$=G.bigint().transform(e=>new N(e));function L(e){return BigInt(1)<<BigInt(e)}var v;(s=>(s.RoomIdSchema=r.string(),s.RoomSchema=r.object({id:s.RoomIdSchema,customer:r.string(),user_data:b,peers:r.array(B)}),s.RoomUpdateSchema=r.discriminatedUnion("kind",[r.object({kind:r.literal("Joined"),room:s.RoomSchema,media_ids:r.array(z),own_peer_id:h}),r.object({kind:r.literal("Left"),reason:r.enum(["RoomClosing","ServerClosing","PeerKicked"])}),r.object({kind:r.literal("UserDataChanged"),user_data:r.optional(b)}),r.object({kind:r.literal("PeerJoined"),peer:B}),r.object({kind:r.literal("PeerLeft"),peer_id:h})]),s.RoomUpdatesSchema=r.object({updates:r.array(s.RoomUpdateSchema)}),s.RoomStatusSchema=r.enum(["Joining","Joined","Closed"]),s.RoomStatusChangedSchema=r.object({status:s.RoomStatusSchema,message:r.optional(r.string())})))(v||={});var ge;(i=>(i.ParametersSchema=r.record(T),i.PeerProperties=r.object({user_data:b.optional(),tags:r.array(r.string()).optional(),audio_parameters:i.ParametersSchema.optional(),video_parameters:i.ParametersSchema.optional()}),i.PingSchema=r.object({Ping:r.object({id:r.number()})}),i.ChangeSelfSchema=r.object({ChangeSelf:i.PeerProperties.omit({tags:!0})}),i.SetAudioMaskSchema=r.object({SetAudioMask:r.object({peer_id:r.number(),mask:$})}),i.SendMessageSchema=r.object({SendMessage:r.object({peer_ids:r.number().array().default([]),message:b})}),i.CallSchema=i.PingSchema.or(i.ChangeSelfSchema).or(i.SetAudioMaskSchema).or(i.SendMessageSchema),i.PongSchema=r.object({Pong:r.object({id:r.number()})}),i.JoinedSchema=r.object({Joined:r.object({own_peer_id:r.number(),room_id:r.string(),customer:r.string()})}),i.LeftSchema=r.object({Left:r.object({reason:r.enum(["room_closing","server_closing","peer_kicked"])})}),i.PeerJoinedSchema=r.object({PeerJoined:i.PeerProperties.extend({peer_id:r.number(),user_id:r.string()})}),i.PeerLeftSchema=r.object({PeerLeft:r.object({peer_id:r.number()})}),i.PeerChangedSchema=r.object({PeerChanged:i.PeerProperties.extend({peer_id:r.number()})}),i.NewReconnectTokenSchema=r.object({NewReconnectToken:r.object({token:r.string()})}),i.MessageReceivedSchema=r.object({MessageReceived:r.object({sender_peer_id:r.number(),message:b})}),i.ErrorSchema=r.object({Error:r.object({message:b})}),i.EventSchema=i.PongSchema.or(i.JoinedSchema).or(i.LeftSchema).or(i.PeerJoinedSchema).or(i.PeerLeftSchema).or(i.PeerChangedSchema).or(i.NewReconnectTokenSchema).or(i.MessageReceivedSchema).or(i.ErrorSchema)))(ge||={});import{z as ye}from"zod";var E=ye.object({sender_peer_id:h,message:b});import*as a from"zod";var R=a.discriminatedUnion("kind",[a.object({kind:a.literal("Sdp"),type:a.enum(["Answer","Offer"]),sdp:a.string(),media_map:a.array(a.tuple([z,a.string()]))}),a.object({kind:a.literal("Trickle"),candidate:a.string(),spd_mid:a.optional(a.string()),spd_mline_index:a.optional(a.number()),username_fragment:a.optional(a.union([a.string(),a.null()]))}),a.object({kind:a.literal("TrickleFinished")})]);import{z as o}from"zod";var ot={Hello:{request:o.object({stream:o.literal("main")}),response:o.null()},JoinRoom:{request:o.object({token:o.string(),room_id:v.RoomIdSchema,user_data:b,position:A}),response:o.object({peer_id:h,stream_id:o.optional(o.number()),token:o.optional(o.string())})},WebRtcUpdate:{request:R,response:o.null()},RequestReconnectToken:{request:o.object({peer_id:o.optional(h)}),response:o.string()},Ping:{request:o.object({}),response:o.null()}},it={Hello:{request:o.object({stream:o.literal("room"),token:o.string(),room_id:o.string(),user_data:b,position:A}),response:o.null()},UpdatePeer:{request:o.object({user_data:b}),response:o.null()},StartMedia:{request:o.object({media_id:z,properties:_}),response:o.null()},StopMedia:{request:o.object({media_id:z}),response:o.null()},PauseMedia:{request:o.object({media_id:z}),response:o.null()},ResumeMedia:{request:o.object({media_id:z}),response:o.null()},SetPeerPosition:{request:o.object({position:A}),response:o.null()},SendMessage:{request:o.object({target_peer_ids:o.optional(o.array(h)),message:b}),response:o.null()}};import*as x from"zod";var dt=x.object({name:x.literal("WebRtcUpdate"),properties:R}),lt={WebRtcUpdate:R},mt=x.union([x.object({name:x.literal("RoomStatusChanged"),properties:v.RoomStatusChangedSchema}),x.object({name:x.literal("RoomUpdated"),properties:v.RoomUpdatesSchema}),x.object({name:x.literal("PeerUpdated"),properties:O}),x.object({name:x.literal("MessageReceived"),properties:E})]),ft={RoomStatusChanged:v.RoomStatusChangedSchema,RoomUpdated:v.RoomUpdatesSchema,PeerUpdated:O,MessageReceived:E};function w(e,t){e||H(t)}function H(e){throw new Error(e)}function g(e){return{type:"Success",value:e}}function S(e){return{type:"Failure",reason:e}}function yt(e){return e.type==="Failure"&&H(e.reason),e.value}function D(e,t){return e.type==="Success"?e.value:t}function ht(e){try{let t=atob(e),n=Uint8Array.from(t,y=>y.codePointAt(0)),u=new TextDecoder("utf8");return g(u.decode(n))}catch(t){return S(String(t))}}function St(e){try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=Uint8Array.from(t,y=>y.codePointAt(0)),u=new TextDecoder("utf8");return g(u.decode(n))}catch(t){return S(String(t))}}function kt(e){try{w(e!==void 0,"undefined cannot be converted to byte array"),w(e!==null,"null cannot be converted to byte array");let t=JSON.stringify(e),n=new TextEncoder;return g(n.encode(t))}catch(t){return S(String(t))}}function Rt(e){try{w(e.length>0,"empty byte array cannot be converted to value");let t=new TextDecoder().decode(e),n=JSON.parse(t);return g(n)}catch(t){return S(String(t))}}var be=["VP8","VP9","AV1","H264"],Z=class{constructor(t){this.codec=t}channels=0;clockRate=9e4;isValid(){return be.includes(this.codec)}isSupported(){if(typeof RTCRtpReceiver>"u"||typeof RTCRtpReceiver.getCapabilities>"u")return null;let t=D(this.getMimeType(),"").toLowerCase(),n=new Set(D(this.getSdpFmtpLine(),"").split(";").map(u=>u.trim().toLowerCase()));return RTCRtpReceiver.getCapabilities("video")?.codecs?.find(u=>{let y=u.mimeType.toLowerCase(),m=new Set((u.sdpFmtpLine??"").split(";").map(s=>s.trim().toLowerCase()));if(t!==y||n.size!==m.size)return!1;for(let s of n)if(!m.has(s))return!1;return!0})??null}getPayloadType(){switch(this.codec){case"VP8":return g(96);case"VP9":return g(98);case"AV1":return g(41);case"H264":return g(102);default:return S("invalid video codec")}}getMimeType(){switch(this.codec){case"VP8":return g("video/VP8");case"VP9":return g("video/VP9");case"AV1":return g("video/AV1");case"H264":return g("video/H264");default:return S("invalid video codec")}}getSdpFmtpLine(){switch(this.codec){case"VP8":return g("");case"VP9":return g("profile-id=2");case"AV1":return g("level-idx=5;profile=0;tier=0");case"H264":return g("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f");default:return S("invalid video codec")}}};function At(e,t){for(let n of e)if(t(n))return n}function wt(){return typeof AudioContext<"u"&&typeof Worker<"u"}function Mt(){return typeof SharedArrayBuffer<"u"}function xe(){return/(apple)?webkit\/537\.36/i.test(globalThis.navigator.userAgent)}function jt(){return/electron/i.test(globalThis.navigator.userAgent)}function Ut(){return/firefox|iceweasel|fxios/i.test(globalThis.navigator.userAgent)}function _t(){return xe()?!1:/safari|applewebkit/i.test(globalThis.navigator.userAgent)}function Bt(e){return JSON.parse(JSON.stringify(e))}var Y=class e{constructor(t){this._Generators=t;this._Futures=t.map(e.addIndex)}_Futures;async next(){let[t,n]=await Promise.race(this._Futures);return this._Futures[n]=e.addIndex(this._Generators[n],n),t}static async addIndex(t,n){return[await t(),n]}};function Et(e,t){return e<=0?Promise.resolve(t):new Promise(n=>setTimeout(()=>n(t),e))}function Dt(e,t){return t.aborted?Promise.resolve("aborted"):new Promise(n=>{let u=()=>n("aborted");t.addEventListener("abort",u,{once:!0}),setTimeout(()=>{t.removeEventListener("abort",u),n(void 0)},e)})}function Ft(){return new Promise(e=>setTimeout(e,0))}var K=class{_Tasks=[];_Running=!1;_Values;constructor(...t){this._Values=t}enqueue(t){return new Promise((n,u)=>{let y=async()=>{try{let m=await t(...this._Values);n(m)}catch(m){u(m)}};this._Tasks.push(y),this._Running||this.execute()})}async execute(){for(this._Running=!0;;){let t=this._Tasks.shift();if(t===void 0)break;await t()}this._Running=!1}};function qt(e){let t=e.trim();e.indexOf("://")===-1&&(t=`https://${t}`);try{return g(new URL(t))}catch(n){return S(String(n))}}function Gt(e,t){let n=e.pathname;n.endsWith("/")===!1&&(n+="/");try{return g(new URL(n+t,e))}catch(u){return S(String(u))}}var he=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Ht(){return crypto.randomUUID()}function Zt(e){return he.test(e)}function Kt(e,t){return t in e}function Xt(e){return typeof e=="function"}function Qt(e){return typeof e=="object"&&e===null}function er(e){return typeof e=="number"}function tr(e){return typeof e=="object"}function rr(e){return typeof e=="string"}function nr(e){return typeof e>"u"}function or(e){return e.type==="Failure"}function ir(e){return e.type==="Success"}var{Deno:X}=globalThis,Se=typeof X?.noColor=="boolean"?X.noColor:!1,ze=!Se;function F(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}function J(e,t){return ze?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function M(e){return J(e,F([0],0))}function V(e){return J(e,F([1],22))}function Q(e){return J(e,F([2],22))}var sr=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");var W=(f=>(f[f.Nothing=0]="Nothing",f[f.CRITICAL=1]="CRITICAL",f[f.ERROR=2]="ERROR",f[f.WARN=3]="WARN",f[f.INFO=4]="INFO",f[f.DEBUG=5]="DEBUG",f[f.Everything=6]="Everything",f))(W||{}),ke=new Date,ne=(m=>(m[m.CRITICAL=1]="CRITICAL",m[m.ERROR=2]="ERROR",m[m.WARN=3]="WARN",m[m.INFO=4]="INFO",m[m.DEBUG=5]="DEBUG",m))(ne||{}),Re={1:"\u{1F4A5}",2:"\u{1F534}",3:"\u{1F7E1}",4:"\u{1F535}",5:"\u{1F7E3}"},Pe={5:Q,4:M,3:M,2:V,1:V};function pr(e){for(let t of Object.keys(W))if(isNaN(Number(t))!==!1&&t.localeCompare(e,void 0,{sensitivity:"accent"})===0)return W[t]}function Te({message:e}){return String(e)}function ee(e){return JSON.stringify({timestamp:e.date.toISOString(),level:ne[e.level],message:e.message,extra:e.extra})}function te(e){function t(s,f){return[Math.floor(s/f),s%f]}function n(){let s,f=e.date.valueOf()-ke.valueOf();[f,s]=t(f,1e3);let[j,U]=t(f,60);return`${j.toString().padStart(4,"0")}:${U.toString().padStart(2,"0")}.${s.toString().padStart(4,"0")}`}function u(){return e.extra===void 0?"":"Deno"in globalThis?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let y=Re[e.level],m=e.logger.name!==void 0?`@${e.logger}`:"";return`${M(n())}${m} ${y} ${Pe[e.level](String(e.message))}${u()}`}var Ce={sparse:Te,json:ee,pretty:te,default:"Deno"in globalThis&&Deno.stdout.isTerminal()?te:ee},q=class{#e;#t;filter;constructor(t=Ce.default,n=6,u=console){this.filter=n,this.#e=t,this.#t=u}handle(t){let n=this.#e(t);switch(t.level){case 2:this.#t.error(n);break;case 3:this.#t.warn(n);break;case 4:this.#t.info(n);break;case 5:this.#t.debug(n);break}}},k=class{#e;sinks;filter;get name(){return this.#e}constructor(t,n=void 0,u=[new q]){this.#e=n,this.sinks=u,this.filter=t}log(t,n,u=void 0){if(this.filter<t)return;let y=re;for(let m of this.sinks)m.filter<t||(y===re&&(y={date:new Date,level:t,logger:this,message:typeof n=="function"?n():n,extra:u}),m.handle(y))}error=this.log.bind(this,2);warn=this.log.bind(this,3);info=this.log.bind(this,4);debug=this.log.bind(this,5)},P=new k(4),cr=k.prototype.log.bind(P,2),ur=k.prototype.log.bind(P,3),dr=k.prototype.log.bind(P,4),lr=k.prototype.log.bind(P,5),mr=k.prototype.log.bind(P),re=Symbol();var gr=-758.596,Ae;(t=>{let e;(s=>(s[s.InvalidPassword=-1]="InvalidPassword",s[s.Unknown=0]="Unknown",s[s.Unencrypted=1]="Unencrypted",s[s.Encrypted=2]="Encrypted"))(e=t.PeerCipherStatus||={})})(Ae||={});var yr={bytesSent:0,bytesReceived:0,packetsSent:0,packetsReceived:0,rtt:0,packetLoss:0},br={packetsBuffered:0,packetsSeen:0,packetsProcessed:0,packetsTooEarly:0,packetsTooLate:0,packetsDropped:0,packetsInvalid:0,packetsRepeated:0,packetsLost:0},xr={voiceActivity:{attackThreshold:.9,releaseThreshold:.8},volumeGate:{attackThreshold:-30,releaseThreshold:-40}},hr={echoCanceller:!0,highPassFilter:!1,noiseSuppression:"Moderate",transientSuppressor:!1,gainController:!0};export{hr as APM_DEFAULTS,Ae as Backend,b as ByteArraySchema,yr as CONNECTION_STATS_INITIAL,N as ChannelSet,$ as ChannelSetSchema,q as ConsoleSink,Ce as Formatter,P as GLOBAL_LOGGER,br as JITTER_STATS_INITIAL,T as JsonSchema,W as LogFilter,ne as LogLevel,k as Logger,ot as MainCommandsRpc,dt as MainNotificationSchema,lt as MainNotificationsRpc,me as MediaAudioPropertiesSchema,z as MediaIdSchema,_ as MediaPropertiesSchema,I as MediaSchema,fe as MediaVideoPropertiesSchema,Me as MessagePackRpcSchema,E as MessageReceivedSchema,gr as MinDBFS,h as PeerIdSchema,A as PeerPositionSchema,B as PeerSchema,O as PeerUpdateSchema,it as RoomCommandsRpc,mt as RoomNotificationSchema,ft as RoomNotificationsRpc,v as RoomV1,ge as RoomV2,Y as Selector,K as Strand,de as TokenAudienceSchema,_e as TokenClaimsSchema,le as TokenSubjectSchema,xr as VAD_DEFAULTS,Z as VideoCodec,R as WebRtcUpdateSchema,Dt as abortableSleep,w as assert,lr as debug,cr as error,Gt as extendUrl,H as fail,S as failure,At as find,ht as fromBase64,St as fromBase64Url,Rt as fromBytes,Ht as generateUUID,dr as info,wt as isAudioCapable,xe as isBlinkBrowser,jt as isElectronBrowser,or as isFailure,Ut as isFirefoxBrowser,Xt as isFunction,Qt as isNull,er as isNumber,tr as isObject,Kt as isProperty,_t as isSafariBrowser,Mt as isSharedArrayBufferCapable,rr as isString,ir as isSuccess,nr as isUndefined,mr as log,Ft as nextTick,qt as normalizeUrl,C as oneOrMany,Et as sleep,g as success,kt as toBytes,Bt as toRaw,pr as tryParseLogFilter,yt as unwrap,D as unwrapOr,Zt as validateUUID,ur as warn};
1
+ import{z as d}from"zod";var b=d.custom(e=>e instanceof Uint8Array),ue=d.union([d.string(),d.number(),d.boolean(),d.null()]),T=d.lazy(()=>d.union([ue,d.array(T),d.record(d.string(),T)])),Me=d.union([d.tuple([d.literal(0),d.number(),d.string(),d.unknown()]),d.tuple([d.literal(1),d.number(),d.nullable(d.string()),d.unknown()]),d.tuple([d.literal(2),d.string(),d.unknown()])]);import{z as p}from"zod";var de=p.enum(["sfu","gateway"]),le=p.enum(["connect","roomclose","roomupdate","roombanclient","roomsendmessage"]),_e=p.object({uid:p.string(),cid:p.optional(p.string()),rid:C(p.string()).refine(e=>e.length>=1,{message:"missing rid"}),nsp:p.optional(p.string()),adr:p.optional(p.string()),aud:p.optional(C(de)),sub:p.optional(C(le)),exp:p.optional(p.number()),nbf:p.optional(p.number()),ups:p.optional(p.string()),tgs:p.optional(C(p.string())),tsp:p.optional(p.number()),internal:p.optional(p.object({server:p.optional(p.string())}))});function C(e){return p.union([e.transform(t=>[t]),p.array(e)])}import*as r from"zod";import*as c from"zod";var z=c.number(),me=c.object({kind:c.optional(c.literal("audio")),uid:c.optional(c.string()),customType:c.optional(c.string())}),fe=c.object({kind:c.optional(c.literal("video")),codec:c.optional(c.string()),uid:c.optional(c.string()),customType:c.optional(c.string()),id:c.optional(c.string())}),_=c.union([me,fe]),I=c.object({id:z,properties:_,paused:c.boolean()});import*as l from"zod";var h=l.number(),A=l.union([l.tuple([l.number(),l.number(),l.number()]),l.tuple([l.number(),l.number()])]),B=l.object({id:h,user_id:l.string(),user_data:b,medias:l.array(I)}),O=l.discriminatedUnion("kind",[l.object({kind:l.literal("UserDataChanged"),peer_id:h,user_data:b}),l.object({kind:l.literal("MediaStarted"),peer_id:h,media:I}),l.object({kind:l.literal("MediaStopped"),peer_id:h,media_id:z})]);import*as G from"zod";var N=class e{constructor(t=BigInt(0)){this.value=t}from(...t){let n=t.reduce((u,y)=>u|L(y),BigInt(0));return new e(n)}contains(t){return(this.value&L(t))!==BigInt(0)}insert(t){this.value|=L(t)}remove(t){this.value&=~L(t)}[Symbol.iterator](){let t=-1,n=new e(this.value);return{next(){for(;t<63;)if(t+=1,n.contains(t))return{value:t,done:!1};return{value:void 0,done:!0}}}}},$=G.bigint().transform(e=>new N(e));function L(e){return BigInt(1)<<BigInt(e)}var v;(s=>(s.RoomIdSchema=r.string(),s.RoomSchema=r.object({id:s.RoomIdSchema,customer:r.string(),user_data:b,peers:r.array(B)}),s.RoomUpdateSchema=r.discriminatedUnion("kind",[r.object({kind:r.literal("Joined"),room:s.RoomSchema,media_ids:r.array(z),own_peer_id:h}),r.object({kind:r.literal("Left"),reason:r.enum(["RoomClosing","ServerClosing","PeerKicked"])}),r.object({kind:r.literal("UserDataChanged"),user_data:r.optional(b)}),r.object({kind:r.literal("PeerJoined"),peer:B}),r.object({kind:r.literal("PeerLeft"),peer_id:h})]),s.RoomUpdatesSchema=r.object({updates:r.array(s.RoomUpdateSchema)}),s.RoomStatusSchema=r.enum(["Joining","Joined","Closed"]),s.RoomStatusChangedSchema=r.object({status:s.RoomStatusSchema,message:r.optional(r.string())})))(v||={});var ge;(i=>(i.ParametersSchema=r.record(r.string(),T),i.PeerProperties=r.object({user_data:b.optional(),tags:r.array(r.string()).optional(),audio_parameters:i.ParametersSchema.optional(),video_parameters:i.ParametersSchema.optional()}),i.PingSchema=r.object({Ping:r.object({id:r.number()})}),i.ChangeSelfSchema=r.object({ChangeSelf:i.PeerProperties.omit({tags:!0})}),i.SetAudioMaskSchema=r.object({SetAudioMask:r.object({peer_id:r.number(),mask:$})}),i.SendMessageSchema=r.object({SendMessage:r.object({peer_ids:r.number().array().default([]),message:b})}),i.CallSchema=i.PingSchema.or(i.ChangeSelfSchema).or(i.SetAudioMaskSchema).or(i.SendMessageSchema),i.PongSchema=r.object({Pong:r.object({id:r.number()})}),i.JoinedSchema=r.object({Joined:r.object({own_peer_id:r.number(),room_id:r.string(),customer:r.string()})}),i.LeftSchema=r.object({Left:r.object({reason:r.enum(["room_closing","server_closing","peer_kicked"])})}),i.PeerJoinedSchema=r.object({PeerJoined:i.PeerProperties.extend({peer_id:r.number(),user_id:r.string()})}),i.PeerLeftSchema=r.object({PeerLeft:r.object({peer_id:r.number()})}),i.PeerChangedSchema=r.object({PeerChanged:i.PeerProperties.extend({peer_id:r.number()})}),i.NewReconnectTokenSchema=r.object({NewReconnectToken:r.object({token:r.string()})}),i.MessageReceivedSchema=r.object({MessageReceived:r.object({sender_peer_id:r.number(),message:b})}),i.ErrorSchema=r.object({Error:r.object({message:b})}),i.EventSchema=i.PongSchema.or(i.JoinedSchema).or(i.LeftSchema).or(i.PeerJoinedSchema).or(i.PeerLeftSchema).or(i.PeerChangedSchema).or(i.NewReconnectTokenSchema).or(i.MessageReceivedSchema).or(i.ErrorSchema)))(ge||={});import{z as ye}from"zod";var E=ye.object({sender_peer_id:h,message:b});import*as a from"zod";var R=a.discriminatedUnion("kind",[a.object({kind:a.literal("Sdp"),type:a.enum(["Answer","Offer"]),sdp:a.string(),media_map:a.array(a.tuple([z,a.string()]))}),a.object({kind:a.literal("Trickle"),candidate:a.string(),spd_mid:a.optional(a.string()),spd_mline_index:a.optional(a.number()),username_fragment:a.optional(a.union([a.string(),a.null()]))}),a.object({kind:a.literal("TrickleFinished")})]);import{z as o}from"zod";var ot={Hello:{request:o.object({stream:o.literal("main")}),response:o.null()},JoinRoom:{request:o.object({token:o.string(),room_id:v.RoomIdSchema,user_data:b,position:A}),response:o.object({peer_id:h,stream_id:o.optional(o.number()),token:o.optional(o.string())})},WebRtcUpdate:{request:R,response:o.null()},RequestReconnectToken:{request:o.object({peer_id:o.optional(h)}),response:o.string()},Ping:{request:o.object({}),response:o.null()}},it={Hello:{request:o.object({stream:o.literal("room"),token:o.string(),room_id:o.string(),user_data:b,position:A}),response:o.null()},UpdatePeer:{request:o.object({user_data:b}),response:o.null()},StartMedia:{request:o.object({media_id:z,properties:_}),response:o.null()},StopMedia:{request:o.object({media_id:z}),response:o.null()},PauseMedia:{request:o.object({media_id:z}),response:o.null()},ResumeMedia:{request:o.object({media_id:z}),response:o.null()},SetPeerPosition:{request:o.object({position:A}),response:o.null()},SendMessage:{request:o.object({target_peer_ids:o.optional(o.array(h)),message:b}),response:o.null()}};import*as x from"zod";var dt=x.object({name:x.literal("WebRtcUpdate"),properties:R}),lt={WebRtcUpdate:R},mt=x.union([x.object({name:x.literal("RoomStatusChanged"),properties:v.RoomStatusChangedSchema}),x.object({name:x.literal("RoomUpdated"),properties:v.RoomUpdatesSchema}),x.object({name:x.literal("PeerUpdated"),properties:O}),x.object({name:x.literal("MessageReceived"),properties:E})]),ft={RoomStatusChanged:v.RoomStatusChangedSchema,RoomUpdated:v.RoomUpdatesSchema,PeerUpdated:O,MessageReceived:E};function w(e,t){e||H(t)}function H(e){throw new Error(e)}function g(e){return{type:"Success",value:e}}function S(e){return{type:"Failure",reason:e}}function yt(e){return e.type==="Failure"&&H(e.reason),e.value}function D(e,t){return e.type==="Success"?e.value:t}function ht(e){try{let t=atob(e),n=Uint8Array.from(t,y=>y.codePointAt(0)),u=new TextDecoder("utf8");return g(u.decode(n))}catch(t){return S(String(t))}}function St(e){try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=Uint8Array.from(t,y=>y.codePointAt(0)),u=new TextDecoder("utf8");return g(u.decode(n))}catch(t){return S(String(t))}}function kt(e){try{w(e!==void 0,"undefined cannot be converted to byte array"),w(e!==null,"null cannot be converted to byte array");let t=JSON.stringify(e),n=new TextEncoder;return g(n.encode(t))}catch(t){return S(String(t))}}function Rt(e){try{w(e.length>0,"empty byte array cannot be converted to value");let t=new TextDecoder().decode(e),n=JSON.parse(t);return g(n)}catch(t){return S(String(t))}}var be=["VP8","VP9","AV1","H264"],Z=class{constructor(t){this.codec=t}channels=0;clockRate=9e4;isValid(){return be.includes(this.codec)}isSupported(){if(typeof RTCRtpReceiver>"u"||typeof RTCRtpReceiver.getCapabilities>"u")return null;let t=D(this.getMimeType(),"").toLowerCase(),n=new Set(D(this.getSdpFmtpLine(),"").split(";").map(u=>u.trim().toLowerCase()));return RTCRtpReceiver.getCapabilities("video")?.codecs?.find(u=>{let y=u.mimeType.toLowerCase(),m=new Set((u.sdpFmtpLine??"").split(";").map(s=>s.trim().toLowerCase()));if(t!==y||n.size!==m.size)return!1;for(let s of n)if(!m.has(s))return!1;return!0})??null}getPayloadType(){switch(this.codec){case"VP8":return g(96);case"VP9":return g(98);case"AV1":return g(41);case"H264":return g(102);default:return S("invalid video codec")}}getMimeType(){switch(this.codec){case"VP8":return g("video/VP8");case"VP9":return g("video/VP9");case"AV1":return g("video/AV1");case"H264":return g("video/H264");default:return S("invalid video codec")}}getSdpFmtpLine(){switch(this.codec){case"VP8":return g("");case"VP9":return g("profile-id=2");case"AV1":return g("level-idx=5;profile=0;tier=0");case"H264":return g("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f");default:return S("invalid video codec")}}};function At(e,t){for(let n of e)if(t(n))return n}function wt(){return typeof AudioContext<"u"&&typeof Worker<"u"}function Mt(){return typeof SharedArrayBuffer<"u"}function xe(){return/(apple)?webkit\/537\.36/i.test(globalThis.navigator.userAgent)}function jt(){return/electron/i.test(globalThis.navigator.userAgent)}function Ut(){return/firefox|iceweasel|fxios/i.test(globalThis.navigator.userAgent)}function _t(){return xe()?!1:/safari|applewebkit/i.test(globalThis.navigator.userAgent)}function Bt(e){return JSON.parse(JSON.stringify(e))}var Y=class e{constructor(t){this._Generators=t;this._Futures=t.map(e.addIndex)}_Futures;async next(){let[t,n]=await Promise.race(this._Futures);return this._Futures[n]=e.addIndex(this._Generators[n],n),t}static async addIndex(t,n){return[await t(),n]}};function Et(e,t){return e<=0?Promise.resolve(t):new Promise(n=>setTimeout(()=>n(t),e))}function Dt(e,t){return t.aborted?Promise.resolve("aborted"):new Promise(n=>{let u=()=>n("aborted");t.addEventListener("abort",u,{once:!0}),setTimeout(()=>{t.removeEventListener("abort",u),n(void 0)},e)})}function Ft(){return new Promise(e=>setTimeout(e,0))}var K=class{_Tasks=[];_Running=!1;_Values;constructor(...t){this._Values=t}enqueue(t){return new Promise((n,u)=>{let y=async()=>{try{let m=await t(...this._Values);n(m)}catch(m){u(m)}};this._Tasks.push(y),this._Running||this.execute()})}async execute(){for(this._Running=!0;;){let t=this._Tasks.shift();if(t===void 0)break;await t()}this._Running=!1}};function qt(e){let t=e.trim();e.indexOf("://")===-1&&(t=`https://${t}`);try{return g(new URL(t))}catch(n){return S(String(n))}}function Gt(e,t){let n=e.pathname;n.endsWith("/")===!1&&(n+="/");try{return g(new URL(n+t,e))}catch(u){return S(String(u))}}var he=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Ht(){return crypto.randomUUID()}function Zt(e){return he.test(e)}function Kt(e,t){return t in e}function Xt(e){return typeof e=="function"}function Qt(e){return typeof e=="object"&&e===null}function er(e){return typeof e=="number"}function tr(e){return typeof e=="object"}function rr(e){return typeof e=="string"}function nr(e){return typeof e>"u"}function or(e){return e.type==="Failure"}function ir(e){return e.type==="Success"}var{Deno:X}=globalThis,Se=typeof X?.noColor=="boolean"?X.noColor:!1,ze=!Se;function F(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}function J(e,t){return ze?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}function M(e){return J(e,F([0],0))}function V(e){return J(e,F([1],22))}function Q(e){return J(e,F([2],22))}var sr=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");var W=(f=>(f[f.Nothing=0]="Nothing",f[f.CRITICAL=1]="CRITICAL",f[f.ERROR=2]="ERROR",f[f.WARN=3]="WARN",f[f.INFO=4]="INFO",f[f.DEBUG=5]="DEBUG",f[f.Everything=6]="Everything",f))(W||{}),ke=new Date,ne=(m=>(m[m.CRITICAL=1]="CRITICAL",m[m.ERROR=2]="ERROR",m[m.WARN=3]="WARN",m[m.INFO=4]="INFO",m[m.DEBUG=5]="DEBUG",m))(ne||{}),Re={1:"\u{1F4A5}",2:"\u{1F534}",3:"\u{1F7E1}",4:"\u{1F535}",5:"\u{1F7E3}"},Pe={5:Q,4:M,3:M,2:V,1:V};function pr(e){for(let t of Object.keys(W))if(isNaN(Number(t))!==!1&&t.localeCompare(e,void 0,{sensitivity:"accent"})===0)return W[t]}function Te({message:e}){return String(e)}function ee(e){return JSON.stringify({timestamp:e.date.toISOString(),level:ne[e.level],message:e.message,extra:e.extra})}function te(e){function t(s,f){return[Math.floor(s/f),s%f]}function n(){let s,f=e.date.valueOf()-ke.valueOf();[f,s]=t(f,1e3);let[j,U]=t(f,60);return`${j.toString().padStart(4,"0")}:${U.toString().padStart(2,"0")}.${s.toString().padStart(4,"0")}`}function u(){return e.extra===void 0?"":"Deno"in globalThis?" "+Deno.inspect(e.extra,{compact:!1,colors:!0,trailingComma:!0}).trimStart():" "+JSON.stringify(e.extra)}let y=Re[e.level],m=e.logger.name!==void 0?`@${e.logger}`:"";return`${M(n())}${m} ${y} ${Pe[e.level](String(e.message))}${u()}`}var Ce={sparse:Te,json:ee,pretty:te,default:"Deno"in globalThis&&Deno.stdout.isTerminal()?te:ee},q=class{#e;#t;filter;constructor(t=Ce.default,n=6,u=console){this.filter=n,this.#e=t,this.#t=u}handle(t){let n=this.#e(t);switch(t.level){case 2:this.#t.error(n);break;case 3:this.#t.warn(n);break;case 4:this.#t.info(n);break;case 5:this.#t.debug(n);break}}},k=class{#e;sinks;filter;get name(){return this.#e}constructor(t,n=void 0,u=[new q]){this.#e=n,this.sinks=u,this.filter=t}log(t,n,u=void 0){if(this.filter<t)return;let y=re;for(let m of this.sinks)m.filter<t||(y===re&&(y={date:new Date,level:t,logger:this,message:typeof n=="function"?n():n,extra:u}),m.handle(y))}error=this.log.bind(this,2);warn=this.log.bind(this,3);info=this.log.bind(this,4);debug=this.log.bind(this,5)},P=new k(4),cr=k.prototype.log.bind(P,2),ur=k.prototype.log.bind(P,3),dr=k.prototype.log.bind(P,4),lr=k.prototype.log.bind(P,5),mr=k.prototype.log.bind(P),re=Symbol();var gr=-758.596,Ae;(t=>{let e;(s=>(s[s.InvalidPassword=-1]="InvalidPassword",s[s.Unknown=0]="Unknown",s[s.Unencrypted=1]="Unencrypted",s[s.Encrypted=2]="Encrypted"))(e=t.PeerCipherStatus||={})})(Ae||={});var yr={bytesSent:0,bytesReceived:0,packetsSent:0,packetsReceived:0,rtt:0,packetLoss:0},br={packetsBuffered:0,packetsSeen:0,packetsProcessed:0,packetsTooEarly:0,packetsTooLate:0,packetsDropped:0,packetsInvalid:0,packetsRepeated:0,packetsLost:0},xr={voiceActivity:{attackThreshold:.9,releaseThreshold:.8},volumeGate:{attackThreshold:-30,releaseThreshold:-40}},hr={echoCanceller:!0,highPassFilter:!1,noiseSuppression:"Moderate",transientSuppressor:!1,gainController:!0};export{hr as APM_DEFAULTS,Ae as Backend,b as ByteArraySchema,yr as CONNECTION_STATS_INITIAL,N as ChannelSet,$ as ChannelSetSchema,q as ConsoleSink,Ce as Formatter,P as GLOBAL_LOGGER,br as JITTER_STATS_INITIAL,T as JsonSchema,W as LogFilter,ne as LogLevel,Re as LogSymbols,k as Logger,ot as MainCommandsRpc,dt as MainNotificationSchema,lt as MainNotificationsRpc,me as MediaAudioPropertiesSchema,z as MediaIdSchema,_ as MediaPropertiesSchema,I as MediaSchema,fe as MediaVideoPropertiesSchema,Me as MessagePackRpcSchema,E as MessageReceivedSchema,gr as MinDBFS,h as PeerIdSchema,A as PeerPositionSchema,B as PeerSchema,O as PeerUpdateSchema,it as RoomCommandsRpc,mt as RoomNotificationSchema,ft as RoomNotificationsRpc,v as RoomV1,ge as RoomV2,Y as Selector,K as Strand,de as TokenAudienceSchema,_e as TokenClaimsSchema,le as TokenSubjectSchema,xr as VAD_DEFAULTS,Z as VideoCodec,R as WebRtcUpdateSchema,Dt as abortableSleep,w as assert,lr as debug,cr as error,Gt as extendUrl,H as fail,S as failure,At as find,ht as fromBase64,St as fromBase64Url,Rt as fromBytes,Ht as generateUUID,dr as info,wt as isAudioCapable,xe as isBlinkBrowser,jt as isElectronBrowser,or as isFailure,Ut as isFirefoxBrowser,Xt as isFunction,Qt as isNull,er as isNumber,tr as isObject,Kt as isProperty,_t as isSafariBrowser,Mt as isSharedArrayBufferCapable,rr as isString,ir as isSuccess,nr as isUndefined,mr as log,Ft as nextTick,qt as normalizeUrl,C as oneOrMany,Et as sleep,g as success,kt as toBytes,Bt as toRaw,pr as tryParseLogFilter,yt as unwrap,D as unwrapOr,Zt as validateUUID,ur as warn};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4players/odin-common",
3
- "version": "9.0.3",
3
+ "version": "9.0.5",
4
4
  "description": "A collection of commonly used type definitions and utility functions across ODIN web projects",
5
5
  "author": "Josho Bleicker <josho.bleicker@4players.io> (https://www.4players.io)",
6
6
  "homepage": "https://www.4players.io",
package/schema/room.d.ts CHANGED
@@ -179,12 +179,12 @@ export declare namespace RoomV1 {
179
179
  type RoomStatusChanged = z.infer<typeof RoomStatusChangedSchema>;
180
180
  }
181
181
  export declare namespace RoomV2 {
182
- const ParametersSchema: z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>;
182
+ const ParametersSchema: z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>;
183
183
  const PeerProperties: z.ZodObject<{
184
184
  user_data: z.ZodOptional<z.ZodCustom<Uint8Array, Uint8Array>>;
185
185
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
186
- audio_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
187
- video_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
186
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
187
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
188
188
  }, z.core.$strip>;
189
189
  const PingSchema: z.ZodObject<{
190
190
  Ping: z.ZodObject<{
@@ -194,8 +194,8 @@ export declare namespace RoomV2 {
194
194
  const ChangeSelfSchema: z.ZodObject<{
195
195
  ChangeSelf: z.ZodObject<{
196
196
  user_data: z.ZodOptional<z.ZodCustom<Uint8Array, Uint8Array>>;
197
- audio_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
198
- video_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
197
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
198
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
199
199
  }, z.core.$strip>;
200
200
  }, z.core.$strip>;
201
201
  const SetAudioMaskSchema: z.ZodObject<{
@@ -217,8 +217,8 @@ export declare namespace RoomV2 {
217
217
  }, z.core.$strip>, z.ZodObject<{
218
218
  ChangeSelf: z.ZodObject<{
219
219
  user_data: z.ZodOptional<z.ZodCustom<Uint8Array, Uint8Array>>;
220
- audio_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
221
- video_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
220
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
221
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
222
222
  }, z.core.$strip>;
223
223
  }, z.core.$strip>]>, z.ZodObject<{
224
224
  SetAudioMask: z.ZodObject<{
@@ -257,8 +257,8 @@ export declare namespace RoomV2 {
257
257
  PeerJoined: z.ZodObject<{
258
258
  user_data: z.ZodOptional<z.ZodCustom<Uint8Array, Uint8Array>>;
259
259
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
260
- audio_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
261
- video_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
260
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
261
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
262
262
  peer_id: z.ZodNumber;
263
263
  user_id: z.ZodString;
264
264
  }, z.core.$strip>;
@@ -272,8 +272,8 @@ export declare namespace RoomV2 {
272
272
  PeerChanged: z.ZodObject<{
273
273
  user_data: z.ZodOptional<z.ZodCustom<Uint8Array, Uint8Array>>;
274
274
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
275
- audio_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
276
- video_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
275
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
276
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
277
277
  peer_id: z.ZodNumber;
278
278
  }, z.core.$strip>;
279
279
  }, z.core.$strip>;
@@ -315,8 +315,8 @@ export declare namespace RoomV2 {
315
315
  PeerJoined: z.ZodObject<{
316
316
  user_data: z.ZodOptional<z.ZodCustom<Uint8Array, Uint8Array>>;
317
317
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
318
- audio_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
319
- video_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
318
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
319
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
320
320
  peer_id: z.ZodNumber;
321
321
  user_id: z.ZodString;
322
322
  }, z.core.$strip>;
@@ -328,8 +328,8 @@ export declare namespace RoomV2 {
328
328
  PeerChanged: z.ZodObject<{
329
329
  user_data: z.ZodOptional<z.ZodCustom<Uint8Array, Uint8Array>>;
330
330
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
331
- audio_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
332
- video_parameters: z.ZodOptional<z.ZodRecord<z.core.$ZodRecordKey, z.core.SomeType>>;
331
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
332
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./serialization.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("./serialization.ts").JsonValue, unknown>>>>;
333
333
  peer_id: z.ZodNumber;
334
334
  }, z.core.$strip>;
335
335
  }, z.core.$strip>]>, z.ZodObject<{
package/utility/log.d.ts CHANGED
@@ -14,6 +14,9 @@ export declare enum LogLevel {
14
14
  INFO = 4,
15
15
  DEBUG = 5
16
16
  }
17
+ export declare const LogSymbols: {
18
+ [Level in LogLevel]: string;
19
+ };
17
20
  export declare function tryParseLogFilter(text: string): LogFilter | undefined;
18
21
  export interface LogSink {
19
22
  filter: LogFilter;