UNPKG

livekit-client

Version:

JavaScript/TypeScript client SDK for LiveKit

1 lines 355 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LivekitClient={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}function i(e,t){if(!e)throw new Error(t)}const n=34028234663852886e22,s=-34028234663852886e22,r=4294967295,o=2147483647,a=-2147483648;function c(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>o||e<a)throw new Error("invalid int 32: "+e)}function d(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>r||e<0)throw new Error("invalid uint 32: "+e)}function l(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>n||e<s))throw new Error("invalid float 32: "+e)}const u=Symbol("@bufbuild/protobuf/enum-type");function h(e){const t=e[u];return i(t,"missing enum type on enum object"),t}function p(e,t,i,n){e[u]=m(t,i.map((t=>({no:t.no,name:t.name,localName:e[t.no]}))))}function m(e,t,i){const n=Object.create(null),s=Object.create(null),r=[];for(const e of t){const t=f(e);r.push(t),n[e.name]=t,s[e.no]=t}return{typeName:e,values:r,findName:e=>n[e],findNumber:e=>s[e]}}function g(e,t,i){const n={};for(const e of t){const t=f(e);n[t.localName]=t.no,n[t.no]=t.localName}return p(n,e,t),n}function f(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class v{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const i=this.getType().runtime.bin,n=i.makeReadOptions(t);return i.readMessage(this,n.readerFactory(e),e.byteLength,n),this}fromJson(e,t){const i=this.getType(),n=i.runtime.json,s=n.makeReadOptions(t);return n.readMessage(i,e,s,this),this}fromJsonString(e,t){let i;try{i=JSON.parse(e)}catch(e){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(e instanceof Error?e.message:String(e)))}return this.fromJson(i,t)}toBinary(e){const t=this.getType().runtime.bin,i=t.makeWriteOptions(e),n=i.writerFactory();return t.writeMessage(this,n,i),n.finish()}toJson(e){const t=this.getType().runtime.json,i=t.makeWriteOptions(e);return t.writeMessage(this,i)}toJsonString(e){var t;const i=this.toJson(e);return JSON.stringify(i,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function k(){let e=0,t=0;for(let i=0;i<28;i+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<i,0==(128&n))return this.assertBounds(),[e,t]}let i=this.buf[this.pos++];if(e|=(15&i)<<28,t=(112&i)>>4,0==(128&i))return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<i,0==(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function b(e,t,i){for(let n=0;n<28;n+=7){const s=e>>>n,r=!(s>>>7==0&&0==t),o=255&(r?128|s:s);if(i.push(o),!r)return}const n=e>>>28&15|(7&t)<<4,s=!(t>>3==0);if(i.push(255&(s?128|n:n)),s){for(let e=3;e<31;e+=7){const n=t>>>e,s=!(n>>>7==0),r=255&(s?128|n:n);if(i.push(r),!s)return}i.push(t>>>31&1)}}const y=4294967296;function T(e){const t="-"===e[0];t&&(e=e.slice(1));const i=1e6;let n=0,s=0;function r(t,r){const o=Number(e.slice(t,r));s*=i,n=n*i+o,n>=y&&(s+=n/y|0,n%=y)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),t?E(n,s):S(n,s)}function C(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(y*t+e);const i=16777215&(e>>>24|t<<8),n=t>>16&65535;let s=(16777215&e)+6777216*i+6710656*n,r=i+8147497*n,o=2*n;const a=1e7;return s>=a&&(r+=Math.floor(s/a),s%=a),r>=a&&(o+=Math.floor(r/a),r%=a),o.toString()+w(r)+w(s)}function S(e,t){return{lo:0|e,hi:0|t}}function E(e,t){return t=~t,e?e=1+~e:t+=1,S(e,t)}const w=e=>{const t=String(e);return"0000000".slice(t.length)+t};function P(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let i=0;i<9;i++)t.push(127&e|128),e>>=7;t.push(1)}}function R(){let e=this.buf[this.pos++],t=127&e;if(0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,0==(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,0==(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let t=5;0!=(128&e)&&t<10;t++)e=this.buf[this.pos++];if(0!=(128&e))throw new Error("invalid varint");return this.assertBounds(),t>>>0}const I=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),i=BigInt("9223372036854775807"),n=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const n="bigint"==typeof e?e:BigInt(e);if(n>i||n<t)throw new Error("int64 invalid: ".concat(e));return n},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>s||t<n)throw new Error("uint64 invalid: ".concat(e));return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,i)=>(e.setInt32(0,t,!0),e.setInt32(4,i,!0),e.getBigInt64(0,!0)),uDec:(t,i)=>(e.setInt32(0,t,!0),e.setInt32(4,i,!0),e.getBigUint64(0,!0))}}const t=e=>i(/^-?[0-9]+$/.test(e),"int64 invalid: ".concat(e)),n=e=>i(/^[0-9]+$/.test(e),"uint64 invalid: ".concat(e));return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),n(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),T(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),T(e)),dec:(e,t)=>function(e,t){let i=S(e,t);const n=2147483648&i.hi;n&&(i=E(i.lo,i.hi));const s=C(i.lo,i.hi);return n?"-"+s:s}(e,t),uDec:(e,t)=>C(e,t)}}();var O,x,D;function M(e,t,i){if(t===i)return!0;if(e==O.BYTES){if(!(t instanceof Uint8Array&&i instanceof Uint8Array))return!1;if(t.length!==i.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==i[e])return!1;return!0}switch(e){case O.UINT64:case O.FIXED64:case O.INT64:case O.SFIXED64:case O.SINT64:return t==i}return!1}function N(e,t){switch(e){case O.BOOL:return!1;case O.UINT64:case O.FIXED64:case O.INT64:case O.SFIXED64:case O.SINT64:return 0==t?I.zero:"0";case O.DOUBLE:case O.FLOAT:return 0;case O.BYTES:return new Uint8Array(0);case O.STRING:return"";default:return 0}}function _(e,t){switch(e){case O.BOOL:return!1===t;case O.STRING:return""===t;case O.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}!function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"}(O||(O={})),function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"}(x||(x={})),function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(D||(D={}));class A{constructor(e){this.stack=[],this.textEncoder=null!=e?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),i=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],i),i+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(d(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return c(e),P(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){l(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){d(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){c(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return c(e),P(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),n=I.enc(e);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),n=I.uEnc(e);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=I.enc(e);return b(t.lo,t.hi,this.buf),this}sint64(e){let t=I.enc(e),i=t.hi>>31;return b(t.lo<<1^i,(t.hi<<1|t.lo>>>31)^i,this.buf),this}uint64(e){let t=I.uEnc(e);return b(t.lo,t.hi,this.buf),this}}class L{constructor(e,t){this.varint64=k,this.uint32=R,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,i=7&e;if(t<=0||i<0||i>5)throw new Error("illegal tag: field no "+t+" wire type "+i);return[t,i]}skip(e,t){let i=this.pos;switch(e){case D.Varint:for(;128&this.buf[this.pos++];);break;case D.Bit64:this.pos+=4;case D.Bit32:this.pos+=4;break;case D.LengthDelimited:let i=this.uint32();this.pos+=i;break;case D.StartGroup:for(;;){const[e,i]=this.tag();if(i===D.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(i,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return I.dec(...this.varint64())}uint64(){return I.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),i=-(1&e);return e=(e>>>1|(1&t)<<31)^i,t=t>>>1^i,I.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return I.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return I.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function U(e){const t=e.field.localName,i=Object.create(null);return i[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return N(t.T,t.L);case"message":const e=t.T,i=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}(e),[i,()=>i[t]]}let j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),F=[];for(let e=0;e<j.length;e++)F[j[e].charCodeAt(0)]=e;F["-".charCodeAt(0)]=j.indexOf("+"),F["_".charCodeAt(0)]=j.indexOf("/");const B={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let i,n=new Uint8Array(t),s=0,r=0,o=0;for(let t=0;t<e.length;t++){if(i=F[e.charCodeAt(t)],void 0===i)switch(e[t]){case"=":r=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:o=i,r=1;break;case 1:n[s++]=o<<2|(48&i)>>4,o=i,r=2;break;case 2:n[s++]=(15&o)<<4|(60&i)>>2,o=i,r=3;break;case 3:n[s++]=(3&o)<<6|i,r=0}}if(1==r)throw Error("invalid base64 string.");return n.subarray(0,s)},enc(e){let t,i="",n=0,s=0;for(let r=0;r<e.length;r++)switch(t=e[r],n){case 0:i+=j[t>>2],s=(3&t)<<4,n=1;break;case 1:i+=j[s|t>>4],s=(15&t)<<2,n=2;break;case 2:i+=j[s|t>>6],i+=j[63&t],n=0}return n&&(i+=j[s],i+="=",1==n&&(i+="=")),i}};function V(e,t,i){W(t,e);const n=t.runtime.bin.makeReadOptions(i),s=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let i=e.length-1;i>=0;--i)if(e[i].no==t.no)return[e[i]];return[]}return e.filter((e=>e.no===t.no))}(e.getType().runtime.bin.listUnknownFields(e),t.field),[r,o]=U(t);for(const e of s)t.runtime.bin.readField(r,n.readerFactory(e.data),t.field,e.wireType,n);return o()}function q(e,t,i,n){W(t,e);const s=t.runtime.bin.makeReadOptions(n),r=t.runtime.bin.makeWriteOptions(n);if(K(e,t)){const i=e.getType().runtime.bin.listUnknownFields(e).filter((e=>e.no!=t.field.no));e.getType().runtime.bin.discardUnknownFields(e);for(const t of i)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const o=r.writerFactory();let a=t.field;a.opt||a.repeated||"enum"!=a.kind&&"scalar"!=a.kind||(a=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(a,i,o,r);const c=s.readerFactory(o.finish());for(;c.pos<c.len;){const[t,i]=c.tag(),n=c.skip(i,t);e.getType().runtime.bin.onUnknownField(e,t,i,n)}}function K(e,t){const i=e.getType();return t.extendee.typeName===i.typeName&&!!i.runtime.bin.listUnknownFields(e).find((e=>e.no==t.field.no))}function W(e,t){i(e.extendee.typeName==t.getType().typeName,"extension ".concat(e.typeName," can only be applied to message ").concat(e.extendee.typeName))}function G(e,t){const i=e.localName;if(e.repeated)return t[i].length>0;if(e.oneof)return t[e.oneof.localName].case===i;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[i]:"enum"==e.kind?t[i]!==e.T.values[0].no:!_(e.T,t[i]);case"message":return void 0!==t[i];case"map":return Object.keys(t[i]).length>0}}function H(e,t){const i=e.localName,n=!e.opt&&!e.req;if(e.repeated)t[i]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[i]={};break;case"enum":t[i]=n?e.T.values[0].no:void 0;break;case"scalar":t[i]=n?N(e.T,e.L):void 0;break;case"message":t[i]=void 0}}function J(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(v.prototype).every((t=>t in e&&"function"==typeof e[t])))return!1;const i=e.getType();return null!==i&&"function"==typeof i&&"typeName"in i&&"string"==typeof i.typeName&&(void 0===t||i.typeName==t.typeName)}function Q(e,t){return J(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}O.DOUBLE,O.FLOAT,O.INT64,O.UINT64,O.INT32,O.UINT32,O.BOOL,O.STRING,O.BYTES;const z={ignoreUnknownFields:!1},Y={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function X(e){return e?Object.assign(Object.assign({},z),e):z}function $(e){return e?Object.assign(Object.assign({},Y),e):Y}const Z=Symbol(),ee=Symbol();function te(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":'"'.concat(e.split('"').join('\\"'),'"');default:return String(e)}}function ie(e,t,n,s,r){let o=n.localName;if(n.repeated){if(i("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(te(t)));const a=e[o];for(const e of t){if(null===e)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(te(e)));switch(n.kind){case"message":a.push(n.T.fromJson(e,s));break;case"enum":const t=re(n.T,e,s.ignoreUnknownFields,!0);t!==ee&&a.push(t);break;case"scalar":try{a.push(se(n.T,e,n.L,!0))}catch(t){let i="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(te(e));throw t instanceof Error&&t.message.length>0&&(i+=": ".concat(t.message)),new Error(i)}}}}else if("map"==n.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(te(t)));const i=e[o];for(const[e,o]of Object.entries(t)){if(null===o)throw new Error("cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: map value null"));let a;try{a=ne(n.K,e)}catch(e){let i="cannot decode map key for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(te(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}switch(n.V.kind){case"message":i[a]=n.V.T.fromJson(o,s);break;case"enum":const e=re(n.V.T,o,s.ignoreUnknownFields,!0);e!==ee&&(i[a]=e);break;case"scalar":try{i[a]=se(n.V.T,o,x.BIGINT,!0)}catch(e){let i="cannot decode map value for field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(te(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:o},o="value"),n.kind){case"message":const i=n.T;if(null===t&&"google.protobuf.Value"!=i.typeName)return;let a=e[o];J(a)?a.fromJson(t,s):(e[o]=a=i.fromJson(t,s),i.fieldWrapper&&!n.oneof&&(e[o]=i.fieldWrapper.unwrapField(a)));break;case"enum":const c=re(n.T,t,s.ignoreUnknownFields,!1);switch(c){case Z:H(n,e);break;case ee:break;default:e[o]=c}break;case"scalar":try{const i=se(n.T,t,n.L,!1);if(i===Z)H(n,e);else e[o]=i}catch(e){let i="cannot decode field ".concat(r.typeName,".").concat(n.name," from JSON: ").concat(te(t));throw e instanceof Error&&e.message.length>0&&(i+=": ".concat(e.message)),new Error(i)}}}function ne(e,t){if(e===O.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return se(e,t,x.BIGINT,!0).toString()}function se(e,t,i,n){if(null===t)return n?N(e,i):Z;switch(e){case O.DOUBLE:case O.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const n=Number(t);if(Number.isNaN(n))break;if(!Number.isFinite(n))break;return e==O.FLOAT&&l(n),n;case O.INT32:case O.FIXED32:case O.SFIXED32:case O.SINT32:case O.UINT32:let s;if("number"==typeof t?s=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(s=Number(t)),void 0===s)break;return e==O.UINT32||e==O.FIXED32?d(s):c(s),s;case O.INT64:case O.SFIXED64:case O.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const r=I.parse(t);return i?r.toString():r;case O.FIXED64:case O.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const o=I.uParse(t);return i?o.toString():o;case O.BOOL:if("boolean"!=typeof t)break;return t;case O.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(e){throw new Error("invalid UTF8")}return t;case O.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return B.dec(t)}throw new Error}function re(e,t,i,n){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:n?e.values[0].no:Z;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const n=e.findName(t);if(void 0!==n)return n.no;if(i)return ee}throw new Error("cannot decode enum ".concat(e.typeName," from JSON: ").concat(te(t)))}function oe(e){return!(!e.repeated&&"map"!=e.kind)||!e.oneof&&("message"!=e.kind&&(!e.opt&&!e.req))}function ae(e,t,n){if("map"==e.kind){i("object"==typeof t&&null!=t);const s={},r=Object.entries(t);switch(e.V.kind){case"scalar":for(const[t,i]of r)s[t.toString()]=de(e.V.T,i);break;case"message":for(const[e,t]of r)s[e.toString()]=t.toJson(n);break;case"enum":const t=e.V.T;for(const[e,i]of r)s[e.toString()]=ce(t,i,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?s:void 0}if(e.repeated){i(Array.isArray(t));const s=[];switch(e.kind){case"scalar":for(let i=0;i<t.length;i++)s.push(de(e.T,t[i]));break;case"enum":for(let i=0;i<t.length;i++)s.push(ce(e.T,t[i],n.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)s.push(t[e].toJson(n))}return n.emitDefaultValues||s.length>0?s:void 0}switch(e.kind){case"scalar":return de(e.T,t);case"enum":return ce(e.T,t,n.enumAsInteger);case"message":return Q(e.T,t).toJson(n)}}function ce(e,t,n){var s;if(i("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const r=e.findNumber(t);return null!==(s=null==r?void 0:r.name)&&void 0!==s?s:t}function de(e,t){switch(e){case O.INT32:case O.SFIXED32:case O.SINT32:case O.FIXED32:case O.UINT32:return i("number"==typeof t),t;case O.FLOAT:case O.DOUBLE:return i("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case O.STRING:return i("string"==typeof t),t;case O.BOOL:return i("boolean"==typeof t),t;case O.UINT64:case O.FIXED64:case O.INT64:case O.SFIXED64:case O.SINT64:return i("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case O.BYTES:return i(t instanceof Uint8Array),B.enc(t)}}const le=Symbol("@bufbuild/protobuf/unknown-fields"),ue={readUnknownFields:!0,readerFactory:e=>new L(e)},he={writeUnknownFields:!0,writerFactory:()=>new A};function pe(e){return e?Object.assign(Object.assign({},ue),e):ue}function me(e){return e?Object.assign(Object.assign({},he),e):he}function ge(e,t,i,n,s){let{repeated:r,localName:o}=i;switch(i.oneof&&((e=e[i.oneof.localName]).case!=o&&delete e.value,e.case=o,o="value"),i.kind){case"scalar":case"enum":const a="enum"==i.kind?O.INT32:i.T;let c=ke;if("scalar"==i.kind&&i.L>0&&(c=ve),r){let i=e[o];if(n==D.LengthDelimited&&a!=O.STRING&&a!=O.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)i.push(c(t,a))}else i.push(c(t,a))}else e[o]=c(t,a);break;case"message":const d=i.T;r?e[o].push(fe(t,new d,s,i)):J(e[o])?fe(t,e[o],s,i):(e[o]=fe(t,new d,s,i),!d.fieldWrapper||i.oneof||i.repeated||(e[o]=d.fieldWrapper.unwrapField(e[o])));break;case"map":let[l,u]=function(e,t,i){const n=t.uint32(),s=t.pos+n;let r,o;for(;t.pos<s;){const[n]=t.tag();switch(n){case 1:r=ke(t,e.K);break;case 2:switch(e.V.kind){case"scalar":o=ke(t,e.V.T);break;case"enum":o=t.int32();break;case"message":o=fe(t,new e.V.T,i,void 0)}}}void 0===r&&(r=N(e.K,x.BIGINT));"string"!=typeof r&&"number"!=typeof r&&(r=r.toString());if(void 0===o)switch(e.V.kind){case"scalar":o=N(e.V.T,x.BIGINT);break;case"enum":o=e.V.T.values[0].no;break;case"message":o=new e.V.T}return[r,o]}(i,t,s);e[o][l]=u}}function fe(e,t,i,n){const s=t.getType().runtime.bin,r=null==n?void 0:n.delimited;return s.readMessage(t,e,r?n.no:e.uint32(),i,r),t}function ve(e,t){const i=ke(e,t);return"bigint"==typeof i?i.toString():i}function ke(e,t){switch(t){case O.STRING:return e.string();case O.BOOL:return e.bool();case O.DOUBLE:return e.double();case O.FLOAT:return e.float();case O.INT32:return e.int32();case O.INT64:return e.int64();case O.UINT64:return e.uint64();case O.FIXED64:return e.fixed64();case O.BYTES:return e.bytes();case O.FIXED32:return e.fixed32();case O.SFIXED32:return e.sfixed32();case O.SFIXED64:return e.sfixed64();case O.SINT64:return e.sint64();case O.UINT32:return e.uint32();case O.SINT32:return e.sint32()}}function be(e,t,n,s){i(void 0!==t);const r=e.repeated;switch(e.kind){case"scalar":case"enum":let o="enum"==e.kind?O.INT32:e.T;if(r)if(i(Array.isArray(t)),e.packed)!function(e,t,i,n){if(!n.length)return;e.tag(i,D.LengthDelimited).fork();let[,s]=Se(t);for(let t=0;t<n.length;t++)e[s](n[t]);e.join()}(n,o,e.no,t);else for(const i of t)Ce(n,o,e.no,i);else Ce(n,o,e.no,t);break;case"message":if(r){i(Array.isArray(t));for(const i of t)Te(n,s,e,i)}else Te(n,s,e,t);break;case"map":i("object"==typeof t&&null!=t);for(const[i,r]of Object.entries(t))ye(n,s,e,i,r)}}function ye(e,t,n,s,r){e.tag(n.no,D.LengthDelimited),e.fork();let o=s;switch(n.K){case O.INT32:case O.FIXED32:case O.UINT32:case O.SFIXED32:case O.SINT32:o=Number.parseInt(s);break;case O.BOOL:i("true"==s||"false"==s),o="true"==s}switch(Ce(e,n.K,1,o),n.V.kind){case"scalar":Ce(e,n.V.T,2,r);break;case"enum":Ce(e,O.INT32,2,r);break;case"message":i(void 0!==r),e.tag(2,D.LengthDelimited).bytes(r.toBinary(t))}e.join()}function Te(e,t,i,n){const s=Q(i.T,n);i.delimited?e.tag(i.no,D.StartGroup).raw(s.toBinary(t)).tag(i.no,D.EndGroup):e.tag(i.no,D.LengthDelimited).bytes(s.toBinary(t))}function Ce(e,t,n,s){i(void 0!==s);let[r,o]=Se(t);e.tag(n,r)[o](s)}function Se(e){let t=D.Varint;switch(e){case O.BYTES:case O.STRING:t=D.LengthDelimited;break;case O.DOUBLE:case O.FIXED64:case O.SFIXED64:t=D.Bit64;break;case O.FIXED32:case O.SFIXED32:case O.FLOAT:t=D.Bit32}return[t,O[e].toLowerCase()]}function Ee(e){if(void 0===e)return e;if(J(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function we(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class Pe{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort(((e,t)=>e.no-t.no))),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const i of this.list())i.oneof?i.oneof!==t&&(t=i.oneof,e.push(t)):e.push(i)}return this.members}}function Re(e,t){const i=Oe(e);return t?i:_e(Ne(i))}const Ie=Oe;function Oe(e){let t=!1;const i=[];for(let n=0;n<e.length;n++){let s=e.charAt(n);switch(s){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":i.push(s),t=!1;break;default:t&&(t=!1,s=s.toUpperCase()),i.push(s)}}return i.join("")}const xe=new Set(["constructor","toString","toJSON","valueOf"]),De=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Me=e=>"".concat(e,"$"),Ne=e=>De.has(e)?Me(e):e,_e=e=>xe.has(e)?Me(e):e;class Ae{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Re(e,!1)}addField(e){i(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const Le=(Ue=e=>new Pe(e,(e=>function(e,t){var i,n,s,r,o,a;const c=[];let d;for(const t of"function"==typeof e?e():e){const e=t;if(e.localName=Re(t.name,void 0!==t.oneof),e.jsonName=null!==(i=t.jsonName)&&void 0!==i?i:Ie(t.name),e.repeated=null!==(n=t.repeated)&&void 0!==n&&n,"scalar"==t.kind&&(e.L=null!==(s=t.L)&&void 0!==s?s:x.BIGINT),e.delimited=null!==(r=t.delimited)&&void 0!==r&&r,e.req=null!==(o=t.req)&&void 0!==o&&o,e.opt=null!==(a=t.opt)&&void 0!==a&&a,void 0===t.packed&&(e.packed="enum"==t.kind||"scalar"==t.kind&&t.T!=O.BYTES&&t.T!=O.STRING),void 0!==t.oneof){const i="string"==typeof t.oneof?t.oneof:t.oneof.name;d&&d.name==i||(d=new Ae(i)),e.oneof=d,d.addField(e)}c.push(e)}return c}(e))),je=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const i=t.localName,n=e;if(t.repeated)n[i]=[];else switch(t.kind){case"oneof":n[i]={case:void 0};break;case"enum":n[i]=0;break;case"map":n[i]={};break;case"scalar":n[i]=N(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:X,makeWriteOptions:$,readMessage(e,t,i,n){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(e.typeName," from JSON: ").concat(te(t)));n=null!=n?n:new e;const s=new Map,r=i.typeRegistry;for(const[o,a]of Object.entries(t)){const t=e.fields.findJsonName(o);if(t){if(t.oneof){if(null===a&&"scalar"==t.kind)continue;const i=s.get(t.oneof);if(void 0!==i)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(i,'", "').concat(o,'"'));s.set(t.oneof,o)}ie(n,a,t,i,e)}else{let t=!1;if((null==r?void 0:r.findExtension)&&o.startsWith("[")&&o.endsWith("]")){const s=r.findExtension(o.substring(1,o.length-1));if(s&&s.extendee.typeName==e.typeName){t=!0;const[e,r]=U(s);ie(e,a,s.field,i,s),q(n,s,r(),i)}}if(!t&&!i.ignoreUnknownFields)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: key "').concat(o,'" is unknown'))}}return n},writeMessage(e,t){const i=e.getType(),n={};let s;try{for(s of i.fields.byNumber()){if(!G(s,e)){if(s.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!oe(s))continue}const i=ae(s,s.oneof?e[s.oneof.localName].value:e[s.localName],t);void 0!==i&&(n[t.useProtoFieldName?s.name:s.jsonName]=i)}const r=t.typeRegistry;if(null==r?void 0:r.findExtensionFor)for(const s of i.runtime.bin.listUnknownFields(e)){const o=r.findExtensionFor(i.typeName,s.no);if(o&&K(e,o)){const i=V(e,o,t),s=ae(o.field,i,t);void 0!==s&&(n[o.field.jsonName]=s)}}}catch(e){const t=s?"cannot encode field ".concat(i.typeName,".").concat(s.name," to JSON"):"cannot encode message ".concat(i.typeName," to JSON"),n=e instanceof Error?e.message:String(e);throw new Error(t+(n.length>0?": ".concat(n):""))}return n},readScalar:(e,t,i)=>se(e,t,null!=i?i:x.BIGINT,!0),writeScalar(e,t,i){if(void 0!==t)return i||_(e,t)?de(e,t):void 0},debug:te},bin:{makeReadOptions:pe,makeWriteOptions:me,listUnknownFields(e){var t;return null!==(t=e[le])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[le]},writeUnknownFields(e,t){const i=e[le];if(i)for(const e of i)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,i,n){const s=e;Array.isArray(s[le])||(s[le]=[]),s[le].push({no:t,wireType:i,data:n})},readMessage(e,t,i,n,s){const r=e.getType(),o=s?t.len:t.pos+i;let a,c;for(;t.pos<o&&([a,c]=t.tag(),!0!==s||c!=D.EndGroup);){const i=r.fields.find(a);if(i)ge(e,t,i,c,n);else{const i=t.skip(c,a);n.readUnknownFields&&this.onUnknownField(e,a,c,i)}}if(s&&(c!=D.EndGroup||a!==i))throw new Error("invalid end group tag")},readField:ge,writeMessage(e,t,i){const n=e.getType();for(const s of n.fields.byNumber())if(G(s,e))be(s,s.oneof?e[s.oneof.localName].value:e[s.localName],t,i);else if(s.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(s.name," to binary: required field not set"));return i.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,i,n){void 0!==t&&be(e,t,i,n)}},util:Object.assign(Object.assign({},{setEnumType:p,initPartial(e,t){if(void 0===e)return;const i=t.getType();for(const n of i.fields.byMember()){const i=n.localName,s=t,r=e;if(null!=r[i])switch(n.kind){case"oneof":const e=r[i].case;if(void 0===e)continue;const t=n.findField(e);let o=r[i].value;t&&"message"==t.kind&&!J(o,t.T)?o=new t.T(o):t&&"scalar"===t.kind&&t.T===O.BYTES&&(o=we(o)),s[i]={case:e,value:o};break;case"scalar":case"enum":let a=r[i];n.T===O.BYTES&&(a=n.repeated?a.map(we):we(a)),s[i]=a;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===O.BYTES)for(const[e,t]of Object.entries(r[i]))s[i][e]=we(t);else Object.assign(s[i],r[i]);break;case"message":const e=n.V.T;for(const t of Object.keys(r[i])){let n=r[i][t];e.fieldWrapper||(n=new e(n)),s[i][t]=n}}break;case"message":const c=n.T;if(n.repeated)s[i]=r[i].map((e=>J(e,c)?e:new c(e)));else{const e=r[i];c.fieldWrapper?"google.protobuf.BytesValue"===c.typeName?s[i]=we(e):s[i]=e:s[i]=J(e,c)?e:new c(e)}}}},equals:(e,t,i)=>t===i||!(!t||!i)&&e.fields.byMember().every((e=>{const n=t[e.localName],s=i[e.localName];if(e.repeated){if(n.length!==s.length)return!1;switch(e.kind){case"message":return n.every(((t,i)=>e.T.equals(t,s[i])));case"scalar":return n.every(((t,i)=>M(e.T,t,s[i])));case"enum":return n.every(((e,t)=>M(O.INT32,e,s[t])))}throw new Error("repeated cannot contain ".concat(e.kind))}switch(e.kind){case"message":return e.T.equals(n,s);case"enum":return M(O.INT32,n,s);case"scalar":return M(e.T,n,s);case"oneof":if(n.case!==s.case)return!1;const t=e.findField(n.case);if(void 0===t)return!0;switch(t.kind){case"message":return t.T.equals(n.value,s.value);case"enum":return M(O.INT32,n.value,s.value);case"scalar":return M(t.T,n.value,s.value)}throw new Error("oneof cannot contain ".concat(t.kind));case"map":const i=Object.keys(n).concat(Object.keys(s));switch(e.V.kind){case"message":const t=e.V.T;return i.every((e=>t.equals(n[e],s[e])));case"enum":return i.every((e=>M(O.INT32,n[e],s[e])));case"scalar":const r=e.V.T;return i.every((e=>M(r,n[e],s[e])))}}})),clone(e){const t=e.getType(),i=new t,n=i;for(const i of t.fields.byMember()){const t=e[i.localName];let s;if(i.repeated)s=t.map(Ee);else if("map"==i.kind){s=n[i.localName];for(const[e,i]of Object.entries(t))s[e]=Ee(i)}else s="oneof"==i.kind?i.findField(t.case)?{case:t.case,value:Ee(t.value)}:{case:void 0}:Ee(t);n[i.localName]=s}for(const i of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(n,i.no,i.wireType,i.data);return i}}),{newFieldList:Ue,initFields:je}),makeMessageType(e,t,i){return function(e,t,i,n){var s;const r=null!==(s=null==n?void 0:n.localName)&&void 0!==s?s:t.substring(t.lastIndexOf(".")+1),o={[r]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[r];return Object.setPrototypeOf(o.prototype,new v),Object.assign(o,{runtime:e,typeName:t,fields:e.util.newFieldList(i),fromBinary:(e,t)=>(new o).fromBinary(e,t),fromJson:(e,t)=>(new o).fromJson(e,t),fromJsonString:(e,t)=>(new o).fromJsonString(e,t),equals:(t,i)=>e.util.equals(o,t,i)}),o}(this,e,t,i)},makeEnum:g,makeEnumType:m,getEnumType:h,makeExtension(e,t,i){return function(e,t,i,n){let s;return{typeName:t,extendee:i,get field(){if(!s){const i="function"==typeof n?n():n;i.name=t.split(".").pop(),i.jsonName="[".concat(t,"]"),s=e.util.newFieldList([i]).list()[0]}return s},runtime:e}}(this,e,t,i)}});var Ue,je;const Fe=Le.makeMessageType("livekit.MetricsBatch",(()=>[{no:1,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:2,name:"time_series",kind:"message",T:Be,repeated:!0},{no:3,name:"events",kind:"message",T:qe,repeated:!0}])),Be=Le.makeMessageType("livekit.TimeSeriesMetric",(()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp",kind:"scalar",T:3},{no:5,name:"end_timestamp",kind:"scalar",T:3},{no:6,name:"samples",kind:"message",T:Ve,repeated:!0}])),Ve=Le.makeMessageType("livekit.MetricSample",(()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"value",kind:"scalar",T:2}])),qe=Le.makeMessageType("livekit.EventMetric",(()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp",kind:"scalar",T:3},{no:5,name:"end_timestamp",kind:"scalar",T:3,opt:!0},{no:6,name:"metadata",kind:"scalar",T:9}])),Ke=Le.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),We=Le.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),Ge=Le.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),He=Le.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),Je=Le.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Qe=Le.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"}]),ze=Le.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),Ye=Le.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),Xe=Le.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"}]),$e=Le.makeMessageType("livekit.Room",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:Ze,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:Et}])),Ze=Le.makeMessageType("livekit.Codec",(()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}])),et=Le.makeMessageType("livekit.ParticipantPermission",(()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:Le.getEnumType(We),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}])),tt=Le.makeMessageType("livekit.ParticipantInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Le.getEnumType(it)},{no:4,name:"tracks",kind:"message",T:ot,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:et},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Le.getEnumType(nt)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Le.getEnumType(Qe)}])),it=Le.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),nt=Le.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),st=Le.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),rt=Le.makeMessageType("livekit.SimulcastCodecInfo",(()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:at,repeated:!0}])),ot=Le.makeMessageType("livekit.TrackInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Le.getEnumType(Ke)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:Le.getEnumType(We)},{no:10,name:"layers",kind:"message",T:at,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:rt,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:Le.getEnumType(st)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:Et},{no:19,name:"audio_features",kind:"enum",T:Le.getEnumType(Xe),repeated:!0}])),at=Le.makeMessageType("livekit.VideoLayer",(()=>[{no:1,name:"quality",kind:"enum",T:Le.getEnumType(Ge)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}])),ct=Le.makeMessageType("livekit.DataPacket",(()=>[{no:1,name:"kind",kind:"enum",T:Le.getEnumType(dt)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:ht,oneof:"value"},{no:3,name:"speaker",kind:"message",T:lt,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:pt,oneof:"value"},{no:7,name:"transcription",kind:"message",T:mt,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Fe,oneof:"value"}])),dt=Le.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),lt=Le.makeMessageType("livekit.ActiveSpeakerUpdate",(()=>[{no:1,name:"speakers",kind:"message",T:ut,repeated:!0}])),ut=Le.makeMessageType("livekit.SpeakerInfo",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}])),ht=Le.makeMessageType("livekit.UserPacket",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0}])),pt=Le.makeMessageType("livekit.SipDTMF",(()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}])),mt=Le.makeMessageType("livekit.Transcription",(()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:gt,repeated:!0}])),gt=Le.makeMessageType("livekit.TranscriptionSegment",(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}])),ft=Le.makeMessageType("livekit.ParticipantTracks",(()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}])),vt=Le.makeMessageType("livekit.ServerInfo",(()=>[{no:1,name:"edition",kind:"enum",T:Le.getEnumType(kt)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}])),kt=Le.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),bt=Le.makeMessageType("livekit.ClientInfo",(()=>[{no:1,name:"sdk",kind:"enum",T:Le.getEnumType(yt)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9}])),yt=Le.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"}]),Tt=Le.makeMessageType("livekit.ClientConfiguration",(()=>[{no:1,name:"video",kind:"message",T:Ct},{no:2,name:"screen",kind:"message",T:Ct},{no:3,name:"resume_connection",kind:"enum",T:Le.getEnumType(Je)},{no:4,name:"disabled_codecs",kind:"message",T:St},{no:5,name:"force_relay",kind:"enum",T:Le.getEnumType(Je)}])),Ct=Le.makeMessageType("livekit.VideoConfiguration",(()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Le.getEnumType(Je)}])),St=Le.makeMessageType("livekit.DisabledCodecs",(()=>[{no:1,name:"codecs",kind:"message",T:Ze,repeated:!0},{no:2,name:"publish",kind:"message",T:Ze,repeated:!0}])),Et=Le.makeMessageType("livekit.TimedVersion",(()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}])),wt=Le.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Pt=Le.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),Rt=Le.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),It=Le.makeMessageType("livekit.SignalRequest",(()=>[{no:1,name:"offer",kind:"message",T:jt,oneof:"message"},{no:2,name:"answer",kind:"message",T:jt,oneof:"message"},{no:3,name:"trickle",kind:"message",T:Mt,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Dt,oneof:"message"},{no:5,name:"mute",kind:"message",T:Nt,oneof:"message"},{no:6,name:"subscription",kind:"message",T:Bt,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Vt,oneof:"message"},{no:8,name:"leave",kind:"message",T:Wt,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:Ht,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:ri,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:ai,oneof:"message"},{no:13,name:"simulate",kind:"message",T:di,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:Jt,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:li,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:qt,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:Kt,oneof:"message"}])),Ot=Le.makeMessageType("livekit.SignalResponse",(()=>[{no:1,name:"join",kind:"message",T:_t,oneof:"message"},{no:2,name:"answer",kind:"message",T:jt,oneof:"message"},{no:3,name:"offer",kind:"message",T:jt,oneof:"message"},{no:4,name:"trickle",kind:"message",T:Mt,oneof:"message"},{no:5,name:"update",kind:"message",T:Ft,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Lt,oneof:"message"},{no:8,name:"leave",kind:"message",T:Wt,oneof:"message"},{no:9,name:"mute",kind:"message",T:Nt,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:zt,oneof:"message"},{no:11,name:"room_update",kind:"message",T:Yt,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:$t,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:ei,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:ni,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:oi,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:Ut,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:At,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:ui,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:mi,oneof:"message"},{no:22,name:"request_response",kind:"message",T:gi,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:vi,oneof:"message"}])),xt=Le.makeMessageType("livekit.SimulcastCodec",(()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}])),Dt=Le.makeMessageType("livekit.AddTrackRequest",(()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:Le.getEnumType(Ke)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:Le.getEnumType(We)},{no:9,name:"layers",kind:"message",T:at,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:xt,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:Le.getEnumType(st)},{no:15,name:"stream",kind:"scalar",T:9}])),Mt=Le.makeMessageType("livekit.TrickleRequest",(()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Le.getEnumType(wt)},{no:3,name:"final",kind:"scalar",T:8}])),Nt=Le.makeMessageType("livekit.MuteTrackRequest",(()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}])),_t=Le.makeMessageType("livekit.JoinResponse",(()=>[{no:1,name:"room",kind:"message",T:$e},{no:2,name:"participant",kind:"message",T:tt},{no:3,name:"other_participants",kind:"message",T:tt,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:Qt,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:Tt},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:vt},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:Ze,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}])),At=Le.makeMessageType("livekit.ReconnectResponse",(()=>[{no:1,name:"ice_servers",kind:"message",T:Qt,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Tt}])),Lt=Le.makeMessageType("livekit.TrackPublishedResponse",(()